-GENIVI Boot Manager Coding Style
-================================
+GENIVI Node Startup Controller Coding Style
+===========================================
This document intends to give information about the coding style to be
-used when contributing code to the GENIVI Boot Manager. It does not
-claim to be complete. Parts of it are taken or inspired from the Clutter
-coding style document.
+used when contributing code to the GENIVI Node Startup Controller. It
+does not claim to be complete. Parts of it are taken or inspired from
+the Clutter coding style document.
In the following, the most important requirements for writing consistent
-code for the GENIVI Boot Manager are explained.
+code for the GENIVI Node Startup Controller are explained.
Table of Contents:
* Copyright and License Header
-GENIVI Boot Manager README
-==========================
+GENIVI Node Startup Controller README
+=====================================
-This is the official source repository of the GENIVI Boot Manager.
+This is the official source repository of the GENIVI Node Startup
+Controller.
At present, all relevant documentation for this project is available
in the GENIVI wiki on
------------------
The following libraries need to be installed in order to be able to
-build the boot manager:
+build the Node Startup Controller:
automotive-dlt >= 2.2.0
gio-2.0 >= 2.30.0
Build Instructions
------------------
-In order to build the boot manager, run the following:
+In order to build the Node Startup Controller, run the following:
gtkdocize &&
autoreconf -ivf &&
Install Instructions
--------------------
-To install the boot manager after having built it, run:
+To install the Node Startup Controller after having built it, run:
make install
Testing Instructions
--------------------
-To run any test suites shipped with the boot manager, run:
+To run any test suites shipped with the Node Startup Controller, run:
make check
There may also be some post-install tests that can only be performed
-after installing the boot manager into the system. Those can be
-executed with:
+after installing the Node Startup Controller into the system. Those
+can be executed with:
make installcheck
--interface-prefix org.genivi \
--c-namespace "" \
--generate-c-code la-handler-dbus \
- --annotate org.genivi.BootManager1.LegacyAppHandler org.gtk.GDBus.C.Name \
+ --annotate \
+ org.genivi.NodeStartupController1.LegacyAppHandler \
+ org.gtk.GDBus.C.Name \
LA_Handler $<
$(nsm_consumer_built_sources): nsm-consumer-dbus.xml Makefile
--interface-prefix com.contiautomotive.NodeStateManager \
--c-namespace "" \
--generate-c-code nsm-consumer-dbus \
- --annotate com.contiautomotive.NodeStateManager.Consumer \
+ --annotate \
+ com.contiautomotive.NodeStateManager.Consumer \
org.gtk.GDBus.C.Name NSM_Consumer $<
$(nsm_lifecycle_control_built_sources): nsm-lifecycle-control-dbus.xml Makefile
--interface-prefix com.contiautomotive.NodeStateManager \
--c-namespace "" \
--generate-c-code nsm-lifecycle-control-dbus \
- --annotate com.contiautomotive.NodeStateManager.LifecycleControl \
+ --annotate \
+ com.contiautomotive.NodeStateManager.LifecycleControl \
org.gtk.GDBus.C.Name NSM_Lifecycle_Control $<
$(shutdown_consumer_built_sources): shutdown-consumer-dbus.xml Makefile
--interface-prefix org.genivi \
--c-namespace "" \
--generate-c-code shutdown-consumer-dbus \
- --annotate com.contiautomotive.NodeStateManager.LifeCycleConsumer \
+ --annotate \
+ com.contiautomotive.NodeStateManager.LifeCycleConsumer \
org.gtk.GDBus.C.Name Shutdown_Consumer $<
<?xml version="1.0" encoding="UTF-8"?>
-<node name="/org/genivi/BootManager1/LegacyAppHandler">
+<node name="/org/genivi/NodeStartupController1/LegacyAppHandler">
<!--
org.genivi.LegacyAppHandler1:
@short_description: Interface for registering legacy apps with the NSM
performs a shutdown it can shut down the application in reverse
order of their creation.
-->
- <interface name="org.genivi.BootManager1.LegacyAppHandler">
+ <interface name="org.genivi.NodeStartupController1.LegacyAppHandler">
<!--
Register:
@unit: An application unit filename.
<?xml version="1.0" encoding="UTF-8"?>
<node>
<!--
- com.conti.NodeStateManager.Consumer:
- @short_description: Interface for testing the interaction between Boot
- Manager and Node State Manager.
- It is a summary of
- "com.conti.NodeStateManager.LifecycleControl" using
- only the methods needed to test Boot Manager.
+ com.contiautomotive.NodeStateManager.Consumer:
+ @short_description: Interface for testing the interaction between the
+ Node Startup Controller and the Node State Manager.
+ It is an excerpt of
+ "com.contiautomotive.NodeStateManager.LifecycleControl"
+ using only the methods needed to test the NSC.
-->
<interface name="com.contiautomotive.NodeStateManager.Consumer">
<!--
their DBUS object called NSMLifecycleRequest. This method will take one
parameter which is the Lifecycle Request (i.e. normal shutdown, fast
shutdown, runup). For an example of the required client interface
- please see the Boot Manager component who will be a client of the NSM.
+ please see the Node Startup Controller, which will be a client of
+ the NSM.
-->
<method name="RegisterShutdownClient">
<arg name="BusName" direction="in" type="s"/>
<arg name="ErrorCode" direction="out" type="i"/>
</method>
- <!--
+ <!--
LifecycleRequestComplete:
- @RequestId: The request Id of the called life cycle client. The value has been passed when "LifecycleRequest" was called.
- @Status: The result of the call to "LifecycleRequest". NsmErrorStatus_Ok: Request successfully processed. NsmErrorStatus_Error: An error occured while processing the "LifecycleRequest".
+ @RequestId: The request Id of the called life cycle client. The value
+ has been passed when "LifecycleRequest" was called.
+ @Status: The result of the call to "LifecycleRequest".
+ NsmErrorStatus_Ok: Request successfully processed.
+ NsmErrorStatus_Error: An error occured while processing
+ the "LifecycleRequest".
@ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The function has to be called by a "asynchrounous" lifecycle client, when he processed the "LifecycleRequest".
- -->
+
+ The function has to be called asynchrounously by a lifecycle client
+ when it has processed an earlier LifecycleRequest.
+ -->
<method name="LifecycleRequestComplete">
<arg name="RequestId" direction="in" type="u"/>
<arg name="Status" direction="in" type="i"/>
<?xml version="1.0" encoding="UTF-8"?>
<node>
<!--
- com.conti.NodeStateManager.LifecycleControl:
- @short_description: Interface for testing the interaction between Boot
- Manager and Node State Manager.
- It is a summary of
- "com.conti.NodeStateManager.LifecycleControl" using
- only the methods needed to test Boot Manager.
+ com.contiautomotive.NodeStateManager.LifecycleControl:
+ @short_description: Interface for testing the interaction between the
+ Node Startup Controller and the Node State Manager.
+ It is an excerpt of
+ "com.conti.NodeStateManager.LifecycleControl"
+ using only the methods needed to test the NSC.
-->
<interface name="com.contiautomotive.NodeStateManager.LifecycleControl">
<!--
SetNodeState:
@NodeStateId: The passed value will be based upon the enum
NSM_NodeState_e
- @ErrorCode
+ @ErrorCode:
The method is used by other applications to set the NodeState. When
this method is called to change the current NodeState a signal will be
@LucWanted: This will be a simple TRUE or FALSE to define whether the LUC
is wanted in the current Lifecycle
- This method will be called exclusivley by the Boot Manager to find out
- whether the LUC Applications should be started in the current
- Lifecycle. This is required whilst in certain Node Application Modes
- (i.e. Transport, Factory) we do not want the LUC Applications started.
- Internally the Node State Manager.
+ This method will be called exclusivley by the Node Startup Controller
+ to find out whether the LUC applications should be started in the
+ current lifecycle. This is required whilst in certain Node Application
+ Modes (i.e. Transport, Factory) we do not want the LUC applications
+ started.
-->
<method name="CheckLucRequired">
<arg name="LucWanted" direction="out" type="b"/>
DOC_MODULE=node-startup-controller
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
-DOC_MODULE_VERSION=$(BOOT_MANAGER_VERSION)
+DOC_MODULE_VERSION=$(NODE_STARTUP_CONTROLLER_VERSION)
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
<title>Description</title>
<para>
<command>legacy-app-handler</command> is a helper binary which registers the legacy
- app <arg>unit</arg> with the boot manager, which in turn registers a shutdown client
- with the Node State Manager.
- This means that during the Node State Manager's shutdown cycle, it will shut down
- the legacy app as well.
+ app <arg>unit</arg> with the Node Startup Controller, which in turn registers a
+ shutdown client with the Node State Manager. This means that during the Node State
+ Manager's shutdown cycle, it will shut down the legacy app as well.
</para>
<refsect2>
<title>Arguments</title>
# vi:set ts=8 sw=8 noet ai nocindent:
legacy_app_handlerdir = \
- $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)
+ $(libdir)/node-startup-controller-$(NODE_STARTUP_CONTROLLER_VERSION_API)
legacy_app_handler_PROGRAMS = \
legacy-app-handler
service =
la_handler_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
- "org.genivi.BootManager1",
- "/org/genivi/BootManager1/LegacyAppHandler",
+ "org.genivi.NodeStartupController1",
+ "/org/genivi/NodeStartupController1/LegacyAppHandler",
NULL, &error);
/* abort if the proxy could not be created */
# vi:set ts=8 sw=8 noet ai nocindent:
-boot_manager_confdir = $(sysconfdir)/dbus-1/system.d
+node_startup_controller_confdir = $(sysconfdir)/dbus-1/system.d
-boot_manager_conf_DATA = \
- org.genivi.BootManager1.conf
+node_startup_controller_conf_DATA = \
+ org.genivi.NodeStartupController1.conf
EXTRA_DIST = \
- org.genivi.BootManager1.conf
+ org.genivi.NodeStartupController1.conf
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
- <allow own="org.genivi.BootManager1"/>
- <allow send_destination="org.genivi.BootManager1" />
- <allow receive_sender="org.genivi.BootManager1" />
+ <allow own="org.genivi.NodeStartupController1"/>
+ <allow send_destination="org.genivi.NodeStartupController1" />
+ <allow receive_sender="org.genivi.NodeStartupController1" />
</policy>
</busconfig>
service->index = 1;
/* the string that precedes the index in the shutdown client's object path */
- service->prefix = "/org/genivi/BootManager1/ShutdownConsumer";
+ service->prefix = "/org/genivi/NodeStartupController1/ShutdownConsumer";
/* initialize the association of shutdown client to units */
service->units_to_clients = g_hash_table_new_full (g_str_hash, g_str_equal,
else
{
/* create a new shutdown client and consumer for the unit */
- bus_name = "org.genivi.BootManager1";
+ bus_name = "org.genivi.NodeStartupController1";
object_path = g_strdup_printf ("%s/%u", service->prefix, service->index);
client = shutdown_client_new (bus_name, object_path, shutdown_mode, timeout);
consumer = shutdown_consumer_skeleton_new ();
g_return_val_if_fail (LA_HANDLER_IS_SERVICE (service), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- /* announce the org.genivi.BootManager1.LegacyAppHandler service on the bus */
+ /* announce the org.genivi.NodeStartupController1.LegacyAppHandler service on the bus */
return g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (service->interface),
service->connection,
- "/org/genivi/BootManager1/LegacyAppHandler",
+ "/org/genivi/NodeStartupController1/LegacyAppHandler",
error);
}
&error);
if (error != NULL)
{
- if (error->code == G_IO_ERROR_NOT_FOUND)
- {
- DLT_LOG (controller_context, DLT_LOG_INFO,
- DLT_STRING ("Boot manager could not find the last user context"));
- }
- else
- {
- log_text = g_strdup_printf ("Error reading last user context: %s",
- error->message);
- DLT_LOG (controller_context, DLT_LOG_ERROR, DLT_STRING (log_text));
- g_free (log_text);
- }
+ log_text = g_strdup_printf ("Error reading last user context: %s", error->message);
+ DLT_LOG (controller_context, DLT_LOG_ERROR, DLT_STRING (log_text));
+ g_free (log_text);
g_error_free (error);
return;
}
busconf
nsm_dummydir = \
- $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)
+ $(libdir)/node-startup-controller-$(NODE_STARTUP_CONTROLLER_VERSION_API)
nsm_dummy_PROGRAMS = \
nsm-dummy
%.service: %.service.in
sed -e "s,\@libdir\@,$(libdir),g" \
- -e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
+ -e "s,\@NODE_STARTUP_CONTROLLER_VERSION_API\@,$(NODE_STARTUP_CONTROLLER_VERSION_API),g" < $< > $@
dbus_servicedir = $(datadir)/dbus-1/system-services
[D-BUS Service]
Name=com.contiautomotive.NodeStateManager
SystemdService = nsm-dummy.service
-Exec=@libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/nsm-dummy
+Exec=@libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/nsm-dummy
[D-BUS Service]
Name=com.contiautomotive.NodeStateManager
SystemdService = nsm-dummy.service
-Exec=@libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/nsm-dummy
+Exec=@libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/nsm-dummy
+++ /dev/null
-# vi:set ts=8 sw=8 noet ai nocindent:
-
-servicedir = $(datadir)/dbus-1/system-services
-
-service_in_files = \
- com.contiautomotive.NodeStateManager.Consumer.service.in \
- com.contiautomotive.NodeStateManager.LifecycleControl.service.in
-
-service_DATA = $(service_in_files:.service.in=.service)
-
-%.service: %.service.in
- sed -e "s,\@libdir\@,$(libdir),g" \
- -e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
-
-CLEANFILES = \
- $(service_DATA)
-
-EXTRA_DIST = \
- $(service_in_files)
[Service]
Type = dbus
BusName = com.contiautomotive.NodeStateManager
-ExecStart = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/nsm-dummy
+ExecStart = @libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/nsm-dummy
WatchdogSec = 5
+++ /dev/null
-# vi:set ts=8 sw=8 noet ai nocindent:
-
-systemd_servicedir = $(libdir)/systemd/system
-
-systemd_service_in_files = \
- nsm-dummy.service.in
-
-systemd_service_DATA = $(systemd_service_in_files:.service.in=.service)
-
-%.service: %.service.in
- sed -e "s,\@libdir\@,$(libdir),g" \
- -e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
-
-CLEANFILES = \
- $(systemd_service_DATA)
-
-EXTRA_DIST = \
- $(systemd_service_in_files)
%.service: %.service.in
sed -e "s,\@libdir\@,$(libdir),g" \
- -e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
+ -e "s,\@NODE_STARTUP_CONTROLLER_VERSION_API\@,$(NODE_STARTUP_CONTROLLER_VERSION_API),g" < $< > $@
CLEANFILES = \
*.service
def __init__(self, name):
bus_name = dbus.service.BusName(
- 'org.genivi.BootManager1.LegacyAppHandler.%s' % name,
+ 'org.genivi.NodeStartupController1.LegacyAppHandler.%s' % name,
bus=dbus.SystemBus())
- object_path = '/org/genivi/BootManager1/LegacyAppHandler/%s' % name
- dbus.service.Object.__init__(self, bus_name, object_path)
+ path = '/org/genivi/NodeStartupController1/LegacyAppHandler/%s' % name
+ dbus.service.Object.__init__(self, bus_name, path)
- @dbus.service.method('org.genivi.BootManager1.LegacyAppHandler.Test')
+ @dbus.service.method('org.genivi.NodeStartupController1.'
+ 'LegacyAppHandler.Test')
def hello(self):
return "Hello World!"
[Service]
-ExecStart = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler-test Test1
-ExecStartPost = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
+ExecStart = @libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/legacy-app-handler-test Test1
+ExecStartPost = @libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/legacy-app-handler \
--register --unit=legacy-app-handler-test1.service
[Service]
-ExecStart = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler-test Test2
-ExecStartPost = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
+ExecStart = @libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/legacy-app-handler-test Test2
+ExecStartPost = @libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/legacy-app-handler \
--register --unit=legacy-app-handler-test2.service
[Service]
-ExecStart = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler-test Test3
-ExecStartPost = @libdir@/boot-manager-@BOOT_MANAGER_VERSION_API@/legacy-app-handler \
+ExecStart = @libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/legacy-app-handler-test Test3
+ExecStartPost = @libdir@/node-startup-controller-@NODE_STARTUP_CONTROLLER_VERSION_API@/legacy-app-handler \
--register --unit=legacy-app-handler-test3.service
export LUC_PATH = last-user-context
-export BOOT_MANAGER_CMD = \
- $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)/boot-manager
+export NODE_STARTUP_CONTROLLER_CMD = \
+ $(libdir)/node-startup-controller-$(NODE_STARTUP_CONTROLLER_VERSION_API)/node-startup-controller
noinst_PROGRAMS = \
gvariant-writer
begin()
{
gdbus call --system \
- -d org.genivi.BootManager1 \
- -o /org/genivi/BootManager1/BootManager \
- -m org.genivi.BootManager1.BootManager.BeginLUCRegistration \
+ -d org.genivi.NodeStartupController1 \
+ -o /org/genivi/NodeStartupController1/NodeStartupController \
+ -m org.genivi.NodeStartupController1.NodeStartupController.BeginLUCRegistration \
&> /dev/null
}
register()
{
gdbus call --system \
- -d org.genivi.BootManager1 \
- -o /org/genivi/BootManager1/BootManager \
- -m org.genivi.BootManager1.BootManager.RegisterWithLUC \
+ -d org.genivi.NodeStartupController1 \
+ -o /org/genivi/NodeStartupController1/NodeStartupController \
+ -m org.genivi.NodeStartupController1.NodeStartupController.RegisterWithLUC \
"$1" &> /dev/null
}
end()
{
gdbus call --system \
- -d org.genivi.BootManager1 \
- -o /org/genivi/BootManager1/BootManager \
- -m org.genivi.BootManager1.BootManager.FinishLUCRegistration \
+ -d org.genivi.NodeStartupController1 \
+ -o /org/genivi/NodeStartupController1/NodeStartupController \
+ -m org.genivi.NodeStartupController1.NodeStartupController.FinishLUCRegistration \
&> /dev/null
}
rm -f "$LUC_PATH"
-# kill any existing instances of the boot manager
-skill -SIGKILL boot-manager 2>&1 >/dev/null
+# kill any existing instances of the Node Startup Controller
+skill -SIGKILL node-startup-controller 2>&1 >/dev/null
-# start the boot manager manually
-$BOOT_MANAGER_CMD &
+# start the Node Startup Controller manually
+$NODE_STARTUP_CONTROLLER_CMD &
-# wait for ten seconds, hoping the boot manager will become available
+# wait for ten seconds, hoping the Node Startup Controller will become available
sleep 2
-# kill the boot manager when the test script exits
-trap "skill -SIGKILL boot-manager 2>&1 >/dev/null" EXIT
+# kill the Node Startup Controller when the test script exits
+trap "skill -SIGKILL node-startup-controller 2>&1 >/dev/null" EXIT
# test a simple dictionary