diff options
author | Saurav Babu <saurav.babu@samsung.com> | 2017-12-04 15:22:23 +0530 |
---|---|---|
committer | Saurav Babu <saurav.babu@samsung.com> | 2017-12-04 16:27:33 +0530 |
commit | 598951d9af9539fe90c89598b9b794582c16cda3 (patch) | |
tree | a6ee168dc63d75f025b8c053a19385dc16751ed8 | |
parent | 69172a3309fd1ff756927a6be115312b2eba0b34 (diff) | |
download | wifi-mesh-598951d9af9539fe90c89598b9b794582c16cda3.tar.gz wifi-mesh-598951d9af9539fe90c89598b9b794582c16cda3.tar.bz2 wifi-mesh-598951d9af9539fe90c89598b9b794582c16cda3.zip |
wifi-mesh: Update CAPI to get softAP station info
This patch updates wifi_mesh_get_stations_info() to also get softAP
station information along with mesh station information
Change-Id: I128b3c125c3f6569d44e291c46dc9f6e8d2317da
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
-rw-r--r-- | include/wifi-mesh-internal.h | 4 | ||||
-rw-r--r-- | include/wifi-mesh_dbus.h | 4 | ||||
-rw-r--r-- | include/wifi-mesh_private.h | 1 | ||||
-rw-r--r-- | src/wifi-mesh-dbus.c | 7 | ||||
-rw-r--r-- | src/wifi-mesh-internal.c | 13 | ||||
-rw-r--r-- | test/wifi-mesh-network.c | 27 |
6 files changed, 48 insertions, 8 deletions
diff --git a/include/wifi-mesh-internal.h b/include/wifi-mesh-internal.h index b083a35..33aae7f 100644 --- a/include/wifi-mesh-internal.h +++ b/include/wifi-mesh-internal.h @@ -185,6 +185,7 @@ typedef void (*wifi_mesh_found_station_cb)(wifi_mesh_station_info_h station, voi * @since_tizen 4.0 * * @param[in] handle The Wi-Fi mesh handle + * @param[in] sta_type Type of Station * @param[in] cb The callback function to receive station information * @param[in] user_data User data * @@ -197,7 +198,8 @@ typedef void (*wifi_mesh_found_station_cb)(wifi_mesh_station_info_h station, voi * @see mesh_get_path_info() * */ -int wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb cb, +int wifi_mesh_get_stations_info(wifi_mesh_h handle, + wifi_mesh_station_type_e sta_type, wifi_mesh_found_station_cb cb, void *user_data); /** diff --git a/include/wifi-mesh_dbus.h b/include/wifi-mesh_dbus.h index 3eb46b5..348a9b7 100644 --- a/include/wifi-mesh_dbus.h +++ b/include/wifi-mesh_dbus.h @@ -69,7 +69,9 @@ int _mesh_connect_network(wifi_mesh_h handle, wifi_mesh_network_h _network); int _mesh_disconnect_network(wifi_mesh_h handle, wifi_mesh_network_h _network); int _mesh_forget_network(wifi_mesh_h handle, wifi_mesh_network_h _network); int _mesh_set_interface(wifi_mesh_h handle, const char *mesh, const char *gate, const char *softap); -int _wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb cb, void *user_data); +int _wifi_mesh_get_stations_info(wifi_mesh_h handle, + wifi_mesh_station_type_e sta_type, wifi_mesh_found_station_cb cb, + void *user_data); int _wifi_mesh_get_mpath_info(wifi_mesh_h handle, mesh_found_mpath_cb cb, void *user_data); int _wifi_mesh_set_interfaces(wifi_mesh_h handle, const char *mesh, const char *gate, const char *softap); int _wifi_mesh_get_meshconf_info(wifi_mesh_h handle, diff --git a/include/wifi-mesh_private.h b/include/wifi-mesh_private.h index d4c3e73..d257aaa 100644 --- a/include/wifi-mesh_private.h +++ b/include/wifi-mesh_private.h @@ -88,6 +88,7 @@ struct mesh_network_s { }; struct mesh_station_info_s { + wifi_mesh_station_type_e sta_type; /* Type of Station */ gchar bssid[MAX_BSSID_LEN]; /* station bssid ex) 7c:dd:90:62:37:cf (on mesh0) */ guint inactive_time; /**< inactive time ex) 1685 ms */ guint64 rx_bytes; /**< rx bytes ex) 34174 */ diff --git a/src/wifi-mesh-dbus.c b/src/wifi-mesh-dbus.c index bbdb3d2..02573c1 100644 --- a/src/wifi-mesh-dbus.c +++ b/src/wifi-mesh-dbus.c @@ -1671,7 +1671,9 @@ int _mesh_forget_network(wifi_mesh_h handle, wifi_mesh_network_h _network) return result; } -int _wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb cb, void *user_data) +int _wifi_mesh_get_stations_info(wifi_mesh_h handle, + wifi_mesh_station_type_e sta_type, wifi_mesh_found_station_cb cb, + void *user_data) { GVariant *variant = NULL; int result = WIFI_MESH_ERROR_NONE; @@ -1700,7 +1702,7 @@ int _wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "get_station_info", - NULL, + g_variant_new("(i)", sta_type), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); @@ -1711,6 +1713,7 @@ int _wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb struct mesh_station_info_s station; memset(&station, 0, sizeof(struct mesh_station_info_s)); /* LCOV_EXCL_START */ + station.sta_type = sta_type; while (g_variant_iter_loop(iter_row, "{sv}", &key, &val)) { if (strcasecmp(key, "bssid") == 0) { const char *buf = g_variant_get_string(val, &len); diff --git a/src/wifi-mesh-internal.c b/src/wifi-mesh-internal.c index be8cf24..2ab9121 100644 --- a/src/wifi-mesh-internal.c +++ b/src/wifi-mesh-internal.c @@ -111,7 +111,8 @@ EXPORT_API int wifi_mesh_unset_gate(wifi_mesh_h handle) } EXPORT_API int wifi_mesh_get_stations_info(wifi_mesh_h handle, - wifi_mesh_found_station_cb cb, void *user_data) + wifi_mesh_station_type_e sta_type, wifi_mesh_found_station_cb cb, + void *user_data) { int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); @@ -123,7 +124,15 @@ EXPORT_API int wifi_mesh_get_stations_info(wifi_mesh_h handle, /* LCOV_EXCL_STOP */ } - rv = _wifi_mesh_get_stations_info(handle, cb, user_data); + switch (sta_type) { + case MESH_STATION_TYPE_MESH_POINT: + case MESH_STATION_TYPE_SOFTAP: + rv = _wifi_mesh_get_stations_info(handle, sta_type, cb, user_data); + break; + default: + LOGE("Invalid Station Type"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + } return rv; } diff --git a/test/wifi-mesh-network.c b/test/wifi-mesh-network.c index 0f91e63..52ae3e5 100644 --- a/test/wifi-mesh-network.c +++ b/test/wifi-mesh-network.c @@ -138,7 +138,7 @@ static void found_station_cb(wifi_mesh_station_info_h station, void* user_data) gboolean short_slot_time; /**< short slot time supported ex) yes */ guint connected_time; /**< connected time : ex) 256 seconds */ - msgp("[%d] tation Information Received", g_idx++); + msgp("[%d] Station Information Received", g_idx++); if (NULL == station) return; @@ -837,7 +837,8 @@ static int run_get_station_information(MManager *mm, struct menu_data *menu) g_idx = 1; - ret = wifi_mesh_get_stations_info(mesh, found_station_cb, NULL); + ret = wifi_mesh_get_stations_info(mesh, MESH_STATION_TYPE_MESH_POINT, + found_station_cb, NULL); if (WIFI_MESH_ERROR_NONE != ret) { msgr("Failed to wifi_mesh_get_stations_info: [%s(0x%X)]", wifi_mesh_error_to_string(ret), ret); @@ -955,6 +956,26 @@ static int run_get_meshconf_information(MManager *mm, struct menu_data *menu) return RET_SUCCESS; } +static int run_get_softap_station_info(MManager *mm, struct menu_data *menu) +{ + int ret; + msg("Get SoftAP Station Information"); + + g_idx = 1; + + ret = wifi_mesh_get_stations_info(mesh, MESH_STATION_TYPE_SOFTAP, + found_station_cb, NULL); + if (WIFI_MESH_ERROR_NONE != ret) { + msgr("Failed to wifi_mesh_get_stations_info: [%s(0x%X)]", + wifi_mesh_error_to_string(ret), ret); + return RET_FAILURE; + } + msg(" - wifi_mesh_get_stations_info() ret: [0x%X] [%s]", + ret, wifi_mesh_error_to_string(ret)); + + return RET_SUCCESS; +} + static struct menu_data menu_specific_scan[] = { { "1", "Mesh ID", NULL, NULL, meshid }, { "2", "Channel", NULL, NULL, mesh_channel }, @@ -1036,5 +1057,7 @@ struct menu_data menu_mesh_network[] = { { "19", "Get mesh path information", NULL, run_get_mpath_information, NULL }, { "20", "Get mesh conf information", NULL, run_get_meshconf_information, NULL }, + { "21", "Get softap station information", NULL, run_get_softap_station_info, + NULL }, { NULL, NULL, }, }; |