wds: add Go Dormant, Go Active, and Get Dormancy Status

This commit is contained in:
Dan Williams 2016-10-04 07:43:57 -05:00
parent dda73618bd
commit d90fae4dba
3 changed files with 183 additions and 0 deletions

View File

@ -646,6 +646,22 @@
"format" : "guint32",
"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",
@ -1550,6 +1566,21 @@
"public-format" : "QmiWdsExtendedTechnologyPreference",
"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",

View File

@ -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"/>

View File

@ -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;