summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-05-18 13:30:58 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 16:08:53 +0200
commit64b944badc26a5d75698974935e4154e1ba0cf72 (patch)
treeb9975c9db87efbd26c279ea9d6799379fbe729f1
parent716b0c15ea2a46dbcc11019b8b4381f0a0e64736 (diff)
downloadlibqmi-64b944badc26a5d75698974935e4154e1ba0cf72.tar.gz
core: use new autogenerated code for the CTL service
-rw-r--r--.gitignore5
-rw-r--r--src/Makefile.am26
-rw-r--r--src/qmi-client-ctl.c497
-rw-r--r--src/qmi-client-ctl.h99
-rw-r--r--src/qmi-client.c2
-rw-r--r--src/qmi-ctl.h62
-rw-r--r--src/qmi-device.c111
-rw-r--r--src/qmi-message-ctl.c334
-rw-r--r--src/qmi-message-ctl.h67
-rw-r--r--src/qmi-message.c2
10 files changed, 103 insertions, 1102 deletions
diff --git a/.gitignore b/.gitignore
index c0e12ead..f74b49dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,8 +38,9 @@ src/qmi-error-types.c
src/qmi-error-types.h
src/qmi-enum-types.h
src/qmi-enum-types.c
-src/qmi-tmp-ctl.h
-src/qmi-tmp-ctl.c
+src/qmi-ctl.h
+src/qmi-ctl.c
+src/*.stamp
cli/.deps
cli/.libs
diff --git a/src/Makefile.am b/src/Makefile.am
index b338a766..2fa6ba38 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,21 +37,20 @@ qmi-enum-types.c: $(ENUMS) qmi-enum-types.h $(top_srcdir)/build-aux/templates/qm
--template $(top_srcdir)/build-aux/templates/qmi-enum-types-template.c \
$(ENUMS) > $@
-# QMI message handling generation
-qmi-tmp-ctl.c qmi-tmp-ctl.h: $(top_srcdir)/data/qmi-service-ctl.json $(top_srcdir)/build-aux/qmi-codegen/*.py $(top_srcdir)/build-aux/qmi-codegen/qmi-codegen
+# CTL service
+qmi-ctl.stamp: $(top_srcdir)/data/qmi-service-ctl.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 \
$(top_srcdir)/data/qmi-service-ctl.json \
- qmi-tmp-ctl
+ qmi-ctl && \
+ 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
-qmi-client-ctl.c: qmi-error-types.h qmi-enum-types.h
qmi-message.c: qmi-error-types.h qmi-enum-types.h
-qmi-message-ctl.c: qmi-error-types.h
qmi-message-dms.c: qmi-error-types.h
-qmi-tmp-*.c: qmi-error-types.h
-qmi-tmp-*.h: qmi-enum-types.h
+qmi-ctl.h: qmi-ctl.stamp
+qmi-ctl.c: qmi-error-types.h qmi-enum-types.h qmi-ctl.stamp
libqmi_glib_la_SOURCES = \
libqmi-glib.h \
@@ -59,16 +58,16 @@ libqmi_glib_la_SOURCES = \
qmi-enums.h qmi-enum-types.h qmi-enum-types.c \
qmi-utils.h qmi-utils.c \
qmi-message.h qmi-message.c \
- qmi-tmp-ctl.c qmi-tmp-ctl.h \
- qmi-message-ctl.h qmi-message-ctl.c \
- qmi-message-dms.h qmi-message-dms.c \
- qmi-message-wds.h qmi-message-wds.c \
qmi-device.h qmi-device.c \
qmi-client.h qmi-client.c \
- qmi-ctl.h qmi-client-ctl.h qmi-client-ctl.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
+
libqmi_glib_la_LIBADD = \
$(LIBQMI_GLIB_LIBS)
@@ -81,3 +80,6 @@ include_HEADERS = \
qmi-client.h \
qmi-dms.h qmi-client-dms.h \
qmi-wds.h qmi-client-wds.h
+
+CLEANFILES = \
+ qmi-ctl.h qmi-ctl.c qmi-ctl.stamp
diff --git a/src/qmi-client-ctl.c b/src/qmi-client-ctl.c
deleted file mode 100644
index 33237ad0..00000000
--- a/src/qmi-client-ctl.c
+++ /dev/null
@@ -1,497 +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-error-types.h"
-#include "qmi-enum-types.h"
-#include "qmi-device.h"
-#include "qmi-client-ctl.h"
-#include "qmi-message-ctl.h"
-
-G_DEFINE_TYPE (QmiClientCtl, qmi_client_ctl, QMI_TYPE_CLIENT)
-
-/*****************************************************************************/
-/* Get version info */
-
-/**
- * qmi_client_ctl_get_version_info_finish:
- * @res: a #GAsyncResult.
- * @error: a #GError.
- *
- * Finishes an operation started with qmi_client_ctl_get_version_info().
- *
- * Returns: A #GPtrArray of #QmiCtlVersionInfo, or #NULL if @error is set.
- */
-GPtrArray *
-qmi_client_ctl_get_version_info_finish (QmiClientCtl *self,
- GAsyncResult *res,
- GError **error)
-{
- if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
- return NULL;
-
- return g_ptr_array_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
-}
-
-static void
-version_info_ready (QmiDevice *device,
- GAsyncResult *res,
- GSimpleAsyncResult *simple)
-{
- GError *error = NULL;
- QmiMessage *reply;
- GPtrArray *result;
-
- reply = qmi_device_command_finish (device, res, &error);
- if (!reply) {
- g_prefix_error (&error, "Version info check failed: ");
- g_simple_async_result_take_error (simple, error);
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
- return;
- }
-
- /* Parse version reply */
- result = qmi_message_ctl_version_info_reply_parse (reply, &error);
- if (!result) {
- g_prefix_error (&error, "Version info reply parsing failed: ");
- g_simple_async_result_take_error (simple, error);
- } else
- g_simple_async_result_set_op_res_gpointer (simple,
- result,
- (GDestroyNotify)g_ptr_array_unref);
-
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
- qmi_message_unref (reply);
-}
-
-/**
- * qmi_client_ctl_get_version_info:
- * @self: a #QmiClientCtl.
- * @timeout: maximum time to wait to get the operation completed.
- * @cancellable: optional #GCancellable object, #NULL to ignore.
- * @callback: a #GAsyncReadyCallback to call when the operation is finished.
- * @user_data: the data to pass to callback function.
- *
- * Get list of supported services.
- * When the query is finished, @callback will be called. You can then call
- * qmi_client_ctl_get_version_info_finish() to get the the result of the operation.
- */
-void
-qmi_client_ctl_get_version_info (QmiClientCtl *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_ctl_get_version_info);
-
- request = qmi_message_ctl_version_info_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)));
- qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))),
- request,
- timeout,
- cancellable,
- (GAsyncReadyCallback)version_info_ready,
- result);
- qmi_message_unref (request);
-}
-
-/*****************************************************************************/
-/* Allocate CID */
-
-typedef struct {
- QmiClientCtl *self;
- GSimpleAsyncResult *result;
- QmiService service;
-} AllocateCidContext;
-
-static void
-allocate_cid_context_complete_and_free (AllocateCidContext *ctx)
-{
- g_simple_async_result_complete (ctx->result);
- g_object_unref (ctx->result);
- g_object_unref (ctx->self);
- g_slice_free (AllocateCidContext, ctx);
-}
-
-/**
- * qmi_client_ctl_allocate_cid_finish:
- * @self: a #QmiClientCtl.
- * @res: a #GAsyncResult.
- * @error: a #GError.
- *
- * Finishes an operation started with qmi_client_ctl_allocate_cid().
- *
- * Returns: the new CID, or 0 if @error is set.
- */
-guint8
-qmi_client_ctl_allocate_cid_finish (QmiClientCtl *self,
- GAsyncResult *res,
- GError **error)
-{
- if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
- return 0;
-
- return (guint8) GPOINTER_TO_UINT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
-}
-
-static void
-allocate_cid_ready (QmiDevice *device,
- GAsyncResult *res,
- AllocateCidContext *ctx)
-{
- GError *error = NULL;
- QmiMessage *reply;
- guint8 cid;
- QmiService service;
-
- reply = qmi_device_command_finish (device, res, &error);
- if (!reply) {
- g_prefix_error (&error, "CID allocation failed: ");
- g_simple_async_result_take_error (ctx->result, error);
- allocate_cid_context_complete_and_free (ctx);
- return;
- }
-
- /* Parse reply */
- cid = 0;
- service = QMI_SERVICE_UNKNOWN;
- if (!qmi_message_ctl_allocate_cid_reply_parse (reply, &cid, &service, &error)) {
- g_prefix_error (&error, "CID allocation reply parsing failed: ");
- g_simple_async_result_take_error (ctx->result, error);
- allocate_cid_context_complete_and_free (ctx);
- qmi_message_unref (reply);
- return;
- }
-
- /* The service we got must match the one we requested */
- if (service != ctx->service) {
- g_simple_async_result_set_error (ctx->result,
- QMI_CORE_ERROR,
- QMI_CORE_ERROR_FAILED,
- "Service mismatch (%s vs %s)",
- qmi_service_get_string (service),
- qmi_service_get_string (ctx->service));
- allocate_cid_context_complete_and_free (ctx);
- qmi_message_unref (reply);
- return;
- }
-
- g_debug ("Allocated client ID '%u' for service '%s'",
- cid,
- qmi_service_get_string (ctx->service));
-
- /* Set the CID as result */
- g_simple_async_result_set_op_res_gpointer (ctx->result,
- GUINT_TO_POINTER ((guint)cid),
- NULL);
- allocate_cid_context_complete_and_free (ctx);
- qmi_message_unref (reply);
-}
-
-/**
- * qmi_client_ctl_allocate_cid:
- * @self: a #QmiClientCtl.
- * @service: a #QmiService.
- * @timeout: maximum time to wait to get the operation completed.
- * @cancellable: optional #GCancellable object, #NULL to ignore.
- * @callback: a #GAsyncReadyCallback to call when the operation is finished.
- * @user_data: the data to pass to callback function.
- *
- * Allocate a new client ID for the given @service..
- * When the query is finished, @callback will be called. You can then call
- * qmi_client_ctl_allocate_cid_finish() to get the the result of the operation.
- */
-void
-qmi_client_ctl_allocate_cid (QmiClientCtl *self,
- QmiService service,
- guint timeout,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- AllocateCidContext *ctx;
- QmiMessage *request;
-
- ctx = g_slice_new (AllocateCidContext);
- ctx->self = g_object_ref (self);
- ctx->service = service;
- ctx->result = g_simple_async_result_new (G_OBJECT (self),
- callback,
- user_data,
- qmi_client_ctl_allocate_cid);
-
- request = qmi_message_ctl_allocate_cid_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)),
- service);
- qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))),
- request,
- timeout,
- cancellable,
- (GAsyncReadyCallback)allocate_cid_ready,
- ctx);
- qmi_message_unref (request);
-}
-
-/*****************************************************************************/
-/* Release CID */
-
-typedef struct {
- QmiClientCtl *self;
- GSimpleAsyncResult *result;
- QmiService service;
- guint8 cid;
-} ReleaseCidContext;
-
-static void
-release_cid_context_complete_and_free (ReleaseCidContext *ctx)
-{
- g_simple_async_result_complete (ctx->result);
- g_object_unref (ctx->result);
- g_object_unref (ctx->self);
- g_slice_free (ReleaseCidContext, ctx);
-}
-
-/**
- * qmi_client_ctl_release_cid_finish:
- * @self: a #QmiClientCtl.
- * @res: a #GAsyncResult.
- * @error: a #GError.
- *
- * Finishes an operation started with qmi_client_ctl_release_cid().
- *
- * Returns: #TRUE if the operation succeeded, or #FALSE if @error is set.
- */
-gboolean
-qmi_client_ctl_release_cid_finish (QmiClientCtl *self,
- GAsyncResult *res,
- GError **error)
-{
- return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
-}
-
-static void
-release_cid_ready (QmiDevice *device,
- GAsyncResult *res,
- ReleaseCidContext *ctx)
-{
- GError *error = NULL;
- QmiMessage *reply;
- guint8 cid;
- QmiService service;
-
- reply = qmi_device_command_finish (device, res, &error);
- if (!reply) {
- g_prefix_error (&error, "CID release failed: ");
- g_simple_async_result_take_error (ctx->result, error);
- release_cid_context_complete_and_free (ctx);
- return;
- }
-
- /* Parse reply */
- cid = 0;
- service = QMI_SERVICE_UNKNOWN;
- if (!qmi_message_ctl_release_cid_reply_parse (reply, &cid, &service, &error)) {
- g_prefix_error (&error, "CID release reply parsing failed: ");
- g_simple_async_result_take_error (ctx->result, error);
- release_cid_context_complete_and_free (ctx);
- qmi_message_unref (reply);
- return;
- }
-
- /* The service we got must match the one we requested */
- if (service != ctx->service) {
- g_simple_async_result_set_error (ctx->result,
- QMI_CORE_ERROR,
- QMI_CORE_ERROR_FAILED,
- "Service mismatch (%s vs %s)",
- qmi_service_get_string (service),
- qmi_service_get_string (ctx->service));
- release_cid_context_complete_and_free (ctx);
- qmi_message_unref (reply);
- return;
- }
-
- /* The cid we got must match the one we requested */
- if (cid != ctx->cid) {
- g_simple_async_result_set_error (ctx->result,
- QMI_CORE_ERROR,
- QMI_CORE_ERROR_FAILED,
- "CID mismatch (%s vs %s)",
- qmi_service_get_string (service),
- qmi_service_get_string (ctx->service));
- release_cid_context_complete_and_free (ctx);
- qmi_message_unref (reply);
- return;
- }
-
- g_debug ("Released client ID '%u' for service '%s'",
- cid,
- qmi_service_get_string (service));
-
- /* Set the CID as result */
- g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
- release_cid_context_complete_and_free (ctx);
- qmi_message_unref (reply);
-}
-
-/**
- * qmi_client_ctl_release_cid:
- * @self: a #QmiClientCtl.
- * @service: a #QmiService.
- * @cid: the client ID to release.
- * @timeout: maximum time to wait to get the operation completed.
- * @cancellable: optional #GCancellable object, #NULL to ignore.
- * @callback: a #GAsyncReadyCallback to call when the operation is finished.
- * @user_data: the data to pass to callback function.
- *
- * Release a previously allocated client ID for the given @service.
- * When the query is finished, @callback will be called. You can then call
- * qmi_client_ctl_release_cid_finish() to get the the result of the operation.
- */
-void
-qmi_client_ctl_release_cid (QmiClientCtl *self,
- QmiService service,
- guint8 cid,
- guint timeout,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- ReleaseCidContext *ctx;
- QmiMessage *request;
-
- ctx = g_slice_new (ReleaseCidContext);
- ctx->self = g_object_ref (self);
- ctx->service = service;
- ctx->cid = cid;
- ctx->result = g_simple_async_result_new (G_OBJECT (self),
- callback,
- user_data,
- qmi_client_ctl_release_cid);
-
- request = qmi_message_ctl_release_cid_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)),
- service,
- cid);
- qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))),
- request,
- timeout,
- cancellable,
- (GAsyncReadyCallback)release_cid_ready,
- ctx);
- qmi_message_unref (request);
-}
-
-/*****************************************************************************/
-/* Sync */
-
-/**
- * qmi_client_ctl_sync_finish:
- * @self: a #QmiClientCtl.
- * @res: a #GAsyncResult.
- * @error: a #GError.
- *
- * Finishes an operation started with qmi_client_ctl_sync().
- *
- * Returns: #TRUE if the operation succeeded, or #FALSE if @error is set.
- */
-gboolean
-qmi_client_ctl_sync_finish (QmiClientCtl *self,
- GAsyncResult *res,
- GError **error)
-{
- return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
-}
-
-static void
-sync_command_ready (QmiDevice *device,
- GAsyncResult *res,
- GSimpleAsyncResult *simple)
-{
- GError *error = NULL;
- QmiMessage *reply;
-
- reply = qmi_device_command_finish (device, res, &error);
- if (!reply)
- g_simple_async_result_take_error (simple, error);
- else {
- g_simple_async_result_set_op_res_gboolean (simple, TRUE);
- qmi_message_unref (reply);
- }
-
- g_simple_async_result_complete (simple);
- g_object_unref (simple);
-}
-
-/**
- * qmi_client_ctl_sync:
- * @self: a #QmiClientCtl.
- * @timeout: maximum time to wait to get the operation completed.
- * @cancellable: optional #GCancellable object, #NULL to ignore.
- * @callback: a #GAsyncReadyCallback to call when the operation is finished.
- * @user_data: the data to pass to callback function.
- *
- * Request to sync with the device.
- * When the operation is finished, @callback will be called. You can then call
- * qmi_client_ctl_sync_finish() to get the the result of the operation.
- */
-void
-qmi_client_ctl_sync (QmiClientCtl *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_ctl_sync);
-
- request = qmi_message_ctl_sync_new (qmi_client_get_next_transaction_id (QMI_CLIENT (self)));
- qmi_device_command (QMI_DEVICE (qmi_client_peek_device (QMI_CLIENT (self))),
- request,
- timeout,
- cancellable,
- (GAsyncReadyCallback)sync_command_ready,
- result);
- qmi_message_unref (request);
-}
-
-static void
-qmi_client_ctl_init (QmiClientCtl *self)
-{
-}
-
-static void
-qmi_client_ctl_class_init (QmiClientCtlClass *klass)
-{
-}
diff --git a/src/qmi-client-ctl.h b/src/qmi-client-ctl.h
deleted file mode 100644
index d264ab2d..00000000
--- a/src/qmi-client-ctl.h
+++ /dev/null
@@ -1,99 +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_CTL_H_
-#define _LIBQMI_GLIB_QMI_CLIENT_CTL_H_
-
-#include <glib-object.h>
-
-#include "qmi-client.h"
-#include "qmi-ctl.h"
-
-G_BEGIN_DECLS
-
-#define QMI_TYPE_CLIENT_CTL (qmi_client_ctl_get_type ())
-#define QMI_CLIENT_CTL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QMI_TYPE_CLIENT_CTL, QmiClientCtl))
-#define QMI_CLIENT_CTL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QMI_TYPE_CLIENT_CTL, QmiClientCtlClass))
-#define QMI_IS_CLIENT_CTL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QMI_TYPE_CLIENT_CTL))
-#define QMI_IS_CLIENT_CTL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QMI_TYPE_CLIENT_CTL))
-#define QMI_CLIENT_CTL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), QMI_TYPE_CLIENT_CTL, QmiClientCtlClass))
-
-typedef struct _QmiClientCtl QmiClientCtl;
-typedef struct _QmiClientCtlClass QmiClientCtlClass;
-
-struct _QmiClientCtl {
- QmiClient parent;
- gpointer priv_unused;
-};
-
-struct _QmiClientCtlClass {
- QmiClientClass parent;
-};
-
-GType qmi_client_ctl_get_type (void);
-
-/* Version info */
-void qmi_client_ctl_get_version_info (QmiClientCtl *self,
- guint timeout,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-GPtrArray *qmi_client_ctl_get_version_info_finish (QmiClientCtl *self,
- GAsyncResult *res,
- GError **error);
-
-/* Allocate CID */
-void qmi_client_ctl_allocate_cid (QmiClientCtl *self,
- QmiService service,
- guint timeout,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-guint8 qmi_client_ctl_allocate_cid_finish (QmiClientCtl *self,
- GAsyncResult *res,
- GError **error);
-
-/* Release CID */
-void qmi_client_ctl_release_cid (QmiClientCtl *self,
- QmiService service,
- guint8 cid,
- guint timeout,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean qmi_client_ctl_release_cid_finish (QmiClientCtl *self,
- GAsyncResult *res,
- GError **error);
-
-/* Sync */
-void qmi_client_ctl_sync (QmiClientCtl *self,
- guint timeout,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean qmi_client_ctl_sync_finish (QmiClientCtl *self,
- GAsyncResult *res,
- GError **error);
-
-G_END_DECLS
-
-#endif /* _LIBQMI_GLIB_QMI_CLIENT_CTL_H_ */
diff --git a/src/qmi-client.c b/src/qmi-client.c
index 509fe3a7..f3e6babe 100644
--- a/src/qmi-client.c
+++ b/src/qmi-client.c
@@ -26,7 +26,7 @@
#include "qmi-enum-types.h"
#include "qmi-device.h"
#include "qmi-client.h"
-#include "qmi-client-ctl.h"
+#include "qmi-ctl.h"
G_DEFINE_ABSTRACT_TYPE (QmiClient, qmi_client, G_TYPE_OBJECT);
diff --git a/src/qmi-ctl.h b/src/qmi-ctl.h
deleted file mode 100644
index ad1edbca..00000000
--- a/src/qmi-ctl.h
+++ /dev/null
@@ -1,62 +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_CTL_H_
-#define _LIBQMI_GLIB_QMI_CTL_H_
-
-#include <glib.h>
-
-#include "qmi-enums.h"
-
-G_BEGIN_DECLS
-
-/*****************************************************************************/
-/* Supported/known messages */
-typedef enum {
- QMI_CTL_MESSAGE_SET_INSTANCE_ID = 0x0020, /* unused currently */
- QMI_CTL_MESSAGE_GET_VERSION_INFO = 0x0021,
- QMI_CTL_MESSAGE_ALLOCATE_CLIENT_ID = 0x0022,
- QMI_CTL_MESSAGE_RELEASE_CLIENT_ID = 0x0023,
- QMI_CTL_MESSAGE_REVOKE_CLIENT_ID = 0x0024, /* unused currently */
- QMI_CTL_MESSAGE_INVALID_CLIENT_ID = 0x0025, /* unused currently */
- QMI_CTL_MESSAGE_SET_DATA_FORMAT = 0x0026, /* unused currently */
- QMI_CTL_MESSAGE_SYNC = 0x0027,
- QMI_CTL_MESSAGE_EVENT = 0x0028, /* unused currently */
- QMI_CTL_MESSAGE_SET_POWER_SAVE_CONFIG = 0x0029, /* unused currently */
- QMI_CTL_MESSAGE_SET_POWER_SAVE_MODE = 0x002A, /* unused currently */
- QMI_CTL_MESSAGE_GET_POWER_SAVE_MODE = 0x002B /* unused currently */
-} QmiCtlMessage;
-
-/*****************************************************************************/
-/* Version info */
-typedef struct _QmiCtlVersionInfo QmiCtlVersionInfo;
-QmiService qmi_ctl_version_info_get_service (QmiCtlVersionInfo *info);
-guint16 qmi_ctl_version_info_get_major_version (QmiCtlVersionInfo *info);
-guint16 qmi_ctl_version_info_get_minor_version (QmiCtlVersionInfo *info);
-
-QmiCtlVersionInfo *qmi_ctl_version_info_ref (QmiCtlVersionInfo *info);
-void qmi_ctl_version_info_unref (QmiCtlVersionInfo *info);
-
-G_END_DECLS
-
-#endif /* _LIBQMI_GLIB_QMI_CTL_H_ */
diff --git a/src/qmi-device.c b/src/qmi-device.c
index 42617ca9..631b1cbf 100644
--- a/src/qmi-device.c
+++ b/src/qmi-device.c
@@ -29,7 +29,7 @@
#include "qmi-device.h"
#include "qmi-message.h"
-#include "qmi-client-ctl.h"
+#include "qmi-ctl.h"
#include "qmi-client-dms.h"
#include "qmi-client-wds.h"
#include "qmi-utils.h"
@@ -60,7 +60,7 @@ struct _QmiDevicePrivate {
QmiClientCtl *client_ctl;
/* Supported services */
- GPtrArray *supported_services;
+ GArray *supported_services;
/* I/O channel, set when the file is open */
GIOChannel *iochannel;
@@ -424,8 +424,8 @@ qmi_device_allocate_client_finish (QmiDevice *self,
static void
build_client_object (AllocateClientContext *ctx)
{
- GError *error = NULL;
QmiClient *client;
+ GError *error = NULL;
/* We now have a proper CID for the client, we should be able to create it
* right away */
@@ -463,17 +463,37 @@ allocate_cid_ready (QmiClientCtl *client_ctl,
GAsyncResult *res,
AllocateClientContext *ctx)
{
+ QmiMessageCtlAllocateCidOutput *output;
+ QmiMessageCtlAllocateCidOutputAllocationInfo info;
GError *error = NULL;
- ctx->cid = qmi_client_ctl_allocate_cid_finish (client_ctl, res, &error);
- if (ctx->cid == QMI_CID_NONE) {
+ output = qmi_client_ctl_allocate_cid_finish (client_ctl, res, &error);
+ if (!output) {
g_prefix_error (&error, "CID allocation failed in the CTL client: ");
g_simple_async_result_take_error (ctx->result, error);
allocate_client_context_complete_and_free (ctx);
return;
}
+ g_assert (qmi_message_ctl_allocate_cid_output_get_allocation_info (output, &info, NULL));
+
+ if (info.service != ctx->service) {
+ g_simple_async_result_set_error (
+ ctx->result,
+ QMI_CORE_ERROR,
+ QMI_CORE_ERROR_FAILED,
+ "CID allocation failed in the CTL client: "
+ "Service mismatch (requested '%s', got '%s')",
+ qmi_service_get_string (ctx->service),
+ qmi_service_get_string (info.service));
+ allocate_client_context_complete_and_free (ctx);
+ qmi_message_ctl_allocate_cid_output_unref (output);
+ return;
+ }
+
+ ctx->cid = info.cid;
build_client_object (ctx);
+ qmi_message_ctl_allocate_cid_output_unref (output);
}
static gboolean
@@ -490,11 +510,13 @@ check_service_supported (QmiDevice *self,
}
for (i = 0; i < self->priv->supported_services->len; i++) {
- QmiCtlVersionInfo *info;
+ QmiMessageCtlGetVersionInfoOutputServiceListService *info;
- info = g_ptr_array_index (self->priv->supported_services, i);
+ info = &g_array_index (self->priv->supported_services,
+ QmiMessageCtlGetVersionInfoOutputServiceListService,
+ i);
- if (service == qmi_ctl_version_info_get_service (info))
+ if (service == info->service)
return TRUE;
}
@@ -584,13 +606,20 @@ qmi_device_allocate_client (QmiDevice *self,
/* Allocate a new CID for the client to be created */
if (cid == QMI_CID_NONE) {
+ QmiMessageCtlAllocateCidInput *input;
+
+ input = qmi_message_ctl_allocate_cid_input_new ();
+ qmi_message_ctl_allocate_cid_input_set_service (input, ctx->service, NULL);
+
g_debug ("Allocating new client ID...");
qmi_client_ctl_allocate_cid (self->priv->client_ctl,
- ctx->service,
+ input,
timeout,
cancellable,
(GAsyncReadyCallback)allocate_cid_ready,
ctx);
+
+ qmi_message_ctl_allocate_cid_input_unref (input);
return;
}
@@ -685,8 +714,7 @@ qmi_device_release_client (QmiDevice *self,
gpointer user_data)
{
ReleaseClientContext *ctx;
- guint8 cid;
- QmiService service;
+ QmiMessageCtlReleaseCidInputReleaseInfo info;
g_return_if_fail (QMI_IS_DEVICE (self));
g_return_if_fail (QMI_IS_CLIENT (client));
@@ -704,11 +732,11 @@ qmi_device_release_client (QmiDevice *self,
user_data,
qmi_device_release_client);
- cid = qmi_client_get_cid (client);
- service = qmi_client_get_service (client);
+ info.cid = qmi_client_get_cid (client);
+ info.service = (guint8)qmi_client_get_service (client);
/* Do not try to release an already released client */
- if (cid == QMI_CID_NONE) {
+ if (info.cid == QMI_CID_NONE) {
g_simple_async_result_set_error (ctx->result,
QMI_CORE_ERROR,
QMI_CORE_ERROR_INVALID_ARGS,
@@ -721,8 +749,8 @@ qmi_device_release_client (QmiDevice *self,
unregister_client (self, client);
g_debug ("Unregistered '%s' client with ID '%u'",
- qmi_service_get_string (service),
- cid);
+ qmi_service_get_string (info.service),
+ info.cid);
/* Reset the contents of the client object, making it unusable */
g_object_set (client,
@@ -732,14 +760,21 @@ qmi_device_release_client (QmiDevice *self,
NULL);
if (flags & QMI_DEVICE_RELEASE_CLIENT_FLAGS_RELEASE_CID) {
+ QmiMessageCtlReleaseCidInput *input;
+
+ /* And now, really try to release the CID */
+ input = qmi_message_ctl_release_cid_input_new ();
+ qmi_message_ctl_release_cid_input_set_release_info (input, info, NULL);
+
/* And now, really try to release the CID */
qmi_client_ctl_release_cid (self->priv->client_ctl,
- service,
- cid,
+ input,
timeout,
cancellable,
(GAsyncReadyCallback)client_ctl_release_cid_ready,
ctx);
+
+ qmi_message_ctl_release_cid_input_unref (input);
return;
}
@@ -749,7 +784,6 @@ qmi_device_release_client (QmiDevice *self,
return;
}
-
/*****************************************************************************/
/* Open device */
@@ -1063,8 +1097,10 @@ sync_ready (QmiClientCtl *client_ctl,
DeviceOpenContext *ctx)
{
GError *error = NULL;
+ QmiMessageCtlSyncOutput *output;
- if (!qmi_client_ctl_sync_finish (client_ctl, res, &error)) {
+ output = qmi_client_ctl_sync_finish (client_ctl, res, &error);
+ if(!output) {
g_prefix_error (&error, "Sync failed: ");
g_simple_async_result_take_error (ctx->result, error);
device_open_context_complete_and_free (ctx);
@@ -1076,6 +1112,8 @@ sync_ready (QmiClientCtl *client_ctl,
/* Keep on with next flags */
process_open_flags (ctx);
+
+ qmi_message_ctl_sync_output_unref (output);
}
static void
@@ -1083,33 +1121,48 @@ version_info_ready (QmiClientCtl *client_ctl,
GAsyncResult *res,
DeviceOpenContext *ctx)
{
+ QmiMessageCtlGetVersionInfoOutputResult result;
+ QmiMessageCtlGetVersionInfoOutput *output;
GError *error = NULL;
guint i;
- ctx->self->priv->supported_services = qmi_client_ctl_get_version_info_finish (client_ctl, res, &error);
- if (!ctx->self->priv->supported_services) {
+ output = qmi_client_ctl_get_version_info_finish (client_ctl, res, &error);
+ if (!output) {
g_prefix_error (&error, "Version info check failed: ");
g_simple_async_result_take_error (ctx->result, error);
device_open_context_complete_and_free (ctx);
return;
}
+ g_assert (qmi_message_ctl_get_version_info_output_get_result (
+ output,
+ &result,
+ NULL));
+
+ qmi_message_ctl_get_version_info_output_get_service_list (output,
+ &ctx->self->priv->supported_services,
+ NULL);
+
+
g_debug ("[%s] QMI Device supports %u services:",
ctx->self->priv->path_display,
ctx->self->priv->supported_services->len);
for (i = 0; i < ctx->self->priv->supported_services->len; i++) {
- QmiCtlVersionInfo *service;
+ QmiMessageCtlGetVersionInfoOutputServiceListService *info;
- service = g_ptr_array_index (ctx->self->priv->supported_services, i);
+ info = &g_array_index (ctx->self->priv->supported_services,
+ QmiMessageCtlGetVersionInfoOutputServiceListService,
+ i);
g_debug ("[%s] %s (%u.%u)",
ctx->self->priv->path_display,
- qmi_service_get_string (qmi_ctl_version_info_get_service (service)),
- qmi_ctl_version_info_get_major_version (service),
- qmi_ctl_version_info_get_minor_version (service));
+ qmi_service_get_string (info->service),
+ info->major_version,
+ info->minor_version);
}
/* Keep on with next flags */
process_open_flags (ctx);
+ qmi_message_ctl_get_version_info_output_unref (output);
}
static void
@@ -1120,6 +1173,7 @@ process_open_flags (DeviceOpenContext *ctx)
g_debug ("Checking version info...");
ctx->flags &= ~QMI_DEVICE_OPEN_FLAGS_VERSION_INFO;
qmi_client_ctl_get_version_info (ctx->self->priv->client_ctl,
+ NULL,
ctx->timeout,
ctx->cancellable,
(GAsyncReadyCallback)version_info_ready,
@@ -1132,6 +1186,7 @@ process_open_flags (DeviceOpenContext *ctx)
g_debug ("Running sync...");
ctx->flags &= ~QMI_DEVICE_OPEN_FLAGS_SYNC;
qmi_client_ctl_sync (ctx->self->priv->client_ctl,
+ NULL,
ctx->timeout,
ctx->cancellable,
(GAsyncReadyCallback)sync_ready,
@@ -1645,7 +1700,7 @@ finalize (GObject *object)
g_hash_table_unref (self->priv->registered_clients);
if (self->priv->supported_services)
- g_ptr_array_unref (self->priv->supported_services);
+ g_array_unref (self->priv->supported_services);
g_free (self->priv->path);
g_free (self->priv->path_display);
diff --git a/src/qmi-message-ctl.c b/src/qmi-message-ctl.c
deleted file mode 100644
index 51ed061a..00000000
--- a/src/qmi-message-ctl.c
+++ /dev/null
@@ -1,334 +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) 2011 - 2012 Red Hat, Inc.
- * Copyright (C) 2012 Aleksander Morgado <aleksander@lanedo.com>
- */
-
-#include <endian.h>
-
-#include "qmi-message-ctl.h"
-#include "qmi-enums.h"
-#include "qmi-error-types.h"
-
-/*****************************************************************************/
-/* Version info */
-
-/**
- * QmiCtlVersionInfo:
- *
- * An opaque type specifying a supported service.
- */
-struct _QmiCtlVersionInfo {
- volatile gint ref_count;
- QmiService service;
- guint16 major_version;
- guint16 minor_version;
-};
-
-/**
- * qmi_ctl_version_info_get_service:
- * @info: a #QmiCtlVersionInfo.
- *
- * Get the QMI service being reported.
- *
- * Returns: A #QmiService.
- */
-QmiService
-qmi_ctl_version_info_get_service (QmiCtlVersionInfo *info)
-{
- g_return_val_if_fail (info != NULL, QMI_SERVICE_UNKNOWN);
-
- return info->service;
-}
-
-/**
- * qmi_ctl_version_info_get_major_version:
- * @info: a #QmiCtlVersionInfo.
- *
- * Get the major version of the QMI service being reported.
- *
- * Returns: the major version.
- */
-guint16
-qmi_ctl_version_info_get_major_version (QmiCtlVersionInfo *info)
-{
- g_return_val_if_fail (info != NULL, 0);
-
- return info->major_version;
-}
-
-/**
- * qmi_ctl_version_info_get_minor_version:
- * @info: a #QmiCtlVersionInfo.
- *
- * Get the minor version of the QMI service being reported.
- *
- * Returns: the minor version.
- */
-guint16
-qmi_ctl_version_info_get_minor_version (QmiCtlVersionInfo *info)
-{
- g_return_val_if_fail (info != NULL, 0);
-
- return info->minor_version;
-}
-
-/**
- * qmi_ctl_version_info_ref:
- * @info: a #QmiCtlVersionInfo.
- *
- * Atomically increments the reference count of @info by one.
- *
- * Returns: the new reference to @info.
- */
-QmiCtlVersionInfo *
-qmi_ctl_version_info_ref (QmiCtlVersionInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
-
- g_atomic_int_inc (&info->ref_count);
- return info;
-}
-
-/**
- * qmi_ctl_version_info_unref:
- * @info: a #QmiCtlVersionInfo.
- *
- * Atomically decrements the reference count of array by one.
- * If the reference count drops to 0, @info is completely disposed.
- */
-void
-qmi_ctl_version_info_unref (QmiCtlVersionInfo *info)
-{
- g_return_if_fail (info != NULL);
-
- if (g_atomic_int_dec_and_test (&info->ref_count)) {
- g_slice_free (QmiCtlVersionInfo, info);
- }
-}
-
-QmiMessage *
-qmi_message_ctl_version_info_new (guint8 transaction_id)
-{
- return qmi_message_new (QMI_SERVICE_CTL,
- 0,
- transaction_id,
- QMI_CTL_MESSAGE_GET_VERSION_INFO);
-}
-
-struct qmi_ctl_version_info_list_service {
- guint8 service_type;
- guint16 major_version;
- guint16 minor_version;
-} __attribute__((__packed__));
-
-struct qmi_tlv_ctl_version_info_list {
- guint8 count;
- struct qmi_ctl_version_info_list_service services[0];
-}__attribute__((__packed__));
-
-GPtrArray *
-qmi_message_ctl_version_info_reply_parse (QmiMessage *self,
- GError **error)
-{
- struct qmi_tlv_ctl_version_info_list *service_list;
- struct qmi_ctl_version_info_list_service *svc;
- guint8 svcbuf[100];
- guint16 svcbuflen = 100;
- GPtrArray *result;
- guint i;
-
- g_assert (qmi_message_get_message_id (self) == QMI_CTL_MESSAGE_GET_VERSION_INFO);
-
- /* Abort if we got a QMI error reported */
- if (!qmi_message_get_response_result (self, error))
- return NULL;
-
- if (!qmi_message_tlv_get_varlen (self,
- 0x01,
- &svcbuflen,
- svcbuf,
- error)) {
- g_prefix_error (error, "Couldn't get services TLV: ");
- return NULL;
- }
-
- service_list = (struct qmi_tlv_ctl_version_info_list *) svcbuf;
- if (svcbuflen < (service_list->count * sizeof (struct qmi_ctl_version_info_list_service))) {
- g_set_error (error,
- QMI_CORE_ERROR,
- QMI_CORE_ERROR_FAILED,
- "Couldn't read the whole services list (%u < %" G_GSIZE_FORMAT ")",
- svcbuflen,
- (service_list->count * sizeof (struct qmi_ctl_version_info_list_service)));
- return NULL;
- }
-
- result = g_ptr_array_sized_new (service_list->count);
- g_ptr_array_set_free_func (result, (GDestroyNotify)qmi_ctl_version_info_unref);
-
- for (i = 0, svc = &(service_list->services[0]);
- i < service_list->count;
- i++, svc++) {
- QmiCtlVersionInfo *info;
-
- info = g_slice_new (QmiCtlVersionInfo);
- info->ref_count = 1;
- info->service = (QmiService)svc->service_type;
- info->major_version = le16toh (svc->major_version);
- info->minor_version = le16toh (svc->minor_version);
-
- g_ptr_array_add (result, info);
- }
-
- return result;
-}
-
-/*****************************************************************************/
-/* Allocate CID */
-
-QmiMessage *
-qmi_message_ctl_allocate_cid_new (guint8 transaction_id,
- QmiService service)
-{
- QmiMessage *message;
- guint8 service_id;
- GError *error = NULL;
-
- g_assert (service != QMI_SERVICE_UNKNOWN);
- service_id = service;
-
- message = qmi_message_new (QMI_SERVICE_CTL,
- 0,
- transaction_id,
- QMI_CTL_MESSAGE_ALLOCATE_CLIENT_ID);
-
- qmi_message_tlv_add (message,
- (guint8)0x01,
- sizeof (service_id),
- &service_id,
- &error);
- g_assert_no_error (error);
-
- return message;
-}
-
-struct qmi_ctl_cid {
- guint8 service_type;
- guint8 cid;
-} __attribute__((__packed__));
-
-gboolean
-qmi_message_ctl_allocate_cid_reply_parse (QmiMessage *self,
- guint8 *cid,
- QmiService *service,
- GError **error)
-{
- struct qmi_ctl_cid id;
-
- g_assert (qmi_message_get_message_id (self) == QMI_CTL_MESSAGE_ALLOCATE_CLIENT_ID);
-
- /* Abort if we got a QMI error reported */
- if (!qmi_message_get_response_result (self, error))
- return FALSE;
-
- if (!qmi_message_tlv_get (self, 0x01, sizeof (id), &id, error)) {
- g_prefix_error (error, "Couldn't get TLV: ");
- return FALSE;
- }
-
- if (cid)
- *cid = id.cid;
- if (service)
- *service = (QmiService)id.service_type;
-
- return TRUE;
-}
-
-/*****************************************************************************/
-/* Release CID */
-
-QmiMessage *
-qmi_message_ctl_release_cid_new (guint8 transaction_id,
- QmiService service,
- guint8 cid)
-{
- QmiMessage *message;
- GError *error = NULL;
- struct qmi_ctl_cid id;
-
- g_assert (service != QMI_SERVICE_UNKNOWN);
- id.service_type = (guint8)service;
- id.cid = cid;
-
- message = qmi_message_new (QMI_SERVICE_CTL,
- 0,
- transaction_id,
- QMI_CTL_MESSAGE_RELEASE_CLIENT_ID);
-
- qmi_message_tlv_add (message,
- (guint8)0x01,
- sizeof (id),
- &id,
- &error);
- g_assert_no_error (error);
-
- return message;
-}
-
-gboolean
-qmi_message_ctl_release_cid_reply_parse (QmiMessage *self,
- guint8 *cid,
- QmiService *service,
- GError **error)
-{
- struct qmi_ctl_cid id;
-
- g_assert (qmi_message_get_message_id (self) == QMI_CTL_MESSAGE_RELEASE_CLIENT_ID);
-
- /* Abort if we got a QMI error reported */
- if (!qmi_message_get_response_result (self, error))
- return FALSE;
-
- if (!qmi_message_tlv_get (self, 0x01, sizeof (id), &id, error)) {
- g_prefix_error (error, "Couldn't get TLV: ");
- return FALSE;
- }
-
- if (cid)
- *cid = id.cid;
- if (service)
- *service = (QmiService)id.service_type;
-
- return TRUE;
-}
-
-/*****************************************************************************/
-/* Sync */
-
-QmiMessage *
-qmi_message_ctl_sync_new (guint8 transaction_id)
-{
- return qmi_message_new (QMI_SERVICE_CTL,
- 0,
- transaction_id,
- QMI_CTL_MESSAGE_SYNC);
-}
diff --git a/src/qmi-message-ctl.h b/src/qmi-message-ctl.h
deleted file mode 100644
index 3670db7a..00000000
--- a/src/qmi-message-ctl.h
+++ /dev/null
@@ -1,67 +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_CTL_H_
-#define _LIBQMI_GLIB_QMI_MESSAGE_CTL_H_
-
-#include <glib.h>
-
-#include "qmi-ctl.h"
-#include "qmi-message.h"
-
-G_BEGIN_DECLS
-
-/*****************************************************************************/
-/* Version info */
-QmiMessage *qmi_message_ctl_version_info_new (guint8 transaction_id);
-GPtrArray *qmi_message_ctl_version_info_reply_parse (QmiMessage *self,
- GError **error);
-
-/*****************************************************************************/
-/* Allocate CID */
-QmiMessage *qmi_message_ctl_allocate_cid_new (guint8 transaction_id,
- QmiService service);
-gboolean qmi_message_ctl_allocate_cid_reply_parse (QmiMessage *self,
- guint8 *cid,
- QmiService *service,
- GError **error);
-
-/*****************************************************************************/
-/* Release CID */
-QmiMessage *qmi_message_ctl_release_cid_new (guint8 transaction_id,
- QmiService service,
- guint8 cid);
-gboolean qmi_message_ctl_release_cid_reply_parse (QmiMessage *self,
- guint8 *cid,
- QmiService *service,
- GError **error);
-
-/*****************************************************************************/
-/* Sync */
-QmiMessage *qmi_message_ctl_sync_new (guint8 transaction_id);
-
-G_END_DECLS
-
-#endif /* _LIBQMI_GLIB_QMI_MESSAGE_CTL_H_ */
diff --git a/src/qmi-message.c b/src/qmi-message.c
index d100cbd5..0e848669 100644
--- a/src/qmi-message.c
+++ b/src/qmi-message.c
@@ -647,6 +647,7 @@ qmi_message_new_from_raw (const guint8 *raw,
return self;
}
+#if 0
gchar *
qmi_message_get_printable (QmiMessage *self,
const gchar *line_prefix)
@@ -726,6 +727,7 @@ qmi_message_get_printable (QmiMessage *self,
return g_string_free (printable, FALSE);
}
+#endif
/*****************************************************************************/
/* QMI protocol errors handling */