aboutsummaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-05-04 12:43:10 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 16:08:50 +0200
commita43919271b3789c74cbbefa6123f407c26dd7a90 (patch)
tree5d2664d5e21665940e4ba94f099547cd9468b4fa /cli
parentcab9be9084a4af12d601e09cbe9bb0b3e7f1cc92 (diff)
downloadexternal_libqmi-a43919271b3789c74cbbefa6123f407c26dd7a90.zip
external_libqmi-a43919271b3789c74cbbefa6123f407c26dd7a90.tar.gz
external_libqmi-a43919271b3789c74cbbefa6123f407c26dd7a90.tar.bz2
wds: new types to handle all input and output arguments of Start Network
The new `QmiWdsStartNetworkInput' type handles all possible input arguments passed to the Start Network request. Currently just APN, username and password are used. The new `QmiWdsStartNetworkOutput' type handles all possible output arguments received in a Start Network response. This includes call end reason and verbose call end reason, when applicable.
Diffstat (limited to 'cli')
-rw-r--r--cli/qmicli-wds.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/cli/qmicli-wds.c b/cli/qmicli-wds.c
index f9f443e..7c13e35 100644
--- a/cli/qmicli-wds.c
+++ b/cli/qmicli-wds.c
@@ -174,14 +174,34 @@ start_network_ready (QmiClientWds *client,
GAsyncResult *res)
{
GError *error = NULL;
+ QmiWdsStartNetworkOutput *output;
- ctx->packet_data_handle = qmi_client_wds_start_network_finish (client, res, &error);
- if (!ctx->packet_data_handle) {
- g_printerr ("error: couldn't start network: %s\n",
+ output = qmi_client_wds_start_network_finish (client, res, &error);
+ if (!output) {
+ g_printerr ("error: operation failed: %s\n",
error->message);
exit (EXIT_FAILURE);
}
+ if (!qmi_wds_start_network_output_get_result (output, &error)) {
+ g_printerr ("error: couldn't start network: %s\n", error->message);
+ if (g_error_matches (error,
+ QMI_PROTOCOL_ERROR,
+ QMI_PROTOCOL_ERROR_CALL_FAILED)) {
+ guint16 cer;
+ guint16 domain;
+
+ if (qmi_wds_start_network_output_get_call_end_reason (output, &cer))
+ g_printerr ("call end reason: %u\n", cer);
+ if (qmi_wds_start_network_output_get_verbose_call_end_reason (output, &cer, &domain))
+ g_printerr ("verbose call end reason: %u, %u\n", domain, cer);
+ }
+
+ exit (EXIT_FAILURE);
+ }
+
+ qmi_wds_start_network_output_get_packet_data_handle (output, &ctx->packet_data_handle);
+
#undef VALIDATE_UNKNOWN
#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")
@@ -195,6 +215,8 @@ start_network_ready (QmiClientWds *client,
G_CALLBACK (network_cancelled),
NULL,
NULL);
+
+ qmi_wds_start_network_output_unref (output);
}
static void
@@ -214,6 +236,7 @@ allocate_client_ready (QmiDevice *device,
if (start_network_flag) {
g_debug ("Asynchronously starting network...");
qmi_client_wds_start_network (ctx->client,
+ NULL, /* allow NULL input for now */
10,
ctx->cancellable,
(GAsyncReadyCallback)start_network_ready,