diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | cli/qmicli-dms.c | 22 | ||||
-rw-r--r-- | data/qmi-service-dms.json | 40 | ||||
-rw-r--r-- | src/Makefile.am | 22 | ||||
-rw-r--r-- | src/libqmi-glib.h | 2 | ||||
-rw-r--r-- | src/qmi-client-dms.c | 114 | ||||
-rw-r--r-- | src/qmi-client-dms.h | 66 | ||||
-rw-r--r-- | src/qmi-device.c | 2 | ||||
-rw-r--r-- | src/qmi-dms.h | 56 | ||||
-rw-r--r-- | src/qmi-message-dms.c | 208 | ||||
-rw-r--r-- | src/qmi-message-dms.h | 45 |
11 files changed, 75 insertions, 504 deletions
@@ -40,6 +40,8 @@ src/qmi-enum-types.h src/qmi-enum-types.c src/qmi-ctl.h src/qmi-ctl.c +src/qmi-dms.h +src/qmi-dms.c src/*.stamp cli/.deps diff --git a/cli/qmicli-dms.c b/cli/qmicli-dms.c index 4fc63944..c79425f9 100644 --- a/cli/qmicli-dms.c +++ b/cli/qmicli-dms.c @@ -119,8 +119,11 @@ static void get_ids_ready (QmiClientDms *client, GAsyncResult *res) { + gchar *esn = NULL; + gchar *imei = NULL; + gchar *meid = NULL; + QmiMessageDmsGetIdsOutput *output; GError *error = NULL; - QmiDmsGetIdsOutput *output; output = qmi_client_dms_get_ids_finish (client, res, &error); if (!output) { @@ -130,10 +133,10 @@ get_ids_ready (QmiClientDms *client, return; } - if (!qmi_dms_get_ids_output_get_result (output, &error)) { + if (!qmi_message_dms_get_ids_output_get_result (output, &error)) { g_printerr ("error: couldn't get IDs: %s\n", error->message); g_error_free (error); - qmi_dms_get_ids_output_unref (output); + qmi_message_dms_get_ids_output_unref (output); shutdown (FALSE); return; } @@ -141,16 +144,20 @@ get_ids_ready (QmiClientDms *client, #undef VALIDATE_UNKNOWN #define VALIDATE_UNKNOWN(str) (str ? str : "unknown") + qmi_message_dms_get_ids_output_get_esn (output, &esn, NULL); + qmi_message_dms_get_ids_output_get_imei (output, &imei, NULL); + qmi_message_dms_get_ids_output_get_meid (output, &meid, NULL); + g_print ("[%s] Device IDs retrieved:\n" "\t ESN: '%s'\n" "\tIMEI: '%s'\n" "\tMEID: '%s'\n", qmi_device_get_path_display (ctx->device), - VALIDATE_UNKNOWN (qmi_dms_get_ids_output_get_esn (output)), - VALIDATE_UNKNOWN (qmi_dms_get_ids_output_get_imei (output)), - VALIDATE_UNKNOWN (qmi_dms_get_ids_output_get_meid (output))); + VALIDATE_UNKNOWN (esn), + VALIDATE_UNKNOWN (imei), + VALIDATE_UNKNOWN (meid)); - qmi_dms_get_ids_output_unref (output); + qmi_message_dms_get_ids_output_unref (output); shutdown (TRUE); } @@ -177,6 +184,7 @@ qmicli_dms_run (QmiDevice *device, if (get_ids_flag) { g_debug ("Asynchronously getting IDs..."); qmi_client_dms_get_ids (ctx->client, + NULL, 10, ctx->cancellable, (GAsyncReadyCallback)get_ids_ready, diff --git a/data/qmi-service-dms.json b/data/qmi-service-dms.json new file mode 100644 index 00000000..6d3892bd --- /dev/null +++ b/data/qmi-service-dms.json @@ -0,0 +1,40 @@ + +[ + { "name" : "QMI Client DMS", + "type" : "Client" }, + + { "name" : "QMI Message DMS", + "type" : "Message-ID-Enum" }, + + { "name" : "Get IDs", + "type" : "Message", + "service" : "DMS", + "id" : "0x0025", + "output" : [ { "name" : "Result", + "type" : "common-TLV" }, + { "name" : "Esn", + "id" : "0x10", + "mandatory" : "no", + "type" : "TLV", + "format" : "string", + "prerequisite": { "field" : "Result.Error Status", + "operation" : "==", + "value" : "QMI_STATUS_SUCCESS" } }, + { "name" : "Imei", + "id" : "0x11", + "mandatory" : "no", + "type" : "TLV", + "format" : "string", + "prerequisite": { "field" : "Result.Error Status", + "operation" : "==", + "value" : "QMI_STATUS_SUCCESS" } }, + { "name" : "Meid", + "id" : "0x12", + "mandatory" : "no", + "type" : "TLV", + "format" : "string", + "prerequisite": { "field" : "Result.Error Status", + "operation" : "==", + "value" : "QMI_STATUS_SUCCESS" } } ] } + +] diff --git a/src/Makefile.am b/src/Makefile.am index 6b33e23e..a6bb841d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,7 +26,7 @@ qmi-error-types.c: qmi-errors.h qmi-error-types.h $(top_srcdir)/build-aux/templa ENUMS = qmi-enums.h qmi-dms.h qmi-wds.h qmi-ctl.h qmi-enum-types.h: $(ENUMS) $(top_srcdir)/build-aux/templates/qmi-enum-types-template.h $(AM_V_GEN) $(GLIB_MKENUMS) \ - --fhead "#ifndef __LIBQMI_GLIB_ENUM_TYPES_H__\n#define __LIBQMI_GLIB_ENUM_TYPES_H__\n#include \"qmi-enums.h\"\n#include \"qmi-dms.h\"\n#include \"qmi-ctl.h\"\n#include \"qmi-wds.h\"\n" \ + --fhead "#ifndef __LIBQMI_GLIB_ENUM_TYPES_H__\n#define __LIBQMI_GLIB_ENUM_TYPES_H__\n#include \"qmi-enums.h\"\n#include \"qmi-ctl.h\"\n#include \"qmi-dms.h\"\n#include \"qmi-wds.h\"\n" \ --template $(top_srcdir)/build-aux/templates/qmi-enum-types-template.h \ --ftail "#endif /* __LIBQMI_GLIB_ENUM_TYPES_H__ */\n" \ $(ENUMS) > $@ @@ -45,6 +45,14 @@ qmi-ctl.stamp: $(top_srcdir)/data/qmi-service-ctl.json $(top_srcdir)/build-aux/q --output qmi-ctl && \ touch $@ +# DMS service +qmi-dms.stamp: $(top_srcdir)/data/qmi-service-dms.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-dms.json \ + --include $(top_srcdir)/data/qmi-common.json \ + --output qmi-dms && \ + 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 @@ -52,6 +60,8 @@ qmi-message.c: qmi-error-types.h qmi-enum-types.h qmi-message-dms.c: qmi-error-types.h 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 libqmi_glib_la_SOURCES = \ libqmi-glib.h \ @@ -61,13 +71,12 @@ libqmi_glib_la_SOURCES = \ qmi-message.h qmi-message.c \ qmi-device.h qmi-device.c \ qmi-client.h qmi-client.c \ - qmi-message-dms.h qmi-message-dms.c \ qmi-message-wds.h qmi-message-wds.c \ - qmi-dms.h qmi-client-dms.h qmi-client-dms.c \ qmi-wds.h qmi-client-wds.h qmi-client-wds.c nodist_libqmi_glib_la_SOURCES = \ - qmi-ctl.c qmi-ctl.h + qmi-ctl.c qmi-ctl.h \ + qmi-dms.c qmi-dms.h libqmi_glib_la_LIBADD = \ $(LIBQMI_GLIB_LIBS) @@ -79,8 +88,9 @@ include_HEADERS = \ qmi-enums.h qmi-enum-types.h \ qmi-device.h \ qmi-client.h \ - qmi-dms.h qmi-client-dms.h \ + qmi-dms.h \ qmi-wds.h qmi-client-wds.h CLEANFILES = \ - qmi-ctl.h qmi-ctl.c qmi-ctl.stamp + qmi-ctl.h qmi-ctl.c qmi-ctl.stamp \ + qmi-dms.h qmi-dms.c qmi-dms.stamp diff --git a/src/libqmi-glib.h b/src/libqmi-glib.h index a488cdf4..34e2d16f 100644 --- a/src/libqmi-glib.h +++ b/src/libqmi-glib.h @@ -29,7 +29,7 @@ #include "qmi-device.h" #include "qmi-client.h" -#include "qmi-client-dms.h" +#include "qmi-dms.h" #include "qmi-client-wds.h" #endif /* _LIBQMI_GLIB_H_ */ diff --git a/src/qmi-client-dms.c b/src/qmi-client-dms.c deleted file mode 100644 index b30d4717..00000000 --- a/src/qmi-client-dms.c +++ /dev/null @@ -1,114 +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-enum-types.h" -#include "qmi-device.h" -#include "qmi-client-dms.h" -#include "qmi-message-dms.h" - -G_DEFINE_TYPE (QmiClientDms, qmi_client_dms, QMI_TYPE_CLIENT) - -/*****************************************************************************/ -/* Get IDs */ - -QmiDmsGetIdsOutput * -qmi_client_dms_get_ids_finish (QmiClientDms *self, - GAsyncResult *res, - GError **error) -{ - if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) - return NULL; - - return qmi_dms_get_ids_output_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res))); -} - -static void -get_ids_ready (QmiDevice *device, - GAsyncResult *res, - GSimpleAsyncResult *simple) -{ - QmiDmsGetIdsOutput *output; - GError *error = NULL; - QmiMessage *reply; - - reply = qmi_device_command_finish (device, res, &error); - if (!reply) { - g_prefix_error (&error, "Getting IDs failed: "); - g_simple_async_result_take_error (simple, error); - g_simple_async_result_complete (simple); - g_object_unref (simple); - return; - } - - /* Parse reply */ - output = qmi_message_dms_get_ids_reply_parse (reply, &error); - if (!output) { - g_prefix_error (&error, "Getting IDs reply parsing failed: "); - g_simple_async_result_take_error (simple, error); - } else - g_simple_async_result_set_op_res_gpointer (simple, - output, - (GDestroyNotify)qmi_dms_get_ids_output_unref); - g_simple_async_result_complete (simple); - g_object_unref (simple); - qmi_message_unref (reply); -} - -void -qmi_client_dms_get_ids (QmiClientDms *self, - 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_dms_get_ids); - - request = qmi_message_dms_get_ids_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_ids_ready, - result); - qmi_message_unref (request); -} - -/*****************************************************************************/ - -static void -qmi_client_dms_init (QmiClientDms *self) -{ -} - -static void -qmi_client_dms_class_init (QmiClientDmsClass *klass) -{ -} diff --git a/src/qmi-client-dms.h b/src/qmi-client-dms.h deleted file mode 100644 index 8b91d7b7..00000000 --- a/src/qmi-client-dms.h +++ /dev/null @@ -1,66 +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_DMS_H_ -#define _LIBQMI_GLIB_QMI_CLIENT_DMS_H_ - -#include <glib-object.h> - -#include "qmi-client.h" -#include "qmi-dms.h" - -G_BEGIN_DECLS - -#define QMI_TYPE_CLIENT_DMS (qmi_client_dms_get_type ()) -#define QMI_CLIENT_DMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QMI_TYPE_CLIENT_DMS, QmiClientDms)) -#define QMI_CLIENT_DMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QMI_TYPE_CLIENT_DMS, QmiClientDmsClass)) -#define QMI_IS_CLIENT_DMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QMI_TYPE_CLIENT_DMS)) -#define QMI_IS_CLIENT_DMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QMI_TYPE_CLIENT_DMS)) -#define QMI_CLIENT_DMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), QMI_TYPE_CLIENT_DMS, QmiClientDmsClass)) - -typedef struct _QmiClientDms QmiClientDms; -typedef struct _QmiClientDmsClass QmiClientDmsClass; - -struct _QmiClientDms { - QmiClient parent; - gpointer priv_unused; -}; - -struct _QmiClientDmsClass { - QmiClientClass parent; -}; - -GType qmi_client_dms_get_type (void); - -/* Get IDs */ -void qmi_client_dms_get_ids (QmiClientDms *self, - guint timeout, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -QmiDmsGetIdsOutput *qmi_client_dms_get_ids_finish (QmiClientDms *self, - GAsyncResult *res, - GError **error); - -G_END_DECLS - -#endif /* _LIBQMI_GLIB_QMI_CLIENT_DMS_H_ */ diff --git a/src/qmi-device.c b/src/qmi-device.c index cc931845..e6b66207 100644 --- a/src/qmi-device.c +++ b/src/qmi-device.c @@ -30,7 +30,7 @@ #include "qmi-device.h" #include "qmi-message.h" #include "qmi-ctl.h" -#include "qmi-client-dms.h" +#include "qmi-dms.h" #include "qmi-client-wds.h" #include "qmi-utils.h" #include "qmi-error-types.h" diff --git a/src/qmi-dms.h b/src/qmi-dms.h deleted file mode 100644 index e3e6b7e5..00000000 --- a/src/qmi-dms.h +++ /dev/null @@ -1,56 +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_DMS_H_ -#define _LIBQMI_GLIB_QMI_DMS_H_ - -#include <glib.h> - -#include "qmi-enums.h" - -G_BEGIN_DECLS - -/*****************************************************************************/ -/* Supported/known messages */ -typedef enum { - QMI_DMS_MESSAGE_EVENT = 0x0001, /* unused currently */ - QMI_DMS_MESSAGE_GET_MANUFACTURER = 0x0021, /* unused currently */ - QMI_DMS_MESSAGE_GET_IDS = 0x0025, - QMI_DMS_MESSAGE_GET_OPERATING_MODE = 0x002D, /* unused currently */ - QMI_DMS_MESSAGE_SET_OPERATING_MODE = 0x002E /* unused currently */ -} QmiDmsMessage; - -/*****************************************************************************/ -/* Get IDs */ -typedef struct _QmiDmsGetIdsOutput QmiDmsGetIdsOutput; -QmiDmsGetIdsOutput *qmi_dms_get_ids_output_ref (QmiDmsGetIdsOutput *output); -void qmi_dms_get_ids_output_unref (QmiDmsGetIdsOutput *output); -gboolean qmi_dms_get_ids_output_get_result (QmiDmsGetIdsOutput *output, - GError **error); -const gchar *qmi_dms_get_ids_output_get_esn (QmiDmsGetIdsOutput *output); -const gchar *qmi_dms_get_ids_output_get_imei (QmiDmsGetIdsOutput *output); -const gchar *qmi_dms_get_ids_output_get_meid (QmiDmsGetIdsOutput *output); - -G_END_DECLS - -#endif /* _LIBQMI_GLIB_QMI_DMS_H_ */ diff --git a/src/qmi-message-dms.c b/src/qmi-message-dms.c deleted file mode 100644 index 7315bd41..00000000 --- a/src/qmi-message-dms.c +++ /dev/null @@ -1,208 +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 "qmi-message-dms.h" -#include "qmi-enums.h" -#include "qmi-error-types.h" - -/*****************************************************************************/ -/* Get IDs */ - -enum { - QMI_DMS_TLV_GET_IDS_ESN = 0x10, - QMI_DMS_TLV_GET_IDS_IMEI, - QMI_DMS_TLV_GET_IDS_MEID -}; - -/** - * QmiDmsGetIdsOutput: - * - * An opaque type handling the output of the Get IDs operation. - */ -struct _QmiDmsGetIdsOutput { - volatile gint ref_count; - GError *error; - gchar *esn; - gchar *imei; - gchar *meid; -}; - -/** - * qmi_dms_get_ids_output_get_result: - * @output: a #QmiDmsGetIdsOutput. - * @error: a #GError. - * - * Get the result of the Get IDs operation. - * - * Returns: #TRUE if the operation succeeded, and #FALSE if @error is set. - */ -gboolean -qmi_dms_get_ids_output_get_result (QmiDmsGetIdsOutput *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_dms_get_ids_output_get_esn: - * @output: a #QmiDmsGetIdsOutput. - * - * Get the ESN. - * - * Returns: the ESN. - */ -const gchar * -qmi_dms_get_ids_output_get_esn (QmiDmsGetIdsOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - return output->esn; -} - -/** - * qmi_dms_get_ids_output_get_imei: - * @output: a #QmiDmsGetIdsOutput. - * - * Get the IMEI. - * - * Returns: the IMEI. - */ -const gchar * -qmi_dms_get_ids_output_get_imei (QmiDmsGetIdsOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - return output->imei; -} - -/** - * qmi_dms_get_ids_output_get_meid: - * @output: a #QmiDmsGetIdsOutput. - * - * Get the MEID. - * - * Returns: the MEID. - */ -const gchar * -qmi_dms_get_ids_output_get_meid (QmiDmsGetIdsOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - return output->meid; -} - -/** - * qmi_dms_get_ids_output_ref: - * @output: a #QmiDmsGetIdsOutput. - * - * Atomically increments the reference count of @output by one. - * - * Returns: the new reference to @output. - */ -QmiDmsGetIdsOutput * -qmi_dms_get_ids_output_ref (QmiDmsGetIdsOutput *output) -{ - g_return_val_if_fail (output != NULL, NULL); - - g_atomic_int_inc (&output->ref_count); - return output; -} - -/** - * qmi_dms_get_ids_output_unref: - * @output: a #QmiDmsGetIdsOutput. - * - * Atomically decrements the reference count of @output by one. - * If the reference count drops to 0, @output is completely disposed. - */ -void -qmi_dms_get_ids_output_unref (QmiDmsGetIdsOutput *output) -{ - g_return_if_fail (output != NULL); - - if (g_atomic_int_dec_and_test (&output->ref_count)) { - g_free (output->esn); - g_free (output->imei); - g_free (output->meid); - if (output->error) - g_error_free (output->error); - g_slice_free (QmiDmsGetIdsOutput, output); - } -} - -QmiMessage * -qmi_message_dms_get_ids_new (guint8 transaction_id, - guint8 client_id) -{ - return qmi_message_new (QMI_SERVICE_DMS, - client_id, - transaction_id, - QMI_DMS_MESSAGE_GET_IDS); -} - -QmiDmsGetIdsOutput * -qmi_message_dms_get_ids_reply_parse (QmiMessage *self, - GError **error) -{ - QmiDmsGetIdsOutput *output; - GError *inner_error = NULL; - - g_assert (qmi_message_get_message_id (self) == QMI_DMS_MESSAGE_GET_IDS); - - 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 (QmiDmsGetIdsOutput); - output->ref_count = 1; - output->error = inner_error; - - /* Note: all ESN/IMEI/MEID are OPTIONAL; so it's ok if none of them appear */ - output->esn = qmi_message_tlv_get_string (self, - QMI_DMS_TLV_GET_IDS_ESN, - NULL); - output->imei = qmi_message_tlv_get_string (self, - QMI_DMS_TLV_GET_IDS_IMEI, - NULL); - output->meid = qmi_message_tlv_get_string (self, - QMI_DMS_TLV_GET_IDS_MEID, - NULL); - - return output; -} diff --git a/src/qmi-message-dms.h b/src/qmi-message-dms.h deleted file mode 100644 index b481c64a..00000000 --- a/src/qmi-message-dms.h +++ /dev/null @@ -1,45 +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_DMS_H_ -#define _LIBQMI_GLIB_QMI_MESSAGE_DMS_H_ - -#include <glib.h> - -#include "qmi-dms.h" -#include "qmi-message.h" - -G_BEGIN_DECLS - -/*****************************************************************************/ -/* Get IDs */ -QmiMessage *qmi_message_dms_get_ids_new (guint8 transaction_id, - guint8 client_id); -QmiDmsGetIdsOutput *qmi_message_dms_get_ids_reply_parse (QmiMessage *self, - GError **error); - -G_END_DECLS - -#endif /* _LIBQMI_GLIB_QMI_MESSAGE_DMS_H_ */ |