commit 47b6da81b4533ad505356c4125526c732576f7d5
parent 0f95c97649346e888e275d6ce9d96cfdb1166562
Author: James Prestwood <prestwoj@gmail.com>
Date: Tue, 1 Nov 2022 13:17:37 -0700
client: show frequency with ap show
Diffstat:
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/client/ap.c b/client/ap.c
@@ -36,6 +36,7 @@ struct ap {
bool started;
char *name;
bool scanning;
+ uint32_t freq;
};
static void *ap_create(void)
@@ -126,10 +127,35 @@ static const char *get_scanning_tostr(const void *data)
return ap->scanning ? "yes" : "no";
}
+static void update_freq(void *data, struct l_dbus_message_iter *variant)
+{
+ struct ap *ap = data;
+ uint32_t value;
+
+ if (!l_dbus_message_iter_get_variant(variant, "u", &value)) {
+ ap->freq = 0;
+
+ return;
+ }
+
+ ap->freq = value;
+}
+
+static const char *get_freq_tostr(const void *data)
+{
+ const struct ap *ap = data;
+ static char str[5];
+
+ sprintf(str, "%u", ap->freq);
+
+ return str;
+}
+
static const struct proxy_interface_property ap_properties[] = {
{ "Started", "b", update_started, get_started_tostr },
{ "Name", "s", update_name, get_name_tostr },
{ "Scanning", "b", update_scanning, get_scanning_tostr },
+ { "Frequency", "u", update_freq, get_freq_tostr },
{ }
};