int mesh_ipc_create_mesh_interface(mesh_service *service)
{
+ int ret = MESHD_ERROR_NONE;
GVariant *variant = NULL;
GError *error = NULL;
GVariant *var_dict = NULL;
if (variant) {
MESH_LOGD("Successfully requested. [MeshInterfaceAdd]");
} else if (error) {
+ ret = MESHD_ERROR_IO_ERROR;
MESH_LOGE("Failed DBus call [%s]", error->message);
+
+ /* Interface not exists */
+ if (g_strrstr(error->message, "No such device"))
+ ret = MESHD_ERROR_INVALID_PARAMETER;
g_error_free(error);
- return MESHD_ERROR_IO_ERROR;
}
- return MESHD_ERROR_NONE;
+ return ret;
}
int mesh_ipc_remove_mesh_interface(mesh_service *service)
GVariant *val = NULL;
gsize len = 0;
GVariant *child;
- gchar *var_string = NULL;
const gchar* obj_path = NULL;
const gchar* buf = NULL;
mesh_network_info_s *joined_info = NULL;
gboolean valid_state = TRUE;
- MESH_LOGD(" Child : [%s]", g_variant_get_type_string(child));
- var_string = g_variant_print(child, FALSE);
- MESH_LOGD(" %s", var_string);
- g_free(var_string);
-
g_variant_get(child, "(oa{sv})", &obj_path, &property);
MESH_LOGD(" Object: [%s]", obj_path);
if (NULL == obj_path) {
GVariant *val = NULL;
gsize len = 0;
GVariant *child;
- gchar *var_string = NULL;
const gchar* obj_path = NULL;
g_variant_get(variant, "(a(oa{sv}))", &peer);
- //while (g_variant_iter_next(peer, "oa{sv}", &tmp, &property)) {
while ((child = g_variant_iter_next_value(peer))) {
mesh_scan_result_s *scan_info = NULL;
return;
}
- MESH_LOGD(" Child : [%s]", g_variant_get_type_string(child));
- var_string = g_variant_print(child, FALSE);
- MESH_LOGD(" %s", var_string);
- g_free(var_string);
-
g_variant_get(child, "(oa{sv})", &obj_path, &property);
if (NULL == obj_path) {
MESH_LOGE("Null object");
scan_info->bssid = g_strdup(buf);
MESH_LOGD(" BSSID : %s", scan_info->bssid);
}
+ else if (strcasecmp(key, "State") == 0) {
+ const char *buf = g_variant_get_string(val, &len);
+ MESH_LOGD(" State : %s", buf);
+ }
+ else if (strcasecmp(key, "Security") == 0) {
+ const char *buf = g_variant_get_string(val, &len);
+ MESH_LOGD(" Security : %s", buf);
+ }
else if (strcasecmp(key, "Frequency") == 0) {
scan_info->channel = __frequency_to_channel(g_variant_get_uint16(val));
MESH_LOGD(" Channel : %d", scan_info->channel);
}
+ else if (strcasecmp(key, "Favorite") == 0) {
+ const char *buf = g_variant_get_string(val, &len);
+ MESH_LOGD(" Favorite : %s", buf);
+ }
else if (strcasecmp(key, "Strength") == 0) {
scan_info->rssi = (gint)g_variant_get_byte(val);
MESH_LOGD(" RSSI : %d", scan_info->rssi);
int mesh_ipc_connect_network(mesh_service *service, mesh_scan_result_s *info)
{
+ int ret = MESHD_ERROR_NONE;
GVariant *variant = NULL;
GError *error = NULL;
if (variant) {
MESH_LOGD("Successfully requested. [Connect]");
} else if (error) {
+ ret = MESHD_ERROR_IO_ERROR;
LOGE("Failed DBus call [%s]", error->message);
+
+ if (g_strrstr(error->message, "Already exists"))
+ ret = MESHD_ERROR_ALREADY_REGISTERED;
+ else
+ ret = MESHD_ERROR_IO_ERROR;
+
g_error_free(error);
- return MESHD_ERROR_IO_ERROR;
}
- return MESHD_ERROR_NONE;
+ return ret;
}
int mesh_ipc_disconnect_network(mesh_service *service, mesh_scan_result_s *info)