Mesh: Implement Node configuration API's
authorAnupam Roy <anupam.r@samsung.com>
Fri, 17 Jul 2020 16:27:51 +0000 (21:57 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Fri, 17 Jul 2020 16:27:51 +0000 (21:57 +0530)
This patch-set handles following
- Configure Keys
- Configure Publications (GET/SET)
- Configure Subscription (Get/Set)
- Model Binding
- Configure TTL (Time to Live)
- Browse Node's composition
- Browse Node's vendor features
- Configure Groups(Normal & Virtual)

 Note: application credential is requested
 in service layer to get access to Mesh Resources
 for formward coompatibility.
 Credentials are not yet fully handled.

Change-Id: I6e3dd9a17167b528725f7a472d248d7f883c61be
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
bt-api/bt-mesh.c
bt-service/services/bt-request-handler.c

index 5963603..ea9d1ae 100644 (file)
@@ -397,9 +397,278 @@ BT_EXPORT_API int bluetooth_mesh_network_delete_appkey(bluetooth_mesh_network_t
        return result;
 }
 
-BT_EXPORT_API int bluetooth_mesh_network_get_all_netkey(
+BT_EXPORT_API int bluetooth_mesh_network_get_all_nodes(
+               bluetooth_mesh_network_t *network,
+                       GPtrArray **nodes)
+{
+       int result = BLUETOOTH_ERROR_NONE;
+       guint size;
+       int i;
+       bluetooth_mesh_node_info_t *info;
+
+       BT_CHECK_PARAMETER(network, return);
+       BT_CHECK_PARAMETER(nodes, return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, network,  sizeof(bluetooth_mesh_network_t));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NETWORK_GET_NODES,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       if (result == BLUETOOTH_ERROR_NONE) {
+               if (out_param == NULL) {
+                       BT_ERR("Mesh: out_param is NULL");
+                       result = BLUETOOTH_ERROR_INTERNAL;
+               } else {
+                       size = (out_param->len) / sizeof(bluetooth_mesh_node_info_t);
+
+                       for (i = 0; i < size; i++) {
+                               bluetooth_mesh_node_info_t *data;
+
+                               info = &g_array_index(out_param,
+                                               bluetooth_mesh_node_info_t, i);
+
+                               data= g_memdup(info, sizeof(bluetooth_mesh_node_info_t));
+                               g_ptr_array_add(*nodes, (gpointer)data);
+                       }
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_element_get_all_models(
        bluetooth_mesh_network_t *network,
-               GPtrArray **netkeys)
+               uint16_t node_addr, int elem_idx,
+                       GPtrArray **models)
+{
+       int result = BLUETOOTH_ERROR_NONE;
+       guint size;
+       int i;
+
+       BT_CHECK_PARAMETER(network, return);
+       BT_CHECK_PARAMETER(models, return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, network,  sizeof(bluetooth_mesh_network_t));
+       g_array_append_vals(in_param2, &node_addr,  sizeof(guint16));
+       g_array_append_vals(in_param3, &elem_idx,  sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_ELEMENT_GET_MODELS,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       if (result == BLUETOOTH_ERROR_NONE) {
+               if (out_param == NULL) {
+                       BT_ERR("Mesh: out_param is NULL");
+                       result = BLUETOOTH_ERROR_INTERNAL;
+               } else {
+                       size = (out_param->len) / sizeof(guint16);
+
+                       for (i = 0; i < size; i++) {
+                               uint32_t model_obj;
+                               uint32_t *model_ptr = NULL;
+
+                               model_obj = g_array_index(out_param,
+                                               guint32, i);
+
+                               model_ptr = g_memdup(&model_obj, sizeof(guint32));
+                               g_ptr_array_add(*models, (gpointer)model_ptr);
+                       }
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_node_browse_vendor_features(
+                       bluetooth_mesh_node_features_t *req)
+{
+       int result;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_node_features_t));
+
+       BT_INFO("Mesh: Browse Vendor features of Node");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_NODE_GET_VENDOR_FEATURES,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_browse_remote_node(
+                       bluetooth_mesh_node_discover_t *req)
+{
+       int result;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_node_discover_t));
+
+       BT_INFO("Mesh: Browse remote Node");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_NODE_BROWSE,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_node_ttl_execute(
+                       bluetooth_mesh_node_ttl_info_t *req)
+{
+       int result;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_node_ttl_info_t));
+
+       BT_INFO("Mesh: Node TTL Execute");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_NODE_TTL_EXECUTE,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_model_configure_appkey(
+                       bluetooth_mesh_model_configure_t *req)
+{
+       int result;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_model_configure_t));
+
+       BT_INFO("Mesh: Node Model Configure AppKey");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_MODEL_CONFIGURE_APPKEY,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_node_configure_key(
+                       bluetooth_mesh_key_configure_t *req)
+{
+       int result;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_key_configure_t));
+
+       BT_INFO("Mesh:BTAPI: Node Key Configure");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_NODE_CONFIGURE_KEY,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_network_get_all_groups(
+               bluetooth_mesh_network_t *network,
+                       GPtrArray **groups)
+{
+       int result = BLUETOOTH_ERROR_NONE;
+       guint size;
+       int i;
+
+       BT_CHECK_PARAMETER(network, return);
+       BT_CHECK_PARAMETER(groups, return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, network,  sizeof(bluetooth_mesh_network_t));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NETWORK_GET_GROUPS,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       if (result == BLUETOOTH_ERROR_NONE) {
+               if (out_param == NULL) {
+                       BT_ERR("Mesh: out_param is NULL");
+                       result = BLUETOOTH_ERROR_INTERNAL;
+               } else {
+                       size = (out_param->len) / sizeof(guint16);
+
+                       if (size == 0) {
+                               BT_INFO("Mesh: No Groups created for the network");
+                       }
+
+                       for (i = 0; i < size; i++) {
+                               uint16_t group_addr;
+                               uint16_t *group_ptr = NULL;
+
+                               group_addr = g_array_index(out_param,
+                                               guint16, i);
+
+                               group_ptr = g_memdup(&group_addr, sizeof(guint16));
+                               g_ptr_array_add(*groups, (gpointer)group_ptr);
+                       }
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_network_get_all_netkey(
+               bluetooth_mesh_network_t *network,
+                       GPtrArray **netkeys)
 {
        int result = BLUETOOTH_ERROR_NONE;
        guint size;
@@ -496,3 +765,270 @@ BT_EXPORT_API int bluetooth_mesh_netkey_get_all_appkey(
 
        return result;
 }
+
+BT_EXPORT_API int bluetooth_mesh_node_get_all_netkeys(
+               bluetooth_mesh_node_discover_t *node,
+                       GPtrArray **netkeys)
+{
+       int result = BLUETOOTH_ERROR_NONE;
+       guint size;
+       int i;
+
+       BT_CHECK_PARAMETER(node, return);
+       BT_CHECK_PARAMETER(netkeys, return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, node,  sizeof(bluetooth_mesh_node_discover_t));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NODE_GET_NETKEYS,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       if (result == BLUETOOTH_ERROR_NONE) {
+               if (out_param == NULL) {
+                       BT_ERR("Mesh: out_param is NULL");
+                       result = BLUETOOTH_ERROR_INTERNAL;
+               } else {
+                       size = (out_param->len) / sizeof(guint16);
+
+                       for (i = 0; i < size; i++) {
+                               uint16_t netkey_index;
+                               uint16_t *netkey_idx = NULL;
+
+                               netkey_index = g_array_index(out_param,
+                                               guint16, i);
+
+                               netkey_idx = g_memdup(&netkey_index, sizeof(guint16));
+                               g_ptr_array_add(*netkeys, (gpointer)netkey_idx);
+                       }
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_node_get_all_appkeys(
+       bluetooth_mesh_node_discover_t *req, GPtrArray **appkeys)
+{
+       int result = BLUETOOTH_ERROR_NONE;
+       guint size;
+       int i;
+
+       BT_CHECK_PARAMETER(req, return);
+       BT_CHECK_PARAMETER(appkeys, return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_node_discover_t));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NODE_GET_APPKEYS,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       if (result == BLUETOOTH_ERROR_NONE) {
+               if (out_param == NULL) {
+                       BT_ERR("Mesh: out_param is NULL");
+                       result = BLUETOOTH_ERROR_INTERNAL;
+               } else {
+                       size = (out_param->len) / sizeof(guint16);
+
+                       for (i = 0; i < size; i++) {
+                               uint16_t appkey_index;
+                               uint16_t *appkey_idx = NULL;
+
+                               appkey_index = g_array_index(out_param,
+                                               guint16, i);
+
+                               appkey_idx = g_memdup(&appkey_index, sizeof(guint16));
+                               g_ptr_array_add(*appkeys, (gpointer)appkey_idx);
+                       }
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_model_get_all_appkeys(
+                       bluetooth_mesh_model_configure_t *req)
+{
+       int result = 0;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_model_configure_t));
+
+       BT_INFO("Mesh:Node Model Get AppKey List ");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_MODEL_GET_APPKEY_LIST,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_model_set_publication(
+                       bluetooth_mesh_model_configure_t *req)
+{
+       int result = 0;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_model_configure_t));
+
+       BT_INFO("Mesh: Model Set Publication");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_MODEL_SET_PUBLICATION,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_model_get_publication(
+                       bluetooth_mesh_model_configure_t *req)
+{
+       int result = 0;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_model_configure_t));
+
+       BT_INFO("Mesh:BTAPI:  Model Get Publication");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_MODEL_GET_PUBLICATION,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_model_get_subscriptopn_list(
+                       bluetooth_mesh_model_configure_t *req)
+{
+       int result = 0;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_model_configure_t));
+
+       BT_INFO("Mesh:BTAPI:  Model Get Subscription List ");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_MODEL_GET_SUBSCRIPTION_LIST,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_network_create_group(
+               bluetooth_mesh_network_t *network, bool is_virtual,
+                       uint16_t grp_addr, bluetooth_mesh_network_group_info_t *info)
+{
+       int result;
+
+       BT_CHECK_PARAMETER(network, return);
+       BT_CHECK_PARAMETER(info, return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, network,  sizeof(bluetooth_mesh_network_t));
+       g_array_append_vals(in_param2, &is_virtual,  sizeof(gboolean));
+       g_array_append_vals(in_param3, &grp_addr,  sizeof(guint16));
+
+       BT_INFO("Mesh: Create Group Request");
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NETWORK_CREATE_GROUP,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       if (result == BLUETOOTH_ERROR_NONE) {
+               *info = g_array_index(out_param,
+                               bluetooth_mesh_network_group_info_t, 0);
+       }
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_model_configure_group_sub(
+                       bluetooth_mesh_model_configure_t *req)
+{
+       int result = 0;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_model_configure_t));
+
+       BT_INFO("Mesh:Model Group Subscription Request");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_MESH_MODEL_CONFIG_GROUP_SUB,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_model_configure_virtual_group_sub(
+                       bluetooth_mesh_model_configure_t *req)
+{
+       int result = 0;
+       bt_user_info_t *user_info;
+
+       BT_CHECK_PARAMETER(req, return);
+
+       user_info = _bt_get_user_data(BT_MESH);
+       retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, req,  sizeof(bluetooth_mesh_model_configure_t));
+
+       BT_INFO("Mesh: Model Virtual Group Subscription Request");
+       result = _bt_send_request_async(BT_BLUEZ_SERVICE,
+                       BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB,
+                       in_param1, in_param2, in_param3, in_param4,
+                       user_info->cb, user_info->user_data);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+       return result;
+}
index c61e140..b516db6 100644 (file)
@@ -43,6 +43,7 @@
 #include "bt-service-gatt.h"
 #include "bt-service-mesh-util.h"
 #include "bt-service-mesh-network.h"
+#include "bt-service-mesh-config-client.h"
 
 #ifdef TIZEN_FEATURE_BT_DPM
 #include "bt-service-dpm.h"
@@ -232,6 +233,7 @@ static gboolean __bt_is_sync_function(int service_function)
                        || service_function == BT_AUDIO_SELECT_ROLE
                        /* Mesh API's */
                        || service_function == BT_MESH_NETWORK_CREATE
+                       || service_function == BT_MESH_NETWORK_LOAD
                        || service_function == BT_MESH_NETWORK_SCAN
                        || service_function == BT_MESH_NETWORK_ADD_NETKEY
                        || service_function == BT_MESH_NETWORK_DELETE_NETKEY
@@ -3431,6 +3433,25 @@ normal:
                BT_INFO("Mesh: Cleanup Done");
                break;
        }
+       case BT_MESH_NETWORK_LOAD: {
+               char *token = NULL;
+               bluetooth_mesh_network_t *network;
+               token = (char *)g_variant_get_data(in_param1);
+               BT_INFO("MESH: Network Load: Token string [%s]", token);
+               result = _bt_mesh_network_load(requester_unique_creds, sender, token);
+               /* Save invocation */
+               if (result == BLUETOOTH_ERROR_NONE) {
+                       network =  g_malloc0(sizeof(bluetooth_mesh_network_t));
+                       g_strlcpy(network->token.token, token, strlen(token));
+                       g_strlcpy(network->app_cred, requester_unique_creds, strlen(requester_unique_creds));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)network);
+               }
+               g_free((gpointer)requester_unique_creds);
+               break;
+       }
        case BT_MESH_NETWORK_SCAN: {
                bluetooth_mesh_network_t network;
                bluetooth_mesh_scan_param_t param;
@@ -3709,8 +3730,354 @@ normal:
                                &network, sizeof(bluetooth_mesh_network_t));
                __bt_service_get_parameters(in_param2,
                                &net_idx, sizeof(guint16));
-               result = _bt_mesh_network_get_appkeys(requester_unique_creds,
-                               sender, &network, net_idx, out_param1);
+               result = _bt_mesh_network_get_appkeys(
+                               requester_unique_creds, sender,
+                                       &network, net_idx, out_param1);
+               break;
+       }
+       case BT_MESH_NETWORK_GET_NODES: {
+               bluetooth_mesh_network_t network;
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               result = _bt_mesh_network_get_nodes(
+                               requester_unique_creds, sender,
+                                       &network, out_param1);
+               break;
+       }
+       case BT_MESH_ELEMENT_GET_MODELS: {
+               bluetooth_mesh_network_t network;
+               uint16_t node_addr;
+               int elem_idx;
+
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param2,
+                               &node_addr, sizeof(guint16));
+               __bt_service_get_parameters(in_param3,
+                               &elem_idx, sizeof(int));
+               result = _bt_mesh_element_get_models(requester_unique_creds, sender,
+                               &network, node_addr, elem_idx, out_param1);
+               break;
+       }
+       case BT_MESH_NODE_BROWSE: {
+               bluetooth_mesh_node_discover_t req;
+               memset(&req, 0x00, sizeof(bluetooth_mesh_node_discover_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_node_discover_t));
+
+               result = _bt_mesh_browse_remote_node(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req,
+                               sizeof(bluetooth_mesh_node_discover_t));
+               } else {
+                       bluetooth_mesh_node_discover_t *param = \
+                               g_memdup(&req, sizeof(bluetooth_mesh_node_discover_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_NODE_GET_VENDOR_FEATURES: {
+               bluetooth_mesh_node_features_t req;
+               memset(&req, 0x00, sizeof(bluetooth_mesh_node_features_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_node_features_t));
+
+               result = _bt_mesh_node_discover_vendor_features(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1,
+                               &req, sizeof(bluetooth_mesh_node_features_t));
+               } else {
+                       bluetooth_mesh_node_features_t *param =  \
+                               g_memdup(&req, sizeof(bluetooth_mesh_node_features_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_NODE_CONFIGURE_KEY: {
+               bluetooth_mesh_key_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_key_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_key_configure_t));
+
+               result = _bt_mesh_node_configure_key(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1,
+                               &req, sizeof(bluetooth_mesh_key_configure_t));
+               } else {
+                       bluetooth_mesh_key_configure_t *param = \
+                               g_memdup(&req, sizeof(bluetooth_mesh_key_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_NODE_TTL_EXECUTE: {
+               bluetooth_mesh_node_ttl_info_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_node_ttl_info_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_node_ttl_info_t));
+
+               result = _bt_mesh_ttl_execute_remote_node(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_node_ttl_info_t));
+               } else {
+                       bluetooth_mesh_node_ttl_info_t *param =  \
+                               g_memdup(&req, sizeof(bluetooth_mesh_node_ttl_info_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_CONFIGURE_APPKEY: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_node_model_appkey_execute(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_NODE_GET_NETKEYS: {
+               bluetooth_mesh_node_discover_t node;
+               memset(&node, 0x00, sizeof(bluetooth_mesh_node_discover_t));
+               __bt_service_get_parameters(in_param1,
+                               &node, sizeof(bluetooth_mesh_node_discover_t));
+               result = _bt_mesh_network_node_get_netkeys(
+                               requester_unique_creds, &node, out_param1);
+               break;
+       }
+       case BT_MESH_NODE_GET_APPKEYS: {
+               bluetooth_mesh_node_discover_t node;
+               memset(&node, 0x00, sizeof(bluetooth_mesh_node_discover_t));
+               __bt_service_get_parameters(in_param1,
+                               &node, sizeof(bluetooth_mesh_node_discover_t));
+               result = _bt_mesh_network_node_get_appkeys(
+                               requester_unique_creds, sender, &node, out_param1);
+               break;
+       }
+       case BT_MESH_MODEL_GET_APPKEY_LIST: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_node_model_get_appkey_list(
+                                       requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param = \
+                               g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_GET_SUBSCRIPTION_LIST: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_node_model_get_subscription_list(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+
+               break;
+       }
+       case BT_MESH_NETWORK_CREATE_GROUP: {
+               bluetooth_mesh_network_t net;
+               bluetooth_mesh_network_group_info_t res;
+               gboolean is_virtual;
+               uint16_t grp_addr;
+
+               memset(&net, 0x00, sizeof(bluetooth_mesh_network_t));
+               memset(&res, 0x00, sizeof(bluetooth_mesh_network_group_info_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &net, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param2,
+                               &is_virtual, sizeof(gboolean));
+               __bt_service_get_parameters(in_param3,
+                               &grp_addr, sizeof(guint16));
+
+               result = _bt_mesh_network_create_group(
+                               requester_unique_creds, sender, &net,
+                                       is_virtual, grp_addr, &res);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       g_array_append_vals(*out_param1, &res,
+                               sizeof(bluetooth_mesh_network_group_info_t));
+               break;
+       }
+       case BT_MESH_MODEL_CONFIG_GROUP_SUB: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_model_configure_group_subscription(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_model_configure_virtual_group_subscription(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_SET_PUBLICATION: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_model_set_publication(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param = g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_GET_PUBLICATION: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_model_get_publication(
+                                       requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_NETWORK_GET_GROUPS: {
+               bluetooth_mesh_network_t network;
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               result = _bt_mesh_network_get_groups(
+                               requester_unique_creds, sender, &network, out_param1);
                break;
        }
        default:
@@ -4337,7 +4704,7 @@ gboolean __bt_service_check_privilege(int function_name,
                return FALSE;
        }
 
-//     BT_DBG("%s, %s, %s", unique_name, client_creds, user_creds);
+       BT_DBG("%s, %s, %s", unique_name, client_creds, user_creds);
 
        switch (function_name) {
        case BT_SET_LOCAL_NAME:
@@ -4534,6 +4901,7 @@ gboolean __bt_service_check_privilege(int function_name,
 
        case BT_RFCOMM_LISTEN_AND_ACCEPT:
        case BT_MESH_NETWORK_CREATE:
+       case BT_MESH_NETWORK_LOAD:
        case BT_MESH_NETWORK_SCAN:
        case BT_MESH_NETWORK_CANCEL_SCAN:
        case BT_MESH_NETWORK_SET_CAPABILITIES:
@@ -4548,6 +4916,22 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_MESH_NETWORK_UPDATE_APPKEY:
        case BT_MESH_NETWORK_GET_NETKEYS:
        case BT_MESH_NETWORK_GET_APPKEYS:
+       case BT_MESH_NETWORK_GET_NODES:
+       case BT_MESH_ELEMENT_GET_MODELS:
+       case BT_MESH_NODE_BROWSE:
+       case BT_MESH_NODE_GET_VENDOR_FEATURES:
+       case BT_MESH_NODE_CONFIGURE_KEY:
+       case BT_MESH_NODE_TTL_EXECUTE:
+       case BT_MESH_NODE_GET_NETKEYS:
+       case BT_MESH_NODE_GET_APPKEYS:
+       case BT_MESH_MODEL_CONFIGURE_APPKEY:
+       case BT_MESH_MODEL_GET_APPKEY_LIST:
+       case BT_MESH_NETWORK_CREATE_GROUP:
+       case BT_MESH_MODEL_CONFIG_GROUP_SUB:
+       case BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB:
+       case BT_MESH_MODEL_SET_PUBLICATION:
+       case BT_MESH_MODEL_GET_PUBLICATION:
+       case BT_MESH_NETWORK_GET_GROUPS:
 
        ret_val = cynara_check(p_cynara, client_creds, client_session, user_creds,
                                                BT_PRIVILEGE_PUBLIC);