wifi-mesh: Correct found_station_cb() logging code 09/162809/1 accepted/tizen/unified/20171207.124739 submit/tizen/20171207.070141
authorSaurav Babu <saurav.babu@samsung.com>
Tue, 5 Dec 2017 10:44:43 +0000 (16:14 +0530)
committerSaurav Babu <saurav.babu@samsung.com>
Tue, 5 Dec 2017 10:44:43 +0000 (16:14 +0530)
Change-Id: I0b9f8eac597f0cc90fa27bb2b97efaad64626437
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
test/wifi-mesh-network.c

index 52ae3e5..fa162b8 100644 (file)
@@ -100,6 +100,42 @@ static void connected_peer_cb(wifi_mesh_peer_h peer, void* user_data)
                free(address);
 }
 
+static const char *mesh_plink_state_to_string(guchar plink)
+{
+       switch (plink) {
+       case 0:
+               return "LISTEN";
+       case 1:
+               return "OPN_SNT";
+       case 2:
+               return "OPN_RCVD";
+       case 3:
+               return "CNF_RCVD";
+       case 4:
+               return "ESTAB";
+       case 5:
+               return "HOLDING";
+       case 6:
+               return "BLOCKED";
+       default:
+               return "UNKNOWN";
+       }
+}
+
+static const char *power_mode_to_string(guint pm)
+{
+       switch (pm) {
+       case 1: /* NL80211_MESH_POWER_ACTIVE */
+               return "ACTIVE";
+       case 2: /* NL80211_MESH_POWER_LIGHT_SLEEP */
+               return "LIGHT SLEEP";
+       case 3: /* NL80211_MESH_POWER_DEEP_SLEEP */
+               return "DEEP SLEEP";
+       default:
+               return "UNKNOWN";
+       }
+}
+
 static void found_station_cb(wifi_mesh_station_info_h station, void* user_data)
 {
        int ret = WIFI_MESH_ERROR_NONE;
@@ -148,7 +184,7 @@ static void found_station_cb(wifi_mesh_station_info_h station, void* user_data)
                msg("bssid = %s", bssid);
        ret = wifi_mesh_get_sta_inactive_time(station, &inactive_time);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("inactive_time = %d", inactive_time);
+               msg("inactive_time = %d ms", inactive_time);
        ret = wifi_mesh_get_sta_rx_bytes(station, &rx_bytes);
        if (WIFI_MESH_ERROR_NONE == ret)
                msg("rx_bytes = %"G_GUINT64_FORMAT, rx_bytes);
@@ -178,16 +214,16 @@ static void found_station_cb(wifi_mesh_station_info_h station, void* user_data)
                msg("rx_drop_misc = %"G_GUINT64_FORMAT, rx_drop_misc);
        ret = wifi_mesh_get_sta_signal(station, &signal);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("signal = %d", signal);
+               msg("signal = %d dBm", signal);
        ret = wifi_mesh_get_sta_signal_avg(station, &signal_avg);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("signal_avg = %d", signal_avg);
+               msg("signal_avg = %d dBm", signal_avg);
        ret = wifi_mesh_get_sta_tx_bitrate(station, &tx_bitrate);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("inactive_time = %d", inactive_time);
+               msg("tx_bitrate = %d.%d MBit/s", tx_bitrate / 10, tx_bitrate % 10);
        ret = wifi_mesh_get_sta_rx_bitrate(station, &rx_bitrate);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("tx_bitrate = %d", tx_bitrate);
+               msg("rx_bitrate = %d.%d MBit/s", rx_bitrate / 10, rx_bitrate % 10);
        ret = wifi_mesh_get_sta_mesh_llid(station, &mesh_llid);
        if (WIFI_MESH_ERROR_NONE == ret)
                msg("mesh_llid = %d", mesh_llid);
@@ -196,37 +232,37 @@ static void found_station_cb(wifi_mesh_station_info_h station, void* user_data)
                msg("mesh_plid = %d", mesh_plid);
        ret = wifi_mesh_get_sta_mesh_plink(station, &mesh_plink);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("inactive_time = %d", inactive_time);
+               msg("mesh_plink = %s", mesh_plink_state_to_string(mesh_plink));
        ret = wifi_mesh_get_sta_local_ps_mode(station, &local_ps_mode);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("inactive_time = %d", inactive_time);
+               msg("local_ps_mode = %s", power_mode_to_string(local_ps_mode));
        ret = wifi_mesh_get_sta_peer_ps_mode(station, &peer_ps_mode);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("local_ps_mode = %d", local_ps_mode);
+               msg("peer_ps_mode = %s", power_mode_to_string(peer_ps_mode));
        ret = wifi_mesh_get_sta_non_peer_ps_mode(station, &non_peer_ps_mode);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("local_ps_mode = %d", local_ps_mode);
+               msg("non_peer_ps_mode = %s", power_mode_to_string(non_peer_ps_mode));
        ret = wifi_mesh_get_sta_authorized(station, &authorized);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("authorized = %d", authorized);
+               msg("authorized = %s", authorized ? "yes" : "no");
        ret = wifi_mesh_get_sta_authenticated(station, &authenticated);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("authenticated = %d", authenticated);
+               msg("authenticated = %s", authenticated ? "yes" : "no");
        ret = wifi_mesh_get_sta_associated(station, &associated);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("associated = %d", associated);
+               msg("associated = %s", associated ? "yes" : "no");
        ret = wifi_mesh_get_sta_preamble(station, &preamble);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("preamble = %d", preamble);
+               msg("preamble = %s", preamble ? "short" : "long");
        ret = wifi_mesh_get_sta_wmm_wme(station, &wmm_wme);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("wmm_wme = %d", wmm_wme);
+               msg("wmm_wme = %s", wmm_wme ? "yes" : "no");
        ret = wifi_mesh_get_sta_mfp(station, &mfp);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("wmm_wme = %d", wmm_wme);
+               msg("mfp = %s", mfp ? "yes" : "no");
        ret = wifi_mesh_get_sta_tdls_peer(station, &tdls_peer);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("tdls_peer = %d", tdls_peer);
+               msg("tdls_peer = %s", tdls_peer ? "yes" : "no");
        ret = wifi_mesh_get_sta_dtim_period(station, &dtim_period);
        if (WIFI_MESH_ERROR_NONE == ret)
                msg("dtim_period = %d", dtim_period);
@@ -241,10 +277,10 @@ static void found_station_cb(wifi_mesh_station_info_h station, void* user_data)
                msg("short_preamble = %d", short_preamble);
        ret = wifi_mesh_get_sta_short_slot_time(station, &short_slot_time);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("short_slot_time = %d", short_slot_time);
+               msg("short_slot_time = %s", short_slot_time ? "yes" : "no");
        ret = wifi_mesh_get_sta_connected_time(station, &connected_time);
        if (WIFI_MESH_ERROR_NONE == ret)
-               msg("connected_time = %d", connected_time);
+               msg("connected_time = %d seconds", connected_time);
 
 }