BT_INFO("BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS");
bluetooth_mesh_model_configure_t *res = NULL;
bt_mesh_network_s *network_s = NULL;
- bt_mesh_node_s *node_s = NULL;
- bt_mesh_element_s *element_s = NULL;
bt_mesh_group_s *group_s = NULL;
bt_mesh_appkey_s *appkey_s = NULL;
bt_mesh_model_s *model_s = NULL;
else
BT_INFO("Mesh: Model Publication Status: FAILED");
+ BT_INFO("Mesh: AppKey Index [0x%2.2x]", res->appkey_idx);
+ BT_INFO("Mesh: Model ID[0x%4.4x]", res->model);
+
appkey_s = _bt_mesh_network_get_appkey_from_index(network_s, res->appkey_idx);
if (!appkey_s)
break;
- node_s = _bt_mesh_get_node_from_unicast(res->net_uuid, res->primary_unicast);
- if (!node_s)
- break;
- element_s = _bt_mesh_get_node_get_element_from_index(res->net_uuid,
- res->primary_unicast, res->elem_index);
- if (!element_s)
- break;
+
model_s = _bt_mesh_get_node_get_model_from_element(res->net_uuid,
res->primary_unicast, res->elem_index, res->model);
if (!model_s)
break;
- group_s = _bt_mesh_network_get_group(network_s, res->sub_addr);
+ model_s->pub_addr = res->pub_addr;
+ BT_INFO("Mesh: Model Publication address [0x%2.2x]", model_s->pub_addr);
+ group_s = _bt_mesh_network_get_group(network_s, res->pub_addr);
/* Exception is Unassigned address */
- if (!group_s && res->sub_addr == 0x0000)
+ if (!group_s && res->pub_addr == 0x0000) {
+ BT_INFO("Mesh: Model Publication Group is set to Unassigned");
((bt_mesh_model_publication_status_cb)
- bt_event_slot_container[event_index].callback)
- (_bt_get_error_code(param->result), (bt_mesh_model_h) model_s,
- NULL, (bt_mesh_appkey_h) appkey_s,
- bt_event_slot_container[event_index].user_data);
- else
+ bt_event_slot_container[event_index].callback)
+ (_bt_get_error_code(param->result), (bt_mesh_model_h) model_s,
+ NULL, (bt_mesh_appkey_h) appkey_s,
+ bt_event_slot_container[event_index].user_data);
+ } else {
+ BT_INFO("Mesh: Send Model Publication Status event");
((bt_mesh_model_publication_status_cb)
- bt_event_slot_container[event_index].callback)
- (_bt_get_error_code(param->result), (bt_mesh_model_h) model_s,
- (bt_mesh_group_h) group_s, (bt_mesh_appkey_h) appkey_s,
- bt_event_slot_container[event_index].user_data);
+ bt_event_slot_container[event_index].callback)
+ (_bt_get_error_code(param->result), (bt_mesh_model_h) model_s,
+ (bt_mesh_group_h) group_s, (bt_mesh_appkey_h) appkey_s,
+ bt_event_slot_container[event_index].user_data);
+ }
break;
}
case BLUETOOTH_EVENT_MESH_MODEL_APPKEY_LIST : {
BT_CHECK_INPUT_PARAMETER(callback);
model_s = (bt_mesh_model_s*) model;
+ BT_MESH_VALIDATE_HANDLE(model_s, model_list);
+
appkey_s = (bt_mesh_appkey_s*) appkey;
+ BT_MESH_VALIDATE_HANDLE(appkey_s, appkey_list);
+
group_s = (bt_mesh_group_s*) group;
+ BT_MESH_VALIDATE_HANDLE(group_s, group_list);
+
element_s = (bt_mesh_element_s*) model_s->parent;
+ BT_CHECK_INPUT_PARAMETER(element_s);
+ BT_MESH_VALIDATE_HANDLE(element_s, element_list);
+
node_s = (bt_mesh_node_s*) element_s->parent;
+ BT_CHECK_INPUT_PARAMETER(node_s);
+ BT_MESH_VALIDATE_HANDLE(node_s, node_list);
+
network_s = (bt_mesh_network_s*) node_s->parent;
+ BT_CHECK_INPUT_PARAMETER(network_s);
+ BT_MESH_VALIDATE_HANDLE(network_s, networks);
if (group_s->parent != network_s)
return BT_ERROR_INVALID_PARAMETER;
if (params->retrans_step > BT_MESH_MAX_PUBISH_RETRANSMIT_INTERVAL_STEPS)
return BT_ERROR_INVALID_PARAMETER;
- BT_CHECK_INPUT_PARAMETER(element_s);
- BT_CHECK_INPUT_PARAMETER(node_s);
- BT_CHECK_INPUT_PARAMETER(network_s);
-
- BT_MESH_VALIDATE_HANDLE(model_s, model_list);
- BT_MESH_VALIDATE_HANDLE(element_s, element_list);
- BT_MESH_VALIDATE_HANDLE(node_s, node_list);
- BT_MESH_VALIDATE_HANDLE(network_s, networks);
- BT_MESH_VALIDATE_HANDLE(appkey_s, appkey_list);
- BT_MESH_VALIDATE_HANDLE(group_s, group_list);
-
/* Return error, if node is not attached */
if (!node_s->is_attached)
return BT_ERROR_INVALID_PARAMETER;
BT_CHECK_INPUT_PARAMETER(callback);
model_s = (bt_mesh_model_s*) model;
- element_s = (bt_mesh_element_s*) model_s->parent;
- node_s = (bt_mesh_node_s*) element_s->parent;
- network_s = (bt_mesh_network_s*) node_s->parent;
+ BT_MESH_VALIDATE_HANDLE(model_s, model_list);
- BT_CHECK_INPUT_PARAMETER(model_s);
+ element_s = (bt_mesh_element_s*) model_s->parent;
BT_CHECK_INPUT_PARAMETER(element_s);
- BT_CHECK_INPUT_PARAMETER(node_s);
- BT_CHECK_INPUT_PARAMETER(network_s);
-
- BT_MESH_VALIDATE_HANDLE(model_s, model_list);
BT_MESH_VALIDATE_HANDLE(element_s, element_list);
+
+ node_s = (bt_mesh_node_s*) element_s->parent;
+ BT_CHECK_INPUT_PARAMETER(node_s);
BT_MESH_VALIDATE_HANDLE(node_s, node_list);
+
+ network_s = (bt_mesh_network_s*) node_s->parent;
+ BT_CHECK_INPUT_PARAMETER(network_s);
BT_MESH_VALIDATE_HANDLE(network_s, networks);
/* Return error, if node is not attached */