diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-05-22 14:00:00 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-07-03 16:08:54 +0200 |
commit | 5ee73a0f3e339edbf4feb345e7fd4e175de85441 (patch) | |
tree | c65005e52a55f5e5f771f9991f60293a92d18e49 | |
parent | 39de72d0b29f6561ed4f5b04de5df10c93ccfbdd (diff) | |
download | libqmi-5ee73a0f3e339edbf4feb345e7fd4e175de85441.tar.gz |
core: use new autogenerated code for the WDS service
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | cli/qmicli-wds.c | 237 | ||||
-rw-r--r-- | data/qmi-service-wds.json | 60 | ||||
-rw-r--r-- | src/Makefile.am | 22 | ||||
-rw-r--r-- | src/libqmi-glib.h | 2 | ||||
-rw-r--r-- | src/qmi-client-wds.c | 418 | ||||
-rw-r--r-- | src/qmi-client-wds.h | 116 | ||||
-rw-r--r-- | src/qmi-device.c | 2 | ||||
-rw-r--r-- | src/qmi-message-wds.c | 1415 | ||||
-rw-r--r-- | src/qmi-message-wds.h | 77 | ||||
-rw-r--r-- | src/qmi-wds.h | 209 |
11 files changed, 175 insertions, 2385 deletions
@@ -42,6 +42,8 @@ src/qmi-ctl.h src/qmi-ctl.c src/qmi-dms.h src/qmi-dms.c +src/qmi-wds.h +src/qmi-wds.c src/*.stamp cli/.deps diff --git a/cli/qmicli-wds.c b/cli/qmicli-wds.c index 9683637f..17ef9468 100644 --- a/cli/qmicli-wds.c +++ b/cli/qmicli-wds.c @@ -160,7 +160,7 @@ stop_network_ready (QmiClientWds *client, GAsyncResult *res) { GError *error = NULL; - QmiWdsStopNetworkOutput *output; + QmiMessageWdsStopNetworkOutput *output; output = qmi_client_wds_stop_network_finish (client, res, &error); if (!output) { @@ -171,10 +171,10 @@ stop_network_ready (QmiClientWds *client, return; } - if (!qmi_wds_stop_network_output_get_result (output, &error)) { + if (!qmi_message_wds_stop_network_output_get_result (output, &error)) { g_printerr ("error: couldn't stop network: %s\n", error->message); g_error_free (error); - qmi_wds_stop_network_output_unref (output); + qmi_message_wds_stop_network_output_unref (output); shutdown (FALSE); return; } @@ -184,7 +184,7 @@ stop_network_ready (QmiClientWds *client, g_print ("[%s] Network stopped\n", qmi_device_get_path_display (ctx->device)); - qmi_wds_stop_network_output_unref (output); + qmi_message_wds_stop_network_output_unref (output); shutdown (TRUE); } @@ -192,10 +192,10 @@ static void internal_stop_network (GCancellable *cancellable, guint32 packet_data_handle) { - QmiWdsStopNetworkInput *input; + QmiMessageWdsStopNetworkInput *input; - input = qmi_wds_stop_network_input_new (); - qmi_wds_stop_network_input_set_packet_data_handle (input, packet_data_handle); + input = qmi_message_wds_stop_network_input_new (); + qmi_message_wds_stop_network_input_set_packet_data_handle (input, packet_data_handle, NULL); g_print ("Network cancelled... releasing resources\n"); qmi_client_wds_stop_network (ctx->client, @@ -204,7 +204,7 @@ internal_stop_network (GCancellable *cancellable, ctx->cancellable, (GAsyncReadyCallback)stop_network_ready, NULL); - qmi_wds_stop_network_input_unref (input); + qmi_message_wds_stop_network_input_unref (input); } static void @@ -227,7 +227,8 @@ timeout_get_packet_service_status_ready (QmiClientWds *client, GAsyncResult *res) { GError *error = NULL; - QmiWdsGetPacketServiceStatusOutput *output; + QmiMessageWdsGetPacketServiceStatusOutput *output; + guint8 status; output = qmi_client_wds_get_packet_service_status_finish (client, res, &error); if (!output) { @@ -238,20 +239,24 @@ timeout_get_packet_service_status_ready (QmiClientWds *client, return; } - if (!qmi_wds_get_packet_service_status_output_get_result (output, &error)) { + if (!qmi_message_wds_get_packet_service_status_output_get_result (output, &error)) { g_printerr ("error: couldn't get packet service status: %s\n", error->message); g_error_free (error); - qmi_wds_get_packet_service_status_output_unref (output); + qmi_message_wds_get_packet_service_status_output_unref (output); shutdown (FALSE); return; } - g_print ("[%s] Connection status: '%s'\n", + qmi_message_wds_get_packet_service_status_output_get_connection_status ( + output, + &status, + NULL); + + /* TODO: print string */ + g_print ("[%s] Connection status: '%u'\n", qmi_device_get_path_display (ctx->device), - qmi_wds_connection_status_get_string ( - qmi_wds_get_packet_service_status_output_get_connection_status ( - output))); - qmi_wds_get_packet_service_status_output_unref (output); + (guint) status); + qmi_message_wds_get_packet_service_status_output_unref (output); shutdown (TRUE); } @@ -264,6 +269,7 @@ packet_status_timeout (void) ctx->cancellable, (GAsyncReadyCallback)timeout_get_packet_service_status_ready, NULL); + return TRUE; } @@ -272,7 +278,7 @@ start_network_ready (QmiClientWds *client, GAsyncResult *res) { GError *error = NULL; - QmiWdsStartNetworkOutput *output; + QmiMessageWdsStartNetworkOutput *output; output = qmi_client_wds_start_network_finish (client, res, &error); if (!output) { @@ -283,28 +289,30 @@ start_network_ready (QmiClientWds *client, return; } - if (!qmi_wds_start_network_output_get_result (output, &error)) { + if (!qmi_message_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; + QmiMessageWdsStartNetworkOutputVerboseCallEndReason verbose_cer; - if (qmi_wds_start_network_output_get_call_end_reason (output, &cer)) + if (qmi_message_wds_start_network_output_get_call_end_reason (output, &cer, NULL)) 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); + if (qmi_message_wds_start_network_output_get_verbose_call_end_reason (output, &verbose_cer, NULL)) + g_printerr ("verbose call end reason: %u, %u\n", + verbose_cer.type, + verbose_cer.reason); } g_error_free (error); - qmi_wds_start_network_output_unref (output); + qmi_message_wds_start_network_output_unref (output); shutdown (FALSE); return; } - qmi_wds_start_network_output_get_packet_data_handle (output, &ctx->packet_data_handle); - qmi_wds_start_network_output_unref (output); + qmi_message_wds_start_network_output_get_packet_data_handle (output, &ctx->packet_data_handle, NULL); + qmi_message_wds_start_network_output_unref (output); #undef VALIDATE_UNKNOWN #define VALIDATE_UNKNOWN(str) (str ? str : "unknown") @@ -336,7 +344,8 @@ get_packet_service_status_ready (QmiClientWds *client, GAsyncResult *res) { GError *error = NULL; - QmiWdsGetPacketServiceStatusOutput *output; + QmiMessageWdsGetPacketServiceStatusOutput *output; + guint8 status; output = qmi_client_wds_get_packet_service_status_finish (client, res, &error); if (!output) { @@ -347,21 +356,25 @@ get_packet_service_status_ready (QmiClientWds *client, return; } - if (!qmi_wds_get_packet_service_status_output_get_result (output, &error)) { + if (!qmi_message_wds_get_packet_service_status_output_get_result (output, &error)) { g_printerr ("error: couldn't get packet service status: %s\n", error->message); g_error_free (error); - qmi_wds_get_packet_service_status_output_unref (output); + qmi_message_wds_get_packet_service_status_output_unref (output); shutdown (FALSE); return; } - g_print ("[%s] Connection status: '%s'\n", + qmi_message_wds_get_packet_service_status_output_get_connection_status ( + output, + &status, + NULL); + + /* TODO: print string */ + g_print ("[%s] Connection status: '%u'\n", qmi_device_get_path_display (ctx->device), - qmi_wds_connection_status_get_string ( - qmi_wds_get_packet_service_status_output_get_connection_status ( - output))); + status); - qmi_wds_get_packet_service_status_output_unref (output); + qmi_message_wds_get_packet_service_status_output_unref (output); shutdown (TRUE); } @@ -370,7 +383,8 @@ get_data_bearer_technology_ready (QmiClientWds *client, GAsyncResult *res) { GError *error = NULL; - QmiWdsGetDataBearerTechnologyOutput *output; + QmiMessageWdsGetDataBearerTechnologyOutput *output; + guint8 current; output = qmi_client_wds_get_data_bearer_technology_finish (client, res, &error); if (!output) { @@ -381,31 +395,39 @@ get_data_bearer_technology_ready (QmiClientWds *client, return; } - if (!qmi_wds_get_data_bearer_technology_output_get_result (output, &error)) { + if (!qmi_message_wds_get_data_bearer_technology_output_get_result (output, &error)) { g_printerr ("error: couldn't get data bearer technology: %s\n", error->message); if (g_error_matches (error, QMI_PROTOCOL_ERROR, QMI_PROTOCOL_ERROR_OUT_OF_CALL)) { - g_print ("[%s] Data bearer technology (last): '%s'\n", + guint8 last; + + qmi_message_wds_get_data_bearer_technology_output_get_last ( + output, + &last, + NULL); + /* TODO: print string */ + g_print ("[%s] Data bearer technology (last): '%u'\n", qmi_device_get_path_display (ctx->device), - qmi_wds_data_bearer_technology_get_string ( - qmi_wds_get_data_bearer_technology_output_get_last ( - output))); + last); } g_error_free (error); - qmi_wds_get_data_bearer_technology_output_unref (output); + qmi_message_wds_get_data_bearer_technology_output_unref (output); shutdown (FALSE); return; } - g_print ("[%s] Data bearer technology (current): '%s'\n", + qmi_message_wds_get_data_bearer_technology_output_get_last ( + output, + ¤t, + NULL); + /* TODO: print string */ + g_print ("[%s] Data bearer technology (current): '%u'\n", qmi_device_get_path_display (ctx->device), - qmi_wds_data_bearer_technology_get_string ( - qmi_wds_get_data_bearer_technology_output_get_current ( - output))); - qmi_wds_get_data_bearer_technology_output_unref (output); + current); + qmi_message_wds_get_data_bearer_technology_output_unref (output); shutdown (TRUE); } @@ -414,9 +436,8 @@ get_current_data_bearer_technology_ready (QmiClientWds *client, GAsyncResult *res) { GError *error = NULL; - QmiWdsGetCurrentDataBearerTechnologyOutput *output; - gchar *rat_string = NULL; - gchar *so_string = NULL; + QmiMessageWdsGetCurrentDataBearerTechnologyOutput *output; + QmiMessageWdsGetCurrentDataBearerTechnologyOutputCurrent current;; output = qmi_client_wds_get_current_data_bearer_technology_finish (client, res, &error); if (!output) { @@ -427,114 +448,48 @@ get_current_data_bearer_technology_ready (QmiClientWds *client, return; } - if (!qmi_wds_get_current_data_bearer_technology_output_get_result (output, &error)) { + if (!qmi_message_wds_get_current_data_bearer_technology_output_get_result (output, &error)) { + QmiMessageWdsGetCurrentDataBearerTechnologyOutputLast last; + g_printerr ("error: couldn't get current data bearer technology: %s\n", error->message); - if (g_error_matches (error, - QMI_PROTOCOL_ERROR, - QMI_PROTOCOL_ERROR_OUT_OF_CALL)) { - /* Retrieve LAST */ - - switch (qmi_wds_get_current_data_bearer_technology_output_get_last_network_type (output)) { - case QMI_WDS_NETWORK_TYPE_UNKNOWN: - break; - case QMI_WDS_NETWORK_TYPE_3GPP: - rat_string = (qmi_wds_rat_3gpp_build_string_from_mask ( - qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp ( - output))); - break; - case QMI_WDS_NETWORK_TYPE_3GPP2: - rat_string = (qmi_wds_rat_3gpp2_build_string_from_mask ( - qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp2 ( - output))); - if (qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp2 (output) & - QMI_WDS_RAT_3GPP2_CDMA1X) { - so_string = (qmi_wds_so_cdma1x_build_string_from_mask ( - qmi_wds_get_current_data_bearer_technology_output_get_last_so_cdma1x ( - output))); - } else if (qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp2 (output) & - QMI_WDS_RAT_3GPP2_EVDO_REVA) { - so_string = (qmi_wds_so_evdo_reva_build_string_from_mask ( - qmi_wds_get_current_data_bearer_technology_output_get_last_so_evdo_reva ( - output))); - } - break; - default: - g_warn_if_reached (); - } + if (qmi_message_wds_get_current_data_bearer_technology_output_get_last ( + output, + &last, + NULL)) { g_print ("[%s] Data bearer technology (last):\n" - " Network type: '%s'\n", + " Network type: '%u'\n" + " Radio Access Technology: '%u'\n" + " Service Option: '%u'\n", qmi_device_get_path_display (ctx->device), - qmi_wds_network_type_get_string ( - qmi_wds_get_current_data_bearer_technology_output_get_last_network_type ( - output))); - if (rat_string) { - g_print (" Radio Access Technology: '%s'\n", - rat_string); - g_free (rat_string); - } - if (so_string) { - g_print (" Service Option: '%s'\n", - so_string); - g_free (so_string); - } + last.network_type, + last.rat_mask, + last.so_mask); } g_error_free (error); - qmi_wds_get_current_data_bearer_technology_output_unref (output); + qmi_message_wds_get_current_data_bearer_technology_output_unref (output); shutdown (FALSE); return; } /* Retrieve CURRENT */ - - switch (qmi_wds_get_current_data_bearer_technology_output_get_current_network_type (output)) { - case QMI_WDS_NETWORK_TYPE_UNKNOWN: - break; - case QMI_WDS_NETWORK_TYPE_3GPP: - rat_string = (qmi_wds_rat_3gpp_build_string_from_mask ( - qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp ( - output))); - break; - case QMI_WDS_NETWORK_TYPE_3GPP2: - rat_string = (qmi_wds_rat_3gpp2_build_string_from_mask ( - qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp2 ( - output))); - if (qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp2 (output) & - QMI_WDS_RAT_3GPP2_CDMA1X) { - so_string = (qmi_wds_so_cdma1x_build_string_from_mask ( - qmi_wds_get_current_data_bearer_technology_output_get_current_so_cdma1x ( - output))); - } else if (qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp2 (output) & - QMI_WDS_RAT_3GPP2_EVDO_REVA) { - so_string = (qmi_wds_so_evdo_reva_build_string_from_mask ( - qmi_wds_get_current_data_bearer_technology_output_get_current_so_evdo_reva ( - output))); - } - break; - default: - g_warn_if_reached (); - } - - g_print ("[%s] Data bearer technology (current):\n" - " Network type: '%s'\n", - qmi_device_get_path_display (ctx->device), - qmi_wds_network_type_get_string ( - qmi_wds_get_current_data_bearer_technology_output_get_current_network_type ( - output))); - if (rat_string) { - g_print (" Radio Access Technology: '%s'\n", - rat_string); - g_free (rat_string); - } - if (so_string) { - g_print (" Service Option: '%s'\n", - so_string); - g_free (so_string); + if (qmi_message_wds_get_current_data_bearer_technology_output_get_current ( + output, + ¤t, + NULL)) { + g_print ("[%s] Data bearer technology (current):\n" + " Network type: '%u'\n" + " Radio Access Technology: '%u'\n" + " Service Option: '%u'\n", + qmi_device_get_path_display (ctx->device), + current.network_type, + current.rat_mask, + current.so_mask); } - qmi_wds_get_current_data_bearer_technology_output_unref (output); + qmi_message_wds_get_current_data_bearer_technology_output_unref (output); shutdown (TRUE); } diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json index 3b400f70..1f5bceb6 100644 --- a/data/qmi-service-wds.json +++ b/data/qmi-service-wds.json @@ -87,6 +87,64 @@ "format" : "guint8", "prerequisite": { "field" : "Result.Error Status", "operation" : "==", - "value" : "QMI_STATUS_SUCCESS" } } ] } + "value" : "QMI_STATUS_SUCCESS" } } ] }, + + { "name" : "Get Current Data Bearer Technology", + "type" : "Message", + "service" : "WDS", + "id" : "0x0044", + "output" : [ { "name" : "Result", + "type" : "common-TLV" }, + { "name" : "Current", + "id" : "0x01", + "mandatory" : "yes", + "type" : "TLV", + "format" : "struct", + "contents" : [ { "name" : "Network Type", + "type" : "guint8" }, + { "name" : "RAT Mask", + "type" : "guint32" }, + { "name" : "SO Mask", + "type" : "guint32" } ], + "prerequisite": { "field" : "Result.Error Status", + "operation" : "==", + "value" : "QMI_STATUS_SUCCESS" } }, + { "name" : "Last", + "id" : "0x10", + "mandatory" : "no", + "type" : "TLV", + "format" : "struct", + "contents" : [ { "name" : "Network Type", + "type" : "guint8" }, + { "name" : "RAT Mask", + "type" : "guint32" }, + { "name" : "SO Mask", + "type" : "guint32" } ] } ] }, + + { "name" : "Get Data Bearer Technology", + "type" : "Message", + "service" : "WDS", + "id" : "0x0037", + "output" : [ { "name" : "Result", + "type" : "common-TLV" }, + { "name" : "Current", + "id" : "0x01", + "mandatory" : "yes", + "type" : "TLV", + "format" : "guint8", + "prerequisite": { "field" : "Result.Error Status", + "operation" : "==", + "value" : "QMI_STATUS_SUCCESS" } }, + { "name" : "Last", + "id" : "0x10", + "mandatory" : "yes", + "type" : "TLV", + "format" : "guint8", + "prerequisite": [ { "field" : "Result.Error Status", + "operation" : "!=", + "value" : "QMI_STATUS_SUCCESS" }, + { "field" : "Result.Error Code", + "operation" : "==", + "value" : "QMI_PROTOCOL_ERROR_OUT_OF_CALL" } ] } ] } ] diff --git a/src/Makefile.am b/src/Makefile.am index a6bb841d..92debc8b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,6 +53,14 @@ qmi-dms.stamp: $(top_srcdir)/data/qmi-service-dms.json $(top_srcdir)/build-aux/q --output qmi-dms && \ touch $@ +# WDS service +qmi-wds.stamp: $(top_srcdir)/data/qmi-service-wds.json $(top_srcdir)/build-aux/qmi-codegen/*.py $(top_srcdir)/build-aux/qmi-codegen/qmi-codegen + $(AM_V_GEN) $(top_srcdir)/build-aux/qmi-codegen/qmi-codegen \ + --input $(top_srcdir)/data/qmi-service-wds.json \ + --include $(top_srcdir)/data/qmi-common.json \ + --output qmi-wds && \ + touch $@ + # Additional dependencies qmi-device.c: qmi-error-types.h qmi-enum-types.h qmi-client.c: qmi-error-types.h qmi-enum-types.h @@ -62,6 +70,8 @@ qmi-ctl.h: qmi-ctl.stamp qmi-ctl.c: qmi-error-types.h qmi-enum-types.h qmi-ctl.stamp qmi-dms.h: qmi-dms.stamp qmi-dms.c: qmi-error-types.h qmi-enum-types.h qmi-dms.stamp +qmi-wds.h: qmi-wds.stamp +qmi-wds.c: qmi-error-types.h qmi-enum-types.h qmi-wds.stamp libqmi_glib_la_SOURCES = \ libqmi-glib.h \ @@ -70,13 +80,12 @@ libqmi_glib_la_SOURCES = \ qmi-utils.h qmi-utils.c \ qmi-message.h qmi-message.c \ qmi-device.h qmi-device.c \ - qmi-client.h qmi-client.c \ - qmi-message-wds.h qmi-message-wds.c \ - qmi-wds.h qmi-client-wds.h qmi-client-wds.c + qmi-client.h qmi-client.c nodist_libqmi_glib_la_SOURCES = \ qmi-ctl.c qmi-ctl.h \ - qmi-dms.c qmi-dms.h + qmi-dms.c qmi-dms.h \ + qmi-wds.c qmi-wds.h libqmi_glib_la_LIBADD = \ $(LIBQMI_GLIB_LIBS) @@ -89,8 +98,9 @@ include_HEADERS = \ qmi-device.h \ qmi-client.h \ qmi-dms.h \ - qmi-wds.h qmi-client-wds.h + qmi-wds.h CLEANFILES = \ qmi-ctl.h qmi-ctl.c qmi-ctl.stamp \ - qmi-dms.h qmi-dms.c qmi-dms.stamp + qmi-dms.h qmi-dms.c qmi-dms.stamp \ + qmi-wds.h qmi-wds.c qmi-wds.stamp diff --git a/src/libqmi-glib.h b/src/libqmi-glib.h index 34e2d16f..c6d6a65f 100644 --- a/src/libqmi-glib.h +++ b/src/libqmi-glib.h @@ -30,6 +30,6 @@ #include "qmi-device.h" #include "qmi-client.h" #include "qmi-dms.h" -#include "qmi-client-wds.h" +#include "qmi-wds.h" #endif /* _LIBQMI_GLIB_H_ */ diff --git a/src/qmi-client-wds.c b/src/qmi-client-wds.c deleted file mode 100644 index 98253a9e..00000000 --- a/src/qmi-client-wds.c +++ /dev/null @@ -1,418 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * libqmi-glib -- GLib/GIO based library to control QMI devices - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright (C) 2012 Aleksander Morgado <aleksander@lanedo.com> - */ - -#include <gio/gio.h> - -#include "qmi-device.h" -#include "qmi-client-wds.h" -#include "qmi-message-wds.h" - -G_DEFINE_TYPE (QmiClientWds, qmi_client_wds, QMI_TYPE_CLIENT) - -/*****************************************************************************/ -/* Start network */ - -QmiWdsStartNetworkOutput * -qmi_client_wds_start_network_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error) -{ - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) - return NULL; - - return qmi_wds_start_network_output_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res))); -} - -static void -start_network_ready (QmiDevice *device, - GAsyncResult *res, - GSimpleAsyncResult *simple) -{ - GError *error = NULL; - QmiMessage *reply; - QmiWdsStartNetworkOutput *output; - - reply = qmi_device_command_finish (device, res, &error); - if (!reply) { - g_simple_async_result_take_error (simple, error); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; - } - - /* Parse reply */ - output = qmi_message_wds_start_network_reply_parse (reply, &error); - if (!output) - g_simple_async_result_take_error (simple, error); - else - g_simple_async_result_set_op_res_gpointer (simple, - output, - (GDestroyNotify)qmi_wds_start_network_output_unref); - g_simple_async_result_complete (simple); - g_object_unref (simple); - qmi_message_unref (reply); -} - -void -qmi_client_wds_start_network (QmiClientWds *self, - QmiWdsStartNetworkInput *input, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GSimpleAsyncResult *result; - QmiMessage *request; - GError *error = NULL; - - result = g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - qmi_client_wds_start_network); - - request = qmi_message_wds_start_network_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)), - qmi_client_get_cid (QMI_CLIENT (self)), - input, - &error); - if (!request) { - g_prefix_error (&error, "Couldn't create request message: "); - g_simple_async_result_take_error (result, error); - g_simple_async_result_complete_in_idle (result); - g_object_unref (result); - return; - } - - qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))), - request, - timeout, - cancellable, - (GAsyncReadyCallback)start_network_ready, - result); - qmi_message_unref (request); -} - -/*****************************************************************************/ -/* Stop network */ - -QmiWdsStopNetworkOutput * -qmi_client_wds_stop_network_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error) -{ - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) - return NULL; - - return qmi_wds_stop_network_output_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res))); -} - -static void -stop_network_ready (QmiDevice *device, - GAsyncResult *res, - GSimpleAsyncResult *simple) -{ - GError *error = NULL; - QmiMessage *reply; - QmiWdsStopNetworkOutput *output; - - reply = qmi_device_command_finish (device, res, &error); - if (!reply) { - g_simple_async_result_take_error (simple, error); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; - } - - /* Parse reply */ - output = qmi_message_wds_stop_network_reply_parse (reply, &error); - if (!output) - g_simple_async_result_take_error (simple, error); - else - g_simple_async_result_set_op_res_gpointer (simple, - output, - (GDestroyNotify)qmi_wds_stop_network_output_unref); - g_simple_async_result_complete (simple); - g_object_unref (simple); - qmi_message_unref (reply); -} - -void -qmi_client_wds_stop_network (QmiClientWds *self, - QmiWdsStopNetworkInput *input, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GSimpleAsyncResult *result; - QmiMessage *request; - GError *error = NULL; - - result = g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - qmi_client_wds_stop_network); - - request = qmi_message_wds_stop_network_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)), - qmi_client_get_cid (QMI_CLIENT (self)), - input, - &error); - if (!request) { - g_prefix_error (&error, "Couldn't create request message: "); - g_simple_async_result_take_error (result, error); - g_simple_async_result_complete_in_idle (result); - g_object_unref (result); - return; - } - - qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))), - request, - timeout, - cancellable, - (GAsyncReadyCallback)stop_network_ready, - result); - qmi_message_unref (request); -} - -/*****************************************************************************/ -/* Get packet service status */ - -QmiWdsGetPacketServiceStatusOutput * -qmi_client_wds_get_packet_service_status_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error) -{ - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) - return NULL; - - return qmi_wds_get_packet_service_status_output_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res))); -} - -static void -get_packet_service_status_ready (QmiDevice *device, - GAsyncResult *res, - GSimpleAsyncResult *simple) -{ - GError *error = NULL; - QmiMessage *reply; - QmiWdsGetPacketServiceStatusOutput *output; - - reply = qmi_device_command_finish (device, res, &error); - if (!reply) { - g_simple_async_result_take_error (simple, error); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; - } - - /* Parse reply */ - output = qmi_message_wds_get_packet_service_status_reply_parse (reply, &error); - if (!output) - g_simple_async_result_take_error (simple, error); - else - g_simple_async_result_set_op_res_gpointer (simple, - output, - (GDestroyNotify)qmi_wds_get_packet_service_status_output_unref); - g_simple_async_result_complete (simple); - g_object_unref (simple); - qmi_message_unref (reply); -} - -void -qmi_client_wds_get_packet_service_status (QmiClientWds *self, - gpointer input_unused, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GSimpleAsyncResult *result; - QmiMessage *request; - - result = g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - qmi_client_wds_get_packet_service_status); - - request = qmi_message_wds_get_packet_service_status_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)), - qmi_client_get_cid (QMI_CLIENT (self))); - qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))), - request, - timeout, - cancellable, - (GAsyncReadyCallback)get_packet_service_status_ready, - result); - qmi_message_unref (request); -} - -/*****************************************************************************/ -/* Get data bearer technology */ - -QmiWdsGetDataBearerTechnologyOutput * -qmi_client_wds_get_data_bearer_technology_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error) -{ - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) - return NULL; - - return qmi_wds_get_data_bearer_technology_output_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res))); -} - -static void -get_data_bearer_technology_ready (QmiDevice *device, - GAsyncResult *res, - GSimpleAsyncResult *simple) -{ - GError *error = NULL; - QmiMessage *reply; - QmiWdsGetDataBearerTechnologyOutput *output; - - reply = qmi_device_command_finish (device, res, &error); - if (!reply) { - g_simple_async_result_take_error (simple, error); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; - } - - /* Parse reply */ - output = qmi_message_wds_get_data_bearer_technology_reply_parse (reply, &error); - if (!output) - g_simple_async_result_take_error (simple, error); - else - g_simple_async_result_set_op_res_gpointer (simple, - output, - (GDestroyNotify)qmi_wds_get_data_bearer_technology_output_unref); - g_simple_async_result_complete (simple); - g_object_unref (simple); - qmi_message_unref (reply); -} - -void -qmi_client_wds_get_data_bearer_technology (QmiClientWds *self, - gpointer input_unused, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GSimpleAsyncResult *result; - QmiMessage *request; - - result = g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - qmi_client_wds_get_data_bearer_technology); - - request = qmi_message_wds_get_data_bearer_technology_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)), - qmi_client_get_cid (QMI_CLIENT (self))); - qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))), - request, - timeout, - cancellable, - (GAsyncReadyCallback)get_data_bearer_technology_ready, - result); - qmi_message_unref (request); -} - -/*****************************************************************************/ -/* Get current data bearer technology */ - -QmiWdsGetCurrentDataBearerTechnologyOutput * -qmi_client_wds_get_current_data_bearer_technology_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error) -{ - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) - return NULL; - - return qmi_wds_get_current_data_bearer_technology_output_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res))); -} - -static void -get_current_data_bearer_technology_ready (QmiDevice *device, - GAsyncResult *res, - GSimpleAsyncResult *simple) -{ - GError *error = NULL; - QmiMessage *reply; - QmiWdsGetCurrentDataBearerTechnologyOutput *output; - - reply = qmi_device_command_finish (device, res, &error); - if (!reply) { - g_simple_async_result_take_error (simple, error); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; - } - - /* Parse reply */ - output = qmi_message_wds_get_current_data_bearer_technology_reply_parse (reply, &error); - if (!output) - g_simple_async_result_take_error (simple, error); - else - g_simple_async_result_set_op_res_gpointer (simple, - output, - (GDestroyNotify)qmi_wds_get_current_data_bearer_technology_output_unref); - g_simple_async_result_complete (simple); - g_object_unref (simple); - qmi_message_unref (reply); -} - -void -qmi_client_wds_get_current_data_bearer_technology (QmiClientWds *self, - gpointer input_unused, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GSimpleAsyncResult *result; - QmiMessage *request; - - result = g_simple_async_result_new (G_OBJECT (self), - callback, - user_data, - qmi_client_wds_get_current_data_bearer_technology); - - request = qmi_message_wds_get_current_data_bearer_technology_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)), - qmi_client_get_cid (QMI_CLIENT (self))); - qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))), - request, - timeout, - cancellable, - (GAsyncReadyCallback)get_current_data_bearer_technology_ready, - result); - qmi_message_unref (request); -} - -/*****************************************************************************/ - -static void -qmi_client_wds_init (QmiClientWds *self) -{ -} - -static void -qmi_client_wds_class_init (QmiClientWdsClass *klass) -{ -} diff --git a/src/qmi-client-wds.h b/src/qmi-client-wds.h deleted file mode 100644 index 2589bc70..00000000 --- a/src/qmi-client-wds.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * libqmi-glib -- GLib/GIO based library to control QMI devices - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright (C) 2012 Aleksander Morgado <aleksander@lanedo.com> - */ - -#ifndef _LIBQMI_GLIB_QMI_CLIENT_WDS_H_ -#define _LIBQMI_GLIB_QMI_CLIENT_WDS_H_ - -#include <glib-object.h> - -#include "qmi-client.h" -#include "qmi-wds.h" - -G_BEGIN_DECLS - -#define QMI_TYPE_CLIENT_WDS (qmi_client_wds_get_type ()) -#define QMI_CLIENT_WDS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QMI_TYPE_CLIENT_WDS, QmiClientWds)) -#define QMI_CLIENT_WDS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QMI_TYPE_CLIENT_WDS, QmiClientWdsClass)) -#define QMI_IS_CLIENT_WDS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QMI_TYPE_CLIENT_WDS)) -#define QMI_IS_CLIENT_WDS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QMI_TYPE_CLIENT_WDS)) -#define QMI_CLIENT_WDS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), QMI_TYPE_CLIENT_WDS, QmiClientWdsClass)) - -typedef struct _QmiClientWds QmiClientWds; -typedef struct _QmiClientWdsClass QmiClientWdsClass; - -struct _QmiClientWds { - QmiClient parent; - gpointer priv_unused; -}; - -struct _QmiClientWdsClass { - QmiClientClass parent; -}; - -GType qmi_client_wds_get_type (void); - -/*****************************************************************************/ -/* Start network */ -void qmi_client_wds_start_network (QmiClientWds *self, - QmiWdsStartNetworkInput *input, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -QmiWdsStartNetworkOutput *qmi_client_wds_start_network_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error); - -/*****************************************************************************/ -/* Stop network */ -void qmi_client_wds_stop_network (QmiClientWds *self, - QmiWdsStopNetworkInput *input, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -QmiWdsStopNetworkOutput *qmi_client_wds_stop_network_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error); - -/*****************************************************************************/ -/* Get packet service status */ -void qmi_client_wds_get_packet_service_status (QmiClientWds *self, - gpointer input_unused, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -QmiWdsGetPacketServiceStatusOutput *qmi_client_wds_get_packet_service_status_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error); - -/*****************************************************************************/ -/* Get data bearer technology */ -void qmi_client_wds_get_data_bearer_technology (QmiClientWds *self, - gpointer input_unused, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -QmiWdsGetDataBearerTechnologyOutput *qmi_client_wds_get_data_bearer_technology_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error); - -/*****************************************************************************/ -/* Get current data bearer technology */ -void qmi_client_wds_get_current_data_bearer_technology (QmiClientWds *self, - gpointer input_unused, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -QmiWdsGetCurrentDataBearerTechnologyOutput *qmi_client_wds_get_current_data_bearer_technology_finish (QmiClientWds *self, - GAsyncResult *res, - GError **error); - -G_END_DECLS - -#endif /* _LIBQMI_GLIB_QMI_CLIENT_WDS_H_ */ diff --git a/src/qmi-device.c b/src/qmi-device.c index e6b66207..113c0874 100644 --- a/src/qmi-device.c +++ b/src/qmi-device.c @@ -31,7 +31,7 @@ #include "qmi-message.h" #include "qmi-ctl.h" #include "qmi-dms.h" -#include "qmi-client-wds.h" +#include "qmi-wds.h" #include "qmi-utils.h" #include "qmi-error-types.h" #include "qmi-enum-types.h" diff --git a/src/qmi-message-wds.c b/src/qmi-message-wds.c deleted file mode 100644 index 7dcd6e1e..00000000 --- a/src/qmi-message-wds.c +++ /dev/null @@ -1,1415 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * libqmi-glib -- GLib/GIO based library to control QMI devices - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright (C) 2012 Aleksander Morgado <aleksander@lanedo.com> - */ - -#include <string.h> - -#include "qmi-message-wds.h" -#include "qmi-enums.h" -#include "qmi-error-types.h" - -/*****************************************************************************/ -/* Start network */ - -enum { - QMI_WDS_TLV_START_NETWORK_APN = 0x14, - QMI_WDS_TLV_START_NETWORK_USERNAME = 0x17, - QMI_WDS_TLV_START_NETWORK_PASSWORD = 0x18 -}; - -/** - * QmiWdsStartNetworkInput: - * - * An opaque type handling the input arguments that may be passed to the Start - * Network operation in the WDS service. - */ -struct _QmiWdsStartNetworkInput { - volatile gint ref_count; - gchar *apn; - gchar *username; - gchar *password; -}; - -/** - * qmi_wds_start_network_input_set_apn: - * @input: a #QmiWdsStartNetworkInput. - * @str: a string with the APN. - * - * Set the APN to use. - */ -void -qmi_wds_start_network_input_set_apn (QmiWdsStartNetworkInput *input, - const gchar *str) -{ - g_return_if_fail (input != NULL); - - g_free (input->apn); - input->apn = (str ? g_strdup (str) : NULL); -} - -/** - * qmi_wds_start_network_input_get_apn: - * @input: a #QmiWdsStartNetworkInput. - * - * Get the configured APN to use. - * - * Returns: a constant string with the APN, or #NULL if none set. - */ -const gchar * -qmi_wds_start_network_input_get_apn (QmiWdsStartNetworkInput *input) -{ - g_return_val_if_fail (input != NULL, NULL); - - return input->apn; -} - -/** - * qmi_wds_start_network_input_set_username: - * @input: a #QmiWdsStartNetworkInput. - * @str: a string with the username. - * - * Set the username to use when authenticating with the network. - */ -void -qmi_wds_start_network_input_set_username (QmiWdsStartNetworkInput *input, - const gchar *str) -{ - g_return_if_fail (input != NULL); - - g_free (input->username); - input->username = (str ? g_strdup (str) : NULL); -} - -/** - * qmi_wds_start_network_input_get_username: - * @input: a #QmiWdsStartNetworkInput. - * - * Get the configured username to use when authenticating with the network. - * - * Returns: a constant string with the username, or #NULL if none set. - */ -const gchar * -qmi_wds_start_network_input_get_username (QmiWdsStartNetworkInput *input) -{ - g_return_val_if_fail (input != NULL, NULL); - - return input->username; -} - -/** - * qmi_wds_start_network_input_set_password: - * @input: a #QmiWdsStartNetworkInput. - * @str: a string with the password. - * - * Set the password to use when authenticating with the network. - */ -void -qmi_wds_start_network_input_set_password (QmiWdsStartNetworkInput *input, - const gchar *str) -{ - g_return_if_fail (input != NULL); - - g_free (input->password); - input->password = (str ? g_strdup (str) : NULL); -} - -/** - * qmi_wds_start_network_input_get_password: - * @input: a #QmiWdsStartNetworkInput. - * - * Get the configured password to use when authenticating with the network. - * - * Returns: a constant string with the password, or #NULL if none set. - */ -const gchar * -qmi_wds_start_network_input_get_password (QmiWdsStartNetworkInput *input) -{ - g_return_val_if_fail (input != NULL, NULL); - - return input->password; -} - -/** - * qmi_wds_start_network_input_new: - * - * Allocates a new #QmiWdsStartNetworkInput. - * - * Returns: the newly created #QmiWdsStartNetworkInput. - */ -QmiWdsStartNetworkInput * -qmi_wds_start_network_input_new (void) -{ - QmiWdsStartNetworkInput *input; - - input = g_slice_new0 (QmiWdsStartNetworkInput); - input->ref_count = 1; - return input; -} - -/** - * qmi_wds_start_network_input_ref: - * @input: a #QmiWdsStartNetworkInput. - * - * Atomically increments the reference count of @input by one. - * - * Returns: the new reference to @input. - */ -QmiWdsStartNetworkInput * -qmi_wds_start_network_input_ref (QmiWdsStartNetworkInput *input) -{ - g_return_val_if_fail (input != NULL, NULL); - - g_atomic_int_inc (&input->ref_count); - return input; -} - -/** - * qmi_wds_start_network_input_unref: - * @input: a #QmiWdsStartNetworkInput. - * - * Atomically decrements the reference count of @input by one. - * If the reference count drops to 0, @input is completely disposed. - */ -void -qmi_wds_start_network_input_unref (QmiWdsStartNetworkInput *input) -{ - g_return_if_fail (input != NULL); - - if (g_atomic_int_dec_and_test (&input->ref_count)) { - g_free (input->apn); - g_free (input->username); - g_free (input->password); - g_slice_free (QmiWdsStartNetworkInput, input); - } -} - -QmiMessage * -qmi_message_wds_start_network_new (guint8 transaction_id, - guint8 client_id, - QmiWdsStartNetworkInput *input, - GError **error) -{ - QmiMessage *message; - - message = qmi_message_new (QMI_SERVICE_WDS, - client_id, - transaction_id, - QMI_WDS_MESSAGE_START_NETWORK); - - /* If input arguments given, use them */ - if (input) { - /* Add APN if any */ - if (input->apn && - !qmi_message_tlv_add (message, - QMI_WDS_TLV_START_NETWORK_APN, - strlen (input->apn) + 1, - input->apn, - error)) { - g_prefix_error (error, "Failed to add APN to message: "); - qmi_message_unref (message); - return NULL; - } - - /* Add username if any */ - if (input->username && - !qmi_message_tlv_add (message, - QMI_WDS_TLV_START_NETWORK_USERNAME, - strlen (input->username) + 1, - input->username, - error)) { - g_prefix_error (error, "Failed to add username to message: "); - qmi_message_unref (message); - return NULL; - } - - /* Add password if any */ - if (input->password && - !qmi_message_tlv_add (message, - QMI_WDS_TLV_START_NETWORK_PASSWORD, - strlen (input->password) + 1, - input->password, - error)) { - g_prefix_error (error, "Failed to add password to message: "); - qmi_message_unref (message); - return NULL; - } - } - - return message; -} - -enum { - START_NETWORK_OUTPUT_TLV_PACKET_DATA_HANDLE = 0x01, - START_NETWORK_OUTPUT_TLV_CALL_END_REASON = 0x10, - START_NETWORK_OUTPUT_TLV_VERBOSE_CALL_END_REASON = 0x11 -}; - -/** - * QmiWdsStartNetworkOutput: - * - * An opaque type handling the output of the Start Network operation. - */ -struct _QmiWdsStartNetworkOutput { - volatile gint ref_count; - GError *error; - - gboolean packet_data_handle_set; - guint32 packet_data_handle; - - gboolean call_end_reason_set; - guint16 call_end_reason; - - gboolean verbose_call_end_reason_set; - guint16 verbose_call_end_reason_domain; - guint16 verbose_call_end_reason_value; -}; - -/** - * qmi_wds_start_network_output_get_result: - * @output: a #QmiWdsStartNetworkOutput. - * @error: a #GError. - * - * Get the result of the Start Network operation. - * - * Returns: #TRUE if the operation succeeded, and #FALSE if @error is set. - */ -gboolean -qmi_wds_start_network_output_get_result (QmiWdsStartNetworkOutput *output, - GError **error) -{ - g_return_val_if_fail (output != NULL, FALSE); - - if (output->error) { - if (error) - *error = g_error_copy (output->error); - - return FALSE; - } - - return TRUE; -} - -/** - * qmi_wds_start_network_output_get_packet_data_handle: - * @output: a #QmiWdsStartNetworkOutput. - * @packet_data_handle: location for the output packet data handle. - * - * Get the packet data handle on a successful Start Network operation. - * - * Returns: #TRUE if @packet_data_handle is set, #FALSE otherwise. - */ -gboolean -qmi_wds_start_network_output_get_packet_data_handle (QmiWdsStartNetworkOutput *output, - guint32 *packet_data_handle) -{ - g_return_val_if_fail (output != NULL, FALSE); - - if (output->packet_data_handle_set) - *packet_data_handle = output->packet_data_handle; - return output->packet_data_handle_set; -} - -/** - * qmi_wds_start_network_output_get_call_end_reason: - * @output: a #QmiWdsStartNetworkOutput. - * @call_end_reason: location for the output call end reason. - * - * Get the call end reason, if the operation failed with a CALL_FAILED error. - * This field is optional. - * - * Returns: #TRUE if @call_end_reason is set, #FALSE otherwise. - */ -gboolean -qmi_wds_start_network_output_get_call_end_reason (QmiWdsStartNetworkOutput *output, - guint16 *call_end_reason) -{ - g_return_val_if_fail (output != NULL, FALSE); - - if (output->call_end_reason_set) - *call_end_reason = output->call_end_reason; - return output->call_end_reason_set; -} - -/** - * qmi_wds_start_network_output_get_call_end_reason: - * @output: a #QmiWdsStartNetworkOutput. - * @verbose_call_end_reason_domain: location for the output call end reason domain. - * @verbose_call_end_reason_value: location for the output call end reason value. - * - * Get the verbose call end reason, if the operation failed with a CALL_FAILED error. - * This field is optional. - * - * Returns: #TRUE if @call_end_reason is set, #FALSE otherwise. - */ -gboolean -qmi_wds_start_network_output_get_verbose_call_end_reason (QmiWdsStartNetworkOutput *output, - guint16 *verbose_call_end_reason_domain, - guint16 *verbose_call_end_reason_value) -{ - g_return_val_if_fail (output != NULL, FALSE); - - if (output->verbose_call_end_reason_set) { - *verbose_call_end_reason_domain = output->verbose_call_end_reason_domain; - *verbose_call_end_reason_value = output->verbose_call_end_reason_value; - } - return output->verbose_call_end_reason_set; -} - -/** - * qmi_wds_start_network_output_ref: - * @output: a #QmiWdsStartNetworkOutput. - * - * Atomically increments the reference count of @output by one. - * - * Returns: the new reference to @output. - */ -QmiWdsStartNetworkOutput * -qmi_wds_start_network_output_ref (QmiWdsStartNetworkOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - g_atomic_int_inc (&output->ref_count); - return output; -} - -/** - * qmi_wds_start_network_output_unref: - * @output: a #QmiWdsStartNetworkOutput. - * - * Atomically decrements the reference count of @output by one. - * If the reference count drops to 0, @output is completely disposed. - */ -void -qmi_wds_start_network_output_unref (QmiWdsStartNetworkOutput *output) -{ - g_return_if_fail (output != NULL); - - if (g_atomic_int_dec_and_test (&output->ref_count)) { - if (output->error) - g_error_free (output->error); - g_slice_free (QmiWdsStartNetworkOutput, output); - } -} - -QmiWdsStartNetworkOutput * -qmi_message_wds_start_network_reply_parse (QmiMessage *self, - GError **error) -{ - QmiWdsStartNetworkOutput *output; - GError *inner_error = NULL; - guint32 packet_data_handle_le; - - g_assert (qmi_message_get_message_id (self) == QMI_WDS_MESSAGE_START_NETWORK); - - if (!qmi_message_get_response_result (self, &inner_error)) { - /* Only QMI protocol errors are set in the Output result, all the - * others (e.g. failures parsing) are directly propagated to error. */ - if (inner_error->domain != QMI_PROTOCOL_ERROR) { - g_propagate_error (error, inner_error); - return NULL; - } - - /* Otherwise, build output */ - } - - output = g_slice_new0 (QmiWdsStartNetworkOutput); - output->ref_count = 1; - output->error = inner_error; - - /* On CALL_FAILED errors, we can try to get more info on the reason */ - if (output->error) { - if (g_error_matches (output->error, - QMI_PROTOCOL_ERROR, - QMI_PROTOCOL_ERROR_CALL_FAILED)) { - guint16 cer = 0; - struct verbose_call_end_reason { - guint16 call_end_reason_domain; - guint16 call_end_reason_value; - } __attribute__((__packed__)) verbose_cer = { 0, 0 }; - - /* TODO: Prepare an enum with all the possible call end reasons, - * in order to do this nicely */ - - if (qmi_message_tlv_get (self, - START_NETWORK_OUTPUT_TLV_VERBOSE_CALL_END_REASON, - sizeof (verbose_cer), - &verbose_cer, - NULL)) { - output->verbose_call_end_reason_set = TRUE; - output->verbose_call_end_reason_domain = verbose_cer.call_end_reason_domain; - output->verbose_call_end_reason_value = verbose_cer.call_end_reason_value; - } - - if (qmi_message_tlv_get (self, - START_NETWORK_OUTPUT_TLV_CALL_END_REASON, - sizeof (cer), - &cer, - NULL)) { - output->call_end_reason_set = TRUE; - output->call_end_reason = cer; - } - } - - return output; - } - - /* success */ - - packet_data_handle_le = 0; - if (!qmi_message_tlv_get (self, - START_NETWORK_OUTPUT_TLV_PACKET_DATA_HANDLE, - sizeof (packet_data_handle_le), - &packet_data_handle_le, - error)) { - g_prefix_error (error, "Couldn't get the packet data handle TLV: "); - qmi_wds_start_network_output_unref (output); - return NULL; - } else { - output->packet_data_handle = GUINT32_FROM_LE (packet_data_handle_le); - output->packet_data_handle_set = TRUE; - } - - return output; -} - -/*****************************************************************************/ -/* Stop network */ - -enum { - STOP_NETWORK_INPUT_TLV_PACKET_DATA_HANDLE = 0x01 -}; - -/** - * QmiWdsStopNetworkInput: - * - * An opaque type handling the input arguments that may be passed to the Stop - * Network operation in the WDS service. - */ -struct _QmiWdsStopNetworkInput { - volatile gint ref_count; - - gboolean packet_data_handle_set; - guint32 packet_data_handle; -}; - -/** - * qmi_wds_stop_network_input_set_packet_data_handle: - * @input: a #QmiWdsStopNetworkInput. - * @packet_data_handle: the packet data handle. - * - * Set the packet data handle of the connection. - */ -void -qmi_wds_stop_network_input_set_packet_data_handle (QmiWdsStopNetworkInput *input, - guint32 packet_data_handle) -{ - g_return_if_fail (input != NULL); - - input->packet_data_handle_set = TRUE; - input->packet_data_handle = packet_data_handle; -} - -/** - * qmi_wds_stop_network_input_get_packet_data_handle: - * @input: a #QmiWdsStopNetworkInput. - * @packet_data_handle: output location for the packet data handle. - * - * Get the packet data handle of the connection. - * - * Returns: #TRUE if @packet_data_handle is set, #FALSE otherwise. - */ -gboolean -qmi_wds_stop_network_input_get_packet_data_handle (QmiWdsStopNetworkInput *input, - guint32 *packet_data_handle) -{ - g_return_val_if_fail (input != NULL, FALSE); - - if (input->packet_data_handle_set) - *packet_data_handle = input->packet_data_handle; - return input->packet_data_handle_set; -} - -/** - * qmi_wds_stop_network_input_new: - * - * Allocates a new #QmiWdsStopNetworkInput. - * - * Returns: the newly created #QmiWdsStopNetworkInput. - */ -QmiWdsStopNetworkInput * -qmi_wds_stop_network_input_new (void) -{ - QmiWdsStopNetworkInput *input; - - input = g_slice_new0 (QmiWdsStopNetworkInput); - input->ref_count = 1; - return input; -} - -/** - * qmi_wds_stop_network_input_ref: - * @input: a #QmiWdsStopNetworkInput. - * - * Atomically increments the reference count of @input by one. - * - * Returns: the new reference to @input. - */ -QmiWdsStopNetworkInput * -qmi_wds_stop_network_input_ref (QmiWdsStopNetworkInput *input) -{ - g_return_val_if_fail (input != NULL, NULL); - - g_atomic_int_inc (&input->ref_count); - return input; -} - -/** - * qmi_wds_stop_network_input_unref: - * @input: a #QmiWdsStopNetworkInput. - * - * Atomically decrements the reference count of @input by one. - * If the reference count drops to 0, @input is completely disposed. - */ -void -qmi_wds_stop_network_input_unref (QmiWdsStopNetworkInput *input) -{ - g_return_if_fail (input != NULL); - - if (g_atomic_int_dec_and_test (&input->ref_count)) { - g_slice_free (QmiWdsStopNetworkInput, input); - } -} - -QmiMessage * -qmi_message_wds_stop_network_new (guint8 transaction_id, - guint8 client_id, - QmiWdsStopNetworkInput *input, - GError **error) -{ - QmiMessage *message; - guint32 handle; - - /* Check mandatory input arguments */ - if (!input || - !input->packet_data_handle_set) { - g_set_error (error, - QMI_CORE_ERROR, - QMI_CORE_ERROR_INVALID_ARGS, - "Missing mandatory argument 'packet data handle'"); - return NULL; - } - - if (!input->packet_data_handle) { - g_set_error (error, - QMI_CORE_ERROR, - QMI_CORE_ERROR_INVALID_ARGS, - "Invalid 'packet data handle': %u", - (guint)input->packet_data_handle); - return NULL; - } - - /* We want `handle' in LE; FROM_LE() can also be used as TO_LE() */ - handle = GUINT32_FROM_LE (input->packet_data_handle); - - message = qmi_message_new (QMI_SERVICE_WDS, - client_id, - transaction_id, - QMI_WDS_MESSAGE_STOP_NETWORK); - - if (!qmi_message_tlv_add (message, - STOP_NETWORK_INPUT_TLV_PACKET_DATA_HANDLE, - sizeof (handle), - &handle, - error)) { - g_prefix_error (error, "Failed to add packet data handle to message: "); - qmi_message_unref (message); - return NULL; - } - - return message; -} - -/** - * QmiWdsStopNetworkOutput: - * - * An opaque type handling the output of the Stop Network operation. - */ -struct _QmiWdsStopNetworkOutput { - volatile gint ref_count; - GError *error; -}; - -/** - * qmi_wds_stop_network_output_get_result: - * @output: a #QmiWdsStopNetworkOutput. - * @error: a #GError. - * - * Get the result of the Stop Network operation. - * - * Returns: #TRUE if the operation succeeded, and #FALSE if @error is set. - */ -gboolean -qmi_wds_stop_network_output_get_result (QmiWdsStopNetworkOutput *output, - GError **error) -{ - g_return_val_if_fail (output != NULL, FALSE); - - if (output->error) { - if (error) - *error = g_error_copy (output->error); - - return FALSE; - } - - return TRUE; -} - -/** - * qmi_wds_stop_network_output_ref: - * @output: a #QmiWdsStopNetworkOutput. - * - * Atomically increments the reference count of @output by one. - * - * Returns: the new reference to @output. - */ -QmiWdsStopNetworkOutput * -qmi_wds_stop_network_output_ref (QmiWdsStopNetworkOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - g_atomic_int_inc (&output->ref_count); - return output; -} - -/** - * qmi_wds_stop_network_output_unref: - * @output: a #QmiWdsStopNetworkOutput. - * - * Atomically decrements the reference count of @output by one. - * If the reference count drops to 0, @output is completely disposed. - */ -void -qmi_wds_stop_network_output_unref (QmiWdsStopNetworkOutput *output) -{ - g_return_if_fail (output != NULL); - - if (g_atomic_int_dec_and_test (&output->ref_count)) { - if (output->error) - g_error_free (output->error); - g_slice_free (QmiWdsStopNetworkOutput, output); - } -} - -QmiWdsStopNetworkOutput * -qmi_message_wds_stop_network_reply_parse (QmiMessage *self, - GError **error) -{ - QmiWdsStopNetworkOutput *output; - GError *inner_error = NULL; - - g_assert (qmi_message_get_message_id (self) == QMI_WDS_MESSAGE_STOP_NETWORK); - - if (!qmi_message_get_response_result (self, &inner_error)) { - /* Only QMI protocol errors are set in the Output result, all the - * others (e.g. failures parsing) are directly propagated to error. */ - if (inner_error->domain != QMI_PROTOCOL_ERROR) { - g_propagate_error (error, inner_error); - return NULL; - } - - /* Otherwise, build output */ - } - - output = g_slice_new0 (QmiWdsStopNetworkOutput); - output->ref_count = 1; - output->error = inner_error; - - return output; -} - -/*****************************************************************************/ -/* Get packet service status */ - -QmiMessage * -qmi_message_wds_get_packet_service_status_new (guint8 transaction_id, - guint8 client_id) -{ - return qmi_message_new (QMI_SERVICE_WDS, - client_id, - transaction_id, - QMI_WDS_MESSAGE_GET_PACKET_SERVICE_STATUS); -} - -enum { - GET_PACKET_SERVICE_STATUS_OUTPUT_TLV_CONNECTION_STATUS = 0x01 -}; - -/** - * QmiWdsGetPacketServiceStatusOutput: - * - * An opaque type handling the output of the Stop Network operation. - */ -struct _QmiWdsGetPacketServiceStatusOutput { - volatile gint ref_count; - GError *error; - guint8 connection_status; -}; - -/** - * qmi_wds_get_packet_service_status_output_get_result: - * @output: a #QmiWdsGetPacketServiceStatusOutput. - * @error: a #GError. - * - * Get the result of the Get Packet Status operation. - * - * Returns: #TRUE if the operation succeeded, and #FALSE if @error is set. - */ -gboolean -qmi_wds_get_packet_service_status_output_get_result (QmiWdsGetPacketServiceStatusOutput *output, - GError **error) -{ - g_return_val_if_fail (output != NULL, FALSE); - - if (output->error) { - if (error) - *error = g_error_copy (output->error); - - return FALSE; - } - - return TRUE; -} - -/** - * qmi_wds_start_network_output_get_connection_status: - * @output: a #QmiWdsGetPacketServiceStatusOutput. - * - * Get the connection status. - * - * Returns: a #QmiWdsConnectionStatus. - */ -QmiWdsConnectionStatus -qmi_wds_get_packet_service_status_output_get_connection_status (QmiWdsGetPacketServiceStatusOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_CONNECTION_STATUS_UNKNOWN); - - return (QmiWdsConnectionStatus)output->connection_status; -} - -/** - * qmi_wds_get_packet_service_status_output_ref: - * @output: a #QmiWdsGetPacketServiceStatusOutput. - * - * Atomically increments the reference count of @output by one. - * - * Returns: the new reference to @output. - */ -QmiWdsGetPacketServiceStatusOutput * -qmi_wds_get_packet_service_status_output_ref (QmiWdsGetPacketServiceStatusOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - g_atomic_int_inc (&output->ref_count); - return output; -} - -/** - * qmi_wds_get_packet_service_status_output_unref: - * @output: a #QmiWdsGetPacketServiceStatusOutput. - * - * Atomically decrements the reference count of @output by one. - * If the reference count drops to 0, @output is completely disposed. - */ -void -qmi_wds_get_packet_service_status_output_unref (QmiWdsGetPacketServiceStatusOutput *output) -{ - g_return_if_fail (output != NULL); - - if (g_atomic_int_dec_and_test (&output->ref_count)) { - if (output->error) - g_error_free (output->error); - g_slice_free (QmiWdsGetPacketServiceStatusOutput, output); - } -} - -QmiWdsGetPacketServiceStatusOutput * -qmi_message_wds_get_packet_service_status_reply_parse (QmiMessage *self, - GError **error) -{ - QmiWdsGetPacketServiceStatusOutput *output; - GError *inner_error = NULL; - - g_assert (qmi_message_get_message_id (self) == QMI_WDS_MESSAGE_GET_PACKET_SERVICE_STATUS); - - if (!qmi_message_get_response_result (self, &inner_error)) { - /* Only QMI protocol errors are set in the Output result, all the - * others (e.g. failures parsing) are directly propagated to error. */ - if (inner_error->domain != QMI_PROTOCOL_ERROR) { - g_propagate_error (error, inner_error); - return NULL; - } - - /* Otherwise, build output */ - } - - /* success */ - - output = g_slice_new0 (QmiWdsGetPacketServiceStatusOutput); - output->ref_count = 1; - output->error = inner_error; - - /* If we got a QMI protocol error, no need to look for any TLV */ - if (output->error) - return output; - - if (!qmi_message_tlv_get (self, - GET_PACKET_SERVICE_STATUS_OUTPUT_TLV_CONNECTION_STATUS, - sizeof (output->connection_status), - &output->connection_status, - error)) { - g_prefix_error (error, "Couldn't get the connection status TLV: "); - qmi_wds_get_packet_service_status_output_unref (output); - return NULL; - } - - return output; -} - -/*****************************************************************************/ -/* Get data bearer technology */ - -QmiMessage * -qmi_message_wds_get_data_bearer_technology_new (guint8 transaction_id, - guint8 client_id) -{ - return qmi_message_new (QMI_SERVICE_WDS, - client_id, - transaction_id, - QMI_WDS_MESSAGE_GET_DATA_BEARER_TECHNOLOGY); -} - -enum { - GET_DATA_BEARER_TECHNOLOGY_OUTPUT_TLV_CURRENT = 0x01, - GET_DATA_BEARER_TECHNOLOGY_OUTPUT_TLV_LAST = 0x10 -}; - -/** - * QmiWdsGetDataBearerTechnologyOutput: - * - * An opaque type handling the output of the Stop Network operation. - */ -struct _QmiWdsGetDataBearerTechnologyOutput { - volatile gint ref_count; - GError *error; - gint8 current; - gint8 last; -}; - -/** - * qmi_wds_get_data_bearer_technology_output_get_result: - * @output: a #QmiWdsGetDataBearerTechnologyOutput. - * @error: a #GError. - * - * Get the result of the Get Data Bearer Technology operation. - * - * Returns: #TRUE if the operation succeeded, and #FALSE if @error is set. - */ -gboolean -qmi_wds_get_data_bearer_technology_output_get_result (QmiWdsGetDataBearerTechnologyOutput *output, - GError **error) -{ - g_return_val_if_fail (output != NULL, FALSE); - - if (output->error) { - if (error) - *error = g_error_copy (output->error); - - return FALSE; - } - - return TRUE; -} - -/** - * qmi_wds_get_data_bearer_technology_output_get_current: - * @output: a #QmiWdsGetDataBearerTechnologyOutput. - * - * Get the current data bearer technology. - * - * Returns: a #QmiWdsDataBearerTechnology. - */ -QmiWdsDataBearerTechnology -qmi_wds_get_data_bearer_technology_output_get_current (QmiWdsGetDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_DATA_BEARER_TECHNOLOGY_UNKNOWN); - - return (QmiWdsDataBearerTechnology)output->current; -} - -/** - * qmi_wds_get_data_bearer_technology_output_output_get_last: - * @output: a #QmiWdsGetDataBearerTechnologyOutput. - * - * Get the data bearer technology of the last connection. - * This field is optional, and it may appear only when the operation failed with #QMI_PROTOCOL_ERROR_OUT_OF_CALL. - * - * Returns: a #QmiWdsDataBearerTechnology. - */ -QmiWdsDataBearerTechnology -qmi_wds_get_data_bearer_technology_output_get_last (QmiWdsGetDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_DATA_BEARER_TECHNOLOGY_UNKNOWN); - - return (QmiWdsDataBearerTechnology)output->last; -} - -/** - * qmi_wds_get_data_bearer_technology_output_ref: - * @output: a #QmiWdsGetDataBearerTechnologyOutput. - * - * Atomically increments the reference count of @output by one. - * - * Returns: the new reference to @output. - */ -QmiWdsGetDataBearerTechnologyOutput * -qmi_wds_get_data_bearer_technology_output_ref (QmiWdsGetDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - g_atomic_int_inc (&output->ref_count); - return output; -} - -/** - * qmi_wds_get_data_bearer_technology_output_unref: - * @output: a #QmiWdsGetDataBearerTechnologyOutput. - * - * Atomically decrements the reference count of @output by one. - * If the reference count drops to 0, @output is completely disposed. - */ -void -qmi_wds_get_data_bearer_technology_output_unref (QmiWdsGetDataBearerTechnologyOutput *output) -{ - g_return_if_fail (output != NULL); - - if (g_atomic_int_dec_and_test (&output->ref_count)) { - if (output->error) - g_error_free (output->error); - g_slice_free (QmiWdsGetDataBearerTechnologyOutput, output); - } -} - -QmiWdsGetDataBearerTechnologyOutput * -qmi_message_wds_get_data_bearer_technology_reply_parse (QmiMessage *self, - GError **error) -{ - QmiWdsGetDataBearerTechnologyOutput *output; - GError *inner_error = NULL; - - g_assert (qmi_message_get_message_id (self) == QMI_WDS_MESSAGE_GET_DATA_BEARER_TECHNOLOGY); - - if (!qmi_message_get_response_result (self, &inner_error)) { - /* Only QMI protocol errors are set in the Output result, all the - * others (e.g. failures parsing) are directly propagated to error. */ - if (inner_error->domain != QMI_PROTOCOL_ERROR) { - g_propagate_error (error, inner_error); - return NULL; - } - - /* Otherwise, build output */ - } - - /* success */ - - output = g_slice_new0 (QmiWdsGetDataBearerTechnologyOutput); - output->ref_count = 1; - output->error = inner_error; - output->current = QMI_WDS_DATA_BEARER_TECHNOLOGY_UNKNOWN; - output->last = QMI_WDS_DATA_BEARER_TECHNOLOGY_UNKNOWN; - - /* Handle QMI protocol errors */ - if (output->error) { - if (g_error_matches (output->error, - QMI_PROTOCOL_ERROR, - QMI_PROTOCOL_ERROR_OUT_OF_CALL)) { - /* last will only appear if we get out-of-call errors */ - qmi_message_tlv_get (self, - GET_DATA_BEARER_TECHNOLOGY_OUTPUT_TLV_LAST, - sizeof (output->last), - &output->last, - NULL); - } - - return output; - } - - if (!qmi_message_tlv_get (self, - GET_DATA_BEARER_TECHNOLOGY_OUTPUT_TLV_CURRENT, - sizeof (output->current), - &output->current, - error)) { - g_prefix_error (error, "Couldn't get the current technology TLV: "); - qmi_wds_get_data_bearer_technology_output_unref (output); - return NULL; - } - - return output; -} - -/*****************************************************************************/ -/* Get current data bearer technology */ - -QmiMessage * -qmi_message_wds_get_current_data_bearer_technology_new (guint8 transaction_id, - guint8 client_id) -{ - return qmi_message_new (QMI_SERVICE_WDS, - client_id, - transaction_id, - QMI_WDS_MESSAGE_GET_CURRENT_DATA_BEARER_TECHNOLOGY); -} - -enum { - GET_CURRENT_DATA_BEARER_TECHNOLOGY_OUTPUT_TLV_CURRENT = 0x01, - GET_CURRENT_DATA_BEARER_TECHNOLOGY_OUTPUT_TLV_LAST = 0x10 -}; - -struct current_data_bearer_technology { - guint8 nw; - guint32 rat_mask; - guint32 so_mask; -} __attribute__((__packed__)); - -/** - * QmiWdsGetCurrentDataBearerTechnologyOutput: - * - * An opaque type handling the output of the Get Current Data Bearer Technology operation. - */ -struct _QmiWdsGetCurrentDataBearerTechnologyOutput { - volatile gint ref_count; - GError *error; - struct current_data_bearer_technology current; - struct current_data_bearer_technology last; -}; - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_result: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * @error: a #GError. - * - * Get the result of the Get Current Data Bearer Technology operation. - * - * Returns: #TRUE if the operation succeeded, and #FALSE if @error is set. - */ -gboolean -qmi_wds_get_current_data_bearer_technology_output_get_result (QmiWdsGetCurrentDataBearerTechnologyOutput *output, - GError **error) -{ - g_return_val_if_fail (output != NULL, FALSE); - - if (output->error) { - if (error) - *error = g_error_copy (output->error); - - return FALSE; - } - - return TRUE; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_current_network_type: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the current network type. - * - * Returns: a #QmiWdsNetworkType. - */ -QmiWdsNetworkType -qmi_wds_get_current_data_bearer_technology_output_get_current_network_type (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_NETWORK_TYPE_UNKNOWN); - - return (QmiWdsNetworkType)output->current.nw; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp2: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the current 3GPP2 specific Radio Access Technology, if the current network type is #QMI_NETWORK_TYPE_3GPP2. - * - * Returns: a #QmiWdsRat3gpp2. - */ -QmiWdsRat3gpp2 -qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp2 (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_RAT_3GPP2_NONE); - g_return_val_if_fail (output->current.nw == QMI_WDS_NETWORK_TYPE_3GPP2, QMI_WDS_RAT_3GPP2_NONE); - - return (QmiWdsRat3gpp2)output->current.rat_mask; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the current 3GPP specific Radio Access Technology, if the current network type is #QMI_NETWORK_TYPE_3GPP. - * - * Returns: a #QmiWdsRat3gpp. - */ -QmiWdsRat3gpp -qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_RAT_3GPP_NONE); - g_return_val_if_fail (output->current.nw == QMI_WDS_NETWORK_TYPE_3GPP, QMI_WDS_RAT_3GPP_NONE); - - return (QmiWdsRat3gpp)output->current.rat_mask; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_current_so_cdma1x: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the current Service Option, if the current network type is #QMI_NETWORK_TYPE_3GPP2 - * and the Radio Access Technology mask contains #QMI_WDS_RAT_3GPP2_CDMA1X. - * - * Returns: a #QmiWdsSoCdma1x. - */ -QmiWdsSoCdma1x -qmi_wds_get_current_data_bearer_technology_output_get_current_so_cdma1x (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_SO_CDMA1X_NONE); - g_return_val_if_fail (output->current.nw == QMI_WDS_NETWORK_TYPE_3GPP2, QMI_WDS_SO_CDMA1X_NONE); - g_return_val_if_fail (output->current.rat_mask & QMI_WDS_RAT_3GPP2_CDMA1X, QMI_WDS_SO_CDMA1X_NONE); - - return (QmiWdsSoCdma1x)output->current.so_mask; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_current_so_evdo_reva: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the current Service Option, if the current network type is #QMI_NETWORK_TYPE_3GPP2 - * and the Radio Access Technology mask contains #QMI_WDS_RAT_3GPP2_EVDO_REVA. - * - * Returns: a #QmiWdsSoEvdoRevA. - */ -QmiWdsSoEvdoRevA -qmi_wds_get_current_data_bearer_technology_output_get_current_so_evdo_reva (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_SO_EVDO_REVA_NONE); - g_return_val_if_fail (output->current.nw == QMI_WDS_NETWORK_TYPE_3GPP2, QMI_WDS_SO_EVDO_REVA_NONE); - g_return_val_if_fail (output->current.rat_mask & QMI_WDS_RAT_3GPP2_EVDO_REVA, QMI_WDS_SO_EVDO_REVA_NONE); - - return (QmiWdsSoEvdoRevA)output->current.so_mask; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_last_network_type: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the network type of the last connection. - * This field is optional, and it may appear only when the operation failed with #QMI_PROTOCOL_ERROR_OUT_OF_CALL. - * - * Returns: a #QmiWdsNetworkType. - */ -QmiWdsNetworkType -qmi_wds_get_current_data_bearer_technology_output_get_last_network_type (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_NETWORK_TYPE_UNKNOWN); - - return (QmiWdsConnectionStatus)output->last.nw; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp2: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the 3GPP2 specific Radio Access Technology of the last connection, if the last network type is #QMI_NETWORK_TYPE_3GPP2. - * This field is optional, and it may appear only when the operation failed with #QMI_PROTOCOL_ERROR_OUT_OF_CALL. - * - * Returns: a #QmiWdsRat3gpp2. - */ -QmiWdsRat3gpp2 -qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp2 (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_RAT_3GPP2_NONE); - g_return_val_if_fail (output->last.nw == QMI_WDS_NETWORK_TYPE_3GPP2, QMI_WDS_RAT_3GPP2_NONE); - - return (QmiWdsRat3gpp2)output->last.rat_mask; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the 3GPP specific Radio Access Technology of the last connection, if the last network type is #QMI_NETWORK_TYPE_3GPP. - * This field is optional, and it may appear only when the operation failed with #QMI_PROTOCOL_ERROR_OUT_OF_CALL. - * - * Returns: a #QmiWdsRat3gpp. - */ -QmiWdsRat3gpp -qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_RAT_3GPP2_NONE); - g_return_val_if_fail (output->last.nw == QMI_WDS_NETWORK_TYPE_3GPP, QMI_WDS_RAT_3GPP_NONE); - - return (QmiWdsRat3gpp)output->last.rat_mask; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_last_so_cdma1x: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the Service Option of the last connection, if the last network type is #QMI_NETWORK_TYPE_3GPP2 - * and the Radio Access Technology mask contains #QMI_WDS_RAT_3GPP2_CDMA1X. - * This field is optional, and it may appear only when the operation failed with #QMI_PROTOCOL_ERROR_OUT_OF_CALL. - * - * Returns: a #QmiWdsSoCdma1x. - */ -QmiWdsSoCdma1x -qmi_wds_get_current_data_bearer_technology_output_get_last_so_cdma1x (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_SO_CDMA1X_NONE); - g_return_val_if_fail (output->last.nw == QMI_WDS_NETWORK_TYPE_3GPP2, QMI_WDS_SO_CDMA1X_NONE); - g_return_val_if_fail (output->last.rat_mask & QMI_WDS_RAT_3GPP2_CDMA1X, QMI_WDS_SO_CDMA1X_NONE); - - return (QmiWdsSoCdma1x)output->last.so_mask; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_get_last_so_evdo_reva: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Get the Service Option of the last connection, if the last network type is #QMI_NETWORK_TYPE_3GPP2 - * and the Radio Access Technology mask contains #QMI_WDS_RAT_3GPP2_EVDO_REVA. - * This field is optional, and it may appear only when the operation failed with #QMI_PROTOCOL_ERROR_OUT_OF_CALL. - * - * Returns: a #QmiWdsSoEvdoRevA. - */ -QmiWdsSoEvdoRevA -qmi_wds_get_current_data_bearer_technology_output_get_last_so_evdo_reva (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, QMI_WDS_SO_EVDO_REVA_NONE); - g_return_val_if_fail (output->last.nw == QMI_WDS_NETWORK_TYPE_3GPP2, QMI_WDS_SO_EVDO_REVA_NONE); - g_return_val_if_fail (output->last.rat_mask & QMI_WDS_RAT_3GPP2_EVDO_REVA, QMI_WDS_SO_EVDO_REVA_NONE); - - return (QmiWdsSoEvdoRevA)output->last.so_mask; -} - -/** - * qmi_wds_get_data_bearer_technology_output_ref: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Atomically increments the reference count of @output by one. - * - * Returns: the new reference to @output. - */ -QmiWdsGetCurrentDataBearerTechnologyOutput * -qmi_wds_get_current_data_bearer_technology_output_ref (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - g_atomic_int_inc (&output->ref_count); - return output; -} - -/** - * qmi_wds_get_current_data_bearer_technology_output_unref: - * @output: a #QmiWdsGetCurrentDataBearerTechnologyOutput. - * - * Atomically decrements the reference count of @output by one. - * If the reference count drops to 0, @output is completely disposed. - */ -void -qmi_wds_get_current_data_bearer_technology_output_unref (QmiWdsGetCurrentDataBearerTechnologyOutput *output) -{ - g_return_if_fail (output != NULL); - - if (g_atomic_int_dec_and_test (&output->ref_count)) { - if (output->error) - g_error_free (output->error); - g_slice_free (QmiWdsGetCurrentDataBearerTechnologyOutput, output); - } -} - -QmiWdsGetCurrentDataBearerTechnologyOutput * -qmi_message_wds_get_current_data_bearer_technology_reply_parse (QmiMessage *self, - GError **error) -{ - QmiWdsGetCurrentDataBearerTechnologyOutput *output; - GError *inner_error = NULL; - - g_assert (qmi_message_get_message_id (self) == QMI_WDS_MESSAGE_GET_CURRENT_DATA_BEARER_TECHNOLOGY); - - if (!qmi_message_get_response_result (self, &inner_error)) { - /* Only QMI protocol errors are set in the Output result, all the - * others (e.g. failures parsing) are directly propagated to error. */ - if (inner_error->domain != QMI_PROTOCOL_ERROR) { - g_propagate_error (error, inner_error); - return NULL; - } - - /* Otherwise, build output */ - } - - /* success */ - - output = g_slice_new0 (QmiWdsGetCurrentDataBearerTechnologyOutput); - output->ref_count = 1; - output->error = inner_error; - output->current.nw = QMI_WDS_NETWORK_TYPE_UNKNOWN; - output->current.rat_mask = 0; - output->current.so_mask = 0; - output->last.nw = QMI_WDS_NETWORK_TYPE_UNKNOWN; - output->last.rat_mask = 0; - output->last.so_mask = 0; - - /* Handle QMI protocol errors */ - if (output->error) { - if (g_error_matches (output->error, - QMI_PROTOCOL_ERROR, - QMI_PROTOCOL_ERROR_OUT_OF_CALL)) { - /* last will only appear if we get out-of-call errors */ - qmi_message_tlv_get (self, - GET_CURRENT_DATA_BEARER_TECHNOLOGY_OUTPUT_TLV_LAST, - sizeof (output->last), - &output->last, - NULL); - } - - return output; - } - - if (!qmi_message_tlv_get (self, - GET_CURRENT_DATA_BEARER_TECHNOLOGY_OUTPUT_TLV_CURRENT, - sizeof (output->current), - &output->current, - error)) { - g_prefix_error (error, "Couldn't get the current technology TLV: "); - qmi_wds_get_current_data_bearer_technology_output_unref (output); - return NULL; - } - - return output; -} diff --git a/src/qmi-message-wds.h b/src/qmi-message-wds.h deleted file mode 100644 index a04cf9ba..00000000 --- a/src/qmi-message-wds.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * libqmi-glib -- GLib/GIO based library to control QMI devices - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright (C) 2012 Aleksander Morgado <aleksander@lanedo.com> - */ - -/* NOTE: this is a private non-installable header */ - -#ifndef _LIBQMI_GLIB_QMI_MESSAGE_WDS_H_ -#define _LIBQMI_GLIB_QMI_MESSAGE_WDS_H_ - -#include <glib.h> - -#include "qmi-wds.h" -#include "qmi-message.h" - -G_BEGIN_DECLS - -/*****************************************************************************/ -/* Start network */ -QmiMessage *qmi_message_wds_start_network_new (guint8 transaction_id, - guint8 client_id, - QmiWdsStartNetworkInput *input, - GError **error); -QmiWdsStartNetworkOutput *qmi_message_wds_start_network_reply_parse (QmiMessage *self, - GError **error); - -/*****************************************************************************/ -/* Stop network */ -QmiMessage *qmi_message_wds_stop_network_new (guint8 transaction_id, - guint8 client_id, - QmiWdsStopNetworkInput *input, - GError **error); -QmiWdsStopNetworkOutput *qmi_message_wds_stop_network_reply_parse (QmiMessage *self, - GError **error); - -/*****************************************************************************/ -/* Get packet service status */ -QmiMessage *qmi_message_wds_get_packet_service_status_new (guint8 transaction_id, - guint8 client_id); -QmiWdsGetPacketServiceStatusOutput *qmi_message_wds_get_packet_service_status_reply_parse (QmiMessage *self, - GError **error); - -/*****************************************************************************/ -/* Get data bearer technology */ -QmiMessage *qmi_message_wds_get_data_bearer_technology_new (guint8 transaction_id, - guint8 client_id); -QmiWdsGetDataBearerTechnologyOutput *qmi_message_wds_get_data_bearer_technology_reply_parse (QmiMessage *self, - GError **error); - -/*****************************************************************************/ -/* Get current data bearer technology */ -QmiMessage *qmi_message_wds_get_current_data_bearer_technology_new (guint8 transaction_id, - guint8 client_id); -QmiWdsGetCurrentDataBearerTechnologyOutput *qmi_message_wds_get_current_data_bearer_technology_reply_parse (QmiMessage *self, - GError **error); - -G_END_DECLS - -#endif /* _LIBQMI_GLIB_QMI_MESSAGE_WDS_H_ */ diff --git a/src/qmi-wds.h b/src/qmi-wds.h deleted file mode 100644 index 8b4bad19..00000000 --- a/src/qmi-wds.h +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * libqmi-glib -- GLib/GIO based library to control QMI devices - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org> - */ - -#ifndef _LIBQMI_GLIB_QMI_WDS_H_ -#define _LIBQMI_GLIB_QMI_WDS_H_ - -#include <glib.h> - -G_BEGIN_DECLS - -/*****************************************************************************/ -/* Supported/known messages */ -typedef enum { - QMI_WDS_MESSAGE_EVENT = 0x0001, /* unused currently */ - QMI_WDS_MESSAGE_START_NETWORK = 0x0020, - QMI_WDS_MESSAGE_STOP_NETWORK = 0x0021, - QMI_WDS_MESSAGE_GET_PACKET_SERVICE_STATUS = 0x0022, - QMI_WDS_MESSAGE_GET_DATA_BEARER_TECHNOLOGY = 0x0037, - QMI_WDS_MESSAGE_GET_CURRENT_DATA_BEARER_TECHNOLOGY = 0x0044 -} QmiWdsMessage; - -/*****************************************************************************/ -/* Start network */ - -typedef struct _QmiWdsStartNetworkInput QmiWdsStartNetworkInput; -QmiWdsStartNetworkInput *qmi_wds_start_network_input_new (void); -QmiWdsStartNetworkInput *qmi_wds_start_network_input_ref (QmiWdsStartNetworkInput *input); -void qmi_wds_start_network_input_unref (QmiWdsStartNetworkInput *input); -void qmi_wds_start_network_input_set_apn (QmiWdsStartNetworkInput *input, - const gchar *str); -const gchar *qmi_wds_start_network_input_get_apn (QmiWdsStartNetworkInput *input); -void qmi_wds_start_network_input_set_username (QmiWdsStartNetworkInput *input, - const gchar *str); -const gchar *qmi_wds_start_network_input_get_username (QmiWdsStartNetworkInput *input); -void qmi_wds_start_network_input_set_password (QmiWdsStartNetworkInput *input, - const gchar *str); -const gchar *qmi_wds_start_network_input_get_password (QmiWdsStartNetworkInput *input); - -typedef struct _QmiWdsStartNetworkOutput QmiWdsStartNetworkOutput; -QmiWdsStartNetworkOutput *qmi_wds_start_network_output_ref (QmiWdsStartNetworkOutput *output); -void qmi_wds_start_network_output_unref (QmiWdsStartNetworkOutput *output); -gboolean qmi_wds_start_network_output_get_result (QmiWdsStartNetworkOutput *output, - GError **error); -gboolean qmi_wds_start_network_output_get_packet_data_handle (QmiWdsStartNetworkOutput *output, - guint32 *packet_data_handle); -/* TODO: provide proper enums for the call end reasons */ -gboolean qmi_wds_start_network_output_get_call_end_reason (QmiWdsStartNetworkOutput *output, - guint16 *call_end_reason); -gboolean qmi_wds_start_network_output_get_verbose_call_end_reason (QmiWdsStartNetworkOutput *output, - guint16 *verbose_call_end_reason_domain, - guint16 *verbose_call_end_reason_value); - -/*****************************************************************************/ -/* Stop network */ - -typedef struct _QmiWdsStopNetworkInput QmiWdsStopNetworkInput; -QmiWdsStopNetworkInput *qmi_wds_stop_network_input_new (void); -QmiWdsStopNetworkInput *qmi_wds_stop_network_input_ref (QmiWdsStopNetworkInput *input); -void qmi_wds_stop_network_input_unref (QmiWdsStopNetworkInput *input); -void qmi_wds_stop_network_input_set_packet_data_handle (QmiWdsStopNetworkInput *input, - guint32 packet_data_handle); -gboolean qmi_wds_stop_network_input_get_packet_data_handle (QmiWdsStopNetworkInput *input, - guint32 *packet_data_handle); - -typedef struct _QmiWdsStopNetworkOutput QmiWdsStopNetworkOutput; -QmiWdsStopNetworkOutput *qmi_wds_stop_network_output_ref (QmiWdsStopNetworkOutput *output); -void qmi_wds_stop_network_output_unref (QmiWdsStopNetworkOutput *output); -gboolean qmi_wds_stop_network_output_get_result (QmiWdsStopNetworkOutput *output, - GError **error); - -/*****************************************************************************/ -/* Get packet service status */ - -/* Note: no defined input yet */ - -typedef enum { - QMI_WDS_CONNECTION_STATUS_UNKNOWN = 0, - QMI_WDS_CONNECTION_STATUS_DISCONNECTED = 1, - QMI_WDS_CONNECTION_STATUS_CONNECTED = 2, - QMI_WDS_CONNECTION_STATUS_SUSPENDED = 3, - QMI_WDS_CONNECTION_STATUS_AUTHENTICATING = 4 -} QmiWdsConnectionStatus; - -typedef struct _QmiWdsGetPacketServiceStatusOutput QmiWdsGetPacketServiceStatusOutput; -QmiWdsGetPacketServiceStatusOutput *qmi_wds_get_packet_service_status_output_ref (QmiWdsGetPacketServiceStatusOutput *output); -void qmi_wds_get_packet_service_status_output_unref (QmiWdsGetPacketServiceStatusOutput *output); -gboolean qmi_wds_get_packet_service_status_output_get_result (QmiWdsGetPacketServiceStatusOutput *output, - GError **error); -QmiWdsConnectionStatus qmi_wds_get_packet_service_status_output_get_connection_status (QmiWdsGetPacketServiceStatusOutput *output); - -/*****************************************************************************/ -/* Get data bearer technology */ - -/* Note: no defined input yet */ - -typedef enum { - QMI_WDS_DATA_BEARER_TECHNOLOGY_UNKNOWN = -1, - QMI_WDS_DATA_BEARER_TECHNOLOGY_CDMA20001X = 0x01, - QMI_WDS_DATA_BEARER_TECHNOLOGY_1xEVDO = 0x02, - QMI_WDS_DATA_BEARER_TECHNOLOGY_GSM = 0x03, - QMI_WDS_DATA_BEARER_TECHNOLOGY_UMTS = 0x04, - QMI_WDS_DATA_BEARER_TECHNOLOGY_1xEVDO_REVA = 0x05, - QMI_WDS_DATA_BEARER_TECHNOLOGY_EDGE = 0x06, - QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPA = 0x07, - QMI_WDS_DATA_BEARER_TECHNOLOGY_HSUPA = 0x08, - QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPA_HSUPDA = 0x09, - QMI_WDS_DATA_BEARER_TECHNOLOGY_LTE = 0x0A, - QMI_WDS_DATA_BEARER_TECHNOLOGY_EHRPD = 0x0B, - QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPAPLUS = 0x0C, - QMI_WDS_DATA_BEARER_TECHNOLOGY_HSDPAPLUS_HSUPA = 0x0D, - QMI_WDS_DATA_BEARER_TECHNOLOGY_DCHSDPAPLUS = 0x0E, - QMI_WDS_DATA_BEARER_TECHNOLOGY_DCHSDPAPLUS_HSUPA = 0x0F -} QmiWdsDataBearerTechnology; - -typedef struct _QmiWdsGetDataBearerTechnologyOutput QmiWdsGetDataBearerTechnologyOutput; -QmiWdsGetDataBearerTechnologyOutput *qmi_wds_get_data_bearer_technology_output_ref (QmiWdsGetDataBearerTechnologyOutput *output); -void qmi_wds_get_data_bearer_technology_output_unref (QmiWdsGetDataBearerTechnologyOutput *output); -gboolean qmi_wds_get_data_bearer_technology_output_get_result (QmiWdsGetDataBearerTechnologyOutput *output, - GError **error); -QmiWdsDataBearerTechnology qmi_wds_get_data_bearer_technology_output_get_current (QmiWdsGetDataBearerTechnologyOutput *output); -QmiWdsDataBearerTechnology qmi_wds_get_data_bearer_technology_output_get_last (QmiWdsGetDataBearerTechnologyOutput *output); - -/*****************************************************************************/ -/* Get current data bearer technology */ - -/* Note: no defined input yet */ - -typedef enum { - QMI_WDS_NETWORK_TYPE_UNKNOWN = 0, - QMI_WDS_NETWORK_TYPE_3GPP2 = 1, - QMI_WDS_NETWORK_TYPE_3GPP = 2 -} QmiWdsNetworkType; - -typedef enum { /*< underscore_name=qmi_wds_rat_3gpp2 >*/ - QMI_WDS_RAT_3GPP2_NONE = 0, - QMI_WDS_RAT_3GPP2_CDMA1X = 1 << 0, - QMI_WDS_RAT_3GPP2_EVDO_REV0 = 1 << 1, - QMI_WDS_RAT_3GPP2_EVDO_REVA = 1 << 2, - QMI_WDS_RAT_3GPP2_EVDO_REVB = 1 << 3, - QMI_WDS_RAT_3GPP2_NULL_BEARER = 1 << 15 -} QmiWdsRat3gpp2; - -typedef enum { /*< underscore_name=qmi_wds_rat_3gpp >*/ - QMI_WDS_RAT_3GPP_NONE = 0, - QMI_WDS_RAT_3GPP_WCDMA = 1 << 0, - QMI_WDS_RAT_3GPP_GPRS = 1 << 1, - QMI_WDS_RAT_3GPP_HSDPA = 1 << 2, - QMI_WDS_RAT_3GPP_HSUPA = 1 << 3, - QMI_WDS_RAT_3GPP_EDGE = 1 << 4, - QMI_WDS_RAT_3GPP_LTE = 1 << 5, - QMI_WDS_RAT_3GPP_HSDPAPLUS = 1 << 6, - QMI_WDS_RAT_3GPP_DCHSDPAPLUS = 1 << 7, - QMI_WDS_RAT_3GPP_NULL_BEARER = 1 << 15 -} QmiWdsRat3gpp; - -typedef enum { - QMI_WDS_SO_CDMA1X_NONE = 0, - QMI_WDS_SO_CDMA1X_IS95 = 1 << 0, - QMI_WDS_SO_CDMA1X_IS2000 = 1 << 1, - QMI_WDS_SO_CDMA1X_IS2000_REL_A = 1 << 2 -} QmiWdsSoCdma1x; - -typedef enum { /*< underscore_name=qmi_wds_so_evdo_reva >*/ - QMI_WDS_SO_EVDO_REVA_NONE = 0, - QMI_WDS_SO_EVDO_REVA_DPA = 1 << 0, - QMI_WDS_SO_EVDO_REVA_MFPA = 1 << 1, - QMI_WDS_SO_EVDO_REVA_EMPA = 1 << 2, - QMI_WDS_SO_EVDO_REVA_EMPA_EHRPD = 1 << 3 -} QmiWdsSoEvdoRevA; - -typedef struct _QmiWdsGetCurrentDataBearerTechnologyOutput QmiWdsGetCurrentDataBearerTechnologyOutput; -QmiWdsGetCurrentDataBearerTechnologyOutput *qmi_wds_get_current_data_bearer_technology_output_ref (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -void qmi_wds_get_current_data_bearer_technology_output_unref (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -gboolean qmi_wds_get_current_data_bearer_technology_output_get_result (QmiWdsGetCurrentDataBearerTechnologyOutput *output, - GError **error); -QmiWdsNetworkType qmi_wds_get_current_data_bearer_technology_output_get_current_network_type (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsRat3gpp2 qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp2 (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsRat3gpp qmi_wds_get_current_data_bearer_technology_output_get_current_rat_3gpp (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsSoCdma1x qmi_wds_get_current_data_bearer_technology_output_get_current_so_cdma1x (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsSoEvdoRevA qmi_wds_get_current_data_bearer_technology_output_get_current_so_evdo_reva (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsNetworkType qmi_wds_get_current_data_bearer_technology_output_get_last_network_type (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsRat3gpp2 qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp2 (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsRat3gpp qmi_wds_get_current_data_bearer_technology_output_get_last_rat_3gpp (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsSoCdma1x qmi_wds_get_current_data_bearer_technology_output_get_last_so_cdma1x (QmiWdsGetCurrentDataBearerTechnologyOutput *output); -QmiWdsSoEvdoRevA qmi_wds_get_current_data_bearer_technology_output_get_last_so_evdo_reva (QmiWdsGetCurrentDataBearerTechnologyOutput *output); - -G_END_DECLS - -#endif /* _LIBQMI_GLIB_QMI_WDS_H_ */ |