ble_mesh: stack: Check if mesh stack initialized before init vendor client
This commit is contained in:
parent
c3e8fb73c7
commit
1f32a8d95e
|
@ -948,6 +948,11 @@ static void btc_ble_mesh_proxy_client_filter_status_recv_cb(u8_t conn_handle, u1
|
||||||
|
|
||||||
int btc_ble_mesh_client_model_init(esp_ble_mesh_model_t *model)
|
int btc_ble_mesh_client_model_init(esp_ble_mesh_model_t *model)
|
||||||
{
|
{
|
||||||
|
if (!bt_mesh_is_initialized()) {
|
||||||
|
BT_ERR("Mesh stack is not initialized!");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
__ASSERT(model && model->op, "%s, Invalid parameter", __func__);
|
__ASSERT(model && model->op, "%s, Invalid parameter", __func__);
|
||||||
esp_ble_mesh_model_op_t *op = model->op;
|
esp_ble_mesh_model_op_t *op = model->op;
|
||||||
while (op != NULL && op->opcode != 0) {
|
while (op != NULL && op->opcode != 0) {
|
||||||
|
|
|
@ -446,6 +446,12 @@ int bt_mesh_provisioner_disable(bt_mesh_prov_bearer_t bearers);
|
||||||
BLE_MESH_FEAT_FRIEND | \
|
BLE_MESH_FEAT_FRIEND | \
|
||||||
BLE_MESH_FEAT_LOW_POWER)
|
BLE_MESH_FEAT_LOW_POWER)
|
||||||
|
|
||||||
|
/** @brief Check if the mesh stack is initialized.
|
||||||
|
*
|
||||||
|
* @return true - yes, false - no.
|
||||||
|
*/
|
||||||
|
bool bt_mesh_is_initialized(void);
|
||||||
|
|
||||||
/** @brief Initialize Mesh support
|
/** @brief Initialize Mesh support
|
||||||
*
|
*
|
||||||
* After calling this API, the node will not automatically advertise as
|
* After calling this API, the node will not automatically advertise as
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
|
|
||||||
static bool mesh_init = false;
|
static bool mesh_init = false;
|
||||||
|
|
||||||
|
bool bt_mesh_is_initialized(void)
|
||||||
|
{
|
||||||
|
return mesh_init;
|
||||||
|
}
|
||||||
|
|
||||||
int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
|
int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
|
||||||
u8_t flags, u32_t iv_index, u16_t addr,
|
u8_t flags, u32_t iv_index, u16_t addr,
|
||||||
const u8_t dev_key[16])
|
const u8_t dev_key[16])
|
||||||
|
|
Loading…
Reference in a new issue