All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v3 3/7] station: refactor to use diagnostic_info_to_dict
Date: Fri, 22 Jan 2021 10:14:30 -0800	[thread overview]
Message-ID: <20210122181434.644707-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20210122181434.644707-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2919 bytes --]

---
 src/station.c | 68 +--------------------------------------------------
 1 file changed, 1 insertion(+), 67 deletions(-)

diff --git a/src/station.c b/src/station.c
index 41f19b09..c71d8e6c 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3463,7 +3463,6 @@ static void station_get_diagnostic_cb(
 	struct station *station = user_data;
 	struct l_dbus_message *reply;
 	struct l_dbus_message_builder *builder;
-	int16_t rssi;
 
 	if (!info) {
 		reply = dbus_error_aborted(station->get_station_pending);
@@ -3472,8 +3471,6 @@ static void station_get_diagnostic_cb(
 
 	reply = l_dbus_message_new_method_return(station->get_station_pending);
 
-	rssi = (int16_t)info->cur_rssi;
-
 	builder = l_dbus_message_builder_new(reply);
 
 	l_dbus_message_builder_enter_array(builder, "{sv}");
@@ -3481,70 +3478,7 @@ static void station_get_diagnostic_cb(
 	dbus_append_dict_basic(builder, "ConnectedBss", 's',
 					util_address_to_string(info->addr));
 
-	if (info->have_cur_rssi)
-		dbus_append_dict_basic(builder, "RSSI", 'n', &rssi);
-
-	if (info->have_rx_mcs) {
-		switch (info->rx_mcs_type) {
-		case NETDEV_MCS_TYPE_HT:
-			dbus_append_dict_basic(builder, "RxMode", 's',
-						"802.11n");
-			dbus_append_dict_basic(builder, "RxMCS", 'y',
-						&info->rx_mcs);
-			break;
-		case NETDEV_MCS_TYPE_VHT:
-			dbus_append_dict_basic(builder, "RxMode", 's',
-						"802.11ac");
-			dbus_append_dict_basic(builder, "RxMCS", 'y',
-						&info->rx_mcs);
-			break;
-		case NETDEV_MCS_TYPE_HE:
-			dbus_append_dict_basic(builder, "RxMode", 's',
-						"802.11ax");
-			dbus_append_dict_basic(builder, "RxMCS", 'y',
-						&info->rx_mcs);
-			break;
-		default:
-			break;
-		}
-	}
-
-	if (info->have_tx_mcs) {
-		switch (info->tx_mcs_type) {
-		case NETDEV_MCS_TYPE_HT:
-			dbus_append_dict_basic(builder, "TxMode", 's',
-						"802.11n");
-			dbus_append_dict_basic(builder, "TxMCS", 'y',
-						&info->tx_mcs);
-			break;
-		case NETDEV_MCS_TYPE_VHT:
-			dbus_append_dict_basic(builder, "TxMode", 's',
-						"802.11ac");
-			dbus_append_dict_basic(builder, "TxMCS", 'y',
-						&info->tx_mcs);
-			break;
-		case NETDEV_MCS_TYPE_HE:
-			dbus_append_dict_basic(builder, "TxMode", 's',
-						"802.11ax");
-			dbus_append_dict_basic(builder, "TxMCS", 'y',
-						&info->tx_mcs);
-			break;
-		default:
-			break;
-		}
-	}
-
-	if (info->have_tx_bitrate)
-		dbus_append_dict_basic(builder, "TxBitrate", 'u',
-					&info->tx_bitrate);
-
-	if (info->have_rx_bitrate)
-		dbus_append_dict_basic(builder, "RxBitrate", 'u',
-					&info->rx_bitrate);
-
-	if (info->have_expected_throughput)
-		dbus_append_dict_basic(builder, "ExpectedThroughput", 'u',
-					&info->expected_throughput);
+	diagnostic_info_to_dict(info, builder);
 
 	l_dbus_message_builder_leave_array(builder);
 	l_dbus_message_builder_finalize(builder);
-- 
2.26.2

  parent reply	other threads:[~2021-01-22 18:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 18:14 [PATCH v3 1/7] netdev: move netdev_station_info to diagnostic.h James Prestwood
2021-01-22 18:14 ` [PATCH v3 2/7] diagnostic: commonize the building of diagnostic dict James Prestwood
2021-01-22 18:14 ` James Prestwood [this message]
2021-01-22 18:14 ` [PATCH v3 4/7] ap: add AP diagnostic interface James Prestwood
2021-01-22 18:14 ` [PATCH v3 5/7] client: implement diagnostic module James Prestwood
2021-01-22 18:14 ` [PATCH v3 6/7] client: implement "ap <wlan> show" James Prestwood
2021-01-22 18:14 ` [PATCH v3 7/7] client: update station to use diagnostic_display James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210122181434.644707-3-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.