mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
client: update station to use diagnostic_display
This commit is contained in:
parent
9659c936cd
commit
053afbf19b
@ -31,6 +31,7 @@
|
|||||||
#include "client/device.h"
|
#include "client/device.h"
|
||||||
#include "client/network.h"
|
#include "client/network.h"
|
||||||
#include "client/display.h"
|
#include "client/display.h"
|
||||||
|
#include "client/diagnostic.h"
|
||||||
|
|
||||||
struct station {
|
struct station {
|
||||||
bool scanning;
|
bool scanning;
|
||||||
@ -597,8 +598,6 @@ static void get_diagnostics_callback(struct l_dbus_message *message,
|
|||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct l_dbus_message_iter iter;
|
struct l_dbus_message_iter iter;
|
||||||
struct l_dbus_message_iter variant;
|
|
||||||
const char *key;
|
|
||||||
|
|
||||||
if (dbus_message_has_error(message))
|
if (dbus_message_has_error(message))
|
||||||
return;
|
return;
|
||||||
@ -608,52 +607,7 @@ static void get_diagnostics_callback(struct l_dbus_message *message,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (l_dbus_message_iter_next_entry(&iter, &key, &variant)) {
|
diagnostic_display(&iter, " ", 20, 20);
|
||||||
const char *s_value;
|
|
||||||
uint32_t u_value;
|
|
||||||
int16_t i_value;
|
|
||||||
uint8_t y_value;
|
|
||||||
|
|
||||||
if (!strcmp(key, "ConnectedBss") || !strcmp(key, "RxMode") ||
|
|
||||||
!strcmp(key, "TxMode")) {
|
|
||||||
/* String variants with no special handling */
|
|
||||||
|
|
||||||
l_dbus_message_iter_get_variant(&variant, "s",
|
|
||||||
&s_value);
|
|
||||||
|
|
||||||
display("%s%*s %-*s%-*s\n", MARGIN, 8, "", 20,
|
|
||||||
key, 47, s_value);
|
|
||||||
} else if (!strcmp(key, "RxBitrate") ||
|
|
||||||
!strcmp(key, "TxBitrate")) {
|
|
||||||
/* Bitrates expressed in 100Kbit/s */
|
|
||||||
|
|
||||||
l_dbus_message_iter_get_variant(&variant, "u",
|
|
||||||
&u_value);
|
|
||||||
display("%s%*s %-*s%u Kbit/s\n", MARGIN, 8, "", 20,
|
|
||||||
key, u_value * 100);
|
|
||||||
} else if (!strcmp(key, "ExpectedThroughput")) {
|
|
||||||
/* ExpectedThroughput expressed in Kbit/s */
|
|
||||||
|
|
||||||
l_dbus_message_iter_get_variant(&variant, "u",
|
|
||||||
&u_value);
|
|
||||||
display("%s%*s %-*s%u Kbit/s\n", MARGIN, 8, "", 20,
|
|
||||||
key, u_value);
|
|
||||||
} else if (!strcmp(key, "RSSI")) {
|
|
||||||
/* RSSI expressed in dBm */
|
|
||||||
|
|
||||||
l_dbus_message_iter_get_variant(&variant, "n",
|
|
||||||
&i_value);
|
|
||||||
display("%s%*s %-*s%i dBm\n", MARGIN, 8, "", 20,
|
|
||||||
key, i_value);
|
|
||||||
} else if (!strcmp(key, "RxMCS") || !strcmp(key, "TxMCS")) {
|
|
||||||
/* MCS index's are single byte integers */
|
|
||||||
|
|
||||||
l_dbus_message_iter_get_variant(&variant, "y",
|
|
||||||
&y_value);
|
|
||||||
display("%s%*s %-*s%u\n", MARGIN, 8, "", 20,
|
|
||||||
key, y_value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* Finish the table started by cmd_show */
|
/* Finish the table started by cmd_show */
|
||||||
|
Loading…
Reference in New Issue
Block a user