aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-04-20 15:43:30 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 15:47:22 +0200
commitb168d342237bba689090cd2fc4c1114137fdca0b (patch)
treeddf51da80150cb78dbed2a862580b45a56cc0843
parent75d3232d6e971db65c481dbbaaf042dc95bbae77 (diff)
downloadexternal_libqmi-b168d342237bba689090cd2fc4c1114137fdca0b.zip
external_libqmi-b168d342237bba689090cd2fc4c1114137fdca0b.tar.gz
external_libqmi-b168d342237bba689090cd2fc4c1114137fdca0b.tar.bz2
client-dms: new `QmiClientDms' to handle the DMS service
-rw-r--r--src/Makefile.am6
-rw-r--r--src/libqmi-glib.h1
-rw-r--r--src/qmi-client-dms.c81
-rw-r--r--src/qmi-client-dms.h63
4 files changed, 149 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 292eba7..b47e7f3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,7 +52,8 @@ libqmi_glib_la_SOURCES = \
qmi-message-ctl.h qmi-message-ctl.c \
qmi-device.h qmi-device.c \
qmi-client.h qmi-client.c \
- qmi-client-ctl.h qmi-client-ctl.c
+ qmi-client-ctl.h qmi-client-ctl.c \
+ qmi-client-dms.h qmi-client-dms.c
libqmi_glib_la_LIBADD = \
$(LIBQMI_GLIB_LIBS)
@@ -64,4 +65,5 @@ include_HEADERS = \
qmi-enums.h qmi-enum-types.h \
qmi-device.h \
qmi-client.h \
- qmi-client-ctl.h
+ qmi-client-ctl.h \
+ qmi-client-dms.h
diff --git a/src/libqmi-glib.h b/src/libqmi-glib.h
index 9dfd9b8..19b242d 100644
--- a/src/libqmi-glib.h
+++ b/src/libqmi-glib.h
@@ -30,5 +30,6 @@
#include "qmi-device.h"
#include "qmi-client.h"
#include "qmi-client-ctl.h"
+#include "qmi-client-dms.h"
#endif /* _LIBQMI_GLIB_H_ */
diff --git a/src/qmi-client-dms.c b/src/qmi-client-dms.c
new file mode 100644
index 0000000..0984ab5
--- /dev/null
+++ b/src/qmi-client-dms.c
@@ -0,0 +1,81 @@
+/* -*- 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-client-dms.h"
+
+G_DEFINE_TYPE (QmiClientDms, qmi_client_dms, QMI_TYPE_CLIENT);
+
+/*****************************************************************************/
+/* New DMS client */
+
+/**
+ * qmi_device_new_finish:
+ * @res: a #GAsyncResult.
+ * @error: a #GError.
+ *
+ * Finishes an operation started with qmi_device_new().
+ *
+ * Returns: A newly created #QmiDevice, or #NULL if @error is set.
+ */
+QmiClientDms *
+qmi_client_dms_new_finish (GAsyncResult *res,
+ GError **error)
+{
+ GObject *ret;
+ GObject *source_object;
+
+ source_object = g_async_result_get_source_object (res);
+ ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
+ g_object_unref (source_object);
+
+ return (ret ? QMI_CLIENT_DMS (ret) : NULL);
+}
+
+void
+qmi_client_dms_new (QmiDevice *device,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_async_initable_new_async (QMI_TYPE_CLIENT_DMS,
+ G_PRIORITY_DEFAULT,
+ cancellable,
+ callback,
+ user_data,
+ QMI_CLIENT_DEVICE, device,
+ QMI_CLIENT_SERVICE, QMI_SERVICE_DMS,
+ NULL);
+}
+
+/*****************************************************************************/
+
+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
new file mode 100644
index 0000000..5d5fb02
--- /dev/null
+++ b/src/qmi-client-dms.h
@@ -0,0 +1,63 @@
+/* -*- 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"
+
+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);
+
+/* New DMS client */
+void qmi_client_dms_new (QmiDevice *device,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+QmiClientDms *qmi_client_dms_new_finish (GAsyncResult *res,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* _LIBQMI_GLIB_QMI_CLIENT_DMS_H_ */