Mesh: Fix provisioning and mesh message communication 99/240699/1
authorAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 10 Aug 2020 13:08:00 +0000 (18:38 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 10 Aug 2020 13:45:59 +0000 (19:15 +0530)
This patch fix
- Mesh provisioning of multiple devices
- Mesh model message response handler

Change-Id: I13a909ddf796206c193af41da3fe85a5eb0a592e
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
bt-service/services/mesh/bt-service-mesh-model.c
bt-service/services/mesh/bt-service-mesh-network.c

index 89916b8..d38db10 100644 (file)
@@ -309,7 +309,6 @@ void _bt_mesh_msg_handler(event_mesh_message_t *event)
        uint16_t data_len = event->data_len;
        uint8_t *data = event->data;
        int n;
-       const struct mesh_msg_cmd *cmd;
        struct mesh_pending_request *req;
 
        int result = BLUETOOTH_ERROR_NONE;
@@ -332,11 +331,9 @@ void _bt_mesh_msg_handler(event_mesh_message_t *event)
 
        if (req) {
                BT_INFO("Mesh: Got Request");
-               cmd = req->cmd;
                __mesh_request_remove(req);
                l_queue_remove(pending_msg_requests, req);
-       } else
-               cmd = NULL;
+       }
 
        bluetooth_mesh_model_msg_t param;
        memset(&param, 0x00, sizeof(bluetooth_mesh_model_msg_t));
@@ -357,25 +354,6 @@ void _bt_mesh_msg_handler(event_mesh_message_t *event)
        param.opcode = opcode;
        BT_INFO("Send response");
 
-       switch (opcode & ~MESH_OPCODE_UNRELIABLE) {
-       case MESH_OPCODE_MODEL_GENERIC_ONOFF_STATUS: {
-               BT_INFO("Received Generic On off status");
-
-               BT_INFO("Mesh: Node %4.4x", event->source);
-               if (!cmd) {
-                       BT_INFO("No pending req for this status");
-                       break;
-               }
-               if (cmd->opcode == MESH_OPCODE_MODEL_GENERIC_ONOFF_GET)
-                       BT_INFO("Mesh: Resp recvd: MESH_OPCODE_MODEL_GENERIC_ONOFF_GET");
-               else if (cmd->opcode == MESH_OPCODE_MODEL_GENERIC_ONOFF_SET)
-                       BT_INFO("Mesh: Resp recvd: MESH_OPCODE_MODEL_GENERIC_ONOFF_SET");
-               else
-                       BT_INFO("Request opcode do not match !");
-       }
-       default:
-               return;
-       }
        __bt_mesh_handle_pending_msg_request_info(result,
                BT_MESH_MODEL_EXECUTE_MSG, &param,
                sizeof(bluetooth_mesh_model_msg_t));
index ccda8b5..7a7366a 100644 (file)
@@ -174,7 +174,7 @@ int _bt_mesh_network_request_provisioning_data_request(uint8_t net_uuid[],
 
        unicast = _bt_mesh_node_get_next_unicast(net_uuid,
                        MESH_DEFAULT_START_ADDRESS,
-                       MESH_DEFAULT_START_ADDRESS, count);
+                       MESH_DEFAULT_MAX_ADDRESS, count);
        BT_INFO("Mesh: Network: Got unicast [%4.4x]", unicast);
 
        memcpy(uuid.uuid, net_uuid, 16);