aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/qmi-service-nas.json16
-rw-r--r--docs/reference/libqmi-glib/libqmi-glib-docs.xml1
-rw-r--r--src/qmicli/qmicli-nas.c75
3 files changed, 92 insertions, 0 deletions
diff --git a/data/qmi-service-nas.json b/data/qmi-service-nas.json
index b8a4aab..78ee0b7 100644
--- a/data/qmi-service-nas.json
+++ b/data/qmi-service-nas.json
@@ -358,6 +358,22 @@
"output" : [ { "common-ref" : "Operation Result" } ] },
// *********************************************************************************
+ { "name" : "Get Supported Messages",
+ "type" : "Message",
+ "service" : "NAS",
+ "id" : "0x001E",
+ "version" : "1.54",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "List",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "array",
+ "size-prefix-format" : "guint16",
+ "array-element" : { "format" : "guint8" },
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
{ "name" : "Get Signal Strength",
"type" : "Message",
"service" : "NAS",
diff --git a/docs/reference/libqmi-glib/libqmi-glib-docs.xml b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
index f037805..20da3c0 100644
--- a/docs/reference/libqmi-glib/libqmi-glib-docs.xml
+++ b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
@@ -145,6 +145,7 @@
<xi:include href="xml/qmi-message-nas-get-cdma-position-info.xml"/>
<xi:include href="xml/qmi-message-nas-get-tx-rx-info.xml"/>
<xi:include href="xml/qmi-message-nas-get-cell-location-info.xml"/>
+ <xi:include href="xml/qmi-message-nas-get-supported-messages.xml"/>
</section>
</chapter>
diff --git a/src/qmicli/qmicli-nas.c b/src/qmicli/qmicli-nas.c
index 2db3427..b97a568 100644
--- a/src/qmicli/qmicli-nas.c
+++ b/src/qmicli/qmicli-nas.c
@@ -53,6 +53,7 @@ static gboolean get_system_selection_preference_flag;
static gchar *set_system_selection_preference_str;
static gboolean network_scan_flag;
static gboolean get_cell_location_info_flag;
+static gboolean get_supported_messages_flag;
static gboolean reset_flag;
static gboolean noop_flag;
@@ -101,6 +102,10 @@ static GOptionEntry entries[] = {
"Get Cell Location Info",
NULL
},
+ { "nas-get-supported-messages", 0, 0, G_OPTION_ARG_NONE, &get_supported_messages_flag,
+ "Get supported messages",
+ NULL
+ },
{ "nas-reset", 0, 0, G_OPTION_ARG_NONE, &reset_flag,
"Reset the service state",
NULL
@@ -147,6 +152,7 @@ qmicli_nas_options_enabled (void)
!!set_system_selection_preference_str +
network_scan_flag +
get_cell_location_info_flag +
+ get_supported_messages_flag +
reset_flag +
noop_flag);
@@ -2751,6 +2757,63 @@ get_cell_location_info_ready (QmiClientNas *client,
}
static void
+get_supported_messages_ready (QmiClientNas *client,
+ GAsyncResult *res)
+{
+ QmiMessageNasGetSupportedMessagesOutput *output;
+ GError *error = NULL;
+ GArray *bytearray = NULL;
+ GString *str = NULL;
+
+ output = qmi_client_nas_get_supported_messages_finish (client, res, &error);
+ if (!output) {
+ g_printerr ("error: operation failed: %s\n", error->message);
+ g_error_free (error);
+ shutdown (FALSE);
+ return;
+ }
+
+ if (!qmi_message_nas_get_supported_messages_output_get_result (output, &error)) {
+ g_printerr ("error: couldn't get supported NAS messages: %s\n", error->message);
+ g_error_free (error);
+ qmi_message_nas_get_supported_messages_output_unref (output);
+ shutdown (FALSE);
+ return;
+ }
+
+ g_print ("[%s] Successfully got supported NAS messages:\n",
+ qmi_device_get_path_display (ctx->device));
+
+ if (qmi_message_nas_get_supported_messages_output_get_list (output, &bytearray, NULL)) {
+
+ guint bytearray_i;
+
+ for (bytearray_i = 0; bytearray_i < bytearray->len; bytearray_i++) {
+ guint bit_i;
+ guint8 bytevalue;
+
+ bytevalue = g_array_index (bytearray, guint8, bytearray_i);
+ for (bit_i = 0; bit_i < 8; bit_i++) {
+ if (bytevalue & (1 << bit_i)) {
+ if (!str)
+ str = g_string_new ("");
+ g_string_append_printf (str, "\t0x%04X\n", (bit_i + (8 * bytearray_i)));
+ }
+ }
+ }
+ }
+
+ if (str) {
+ g_print ("%s", str->str);
+ g_string_free (str, TRUE);
+ } else
+ g_print ("\tnone\n");
+
+ qmi_message_nas_get_supported_messages_output_unref (output);
+ shutdown (TRUE);
+}
+
+static void
reset_ready (QmiClientNas *client,
GAsyncResult *res)
{
@@ -2956,6 +3019,18 @@ qmicli_nas_run (QmiDevice *device,
return;
}
+ /* Request to list supported messages? */
+ if (get_supported_messages_flag) {
+ g_debug ("Asynchronously getting supported NAS messages...");
+ qmi_client_nas_get_supported_messages (ctx->client,
+ NULL,
+ 10,
+ ctx->cancellable,
+ (GAsyncReadyCallback)get_supported_messages_ready,
+ NULL);
+ return;
+ }
+
/* Request to reset NAS service? */
if (reset_flag) {
g_debug ("Asynchronously resetting NAS service...");