summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2016-08-29 14:35:11 (GMT)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2016-09-06 13:44:21 (GMT)
commit6de9fc601b3c775dd6d27b435707eb9fe9244956 (patch)
tree7b55f977a6d7e5e855b29f6bef9a05216e77416f
parentba73c960c53def1383129e4ed3b75fa5f35308ba (diff)
downloadtraprain-6de9fc601b3c775dd6d27b435707eb9fe9244956.tar.gz
traprain-6de9fc601b3c775dd6d27b435707eb9fe9244956.tar.xz
mock-service: add D-Bus API
Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> Reviewed-by: Mathieu Duponchelle <mathieu.duponchelle@collabora.co.uk> Differential Revision: https://phabricator.apertis.org/D4178
-rw-r--r--Makefile.am31
-rw-r--r--dbus/org.apertis.Traprain1.Mock.xml63
2 files changed, 90 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index c4be1c8..6b08fdb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,14 +13,25 @@ bin_PROGRAMS =
# gdbus-coden internal library
noinst_LTLIBRARIES += dbus/libtraprain-codegen.la
-DBUS_XML_FILES = \
+NAV_DBUS_XML_FILES = \
dbus/org.apertis.Navigation1.Routes.xml \
dbus/org.apertis.Navigation1.Route.xml \
$(NULL)
+MOCK_DBUS_XML_FILES =\
+ dbus/org.apertis.Traprain1.Mock.xml \
+ $(NULL)
+
+DBUS_XML_FILES = \
+ $(NAV_DBUS_XML_FILES) \
+ $(MOCK_DBUS_XML_FILES) \
+ $(NULL)
+
dbus_libtraprain_codegen_la_SOURCES = \
dbus/org.apertis.Navigation1.c \
dbus/org.apertis.Navigation1.h \
+ dbus/org.apertis.Traprain1.Mock.c \
+ dbus/org.apertis.Traprain1.Mock.h \
$(NULL)
dbus_libtraprain_codegen_la_CPPFLAGS = \
@@ -49,19 +60,31 @@ dbus_libtraprain_codegen_la_LDFLAGS = \
# Needed to fix out-of-tree build as we are passing an explicit list of
# files to the gdbus-codegen rule.
# This is also needed when hotdoc is building out-of-tree as well.
-SRCDIR_DBUS_XML_FILES = $(addprefix $(top_srcdir)/,$(DBUS_XML_FILES))
+SRCDIR_NAV_DBUS_XML_FILES = $(addprefix $(top_srcdir)/,$(NAV_DBUS_XML_FILES))
+SRCDIR_MOCK_DBUS_XML_FILES = $(addprefix $(top_srcdir)/,$(MOCK_DBUS_XML_FILES))
+
+SRCDIR_DBUS_XML_FILES = \
+ $(SRCDIR_NAV_DBUS_XML_FILES) \
+ $(SRCDIR_MOCK_DBUS_XML_FILES) \
+ $(NULL)
# The "--c-generate-object-manager" option generates symbols such as
# trp_object_get_type() which don't depend on the interface name.
# Because of those we have to generate all the code in one gdbus-codegen shot
# to a single source/header file. Not doing so would result in those symbols
# being duplicated in each generated source/header.
-dbus/org.apertis.Navigation1.c dbus/org.apertis.Navigation1.h: $(DBUS_XML_FILES) Makefile
+dbus/org.apertis.Navigation1.c dbus/org.apertis.Navigation1.h: $(NAV_DBUS_XML_FILES) Makefile
$(AM_V_GEN)$(GDBUS_CODEGEN) \
--c-namespace=Trp \
--interface-prefix=org.apertis.Traprain \
--c-generate-object-manager \
- --generate-c-code=$* $(SRCDIR_DBUS_XML_FILES)
+ --generate-c-code=$* $(SRCDIR_NAV_DBUS_XML_FILES)
+
+dbus/org.apertis.Traprain1.Mock.c dbus/org.apertis.Traprain1.Mock.h: $(MOCK_DBUS_XML_FILES) Makefile
+ $(AM_V_GEN)$(GDBUS_CODEGEN) \
+ --c-namespace=Trp \
+ --interface-prefix=org.apertis.Traprain \
+ --generate-c-code=$* $(SRCDIR_MOCK_DBUS_XML_FILES)
EXTRA_DIST += \
$(DBUS_XML_FILES) \
diff --git a/dbus/org.apertis.Traprain1.Mock.xml b/dbus/org.apertis.Traprain1.Mock.xml
new file mode 100644
index 0000000..f346c75
--- /dev/null
+++ b/dbus/org.apertis.Traprain1.Mock.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
+<!--
+ org.apertis.Traprain1.Mock:
+ @short_description: Interface to control the Navigation mock service
+ @since: UNRELEASED
+
+ This API is meant to be implemented by Traprain's mock backend allowing
+ users to control the routes exposed by the service.
+
+ This interface should be implemented by the /org/apertis/Navigation1/Routes
+ object and its implementation should also claim the
+ org.apertis.Traprain1.Mock well-known name.
+-->
+
+<interface name="org.apertis.Traprain1.Mock">
+ <!--
+ AddRoute:
+ @Title: Mapping from language name to a human-readable title of the route in this language.
+ @TotalDistance: The total distance covered by the route, in metres.
+ @TotalTime: An estimation of the total time, in seconds, needed to travel along this route from start to destination
+ @Geometry: Array of latitude-longitude pairs in order, from the start point to the destination (inclusive)
+ @GeometryDescriptions: An array of pairs of index and description. Each key represents an index in the Geometry array and points to the human-readable descriptions, indexed by language, of this point.
+ @Index: the index of the newly added route
+ @since: UNRELEASED
+
+ Create and expose a new Route object as a potential route. See
+ org.apertis.Navigation1.Routes for the exact semantic of each argument.
+ -->
+ <method name="AddRoute">
+ <arg direction="in" type="a{ss}" name="Title" />
+ <arg direction="in" type="u" name="TotalDistance" />
+ <arg direction="in" type="u" name="TotalTime" />
+ <arg direction="in" type="a(dd)" name="Geometry" />
+ <arg direction="in" type="a{ua{ss}}" name="GeometryDescriptions" />
+ <arg direction="out" type="u" name="Index" />
+ </method>
+
+ <!--
+ RemoveRoute:
+ @Index: the index of the route to remove
+ @since: UNRELEASED
+
+ Remove a previously added route.
+ -->
+ <method name="RemoveRoute">
+ <arg direction="in" type="u" name="Index" />
+ </method>
+
+ <!--
+ SetCurrentRoute:
+ @Index: the index of the route
+ @since: UNRELEASED
+
+ Set a previously added route as the current one.
+ -->
+ <method name="SetCurrentRoute">
+ <arg direction="in" type="u" name="Index" />
+ </method>
+
+</interface>
+
+</node>