char *app_uuid_path;
const meshcfg_app *app = (meshcfg_app*) data;
char *path = (char *) user_data;
- INFO("Mesh: proxy path compare: path [%s]", path);
- INFO("Mesh: App Path path [%s]", app->path);
if (!path)
return -1;
app_uuid_path = l_util_hexstring(app->uuid, 16);
- INFO("Mesh:App UUID string [%s]", app_uuid_path);
char **strings = g_strsplit(path, "node", 2);
- INFO("Mesh:String 0 [%s]", strings[0]);
- INFO("Mesh:String 1 [%s]", strings[1]);
ret = g_strcmp0(strings[1], app_uuid_path);
g_free(strings[0]);
g_free(strings[1]);
l_dbus_destroy(dbus);
dbus = NULL;
}
+
+ /* Reset Globals */
+ net_proxy = NULL;
+ agent_msg = NULL;
+ INFO("Mesh: Number of meshapps present in memory [%d]",
+ g_slist_length(mesh_apps));
}
/* To send stack event to hal-mesh handler */
uint8_t *net_uuid;
const char *dbus_path;
GSList *l;
- meshcfg_app *app;
+ meshcfg_app *app = NULL;
dbus_path = l_dbus_message_get_path(msg);
net_uuid = __mesh_get_net_uuid_from_path(dbus_path, true,
l = g_slist_find_custom(mesh_apps, net_uuid,
__mesh_compare_network_uuid);
- app = l->data;
+
+ if (l) {
+ app = l->data;
+ } else {
+ ERR("Mesh: app not found");
+ }
+
memset(&ev, 0, sizeof(ev));
memcpy(ev.net_uuid, net_uuid, 16);
struct hal_ev_mesh_provision_finished ev;
memset(&ev, 0, sizeof(ev));
- memcpy(ev.net_uuid, app->uuid, 16);
+
+ if (app)
+ memcpy(ev.net_uuid, app->uuid, 16);
+
ev.status = BT_STATUS_FAIL;
ev.reason = BT_HAL_MESH_PROV_ERR_INTERNAL;
if (mesh_event_cb)
INFO("Mesh: Leave Network Setup app path [%s]", app->path);
}
+static void __bt_hal_mesh_release_net_reply(
+ struct l_dbus_proxy *proxy,
+ struct l_dbus_message *msg, void *user_data)
+{
+ meshcfg_app *app;
+ app = (meshcfg_app*) user_data;
+
+ INFO("Mesh:Release Network Reply from Meshd: app path [%s]", app->path);
+ if (l_dbus_message_is_error(msg)) {
+ const char *name;
+
+ l_dbus_message_get_error(msg, &name, NULL);
+ ERR("Mesh: Failed to Release network: %s", name);
+
+ } else {
+ INFO("Mesh: Release Network: Success, cleanup app after proxy removed");
+ }
+}
+
+static void __bt_hal_mesh_release_net_setup(struct l_dbus_message *msg,
+ void *user_data)
+{
+ meshcfg_app *app = (meshcfg_app*) user_data;
+
+ l_dbus_message_set_arguments(msg, "t", l_get_be64(app->token.u8));
+ INFO("Mesh: Release Network Setup app path [%s]", app->path);
+}
+
static void __bt_hal_mesh_create_net_reply(
struct l_dbus_proxy *proxy,
struct l_dbus_message *msg, void *user_data)
return BT_STATUS_SUCCESS;
}
+bt_status_t _bt_hal_mesh_network_release(bt_uuid_t *net_uuid)
+{
+ GSList *l;
+ meshcfg_app *app;
+ INFO("Mesh: Release Network");
+ l = g_slist_find_custom(mesh_apps, net_uuid->uu, __mesh_compare_network_uuid);
+ if (l) {
+ app = l->data;
+ if (!__bt_mesh_proxy_check(app)) {
+ ERR("Mesh: Proxy check failed!!");
+ return BT_STATUS_FAIL;
+ }
+ INFO("Mesh: Release Network");
+ /* Create CFG Network */
+ if (!l_dbus_proxy_method_call(net_proxy, "Release",
+ __bt_hal_mesh_release_net_setup,
+ __bt_hal_mesh_release_net_reply, app,
+ NULL)) {
+ ERR("Mesh: Network Release failed!!");
+ return BT_STATUS_FAIL;
+ }
+ } else {
+ ERR("Mesh: App not found!!");
+ return BT_STATUS_PARM_INVALID;
+ }
+ INFO("Mesh: Network Release Call issued successfully!!");
+ return BT_STATUS_SUCCESS;
+}
+
bt_status_t _bt_hal_mesh_network_destroy(bt_uuid_t *net_uuid)
{
GSList *l;