aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-04-17 13:25:27 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 15:47:21 +0200
commit6ab3b7c32a14649b3c224edf43673afd2bef22dc (patch)
treec58cd15dfe2f05644078fbf0a049a85cc2985ded /src
parent5520616c9d5a94f5e43e363b10b10a09dde4865c (diff)
downloadexternal_libqmi-6ab3b7c32a14649b3c224edf43673afd2bef22dc.zip
external_libqmi-6ab3b7c32a14649b3c224edf43673afd2bef22dc.tar.gz
external_libqmi-6ab3b7c32a14649b3c224edf43673afd2bef22dc.tar.bz2
errors: setup a new QMI core error domain
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am20
-rw-r--r--src/libqmi-glib.h2
-rw-r--r--src/qmi-errors.h40
3 files changed, 60 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9bb46ad..5a5e858 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,12 +8,28 @@ libqmi_glib_la_CPPFLAGS = \
-I$(top_srcdir)/src \
-I$(top_builddir)/src
+# Error types
+qmi-error-types.h: qmi-errors.h $(top_srcdir)/build-aux/qmi-error-types-template.h
+ $(AM_V_GEN) $(GLIB_MKENUMS) \
+ --fhead "#ifndef __LIBQMI_GLIB_ERROR_TYPES_H__\n#define __LIBQMI_GLIB_ERROR_TYPES_H__\n#include \"qmi-errors.h\"\n" \
+ --template $(top_srcdir)/build-aux/qmi-error-types-template.h \
+ --ftail "#endif /* __LIBQMI_GLIB_ERROR_TYPES_H__ */\n" \
+ qmi-errors.h > $@
+
+qmi-error-types.c: qmi-errors.h qmi-error-types.h $(top_srcdir)/build-aux/qmi-error-types-template.c
+ $(AM_V_GEN) $(GLIB_MKENUMS) \
+ --fhead "#include \"qmi-errors.h\"\n#include \"qmi-error-types.h\"\n" \
+ --template $(top_srcdir)/build-aux/qmi-error-types-template.c \
+ qmi-errors.h > $@
+
libqmi_glib_la_SOURCES = \
- libqmi-glib.h
+ libqmi-glib.h \
+ qmi-errors.h qmi-error-types.h qmi-error-types.c
libqmi_glib_la_LIBADD = \
$(LIBQMI_GLIB_LIBS)
includedir = @includedir@/libqmi-glib
include_HEADERS = \
- libqmi-glib.h
+ libqmi-glib.h \
+ qmi-errors.h qmi-error-types.h
diff --git a/src/libqmi-glib.h b/src/libqmi-glib.h
index 9b938a7..5f3d63f 100644
--- a/src/libqmi-glib.h
+++ b/src/libqmi-glib.h
@@ -23,5 +23,7 @@
#ifndef _LIBQMI_GLIB_H_
#define _LIBQMI_GLIB_H_
+#include "qmi-errors.h"
+#include "qmi-error-types.h"
#endif /* _LIBQMI_GLIB_H_ */
diff --git a/src/qmi-errors.h b/src/qmi-errors.h
new file mode 100644
index 0000000..bba8411
--- /dev/null
+++ b/src/qmi-errors.h
@@ -0,0 +1,40 @@
+/* -*- 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_ERRORS_H_
+#define _LIBQMI_GLIB_QMI_ERRORS_H_
+
+/**
+ * QmiCoreError:
+ * @QMI_CORE_ERROR_FAILED: Operation failed.
+ * @QMI_CORE_ERROR_WRONG_STATE: Operation cannot be executed in the current state.
+ * @QMI_CORE_ERROR_INVALID_ARGS: Invalid arguments given.
+ *
+ * Common errors that may be reported by libqmi-glib.
+ */
+typedef enum {
+ QMI_CORE_ERROR_FAILED,
+ QMI_CORE_ERROR_WRONG_STATE,
+ QMI_CORE_ERROR_INVALID_ARGS,
+} QmiCoreError;
+
+#endif /* _LIBQMI_GLIB_QMI_ERRORS_H_ */