if (service->mesh_activated) {
/* Already activated */
- manager_complete_enable(object, invocation,
- MESHD_ERROR_OPERATION_FAILED);
- } else {
- /* Do API response first */
- manager_complete_enable(object, invocation, ret);
- service->mesh_activated = TRUE;
+ manager_complete_enable(object, invocation, MESHD_ERROR_NONE);
+ goto FINISH;
}
+ /* Do API response first */
+ manager_complete_enable(object, invocation, ret);
+ service->mesh_activated = TRUE;
+
meshd_check_null_ret_error("info", info, FALSE);
/* Register event handler first */
ret = mesh_request_register_event_handler();
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to register mesh event handler !! [%d]", ret);
- }
ret = mesh_interface_initialize(service->interface_info);
if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to mesh_interface_initialize [%d]", ret);
goto FINISH;
}
-#if 0
- ret = mesh_request_load_saved_mesh_network(&service->saved_mesh_network);
- if (MESHD_ERROR_NONE != ret) {
- MESH_LOGE("Failed to mesh_request_load_saved_mesh_network [%d]", ret);
- goto FINISH;
- }
-#endif
+
FINISH:
net_mesh_emit_mesh_enabled(meshd_dbus_get_object(), ret);
manager_complete_disable(object, invocation, ret);
ret = mesh_request_unregister_event_handler();
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to unregister mesh event handler !! [%d]", ret);
- }
/* Terminate daemon */
meshd_service_exit(service);
meshd_check_null_ret_error("info", info, FALSE);
- ret = mesh_request_ipc_mesh_scan(service);
+ ret = mesh_request_scan(service);
if (MESHD_ERROR_NONE != ret)
- MESH_LOGE("Failed to mesh_request_ipc_mesh_scan !");
+ MESH_LOGE("Failed to mesh_request_scan !");
net_mesh_complete_scan(object, invocation, ret);
meshd_check_null_ret_error("info", info, FALSE);
- ret = mesh_ipc_mesh_specific_scan(service, mesh_id, channel);
+ ret = mesh_request_specific_scan(service, mesh_id, channel);
if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to mesh_request_specific_scan !");
int ret = MESHD_ERROR_NONE;
mesh_service *service = (mesh_service *)user_data;
- ret = mesh_request_ipc_mesh_cancel_scan(service);
- if (MESHD_ERROR_NONE != ret) {
- MESH_LOGE("Failed to mesh_request_ipc_mesh_cancel_scan");
- }
+ ret = mesh_request_cancel_scan(service);
+ if (MESHD_ERROR_NONE != ret)
+ MESH_LOGE("Failed to mesh_request_cancel_scan");
net_mesh_complete_cancel_scan(object, invocation, ret);
g_free(scan_item->bssid);
g_free(scan_item->object_path);
}
+ g_free(scan_item);
+}
+
+static void _on_peer_info_destroy(gpointer data)
+{
+ mesh_peer_info_s *peer = (mesh_peer_info_s *)data;
+ if (peer)
+ g_free(peer->address);
+ g_free(peer);
}
static void _on_station_list_destroy(gpointer data)
MESH_LOGD("Request to get scanned mesh network list");
- ret = mesh_request_ipc_mesh_get_peers(service);
+ ret = mesh_request_get_networks(service);
if (MESHD_ERROR_NONE != ret)
- MESH_LOGE("Failed to mesh_request_ipc_mesh_get_peers");
+ MESH_LOGE("Failed to mesh_request_get_networks");
g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
mesh_service *service = (mesh_service *)user_data;
/* It handles creating virtual network and bridge */
- ret = mesh_request_ipc_enable_network(service);
+ ret = mesh_request_enable_network(service);
if (MESHD_ERROR_NONE != ret)
- MESH_LOGE("Failed to mesh_request_ipc_enable_network [%d]", ret);
+ MESH_LOGE("Failed to mesh_request_enable_network [%d]", ret);
#if 0
/* Detect external network state (i.e. Ethernet)
and decide to make gate enabled */
ret = mesh_request_set_mesh_gate(info->bridge_interface,
info->mesh_interface, info->external_interface);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to mesh_request_set_mesh_gate [%d]", ret);
- }
#endif
net_mesh_complete_enable_mesh(object, invocation, ret);
return TRUE;
}
- ret = mesh_request_ipc_disable_network(service);
- if (MESHD_ERROR_NONE != ret) {
+ ret = mesh_request_disable_network(service);
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to disable mesh network !");
- }
/* Make response */
net_mesh_complete_disable_mesh(object, invocation, ret);
mesh_service *service = (mesh_service *)user_data;
mesh_network_info_s *joined = NULL;
- ret = mesh_request_ipc_get_joined_network(service);
+ ret = mesh_request_get_joined_network(service);
if (MESHD_ERROR_NONE == ret) {
joined = service->joined_network;
if (joined) {
MESH_LOGD("Request to get connected peers");
- ret = mesh_ipc_get_connected_peers(service);
+ ret = mesh_request_get_connected_peers(service);
if (MESHD_ERROR_NONE != ret)
- MESH_LOGE("Failed to mesh_ipc_get_connected_peers");
+ MESH_LOGE("Failed to mesh_request_get_connected_peers");
g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
iter = service->connected_mesh_peers;
/* Set STP and gate_announce */
ret = mesh_request_set_mesh_gate(info->bridge_interface,
info->mesh_interface, info->external_interface);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to mesh_request_set_mesh_gate [%d]", ret);
- }
net_mesh_complete_set_gate(object, invocation, ret);
ret = mesh_request_unset_mesh_gate(info->bridge_interface,
info->mesh_interface, info->external_interface);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to mesh_request_unset_mesh_gate [%d]", ret);
- }
+
net_mesh_complete_unset_gate(object, invocation, ret);
return TRUE;
ret = mesh_request_set_softap_config(info->softap_interface,
ssid, mode, channel, visibility, max_sta,
security, passphrase);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to mesh_request_set_softap_config [%d]", ret);
- }
net_mesh_complete_set_softap(object, invocation, ret);
/* Check softAP interface and execute it */
ret = mesh_request_enable_softap(info->bridge_interface, info->softap_interface);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to mesh_request_enable_softap [%d]", ret);
- }
net_mesh_complete_enable_softap(object, invocation, ret);
/* Destroy softAP */
ret = mesh_request_disable_softap(info->bridge_interface, info->softap_interface);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to mesh_request_disable_softap [%d]", ret);
- }
net_mesh_complete_disable_softap(object, invocation, ret);
mesh_service *service = (mesh_service *)user_data;
meshd_security_type_e sec = (1 == security) ? MESHD_SECURITY_SAE : MESHD_SECURITY_NONE;
- ret = mesh_request_ipc_create_mesh_network(service, mesh_id, channel, sec);
+ ret = mesh_request_create_mesh_network(service, mesh_id, channel, sec);
net_mesh_complete_create_mesh_network(object, invocation, ret);
mesh_service *service = (mesh_service *)user_data;
meshd_security_type_e sec = (1 == security) ? MESHD_SECURITY_SAE : MESHD_SECURITY_NONE;
- ret = mesh_request_ipc_connect_mesh_network(service, mesh_id, channel, sec, passphrase);
+ ret = mesh_request_connect_mesh_network(service, mesh_id, channel, sec, passphrase);
net_mesh_complete_connect_mesh_network(object, invocation, ret);
mesh_service *service = (mesh_service *)user_data;
meshd_security_type_e sec = (1 == security) ? MESHD_SECURITY_SAE : MESHD_SECURITY_NONE;
- ret = mesh_request_ipc_disconnect_mesh_network(service, mesh_id, channel, sec);
+ ret = mesh_request_disconnect_mesh_network(service, mesh_id, channel, sec);
net_mesh_complete_disconnect_mesh_network(object, invocation, ret);
mesh_service *service = (mesh_service *)user_data;
meshd_security_type_e sec = (1 == security) ? MESHD_SECURITY_SAE : MESHD_SECURITY_NONE;
- ret = mesh_request_ipc_remove_mesh_network(service, mesh_id, channel, sec);
+ ret = mesh_request_remove_mesh_network(service, mesh_id, channel, sec);
net_mesh_complete_forget_mesh_network(object, invocation, ret);
* tx retries: 0
* tx failed: 0
* beacon loss: 0
- * signal: -64 dBm
+ * signal: -64 dBm
* signal avg: -63 dBm
* tx bitrate: 54.0 MBit/s
* rx bitrate: 5.5 MBit/s
*/
/* Get mesh path information and make variant data */
g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
-
+
iter = service->mpath_list;
while (iter != NULL) {
mesh_mpath_info_s *item = (mesh_mpath_info_s*)iter->data;
g_list_free_full(service->scanned_mesh_network, _on_scan_result_destroy);
service->scanned_mesh_network = NULL;
+ /* Clear connected peers list */
+ g_list_free_full(service->connected_mesh_peers, _on_peer_info_destroy);
+ service->connected_mesh_peers = NULL;
+
g_free(service->interface_info);
service->interface_info = NULL;
}