Skip to content

Commit

Permalink
Bluetooth: Mesh: Fix shell model clients
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
akredalen committed Feb 22, 2024
1 parent 5336e02 commit 1285ddd
Show file tree
Hide file tree
Showing 20 changed files with 158 additions and 122 deletions.
2 changes: 1 addition & 1 deletion subsys/bluetooth/mesh/shell/shell_bat_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions subsys/bluetooth/mesh/shell/shell_ctl_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 = {
Expand Down Expand Up @@ -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);
Expand All @@ -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 = {
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions subsys/bluetooth/mesh/shell/shell_dm_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/mesh/shell/shell_dtt_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
22 changes: 11 additions & 11 deletions subsys/bluetooth/mesh/shell/shell_hsl_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 = {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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 };

Expand Down Expand Up @@ -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);
Expand All @@ -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 };

Expand Down
14 changes: 7 additions & 7 deletions subsys/bluetooth/mesh/shell/shell_lightness_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 };

Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions subsys/bluetooth/mesh/shell/shell_loc_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions subsys/bluetooth/mesh/shell/shell_lvl_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/mesh/shell/shell_onoff_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 };
Expand Down
Loading

0 comments on commit 1285ddd

Please sign in to comment.