int mesh_interface_initialize(mesh_interface_s *info);
int mesh_interface_check_external_exists(
const char* external_interface, bool *state);
+char* mesh_interface_get_address(const char* if_name);
#endif /* __MESH_INTERFACE_H__ */
/**< Saved mesh network list structure */
typedef struct _mesh_network_info {
char* mesh_id; /**< The mesh id */
+ char* bssid; /**< BSSID */
int channel; /**< Channel */
int security; /**< Security type */
} mesh_network_info_s;
<arg type="s" name="meshid" direction="out"/>\r
<arg type="s" name="bssid" direction="out"/>\r
<arg type="i" name="channel" direction="out"/>\r
- <arg type="i" name="max_speed" direction="out"/>\r
<arg type="u" name="result" direction="out"/>\r
</method>\r
<method name="set_gate">\r
return false;
}
+char* mesh_interface_get_address(const char* if_name)
+{
+ FILE *pf;
+ char buf[32];
+ char *result = NULL;
+ int cnt = 0;
+
+ snprintf(buf, sizeof(buf), "/sys/class/net/%s/address", if_name);
+ pf = fopen(buf, "r");
+ if (NULL != pf) {
+ cnt = fscanf(pf, "%s", buf);
+ MESH_LOGD("Interface[%s] address[%s] %d", if_name, buf, cnt);
+ result = g_strdup(buf);
+
+ fclose(pf);
+ }
+
+ return result;
+}
+
int mesh_interface_initialize(mesh_interface_s *info)
{
info->bridge_interface = _get_interface_not_exists_in_seq("br");
return MESHD_ERROR_OUT_OF_MEMORY;
}
info->mesh_id = g_strdup(mesh_id);
+ info->bssid = NULL;
info->channel = mesh_channel;
info->security = security;
found = (mesh_network_info_s*)iter->data;
info->mesh_id = found->mesh_id;
+ info->bssid = NULL;
info->channel = found->channel;
info->security = found->security;
return MESHD_ERROR_OUT_OF_MEMORY;
}
moved->mesh_id = g_strdup(info->mesh_id);
+ moved->bssid = NULL;
moved->channel = info->channel;
moved->security = info->security;
found = TRUE;
MESH_LOGE("Failed to allocate memory");
} else {
(*joined_network)->mesh_id = g_strdup(info.mesh_id);
+ (*joined_network)->bssid = mesh_interface_get_address(mesh_interface);
(*joined_network)->channel = info.channel;
(*joined_network)->security = info.security;
}
g_variant_builder_add(&builder, "{sv}", "bssid",
g_variant_new_string(scan_item->bssid));
g_variant_builder_add(&builder, "{sv}", "rssi",
- g_variant_new_uint32(scan_item->rssi));
+ g_variant_new_int32(scan_item->rssi));
g_variant_builder_add(&builder, "{sv}", "channel",
g_variant_new_uint32(scan_item->channel));
- g_variant_builder_add(&builder, "{sv}", "data_rate",
- g_variant_new_uint32(scan_item->data_rate));
g_variant_builder_close(&builder);
iter = g_list_next(iter);
if (joined) {
net_mesh_complete_get_joined_mesh_network(object, invocation,
- joined->mesh_id, "", joined->channel, 0, ret);
+ joined->mesh_id, joined->bssid, joined->channel, ret);
} else {
net_mesh_complete_get_joined_mesh_network(object, invocation,
- "", "", 0, 0, MESHD_ERROR_NO_DATA);
+ "", "", 0, MESHD_ERROR_NO_DATA);
}
return TRUE;