diff --git a/nimble/host/mesh/pkg.yml b/nimble/host/mesh/pkg.yml index d3c36be1d..3e1be0e0c 100644 --- a/nimble/host/mesh/pkg.yml +++ b/nimble/host/mesh/pkg.yml @@ -39,3 +39,6 @@ pkg.deps.BLE_MESH_SHELL: pkg.req_apis: - log - stats + +pkg.init: + ble_mesh_shell_init: 1000 diff --git a/nimble/host/mesh/src/mesh.c b/nimble/host/mesh/src/mesh.c index 04712f78e..b0b685abf 100644 --- a/nimble/host/mesh/src/mesh.c +++ b/nimble/host/mesh/src/mesh.c @@ -246,10 +246,6 @@ int bt_mesh_init(uint8_t own_addr_type, const struct bt_mesh_prov *prov, bt_mesh_beacon_enable(); #endif -#if (MYNEWT_VAL(BLE_MESH_SHELL)) - mesh_shell_init(); -#endif - #if (MYNEWT_VAL(BLE_MESH_PB_GATT)) bt_mesh_proxy_prov_enable(); #endif diff --git a/nimble/host/mesh/src/shell.c b/nimble/host/mesh/src/shell.c index 303f13ccc..6c41c698c 100644 --- a/nimble/host/mesh/src/shell.c +++ b/nimble/host/mesh/src/shell.c @@ -193,7 +193,7 @@ static struct bt_mesh_health_cli health_cli = { .current_status = health_current_status, }; -static u8_t dev_uuid[16] = { 0xdd, 0xdd }; +static u8_t dev_uuid[16] = MYNEWT_VAL(BLE_MESH_DEV_UUID); static struct bt_mesh_model root_models[] = { BT_MESH_MODEL_CFG_SRV(&cfg_srv), @@ -2108,11 +2108,16 @@ static const struct shell_cmd mesh_commands[] = { { NULL, NULL, NULL} }; +#endif -void mesh_shell_init(void) +void ble_mesh_shell_init(void) { +#if !(MYNEWT_VAL(BLE_MESH_SHELL)) + return; +#endif + + /* Initialize health pub message */ health_pub_init(); + shell_register("mesh", mesh_commands); } - -#endif diff --git a/nimble/host/mesh/src/shell.h b/nimble/host/mesh/src/shell.h index edd85a1f7..53cc83a27 100644 --- a/nimble/host/mesh/src/shell.h +++ b/nimble/host/mesh/src/shell.h @@ -1,6 +1,6 @@ #ifndef __SHELL_H__ #define __SHELL_H__ -void mesh_shell_init(void); +void ble_mesh_shell_init(void); #endif