aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2016-10-04 07:43:57 -0500
committerDan Williams <dcbw@redhat.com>2016-10-06 10:12:04 -0500
commitd90fae4dba60c40ae71e2d5f20e9191483a8cbdf (patch)
tree84d372a4c335a7d20c15529dc890826d3cdfc98b
parentdda73618bdb92c4e91ce8066c3082d4033475c29 (diff)
wds: add Go Dormant, Go Active, and Get Dormancy Status
-rw-r--r--data/qmi-service-wds.json31
-rw-r--r--docs/reference/libqmi-glib/libqmi-glib-docs.xml3
-rw-r--r--src/qmicli/qmicli-wds.c149
3 files changed, 183 insertions, 0 deletions
diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json
index 5b342c6..6e20823 100644
--- a/data/qmi-service-wds.json
+++ b/data/qmi-service-wds.json
@@ -647,6 +647,22 @@
"prerequisites" : [ { "common-ref" : "Success" } ] } ] },
// *********************************************************************************
+ { "name" : "Go Dormant",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0025",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Go Active",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0026",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
{ "name" : "Create Profile",
"type" : "Message",
"service" : "WDS",
@@ -1551,6 +1567,21 @@
"prerequisites" : [ { "common-ref" : "Success" } ] } ] },
// *********************************************************************************
+ { "name" : "Get Dormancy Status",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0030",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Dormancy Status",
+ "id" : "0x01",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsDormancyStatus",
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
{ "name" : "Get Autoconnect Settings",
"type" : "Message",
"service" : "WDS",
diff --git a/docs/reference/libqmi-glib/libqmi-glib-docs.xml b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
index a1e6052..57d7c43 100644
--- a/docs/reference/libqmi-glib/libqmi-glib-docs.xml
+++ b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
@@ -172,11 +172,14 @@
<xi:include href="xml/qmi-message-wds-stop-network.xml"/>
<xi:include href="xml/qmi-message-wds-get-packet-service-status.xml"/>
<xi:include href="xml/qmi-message-wds-get-packet-statistics.xml"/>
+ <xi:include href="xml/qmi-message-wds-go-dormant.xml"/>
+ <xi:include href="xml/qmi-message-wds-go-active.xml"/>
<xi:include href="xml/qmi-message-wds-create-profile.xml"/>
<xi:include href="xml/qmi-message-wds-get-profile-list.xml"/>
<xi:include href="xml/qmi-message-wds-get-profile-settings.xml"/>
<xi:include href="xml/qmi-message-wds-get-default-settings.xml"/>
<xi:include href="xml/qmi-message-wds-get-current-settings.xml"/>
+ <xi:include href="xml/qmi-message-wds-get-dormancy-status.xml"/>
<xi:include href="xml/qmi-message-wds-get-autoconnect-settings.xml"/>
<xi:include href="xml/qmi-message-wds-set-autoconnect-settings.xml"/>
<xi:include href="xml/qmi-message-wds-get-data-bearer-technology.xml"/>
diff --git a/src/qmicli/qmicli-wds.c b/src/qmicli/qmicli-wds.c
index 3fc964c..5973b11 100644
--- a/src/qmicli/qmicli-wds.c
+++ b/src/qmicli/qmicli-wds.c
@@ -57,6 +57,10 @@ static gboolean get_packet_service_status_flag;
static gboolean get_packet_statistics_flag;
static gboolean get_data_bearer_technology_flag;
static gboolean get_current_data_bearer_technology_flag;
+static gboolean get_current_data_bearer_technology_flag;
+static gboolean go_dormant_flag;
+static gboolean go_active_flag;
+static gboolean get_dormancy_status_flag;
static gchar *get_profile_list_str;
static gchar *get_default_settings_str;
static gboolean get_autoconnect_settings_flag;
@@ -98,6 +102,18 @@ static GOptionEntry entries[] = {
"Get current data bearer technology",
NULL
},
+ { "wds-go-dormant", 0, 0, G_OPTION_ARG_NONE, &go_dormant_flag,
+ "Make the active data connection go dormant",
+ NULL
+ },
+ { "wds-go-active", 0, 0, G_OPTION_ARG_NONE, &go_active_flag,
+ "Make the active data connection go active",
+ NULL
+ },
+ { "wds-get-dormancy-status", 0, 0, G_OPTION_ARG_NONE, &get_dormancy_status_flag,
+ "Get the dormancy status of the active data connection",
+ NULL
+ },
{ "wds-get-profile-list", 0, 0, G_OPTION_ARG_STRING, &get_profile_list_str,
"Get profile list",
"[3gpp|3gpp2]"
@@ -160,6 +176,9 @@ qmicli_wds_options_enabled (void)
get_packet_statistics_flag +
get_data_bearer_technology_flag +
get_current_data_bearer_technology_flag +
+ go_dormant_flag +
+ go_active_flag +
+ get_dormancy_status_flag +
!!get_profile_list_str +
!!get_default_settings_str +
get_autoconnect_settings_flag +
@@ -1025,6 +1044,100 @@ get_current_data_bearer_technology_ready (QmiClientWds *client,
operation_shutdown (TRUE);
}
+static void
+go_dormant_ready (QmiClientWds *client,
+ GAsyncResult *res)
+{
+ GError *error = NULL;
+ QmiMessageWdsGoDormantOutput *output;
+
+ output = qmi_client_wds_go_dormant_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_go_dormant_output_get_result (output, &error)) {
+ g_printerr ("error: couldn't go dormant: %s\n", error->message);
+ g_error_free (error);
+ qmi_message_wds_go_dormant_output_unref (output);
+ operation_shutdown (FALSE);
+ return;
+ }
+
+ qmi_message_wds_go_dormant_output_unref (output);
+ operation_shutdown (TRUE);
+}
+
+static void
+go_active_ready (QmiClientWds *client,
+ GAsyncResult *res)
+{
+ GError *error = NULL;
+ QmiMessageWdsGoActiveOutput *output;
+
+ output = qmi_client_wds_go_active_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_go_active_output_get_result (output, &error)) {
+ g_printerr ("error: couldn't go active: %s\n", error->message);
+ g_error_free (error);
+ qmi_message_wds_go_active_output_unref (output);
+ operation_shutdown (FALSE);
+ return;
+ }
+
+ qmi_message_wds_go_active_output_unref (output);
+ operation_shutdown (TRUE);
+}
+
+static void
+get_dormancy_status_ready (QmiClientWds *client,
+ GAsyncResult *res)
+{
+ GError *error = NULL;
+ QmiMessageWdsGetDormancyStatusOutput *output;
+ QmiWdsDormancyStatus status;
+
+ output = qmi_client_wds_get_dormancy_status_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_dormancy_status_output_get_result (output, &error)) {
+ g_printerr ("error: couldn't get dormancy status: %s\n", error->message);
+ g_error_free (error);
+ qmi_message_wds_get_dormancy_status_output_unref (output);
+ operation_shutdown (FALSE);
+ return;
+ }
+
+ if (qmi_message_wds_get_dormancy_status_output_get_dormancy_status (
+ output,
+ &status,
+ NULL)) {
+ g_print ("[%s] Dormancy Status: '%s'\n",
+ qmi_device_get_path_display (ctx->device),
+ qmi_wds_dormancy_status_get_string (status));
+ }
+
+ qmi_message_wds_get_dormancy_status_output_unref (output);
+ operation_shutdown (TRUE);
+}
+
typedef struct {
guint i;
GArray *profile_list;
@@ -1590,6 +1703,42 @@ qmicli_wds_run (QmiDevice *device,
return;
}
+ /* Request to go dormant? */
+ if (go_dormant_flag) {
+ g_debug ("Asynchronously going dormant...");
+ qmi_client_wds_go_dormant (ctx->client,
+ NULL,
+ 10,
+ ctx->cancellable,
+ (GAsyncReadyCallback)go_dormant_ready,
+ NULL);
+ return;
+ }
+
+ /* Request to go active? */
+ if (go_active_flag) {
+ g_debug ("Asynchronously going active...");
+ qmi_client_wds_go_active (ctx->client,
+ NULL,
+ 10,
+ ctx->cancellable,
+ (GAsyncReadyCallback)go_active_ready,
+ NULL);
+ return;
+ }
+
+ /* Request to get dormancy status? */
+ if (get_dormancy_status_flag) {
+ g_debug ("Asynchronously getting dormancy status...");
+ qmi_client_wds_get_dormancy_status (ctx->client,
+ NULL,
+ 10,
+ ctx->cancellable,
+ (GAsyncReadyCallback)get_dormancy_status_ready,
+ NULL);
+ return;
+ }
+
/* Request to list profiles? */
if (get_profile_list_str) {
QmiMessageWdsGetProfileListInput *input;