From 1285ddda8731c6820379f45fcbfc6a70c1cab98f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stine=20=C3=85kredalen?= Date: Thu, 22 Feb 2024 06:41:36 -0800 Subject: [PATCH] Bluetooth: Mesh: Fix shell model clients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Updated shell clients to comply with new bt mesh model structure. * Small fix in shell_sensor_cli.c with array subscript causing a warning. * Added overlay in tests/subsys/../models/testcase.yaml for EMDS and shell. Signed-off-by: Stine Ã…kredalen --- subsys/bluetooth/mesh/shell/shell_bat_cli.c | 2 +- subsys/bluetooth/mesh/shell/shell_ctl_cli.c | 16 +++---- subsys/bluetooth/mesh/shell/shell_dm_cli.c | 6 +-- subsys/bluetooth/mesh/shell/shell_dtt_cli.c | 4 +- subsys/bluetooth/mesh/shell/shell_hsl_cli.c | 22 +++++----- .../mesh/shell/shell_lightness_cli.c | 14 +++--- subsys/bluetooth/mesh/shell/shell_loc_cli.c | 8 ++-- subsys/bluetooth/mesh/shell/shell_lvl_cli.c | 8 ++-- subsys/bluetooth/mesh/shell/shell_onoff_cli.c | 4 +- subsys/bluetooth/mesh/shell/shell_plvl_cli.c | 14 +++--- .../bluetooth/mesh/shell/shell_ponoff_cli.c | 4 +- subsys/bluetooth/mesh/shell/shell_prop_cli.c | 12 ++--- subsys/bluetooth/mesh/shell/shell_scene_cli.c | 16 +++---- .../mesh/shell/shell_scheduler_cli.c | 6 +-- subsys/bluetooth/mesh/shell/shell_time_cli.c | 16 +++---- subsys/bluetooth/mesh/shell/shell_xyl_cli.c | 14 +++--- .../mesh/models/overlay-mesh-emds.conf | 44 +++++++++++++++++++ .../mesh/models/overlay-mesh-shell.conf | 25 +++++++++++ tests/subsys/bluetooth/mesh/models/prj.conf | 2 + .../bluetooth/mesh/models/testcase.yaml | 43 ++---------------- 20 files changed, 158 insertions(+), 122 deletions(-) create mode 100644 tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf create mode 100644 tests/subsys/bluetooth/mesh/models/overlay-mesh-shell.conf diff --git a/subsys/bluetooth/mesh/shell/shell_bat_cli.c b/subsys/bluetooth/mesh/shell/shell_bat_cli.c index 63ac7367b718..7599637d2d20 100644 --- a/subsys/bluetooth/mesh/shell/shell_bat_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_bat_cli.c @@ -20,7 +20,7 @@ static int cmd_battery_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_battery_cli *cli = mod->user_data; + struct bt_mesh_battery_cli *cli = mod->rt->user_data; struct bt_mesh_battery_status rsp; int err = bt_mesh_battery_cli_get(cli, NULL, &rsp); diff --git a/subsys/bluetooth/mesh/shell/shell_ctl_cli.c b/subsys/bluetooth/mesh/shell/shell_ctl_cli.c index 2e693a154265..6f0e8561ab06 100644 --- a/subsys/bluetooth/mesh/shell/shell_ctl_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_ctl_cli.c @@ -31,7 +31,7 @@ static int cmd_ctl_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_light_ctl_cli *cli = mod->user_data; + struct bt_mesh_light_ctl_cli *cli = mod->rt->user_data; struct bt_mesh_light_ctl_status rsp; int err = bt_mesh_light_ctl_get(cli, NULL, &rsp); @@ -58,7 +58,7 @@ static int ctl_set(const struct shell *shell, size_t argc, char *argv[], bool ac return -ENODEV; } - struct bt_mesh_light_ctl_cli *cli = mod->user_data; + struct bt_mesh_light_ctl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_light_ctl_set set = { .params = { @@ -107,7 +107,7 @@ static int cmd_temp_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_light_ctl_cli *cli = mod->user_data; + struct bt_mesh_light_ctl_cli *cli = mod->rt->user_data; struct bt_mesh_light_temp_status rsp; int err = bt_mesh_light_temp_get(cli, NULL, &rsp); @@ -133,7 +133,7 @@ static int temp_set(const struct shell *shell, size_t argc, char *argv[], bool a return -ENODEV; } - struct bt_mesh_light_ctl_cli *cli = mod->user_data; + struct bt_mesh_light_ctl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_light_temp_set set = { .params = { @@ -178,7 +178,7 @@ static int cmd_ctl_default_get(const struct shell *shell, size_t argc, char *arg return -ENODEV; } - struct bt_mesh_light_ctl_cli *cli = mod->user_data; + struct bt_mesh_light_ctl_cli *cli = mod->rt->user_data; struct bt_mesh_light_ctl rsp; int err = bt_mesh_light_ctl_default_get(cli, NULL, &rsp); @@ -203,7 +203,7 @@ static int default_set(const struct shell *shell, size_t argc, char *argv[], boo return -ENODEV; } - struct bt_mesh_light_ctl_cli *cli = mod->user_data; + struct bt_mesh_light_ctl_cli *cli = mod->rt->user_data; struct bt_mesh_light_ctl set = { .light = light, .temp = temp, @@ -246,7 +246,7 @@ static int cmd_temp_range_get(const struct shell *shell, size_t argc, char *argv return -ENODEV; } - struct bt_mesh_light_ctl_cli *cli = mod->user_data; + struct bt_mesh_light_ctl_cli *cli = mod->rt->user_data; struct bt_mesh_light_temp_range_status rsp; int err = bt_mesh_light_temp_range_get(cli, NULL, &rsp); @@ -270,7 +270,7 @@ static int temp_range_set(const struct shell *shell, size_t argc, char *argv[], return -ENODEV; } - struct bt_mesh_light_ctl_cli *cli = mod->user_data; + struct bt_mesh_light_ctl_cli *cli = mod->rt->user_data; struct bt_mesh_light_temp_range set = { .min = min, .max = max, diff --git a/subsys/bluetooth/mesh/shell/shell_dm_cli.c b/subsys/bluetooth/mesh/shell/shell_dm_cli.c index aeb5db703b19..54b63270053f 100644 --- a/subsys/bluetooth/mesh/shell/shell_dm_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_dm_cli.c @@ -40,7 +40,7 @@ static int cmd_cfg(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_dm_cli *cli = mod->user_data; + struct bt_mesh_dm_cli *cli = mod->rt->user_data; struct bt_mesh_dm_cli_cfg_status rsp; err = bt_mesh_dm_cli_config(cli, NULL, (argc == 1) ? NULL : &set, &rsp); @@ -120,7 +120,7 @@ static int cmd_dm_start(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_dm_cli *cli = mod->user_data; + struct bt_mesh_dm_cli *cli = mod->rt->user_data; struct bt_mesh_dm_cli_results rsp; err = bt_mesh_dm_cli_measurement_start(cli, NULL, &set, &rsp); @@ -147,7 +147,7 @@ static int cmd_result_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_dm_cli *cli = mod->user_data; + struct bt_mesh_dm_cli *cli = mod->rt->user_data; struct bt_mesh_dm_cli_results rsp; err = bt_mesh_dm_cli_results_get(cli, NULL, count, &rsp); diff --git a/subsys/bluetooth/mesh/shell/shell_dtt_cli.c b/subsys/bluetooth/mesh/shell/shell_dtt_cli.c index da8bc1c6c619..c88e0a49f9bf 100644 --- a/subsys/bluetooth/mesh/shell/shell_dtt_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_dtt_cli.c @@ -27,7 +27,7 @@ static int cmd_dtt_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_dtt_cli *cli = mod->user_data; + struct bt_mesh_dtt_cli *cli = mod->rt->user_data; int32_t rsp; int err = bt_mesh_dtt_get(cli, NULL, &rsp); @@ -50,7 +50,7 @@ static int dtt_set(const struct shell *shell, size_t argc, char *argv[], bool ac return -ENODEV; } - struct bt_mesh_dtt_cli *cli = mod->user_data; + struct bt_mesh_dtt_cli *cli = mod->rt->user_data; if (acked) { int32_t rsp; diff --git a/subsys/bluetooth/mesh/shell/shell_hsl_cli.c b/subsys/bluetooth/mesh/shell/shell_hsl_cli.c index bea9e6bc1074..96026df5a12d 100644 --- a/subsys/bluetooth/mesh/shell/shell_hsl_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_hsl_cli.c @@ -31,7 +31,7 @@ static int cmd_hsl_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_light_hsl_status rsp; int err = bt_mesh_light_hsl_get(cli, NULL, &rsp); @@ -58,7 +58,7 @@ static int hsl_set(const struct shell *shell, size_t argc, char *argv[], bool ac return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_light_hsl_params set = { .params = { @@ -96,7 +96,7 @@ static int cmd_hsl_target_get(const struct shell *shell, size_t argc, char *argv return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_light_hsl_status rsp; int err = bt_mesh_light_hsl_target_get(cli, NULL, &rsp); @@ -128,7 +128,7 @@ static int cmd_hsl_default_get(const struct shell *shell, size_t argc, char *arg return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_light_hsl rsp; int err = bt_mesh_light_hsl_default_get(cli, NULL, &rsp); @@ -153,7 +153,7 @@ static int hsl_default_set(const struct shell *shell, size_t argc, char *argv[], return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_light_hsl set = { .lightness = light, .hue = hue, @@ -199,7 +199,7 @@ static int cmd_hsl_range_get(const struct shell *shell, size_t argc, char *argv[ return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_light_hsl_range_status rsp; int err = bt_mesh_light_hsl_range_get(cli, NULL, &rsp); @@ -225,7 +225,7 @@ static int hsl_range_set(const struct shell *shell, size_t argc, char *argv[], b return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_light_hue_sat_range set = { .min.hue = hue_min, .max.hue = hue_max, @@ -268,7 +268,7 @@ static int cmd_hue_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_light_hue_status rsp; int err = bt_mesh_light_hue_get(cli, NULL, &rsp); @@ -293,7 +293,7 @@ static int hue_set(const struct shell *shell, size_t argc, char *argv[], bool ac return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_light_hue set = { .lvl = lvl, .transition = (argc > 2) ? &trans : NULL }; @@ -333,7 +333,7 @@ static int cmd_saturation_get(const struct shell *shell, size_t argc, char *argv return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_light_sat_status rsp; int err = bt_mesh_light_saturation_get(cli, NULL, &rsp); @@ -358,7 +358,7 @@ static int saturation_set(const struct shell *shell, size_t argc, char *argv[], return -ENODEV; } - struct bt_mesh_light_hsl_cli *cli = mod->user_data; + struct bt_mesh_light_hsl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_light_sat set = { .lvl = lvl, .transition = (argc > 2) ? &trans : NULL }; diff --git a/subsys/bluetooth/mesh/shell/shell_lightness_cli.c b/subsys/bluetooth/mesh/shell/shell_lightness_cli.c index d14f52d2f3b6..7e38c9f7fe08 100644 --- a/subsys/bluetooth/mesh/shell/shell_lightness_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_lightness_cli.c @@ -28,7 +28,7 @@ static int cmd_light_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_lightness_cli *cli = mod->user_data; + struct bt_mesh_lightness_cli *cli = mod->rt->user_data; struct bt_mesh_lightness_status rsp; int err = bt_mesh_lightness_cli_light_get(cli, NULL, &rsp); @@ -53,7 +53,7 @@ static int light_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_lightness_cli *cli = mod->user_data; + struct bt_mesh_lightness_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_lightness_set set = { .lvl = lvl, .transition = (argc > 2) ? &trans : NULL }; @@ -93,7 +93,7 @@ static int cmd_range_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_lightness_cli *cli = mod->user_data; + struct bt_mesh_lightness_cli *cli = mod->rt->user_data; struct bt_mesh_lightness_range_status rsp; int err = bt_mesh_lightness_cli_range_get(cli, NULL, &rsp); @@ -117,7 +117,7 @@ static int range_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_lightness_cli *cli = mod->user_data; + struct bt_mesh_lightness_cli *cli = mod->rt->user_data; struct bt_mesh_lightness_range set = { .min = min, .max = max }; if (acked) { @@ -154,7 +154,7 @@ static int cmd_default_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_lightness_cli *cli = mod->user_data; + struct bt_mesh_lightness_cli *cli = mod->rt->user_data; uint16_t rsp; int err = bt_mesh_lightness_cli_default_get(cli, NULL, &rsp); @@ -177,7 +177,7 @@ static int default_set(const struct shell *shell, size_t argc, char *argv[], boo return -ENODEV; } - struct bt_mesh_lightness_cli *cli = mod->user_data; + struct bt_mesh_lightness_cli *cli = mod->rt->user_data; if (acked) { uint16_t rsp; @@ -206,7 +206,7 @@ static int cmd_last_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_lightness_cli *cli = mod->user_data; + struct bt_mesh_lightness_cli *cli = mod->rt->user_data; uint16_t rsp; int err = bt_mesh_lightness_cli_last_get(cli, NULL, &rsp); diff --git a/subsys/bluetooth/mesh/shell/shell_loc_cli.c b/subsys/bluetooth/mesh/shell/shell_loc_cli.c index 37d8d061eaae..e3518feff75c 100644 --- a/subsys/bluetooth/mesh/shell/shell_loc_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_loc_cli.c @@ -28,7 +28,7 @@ static int cmd_loc_global_get(const struct shell *shell, size_t argc, char *argv return -ENODEV; } - struct bt_mesh_loc_cli *cli = mod->user_data; + struct bt_mesh_loc_cli *cli = mod->rt->user_data; struct bt_mesh_loc_global rsp; int err = bt_mesh_loc_cli_global_get(cli, NULL, &rsp); @@ -53,7 +53,7 @@ static int global_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_loc_cli *cli = mod->user_data; + struct bt_mesh_loc_cli *cli = mod->rt->user_data; struct bt_mesh_loc_global set = { .latitude = latitude, .longitude = longitude, @@ -99,7 +99,7 @@ static int cmd_loc_local_get(const struct shell *shell, size_t argc, char *argv[ return -ENODEV; } - struct bt_mesh_loc_cli *cli = mod->user_data; + struct bt_mesh_loc_cli *cli = mod->rt->user_data; struct bt_mesh_loc_local rsp; int err = bt_mesh_loc_cli_local_get(cli, NULL, &rsp); @@ -128,7 +128,7 @@ static int local_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_loc_cli *cli = mod->user_data; + struct bt_mesh_loc_cli *cli = mod->rt->user_data; struct bt_mesh_loc_local set = { .north = north, .east = east, diff --git a/subsys/bluetooth/mesh/shell/shell_lvl_cli.c b/subsys/bluetooth/mesh/shell/shell_lvl_cli.c index 4b74e7b8f42f..d1d435960cca 100644 --- a/subsys/bluetooth/mesh/shell/shell_lvl_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_lvl_cli.c @@ -28,7 +28,7 @@ static int cmd_lvl_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_lvl_cli *cli = mod->user_data; + struct bt_mesh_lvl_cli *cli = mod->rt->user_data; struct bt_mesh_lvl_status rsp; int err = bt_mesh_lvl_cli_get(cli, NULL, &rsp); @@ -53,7 +53,7 @@ static int lvl_set(const struct shell *shell, size_t argc, char *argv[], bool ac return -ENODEV; } - struct bt_mesh_lvl_cli *cli = mod->user_data; + struct bt_mesh_lvl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_lvl_set set = { .lvl = lvl, @@ -97,7 +97,7 @@ static int delta_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_lvl_cli *cli = mod->user_data; + struct bt_mesh_lvl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_lvl_delta_set set = { .delta = delta, @@ -141,7 +141,7 @@ static int move_set(const struct shell *shell, size_t argc, char *argv[], bool a return -ENODEV; } - struct bt_mesh_lvl_cli *cli = mod->user_data; + struct bt_mesh_lvl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_lvl_move_set set = { .delta = delta, diff --git a/subsys/bluetooth/mesh/shell/shell_onoff_cli.c b/subsys/bluetooth/mesh/shell/shell_onoff_cli.c index e07f2fa3b72b..76bdf48c2678 100644 --- a/subsys/bluetooth/mesh/shell/shell_onoff_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_onoff_cli.c @@ -28,7 +28,7 @@ static int cmd_onoff_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_onoff_cli *cli = mod->user_data; + struct bt_mesh_onoff_cli *cli = mod->rt->user_data; struct bt_mesh_onoff_status rsp; int err = bt_mesh_onoff_cli_get(cli, NULL, &rsp); @@ -53,7 +53,7 @@ static int onoff_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_onoff_cli *cli = mod->user_data; + struct bt_mesh_onoff_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_onoff_set set = { .on_off = on_off, .transition = (argc > 2) ? &trans : NULL }; diff --git a/subsys/bluetooth/mesh/shell/shell_plvl_cli.c b/subsys/bluetooth/mesh/shell/shell_plvl_cli.c index a815d1968099..30bd448ae8c8 100644 --- a/subsys/bluetooth/mesh/shell/shell_plvl_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_plvl_cli.c @@ -28,7 +28,7 @@ static int cmd_power_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_plvl_cli *cli = mod->user_data; + struct bt_mesh_plvl_cli *cli = mod->rt->user_data; struct bt_mesh_plvl_status rsp; int err = bt_mesh_plvl_cli_power_get(cli, NULL, &rsp); @@ -53,7 +53,7 @@ static int power_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_plvl_cli *cli = mod->user_data; + struct bt_mesh_plvl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_plvl_set set = { .power_lvl = lvl, .transition = (argc > 2) ? &trans : NULL }; @@ -93,7 +93,7 @@ static int cmd_range_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_plvl_cli *cli = mod->user_data; + struct bt_mesh_plvl_cli *cli = mod->rt->user_data; struct bt_mesh_plvl_range_status rsp; int err = bt_mesh_plvl_cli_range_get(cli, NULL, &rsp); @@ -117,7 +117,7 @@ static int range_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_plvl_cli *cli = mod->user_data; + struct bt_mesh_plvl_cli *cli = mod->rt->user_data; struct bt_mesh_plvl_range set = { .min = min, .max = max }; if (acked) { @@ -154,7 +154,7 @@ static int cmd_default_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_plvl_cli *cli = mod->user_data; + struct bt_mesh_plvl_cli *cli = mod->rt->user_data; uint16_t rsp; int err = bt_mesh_plvl_cli_default_get(cli, NULL, &rsp); @@ -177,7 +177,7 @@ static int default_set(const struct shell *shell, size_t argc, char *argv[], boo return -ENODEV; } - struct bt_mesh_plvl_cli *cli = mod->user_data; + struct bt_mesh_plvl_cli *cli = mod->rt->user_data; if (acked) { uint16_t rsp; @@ -206,7 +206,7 @@ static int cmd_last_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_plvl_cli *cli = mod->user_data; + struct bt_mesh_plvl_cli *cli = mod->rt->user_data; uint16_t rsp; int err = bt_mesh_plvl_cli_last_get(cli, NULL, &rsp); diff --git a/subsys/bluetooth/mesh/shell/shell_ponoff_cli.c b/subsys/bluetooth/mesh/shell/shell_ponoff_cli.c index 4aafb0dd8e21..9cba7fbdece5 100644 --- a/subsys/bluetooth/mesh/shell/shell_ponoff_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_ponoff_cli.c @@ -27,7 +27,7 @@ static int cmd_on_power_up_get(const struct shell *shell, size_t argc, char *arg return -ENODEV; } - struct bt_mesh_ponoff_cli *cli = mod->user_data; + struct bt_mesh_ponoff_cli *cli = mod->rt->user_data; enum bt_mesh_on_power_up rsp; int err = bt_mesh_ponoff_cli_on_power_up_get(cli, NULL, &rsp); @@ -50,7 +50,7 @@ static int on_power_up_set(const struct shell *shell, size_t argc, char *argv[], return -ENODEV; } - struct bt_mesh_ponoff_cli *cli = mod->user_data; + struct bt_mesh_ponoff_cli *cli = mod->rt->user_data; if (acked) { enum bt_mesh_on_power_up rsp; diff --git a/subsys/bluetooth/mesh/shell/shell_prop_cli.c b/subsys/bluetooth/mesh/shell/shell_prop_cli.c index 85e359cee095..ec405ce65ec9 100644 --- a/subsys/bluetooth/mesh/shell/shell_prop_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_prop_cli.c @@ -44,7 +44,7 @@ static int cmd_prop_client_props_get(const struct shell *shell, size_t argc, cha return -ENODEV; } - struct bt_mesh_prop_cli *cli = mod->user_data; + struct bt_mesh_prop_cli *cli = mod->rt->user_data; uint16_t ids[CONFIG_BT_MESH_PROP_MAXCOUNT]; struct bt_mesh_prop_list rsp = { .ids = &ids[0], .count = CONFIG_BT_MESH_PROP_MAXCOUNT }; @@ -68,7 +68,7 @@ static int cmd_prop_props_get(const struct shell *shell, size_t argc, char *argv return -ENODEV; } - struct bt_mesh_prop_cli *cli = mod->user_data; + struct bt_mesh_prop_cli *cli = mod->rt->user_data; uint16_t ids[CONFIG_BT_MESH_PROP_MAXCOUNT]; struct bt_mesh_prop_list rsp = { .ids = &ids[0], .count = CONFIG_BT_MESH_PROP_MAXCOUNT }; @@ -100,7 +100,7 @@ static int cmd_prop_prop_get(const struct shell *shell, size_t argc, char *argv[ return -ENODEV; } - struct bt_mesh_prop_cli *cli = mod->user_data; + struct bt_mesh_prop_cli *cli = mod->rt->user_data; uint8_t value[CONFIG_BT_MESH_PROP_MAXSIZE]; struct bt_mesh_prop_val rsp = { .value = &value[0], .size = CONFIG_BT_MESH_PROP_MAXSIZE }; @@ -125,7 +125,7 @@ static int user_prop_set(const struct shell *shell, size_t argc, char *argv[], b return -ENODEV; } - struct bt_mesh_prop_cli *cli = mod->user_data; + struct bt_mesh_prop_cli *cli = mod->rt->user_data; struct bt_mesh_prop_val set = { .meta.id = id, .value = val, @@ -172,7 +172,7 @@ static int admin_prop_set(const struct shell *shell, size_t argc, char *argv[], return -ENODEV; } - struct bt_mesh_prop_cli *cli = mod->user_data; + struct bt_mesh_prop_cli *cli = mod->rt->user_data; struct bt_mesh_prop_val set = { .meta.id = id, .meta.user_access = access, @@ -218,7 +218,7 @@ static int mfr_prop_set(const struct shell *shell, size_t argc, char *argv[], bo return -ENODEV; } - struct bt_mesh_prop_cli *cli = mod->user_data; + struct bt_mesh_prop_cli *cli = mod->rt->user_data; struct bt_mesh_prop set = { .id = id, .user_access = access, diff --git a/subsys/bluetooth/mesh/shell/shell_scene_cli.c b/subsys/bluetooth/mesh/shell/shell_scene_cli.c index 9104c6856162..4dccf77470ca 100644 --- a/subsys/bluetooth/mesh/shell/shell_scene_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_scene_cli.c @@ -33,7 +33,7 @@ static int cmd_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_scene_cli *cli = mod->user_data; + struct bt_mesh_scene_cli *cli = mod->rt->user_data; struct bt_mesh_scene_state rsp; int err = bt_mesh_scene_cli_get(cli, NULL, &rsp); @@ -59,11 +59,11 @@ static int cmd_register_get(const struct shell *shell, size_t argc, char *argv[] return -ENODEV; } - struct bt_mesh_scene_cli *cli = mod->user_data; + struct bt_mesh_scene_cli *cli = mod->rt->user_data; uint16_t scenes[SHELL_SENSOR_CLI_REG_CNT_MAX]; struct bt_mesh_scene_register rsp = { .count = SHELL_SENSOR_CLI_REG_CNT_MAX, - .scenes = &scenes[0], + .scenes = scenes, }; int err = bt_mesh_scene_cli_register_get(cli, NULL, &rsp); @@ -86,13 +86,13 @@ static int store(const struct shell *shell, size_t argc, char *argv[], bool acke return -ENODEV; } - struct bt_mesh_scene_cli *cli = mod->user_data; + struct bt_mesh_scene_cli *cli = mod->rt->user_data; if (acked) { uint16_t scenes[CONFIG_BT_MESH_SCENES_MAX]; struct bt_mesh_scene_register rsp = { .count = CONFIG_BT_MESH_SCENES_MAX, - .scenes = &scenes[0], + .scenes = scenes, }; err = bt_mesh_scene_cli_store(cli, NULL, scene, &rsp); @@ -127,13 +127,13 @@ static int scene_del(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_scene_cli *cli = mod->user_data; + struct bt_mesh_scene_cli *cli = mod->rt->user_data; if (acked) { uint16_t scenes[CONFIG_BT_MESH_SCENES_MAX]; struct bt_mesh_scene_register rsp = { .count = CONFIG_BT_MESH_SCENES_MAX, - .scenes = &scenes[0], + .scenes = scenes, }; err = bt_mesh_scene_cli_delete(cli, NULL, scene, &rsp); @@ -170,7 +170,7 @@ static int recall(const struct shell *shell, size_t argc, char *argv[], bool ack return -ENODEV; } - struct bt_mesh_scene_cli *cli = mod->user_data; + struct bt_mesh_scene_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; if (acked) { diff --git a/subsys/bluetooth/mesh/shell/shell_scheduler_cli.c b/subsys/bluetooth/mesh/shell/shell_scheduler_cli.c index 6bb3a3699bf3..131f86c79728 100644 --- a/subsys/bluetooth/mesh/shell/shell_scheduler_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_scheduler_cli.c @@ -24,7 +24,7 @@ static int cmd_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_scheduler_cli *cli = mod->user_data; + struct bt_mesh_scheduler_cli *cli = mod->rt->user_data; uint16_t rsp; int err = bt_mesh_scheduler_cli_get(cli, NULL, &rsp); @@ -63,7 +63,7 @@ static int cmd_action_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_scheduler_cli *cli = mod->user_data; + struct bt_mesh_scheduler_cli *cli = mod->rt->user_data; struct bt_mesh_schedule_entry rsp; err = bt_mesh_scheduler_cli_action_get(cli, NULL, idx, &rsp); @@ -113,7 +113,7 @@ static int action_set(const struct shell *shell, size_t argc, char *argv[], bool return -ENODEV; } - struct bt_mesh_scheduler_cli *cli = mod->user_data; + struct bt_mesh_scheduler_cli *cli = mod->rt->user_data; if (acked) { struct bt_mesh_schedule_entry rsp; diff --git a/subsys/bluetooth/mesh/shell/shell_time_cli.c b/subsys/bluetooth/mesh/shell/shell_time_cli.c index a1fc2caeb210..8c099efc2511 100644 --- a/subsys/bluetooth/mesh/shell/shell_time_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_time_cli.c @@ -31,7 +31,7 @@ static int cmd_time_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_time_cli *cli = mod->user_data; + struct bt_mesh_time_cli *cli = mod->rt->user_data; struct bt_mesh_time_status rsp; int err = bt_mesh_time_cli_time_get(cli, NULL, &rsp); @@ -59,7 +59,7 @@ static int cmd_time_set(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_time_cli *cli = mod->user_data; + struct bt_mesh_time_cli *cli = mod->rt->user_data; struct bt_mesh_time_status set = { .tai.sec = sec, .tai.subsec = subsec, .uncertainty = uncertainty, @@ -88,7 +88,7 @@ static int cmd_zone_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_time_cli *cli = mod->user_data; + struct bt_mesh_time_cli *cli = mod->rt->user_data; struct bt_mesh_time_zone_status rsp; int err = bt_mesh_time_cli_zone_get(cli, NULL, &rsp); @@ -112,7 +112,7 @@ static int cmd_zone_set(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_time_cli *cli = mod->user_data; + struct bt_mesh_time_cli *cli = mod->rt->user_data; struct bt_mesh_time_zone_change set = { .new_offset = new_offset, .timestamp = ts }; struct bt_mesh_time_zone_status rsp; @@ -137,7 +137,7 @@ static int cmd_tai_utc_delta_get(const struct shell *shell, size_t argc, char *a return -ENODEV; } - struct bt_mesh_time_cli *cli = mod->user_data; + struct bt_mesh_time_cli *cli = mod->rt->user_data; struct bt_mesh_time_tai_utc_delta_status rsp; int err = bt_mesh_time_cli_tai_utc_delta_get(cli, NULL, &rsp); @@ -161,7 +161,7 @@ static int cmd_tai_utc_delta_set(const struct shell *shell, size_t argc, char *a return -ENODEV; } - struct bt_mesh_time_cli *cli = mod->user_data; + struct bt_mesh_time_cli *cli = mod->rt->user_data; struct bt_mesh_time_tai_utc_change set = { .delta_new = delta_new, .timestamp = ts }; struct bt_mesh_time_tai_utc_delta_status rsp; @@ -183,7 +183,7 @@ static int cmd_role_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_time_cli *cli = mod->user_data; + struct bt_mesh_time_cli *cli = mod->rt->user_data; uint8_t rsp; int err = bt_mesh_time_cli_role_get(cli, NULL, &rsp); @@ -206,7 +206,7 @@ static int cmd_role_set(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_time_cli *cli = mod->user_data; + struct bt_mesh_time_cli *cli = mod->rt->user_data; uint8_t rsp; err = bt_mesh_time_cli_role_set(cli, NULL, &role, &rsp); diff --git a/subsys/bluetooth/mesh/shell/shell_xyl_cli.c b/subsys/bluetooth/mesh/shell/shell_xyl_cli.c index adadf48b012e..f835d9ffb2f3 100644 --- a/subsys/bluetooth/mesh/shell/shell_xyl_cli.c +++ b/subsys/bluetooth/mesh/shell/shell_xyl_cli.c @@ -31,7 +31,7 @@ static int cmd_xyl_get(const struct shell *shell, size_t argc, char *argv[]) return -ENODEV; } - struct bt_mesh_light_xyl_cli *cli = mod->user_data; + struct bt_mesh_light_xyl_cli *cli = mod->rt->user_data; struct bt_mesh_light_xyl_status rsp; int err = bt_mesh_light_xyl_get(cli, NULL, &rsp); @@ -58,7 +58,7 @@ static int xyl_set(const struct shell *shell, size_t argc, char *argv[], bool ac return -ENODEV; } - struct bt_mesh_light_xyl_cli *cli = mod->user_data; + struct bt_mesh_light_xyl_cli *cli = mod->rt->user_data; struct bt_mesh_model_transition trans = { .time = time, .delay = delay }; struct bt_mesh_light_xyl_set_params set = { .params = { @@ -96,7 +96,7 @@ static int cmd_xyl_target_get(const struct shell *shell, size_t argc, char *argv return -ENODEV; } - struct bt_mesh_light_xyl_cli *cli = mod->user_data; + struct bt_mesh_light_xyl_cli *cli = mod->rt->user_data; struct bt_mesh_light_xyl_status rsp; int err = bt_mesh_light_xyl_target_get(cli, NULL, &rsp); @@ -119,7 +119,7 @@ static int cmd_xyl_default_get(const struct shell *shell, size_t argc, char *arg return -ENODEV; } - struct bt_mesh_light_xyl_cli *cli = mod->user_data; + struct bt_mesh_light_xyl_cli *cli = mod->rt->user_data; struct bt_mesh_light_xyl rsp; int err = bt_mesh_light_xyl_default_get(cli, NULL, &rsp); @@ -144,7 +144,7 @@ static int xyl_default_set(const struct shell *shell, size_t argc, char *argv[], return -ENODEV; } - struct bt_mesh_light_xyl_cli *cli = mod->user_data; + struct bt_mesh_light_xyl_cli *cli = mod->rt->user_data; struct bt_mesh_light_xyl set = { .lightness = light, .xy.x = x, @@ -190,7 +190,7 @@ static int cmd_xyl_range_get(const struct shell *shell, size_t argc, char *argv[ return -ENODEV; } - struct bt_mesh_light_xyl_cli *cli = mod->user_data; + struct bt_mesh_light_xyl_cli *cli = mod->rt->user_data; struct bt_mesh_light_xyl_range_status rsp; int err = bt_mesh_light_xyl_range_get(cli, NULL, &rsp); @@ -216,7 +216,7 @@ static int xyl_range_set(const struct shell *shell, size_t argc, char *argv[], b return -ENODEV; } - struct bt_mesh_light_xyl_cli *cli = mod->user_data; + struct bt_mesh_light_xyl_cli *cli = mod->rt->user_data; struct bt_mesh_light_xy_range set = { .min.x = x_min, .min.y = y_min, diff --git a/tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf b/tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf new file mode 100644 index 000000000000..cf725466df2c --- /dev/null +++ b/tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf @@ -0,0 +1,44 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_BT_SETTINGS=y +CONFIG_FLASH_MAP=y +CONFIG_PM_SINGLE_IMAGE=y +CONFIG_EMDS=y +CONFIG_BT_MESH_PLVL_SRV=y +CONFIG_BT_MESH_LIGHT_HUE_SRV=y +CONFIG_BT_MESH_LIGHT_SAT_SRV=y +CONFIG_BT_MESH_LIGHT_TEMP_SRV=y +CONFIG_BT_MESH_LIGHT_XYL_SRV=y +CONFIG_BT_MESH_LIGHTNESS_SRV=y +CONFIG_BT_MESH_ONOFF_SRV=n +CONFIG_BT_MESH_ONOFF_CLI=n +CONFIG_BT_MESH_TIME_SRV=n +CONFIG_BT_MESH_TIME_CLI=n +CONFIG_BT_MESH_LVL_SRV=n +CONFIG_BT_MESH_LVL_CLI=n +CONFIG_BT_MESH_DTT_SRV=n +CONFIG_BT_MESH_DTT_CLI=n +CONFIG_BT_MESH_PONOFF_SRV=n +CONFIG_BT_MESH_PONOFF_CLI=n +CONFIG_BT_MESH_PLVL_CLI=n +CONFIG_BT_MESH_BATTERY_SRV=n +CONFIG_BT_MESH_BATTERY_CLI=n +CONFIG_BT_MESH_LOC_SRV=n +CONFIG_BT_MESH_LOC_CLI=n +CONFIG_BT_MESH_PROP_SRV=n +CONFIG_BT_MESH_PROP_CLI=n +CONFIG_BT_MESH_LIGHTNESS_CLI=n +CONFIG_BT_MESH_LIGHT_CTRL_SRV=y +CONFIG_BT_MESH_LIGHT_CTRL_CLI=n +CONFIG_BT_MESH_LIGHT_CTL_CLI=n +CONFIG_BT_MESH_LIGHT_CTL_SRV=n +CONFIG_BT_MESH_SENSOR_SRV=n +CONFIG_BT_MESH_SENSOR_CLI=n +CONFIG_BT_MESH_SCENE_CLI=n +CONFIG_BT_MESH_LIGHT_XYL_CLI=n +CONFIG_BT_MESH_LIGHT_HSL_SRV=n +CONFIG_BT_MESH_LIGHT_HSL_CLI=n diff --git a/tests/subsys/bluetooth/mesh/models/overlay-mesh-shell.conf b/tests/subsys/bluetooth/mesh/models/overlay-mesh-shell.conf new file mode 100644 index 000000000000..bfbadc63ea1f --- /dev/null +++ b/tests/subsys/bluetooth/mesh/models/overlay-mesh-shell.conf @@ -0,0 +1,25 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_BT_MESH_SHELL=y +CONFIG_BT_MESH_SHELL_ONOFF_CLI=y +CONFIG_BT_MESH_SHELL_LVL_CLI=y +CONFIG_BT_MESH_SHELL_DTT_CLI=y +CONFIG_BT_MESH_SHELL_PONOFF_CLI=y +CONFIG_BT_MESH_SHELL_PLVL_CLI=y +CONFIG_BT_MESH_SHELL_BATTERY_CLI=y +CONFIG_BT_MESH_SHELL_LOC_CLI=y +CONFIG_BT_MESH_SHELL_PROP_CLI=y +CONFIG_BT_MESH_SHELL_LIGHTNESS_CLI=y +CONFIG_BT_MESH_SHELL_LIGHT_CTL_CLI=y +CONFIG_BT_MESH_SHELL_LIGHT_HSL_CLI=y +CONFIG_BT_MESH_SHELL_LIGHT_XYL_CLI=y +CONFIG_BT_MESH_SHELL_LIGHT_CTRL_CLI=y +CONFIG_BT_MESH_SHELL_TIME_CLI=y +CONFIG_BT_MESH_SHELL_SCENE_CLI=y +CONFIG_BT_MESH_SHELL_SCHEDULER_CLI=y +CONFIG_BT_MESH_SHELL_SENSOR_CLI=y +CONFIG_BT_MESH_SHELL_DM_CLI=y diff --git a/tests/subsys/bluetooth/mesh/models/prj.conf b/tests/subsys/bluetooth/mesh/models/prj.conf index e55dffcfdda6..d453f27bb413 100644 --- a/tests/subsys/bluetooth/mesh/models/prj.conf +++ b/tests/subsys/bluetooth/mesh/models/prj.conf @@ -65,3 +65,5 @@ CONFIG_BT_MESH_LIGHT_SAT_SRV=y CONFIG_BT_MESH_LIGHT_HSL_SRV=y CONFIG_BT_MESH_LIGHT_HSL_CLI=y CONFIG_BT_MESH_SCHEDULER_CLI=y +CONFIG_DM_MODULE=y +CONFIG_BT_MESH_DM_CLI=y diff --git a/tests/subsys/bluetooth/mesh/models/testcase.yaml b/tests/subsys/bluetooth/mesh/models/testcase.yaml index 445066b27dcf..e25149f453ff 100644 --- a/tests/subsys/bluetooth/mesh/models/testcase.yaml +++ b/tests/subsys/bluetooth/mesh/models/testcase.yaml @@ -18,47 +18,12 @@ tests: - CONFIG_BT_SETTINGS=y - CONFIG_BT_MESH_SCENE_SRV=y - CONFIG_BT_MESH_SCHEDULER_SRV=y + bluetooth.mesh.build_models.shell: + extra_configs: + - OVERLAY_CONFIG=overlay-mesh-shell.conf bluetooth.mesh.build_models.emds: # Include emergency data storage (EMDS): # The models that uses the EMDS is already included, remove the models that # does not use EMDS. extra_configs: - - CONFIG_BT_SETTINGS=y - - CONFIG_FLASH_MAP=y - - CONFIG_PM_SINGLE_IMAGE=y - - CONFIG_EMDS=y - - CONFIG_BT_MESH_PLVL_SRV=y - - CONFIG_BT_MESH_LIGHT_HUE_SRV=y - - CONFIG_BT_MESH_LIGHT_SAT_SRV=y - - CONFIG_BT_MESH_LIGHT_TEMP_SRV=y - - CONFIG_BT_MESH_LIGHT_XYL_SRV=y - - CONFIG_BT_MESH_LIGHTNESS_SRV=y - - CONFIG_BT_MESH_ONOFF_SRV=n - - CONFIG_BT_MESH_ONOFF_CLI=n - - CONFIG_BT_MESH_TIME_SRV=n - - CONFIG_BT_MESH_TIME_CLI=n - - CONFIG_BT_MESH_LVL_SRV=n - - CONFIG_BT_MESH_LVL_CLI=n - - CONFIG_BT_MESH_DTT_SRV=n - - CONFIG_BT_MESH_DTT_CLI=n - - CONFIG_BT_MESH_PONOFF_SRV=n - - CONFIG_BT_MESH_PONOFF_CLI=n - - CONFIG_BT_MESH_PLVL_CLI=n - - CONFIG_BT_MESH_BATTERY_SRV=n - - CONFIG_BT_MESH_BATTERY_CLI=n - - CONFIG_BT_MESH_LOC_SRV=n - - CONFIG_BT_MESH_LOC_CLI=n - - CONFIG_BT_MESH_PROP_SRV=n - - CONFIG_BT_MESH_PROP_CLI=n - - CONFIG_BT_MESH_LIGHTNESS_CLI=n - - CONFIG_BT_MESH_LIGHT_CTRL_SRV=y - - CONFIG_BT_MESH_LIGHT_CTRL_CLI=n - - CONFIG_BT_MESH_LIGHT_CTL_CLI=n - - CONFIG_BT_MESH_LIGHT_CTL_SRV=n - - CONFIG_BT_MESH_SENSOR_SRV=n - - CONFIG_BT_MESH_SENSOR_CLI=n - - CONFIG_BT_MESH_SCENE_CLI=n - - CONFIG_BT_MESH_LIGHT_XYL_CLI=n - - CONFIG_BT_MESH_LIGHT_HSL_SRV=n - - CONFIG_BT_MESH_LIGHT_HSL_CLI=n - - CONFIG_BT_MESH_SCHEDULER_CLI=n + - OVERLAY_CONFIG=overlay-mesh-emds.conf