aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/qmi-service-wds.json23
-rw-r--r--src/qmicli/qmicli-wds.c64
2 files changed, 87 insertions, 0 deletions
diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json
index d037481..498710b 100644
--- a/data/qmi-service-wds.json
+++ b/data/qmi-service-wds.json
@@ -639,6 +639,29 @@
"public-format" : "QmiWdsExtendedTechnologyPreference" } ] },
// *********************************************************************************
+ { "name" : "Get Channel Rates",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0023",
+ "version" : "1.0",
+ "since" : "1.20",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Channel Rates",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "since" : "1.0",
+ "format" : "sequence",
+ "contents" : [ { "name" : "Channel TX Rate BPS",
+ "format" : "guint32" },
+ { "name" : "Channel RX Rate BPS",
+ "format" : "guint32" },
+ { "name" : "Max Channel TX Rate BPS",
+ "format" : "guint32" },
+ { "name" : "Max Channel RX Rate BPS",
+ "format" : "guint32" } ] } ] },
+
+ // *********************************************************************************
{ "name" : "Get Packet Statistics",
"type" : "Message",
"service" : "WDS",
diff --git a/src/qmicli/qmicli-wds.c b/src/qmicli/qmicli-wds.c
index c4744af..e434630 100644
--- a/src/qmicli/qmicli-wds.c
+++ b/src/qmicli/qmicli-wds.c
@@ -73,6 +73,7 @@ static gboolean reset_flag;
static gboolean noop_flag;
static gchar *bind_mux_str;
static gchar *set_ip_family_str;
+static gboolean get_channel_rates_flag;
static GOptionEntry entries[] = {
{ "wds-start-network", 0, 0, G_OPTION_ARG_STRING, &start_network_str,
@@ -151,6 +152,10 @@ static GOptionEntry entries[] = {
"Set IP family",
"[4|6]"
},
+ { "wds-get-channel-rates", 0, 0, G_OPTION_ARG_NONE, &get_channel_rates_flag,
+ "Get channel data rates",
+ NULL
+ },
{ "wds-noop", 0, 0, G_OPTION_ARG_NONE, &noop_flag,
"Just allocate or release a WDS client. Use with `--client-no-release-cid' and/or `--client-cid'",
NULL
@@ -200,6 +205,7 @@ qmicli_wds_options_enabled (void)
!!set_autoconnect_settings_str +
get_supported_messages_flag +
reset_flag +
+ !!get_channel_rates_flag +
noop_flag);
if (n_actions > 1) {
@@ -1720,6 +1726,52 @@ set_ip_family_ready (QmiClientWds *client,
operation_shutdown (TRUE);
}
+static void
+get_channel_rates_ready (QmiClientWds *client,
+ GAsyncResult *res)
+{
+ QmiMessageWdsGetChannelRatesOutput *output;
+ guint32 txrate = 0, rxrate = 0, maxtxrate = 0, maxrxrate = 0;
+ GError *error = NULL;
+
+ output = qmi_client_wds_get_channel_rates_finish (client, res, &error);
+ if (!output) {
+ g_printerr ("error: operation failed: %s\n", error->message);
+ g_error_free (error);
+ operation_shutdown (FALSE);
+ return;
+ }
+
+ if (!qmi_message_wds_get_channel_rates_output_get_result (output, &error)) {
+ g_printerr ("error: couldn't get channel rates: %s\n",
+ error->message);
+ g_error_free (error);
+ qmi_message_wds_get_channel_rates_output_unref (output);
+ operation_shutdown (FALSE);
+ return;
+ }
+
+ g_print ("Channel data rates:\n");
+
+ qmi_message_wds_get_channel_rates_output_get_channel_rates (output,
+ &txrate,
+ &rxrate,
+ &maxtxrate,
+ &maxrxrate,
+ NULL);
+ g_print ("\tCurrent TX rate: %ubps\n"
+ "\tCurrent RX rate: %ubps\n"
+ "\tMax TX rate: %ubps\n"
+ "\tMax RX rate: %ubps\n",
+ txrate,
+ rxrate,
+ maxtxrate,
+ maxrxrate);
+
+ qmi_message_wds_get_channel_rates_output_unref (output);
+ operation_shutdown (TRUE);
+}
+
void
qmicli_wds_run (QmiDevice *device,
QmiClientWds *client,
@@ -2064,6 +2116,18 @@ qmicli_wds_run (QmiDevice *device,
return;
}
+ /* Request to get channel data rates? */
+ if (get_channel_rates_flag) {
+ g_debug ("Asynchronously getting channel data rates...");
+ qmi_client_wds_get_channel_rates (client,
+ NULL,
+ 10,
+ ctx->cancellable,
+ (GAsyncReadyCallback)get_channel_rates_ready,
+ NULL);
+ return;
+ }
+
/* Just client allocate/release? */
if (noop_flag) {
g_idle_add (noop_cb, NULL);