Mesh: Save vendor & model info post net create 13/242413/2
authorAnupam Roy <anupam.r@samsung.com>
Wed, 26 Aug 2020 17:24:12 +0000 (22:54 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Thu, 27 Aug 2020 03:25:47 +0000 (08:55 +0530)
This patch handles following:-

Vendor & model info of local config client
node was not saved to Configuration database
after network is created which caused Network
Load operation to fail due to missing Vendor
& Model Info.

With this patch, all vendor & model info are now
saved to CDB. Dduring Network Load, all data are
fetched from Conf DB and node data is prepared,
which is eventually used to attach to the Network.

Change-Id: Id2d59a6d8bebb32a9a251781b3c0cab494daea1f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
bt-oal/bluez_hal/src/bt-hal-mesh-dbus-handler.c
bt-oal/hardware/bt_mesh.h
bt-service/services/bt-request-handler.c
bt-service/services/include/bt-service-mesh-cdb.h
bt-service/services/mesh/bt-service-mesh-cdb.c
bt-service/services/mesh/bt-service-mesh-main.c
bt-service/services/mesh/bt-service-mesh-network.c
bt-service/services/mesh/bt-service-mesh-nodes.c
include/bluetooth-mesh-api.h

index 65bf714..9166f05 100644 (file)
@@ -1691,6 +1691,7 @@ meshcfg_app *__bt_hal_mesh_create_app(bt_hal_mesh_node_t *node,
        char *uuid_str = NULL;
 
        uuid_str = l_util_hexstring(node->uuid.uu, sizeof(uuid));
+       INFO("Mesh: Network UUID [%s]", uuid_str);
 
        app = g_malloc0(sizeof(meshcfg_app));
        memcpy(app->uuid, node->uuid.uu, sizeof(uuid));
@@ -1712,6 +1713,8 @@ meshcfg_app *__bt_hal_mesh_create_app(bt_hal_mesh_node_t *node,
 
        g_free(uuid_str);
        app->is_prov = is_prov;
+       app->token.u64 = node->token.u64;
+       INFO("Mesh: Token [%llu]", app->token.u64);
        INFO("Mesh: app created");
        return app;
 }
@@ -2458,7 +2461,7 @@ bt_status_t _bt_hal_mesh_network_destroy(bt_uuid_t *net_uuid)
                        ERR("Mesh: Proxy check failed!!");
                        return BT_STATUS_FAIL;
                }
-               INFO("Mesh: Create New Network");
+               INFO("Mesh: Destroy Network");
                /* Create CFG Network */
                if (!l_dbus_proxy_method_call(net_proxy, "Leave",
                                        __bt_hal_mesh_leave_net_setup,
@@ -2494,6 +2497,7 @@ bt_status_t _bt_hal_mesh_create_network(
        INFO("Mesh: Node Vendor Info: VSID[0x%2.2x]", node->vendor_info.versionid);
        INFO("Mesh: Node Vendor Info: CRPL[0x%2.2x]", node->vendor_info.crpl);
        INFO("Mesh: Node Total Number of Models in the node[%d]", g_slist_length(models));
+       INFO("Mesh: Token [%llu]", node->token.u64);
        /* Create DBUS APP */
        app = __bt_hal_mesh_create_app(node, models, is_prov);
        if (!app)
@@ -2514,7 +2518,7 @@ bt_status_t _bt_hal_mesh_create_network(
                        goto failed;
                }
        } else {
-               INFO("Mesh: Attach Node to Network");
+               INFO("Mesh: Attach Node to Network: Token [%llu]", app->token.u64);
                /* Attach to Network */
                if (!l_dbus_proxy_method_call(net_proxy, "Attach",
                                        __bt_hal_mesh_attach_node_setup,
index e383fe0..090045e 100644 (file)
@@ -67,6 +67,10 @@ typedef struct {
        uint16_t vendorid;
        uint16_t versionid;
        uint16_t crpl;
+       int relay;
+       int frnd;
+       int proxy;
+       int lpn;
 } bt_hal_mesh_vendor_info_t;
 
 /* Mesh Model: 2 bytes for BT SIG Model & 4 bytes for Vendor Model */
index 8a2f94e..261cd37 100644 (file)
@@ -3390,6 +3390,7 @@ normal:
                __bt_service_get_parameters(in_param1,
                                &node, sizeof(bluetooth_mesh_node_t));
                network_name = (const char *)g_variant_get_data(in_param2);
+
                BT_INFO("MESH: Network name [%s]", network_name);
 
                param3 = g_array_new(TRUE, TRUE, sizeof(gchar));
@@ -3480,8 +3481,10 @@ normal:
                /* 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));
+                       g_strlcpy(network->token.token, token,
+                                       BLUETOOTH_MESH_NETWORK_TOKEN_STRING_LENGTH + 1);
+                       g_strlcpy(network->app_cred, requester_unique_creds,
+                                       sizeof(network->app_cred));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
index 17dd398..1e988da 100644 (file)
@@ -54,6 +54,13 @@ void _bt_mesh_conf_free(_bt_mesh_cdb_t *cfg);
 
 bool _bt_mesh_conf_parse_data(void *cfg, int k);
 
+bool _bt_mesh_conf_set_vendor_info(_bt_mesh_cdb_t *cfg,uint16_t unicast,
+               uint16_t crpl, uint16_t cid, uint16_t vid, uint16_t pid,
+                       int proxy, int relay,int lpn, int frnd);
+
+bool _bt_mesh_conf_set_model_info(_bt_mesh_cdb_t *cfg,
+               uint16_t unicast, GSList *models);
+
 _bt_mesh_cdb_t * _bt_mesh_conf_database_create(const char *file_name,
        const uint8_t uuid[16], const uint8_t token[8],
                const char *network_name,
index c69ea7f..a897564 100644 (file)
@@ -357,6 +357,8 @@ static json_object *__mesh_get_node_by_uuid(json_object *jcfg,
                if (strlen(str) != 32)
                        continue;
                BT_INFO("Mesh: Got one node with UUID [%s]", str);
+               BT_INFO("Mesh: Match with uuid [%s]", buf);
+
                if (!g_strcmp0(buf, str))
                        return jentry;
        }
@@ -401,7 +403,7 @@ static bool __mesh_get_token(json_object *jobj, uint8_t token[8])
        json_object *jval;
        const char *str;
 
-       if (!json_object_object_get_ex(jobj, "token", &jval))
+       if (!json_object_object_get_ex(jobj, "Network_Token", &jval))
                return false;
 
        str = json_object_get_string(jval);
@@ -416,7 +418,7 @@ static bool __mesh_get_uuid(json_object *jobj, uint8_t uuid[16])
        json_object *jval;
        const char *str;
 
-       if (!json_object_object_get_ex(jobj, "uuid", &jval))
+       if (!json_object_object_get_ex(jobj, "Config_Node_UUID", &jval))
                return false;
 
        str = json_object_get_string(jval);
@@ -592,6 +594,132 @@ bool _bt_mesh_conf_delete_application_key(_bt_mesh_cdb_t *cfg, uint16_t app_idx)
        return __mesh_delete_key(cfg, cfg->jcfg, "appKeys", app_idx);
 }
 
+bool _bt_mesh_conf_set_model_info(_bt_mesh_cdb_t *cfg,
+               uint16_t unicast, GSList *models)
+{
+       int sz;
+       json_object *jnode, *jobj, *jelements;
+       GSList *l;
+
+       BT_INFO("Mesh: Set All model informations in the node [0x%2.2x]",
+                       unicast);
+
+       if (!cfg || !cfg->jcfg)
+               return false;
+
+       jnode = __mesh_get_node_by_unicast(cfg, unicast);
+       if (!jnode)
+               return false;
+
+       jelements = json_object_object_get(jnode, "elements");
+       if (!jelements)
+               return false;
+
+       sz = json_object_array_length(jelements);
+       BT_INFO("Mesh: Total elements [%d]", sz);
+       BT_INFO("Mesh: Total Models in List [%d]",
+                       g_slist_length(models));
+
+       for (l = models; l != NULL; l = g_slist_next(l)) {
+               json_object *jentry, *jmods;
+               bluetooth_mesh_model_t *mod = l->data;
+
+               BT_INFO("Mesh: Elem Idx [%u]", mod->elem_index);
+               BT_INFO("Mesh: Model ID [0x%4.4x]", mod->model_id);
+
+               jentry = json_object_array_get_idx(jelements, mod->elem_index);
+               if (!jentry)
+                       return false;
+
+               /* Write Index for the eleement */
+               if (!__mesh_write_int(jentry, "index", (int)mod->elem_index))
+                       return false;
+
+               /* Set Hardcoded location */
+               if (!__mesh_write_uint16_hex(jentry, "location", 0x0000))
+                       return false;
+
+               jmods = json_object_object_get(jentry, "models");
+               if (!jmods) {
+                       /* For backwards compatibility */
+                       jmods = json_object_new_array();
+                       json_object_object_add(jentry, "models", jmods);
+               }
+
+               /* TODO: Vendor Model Entry: Only BT SIG model entry is handled now */
+               jobj = __mesh_init_model((uint16_t)mod->model_id);
+               if (!jobj)
+                       return false;
+
+               json_object_array_add(jmods, jobj);
+       }
+
+       /* Save */
+       return  __bt_mesh_save_configruation_file(cfg);
+}
+
+bool _bt_mesh_conf_set_vendor_info(_bt_mesh_cdb_t *cfg,
+               uint16_t unicast, uint16_t crpl, uint16_t cid,
+                       uint16_t vid, uint16_t pid,
+                               int proxy, int relay,
+                                       int lpn, int frnd)
+{
+       json_object *jnode, *jobj;
+
+       BT_INFO("Mesh: Set Vednor Information in CDB for node [0x%2.2x]",
+                       unicast);
+
+       if (!cfg || !cfg->jcfg)
+               return false;
+
+       jnode = __mesh_get_node_by_unicast(cfg, unicast);
+       if (!jnode) {
+               BT_INFO("Mesh: Node not found");
+               return false;
+       }
+
+       /* Company ID */
+       if (!__mesh_write_uint16_hex(jnode, "crpl", crpl)) {
+               BT_ERR("Mesh: Could not write CRPL");
+               return false;
+       }
+
+       /* Company ID */
+       if (!__mesh_write_uint16_hex(jnode, "cid", cid)) {
+               BT_ERR("Mesh: Could not write CID");
+               return false;
+       }
+
+       /* Vendor ID or Product ID */
+       if (!__mesh_write_uint16_hex(jnode, "pid", pid)) {
+               BT_INFO("Mesh: Could not write PID");
+               return false;
+       }
+
+       /* Version ID */
+       if (!__mesh_write_uint16_hex(jnode, "vid", vid)) {
+               BT_INFO("Mesh: Could not write VID");
+               return false;
+       }
+
+       jobj = json_object_object_get(jnode, "features");
+       if (!jobj) {
+               jobj = json_object_new_object();
+               json_object_object_add(jnode, "features", jobj);
+       }
+
+       BT_INFO("Mesh: Set features in CDB");
+
+       __mesh_write_int(jobj, "relay", relay ? 1 : 0);
+       __mesh_write_int(jobj, "friend", frnd ? 1 : 0);
+       __mesh_write_int(jobj, "proxy", proxy ? 1 : 0);
+       __mesh_write_int(jobj, "lowPower", lpn ? 1 : 0);
+
+       BT_INFO("Mesh: All vendor Info data set successfully");
+
+       return __bt_mesh_save_configruation_file(cfg);
+}
+
 bool _bt_mesh_conf_set_unicast_address_range(_bt_mesh_cdb_t *cfg,
                uint16_t low, uint16_t high)
 {
@@ -934,7 +1062,7 @@ uint16_t** _bt_mesh_conf_get_all_model_info(_bt_mesh_cdb_t *cfg,
        json_object *jelement = NULL;
        json_object *jmodelarray = NULL;
        const char *str;
-       uint16_t **models;
+       uint16_t **models = NULL;
 
        if (!cfg)
                return NULL;
@@ -944,44 +1072,72 @@ uint16_t** _bt_mesh_conf_get_all_model_info(_bt_mesh_cdb_t *cfg,
                return NULL;
 
        jnode = __mesh_get_node_by_uuid(jcfg, cfg->uuid);
-       if (!jnode)
+       if (!jnode) {
+               BT_ERR("Mesh: Node not found with UUID");
                return NULL;
+       }
 
        /* Get element array object */
        json_object_object_get_ex(jnode, "elements", &jarray);
 
-       if (!jarray || json_object_get_type(jarray) != json_type_array)
+       if (!jarray || json_object_get_type(jarray) != json_type_array) {
+               BT_ERR("Mesh:could not get element array");
                return NULL;
+       }
 
        /* Get specific element by index */
        jelement = __mesh_get_key_object(jarray, element_index);
-       if (!jelement)
+       if (!jelement) {
+               BT_ERR("Mesh: Could not find element");
                return NULL;
-
+       }
 
        /* Get Model array object inside the selected element */
        json_object_object_get_ex(jelement, "models", &jmodelarray);
 
-       if (!jmodelarray || json_object_get_type(jmodelarray) != json_type_array)
+       if (!jmodelarray || json_object_get_type(jmodelarray) != json_type_array) {
+               BT_ERR("Mesh: Could not get Model Array");
                return NULL;
+       }
 
        sz = json_object_array_length(jmodelarray);
+       BT_INFO("Mesh: Total number of Models in Element index [%d] is [%d]",
+                       element_index, sz);
+
        models = (uint16_t**) g_malloc0(sz * sizeof(uint16_t*));
 
        for (i = 0; i < sz; ++i) {
-               json_object *jentry;
+               json_object *jentry, *jval;
+               uint16_t mod_id;
 
+               BT_INFO("Mesh: Model [%d]", i);
                jentry = json_object_array_get_idx(jmodelarray, i);
-               str = json_object_get_string(jentry);
+
+               if (!json_object_object_get_ex(jentry, "modelId", &jval)) {
+                       BT_ERR("Mesh: Failed to read Model in index [%d]", i);
+                       for (int j = 0 ; j < sz; j++)
+                               g_free(models[j]);
+                       g_free(models);
+                       return NULL;
+               }
+
+               str = json_object_get_string(jval);
+               BT_INFO("Mesh: Model ID String [%s]", str);
                /* Only standard models are handled now */
-               if (sscanf(str, "%04hx", models[i]) != 1) {
+               if (sscanf(str, "%04hx", &mod_id) != 1) {
+                       BT_INFO("Mesh: Failed to read Model ID from Model entry [%s]", str);
                        for (int j = 0 ; j < sz; j++)
                                g_free(models[j]);
                        g_free(models);
                        return NULL;
                }
+
+               BT_INFO("Mesh: Model string [%s] Model ID [0x%4.4x]", str, mod_id);
+               models[i] = g_malloc0(sizeof(uint16_t));
+               *models[i] = mod_id;
        }
        /* TODO: Need to handle vendor models */
+       BT_INFO("Mesh: Got all model info");
        *num_models = sz;
        return models;
 }
@@ -1002,17 +1158,23 @@ bool _bt_mesh_conf_get_element_count(_bt_mesh_cdb_t *cfg,
                return false;
 
        jnode = __mesh_get_node_by_uuid(jcfg, cfg->uuid);
-       if (!jnode)
+       if (!jnode) {
+               BT_ERR("Mesh: Node by UUID not found");
                return false;
+       }
 
        json_object_object_get_ex(jnode, "elements", &jarray);
 
-       if (!jarray || json_object_get_type(jarray) != json_type_array)
+       if (!jarray || json_object_get_type(jarray) != json_type_array) {
+               BT_ERR("Mesh: Element array not found in Node");
                return false;
+       }
 
        sz = json_object_array_length(jarray);
-       if (sz == 0)
+       if (sz == 0 ){
+               BT_ERR("Mesh: Element array length is 0");
                return false;
+       }
        *num_elems = sz;
 
        return true;
@@ -1038,12 +1200,16 @@ bool _bt_mesh_conf_fetch_vendor_specific_info(
                return false;
 
        jnode = __mesh_get_node_by_unicast(cfg, unicast);
-       if (!jnode)
+       if (!jnode) {
+               BT_ERR("Mesh: Node not found by unicast [0x%2.2x]", unicast);
                return false;
+       }
 
        /* Get CRPL */
-       if (!json_object_object_get_ex(jnode, "crpl", &jobj))
+       if (!json_object_object_get_ex(jnode, "crpl", &jobj)) {
+               BT_ERR("Mesh: CRPL info not found");
                return false;
+       }
 
        str = json_object_get_string(jobj);
        if (!str)
@@ -1499,7 +1665,7 @@ fail:
 _bt_mesh_cdb_t* _bt_mesh_conf_load(const char *file_name,
                const char *token)
 {
-       char *token_str = NULL;
+       char token_str[17];
        int fd;
        char *str;
        struct stat st;
@@ -1508,17 +1674,24 @@ _bt_mesh_cdb_t* _bt_mesh_conf_load(const char *file_name,
        _bt_mesh_cdb_t *cfg;
 
        fd = open(file_name, O_RDONLY);
-       if (fd < 0)
+       if (fd < 0) {
+               BT_ERR("Mesh: Could not open file [%s]",
+                               file_name);
                return NULL;
+       }
 
        if (fstat(fd, &st) == -1) {
                close(fd);
+               BT_ERR("Mesh: Could not stat file [%s]",
+                               file_name);
                return NULL;
        }
 
        str = (char *) g_malloc0(st.st_size + 1);
        if (!str) {
                close(fd);
+               BT_ERR("Mesh: Could not stat file [%s]",
+                               file_name);
                return NULL;
        }
 
@@ -1551,14 +1724,16 @@ _bt_mesh_cdb_t* _bt_mesh_conf_load(const char *file_name,
                goto fail;
        }
 
-       token_str = _bt_service_convert_hex_to_string((unsigned char*)cfg->token, 8);
+       _bt_mesh_util_convert_hex_to_string(cfg->token, 8, token_str, 17);
 
        /* Match CDB file tken with user's token */
        if (g_strcmp0(token_str, token)) {
                BT_INFO("Mesh: Token did not match! File token [%s] requested token [%s]",
-                               cfg->token, token);
+                               token_str, token);
                goto fail;
        }
+
+       BT_INFO("Mesh: Token found");
        /* TODO: Load keys and remotes */
        return cfg;
 fail:
index e3ccbce..bb98162 100644 (file)
@@ -181,17 +181,22 @@ static void __bt_mesh_handle_pending_request_info(int result,
                        _bt_mesh_util_convert_hex_to_string(
                                (uint8_t *) node->token.u8, 8, token_str,
                                        BLUETOOTH_MESH_NETWORK_TOKEN_STRING_LENGTH + 1);
+                       BT_INFO("Mesh: Received Token [%s]", token_str);
 
                        if (!g_strcmp0(network->token.token, token_str)) {
                                char *network_name = NULL;
                                BT_INFO("Mesh: BT_MESH_NETWORK_LOAD Request found Token [%s]",
                                        token_str);
 
+                               BT_INFO("Mesh: Load the Network resources");
                                /* Send request to mesh-network to load keys and Nodes for the network */
                                if (BLUETOOTH_ERROR_NONE == _bt_mesh_network_load_cdb(
                                                result, req_info->sender, network->app_cred,
                                                        node->uuid, node->token.u8, &network_name)) {
-                                       g_strlcpy(network->name.name, network_name, strlen(network_name));
+                                       g_strlcpy(network->name.name, network_name,
+                                               sizeof(network->name.name));
+                                       BT_INFO("Mesh: Got Name of the Network [%s]",
+                                               network->name.name);
                                } else
                                        BT_ERR("!!Mesh: BT_MESH_NETWORK_LOAD Failed!!");
 
index 15daa0c..a742b10 100644 (file)
@@ -430,6 +430,15 @@ int _bt_mesh_network_create_cdb(int result,
                                MESH_PRIMARY_NET_IDX);
        BT_INFO("Mesh: Added Local node's basic info  in CDB");
 
+       _bt_mesh_conf_set_vendor_info(cdb_cfg, 0x0001, tmp->vendor_info.crpl,
+               tmp->vendor_info.companyid, tmp->vendor_info.versionid,
+                       tmp->vendor_info.vendorid, tmp->vendor_info.proxy,
+                               tmp->vendor_info.relay, tmp->vendor_info.lpn,
+                                       tmp->vendor_info.frnd);
+
+       BT_INFO("Mesh: Vendor Info set successfully");
+       _bt_mesh_conf_set_model_info(cdb_cfg, 0x0001, tmp->model_list);
+
        cdb_list = g_slist_append(cdb_list, cdb_cfg);
        BT_INFO("Mesh: CDB added to list");
 
@@ -1385,10 +1394,11 @@ int _bt_mesh_network_load_cdb(int result, const char *sender,
                                         char **network)
 {
        GSList *l;
-       char *token_str;
+       char token_str[17];
        _bt_mesh_cdb_t *cdb_cfg = NULL;
 
-       token_str = _bt_service_convert_hex_to_string(token, 8);
+       _bt_mesh_util_convert_hex_to_string(token, 8,
+                       token_str, 17);
 
        /* Find CDB */
        l = g_slist_find_custom(cdb_list, token_str,
@@ -1396,7 +1406,6 @@ int _bt_mesh_network_load_cdb(int result, const char *sender,
        if (!l)
                return BLUETOOTH_ERROR_INTERNAL;
 
-       g_free(token_str);
        cdb_cfg = (_bt_mesh_cdb_t*)l->data;
 
        if (result != BLUETOOTH_ERROR_NONE)
@@ -1435,6 +1444,7 @@ int _bt_mesh_network_load(const char *app_cred,
        int ret = OAL_STATUS_SUCCESS;
        GSList *l;
        char *dir_path = NULL;
+       char *file_path = NULL;
        _bt_mesh_cdb_t *cdb_cfg = NULL;
        oal_mesh_node_t node;
        GSList *models = NULL;
@@ -1465,20 +1475,27 @@ int _bt_mesh_network_load(const char *app_cred,
                        g_free(dir_path);
                        return BLUETOOTH_ERROR_INTERNAL;
                }
-               g_free(dir_path);
                while ((filename = g_dir_read_name(dir)) != NULL) {
 
                        if ((g_file_test(filename, G_FILE_TEST_IS_SYMLINK) == TRUE) ||
                                        (g_str_has_suffix(filename, ".json") == FALSE))
                                continue;
 
+                       file_path = g_strdup_printf("%s%s",
+                                       dir_path, filename);
+                       BT_INFO("Mesh: Token [%s]", token);
                        BT_INFO("Mesh: File name [%s]", filename);
-                       cdb_cfg = _bt_mesh_conf_load(filename, token);
+                       BT_INFO("Mesh: File Absolute Path [%s]", file_path);
+
+                       cdb_cfg = _bt_mesh_conf_load(file_path, token);
                        if (cdb_cfg)
                                break;
                }
        }
 
+       g_free(file_path);
+       g_free(dir_path);
+
        if (!cdb_cfg) {
                BT_ERR("Mesh: Could not find CDB for the token!! Possibly not authorized!!");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
@@ -1492,7 +1509,9 @@ int _bt_mesh_network_load(const char *app_cred,
                _bt_mesh_conf_free(cdb_cfg);
                return BLUETOOTH_ERROR_INTERNAL;
        }
+       BT_INFO("Mesh: toatl number of elements [%d]", node.num_elements);
 
+       BT_INFO("Mesh:Fetch Vendor specific info");
        if (!_bt_mesh_conf_fetch_vendor_specific_info(cdb_cfg, 0x0001 /* Local Node Unicast */,
                                &node.vendor_info.companyid, &node.vendor_info.vendorid,
                                &node.vendor_info.versionid, &node.vendor_info.crpl,
@@ -1503,6 +1522,7 @@ int _bt_mesh_network_load(const char *app_cred,
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
+       BT_INFO("Mesh: Fill Model informations");
        for (int i = 0; i < node.num_elements; i++) {
                int num_models;
                uint16_t **model_array = _bt_mesh_conf_get_all_model_info(
@@ -1522,14 +1542,16 @@ int _bt_mesh_network_load(const char *app_cred,
                /* Free all model(s) */
                for (int j = 0; j < num_models; j++)
                        g_free(model_array[j]);
+               g_free(model_array);
        }
 
+       BT_INFO("Mesh: Node formation done:: Register it!");
        /* Register Mesh Node */
        ret = mesh_register_node((oal_mesh_node_t*)&node,
                        models, true);
 
        /* Cleanup */
-       g_slist_free_full(models, g_free);
+       //g_slist_free_full(models, g_free);
 
        if (ret != OAL_STATUS_SUCCESS) {
                BT_ERR("Mesh: Load Network Failed ret: %d", ret);
@@ -1539,7 +1561,7 @@ int _bt_mesh_network_load(const char *app_cred,
 
        /* Save till Network attached */
        cdb_list = g_slist_append(cdb_list, cdb_cfg);
-       return ret;
+       return BLUETOOTH_ERROR_NONE;
 }
 
 bool _bt_mesh_network_get_label_uuid_from_sub_addr(
index ca76db9..86039a4 100644 (file)
@@ -111,8 +111,8 @@ static bool __mesh_remove_node_entry(void *a, void *b)
 
        l_free(rmt->els);
 
-       l_queue_destroy(rmt->net_keys, l_free);
-       l_queue_destroy(rmt->app_keys, l_free);
+       l_queue_destroy(rmt->net_keys, NULL);
+       l_queue_destroy(rmt->app_keys, NULL);
 
        l_free(rmt);
        return true;
index f538a10..464b668 100644 (file)
@@ -75,6 +75,10 @@ typedef struct {
        uint16_t vendorid;
        uint16_t versionid;
        uint16_t crpl;
+       int relay;
+       int frnd;
+       int proxy;
+       int lpn;
 } bluetooth_mesh_vendor_info_t;
 
 typedef struct {