Define D-Bus interface for Shutdown Consumers
authorJonathan Maw <jonathan.maw@codethink.co.uk>
Wed, 27 Jun 2012 10:07:47 +0000 (11:07 +0100)
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>
Fri, 29 Jun 2012 12:28:56 +0000 (13:28 +0100)
Shutdown Consumers are D-Bus objects that exist for every application
that does not have a Shutdown() method, and are registered with the Node
State Manager (NSM).

When the NSM shuts down, it calls Shutdown() to all Shutdown Consumers
in reverse order to their registration. For legacy applications, a
Shutdown Consumer is created and registered with the NSM.

When the Shutdown Consumer is told to shut down, it shuts down the
legacy application by signalling the Boot Manager.

common/Makefile.am
common/shutdown-consumer-dbus.xml [new file with mode: 0644]

index 4608d52..4564797 100644 (file)
@@ -2,11 +2,19 @@
 
 noinst_LTLIBRARIES = libcommon.la
 
+libcommon_la_built_headers =                                           \
+       shutdown-consumer-dbus.h
+
+libcommon_la_built_sources =                                           \
+       shutdown-consumer-dbus.c                                        \
+       $(libcommon_la_built_headers)
+
 libcommon_la_SOURCES =                                                 \
        glib-extensions.c                                               \
        glib-extensions.h                                               \
        watchdog-client.c                                               \
-       watchdog-client.h
+       watchdog-client.h                                               \
+       $(libcommon_la_built_sources)
 
 libcommon_la_CFLAGS =                                                  \
        -DG_LOG_DOMAIN=\"common\"                                       \
@@ -28,3 +36,19 @@ libcommon_la_LIBADD =                                                        \
        $(GLIB_LIBS)                                                    \
        $(SYSTEMD_DAEMON_LIBS)
 
+EXTRA_DIST =                                                           \
+       shutdown-consumer-dbus.xml
+
+DISTCLEANFILES =                                                       \
+       $(libcommon_la_built_sources)
+
+BUILT_SOURCES =                                                                \
+       $(libcommon_la_built_headers)
+
+shutdown-consumer-dbus.h: shutdown-consumer-dbus.xml Makefile
+       $(AM_V_GEN) $(GDBUS_CODEGEN)                                    \
+           --interface-prefix org.genivi                               \
+           --c-namespace ""                                            \
+           --generate-c-code shutdown-consumer-dbus                    \
+           --annotate org.genivi.lifecycle.ShutdownConsumer1 org.gtk.GDBus.C.Name      \
+             Shutdown_Consumer $<
diff --git a/common/shutdown-consumer-dbus.xml b/common/shutdown-consumer-dbus.xml
new file mode 100644 (file)
index 0000000..b793002
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node>
+  <!--
+    org.genivi.lifecycle.ShutdownConsumer1:
+    @short_description: Interface for receiving Shutdown commands from the NSM
+
+    Shutdown Consumers are D-Bus object which are created to shut down apps
+    which do not have a Shutdown() D-Bus method to call. These are registered
+    with the Node State Manager (NSM) instead of the apps and shut down those
+    apps when Shutdown() is called on the Shutdown Consumer.
+  -->
+  <interface name="org.genivi.lifecycle.ShutdownConsumer1">
+    <!--
+      Shutdown:
+
+      Shuts down the app the ShutdownConsumer is associated with.
+    -->
+    <method name="Shutdown">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+    </method>
+
+  </interface>
+</node>