if (state) {
/* Turn STP on */
ret = mesh_bridge_set_stp(bridge_interface, TRUE);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to turn STP on !");
return ret;
}
/* Set mesh parameters */
ret = mesh_netlink_set_mesh_parameter(mesh_interface,
"mesh_hwmp_rootmode", 4);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to set [mesh_hwmp_rootmode] : 4");
- }
ret = mesh_netlink_set_mesh_parameter(mesh_interface,
"mesh_gate_announcements", 1);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to set [mesh_gate_announcements] : 1");
- }
} else {
MESH_LOGE("External interface is not available !");
return MESHD_ERROR_OPERATION_FAILED;
/* Set mesh parameters */
ret = mesh_netlink_set_mesh_parameter(mesh_interface,
"mesh_hwmp_rootmode", 0);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to set [mesh_hwmp_rootmode] : 0");
- }
ret = mesh_netlink_set_mesh_parameter(mesh_interface,
"mesh_gate_announcements", 0);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
MESH_LOGE("Failed to set [mesh_gate_announcements] : 0");
- }
/* Turn STP off */
ret = mesh_bridge_set_stp(bridge_interface, FALSE);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to turn STP off!");
return ret;
}
/* Add external interface into bridge */
ret = mesh_bridge_add_interface(bridge_interface, interface);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to add interface !");
return ret;
}
/* Make external interface down */
ret = mesh_interface_set(interface, NULL, MESH_INTERFACE_DOWN);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to change external interface state");
return ret;
}
/* Make external interface up with cleared IP */
ret = mesh_interface_set(interface, "0.0.0.0", MESH_INTERFACE_UP);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to change external interface state");
return ret;
}
/* Remove external interface into bridge */
ret = mesh_bridge_del_interface(bridge_interface, interface);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to remove interface !");
return ret;
}
ret = mesh_softap_set_configuration(softap_interface, ssid, mode, channel,
visibility, max_sta, security, passphrase);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to set Configuration for SoftAP");
return ret;
}
/* Add softAP interface into bridge */
ret = mesh_request_add_bridge_interface(bridge_interface, softap_interface);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
return ret;
- }
return ret;
}
/* Remove softAP interface from bridge */
ret = mesh_request_remove_bridge_interface(bridge_interface, softap_interface);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
return ret;
- }
return ret;
}
/* Get station info */
ret = mesh_netlink_get_station_info(mesh_interface, station_list);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
return ret;
- }
return MESHD_ERROR_NONE;
}
/* Get MPath info */
ret = mesh_netlink_get_mpath_info(mesh_interface, mpath_list);
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
return ret;
- }
return MESHD_ERROR_NONE;
}
/* Get MPath info */
ret = mesh_netlink_register_event_handler();
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
return ret;
- }
return MESHD_ERROR_NONE;
}
/* Get MPath info */
ret = mesh_netlink_unregister_event_handler();
- if (MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret)
return ret;
- }
return MESHD_ERROR_NONE;
}
MESH_LOGD("[IPC] Enable mesh network");
ret = mesh_gdbus_create_mesh_interface(service);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to create mesh network");
return ret;
}
MESH_LOGD("[IPC] Disable mesh network");
ret = mesh_gdbus_remove_mesh_interface(service);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to create mesh network");
return ret;
}
MESH_LOGD("[IPC] Request scan for mesh network");
ret = mesh_gdbus_mesh_scan(service);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to request scan for mesh network");
return ret;
}
return MESHD_ERROR_NONE;
}
-int mesh_request_specific_scan(mesh_service *service, gchar *mesh_id,
- gint channel)
+int mesh_request_specific_scan(mesh_service *service, gchar *mesh_id, gint channel)
{
int ret;
if (NULL == service) {
MESH_LOGD("[IPC] Request specific scan for mesh network");
ret = mesh_gdbus_mesh_specific_scan(service, mesh_id, channel);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to request specific scan for mesh network");
return ret;
}
MESH_LOGD("[IPC] Cancel scan for mesh network");
ret = mesh_gdbus_mesh_cancel_scan(service);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to cancel scan for mesh network");
return ret;
}
MESH_LOGD("[IPC] Get mesh networks");
ret = mesh_gdbus_get_mesh_networks(service);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to get mesh networks !");
return ret;
}
item = (mesh_scan_result_s*)iter->data;
if (g_strcmp0(mesh_id, item->mesh_id) == 0) {
- if (item->channel == mesh_channel && item->security == sec)
- {
+ if (item->channel == mesh_channel && item->security == sec) {
*info = item;
found = TRUE;
break;
MESH_LOGD("[IPC] Get joined mesh network");
ret = mesh_gdbus_get_joined_mesh_network(service);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to get joined mesh network");
return ret;
}
MESH_LOGD("[IPC] Get connected mesh peers");
ret = mesh_gdbus_get_connected_peers(service);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to get connected mesh peers");
return ret;
}
MESH_LOGD("[IPC] Create a new mesh network");
ret = mesh_gdbus_create_network(service, mesh_id, channel, sec);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to create mesh network");
return ret;
}
/* Get mesh_id and channel from saved network */
ret = _select_matched_network(service->scanned_mesh_network,
mesh_id, channel, sec, &info);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to mesh_network_get_first_mesh_network");
return ret;
}
if (MESHD_SECURITY_NONE != sec) {
if (NULL != passphrase) {
ret = mesh_gdbus_set_passphrase(service, info, passphrase);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to set passphrase for mesh network");
return ret;
}
}
ret = mesh_gdbus_connect_network(service, info);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to connect mesh network");
return ret;
}
/* Get mesh_id and channel from saved network */
ret = _select_matched_network(service->scanned_mesh_network,
mesh_id, channel, sec, &info);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to _select_matched_network");
return ret;
}
ret = mesh_gdbus_disconnect_network(service, info);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to disconnect mesh network");
return ret;
}
/* Get mesh_id and channel from saved network */
ret = _select_matched_network(service->scanned_mesh_network,
mesh_id, channel, sec, &info);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to _select_matched_network");
return ret;
}
ret = mesh_gdbus_remove_network(service, info);
- if(MESHD_ERROR_NONE != ret) {
+ if (MESHD_ERROR_NONE != ret) {
MESH_LOGE("Failed to remove mesh network");
return ret;
}