[PATCH] dbus: Report guard interval and dual carrier modulation.
David Ruth
druth at chromium.org
Wed Jul 19 10:29:15 PDT 2023
Propagate guard interval as a double value and dual carrier modulation
as a boolean over D-Bus.
Signed-off-by: David Ruth <druth at chromium.org>
---
wpa_supplicant/dbus/dbus_dict_helpers.c | 21 ++++++++++++++++++
wpa_supplicant/dbus/dbus_dict_helpers.h | 4 ++++
wpa_supplicant/dbus/dbus_new_helpers.c | 29 +++++++++++++++++++++++++
3 files changed, 54 insertions(+)
diff --git a/wpa_supplicant/dbus/dbus_dict_helpers.c b/wpa_supplicant/dbus/dbus_dict_helpers.c
index 0e4753450..22dda1578 100644
--- a/wpa_supplicant/dbus/dbus_dict_helpers.c
+++ b/wpa_supplicant/dbus/dbus_dict_helpers.c
@@ -361,6 +361,27 @@ dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
}
+/**
+ * Add a double entry to the dict.
+ *
+ * @param iter_dict A valid DBusMessageIter returned from
+ * wpa_dbus_dict_open_write()
+ * @param key The key of the dict item
+ * @param value The double value
+ * @return TRUE on success, FALSE on failure
+ *
+ */
+dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
+ const char* key,
+ const double value)
+{
+ if (!key || !value)
+ return FALSE;
+ return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_DOUBLE,
+ &value);
+}
+
+
/**
* Begin an array entry in the dict
*
diff --git a/wpa_supplicant/dbus/dbus_dict_helpers.h b/wpa_supplicant/dbus/dbus_dict_helpers.h
index 44685ea4a..cc9e26fa9 100644
--- a/wpa_supplicant/dbus/dbus_dict_helpers.h
+++ b/wpa_supplicant/dbus/dbus_dict_helpers.h
@@ -59,6 +59,10 @@ dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
const char *value,
const dbus_uint32_t value_len);
+dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
+ const char *key,
+ const double value);
+
/* Manual construction and addition of array elements */
dbus_bool_t wpa_dbus_dict_begin_array(DBusMessageIter *iter_dict,
const char *key, const char *type,
diff --git a/wpa_supplicant/dbus/dbus_new_helpers.c b/wpa_supplicant/dbus/dbus_new_helpers.c
index 06f74ad3d..1ce566ce0 100644
--- a/wpa_supplicant/dbus/dbus_new_helpers.c
+++ b/wpa_supplicant/dbus/dbus_new_helpers.c
@@ -1026,6 +1026,23 @@ DBusMessage * wpas_dbus_reply_new_from_error(DBusMessage *message,
}
+double _wpas_dbus_new_guard_interval_to_double(enum guard_interval value)
+{
+ switch(value) {
+ case GUARD_INTERVAL_0_4:
+ return 0.4;
+ case GUARD_INTERVAL_0_8:
+ return 0.8;
+ case GUARD_INTERVAL_1_6:
+ return 1.6;
+ case GUARD_INTERVAL_3_2:
+ return 3.2;
+ default:
+ return 0;
+ }
+}
+
+
/**
* wpas_dbus_new_from_signal_information - Adds a wpa_signal_info
* to a DBusMessage.
@@ -1149,6 +1166,18 @@ int wpas_dbus_new_from_signal_information(DBusMessageIter *iter,
(si->data.avg_ack_signal &&
!wpa_dbus_dict_append_int32(&iter_dict, "avg-ack-rssi",
si->data.avg_ack_signal)) ||
+ (si->data.rx_guard_interval &&
+ !wpa_dbus_dict_append_double(&iter_dict, "rx-guard-interval",
+ _wpas_dbus_new_guard_interval_to_double(si->data.rx_guard_interval))) ||
+ (si->data.tx_guard_interval &&
+ !wpa_dbus_dict_append_double(&iter_dict, "tx-guard-interval",
+ _wpas_dbus_new_guard_interval_to_double(si->data.tx_guard_interval))) ||
+ (si->data.rx_dcm &&
+ !wpa_dbus_dict_append_bool(&iter_dict, "rx-dcm",
+ si->data.rx_dcm)) ||
+ (si->data.tx_dcm &&
+ !wpa_dbus_dict_append_bool(&iter_dict, "tx-dcm",
+ si->data.tx_dcm)) ||
!wpa_dbus_dict_close_write(&variant_iter, &iter_dict) ||
!dbus_message_iter_close_container(iter, &variant_iter))
return -ENOMEM;
--
2.41.0.487.g6d72f3e995-goog
More information about the Hostap
mailing list