BT_MESH_MODEL_CONFIG_GROUP_SUB, req->data,
sizeof(bluetooth_mesh_model_configure_t));
break;
+ case MESH_OPCODE_CONFIG_MODEL_PUB_GET:
+ /* Send event with timeout */
+ __bt_mesh_handle_pending_dev_config_request_info(
+ BLUETOOTH_ERROR_TIMEOUT,
+ BT_MESH_MODEL_GET_PUBLICATION, req->data,
+ sizeof(bluetooth_mesh_model_configure_t));
+ break;
+ case MESH_OPCODE_CONFIG_MODEL_PUB_SET:
+ /* Send event with timeout */
+ __bt_mesh_handle_pending_dev_config_request_info(
+ BLUETOOTH_ERROR_TIMEOUT,
+ BT_MESH_MODEL_SET_PUBLICATION, req->data,
+ sizeof(bluetooth_mesh_model_configure_t));
+ break;
+ case MESH_OPCODE_MODEL_APP_BIND:
+ case MESH_OPCODE_MODEL_APP_UNBIND:
+ /* Send event with timeout */
+ __bt_mesh_handle_pending_dev_config_request_info(
+ BLUETOOTH_ERROR_TIMEOUT,
+ BT_MESH_MODEL_CONFIGURE_APPKEY, req->data,
+ sizeof(bluetooth_mesh_model_configure_t));
+ break;
default:
break;
}
int n;
struct mesh_pending_request *req;
- if (_bt_mesh_util_opcode_get(data, data_len, &opcode, &n)) {
- BT_INFO("Mesh: Opcode of response data [0x%2.2x], actual data len [%d]", opcode, n);
- data_len -= n;
- data += n;
- } else
+ if (_bt_mesh_util_opcode_get(data, data_len, &opcode, &n) == false)
return;
+ BT_INFO("Mesh: Opcode of response data [0x%2.2x], actual data len [%d]", opcode, n);
+ data_len -= n;
+ data += n;
+
BT_INFO("Mesh: Received %s (len %u) opcode [0x%2.2x]",
__mesh_get_opcode_string(opcode), data_len, opcode);
if (req) {
BT_INFO("Mesh: Got Config Request");
cmd = req->cmd;
- __mesh_request_remove(req);
l_queue_remove(pending_requests, req);
- } else
+ __mesh_request_remove(req);
+ } else {
cmd = NULL;
+ }
switch (opcode & ~MESH_OPCODE_UNRELIABLE) {
BT_INFO("Subscr Addr\t%4.4x\n", addr);
BT_INFO("Model ID\t%4.4x\n", mod_id);
+ if (data[0] == MESH_STATUS_SUCCESS) {
+ /* Update cdb */
+ switch (cmd->opcode) {
+ case MESH_OPCODE_CONFIG_MODEL_SUB_ADD:
+ case MESH_OPCODE_CONFIG_MODEL_SUB_VIRT_ADD:
+ if (!_bt_mesh_network_add_model_subscription(
+ event->net_uuid.uuid, event->source,
+ ele_addr - event->source, mod_id, addr)) {
+ BT_INFO("Failed to add model subscription!");
+ }
+ break;
+ case MESH_OPCODE_CONFIG_MODEL_SUB_DELETE:
+ case MESH_OPCODE_CONFIG_MODEL_SUB_VIRT_DELETE:
+ if (!_bt_mesh_network_delete_model_subscription(
+ event->net_uuid.uuid, event->source,
+ ele_addr - event->source, mod_id, addr)) {
+ BT_INFO("Failed to delete model subscription!");
+ }
+ break;
+ case MESH_OPCODE_CONFIG_MODEL_SUB_DELETE_ALL:
+ if (!_bt_mesh_network_delete_all_model_subscription(
+ event->net_uuid.uuid, event->source,
+ ele_addr - event->source, mod_id)) {
+ BT_INFO("Failed to delete all model subscription!");
+ }
+ break;
+ case MESH_OPCODE_CONFIG_MODEL_SUB_OVERWRITE:
+ case MESH_OPCODE_CONFIG_MODEL_SUB_VIRT_OVERWRITE:
+ if (!_bt_mesh_network_overwrite_model_subscription(
+ event->net_uuid.uuid, event->source,
+ ele_addr - event->source, mod_id, addr)) {
+ BT_INFO("Failed to overwrite model subscription!");
+ }
+ break;
+ }
+ }
+
if (cmd)
__mesh_handle_model_subscription_event(result, ¶m, cmd);
*param.sub_list[k] = l_get_le16(data + i);
}
}
+
+ /* <TO-DO> Update model sub in cdb */
+
__bt_mesh_handle_pending_dev_config_request_info(result,
BT_MESH_MODEL_GET_SUBSCRIPTION_LIST, ¶m,
sizeof(bluetooth_mesh_model_configure_t));