/* TODO Reset the remote node, as no response is expected on reset command */
- switch(req->cmd->opcode) {
+ switch (req->cmd->opcode) {
case MESH_OPCODE_DEV_COMP_GET: {
- /* Send event with timeout */
+ /* Send event with timeout for Vendor Features */
+ bluetooth_mesh_node_features_t *vendor_event = \
+ g_malloc0(sizeof(bluetooth_mesh_node_features_t));
+
+ _bt_mesh_util_convert_hex_to_string((uint8_t *) req->net_uuid, 16,
+ vendor_event->net_uuid,
+ BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
+ vendor_event->unicast = req->addr;
+ __bt_mesh_handle_pending_dev_config_request_info(
+ BLUETOOTH_ERROR_TIMEOUT, BT_MESH_NODE_GET_VENDOR_FEATURES,
+ vendor_event, sizeof(bluetooth_mesh_node_features_t));
+ g_free(vendor_event);
+
+ /* Send event with timeout for Node Browse */
event_mesh_devkey_message_t *event = \
g_malloc0(sizeof(event_mesh_devkey_message_t));
memcpy(event->net_uuid.uuid, req->net_uuid, 16);
event->source = req->addr;
+
__bt_mesh_handle_pending_dev_config_request_info(
BLUETOOTH_ERROR_TIMEOUT, BT_MESH_NODE_BROWSE,
event, sizeof(event_mesh_devkey_message_t));
+
g_free(event);
break;
}
+ case MESH_OPCODE_CONFIG_MODEL_SUB_GET:
+ case MESH_OPCODE_CONFIG_VEND_MODEL_SUB_GET:
+ BT_INFO("Mesh: Command TimedOut: Model Subscription list get");
+ /* Send event with timeout */
+ __bt_mesh_handle_pending_dev_config_request_info(
+ BLUETOOTH_ERROR_TIMEOUT,
+ BT_MESH_MODEL_GET_SUBSCRIPTION_LIST, req->data,
+ sizeof(bluetooth_mesh_model_configure_t));
+ break;
case MESH_OPCODE_NETKEY_ADD:
case MESH_OPCODE_NETKEY_UPDATE:
case MESH_OPCODE_NETKEY_DELETE:
break;
case MESH_OPCODE_CONFIG_MODEL_SUB_ADD:
case MESH_OPCODE_CONFIG_MODEL_SUB_DELETE:
- case MESH_OPCODE_CONFIG_MODEL_SUB_DELETE_ALL:
case MESH_OPCODE_CONFIG_MODEL_SUB_OVERWRITE:
/* Send event with timeout */
__bt_mesh_handle_pending_dev_config_request_info(
BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB, req->data,
sizeof(bluetooth_mesh_model_configure_t));
break;
+ case MESH_OPCODE_CONFIG_MODEL_SUB_DELETE_ALL:
+ /* Send event with timeout */
+ __bt_mesh_handle_pending_dev_config_request_info(
+ BLUETOOTH_ERROR_TIMEOUT,
+ BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB, req->data,
+ sizeof(bluetooth_mesh_model_configure_t));
+ /* Send event with timeout */
+ __bt_mesh_handle_pending_dev_config_request_info(
+ BLUETOOTH_ERROR_TIMEOUT,
+ 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;
}
return;
_bt_mesh_util_convert_hex_to_string((uint8_t *) net_uuid, 16, uuid_str,
BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
- BT_INFO("Mesh: Net UUID[%s]",uuid_str);
+ BT_INFO("Mesh: Net UUID[%s]", uuid_str);
BT_INFO("Mesh: Adding command opcode [0x%2.2x] response [0x%2.2x]",
cmd->opcode, cmd->response);
BT_INFO("Mesh: Current req addr [0x%2.2x] res [0x%2.2x]", addr, response);
_bt_mesh_util_convert_hex_to_string((uint8_t *) net_uuid, 16, uuid_str,
BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
- BT_INFO("Mesh: Net UUID[%s]",uuid_str);
+ BT_INFO("Mesh: Net UUID[%s]", uuid_str);
_bt_mesh_util_convert_hex_to_string((uint8_t *) req->net_uuid, 16, uuid_str1,
BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
- BT_INFO("Mesh: Net UUID1[%s]",uuid_str1);
+ BT_INFO("Mesh: Net UUID1[%s]", uuid_str1);
if (!memcmp(net_uuid, req->net_uuid, 16) &&
req->addr == addr &&
req->cmd->response == response)
GArray *info = NULL;
if (BLUETOOTH_ERROR_NONE == result) {
+ BT_INFO("Mesh: Model ID [0x%4.4x]", evt->model);
+ BT_INFO("Mesh: Model Publication Address [0x%2.2x]", evt->pub_addr);
/* Send event */
info = g_array_new(FALSE, FALSE, sizeof(gchar));
g_array_append_vals(info, evt,
GVariant *param = NULL;
GVariantBuilder *builder = NULL;
int i;
+ char *net_uuid;
if (BLUETOOTH_ERROR_NONE == result) {
- if (evt->sublist_count) {
- builder = g_variant_builder_new(G_VARIANT_TYPE("aq"));
- for (i = 0; i < evt->sublist_count; i++)
- g_variant_builder_add(builder, "q", *evt->sub_list[i]);
+ BT_INFO("Mesh: Total Subscriptions bound to model [%d]",
+ evt->sublist_count);
+ BT_INFO("Mesh: Network [%s]", evt->net_uuid);
+ builder = g_variant_builder_new(G_VARIANT_TYPE("aq"));
+ for (i = 0; i < evt->sublist_count; i++) {
+ BT_INFO("Mesh: Subscription Address [0x%2.2x]",
+ *evt->sub_list[i]);
+ g_variant_builder_add(builder, "q", *evt->sub_list[i]);
+ }
+
+ net_uuid = g_strdup(evt->net_uuid);
+ param = g_variant_new("(isqiui(aq))", result, net_uuid,
+ evt->primary_unicast, evt->elem_index, evt->model,
+ evt->sublist_count, builder);
- param = g_variant_new("(isqiui(aq))", result, evt->net_uuid,
- evt->primary_unicast, evt->elem_index, evt->model,
- evt->sublist_count, builder);
+ g_variant_builder_unref(builder);
- g_variant_builder_unref(builder);
- }
/* Send event */
_bt_send_event(BT_MESH_EVENT,
BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_LIST,
g_free(evt->sub_list[i]);
g_free(evt->sub_list);
}
+ g_free(net_uuid);
+ BT_INFO("freed net uuid");
}
}
_bt_mesh_node_get_element_count(event->net_uuid.uuid, remote_addr, &elem_count);
node->unicast = event->source;
node->count = elem_count;
+ BT_INFO("Mesh: Browse event for Node: Unicast [0x%2.2x] Element Count [%d]",
+ node->unicast, elem_count);
/* Send Event */
__bt_mesh_send_node_browsed_event(result, node);
bluetooth_mesh_model_configure_t *event;
bluetooth_mesh_model_configure_t *req;
+ BT_INFO("Mesh: Handle event for BT_MESH_MODEL_GET_SUBSCRIPTION_LIST");
event = (bluetooth_mesh_model_configure_t*) param;
req = (bluetooth_mesh_model_configure_t*)req_info->user_data;
break;
}
case BT_MESH_MODEL_GET_PUBLICATION: {
+ BT_INFO("Mesh: Event for Model Get Publication Request");
bluetooth_mesh_model_configure_t *event;
bluetooth_mesh_model_configure_t *req;
if (!g_strcmp0(req->net_uuid, event->net_uuid) &&
req->primary_unicast == event->primary_unicast) {
/* Send Event */
+ BT_INFO("Mesh: Send Model Publication status for Get Request");
__bt_mesh_send_model_publication_status_event( \
BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS, \
result, event);
break;
}
case BT_MESH_MODEL_SET_PUBLICATION: {
+ BT_INFO("Mesh: Event for Model Set Publication Request");
bluetooth_mesh_model_configure_t *event;
bluetooth_mesh_model_configure_t *req;
if (!g_strcmp0(req->net_uuid, event->net_uuid) &&
req->primary_unicast == event->primary_unicast) {
/* Send Event */
+ BT_INFO("Mesh: Send Model Publication status for Set Request");
__bt_mesh_send_model_publication_status_event( \
BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS, \
result, req);
case MESH_OPCODE_CONFIG_MODEL_SUB_ADD:
case MESH_OPCODE_CONFIG_MODEL_SUB_DELETE:
case MESH_OPCODE_CONFIG_MODEL_SUB_OVERWRITE:
- case MESH_OPCODE_CONFIG_MODEL_SUB_DELETE_ALL:
/* Model Bind/UnBind Event */
BT_INFO("Mesh: Handle Event for Request: BT_MESH_MODEL_CONFIG_GROUP_SUB");
__bt_mesh_handle_pending_dev_config_request_info(result,
BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB, param,
sizeof(bluetooth_mesh_model_configure_t));
break;
+ case MESH_OPCODE_CONFIG_MODEL_SUB_DELETE_ALL:
+ BT_INFO("Mesh: Handle Event for Request: MESH_OPCODE_CONFIG_MODEL_SUB_DELETE_ALL");
+ __bt_mesh_handle_pending_dev_config_request_info(result,
+ BT_MESH_MODEL_CONFIG_GROUP_SUB, param,
+ sizeof(bluetooth_mesh_model_configure_t));
+ __bt_mesh_handle_pending_dev_config_request_info(result,
+ BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB, param,
+ sizeof(bluetooth_mesh_model_configure_t));
+ break;
default:
break;
}
switch (opcode & ~MESH_OPCODE_UNRELIABLE) {
- default:
- return;
+ default:
+ return;
case MESH_OPCODE_CONFIG_MODEL_PUB_STATUS: {
if (data_len != 12 && data_len != 14)
break;
event->source, __mesh_status_to_string(data[0]));
if (data[0] != MESH_STATUS_SUCCESS)
- break;
+ result = BLUETOOTH_ERROR_INTERNAL;
/* Extract Element Address */
ele_addr = l_get_le16(data + 1);
mod_id = MESH_VENDOR_ID_MASK | mod_id;
}
+ param.model = mod_id;
+ BT_INFO("Model ID\t%4.4x\n", mod_id);
+
param.primary_unicast = event->source;
param.elem_index = ele_addr - event->source;
/* Extract Publish Address */
param.pub_addr = l_get_le16(data + 3);
+ BT_INFO("Mesh: Pub Address [0x%2.2x]", param.pub_addr);
/* Extract Appkey Index */
param.appkey_idx = l_get_le16(data + 5);
+ BT_INFO("Mesh: AppKey Idx [0x%2.2x]", param.appkey_idx);
/* Extract TTL */
param.ttl = data[6];
+ BT_INFO("Mesh: TTL [0x%x]", param.ttl);
/* Extract Period */
param.period = data[7];
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.primary_unicast = event->source;
param.elem_index = elem_addr - event->source;
param.model = mod_id;
-
- total = data_len - 5;
+ BT_INFO("Mesh: Data length of All Models Together [%d]", data_len - 5);
+ total = (data_len - 5)/2;
param.sublist_count = total;
+ BT_INFO("Mesh: Total Number of subscriptions [%d]", total);
if (total) {
param.sub_list = (uint16_t **)g_malloc0(sizeof(uint16_t*) * total);
i = 5;
- for (; i < data_len; i += 2) {
- BT_INFO("Subscription Addr \t\t%4.4x\n ", l_get_le16(data + i));
- param.sub_list[i] = g_malloc(sizeof(uint16_t));
- *param.sub_list[i] = l_get_le16(data + i);
+ for (int k = 0; i < data_len; k++, i += 2) {
+ BT_INFO("Mesh: Subscription Addr \t\t%4.4x\n ", l_get_le16(data + i));
+ param.sub_list[k] = g_malloc(sizeof(uint16_t));
+ *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));
(uint8_t *) event->net_uuid.uuid, 16, param.net_uuid,
BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
- BT_INFO("\nNode %4.4x BT SIG Model Subscription List status %s\n",
+ BT_INFO("\nNode %4.4x Vendor Model Subscription List status %s\n",
event->source, __mesh_status_to_string(data[0]));
BT_INFO("Element Addr\t%4.4x\n", l_get_le16(data + 1));
param.elem_index = elem_addr - event->source;
param.model = mod_id;
- total = data_len - 7;
+ BT_INFO("Mesh: Data length of All Models Together [%d]", data_len - 7);
+ total = (data_len - 7)/2;
param.sublist_count = total;
+
+ BT_INFO("Mesh: Total Number of subscriptions [%d]", total);
if (total) {
param.sub_list = (uint16_t **)g_malloc0(sizeof(uint16_t*) * total);
i = 7;
- for (; i < data_len; i += 2) {
- BT_INFO("Subscription Addr \t\t%4.4x\n ", l_get_le16(data + i));
- param.sub_list[i] = g_malloc(sizeof(uint16_t));
- *param.sub_list[i] = l_get_le16(data + i);
+ for (int k = 0; i < data_len; k++, i += 2) {
+ BT_INFO("Mesh: Subscription Addr \t\t%4.4x\n ", l_get_le16(data + i));
+ param.sub_list[k] = g_malloc(sizeof(uint16_t));
+ *param.sub_list[k] = l_get_le16(data + i);
}
}
__bt_mesh_handle_pending_dev_config_request_info(result,
(uint8_t *) event->net_uuid.uuid, 16, features.net_uuid,
BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
features.unicast = event->source;
- _bt_mesh_node_get_vendor_features(event->net_uuid.uuid,
- event->source, &features);
-
+ BT_INFO("Mesh: Net UUID [%s]", features.net_uuid);
+
+ BT_INFO("Mesh: Composition status for node unicast [0x%2.2x]",
+ event->source);
+ if (!_bt_mesh_node_get_vendor_features(event->net_uuid.uuid,
+ event->source, &features)) {
+ BT_ERR("Mesh: Failed to get Vendor Specific Infor for [0x%2.2x]",
+ event->source);
+ result = BLUETOOTH_ERROR_INTERNAL;
+ } else {
+ BT_INFO("Mesh: Got Feature informations for [0x%2.2x]",
+ event->source);
+ }
__bt_mesh_handle_pending_dev_config_request_info(result,
BT_MESH_NODE_GET_VENDOR_FEATURES, &features,
sizeof(bluetooth_mesh_node_features_t));
oal_uuid_t net_uuid;
uint8_t buffer[MESH_CONFIG_BUFFER_MAX_LEN];
+ BT_INFO("Mesh: Vendor features for Network UUID [%s]", req->net_uuid);
_bt_mesh_util_convert_string_to_hex(req->net_uuid,
strlen(req->net_uuid), net_uuid.uuid, 16);
/* Check if Node's vendor features are already svaed or not */
if (_bt_mesh_node_get_vendor_features(net_uuid.uuid, req->unicast, req)) {
+ BT_INFO("Mesh: Vendor Features already available for Node: Unicast [0x%.2x]",
+ req->unicast);
/* Schedule event ot Application */
bluetooth_mesh_node_features_t *event = \
g_memdup(req, sizeof(bluetooth_mesh_node_features_t));
strlen(req->net_uuid), net_uuid.uuid, 16);
dest = req->unicast;
+ BT_INFO("Mesh: Get Vendor Features for Remote Node Unicast [0x%2.2x]", dest);
/* Check pending request */
if (_bt_mesh_check_pending_request(MESH_OPCODE_DEV_COMP_GET,
return BLUETOOTH_ERROR_DEVICE_BUSY;
}
+ BT_INFO("Mesh: Browse Remote Node: Unicast [0x%2.2x]", dest);
/* Get Subnet index of the rmeote node for TX encryption */
netkey_idx = _bt_mesh_node_get_subnet_idx(net_uuid.uuid, dest);
if (netkey_idx == MESH_NET_IDX_INVALID)
dev_uuid.uuid, &dest))
return BLUETOOTH_ERROR_INTERNAL;
+ BT_INFO("Mesh: Browse Remote Node: Unicast [0x%2.2x]", dest);
/* Check pending request */
if (_bt_mesh_check_pending_request(MESH_OPCODE_DEV_COMP_GET,
dest, net_uuid.uuid)) {
opcode = MESH_OPCODE_CONFIG_MODEL_SUB_VIRT_DELETE;
else if (req->op == BLUETOOTH_MESH_MODEL_SUB_OVERWRITE)
opcode = MESH_OPCODE_CONFIG_MODEL_SUB_VIRT_OVERWRITE;
+ else if (req->op == BLUETOOTH_MESH_MODEL_SUB_DELETE_ALL)
+ opcode = MESH_OPCODE_CONFIG_MODEL_SUB_DELETE_ALL;
/* Check pending request */
if (_bt_mesh_check_pending_request(opcode,
if (req->pub_addr != MESH_UNASSIGNED_ADDRESS) {
if (MESH_IS_VIRTUAL(req->pub_addr)) {
- if(!_bt_mesh_network_get_label_uuid_from_sub_addr(
+ if (!_bt_mesh_network_get_label_uuid_from_sub_addr(
net_uuid.uuid, req->pub_addr, label_uuid))
return BLUETOOTH_ERROR_INVALID_PARAM;
opcode = MESH_OPCODE_CONFIG_MODEL_PUB_VIRT_SET;
l_put_le16((req->primary_unicast + req->elem_index), buffer + data_len);
data_len += 2;
-
/* Insert Model ID */
if (opcode == MESH_OPCODE_CONFIG_MODEL_SUB_GET) {
+ BT_INFO("Mesh: Get Subscription List for BT SIG Model");
/* 1st 2 octet Company ID is 0xFFFF means, it is BT SIG Model*/
l_put_le16(req->model & 0x0000FFFF, buffer + data_len);
data_len += 2;
} else {
+ BT_INFO("Mesh: Get Subscription List for Vendor Model");
/* Vendor Model, 1st 2 octetes: Company ID, next 2 octets: Vendor Model ID */
l_put_le16(req->model & 0xFFFF0000, buffer + data_len);
data_len += 2;
return BLUETOOTH_ERROR_NONE;
}
+int _bt_mesh_network_reset_node(const char *app_cred, const char *sender,
+ bluetooth_mesh_node_info_t *node)
+{
+ int ret = OAL_STATUS_SUCCESS;
+ uint16_t netkey_idx;
+ oal_uuid_t net_uuid;
+ uint16_t data_len;
+ uint8_t buffer[MESH_CONFIG_BUFFER_MAX_LEN];
+
+ /* If Scanning is going on */
+ if (_bt_mesh_is_provisioning() ||
+ _bt_mesh_is_scanning()) {
+ BT_ERR("Device is buzy..");
+ return BLUETOOTH_ERROR_DEVICE_BUSY;
+ }
+
+ _bt_mesh_util_convert_string_to_hex(node->net_uuid,
+ strlen(node->net_uuid), net_uuid.uuid, 16);
+
+ /* Check pending request */
+ if (_bt_mesh_check_pending_request(MESH_OPCODE_NODE_RESET,
+ node->primary_unicast, net_uuid.uuid)) {
+ BT_ERR("Device is buzy..");
+ return BLUETOOTH_ERROR_DEVICE_BUSY;
+ }
+ BT_INFO("Mesh: Reset a remote Node [0x%2.2x] Elem Cnt [0x%2.2x]",
+ node->primary_unicast, node->num_elements);
+ /* Get Subnet index of the remote node for TX encryption */
+ netkey_idx = _bt_mesh_node_get_subnet_idx(net_uuid.uuid, node->primary_unicast);
+ if (netkey_idx == MESH_NET_IDX_INVALID)
+ return BLUETOOTH_ERROR_INTERNAL;
+
+ data_len = _bt_mesh_util_opcode_set(MESH_OPCODE_NODE_RESET, buffer);
+
+ /* Send Node Reset command 5 times to ensure reliability */
+ for (int i = 0; i < 5; i++)
+ ret = mesh_conf_send_message(&net_uuid, node->primary_unicast,
+ true, netkey_idx, buffer, data_len);
+
+ if (ret != OAL_STATUS_SUCCESS) {
+ BT_ERR("Mesh: Node Reset Failed!: %d", ret);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ BT_INFO("Mesh: Node reset Done, Send Delete req: Unicast[0x%2.2x]",
+ node->primary_unicast);
+
+ ret = mesh_delete_remote_node(&net_uuid, node->primary_unicast,
+ node->num_elements);
+ if (ret != OAL_STATUS_SUCCESS) {
+ BT_ERR("Mesh: Remote Node Deletion Failed!: %d", ret);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ return _bt_mesh_network_remove_node_configuration(node);
+}
+
int _bt_mesh_node_model_appkey_execute(const char *app_cred, const char *sender,
bluetooth_mesh_model_configure_t *req)
{
const struct mesh_config_cmd *cmd;
if (is_netkey) {
- switch(op) {
+ switch (op) {
case BLUETOOTH_MESH_NODE_KEY_ADD:
cmd = __mesh_get_command(MESH_OPCODE_NETKEY_ADD);
if (!cmd)
return false;
}
} else {
- switch(op) {
+ switch (op) {
case BLUETOOTH_MESH_NODE_KEY_ADD:
cmd = __mesh_get_command(MESH_OPCODE_APPKEY_ADD);
if (!cmd)
/* Handle Key (App/Net) Update & Add Commands: Key Config message */
update = (opcode == MESH_OPCODE_NETKEY_UPDATE || opcode == MESH_OPCODE_APPKEY_UPDATE);
ret = mesh_conf_send_key_message(&net_uuid, req->primary_unicast, req->is_netkey,
- update, req->is_netkey? req->netkey_idx: req->appkey_idx, netkey_idx);
+ update, req->is_netkey ? req->netkey_idx : req->appkey_idx, netkey_idx);
}
if (ret != OAL_STATUS_SUCCESS) {
BT_ERR("ret: %d", ret);