Mesh: Add Mesh CAPI event handler 51/238851/1
authorAnupam Roy <anupam.r@samsung.com>
Sun, 28 Jun 2020 14:52:00 +0000 (20:22 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Sun, 19 Jul 2020 14:35:17 +0000 (20:05 +0530)
This patch handles Mesh events in CAPI libray
Accordingly, callbacks are invoked to application

Change-Id: I7899086e2dfbdc175f6ce45cfa7e96105e3ad150
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
src/bluetooth-common.c

index f2274a1..889696d 100644 (file)
@@ -283,6 +283,21 @@ static bt_event2index_table_t event2index[] = {
        { BLUETOOTH_EVENT_PXP_PROPERTY_CHANGED, BT_EVENT_PROXIMITY_REPORTER_PROPERTY_CHANGED },
        { BLUETOOTH_EVENT_TDS_ACTIVATION_REQUESTED, BT_EVENT_TDS_ACTIVATION_REQUESTED },
        { BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED, BT_EVENT_OTP_SERVER_STATE_CHANGED },
+       { BLUETOOTH_EVENT_MESH_SCAN_STARTED, BT_EVENT_MESH_NETWORK_SCAN_STATE_CHANGED },
+       { BLUETOOTH_EVENT_MESH_SCAN_FINISHED, BT_EVENT_MESH_NETWORK_SCAN_STATE_CHANGED },
+       { BLUETOOTH_EVENT_MESH_SCAN_RESULT, BT_EVENT_MESH_NETWORK_SCAN_STATE_CHANGED },
+       { BLUETOOTH_EVENT_MESH_AUTHENTICATION_REQUEST, BT_EVENT_MESH_AUTHENTICATION_REQUEST },
+       { BLUETOOTH_EVENT_MESH_PROVISIONING_FINISHED, BT_EVENT_MESH_NETWORK_PROVISIONING_RESULT },
+       { BLUETOOTH_EVENT_MESH_NODE_BROWSED, BT_EVENT_MESH_NODE_BROWSING_COMPLETED },
+       { BLUETOOTH_EVENT_MESH_NODE_VENDOR_FEATURES, BT_EVENT_MESH_NODE_VENDOR_FEATURES },
+       { BLUETOOTH_EVENT_MESH_NODE_KEY_CONFIGURED, BT_EVENT_MESH_NODE_KEY_CONFIGURATION_COMPLETED },
+       { BLUETOOTH_EVENT_MESH_NODE_TTL_CONFIGURED, BT_EVENT_MESH_NODE_TTL_EXECUTE_COMPLETED },
+       { BLUETOOTH_EVENT_MESH_NODE_MODEL_APPKEY_BIND, BT_EVENT_MESH_NODE_MODEL_BIND_APPKEY_COMPLETED },
+       { BLUETOOTH_EVENT_MESH_MODEL_APPKEY_LIST, BT_EVENT_MESH_NODE_MODEL_APPKEY_LIST },
+       { BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_LIST, BT_EVENT_MESH_NODE_MODEL_SUB_LIST },
+       { BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_CONFGURED, BT_EVENT_MESH_NODE_MODEL_GROUP_SUB },
+       { BLUETOOTH_EVENT_MESH_MODEL_VIRTUAL_SUBSCRIPTION_CONFGURED, BT_EVENT_MESH_NODE_MODEL_GROUP_VIR_SUB },
+       { BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS, BT_EVENT_MESH_NODE_MODEL_PUBLICATION },
        { 0, -1 }
 };
 
@@ -291,6 +306,7 @@ static bt_feature_table_t feature_table[] = {
        {"tizen.org/feature/network.bluetooth.le", FALSE, FALSE},               /* BT_FEATURE_LE */
        {"tizen.org/feature/network.bluetooth.le.5_0", FALSE, FALSE},           /* BT_FEATURE_LE_5_0 */
        {"tizen.org/feature/network.bluetooth.le.ipsp", FALSE, FALSE},          /* BT_FEATURE_IPSP */
+       {"tizen.org/feature/network.bluetooth.le.mesh", TRUE, TRUE},            /* BT_FEATURE_MESH */
        {"tizen.org/feature/network.bluetooth.audio.call", FALSE, FALSE},       /* BT_FEATURE_AUDIO_CALL */
        {"tizen.org/feature/network.bluetooth.audio.media", FALSE, FALSE},      /* BT_FEATURE_AUDIO_MEDIA */
        {"tizen.org/feature/network.bluetooth.audio.controller", FALSE, FALSE}, /* BT_FEATURE_AUDIO_CONTROLLER */
@@ -1396,6 +1412,20 @@ static bool __bt_need_to_handle(int event)
        case BLUETOOTH_EVENT_GATT_WRITE_CHAR:
        case BLUETOOTH_EVENT_GATT_READ_DESC:
        case BLUETOOTH_EVENT_GATT_WRITE_DESC:
+       /* Mesh Events */
+       case BLUETOOTH_EVENT_MESH_SCAN_STARTED:
+       case BLUETOOTH_EVENT_MESH_SCAN_FINISHED:
+       case BLUETOOTH_EVENT_MESH_SCAN_RESULT:
+       case BLUETOOTH_EVENT_MESH_AUTHENTICATION_REQUEST:
+       case BLUETOOTH_EVENT_MESH_PROVISIONING_FINISHED:
+       case BLUETOOTH_EVENT_MESH_NODE_BROWSED:
+       case BLUETOOTH_EVENT_MESH_NODE_VENDOR_FEATURES:
+       case BLUETOOTH_EVENT_MESH_NODE_KEY_CONFIGURED:
+       case BLUETOOTH_EVENT_MESH_NODE_TTL_CONFIGURED:
+       case BLUETOOTH_EVENT_MESH_MODEL_APPKEY_LIST:
+       case BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_CONFGURED:
+       case BLUETOOTH_EVENT_MESH_MODEL_VIRTUAL_SUBSCRIPTION_CONFGURED:
+       case BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS:
                return true;
        default:
                break;
@@ -3597,6 +3627,446 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                BT_ERR("Address [%s]", otc_info->address);
                _bt_otc_connection_state_changed(_bt_get_error_code(param->result), otc_info);
                break;
+       } case BLUETOOTH_EVENT_MESH_SCAN_STARTED: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_SCAN_STARTED");
+               bluetooth_mesh_network_t *network = NULL;
+               bt_mesh_network_s *info = NULL;
+               network = (bluetooth_mesh_network_t *)(param->param_data);
+
+               info = _bt_mesh_get_network_handle_info(network->uuid);
+               if (!info)
+                       break;
+               BT_INFO("Mesh: Scan status for Network UUID[%s] Name [%s]",
+                       info->uuid, info->name);
+               ((bt_mesh_network_scan_unprovisioned_device_result_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_network_h) info,
+                                       BT_MESH_SCANNING_STARTED, NULL,
+                                               bt_event_slot_container[event_index].user_data);
+               break;
+       } case BLUETOOTH_EVENT_MESH_SCAN_FINISHED: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_SCAN_FINISHED");
+               bluetooth_mesh_network_t *network = NULL;
+               bt_mesh_network_s *info = NULL;
+               network = (bluetooth_mesh_network_t *)(param->param_data);
+
+               info = _bt_mesh_get_network_handle_info(network->uuid);
+               if (!info)
+                       break;
+               BT_INFO("Mesh: Scan status for Network UUID[%s] Name [%s]",
+                       info->uuid, info->name);
+               ((bt_mesh_network_scan_unprovisioned_device_result_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_network_h) info,
+                                       BT_MESH_SCANNING_FINISHED, NULL,
+                                               bt_event_slot_container[event_index].user_data);
+               break;
+       } case BLUETOOTH_EVENT_MESH_SCAN_RESULT: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_SCAN_RESULT");
+               bluetooth_mesh_scan_result_t *scan_result = NULL;
+               bt_mesh_network_s *info = NULL;
+               bt_mesh_scan_result_s *scan_res;
+               scan_result = (bluetooth_mesh_scan_result_t *)(param->param_data);
+
+               info = _bt_mesh_get_network_handle_info(scan_result->net_uuid);
+               if (!info)
+                       break;
+
+               BT_INFO("Mesh: Scan Result: Dev UUID[%s]", scan_result->dev_uuid);
+
+               scan_res = g_malloc0(sizeof(bt_mesh_scan_result_s));
+               scan_res->uuid = g_strdup(scan_result->dev_uuid);
+               scan_res->rssi = scan_result->rssi;
+               /* TODO Fill OOB Info and URI hash data during testing */
+
+               ((bt_mesh_network_scan_unprovisioned_device_result_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_network_h) info,
+                                       BT_MESH_SCAN_DEVICE_FOUND, scan_res,
+                                       bt_event_slot_container[event_index].user_data);
+
+               g_free(scan_res->uuid);
+               g_free(scan_res);
+               break;
+       } case BLUETOOTH_EVENT_MESH_AUTHENTICATION_REQUEST: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_AUTHENTICATION_REQUEST");
+               bluetooth_mesh_authentication_request_t *auth_req = NULL;
+               bt_mesh_network_s *info = NULL;
+               auth_req = (bluetooth_mesh_authentication_request_t *)(param->param_data);
+
+               info = _bt_mesh_get_network_handle_info(auth_req->net_uuid);
+               if (!info)
+                       break;
+
+               BT_INFO("Mesh: Authentication request: Type [%d]", auth_req->auth_type);
+               _bt_mesh_get_auth_string_from_value(auth_req->auth_type);
+               ((bt_mesh_authentication_request_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result),
+                                       (bt_mesh_authentication_type_e) auth_req->auth_type,
+                                                auth_req->auth_value,
+                                               bt_event_slot_container[event_index].user_data);
+               break;
+       } case BLUETOOTH_EVENT_MESH_PROVISIONING_FINISHED: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_PROVISIONING_FINISHED");
+               bluetooth_mesh_provisioning_result_t *prov_res = NULL;
+               bt_mesh_network_s *info = NULL;
+               prov_res = (bluetooth_mesh_provisioning_result_t *)(param->param_data);
+
+               info = _bt_mesh_get_network_handle_info(prov_res->net_uuid);
+               if (!info)
+                       break;
+
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Provisioning Result: SUCCESS");
+               else
+                       BT_INFO("Mesh: Provisioning Result: FAILED: Reason [%d]",
+                               prov_res->reason);
+
+               ((bt_mesh_network_device_provision_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result),
+                                       (bt_mesh_network_h) info, prov_res->dev_uuid,
+                                       bt_event_slot_container[event_index].user_data);
+               break;
+       } case BLUETOOTH_EVENT_MESH_NODE_BROWSED: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_NODE_BROWSED");
+               bluetooth_mesh_node_discover_t *res = NULL;
+               bt_mesh_network_s *info = NULL;
+               bt_mesh_node_s *node_s = NULL;
+               res = (bluetooth_mesh_node_discover_t *)(param->param_data);
+               BT_INFO("Mesh: Network UUID [%s]", res->net_uuid);
+
+               info = _bt_mesh_get_network_handle_info(res->net_uuid);
+               if (!info)
+                       break;
+
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Remote Node Browsing: SUCCESS");
+               else
+                       BT_INFO("Mesh: Remote Node Browsing: Failed");
+               node_s = _bt_mesh_remote_node_browsed(res->net_uuid, res->dev_uuid,
+                               res->unicast, res->count);
+
+               ((bt_mesh_node_discover_status_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_network_h) info,
+                                       (bt_mesh_node_h) node_s,
+                                       bt_event_slot_container[event_index].user_data);
+               break;
+       } case BLUETOOTH_EVENT_MESH_NODE_VENDOR_FEATURES: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_NODE_VENDOR_FEATURES");
+               bluetooth_mesh_node_features_t *res = NULL;
+               bt_mesh_network_s *network_s = NULL;
+               bt_mesh_node_s *node_s = NULL;
+               res = (bluetooth_mesh_node_features_t *)(param->param_data);
+
+               network_s = _bt_mesh_get_network_handle_info(res->net_uuid);
+               if (!network_s)
+                       break;
+
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Node Vendor Features: SUCCESS");
+               else
+                       BT_INFO("Mesh: Node Vendor Features: Failed");
+               node_s = _bt_mesh_remote_node_browsed(res->net_uuid, res->dev_uuid,
+                               res->unicast, res->elem_count);
+               if (!node_s)
+                       break;
+               node_s->features.cid = res->vendor_info.companyid;
+               node_s->features.pid = res->vendor_info.versionid;
+               node_s->features.vid = res->vendor_info.vendorid;
+               node_s->features.crpl = res->vendor_info.crpl;
+
+               if (res->features.relay)
+                       node_s->features.features = BT_MESH_FEATURE_RELAY;
+               if (res->features.proxy)
+                       node_s->features.features |= BT_MESH_FEATURE_PROXY;
+               if (res->features.frnd)
+                       node_s->features.features |= BT_MESH_FEATURE_FRIEND;
+               if (res->features.lpn)
+                       node_s->features.features |= BT_MESH_FEATURE_LOWPOWER;
+
+               ((bt_mesh_node_features_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_node_h) node_s,
+                                       (bt_mesh_node_features_s*)&node_s->features,
+                                       bt_event_slot_container[event_index].user_data);
+               break;
+       } case BLUETOOTH_EVENT_MESH_NODE_KEY_CONFIGURED : {
+               BT_INFO("BLUETOOTH_EVENT_MESH_NODE_KEY_CONFIGURED");
+               bluetooth_mesh_key_configure_t *res = NULL;
+               bt_mesh_network_s *info = NULL;
+               bt_mesh_node_s *node_s = NULL;
+               bt_mesh_netkey_s *netkey_s = NULL;
+               bt_mesh_appkey_s *appkey_s = NULL;
+               res = (bluetooth_mesh_key_configure_t *)(param->param_data);
+
+               info = _bt_mesh_get_network_handle_info(res->net_uuid);
+               if (!info)
+                       break;
+
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Node Key Cofiguration: SUCCESS");
+               else
+                       BT_INFO("Mesh: Node Key Cofiguration: FAILED");
+               node_s = _bt_mesh_get_node_from_unicast(res->net_uuid,
+                               res->primary_unicast);
+               if (!node_s) {
+                       BT_ERR("Mesh: Node not found in Network!! Unexpected!!");
+                       break;
+               }
+               /* Handle NetKey configuration events */
+               if (res->is_netkey == true) {
+                       netkey_s = _bt_mesh_handle_node_netkey_configure(info, node_s,
+                                       res->netkey_idx,
+                                               (bt_mesh_node_key_configuration_e)res->op);
+
+                       ((bt_mesh_netkey_status_cb)bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_node_key_configuration_e)res->op,
+                                (bt_mesh_node_h) node_s, (bt_mesh_netkey_h) netkey_s,
+                                       bt_event_slot_container[event_index].user_data);
+               /* Handle AppKey configuration events */
+               } else {
+                       appkey_s = _bt_mesh_handle_node_appkey_configure(info, node_s, res->netkey_idx,
+                                       res->appkey_idx, (bt_mesh_node_key_configuration_e)res->op);
+
+                       ((bt_mesh_appkey_status_cb)
+                               bt_event_slot_container[event_index].callback)
+                                       (_bt_get_error_code(param->result),
+                                               (bt_mesh_node_key_configuration_e)res->op,
+                                                       (bt_mesh_node_h) node_s, (bt_mesh_netkey_h) netkey_s,
+                                                               (bt_mesh_appkey_h) appkey_s,
+                                                                bt_event_slot_container[event_index].user_data);
+               }
+               break;
+       } case BLUETOOTH_EVENT_MESH_NODE_TTL_CONFIGURED: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_NODE_TTL_CONFIGURED");
+               bluetooth_mesh_node_ttl_info_t *res = NULL;
+               bt_mesh_network_s *info = NULL;
+               bt_mesh_node_s *node_s = NULL;
+               bt_mesh_node_ttl_operation_e ttl_op;
+               res = (bluetooth_mesh_node_ttl_info_t *)(param->param_data);
+               BT_INFO("Mesh: Network UUID [%s]", res->net_uuid);
+
+               info = _bt_mesh_get_network_handle_info(res->net_uuid);
+               if (!info)
+                       break;
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Node TTL configure [%s]: SUCCESS",
+                               res->is_set? "Set" : "Get");
+               else
+                       BT_INFO("Mesh: Node TTL configure [%s]: FAILED",
+                                       res->is_set? "Set" : "Get");
+
+               node_s = _bt_mesh_get_node_from_unicast(res->net_uuid, res->unicast);
+               if (!node_s)
+                       break;
+               ttl_op = res->is_set ? BT_MESH_TTL_SET : BT_MESH_TTL_GET;
+               ((bt_mesh_node_ttl_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_node_h) node_s,
+                                       ttl_op, res->ttl,
+                                       bt_event_slot_container[event_index].user_data);
+               break;
+       }
+       /* Fall through */
+       case BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_CONFGURED:
+       case BLUETOOTH_EVENT_MESH_MODEL_VIRTUAL_SUBSCRIPTION_CONFGURED: {
+               BT_INFO("BLUETOOTH_EVENT_MESH_SUBSCRIPTION_CONFIGURED");
+               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_model_s *model_s = NULL;
+               bt_mesh_model_subscription_op_e sub_op;
+               res = (bluetooth_mesh_model_configure_t *)(param->param_data);
+
+               network_s = _bt_mesh_get_network_handle_info(res->net_uuid);
+               if (!network_s)
+                       break;
+
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Model Subscription Configuration: SUCCESS");
+               else
+                       BT_INFO("Mesh: Model Subscription Configuration: FAILED");
+
+               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_get_group_from_sub(network_s,
+                               model_s, res->op,  res->sub_addr);
+
+               sub_op = res->op;
+               if (sub_op == BT_MESH_MODEL_SUBSCRIPTION_DELETE_ALL)
+                       ((bt_mesh_model_subscription_op_cb)
+                               bt_event_slot_container[event_index].callback)
+                                       (_bt_get_error_code(param->result), sub_op,
+                                       (bt_mesh_model_h) model_s, NULL,
+                                       bt_event_slot_container[event_index].user_data);
+               else
+                       ((bt_mesh_model_subscription_op_cb)
+                               bt_event_slot_container[event_index].callback)
+                                       (_bt_get_error_code(param->result), sub_op,
+                                       (bt_mesh_model_h) model_s, (bt_mesh_group_h) group_s,
+                                       bt_event_slot_container[event_index].user_data);
+               break;
+       }
+       case BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS: {
+               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;
+               res = (bluetooth_mesh_model_configure_t *)(param->param_data);
+
+               network_s = _bt_mesh_get_network_handle_info(res->net_uuid);
+               if (!network_s)
+                       break;
+
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Model Publication Status: SUCCESS");
+               else
+                       BT_INFO("Mesh: Model Publication Status: FAILED");
+
+               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);
+
+               /* Exception is Unassigned address */
+               if (!group_s &&  res->sub_addr == 0x0000)
+                       ((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_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);
+               break;
+       }
+       case BLUETOOTH_EVENT_MESH_MODEL_APPKEY_LIST : {
+               BT_INFO("BLUETOOTH_EVENT_MESH_MODEL_APPKEY_LIST");
+               bluetooth_mesh_model_configure_t *res = NULL;
+               bt_mesh_network_s *info = NULL;
+               bt_mesh_node_s *node_s = NULL;
+               GSList *appkeylist = NULL;
+               int total = 0;
+               res = (bluetooth_mesh_model_configure_t *)(param->param_data);
+
+               info = _bt_mesh_get_network_handle_info(res->net_uuid);
+               if (!info)
+                       break;
+
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Node Model AppKeyList: SUCCESS");
+               else
+                       BT_INFO("Mesh: Node Model AppKeyList : FAILED");
+
+               node_s = _bt_mesh_get_node_from_unicast(res->net_uuid,
+                       res->primary_unicast);
+               if (!node_s)
+                       break;
+               bt_mesh_model_s *model_s;
+               bt_mesh_element_s *element_s;
+               total = res->appkeylist_count;
+
+               for (int i = 0; i < total; i++) {
+                       bt_mesh_appkey_s *appkey;
+                       appkey = _bt_mesh_node_get_appkey(node_s, *res->appkey_list[i]);
+                       if (appkey)
+                               appkeylist = g_slist_append(appkeylist, appkey);
+                       /* Free memory */
+                       g_free(res->appkey_list[i]);
+               }
+
+               element_s = _bt_mesh_get_element_from_index(node_s, res->elem_index);
+               if (!element_s)
+                       break;
+               model_s = _bt_mesh_get_model_from_modelid(element_s, res->model);
+               if (!model_s)
+                       break;
+               ((bt_mesh_model_appkey_list_cb)
+                        bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_model_h) model_s,
+                                        total, appkeylist,
+                                                bt_event_slot_container[event_index].user_data);
+               break;
+       }
+       case BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_LIST : {
+               BT_INFO("BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_LIST");
+               bluetooth_mesh_model_configure_t *res = NULL;
+               bt_mesh_network_s *network_s = NULL;
+               bt_mesh_node_s *node_s = NULL;
+               GSList *sublist = NULL;
+               int total = 0;
+               res = (bluetooth_mesh_model_configure_t *)(param->param_data);
+
+               network_s = _bt_mesh_get_network_handle_info(res->net_uuid);
+               if (!network_s)
+                       break;
+
+               if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+                       BT_INFO("Mesh: Node Model Subscription List: SUCCESS");
+               else
+                       BT_INFO("Mesh: Node Model Subscription List: FAILED");
+
+               node_s = _bt_mesh_get_node_from_unicast(res->net_uuid,
+                               res->primary_unicast);
+               if (!node_s)
+                       break;
+               bt_mesh_model_s *model_s;
+               bt_mesh_element_s *element_s;
+
+               element_s = _bt_mesh_get_element_from_index(node_s, res->elem_index);
+               if (!element_s)
+                       break;
+               model_s = _bt_mesh_get_model_from_modelid(element_s, res->model);
+               if (!model_s)
+                       break;
+               total = res->sublist_count;
+
+               for (int i = 0; i < total; i++) {
+                       bt_mesh_group_s *group_s;
+                       group_s = _bt_mesh_network_get_group(network_s, *res->sub_list[i]);
+                       sublist = g_slist_append(sublist, group_s);
+                               g_free(res->sub_list[i]);
+               }
+               ((bt_mesh_model_subscription_list_cb)
+                       bt_event_slot_container[event_index].callback)
+                               (_bt_get_error_code(param->result), (bt_mesh_model_h) model_s,
+                                        total, sublist,
+                                               bt_event_slot_container[event_index].user_data);
+               break;
        }
        default:
                BT_INFO("Unknown function");