|
29 | 29 |
|
30 | 30 | #define CID_NVAL 0xffff |
31 | 31 |
|
32 | | -static const struct shell *ctx_shell; |
| 32 | +const struct shell *bt_mesh_shell_ctx_shell; |
33 | 33 |
|
34 | 34 | struct bt_mesh_shell_target bt_mesh_shell_target_ctx = { |
35 | 35 | .dst = BT_MESH_ADDR_UNASSIGNED, |
36 | 36 | }; |
37 | 37 |
|
38 | | -#define shell_print_ctx(_ft, ...) \ |
39 | | - do { \ |
40 | | - if (ctx_shell != NULL) { \ |
41 | | - shell_print(ctx_shell, _ft, ##__VA_ARGS__); \ |
42 | | - } \ |
| 38 | +#define shell_print_ctx(_ft, ...) \ |
| 39 | + do { \ |
| 40 | + if (bt_mesh_shell_ctx_shell != NULL) { \ |
| 41 | + shell_print(bt_mesh_shell_ctx_shell, _ft, ##__VA_ARGS__); \ |
| 42 | + } \ |
43 | 43 | } while (0) |
44 | 44 |
|
45 | 45 | /* Default net, app & dev key values, unless otherwise specified */ |
46 | | -static const uint8_t default_key[16] = { |
| 46 | +const uint8_t bt_mesh_shell_default_key[16] = { |
47 | 47 | 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
48 | 48 | 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
49 | 49 | }; |
@@ -204,7 +204,7 @@ struct bt_mesh_health_cli bt_mesh_shell_health_cli = { |
204 | 204 | static int cmd_init(const struct shell *sh, size_t argc, char *argv[]) |
205 | 205 | { |
206 | 206 |
|
207 | | - ctx_shell = sh; |
| 207 | + bt_mesh_shell_ctx_shell = sh; |
208 | 208 | shell_print(sh, "Mesh shell initialized"); |
209 | 209 |
|
210 | 210 | return 0; |
@@ -452,8 +452,9 @@ static int output_number(bt_mesh_output_action_t action, uint32_t number) |
452 | 452 | shell_print_ctx("OOB display Number: %u", number); |
453 | 453 | break; |
454 | 454 | default: |
455 | | - if (ctx_shell != NULL) { |
456 | | - shell_error(ctx_shell, "Unknown Output action %u (number %u) requested!", |
| 455 | + if (bt_mesh_shell_ctx_shell != NULL) { |
| 456 | + shell_error(bt_mesh_shell_ctx_shell, |
| 457 | + "Unknown Output action %u (number %u) requested!", |
457 | 458 | action, number); |
458 | 459 | } |
459 | 460 | return -EINVAL; |
@@ -485,9 +486,9 @@ static int input(bt_mesh_input_action_t act, uint8_t size) |
485 | 486 | shell_print_ctx("\"Push\" a number (max %u digits) with: Input-num <num>", size); |
486 | 487 | break; |
487 | 488 | default: |
488 | | - if (ctx_shell != NULL) { |
489 | | - shell_error(ctx_shell, "Unknown Input action %u (size %u) requested!", act, |
490 | | - size); |
| 489 | + if (bt_mesh_shell_ctx_shell != NULL) { |
| 490 | + shell_error(bt_mesh_shell_ctx_shell, |
| 491 | + "Unknown Input action %u (size %u) requested!", act, size); |
491 | 492 | } |
492 | 493 | return -EINVAL; |
493 | 494 | } |
@@ -834,7 +835,7 @@ static int cmd_provision_adv(const struct shell *sh, size_t argc, |
834 | 835 |
|
835 | 836 | static int cmd_provision_local(const struct shell *sh, size_t argc, char *argv[]) |
836 | 837 | { |
837 | | - const uint8_t *net_key = default_key; |
| 838 | + const uint8_t *net_key = bt_mesh_shell_default_key; |
838 | 839 | uint16_t net_idx, addr; |
839 | 840 | uint32_t iv_index; |
840 | 841 | int err = 0; |
@@ -867,7 +868,7 @@ static int cmd_provision_local(const struct shell *sh, size_t argc, char *argv[] |
867 | 868 | } |
868 | 869 |
|
869 | 870 | err = bt_mesh_provision(net_key, net_idx, 0, iv_index, addr, |
870 | | - default_key); |
| 871 | + bt_mesh_shell_default_key); |
871 | 872 | if (err) { |
872 | 873 | shell_error(sh, "Provisioning failed (err %d)", err); |
873 | 874 | } |
|
0 commit comments