summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Anton Beier <ralf.anton.beier@continental-corporation.com>2013-04-10 10:57:18 +0200
committerRalf Anton Beier <ralf.anton.beier@continental-corporation.com>2013-04-10 10:57:18 +0200
commitc9ebf0f95499509922c74e55e2eed8192f35e493 (patch)
tree205eb4c505f73d1220259b09dc0e54e5f2a19e46
parent34cc2424117938708bbcf9c7c51024adb46bacdb (diff)
downloadnode-state-manager-c9ebf0f95499509922c74e55e2eed8192f35e493.tar.gz
Release NodeStateManager 1.2.0.0
Signed-off-by: Ralf Anton Beier <ralf.anton.beier@continental-corporation.com>
-rw-r--r--ChangeLog3
-rw-r--r--Makefile.am7
-rw-r--r--NodeStateAccess/Makefile.am61
-rw-r--r--NodeStateAccess/NodeStateAccess.c1287
-rw-r--r--NodeStateAccess/NodeStateAccess.h (renamed from NodeStateAccessStub/NodeStateAccess.h)8
-rw-r--r--NodeStateAccess/model/org.genivi.NodeStateManager.Consumer.xml (renamed from NodeStateAccessStub/model/org.genivi.NodeStateManager.Consumer.xml)18
-rw-r--r--NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleConsumer.xml (renamed from NodeStateAccessStub/model/org.genivi.NodeStateManager.LifecycleConsumer.xml)18
-rw-r--r--NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleControl.xml (renamed from NodeStateAccessStub/model/org.genivi.NodeStateManager.LifecycleControl.xml)18
-rw-r--r--NodeStateAccessStub/Makefile.am27
-rw-r--r--NodeStateAccessStub/NodeStateAccess.c189
-rw-r--r--NodeStateMachineStub/Makefile.am4
-rw-r--r--NodeStateManager/Makefile.am21
-rw-r--r--NodeStateManager/NodeStateManager.c65
-rw-r--r--NodeStateManager/config/node-state-manager.pc.in13
-rw-r--r--NodeStateManager/config/nodestatemanager-daemon.service.in11
-rw-r--r--NodeStateTest/Makefile.am62
-rw-r--r--NodeStateTest/NodeStateMachineTest.c305
-rw-r--r--NodeStateTest/NodeStateMachineTest.h134
-rw-r--r--NodeStateTest/NodeStateTest.c3466
-rw-r--r--NodeStateTest/org.genivi.NodeStateMachineTest.xml37
-rw-r--r--README14
-rwxr-xr-xautogen.sh25
-rw-r--r--configure.ac87
23 files changed, 5555 insertions, 325 deletions
diff --git a/ChangeLog b/ChangeLog
index e69de29..29568d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -0,0 +1,3 @@
+15th Mar. 2013, Jean-Pierre Bogler:
+ - Introduced NodeStateAccess
+ - Introduced NodeStateTest
diff --git a/Makefile.am b/Makefile.am
index 5a485fe..2352391 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,8 +12,13 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
+# Date Author Reason
+# 24.01.2013 Jean-Pierre Bogler Added NodeStateTest to sub directories
+# 14.03.2013 Jean-Pierre Bogler Updated usage for real NodeStateAccess library
+#
#######################################################################################################################
-SUBDIRS = NodeStateAccessStub NodeStateMachineStub NodeStateManager
+ACLOCAL_AMFLAGS=-I m4
+SUBDIRS = NodeStateAccess NodeStateMachineStub NodeStateManager NodeStateTest
diff --git a/NodeStateAccess/Makefile.am b/NodeStateAccess/Makefile.am
new file mode 100644
index 0000000..d7d846d
--- /dev/null
+++ b/NodeStateAccess/Makefile.am
@@ -0,0 +1,61 @@
+################################################################################
+#
+# Copyright (C) 2012 Continental Automotive Systems, Inc.
+#
+# Author: Jean-Pierre.Bogler@continental-corporation.com
+#
+# Makefile template for the NodeStateAccess library
+#
+# Process this file with automake to produce a Makefile.in.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+###############################################################################
+
+lib_LTLIBRARIES = libNodeStateAccess.la
+
+libNodeStateAccess_la_SOURCES = NodeStateAccess.c \
+ generated/NodeStateConsumer.c \
+ generated/NodeStateLifecycleControl.c \
+ generated/NodeStateLifecycleConsumer.c
+
+libNodeStateAccess_la_CFLAGS = -I generated \
+ $(GIO_CFLAGS) \
+ $(GIO_UNIX_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(GOBJECT_CFLAGS) \
+ $(NSM_CFLAGS)
+
+libNodeStateAccess_la_LIBDADD = $(GIO_LIBS) \
+ $(GIO_UNIX_LIBS) \
+ $(GLIB_LIBS) \
+ $(GOBJECT_LIBS)
+
+libNodeStateAccess_la_LDFLAGS = -avoid-version
+
+# List generated headers here to assert that they are available when built is started
+BUILT_SOURCES = generated/NodeStateConsumer.h \
+ generated/NodeStateLifecycleControl.h \
+ generated/NodeStateLifecycleConsumer.h
+
+# Delete all generated files on 'make clean'
+CLEANFILES = generated/NodeStateConsumer.c \
+ generated/NodeStateConsumer.h \
+ generated/NodeStateLifecycleControl.c \
+ generated/NodeStateLifecycleControl.h \
+ generated/NodeStateLifecycleConsumer.c \
+ generated/NodeStateLifecycleConsumer.h
+
+# Targets to create generated sources during the build
+generated/NodeStateConsumer.c generated/NodeStateConsumer.h: model/org.genivi.NodeStateManager.Consumer.xml
+ gdbus-codegen --interface-prefix=org.genivi.NodeStateManager. --c-namespace=NodeState --generate-c-code=generated/NodeStateConsumer --generate-docbook=doc/NodeStateConsumer model/org.genivi.NodeStateManager.Consumer.xml
+
+generated/NodeStateLifecycleControl.c generated/NodeStateLifecycleControl.h: model/org.genivi.NodeStateManager.LifecycleControl.xml
+ gdbus-codegen --interface-prefix=org.genivi.NodeStateManager. --c-namespace=NodeState --generate-c-code=generated/NodeStateLifecycleControl --generate-docbook=doc/LifecycleControl model/org.genivi.NodeStateManager.LifecycleControl.xml
+
+generated/NodeStateLifecycleConsumer.c generated/NodeStateLifecycleConsumer.h: model/org.genivi.NodeStateManager.LifecycleConsumer.xml
+ gdbus-codegen --interface-prefix=org.genivi.NodeStateManager. --c-namespace=NodeState --generate-c-code=generated/NodeStateLifecycleConsumer --generate-docbook=doc/LifecycleConsumer model/org.genivi.NodeStateManager.LifecycleConsumer.xml
+
+
diff --git a/NodeStateAccess/NodeStateAccess.c b/NodeStateAccess/NodeStateAccess.c
new file mode 100644
index 0000000..85a5284
--- /dev/null
+++ b/NodeStateAccess/NodeStateAccess.c
@@ -0,0 +1,1287 @@
+/**********************************************************************************************************************
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* Interface between NodeStateManager and IPC
+*
+* This source file is a part of the NodeStateAccess library (NSMA).
+* The architecture requires that the NodeStateManager (NSM) is independent from the D-Bus binding and code generated by
+* "gdbus-codegen". Therefore, the D-Bus communication and generated D-Bus objects are handled inside of this library.
+* The library offers the NSM an interface to use objects generated via gdbus-codgen.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* Date Author Reason
+* 24.10.2012 Jean-Pierre Bogler CSP_WZ#1322: Initial creation
+* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Fixed bug. LifecycleRequestComnplete did not send dbus response.
+*
+**********************************************************************************************************************/
+
+
+/**********************************************************************************************************************
+*
+* Header includes
+*
+**********************************************************************************************************************/
+
+/* generic includes for the NodeStateAccess library */
+#include "gio/gio.h" /* glib types */
+#include "NodeStateAccess.h" /* own header */
+#include "NodeStateTypes.h" /* Type defintions of the NSM */
+
+/* additional includes to use D-Bus */
+#include "string.h" /* memcpy, memset, etc. */
+#include "NodeStateConsumer.h" /* generated NodeStateConsumer object */
+#include "NodeStateLifecycleControl.h" /* generated LifecycleControl object */
+#include "NodeStateLifecycleConsumer.h" /* generated LifecycleConsumer object */
+
+
+/**********************************************************************************************************************
+*
+* Local variables
+*
+**********************************************************************************************************************/
+
+/* Variables to handle main loop and bus connection */
+static GMainLoop *NSMA__pMainLoop = NULL;
+static GDBusConnection *NSMA__pBusConnection = NULL;
+static gboolean NSMA__boLoopEndByUser = FALSE;
+static guint NSMA__u32ConnectionId = 0;
+static gboolean NSMA__boInitialized = FALSE;
+
+/* Variables to handle life cycle client calls */
+static guint NSMA__u32TimerId = 0;
+static NodeStateLifeCycleConsumer *NSMA__pCurrentLcConsumer = NULL;
+
+/* Variables for D-Bus objects */
+static NodeStateConsumer *NSMA__pNodeStateConsumerObj = NULL;
+static NodeStateLifecycleControl *NSMA__pLifecycleControlObj = NULL;
+
+/* Structure with callback functions to the NSM */
+static NSMA_tstObjectCallbacks NSMA__stObjectCallbacks = {0};
+
+
+/**********************************************************************************************************************
+*
+* Prototypes for file local functions (see implementation for description)
+*
+**********************************************************************************************************************/
+
+/* Internal D-Bus callbacks */
+static gboolean NSMA__boOnHandleSetBootMode (NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32BootMode,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleSetNodeState (NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32NodeStateId,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleSetApplicationMode (NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32ApplicationModeId,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleRequestNodeRestart (NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32RestartReason,
+ const guint i32RestartType,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleCheckLucRequired (NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleRegisterSession (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sSessionName,
+ const gchar *sSessionOwner,
+ const gint i32SeatId,
+ const gint i32SessionState,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleUnRegisterSession (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sSessionName,
+ const gchar *sSessionOwner,
+ const gint i32SeatId,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleRegisterLifecycleClient (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar* sBusName,
+ const gchar* sObjName,
+ const guint u32ShutdownMode,
+ const guint u32TimeoutMs,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleUnRegisterLifecycleClient(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar* sBusName,
+ const gchar* sObjName,
+ const guint u32ShutdownMode,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleLifecycleRequestComplete (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const guint u32RequestId,
+ const gint i32Status,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleGetApplicationMode (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleGetSessionState (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sSessionName,
+ const gint i32SeatId,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleSetSessionState (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sSessionName,
+ const gchar *sSessionOwner,
+ const gint i32SeatId,
+ const gint i32SessionState,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleGetNodeState (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleSetAppHealthStatus (NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sAppName,
+ const gboolean boAppState,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleGetAppHealthCount (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData);
+static gboolean NSMA__boOnHandleGetInterfaceVersion (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData);
+
+/* Internal bus connection callbacks */
+static void NSMA__vOnBusAcquired (GDBusConnection *pConnection, const gchar* sName, gpointer pUserData);
+static void NSMA__vOnNameAcquired(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData);
+static void NSMA__vOnNameLost (GDBusConnection *pConnection, const gchar* sName, gpointer pUserData);
+
+/* Internal callback for async. life cycle client returns */
+static void NSMA__vOnLifecycleRequestFinish(GObject *pSrcObject, GAsyncResult *pRes, gpointer pUserData);
+
+
+/**********************************************************************************************************************
+*
+* Local (static) functions
+*
+**********************************************************************************************************************/
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when the "boot mode" should be set.
+*
+* @param pLifecycleControl: Pointer to a LifecycleControl object
+* @param pInvocation: Pointer to method invocation object
+* @param i32BootMode: New boot mode
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleSetBootMode(NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32BootMode,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfSetBootModeCb(i32BootMode);
+
+ node_state_lifecycle_control_complete_set_boot_mode(pLifecycleControl, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when the "node state" should be set.
+*
+* @param pLifecycleControl: Pointer to a LifecycleControl object
+* @param pInvocation: Pointer to method invocation object
+* @param i32NodeStateId: New node state
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleSetNodeState(NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32NodeStateId,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfSetNodeStateCb((NsmNodeState_e) i32NodeStateId);
+
+ node_state_lifecycle_control_complete_set_node_state(pLifecycleControl, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when the "application mode" should be set.
+*
+* @param pLifecycleControl: Pointer to a LifecycleControl object
+* @param pInvocation: Pointer to method invocation object
+* @param i32ApplicationModeId: New application mode
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleSetApplicationMode(NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32ApplicationModeId,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfSetAppModeCb((NsmApplicationMode_e) i32ApplicationModeId);
+
+ node_state_lifecycle_control_complete_set_application_mode(pLifecycleControl, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when the node should be reset.
+*
+* @param pLifecycleControl: Pointer to a LifecycleControl object
+* @param pInvocation: Pointer to method invocation object
+* @param i32RestartReason: Restart reason
+* @param i32RestartType: Restart type
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleRequestNodeRestart(NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32RestartReason,
+ const guint u32RestartType,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfRequestNodeRestartCb((NsmRestartReason_e) i32RestartReason, u32RestartType);
+
+ node_state_lifecycle_control_complete_request_node_restart(pLifecycleControl, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when a check for LUC is required.
+*
+* @param pLifecycleControl: Pointer to a LifecycleControl object
+* @param pInvocation: Pointer to method invocation object
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleCheckLucRequired(NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData)
+{
+ gboolean boLucRequired = FALSE;
+
+ boLucRequired = NSMA__stObjectCallbacks.pfCheckLucRequiredCb();
+
+ node_state_lifecycle_control_complete_check_luc_required(pLifecycleControl, pInvocation, boLucRequired);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called when an application has become invalid or valid again.
+*
+* @param pLifecycleControl: Caller of the D-Bus interface
+* @param pInvocation: Pointer to the interface invocation
+* @param sAppName: Application which changed its state.
+* @param boAppState: Indicates whether the application has become invalid or valid again.
+* @param pUserData: Optionally user data (not used)
+*
+* @return TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleSetAppHealthStatus(NodeStateLifecycleControl *pLifecycleControl,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sAppName,
+ const gboolean boAppState,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfSetAppHealthStatusCb(sAppName, boAppState);
+
+ node_state_lifecycle_control_complete_set_app_health_status(pLifecycleControl, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when a new session should be registered.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to method invocation object
+* @param sSessionName: Name of the new session
+* @param i32SessionState: Initial state of the new session
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleRegisterSession(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sSessionName,
+ const gchar *sSessionOwner,
+ const gint i32SeatId,
+ const gint i32SessionState,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfRegisterSessionCb(sSessionName,
+ sSessionOwner,
+ (NsmSeat_e) i32SeatId,
+ (NsmSessionState_e) i32SessionState);
+
+ node_state_consumer_complete_register_session(pConsumer, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when a session should be unregistered.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to method invocation object
+* @param sSessionName: Name of the new session
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleUnRegisterSession (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sSessionName,
+ const gchar *sSessionOwner,
+ const gint i32SeatId,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfUnRegisterSessionCb(sSessionName, sSessionOwner, (NsmSeat_e) i32SeatId);
+
+ node_state_consumer_complete_un_register_session(pConsumer, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when a lifecycle client should be registered.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to method invocation object
+* @param sBusName: Bus name of the remote application that hosts the lifecycle client interface
+* @param sObjName: Object name of the lifecycle client
+* @param u32ShutdownMode: Shutdown mode for which the client wants to be informed
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleRegisterLifecycleClient (NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sBusName,
+ const gchar *sObjName,
+ const guint u32ShutdownMode,
+ const guint u32TimeoutMs,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfRegisterLifecycleClientCb(sBusName,
+ sObjName,
+ u32ShutdownMode,
+ u32TimeoutMs);
+
+ node_state_consumer_complete_register_shutdown_client(pConsumer, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop, when a lifecycle client should be unregistered or a shutdown
+* mode should be removed.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to method invocation object
+* @param sBusName: Bus name of the remote application that hosts the lifecycle client interface
+* @param sObjName: Object name of the lifecycle client
+* @param u32ShutdownMode: Shutdown mode for which the client wants to unregister
+* @param pUserData: Optionally user data (not used)
+*
+* @return: TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleUnRegisterLifecycleClient(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sBusName,
+ const gchar *sObjName,
+ const guint u32ShutdownMode,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfUnRegisterLifecycleClientCb(sBusName, sObjName, u32ShutdownMode);
+
+ node_state_consumer_complete_un_register_shutdown_client(pConsumer, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop when the application mode needs to be retrieved.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to a method invocation object
+* @param pUserData: Pointer to optional user data (not used)
+*
+* @return TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleGetApplicationMode(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+ NsmApplicationMode_e enApplicationMode = NsmApplicationMode_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfGetAppModeCb(&enApplicationMode);
+
+ node_state_consumer_complete_get_application_mode(pConsumer,
+ pInvocation,
+ (gint) enApplicationMode,
+ (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop a session state should be retrieved.
+*
+* @param pConsumer: Caller of the D-Bus interface
+* @param pInvocation: Pointer to the interface invocation
+* @param sSessionName: Name of the session whose state just be returned
+* @param sSessionName: Owner of the session whose state just be returned
+* @param i32SeatId: Seat of the session
+* @param i32SessionState: New state of the session
+*
+* @return TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleGetSessionState(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sSessionName,
+ const gint i32SeatId,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+ NsmSessionState_e enSessionState = NsmSessionState_Unregistered;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfGetSessionStateCb(sSessionName, (NsmSeat_e) i32SeatId, &enSessionState);
+
+ node_state_consumer_complete_get_session_state(pConsumer, pInvocation, (gint) enSessionState, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop when a session state should be set.
+*
+* @param pConsumer: Caller of the D-Bus interface
+* @param pInvocation: Pointer to the interface invocation
+* @param sSessionName: Name of the session whose state just be set
+* @param i32SeatId: Seat of the session
+* @param i32SessionState: New state of the session
+*
+* @return TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleSetSessionState(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const gchar *sSessionName,
+ const gchar *sSessionOwner,
+ const gint i32SeatId,
+ const gint i32SessionState,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfSetSessionStateCb(sSessionName,
+ sSessionOwner,
+ (NsmSeat_e) i32SeatId,
+ (NsmSessionState_e) i32SessionState);
+
+ node_state_consumer_complete_set_session_state(pConsumer, pInvocation, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop when the NodeState needs to be retrieved.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to a method invocation object
+* @param pUserData: Pointer to optional user data (not used)
+*
+* @return TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleGetNodeState(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+ NsmNodeState_e enNodeState = NsmNodeState_NotSet;
+
+ enErrorStatus = NSMA__stObjectCallbacks.pfGetNodeStateCb(&enNodeState);
+
+ node_state_consumer_complete_get_node_state(pConsumer, pInvocation, (gint) enNodeState, (gint) enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop when the AppHealthCount (number of failed applications) needs to
+* be retrieved.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to a method invocation object
+* @param pUserData: Pointer to optional user data (not used)
+*
+* @return TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleGetAppHealthCount(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData)
+{
+ guint u32AppHealthCount = 0;
+
+ u32AppHealthCount = NSMA__stObjectCallbacks.pfGetAppHealthCountCb();
+
+ node_state_consumer_complete_get_app_health_count(pConsumer, pInvocation, u32AppHealthCount);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop when the interface version needs to be retrieved.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to a method invocation object
+* @param pUserData: Pointer to optional user data (not used)
+*
+* @return TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleGetInterfaceVersion(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData)
+{
+ guint u32InterfaceVersion = 0;
+
+ u32InterfaceVersion = NSMA__stObjectCallbacks.pfGetInterfaceVersionCb();
+
+ node_state_consumer_complete_get_interface_version(pConsumer, pInvocation, u32InterfaceVersion);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called when a connection to the D-Bus could be established.
+*
+* @param pConnection: Connection, which was acquired
+* @param sName: Bus name
+* @param pUserData: Optionally user data
+*
+* @return void
+*
+**********************************************************************************************************************/
+static void NSMA__vOnBusAcquired(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData)
+{
+ /* Store the connection. Needed later, to create life cycle clients. */
+ NSMA__pBusConnection = pConnection;
+
+ /* Register the callbacks */
+ (void) g_signal_connect(NSMA__pLifecycleControlObj, "handle-set-boot-mode", G_CALLBACK(NSMA__boOnHandleSetBootMode), NULL);
+ (void) g_signal_connect(NSMA__pLifecycleControlObj, "handle-set-node-state", G_CALLBACK(NSMA__boOnHandleSetNodeState), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-get-node-state", G_CALLBACK(NSMA__boOnHandleGetNodeState), NULL);
+ (void) g_signal_connect(NSMA__pLifecycleControlObj, "handle-set-application-mode", G_CALLBACK(NSMA__boOnHandleSetApplicationMode), NULL);
+ (void) g_signal_connect(NSMA__pLifecycleControlObj, "handle-request-node-restart", G_CALLBACK(NSMA__boOnHandleRequestNodeRestart), NULL);
+ (void) g_signal_connect(NSMA__pLifecycleControlObj, "handle-check-luc-required", G_CALLBACK(NSMA__boOnHandleCheckLucRequired), NULL);
+ (void) g_signal_connect(NSMA__pLifecycleControlObj, "handle-set-app-health-status", G_CALLBACK(NSMA__boOnHandleSetAppHealthStatus), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-register-session", G_CALLBACK(NSMA__boOnHandleRegisterSession), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-un-register-session", G_CALLBACK(NSMA__boOnHandleUnRegisterSession), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-register-shutdown-client", G_CALLBACK(NSMA__boOnHandleRegisterLifecycleClient), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-un-register-shutdown-client", G_CALLBACK(NSMA__boOnHandleUnRegisterLifecycleClient), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-get-application-mode", G_CALLBACK(NSMA__boOnHandleGetApplicationMode), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-get-session-state", G_CALLBACK(NSMA__boOnHandleGetSessionState), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-set-session-state", G_CALLBACK(NSMA__boOnHandleSetSessionState), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-get-app-health-count", G_CALLBACK(NSMA__boOnHandleGetAppHealthCount), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-get-interface-version", G_CALLBACK(NSMA__boOnHandleGetInterfaceVersion), NULL);
+ (void) g_signal_connect(NSMA__pNodeStateConsumerObj, "handle-lifecycle-request-complete", G_CALLBACK(NSMA__boOnHandleLifecycleRequestComplete), NULL);
+
+ /* Export the interfaces */
+ if(g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(NSMA__pNodeStateConsumerObj),
+ NSMA__pBusConnection,
+ NSM_CONSUMER_OBJECT,
+ NULL) == TRUE)
+ {
+ if(g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(NSMA__pLifecycleControlObj),
+ NSMA__pBusConnection,
+ NSM_LIFECYCLE_OBJECT,
+ NULL) != TRUE)
+ {
+ /* Error: The LifecycleControl interface could not be exported */
+ NSMA__boLoopEndByUser = FALSE;
+ g_main_loop_quit(NSMA__pMainLoop);
+ }
+ }
+ else
+ {
+ /* Error: The NodeStateConsumer interface could not be exported */
+ NSMA__boLoopEndByUser = FALSE;
+ g_main_loop_quit(NSMA__pMainLoop);
+ }
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called when the "bus name" could be acquired on the D-Bus.
+*
+* @param pConnection: Connection over which the bus name was acquired
+* @param sName: Acquired bus name
+* @param pUserData: Optionally user data
+*
+* @return void
+*
+**********************************************************************************************************************/
+static void NSMA__vOnNameAcquired(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData)
+{
+ /* There is nothing to do in this function, it is only need as callback function. */
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called if either no connection to D-Bus could be established or the bus name could not be acquired.
+*
+* @param pConnection: Connection. If it is NULL, no D-Bus connection could be established.
+* Otherwise the bus name was lost.
+* @param sName: Bus name
+* @param pUserData: Optionally user data
+*
+* @return void
+*
+**********************************************************************************************************************/
+static void NSMA__vOnNameLost(GDBusConnection *pConnection, const gchar* sName, gpointer pUserData)
+{
+ /* If this function was called, either the bus connection could not be established or the bus name could
+ * not be obtained. In both cases, stop the main loop.
+ */
+
+ NSMA__boLoopEndByUser = FALSE;
+ g_main_loop_quit(NSMA__pMainLoop);
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called when the async. call to a life cycle clients "LifecycleRequest" method timed out.
+*
+* @param pUserData: Optionally user data (not used)
+*
+* @return FALSE: Tell the loop to detach and destroy the time out source.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boHandleRequestTimeout(gpointer pUserData)
+{
+ NSMA__pCurrentLcConsumer = NULL;
+ NSMA__stObjectCallbacks.pfLcClientRequestFinish(NsmErrorStatus_Error);
+
+ return FALSE;
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called when the async. call to a life cycle clients "LifecycleRequest" method delivered a value.
+* If the returned error code is not "NsmErrorStatus_ResponsePending", the error code will be forwarded to the NSM.
+* Otherwise, a timer will be started and the life cycle client will get another "default timeout" time, to call
+* the completion function "NSMA__boOnHandleLifecycleRequestComplete".
+*
+* @param pSrcObject: Source object that delivered the async. value
+* @param pRes: Result of the call.
+* @param pUserData: Optionally user data (not used).
+*
+**********************************************************************************************************************/
+static void NSMA__vOnLifecycleRequestFinish(GObject *pSrcObject, GAsyncResult *pRes, gpointer pUserData)
+{
+ /* Function local variables. */
+ NsmErrorStatus_e enErrorCode = NsmErrorStatus_NotSet; /* Error returned by lifecycle client */
+ guint u32Timeout = 0;
+
+ /* Pass proxy object and async. result to get the return value of the lifecycle client's method and D-Bus errors. */
+
+ /* Check if a D-Bus error occurred */
+ if(node_state_life_cycle_consumer_call_lifecycle_request_finish(NODE_STATE_LIFE_CYCLE_CONSUMER(pSrcObject),
+ (gint*) &enErrorCode,
+ pRes,
+ NULL) == TRUE)
+ {
+ /* The returned value could be read, check it! */
+ if(enErrorCode == NsmErrorStatus_ResponsePending)
+ {
+ /* The client returned response pending. Start timer to wait for final result. */
+ u32Timeout = g_dbus_proxy_get_default_timeout(G_DBUS_PROXY(pSrcObject));
+ NSMA__u32TimerId = g_timeout_add_full(G_PRIORITY_DEFAULT, u32Timeout, &NSMA__boHandleRequestTimeout, NULL, NULL);
+ }
+ else
+ {
+ /* The client returned a final value. Pass it to the NSM */
+ NSMA__pCurrentLcConsumer = NULL;
+ NSMA__stObjectCallbacks.pfLcClientRequestFinish(enErrorCode);
+ }
+ }
+ else
+ {
+ /* The clients return value could not be read. Pass an error to the NSM. */
+ NSMA__pCurrentLcConsumer = NULL;
+ NSMA__stObjectCallbacks.pfLcClientRequestFinish(NsmErrorStatus_Dbus);
+ }
+}
+
+
+/**********************************************************************************************************************
+*
+* The function is called from the g_main_loop when a life cycle client finished an "asynchronous" life cycle request.
+*
+* @param pConsumer: Pointer to a NodeStateConsumer object
+* @param pInvocation: Pointer to a method invocation object
+* @param u32RequestId: Request ID that has been passed to client when calling his LifecycleRequest method
+* @param i32Status: Status/Return value of the client.
+*
+* @return TRUE: Tell D-Bus that method succeeded.
+* FALSE: Let D-Bus send an error.
+*
+**********************************************************************************************************************/
+static gboolean NSMA__boOnHandleLifecycleRequestComplete(NodeStateConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const guint u32RequestId,
+ const gint i32Status,
+ gpointer pUserData)
+{
+ NsmErrorStatus_e enErrorStatus = NsmErrorStatus_NotSet;
+
+ /* Check if the client is the one, we are waiting for. */
+ if(NSMA__pCurrentLcConsumer == (NodeStateLifeCycleConsumer*) u32RequestId)
+ {
+ enErrorStatus = NsmErrorStatus_Ok;
+ /* The client is the expected one. Pass the status to the NSM. */
+ NSMA__stObjectCallbacks.pfLcClientRequestFinish((NsmErrorStatus_e) i32Status);
+
+ /* Remove the timeout timer (the expected client returned) */
+ g_source_remove(NSMA__u32TimerId);
+ }
+ else
+ {
+ enErrorStatus = NsmErrorStatus_Error;
+ }
+
+ node_state_consumer_complete_lifecycle_request_complete(pConsumer, pInvocation, enErrorStatus);
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* Interfaces. Exported functions. See Header for detailed description.
+*
+**********************************************************************************************************************/
+
+gboolean NSMA_boInit(const NSMA_tstObjectCallbacks *pstCallbacks)
+{
+ /* Initialize glib types */
+ g_type_init();
+
+ /* Initialize file local variables */
+ NSMA__pMainLoop = NULL;
+ NSMA__pBusConnection = NULL;
+ NSMA__u32ConnectionId = 0;
+ NSMA__boLoopEndByUser = FALSE;
+ NSMA__boInitialized = FALSE;
+
+ NSMA__pCurrentLcConsumer = NULL;
+
+ NSMA__pLifecycleControlObj = NULL;
+ NSMA__pNodeStateConsumerObj = NULL;
+
+ memset(&NSMA__stObjectCallbacks, 0, sizeof(NSMA_tstObjectCallbacks));
+
+ /* Check if all callbacks for the NSM have been configured. */
+ if( (pstCallbacks->pfSetBootModeCb != NULL)
+ && (pstCallbacks->pfSetNodeStateCb != NULL)
+ && (pstCallbacks->pfSetAppModeCb != NULL)
+ && (pstCallbacks->pfRequestNodeRestartCb != NULL)
+ && (pstCallbacks->pfSetAppHealthStatusCb != NULL)
+ && (pstCallbacks->pfCheckLucRequiredCb != NULL)
+ && (pstCallbacks->pfRegisterSessionCb != NULL)
+ && (pstCallbacks->pfUnRegisterSessionCb != NULL)
+ && (pstCallbacks->pfRegisterLifecycleClientCb != NULL)
+ && (pstCallbacks->pfUnRegisterLifecycleClientCb != NULL)
+ && (pstCallbacks->pfGetAppModeCb != NULL)
+ && (pstCallbacks->pfGetSessionStateCb != NULL)
+ && (pstCallbacks->pfGetNodeStateCb != NULL)
+ && (pstCallbacks->pfSetNodeStateCb != NULL)
+ && (pstCallbacks->pfSetSessionStateCb != NULL)
+ && (pstCallbacks->pfGetAppHealthCountCb != NULL)
+ && (pstCallbacks->pfGetInterfaceVersionCb != NULL)
+ && (pstCallbacks->pfLcClientRequestFinish != NULL))
+ {
+ /* All callbacks are configured. */
+ NSMA__boInitialized = TRUE;
+
+ /* Store the passed callbacks. */
+ memcpy(&NSMA__stObjectCallbacks, pstCallbacks, sizeof(NSMA_tstObjectCallbacks));
+
+ /* Create a new main loop */
+ NSMA__pMainLoop = g_main_loop_new(NULL, FALSE);
+
+ /* Create D-Bus skeleton objects */
+ NSMA__pNodeStateConsumerObj = node_state_consumer_skeleton_new();
+ NSMA__pLifecycleControlObj = node_state_lifecycle_control_skeleton_new();
+ }
+ else
+ {
+ /* Error: Callbacks are configured incorrectly. */
+ NSMA__boInitialized = FALSE;
+ }
+
+ return NSMA__boInitialized;
+}
+
+
+gboolean NSMA_boWaitForEvents(void)
+{
+ /* Check if the library has been initialized (objects and callbacks are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ /* Start D-Bus connection sequence */
+ NSMA__u32ConnectionId = g_bus_own_name((GBusType) NSM_BUS_TYPE,
+ NSM_BUS_NAME,
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ &NSMA__vOnBusAcquired,
+ &NSMA__vOnNameAcquired,
+ &NSMA__vOnNameLost,
+ NULL,
+ NULL);
+
+ /* Run main loop to get D-Bus connection and export objects. The function will only return,
+ * if there was an internal error or it has been cancelled by the user.
+ */
+ g_main_loop_run(NSMA__pMainLoop);
+ }
+ else
+ {
+ /* Error: The library has not been initialized. Callbacks and objects are invalid. */
+ NSMA__boLoopEndByUser = FALSE;
+ }
+
+ /* Return if function has been cancelled by user (TRUE) or because of an error (FALSE) */
+ return NSMA__boLoopEndByUser;
+}
+
+
+gboolean NSMA_boSendNodeStateSignal(const NsmNodeState_e enNodeState)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Send the signal */
+ node_state_consumer_emit_node_state(NSMA__pNodeStateConsumerObj, (gint) enNodeState);
+ }
+ else
+ {
+ /* Error: Library not initialized (objects are invalid) */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boSendSessionSignal(const NsmSession_s *pstSession)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Send the signal */
+ node_state_consumer_emit_session_state_changed(NSMA__pNodeStateConsumerObj,
+ pstSession->sName,
+ (gint) pstSession->enSeat,
+ (gint) pstSession->enState);
+ }
+ else
+ {
+ /* Error: Library not initialized (objects are invalid) */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boSendApplicationModeSignal(const NsmApplicationMode_e enApplicationMode)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Send the signal */
+ node_state_consumer_emit_node_application_mode(NSMA__pNodeStateConsumerObj, (gint) enApplicationMode);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boSetBootMode(gint i32BootMode)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Set the properties value */
+ node_state_consumer_set_boot_mode(NSMA__pNodeStateConsumerObj, i32BootMode);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boGetBootMode(gint *pi32BootMode)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Get the properties value */
+ *pi32BootMode = node_state_consumer_get_boot_mode(NSMA__pNodeStateConsumerObj);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boSetRunningReason(const NsmRunningReason_e enRunningReason)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Set the properties value */
+ node_state_consumer_set_wake_up_reason(NSMA__pNodeStateConsumerObj, (gint) enRunningReason);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boGetRunningReason(NsmRunningReason_e *penRunningReason)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Get the properties value */
+ *penRunningReason = (NsmRunningReason_e) node_state_consumer_get_wake_up_reason(NSMA__pNodeStateConsumerObj);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boSetShutdownReason(const NsmShutdownReason_e enShutdownReason)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Set the properties value */
+ node_state_consumer_set_shutdown_reason(NSMA__pNodeStateConsumerObj, (gint) enShutdownReason);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boGetShutdownReason(NsmShutdownReason_e *penShutdownReason)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Get the properties value */
+ *penShutdownReason = (NsmShutdownReason_e) node_state_consumer_get_shutdown_reason(NSMA__pNodeStateConsumerObj);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boSetRestartReason(const NsmRestartReason_e enRestartReason)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Set the properties value */
+ node_state_consumer_set_restart_reason(NSMA__pNodeStateConsumerObj, (gint) enRestartReason);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boGetRestartReason(NsmRestartReason_e *penRestartReason)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ boRetVal = TRUE; /* Get the properties value */
+ *penRestartReason = (NsmRestartReason_e) node_state_consumer_get_restart_reason(NSMA__pNodeStateConsumerObj);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boQuitEventLoop(void)
+{
+ gboolean boRetVal = FALSE;
+
+ /* Check if the library has been initialized (objects are available) */
+ if(NSMA__boInitialized == TRUE)
+ {
+ NSMA__boLoopEndByUser = TRUE;
+ g_main_loop_quit(NSMA__pMainLoop);
+ }
+ else
+ {
+ /* Error: Library not initialized. Objects are invalid. */
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMA_boFreeLcConsumerProxy(NSMA_tLcConsumerHandle hLcConsumer)
+{
+ g_object_unref(hLcConsumer);
+
+ return TRUE;
+}
+
+
+NSMA_tLcConsumerHandle NSMA_hCreateLcConsumer(const gchar* sBusName,
+ const gchar* sObjName,
+ const guint u32TimeoutMs)
+{
+ NodeStateLifeCycleConsumer *pConsumerProxy = NULL;
+
+ pConsumerProxy = node_state_life_cycle_consumer_proxy_new_sync(NSMA__pBusConnection,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
+ | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ sBusName,
+ sObjName,
+ NULL,
+ NULL);
+
+ if(pConsumerProxy != NULL)
+ {
+ g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(pConsumerProxy), u32TimeoutMs);
+ }
+
+ return (NSMA_tLcConsumerHandle) pConsumerProxy;
+}
+
+
+
+gboolean NSMA_boCallLcClientRequest(NSMA_tLcConsumerHandle hLcClient,
+ guint u32ShutdownType)
+{
+
+ NSMA__pCurrentLcConsumer = (NodeStateLifeCycleConsumer*) hLcClient;
+
+ node_state_life_cycle_consumer_call_lifecycle_request(NSMA__pCurrentLcConsumer,
+ u32ShutdownType,
+ (guint) NSMA__pCurrentLcConsumer,
+ NULL,
+ &NSMA__vOnLifecycleRequestFinish,
+ NULL);
+ return TRUE;
+}
+
+
+gboolean NSMA_boSetLcClientTimeout(NSMA_tLcConsumerHandle hClient, guint u32TimeoutMs)
+{
+ g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(hClient), u32TimeoutMs);
+
+ return TRUE;
+}
+
+
+gboolean NSMA_boGetLcClientTimeout(NSMA_tLcConsumerHandle hClient, guint *pu32TimeoutMs)
+{
+ *pu32TimeoutMs = g_dbus_proxy_get_default_timeout(G_DBUS_PROXY(hClient));
+
+ return TRUE;
+}
+
+
+gboolean NSMA_boDeInit(void)
+{
+ NSMA__boInitialized = FALSE;
+
+ g_bus_unown_name(NSMA__u32ConnectionId);
+ g_main_loop_unref(NSMA__pMainLoop);
+
+ /* Release the (created) skeleton objects */
+ if(NSMA__pNodeStateConsumerObj != NULL)
+ {
+ g_object_unref(NSMA__pNodeStateConsumerObj);
+ }
+
+ if(NSMA__pLifecycleControlObj != NULL)
+ {
+ g_object_unref(NSMA__pLifecycleControlObj);
+ }
+
+ return TRUE;
+}
diff --git a/NodeStateAccessStub/NodeStateAccess.h b/NodeStateAccess/NodeStateAccess.h
index 96beb25..f66861f 100644
--- a/NodeStateAccessStub/NodeStateAccess.h
+++ b/NodeStateAccess/NodeStateAccess.h
@@ -9,10 +9,10 @@
*
* Interface between NodeStateManager and IPC
*
-* This header file is a part of the NodeStateAccess library (NSMA) stub.
-* The architecture requires that the NodeStateManager (NSM) is independent
-* from the D-Bus binding and generated code. The interface functions of the
-* library have to be implemented according to their description.
+* This header file is a part of the NodeStateAccess library (NSMA).
+* The architecture requires that the NodeStateManager (NSM) is independent from the D-Bus binding and code generated by
+* "gdbus-codegen". Therefore, the D-Bus communication and generated D-Bus objects are handled inside of this library.
+* The library offers the NSM an interface to use objects generated via gdbus-codgen.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
diff --git a/NodeStateAccessStub/model/org.genivi.NodeStateManager.Consumer.xml b/NodeStateAccess/model/org.genivi.NodeStateManager.Consumer.xml
index e5845d3..dea85d0 100644
--- a/NodeStateAccessStub/model/org.genivi.NodeStateManager.Consumer.xml
+++ b/NodeStateAccess/model/org.genivi.NodeStateManager.Consumer.xml
@@ -1,5 +1,19 @@
-<!-- Auto-Generated interface from Rhapsody: 'Repository::ssw_LifecycleSupport::NodeStateManagement::Concept::Interface::INSM_Consumer' -->
-<!-- Created at 2012-06-01 09:36:05 by uid65904 -->
+<!--
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* Describes the "Consumer" interface of the NodeStateManager
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* Date Author Reason
+* 24.10.2012 Jean-Pierre Bogler Initial creation
+*
+-->
<node>
<!--
diff --git a/NodeStateAccessStub/model/org.genivi.NodeStateManager.LifecycleConsumer.xml b/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleConsumer.xml
index ec1162b..4bc566f 100644
--- a/NodeStateAccessStub/model/org.genivi.NodeStateManager.LifecycleConsumer.xml
+++ b/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleConsumer.xml
@@ -1,3 +1,21 @@
+<!--
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* Describes the "LifecycleConsumer" interface, applications can
+* implement to become a life cycle client of the NodeStateManager.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* Date Author Reason
+* 24.10.2012 Jean-Pierre Bogler Initial creation
+*
+-->
+
<node>
<!--
org.genivi.NodeStateManager.LifeCycleConsumer:
diff --git a/NodeStateAccessStub/model/org.genivi.NodeStateManager.LifecycleControl.xml b/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleControl.xml
index c8b45da..9e1ddd0 100644
--- a/NodeStateAccessStub/model/org.genivi.NodeStateManager.LifecycleControl.xml
+++ b/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleControl.xml
@@ -1,5 +1,19 @@
-<!-- Auto-Generated interface from Rhapsody: 'Repository::ssw_LifecycleSupport::NodeStateManagement::Concept::Interface::INSM_LifecycleControl' -->
-<!-- Created at 2012-06-01 09:36:05 by uid65904 -->
+<!--
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* Describes the "LifecycleControl" interface of the NodeStateManager.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* Date Author Reason
+* 24.10.2012 Jean-Pierre Bogler Initial creation
+*
+-->
<node>
<!--
diff --git a/NodeStateAccessStub/Makefile.am b/NodeStateAccessStub/Makefile.am
deleted file mode 100644
index 58e190e..0000000
--- a/NodeStateAccessStub/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-#######################################################################################################################
-#
-# Copyright (C) 2012 Continental Automotive Systems, Inc.
-#
-# Author: Jean-Pierre.Bogler@continental-corporation.com
-#
-# Makefile template for the NodeStateMachineStub
-#
-# Process this file with automake to produce a Makefile.in.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-#######################################################################################################################
-
-noinst_LTLIBRARIES = libNodeStateAccess.la
-
-libNodeStateAccess_la_CFLAGS = \
- -I$(top_srcdir)/NodeStateManager \
- $(GIO_CFLAGS) \
- $(GIO_UNIX_CFLAGS) \
- $(GLIB_CFLAGS) \
- $(GOBJECT_CFLAGS) \
- $(PLATFORM_CFLAGS)
-
-libNodeStateAccess_la_SOURCES = NodeStateAccess.c NodeStateAccess.h
diff --git a/NodeStateAccessStub/NodeStateAccess.c b/NodeStateAccessStub/NodeStateAccess.c
deleted file mode 100644
index 7e1fbc0..0000000
--- a/NodeStateAccessStub/NodeStateAccess.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/**********************************************************************************************************************
-*
-* Copyright (C) 2012 Continental Automotive Systems, Inc.
-*
-* Author: Jean-Pierre.Bogler@continental-corporation.com
-*
-* Interface between NodeStateManager and IPC
-*
-* This source file is a part of the NodeStateAccess library (NSMA) stub.
-* The architecture requires that the NodeStateManager (NSM) is independent
-* from the D-Bus binding and generated code. The interface functions of the
-* library have to be implemented according to their description.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public
-* License, v. 2.0. If a copy of the MPL was not distributed with this
-* file, You can obtain one at http://mozilla.org/MPL/2.0/.
-*
-* Date Author Reason
-* 24.10.2012 Jean-Pierre Bogler CSP_WZ#1322: Initial creation
-*
-**********************************************************************************************************************/
-
-
-/**********************************************************************************************************************
-*
-* Header includes
-*
-**********************************************************************************************************************/
-
-/* generic includes for the NodeStateAccess library */
-#include "gio/gio.h" /* glib types */
-#include "NodeStateAccess.h" /* own header */
-#include "NodeStateTypes.h" /* Type defintions of the NSM */
-
-/* additional includes to use D-Bus */
-
-
-
-/**********************************************************************************************************************
-*
-* Local variables
-*
-**********************************************************************************************************************/
-
-/* Variables to handle main loop and bus connection */
-
-
-/**********************************************************************************************************************
-*
-* Prototypes for file local functions (see implementation for description)
-*
-**********************************************************************************************************************/
-
-
-/**********************************************************************************************************************
-*
-* Local (static) functions
-*
-**********************************************************************************************************************/
-
-
-/**********************************************************************************************************************
-*
-* Interfaces. Exported functions. See Header for detailed description.
-*
-**********************************************************************************************************************/
-
-gboolean NSMA_boInit(const NSMA_tstObjectCallbacks *pstCallbacks)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boWaitForEvents(void)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boSendNodeStateSignal(const NsmNodeState_e enNodeState)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boSendSessionSignal(const NsmSession_s *pstSession)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boSendApplicationModeSignal(const NsmApplicationMode_e enApplicationMode)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boSetBootMode(gint i32BootMode)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boGetBootMode(gint *pi32BootMode)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boSetRunningReason(const NsmRunningReason_e enRunningReason)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boGetRunningReason(NsmRunningReason_e *penRunningReason)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boSetShutdownReason(const NsmShutdownReason_e enShutdownReason)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boGetShutdownReason(NsmShutdownReason_e *penShutdownReason)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boSetRestartReason(const NsmRestartReason_e enRestartReason)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boGetRestartReason(NsmRestartReason_e *penRestartReason)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boQuitEventLoop(void)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boFreeLcConsumerProxy(NSMA_tLcConsumerHandle hLcConsumer)
-{
- return FALSE;
-}
-
-
-NSMA_tLcConsumerHandle NSMA_hCreateLcConsumer(const gchar* sBusName,
- const gchar* sObjName,
- const guint u32TimeoutMs)
-{
- return NULL;
-}
-
-
-
-gboolean NSMA_boCallLcClientRequest(NSMA_tLcConsumerHandle hLcClient,
- guint u32ShutdownType)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boSetLcClientTimeout(NSMA_tLcConsumerHandle hClient, guint u32TimeoutMs)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boGetLcClientTimeout(NSMA_tLcConsumerHandle hClient, guint *pu32TimeoutMs)
-{
- return FALSE;
-}
-
-
-gboolean NSMA_boDeInit(void)
-{
- return FALSE;
-}
diff --git a/NodeStateMachineStub/Makefile.am b/NodeStateMachineStub/Makefile.am
index e07ce57..a8386a0 100644
--- a/NodeStateMachineStub/Makefile.am
+++ b/NodeStateMachineStub/Makefile.am
@@ -14,10 +14,12 @@
#
#######################################################################################################################
-noinst_LTLIBRARIES = libNodeStateMachine.la
+lib_LTLIBRARIES = libNodeStateMachine.la
libNodeStateMachine_la_CFLAGS = \
-I$(top_srcdir)/NodeStateManager \
$(PLATFORM_CFLAGS)
libNodeStateMachine_la_SOURCES = NodeStateMachine.c NodeStateMachine.h
+
+libNodeStateMachine_la_LDFLAGS = -avoid-version
diff --git a/NodeStateManager/Makefile.am b/NodeStateManager/Makefile.am
index 6de96e5..260ca74 100644
--- a/NodeStateManager/Makefile.am
+++ b/NodeStateManager/Makefile.am
@@ -20,7 +20,7 @@ NodeStateManager_SOURCES = NodeStateManager.c
NodeStateManager_CFLAGS = \
-I$(top_srcdir)/NodeStateMachineStub \
- -I$(top_srcdir)/NodeStateAccessStub \
+ -I$(top_srcdir)/NodeStateAccess \
$(DLT_CFLAGS) \
$(GIO_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
@@ -29,10 +29,11 @@ NodeStateManager_CFLAGS = \
$(PLATFORM_CFLAGS)
NodeStateManager_LDFLAGS = \
- $(PLATFORM_LDFLAGS)
+ $(PLATFORM_LDFLAGS) \
+ -export-dynamic
NodeStateManager_LDADD = \
- -L$(top_srcdir)/NodeStateAccessStub -lNodeStateAccess \
+ -L$(top_srcdir)/NodeStateAccess -lNodeStateAccess \
-L$(top_srcdir)/NodeStateMachineStub -lNodeStateMachine \
$(DLT_LIBS) \
$(GIO_LIBS) \
@@ -44,12 +45,20 @@ include_HEADERS = NodeStateManager.h NodeStateTypes.h
systemdsystemunit_DATA = config/nodestatemanager-daemon.service
-
dbussystemunit_DATA = config/org.genivi.NodeStateManager.LifeCycleControl.service
+dbuspolicy_DATA = config/org.genivi.NodeStateManager.conf
+# Write the package config file of the NHM to it destination
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = config/node-state-manager.pc
-dbuspolicy_DATA = config/org.genivi.NodeStateManager.conf
+# Export the dbus interface descrition of the NHM
+dbusinterfaces_DATA = $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.Consumer.xml \
+ $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleConsumer.xml \
+ $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleControl.xml \
+ $(top_srcdir)/NodeStateTest/org.genivi.NodeStateMachineTest.xml
EXTRA_DIST = $(systemdsystemunit_DATA) \
$(dbussystemunit_DATA) \
- $(dbuspolicy_DATA)
+ $(dbuspolicy_DATA) \
+ $(dbusinterfaces_DATA)
diff --git a/NodeStateManager/NodeStateManager.c b/NodeStateManager/NodeStateManager.c
index c92188f..4ed5150 100644
--- a/NodeStateManager/NodeStateManager.c
+++ b/NodeStateManager/NodeStateManager.c
@@ -37,6 +37,9 @@
* the handling of life cycle clients (timeout observation)
* is done by the NSMA.
* 01.11.2012 C. Domke CSP_WZ#666: Instrumented with LTPRO messages
+* 10.01.2013 Jean-Pierre Bogler CSP_WZ#1322: Initialize variables at declaration instead of using
+* memset and use g_utf8_strlen instead of strlen to
+* simplify configure srcipt (avoid some checks).
*
**********************************************************************************************************************/
@@ -1412,18 +1415,15 @@ static NsmErrorStatus_e NSM__enOnHandleRegisterSession(const gchar *
/* Function local variables */
NsmSession_s *pNewSession = NULL; /* Pointer to new created session */
GSList *pListEntry = NULL; /* Pointer to list entry */
- size_t u32SessionNameLen = 0; /* Length of passed session owner */
- size_t u32SessionOwnerLen = 0; /* Length of passed session name */
- NsmSession_s stSearchSession; /* To search for existing session */
+ glong u32SessionNameLen = 0; /* Length of passed session owner */
+ glong u32SessionOwnerLen = 0; /* Length of passed session name */
+ NsmSession_s stSearchSession = {0}; /* To search for existing session */
gboolean boOwnerValid = FALSE;
NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet;
- /* Initialize variables */
- memset(&stSearchSession, 0, sizeof(stSearchSession));
-
/* Check if the passed parameters are valid */
- u32SessionNameLen = strlen(sSessionName);
- u32SessionOwnerLen = strlen(sSessionOwner);
+ u32SessionNameLen = g_utf8_strlen(sSessionName, -1);
+ u32SessionOwnerLen = g_utf8_strlen(sSessionOwner, -1);
boOwnerValid = (g_strcmp0(sSessionOwner, NSM_DEFAULT_SESSION_OWNER) != 0);
if( (boOwnerValid == TRUE )
@@ -1522,17 +1522,14 @@ static NsmErrorStatus_e NSM__enOnHandleUnRegisterSession(const gchar *sSessi
/* Function local variables */
NsmSession_s *pExistingSession = NULL; /* Pointer to existing session */
GSList *pListEntry = NULL; /* Pointer to list entry */
- size_t u32SessionNameLen = 0; /* Length of passed session owner */
- size_t u32SessionOwnerLen = 0; /* Length of passed session name */
- NsmSession_s stSearchSession; /* To search for existing session */
+ glong u32SessionNameLen = 0; /* Length of passed session owner */
+ glong u32SessionOwnerLen = 0; /* Length of passed session name */
+ NsmSession_s stSearchSession = {0}; /* To search for existing session */
NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet;
- /* Initialize variables */
- memset(&stSearchSession, 0, sizeof(stSearchSession));
-
/* Check if the passed parameters are valid */
- u32SessionNameLen = strlen(sSessionName);
- u32SessionOwnerLen = strlen(sSessionOwner);
+ u32SessionNameLen = g_utf8_strlen(sSessionName, -1);
+ u32SessionOwnerLen = g_utf8_strlen(sSessionOwner, -1);
if( (u32SessionNameLen < NSM_MAX_SESSION_NAME_LENGTH )
&& (u32SessionOwnerLen < NSM_MAX_SESSION_OWNER_LENGTH))
@@ -1782,14 +1779,11 @@ static NsmErrorStatus_e NSM__enOnHandleGetSessionState(const gchar *sSessi
{
/* Function local variables */
NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet;
- size_t u32SessionNameLen = 0; /* Length of passed session owner */
- NsmSession_s stSearchSession; /* To search for existing session */
-
- /* Initialize variables */
- memset(&stSearchSession, 0, sizeof(stSearchSession));
+ glong u32SessionNameLen = 0; /* Length of passed session owner */
+ NsmSession_s stSearchSession = {0}; /* To search for existing session */
/* Check if the passed parameters are valid */
- u32SessionNameLen = strlen(sSessionName);
+ u32SessionNameLen = g_utf8_strlen(sSessionName, -1);
if(u32SessionNameLen < NSM_MAX_SESSION_OWNER_LENGTH)
{
@@ -1833,16 +1827,13 @@ static NsmErrorStatus_e NSM__enOnHandleSetSessionState(const gchar *
{
/* Function local variables */
NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet;
- size_t u32SessionNameLen = 0; /* Length of passed session owner */
- size_t u32SessionOwnerLen = 0; /* Length of passed session name */
- NsmSession_s stSession; /* Session object passed to internal function */
-
- /* Initialize variables */
- memset(&stSession, 0, sizeof(stSession));
+ glong u32SessionNameLen = 0; /* Length of passed session owner */
+ glong u32SessionOwnerLen = 0; /* Length of passed session name */
+ NsmSession_s stSession = {0}; /* Session object passed to internal function */
/* Check if the passed parameters are valid */
- u32SessionNameLen = strlen(sSessionName);
- u32SessionOwnerLen = strlen(sSessionOwner);
+ u32SessionNameLen = g_utf8_strlen(sSessionName, -1);
+ u32SessionOwnerLen = g_utf8_strlen(sSessionOwner, -1);
if( (u32SessionNameLen < NSM_MAX_SESSION_NAME_LENGTH )
&& (u32SessionOwnerLen < NSM_MAX_SESSION_OWNER_LENGTH))
@@ -1927,10 +1918,7 @@ static void NSM__vDisableSessionsForApp(NSM__tstFailedApplication* pstFailedApp)
/* Function local variables */
GSList *pSessionListEntry = NULL;
NsmSession_s *pstExistingSession = NULL;
- NsmSession_s stSearchSession;
-
- /* Initialize variables */
- memset(&stSearchSession, 0, sizeof(stSearchSession));
+ NsmSession_s stSearchSession = {0};
/* Only set the "owner" of the session (to the AppName) to search for all sessions of the app. */
g_strlcpy(stSearchSession.sOwner, pstFailedApp->sName, sizeof(stSearchSession.sOwner));
@@ -2043,12 +2031,9 @@ static NsmErrorStatus_e NSM__enSetAppStateFailed(NSM__tstFailedApplication* pstF
static NsmErrorStatus_e NSM__enOnHandleSetAppHealthStatus(const gchar *sAppName,
const gboolean boAppState)
{
- /* Function local variables */
- NSM__tstFailedApplication stSearchApplication; /* Temporary application object for search */
- NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet;
-
- /* Initialize variables */
- memset(&stSearchApplication, 0, sizeof(stSearchApplication));
+ /* Function local variables */
+ NSM__tstFailedApplication stSearchApplication = {0}; /* Temporary application object for search */
+ NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet;
/* Check if passed parameters are valid */
if(strlen(sAppName) < NSM_MAX_SESSION_OWNER_LENGTH)
diff --git a/NodeStateManager/config/node-state-manager.pc.in b/NodeStateManager/config/node-state-manager.pc.in
new file mode 100644
index 0000000..480ff5d
--- /dev/null
+++ b/NodeStateManager/config/node-state-manager.pc.in
@@ -0,0 +1,13 @@
+# Package config file for NodeStateManager
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+dbusinterfacesdir=@dbusinterfacesdir@
+
+Name: NodeStateManager (NSM)
+Description: Package information for the NHM.
+URL: http://www.genivi.org
+Version: @VERSION@
+Cflags: -I${includedir}
diff --git a/NodeStateManager/config/nodestatemanager-daemon.service.in b/NodeStateManager/config/nodestatemanager-daemon.service.in
index 03177bb..6842cbd 100644
--- a/NodeStateManager/config/nodestatemanager-daemon.service.in
+++ b/NodeStateManager/config/nodestatemanager-daemon.service.in
@@ -1,4 +1,13 @@
-# This file is for starting the nodestatemanager-daemon as a service with systemd
+#
+# Copyright (C) 2012 Continental Automotive Systems, Inc.
+#
+# Author: Jean-Pierre.Bogler@continental-corporation.com
+#
+# This file is for starting the nodestatemanager-daemon as a service with systemd
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
[Unit]
Description=NodeStateManager to provide system states, session and shutdown handling
diff --git a/NodeStateTest/Makefile.am b/NodeStateTest/Makefile.am
new file mode 100644
index 0000000..0ccc153
--- /dev/null
+++ b/NodeStateTest/Makefile.am
@@ -0,0 +1,62 @@
+#######################################################################################################################
+#
+# Copyright (C) 2012 Continental Automotive Systems, Inc.
+#
+# Author: Jean-Pierre.Bogler@continental-corporation.com
+#
+# Makefile template for the NodeStateTest executable and NodeStateMachineTest library.
+#
+# Process this file with automake to produce a Makefile.in.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Date Author Reason
+# 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
+#
+#######################################################################################################################
+
+bin_PROGRAMS = NodeStateTest
+
+NodeStateTest_SOURCES = NodeStateTest.c
+
+nodist_NodeStateTest_SOURCES = NodeStateMachineTestApi.c \
+ $(top_srcdir)/NodeStateAccess/generated/NodeStateConsumer.c \
+ $(top_srcdir)/NodeStateAccess/generated/NodeStateLifecycleConsumer.c \
+ $(top_srcdir)/NodeStateAccess/generated/NodeStateLifecycleControl.c
+
+NodeStateTest_CFLAGS = -I$(top_srcdir)/NodeStateManager \
+ -I$(top_srcdir)/NodeStateAccess \
+ -I$(top_srcdir)/NodeStateAccess/generated \
+ $(GIO_CFLAGS) \
+ $(GIO_UNIX_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(GOBJECT_CFLAGS)
+
+NodeStateTest_LDADD = $(GIO_LIBS) \
+ $(GIO_UNIX_LIBS) \
+ $(GLIB_LIBS) \
+ $(GOBJECT_LIBS)
+
+lib_LTLIBRARIES = libNodeStateMachineTest.la
+
+libNodeStateMachineTest_la_CFLAGS = -I../NodeStateManager \
+ $(GIO_CFLAGS) \
+ $(GIO_UNIX_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(GOBJECT_CFLAGS)
+
+libNodeStateMachineTest_la_SOURCES = NodeStateMachineTest.c
+
+nodist_libNodeStateMachineTest_la_SOURCES = NodeStateMachineTestApi.c
+
+libNodeStateMachineTest_la_LDFLAGS = -avoid-version
+
+BUILT_SOURCES = NodeStateMachineTestApi.h
+
+CLEANFILES = NodeStateMachineTestApi.c \
+ NodeStateMachineTestApi.h
+
+NodeStateMachineTestApi.c NodeStateMachineTestApi.h: org.genivi.NodeStateMachineTest.xml
+ gdbus-codegen --interface-prefix com.contiautomotive.NodeStateMachineTest. --c-namespace NodeState --generate-c-code NodeStateMachineTestApi --annotate "com.contiautomotive.NodeStateMachineTest.Test.SetNsmData()[Data]" org.gtk.GDBus.C.ForceGVariant true --annotate "com.contiautomotive.NodeStateMachineTest.Test.GetNsmData()[DataIn]" org.gtk.GDBus.C.ForceGVariant true --annotate "com.contiautomotive.NodeStateMachineTest.Test.GetNsmData()[DataOut]" org.gtk.GDBus.C.ForceGVariant true $<
diff --git a/NodeStateTest/NodeStateMachineTest.c b/NodeStateTest/NodeStateMachineTest.c
new file mode 100644
index 0000000..4381d73
--- /dev/null
+++ b/NodeStateTest/NodeStateMachineTest.c
@@ -0,0 +1,305 @@
+/**********************************************************************************************************************
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* Implementation of the NodeStateMachineTest.
+*
+* The NodeStateMachineTest compiles to a shared object that is loaded by the NodeStateManager.
+* This special test version of the NodeStateMachine implements additonal functionality.
+* Beside of the internal interfaces that are directly called by the NSM, who links with the lib,
+* the test NodeStateMachine offers an own dbus interface!
+*
+* A test frame can use this dbus interface to stimulate the NSMC to make calls to the NSM.
+* The return values that the NSMC receives are passed back to the test frame, where it can be
+* checked if they are valid.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* Date Author Reason
+* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
+*
+**********************************************************************************************************************/
+
+
+/**********************************************************************************************************************
+*
+* Header includes
+*
+**********************************************************************************************************************/
+
+#include <gio/gio.h> /* Access dbus using glib */
+
+#include "NodeStateMachineTest.h" /* Own header file */
+#include "NodeStateTypes.h" /* Know the types of the NSM */
+#include "NodeStateManager.h" /* Access inhternal NSM interfaces */
+
+#include "NodeStateMachineTestApi.h" /* Dbus interface offered by NSMC */
+
+
+/**********************************************************************************************************************
+*
+* Local defines, macros, constants and type definitions.
+*
+**********************************************************************************************************************/
+
+/* There are currently no local defines, macros or types */
+
+
+/**********************************************************************************************************************
+*
+* Local variables
+*
+**********************************************************************************************************************/
+
+static NodeStateTest *TSTMSC__pTestMachine = NULL;
+static GDBusConnection *TSTMSC__pConnection = NULL;
+
+
+/**********************************************************************************************************************
+*
+* Prototypes for file local functions (see implementation for description)
+*
+**********************************************************************************************************************/
+
+static gboolean NSM__boOnHandleSetNsmData(NodeStateTest *pTestMachine,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32DataType,
+ GVariant *pData,
+ const guint u32DataLen,
+ gpointer pUserData);
+
+static gboolean NSM__boOnHandleGetNsmData(NodeStateTest *pTestMachine,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32DataType,
+ GVariant *DataIn,
+ const guint u32DataLen,
+ gpointer pUserData);
+
+static gboolean NSM__boOnHandleGetNsmInterfaceVersion(NodeStateTest *pTestMachine,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData);
+
+/**********************************************************************************************************************
+*
+* Local (static) functions
+*
+**********************************************************************************************************************/
+
+/**********************************************************************************************************************
+*
+* The function is called when a test frame wants to set data to the NSM via the NSMC.
+*
+* @param pTestMachine: NodeStateMachineTest object.
+* @param pInvocation: Invocation for this call.
+* @param i32DataType: DataType (possible valid values see NsmDataType_e)
+* @param pData: GVariant of type "ay". Includes an array of byte containing the data to be set.
+* @param u32DataLen: Length of the data, which is directly passed to the NSM. Can contain invalid values,
+* because it is not usef for the serialization of the content of pData.
+* @param pUserData: Opzional user data (not used).
+*
+* @return TRUE: Dbus message was handled.
+*
+**********************************************************************************************************************/
+static gboolean NSM__boOnHandleSetNsmData(NodeStateTest *pTestMachine,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32DataType,
+ GVariant *pData,
+ const guint u32DataLen,
+ gpointer pUserData)
+{
+ /* Function local variables */
+ guint u32ArraySize = 0; /* Children of pData */
+ guint8 *au8Data = NULL; /* Pointer to byte array */
+ guint u32ArrayIdx = 0; /* Index to loop through data */
+ GVariant *pArrayElement = NULL; /* Pointer to child of pData */
+ NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet;
+ NsmDataType_e enDateType = (NsmDataType_e) i32DataType;
+
+ /* Create a new byte array based on the length of pData and fill it with the values */
+ u32ArraySize = g_variant_n_children(pData);
+ au8Data = g_new(guint8, u32ArraySize);
+
+ for(u32ArrayIdx = 0; u32ArrayIdx < u32ArraySize; u32ArrayIdx++)
+ {
+ pArrayElement = g_variant_get_child_value(pData, u32ArrayIdx);
+ au8Data[u32ArrayIdx] = g_variant_get_byte(pArrayElement);
+ g_variant_unref(pArrayElement);
+ }
+
+ g_variant_unref(pData); /* release the variant. We read it */
+
+ /* Call the NSM. Pass extracted data and length, originally passed by test frame */
+ enRetVal = NsmSetData(enDateType, (unsigned char*) au8Data, (unsigned int) u32DataLen);
+
+ /* Send NSMs return value to the test frame */
+ node_state_test_complete_set_nsm_data(pTestMachine, pInvocation, (gint) enRetVal);
+
+ return TRUE;
+}
+
+/**********************************************************************************************************************
+*
+* The function is called when a test frame wants to get data from the NSM via the NSMC.
+*
+* @param pTestMachine: NodeStateMachineTest object.
+* @param pInvocation: Invocation for this call.
+* @param i32DataType: DataType (possible valid values see NsmDataType_e)
+* @param pDataIn: Parameters passed by test frame fopr getting data (currently only used for sesion states)
+* @param u32DataLen: Length of the expected data, which is directly passed to the NSM. Can contain invalid values,
+* because it is not used for the serialization of pDataOut.
+* @param pUserData: Opzional user data (not used).
+*
+* @return TRUE: Dbus message was handled.
+*
+**********************************************************************************************************************/
+static gboolean NSM__boOnHandleGetNsmData(NodeStateTest *pTestMachine,
+ GDBusMethodInvocation *pInvocation,
+ const gint i32DataType,
+ GVariant *DataIn,
+ const guint u32DataLen,
+ gpointer pUserData)
+{
+ /* Function local variables */
+ NsmSession_s pData; /* Contains data from pDataIn and is popassed to the NSM */
+ int i32RetVal = 0; /* Return value of the NSM */
+ guint u32ArrayIdx = 0; /* Index to loop through data */
+ GVariant **pArrayElements = NULL; /* Helper to serailize data */
+ GVariant *pRetArray = NULL; /* Outgoing data returned to NSM */
+ GVariant *pDataInElement = NULL; /* Pointer to child of pDataIn */
+
+ /*
+ * The NSM has a read write interface for getting data. The largest data frame that can be
+ * exchanged is a NsmSession_s. Therefore, pDataIn is translated into this kind of variable.
+ */
+ for(u32ArrayIdx = 0; u32ArrayIdx < g_variant_n_children(DataIn); u32ArrayIdx++)
+ {
+ pDataInElement = g_variant_get_child_value(DataIn, u32ArrayIdx);
+ ((guchar*) &pData)[u32ArrayIdx] = g_variant_get_byte(pDataInElement);
+ }
+
+ g_variant_unref(DataIn); /* Release pDataIn. we read the data */
+
+ /* Call the NSM */
+ i32RetVal = NsmGetData((NsmDataType_e) i32DataType, (unsigned char*) &pData, u32DataLen);
+
+ /* Serialize ougoing data retuurned by NSM, if there is a positive NSM return */
+ if(i32RetVal > 0)
+ {
+ pArrayElements = g_new(GVariant*, i32RetVal);
+
+ for(u32ArrayIdx = 0; u32ArrayIdx < (guint) i32RetVal; u32ArrayIdx++)
+ {
+ pArrayElements[u32ArrayIdx] = g_variant_new_byte( ((guchar*) &pData)[u32ArrayIdx] );
+ }
+
+ pRetArray = g_variant_new_array(G_VARIANT_TYPE_BYTE, pArrayElements, (gsize) i32RetVal);
+ }
+ else
+ {
+ pArrayElements = g_new(GVariant*, 1);
+ pArrayElements[0] = g_variant_new_byte(0);
+ pRetArray = g_variant_new_array(G_VARIANT_TYPE_BYTE, pArrayElements, 1);
+ }
+
+ /* Send NSM return to test frame */
+ node_state_test_complete_get_nsm_data(pTestMachine, pInvocation, pRetArray, i32RetVal);
+
+ g_variant_unref(pRetArray); /* Release the returned data, because we send it. */
+
+ return TRUE;
+}
+
+/**********************************************************************************************************************
+*
+* The function is called when a test frame wants to get the interface version of the NSM via the NSMC.
+*
+* @param pTestMachine: NodeStateMachineTest object.
+* @param pInvocation: Invocation for this call.
+* @param pUserData: Opzional user data (not used).
+*
+* @return TRUE: Dbus message was handled.
+*
+**********************************************************************************************************************/
+static gboolean NSM__boOnHandleGetNsmInterfaceVersion(NodeStateTest *pTestMachine,
+ GDBusMethodInvocation *pInvocation,
+ gpointer pUserData)
+{
+ node_state_test_complete_get_nsm_interface_version(pTestMachine, pInvocation, (guint) NsmGetInterfaceVersion());
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* Interfaces, exported functions. See header for detailed description.
+*
+**********************************************************************************************************************/
+
+unsigned char NsmcInit(void)
+{
+ unsigned char u8RetVal = 0;
+
+ TSTMSC__pTestMachine = node_state_test_skeleton_new();
+ TSTMSC__pConnection = g_bus_get_sync(NSM_BUS_TYPE, NULL, NULL);
+
+ if(g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(TSTMSC__pTestMachine),
+ TSTMSC__pConnection,
+ "/com/contiautomotive/NodeStateMachineTest",
+ NULL) == TRUE)
+ {
+ u8RetVal = 1;
+ (void) g_signal_connect(TSTMSC__pTestMachine, "handle-set-nsm-data", G_CALLBACK(NSM__boOnHandleSetNsmData), NULL);
+ (void) g_signal_connect(TSTMSC__pTestMachine, "handle-get-nsm-data", G_CALLBACK(NSM__boOnHandleGetNsmData), NULL);
+ (void) g_signal_connect(TSTMSC__pTestMachine, "handle-get-nsm-interface-version", G_CALLBACK(NSM__boOnHandleGetNsmInterfaceVersion), NULL);
+ }
+ else
+ {
+ u8RetVal = 0;
+ }
+
+ return u8RetVal;
+}
+
+
+unsigned char NsmcLucRequired(void)
+{
+ return 1;
+}
+
+
+NsmErrorStatus_e NsmcSetData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen)
+{
+ return NsmErrorStatus_Ok;
+}
+
+
+unsigned char NsmcRequestNodeRestart(void)
+{
+ return 1;
+}
+
+
+unsigned int NsmcGetInterfaceVersion(void)
+{
+ return (unsigned int) NSMC_INTERFACE_VERSION;
+}
+
+
+NsmErrorStatus_e NsmcSetTestData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen)
+{
+ if( (enData == NsmDataType_NodeState)
+ && (u32DataLen == sizeof(NsmNodeState_e)
+ && ((NsmNodeState_e) *pData) == NsmNodeState_Shutdown))
+ {
+ g_object_unref(TSTMSC__pConnection);
+ g_object_unref(TSTMSC__pTestMachine);
+ }
+
+ return NsmErrorStatus_Ok;
+}
+
diff --git a/NodeStateTest/NodeStateMachineTest.h b/NodeStateTest/NodeStateMachineTest.h
new file mode 100644
index 0000000..a502ba3
--- /dev/null
+++ b/NodeStateTest/NodeStateMachineTest.h
@@ -0,0 +1,134 @@
+#ifndef NSM_NODESTATEMACHINE_H
+#define NSM_NODESTATEMACHINE_H
+
+/**********************************************************************************************************************
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* Header for the test NodeStateMachine.
+*
+* The header file defines the interfaces offered by the test NodeStateMachine.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* Date Author Reason
+* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
+*
+**********************************************************************************************************************/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**********************************************************************************************************************
+*
+* HEADER FILE INCLUDES
+*
+**********************************************************************************************************************/
+
+#include "NodeStateTypes.h"
+
+/**********************************************************************************************************************
+*
+* CONSTANTS
+*
+**********************************************************************************************************************/
+
+/**
+ * Module version, use SswVersion to interpret the value.
+ * The lower significant byte is equal 0 for released version only
+ */
+
+#define NSMC_INTERFACE_VERSION 0x01000000U
+
+
+/**********************************************************************************************************************
+*
+* TYPE
+*
+**********************************************************************************************************************/
+
+/* There are no own types defined */
+
+
+/**********************************************************************************************************************
+*
+* GLOBAL VARIABLES
+*
+**********************************************************************************************************************/
+
+/* There are no exported global variables */
+
+
+/**********************************************************************************************************************
+*
+* FUNCTION PROTOTYPE
+*
+**********************************************************************************************************************/
+
+/** \brief Initialize the NodeStateMachine
+\retval true: The NodeStateMachine could be initialized and is running. false: An error occurred. NodeStateMachine not started.
+
+This function will be used to initialize the Node State Machine, it will be called by the Node State Manager.
+At the point where this function returns the machine is available to accept events via its interfaces from
+the NSM. It is envisaged that in this call the NSMC will create and transfer control of the NSMC to its own
+thread and will return in the original thread.*/
+unsigned char NsmcInit(void);
+
+
+/** \brief Check for Last User Context
+\retval true: Last User Context (LUC) is required. false: No LUC required.
+
+This will be used by the NSM to check whether in the current Lifecycle the Last User Context (LUC) should
+be started. This allows the product to define its own handling for specific Application modes. */
+unsigned char NsmcLucRequired(void);
+
+
+/** \brief Set data in the NodeStateMachine.
+\param[in] enData Type of the data to set (see ::NsmDataType_e).
+\param[in] pData Pointer to the memory location containing the data.
+\param[in] u32DataLen Length of the data that should be set (in byte).
+\retval see ::NsmErrorStatus_e
+
+This is a generic interface that can be used by the NSM to inform the NSMC about changes
+to data items (i.e. events that have occurred in the system) */
+NsmErrorStatus_e NsmcSetData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen);
+
+
+/** \brief Request a NodeRestart.
+\retval true: The request for the restart could be processed. false: Error processing the restart request.
+
+This will be used by the NSM to request a node restart when requested by one of its clients.*/
+unsigned char NsmcRequestNodeRestart(void);
+
+
+/** \brief Get version of the interface
+\retval Version of the interface as defined in ::SswVersion_t
+
+This function asks the lifecycle to perform a restart of the main controller. */
+unsigned int NsmcGetInterfaceVersion(void);
+
+
+NsmErrorStatus_e NsmcSetTestData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen);
+
+
+/**********************************************************************************************************************
+*
+* MACROS
+*
+**********************************************************************************************************************/
+
+/* There are no macros defined */
+
+
+#ifdef __cplusplus
+}
+#endif
+/** \} */ /* End of SSW_NSMC_INTERFACE */
+/** \} */ /* End of SSW_NSMC_TEMPLATE */
+#endif /* NSM_NODESTATEMACHINE_H */
diff --git a/NodeStateTest/NodeStateTest.c b/NodeStateTest/NodeStateTest.c
new file mode 100644
index 0000000..980e8d0
--- /dev/null
+++ b/NodeStateTest/NodeStateTest.c
@@ -0,0 +1,3466 @@
+/**********************************************************************************************************************
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* Implementation of the NodeStateMachineTest.
+*
+* The file implements a test executable that communicates with the NodeStateManager and provides "LifecycleClients"
+* for shutdown tests. The intention is to keep the test code as simple as possible. Additional test cases should
+* only be defined by adding them to the table "NSMTST__astTestCase". If the NSM offers new functionality, it might
+* be necessary to extend the test frame by new functions.
+*
+* The test is controlled by a timer. In configurable time steps, the test cases are called one after the other.
+* The table NSMTST__astTestCase contains a function pointer to the test function, a union for possible parameters
+* and a union for the expected return value(s).
+*
+* The test functions return a boolean value and do not take parameters. The parameters to test the NSM and the
+* expected return values are read from the table "NSMTST__astTestCase".
+*
+* For every NSM interface the possible parameters are stored in a structure. The structure is added as a member
+* in the "tunParameter" union type definition. The same applies to the expected return values, where the structures
+* are declares as members in the tunReturnValues union.
+*
+* Wrapping the parameters and expected returns in structures should simplify further extensions and adaption to the
+* test frame and allow a consistent syntax. Every structure name for parameters and return values has the same naming
+* convenitons:
+*
+* NSMTST__tst<Interface><Function>Param or NSMTST__tst<Interface><Function>Return
+*
+* Where interface either is Db (D-Bus), Sm (StateMachine) or Test (int. functions, where no NSM interface is accessed).
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* Date Author Reason
+* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
+*
+**********************************************************************************************************************/
+
+
+/**********************************************************************************************************************
+*
+* Header includes
+*
+**********************************************************************************************************************/
+
+/* System header files */
+#include <gio/gio.h> /* Use glib to access dbus and communicate to NSM */
+
+/* Header files offered by NSM */
+#include "NodeStateTypes.h" /* Know type definitions of NSM */
+#include "NodeStateManager.h" /* Know internal interfaces of NSM */
+
+/* Generated header files to access NSM via D-Bus */
+#include "NodeStateConsumer.h" /* Consumer interface with publicly available functions */
+#include "NodeStateLifecycleControl.h" /* Control interface with safety relevant functions */
+#include "NodeStateLifecycleConsumer.h" /* Consumer interface to offer life cycle clients */
+#include "NodeStateMachineTestApi.h" /* Access D-Bus interface of test NSMC */
+
+
+/**********************************************************************************************************************
+*
+* Local defines, macros and type definitions.
+*
+**********************************************************************************************************************/
+
+/*
+ * Interval between the test steps in ms.
+ */
+#define NSMTST__TIMER_INTERVAL 100
+
+/*
+ * Format for the trace output of the test frame.
+ * An integer (the test case number) and three strings can be displayed:
+ * The test description, the ErrorMessage and a "success"/"failed" string.
+ *
+ */
+#define NSMTST__TESTPRINT "%03d;%s;%s;%s\n"
+
+/*
+ * The define sets up a string that is longer for all text fields used in the NSM.
+ * The intend is to test the NSM for correct behavior by passing this string.
+ */
+#define NSMTST__260CHAR_STRING "012345678901234567890123456789012345678901234567890123456789"\
+ "012345678901234567890123456789012345678901234567890123456789"\
+ "012345678901234567890123456789012345678901234567890123456789"\
+ "012345678901234567890123456789012345678901234567890123456789"\
+ "01234567890123456789"
+
+/* Defines the syntax of a test function call */
+typedef gboolean (*NSMTST__tpfTestFunction)(void);
+
+/* Configures dummy parameter for test cases that do not need additional parameters. */
+typedef struct
+{
+ guint8 u8Dummy;
+} NSMTST__tstTestDummyParam;
+
+/*
+ * Configures parameters for the helper function "NSMTST__boCreateLifecycleClient",
+ * which is used to create life cycle clients that are needed for further tests.
+ */
+typedef struct
+{
+ gchar* sObjName; /* Object name of the LifecycleClient that should be created */
+} NSMTST__tstTestCreateLifecycleClientParam;
+
+/* Configures parameters for calling the (internal) NsmSetData interface of the NSM with invalid data types. */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+ NsmDataType_e enDataType; /* Data type passed to NSM */
+} NSMTST__tstSmSetInvalidDataParam;
+
+/* Configures parameters for getting a SessionState from the NSM by calling its (internal) NsmSetData interface. */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+ NsmSession_s sSession; /* Defines which session to get */
+} NSMTST__tstSmGetSessionStateParam;
+
+/* Configures parameters for setting an ApplicationMode using the (internal) NsmSetData interface. */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+ NsmApplicationMode_e enApplicationMode; /* ApplicationMode to be set */
+} NSMTST__tstSmSetApplicationModeParam;
+
+/* Configures parameters for setting a NodeState using the (internal) NsmSetData interface. */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+ NsmNodeState_e enNodeState; /* NodeState to be set */
+} NSMTST__tstSmSetNodeStateParam;
+
+/* Configure parameters for setting a SessionState using the (internal) NsmSetData interface. */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+ NsmSession_s stSession; /* Defines session and state that should be set */
+} NSMTST__tstSmSetSessionStateParam;
+
+/* Configure the parameters for setting a ShutdownReason using the (internal) NsmSetData interface. */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+ NsmShutdownReason_e enShutdownReason; /* ShutdownReason to be set */
+} NSMTST__tstSmSetShutdownReasonParam;
+
+/* Configure parameters for setting a BootMode using the (internal) NsmSetData interface. */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+ gint i32BootMode; /* BootMode to be set */
+} NSMTST__tstSmSetBootModeParam;
+
+/* Configure the parameters for getting different values of the NSM via the (internal) NsmGetData interface */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+} NSMTST__tstSmGetRunningReasonParam,
+ NSMTST__tstSmGetShutdownReasonParam,
+ NSMTST__tstSmGetNodeStateParam,
+ NSMTST__tstSmGetApplicationModeParam,
+ NSMTST__tstSmGetBootModeParam,
+ NSMTST__tstSmGetRestartReasonParam;
+
+/* Configures parameters for trying to get invalid data using the (internal) NsmSetData interface. */
+typedef struct
+{
+ guint u32DataLen; /* Length of the data to be set in byte */
+ NsmDataType_e enDataType; /* DataType, which is trying to be get */
+} NSMTST__tstSmGetInvalidDataParam;
+
+/* Configures parameters for calling the RegisterLifecycleClient D-Bus interface of the NSM.
+ * Note that the bus address automatically is defined by the test frame.
+ */
+typedef struct
+{
+ gchar *sObjName; /* Object name */
+ guint u32Mode; /* Registered shutdown mode(s) */
+ guint u32Timeout; /* Timeout for shutdown */
+} NSMTST__tstDbRegisterShutdownClientParam;
+
+/* Configures parameters for calling the UnRegisterLifecycleClient D-Bus interface of the NSM. */
+typedef struct
+{
+ gchar *sObjName; /* Object name */
+ guint u32Mode; /* Shutdown mode(s) taht should be unregistered */
+} NSMTST__tstDbUnRegisterShutdownClientParam;
+
+/* Configures parameters for calling the RequestNodeRestart D-Bus interface of the NSM. */
+typedef struct
+{
+ NsmRestartReason_e enRestartReason; /* RestartReason passed to NSM */
+ guint u32RestartType; /* RestartType. E.g. NSM_NORMAL_SHUTDOWN */
+} NSMTST__tstDbRequestNodeRestartParam;
+
+/* Configures parameters for calling the SetAppHealthStatus D-Bus interface of the NSM. */
+typedef struct
+{
+ gchar *sAppName; /* (Systemd) name of the application, which state changed */
+ gboolean boAppRunning; /* New "RunningState" of the application */
+} NSMTST__tstDbSetAppHealthStatusParam;
+
+/* Configures parameters for calling the SetBootMode D-Bus interface of the NSM. */
+typedef struct
+{
+ gint i32BootMode; /* BootMode to be set */
+} NSMTST__tstDbSetBootModeParam;
+
+/* Configures parameters for setting the NodeState using the D-Bus SetNodeState interface of the NSM. */
+typedef struct
+{
+ NsmNodeState_e enNodeState; /* NodeState to be set */
+} NSMTST__tstDbSetNodeStateParam;
+
+/* Configures parameters for setting the ApplicationMode using the D-Bus SetApplicationMode interface of the NSM. */
+typedef struct
+{
+ NsmApplicationMode_e enApplicationMode; /* ApplicationMode to be set */
+} NSMTST__tstDbSetApplicationModeParam;
+
+/*
+ * Configures parameters for registering sessions and setting session states using the D-Bus
+ * RegisterSession and SetSessionState interface of the NSM.
+ */
+typedef struct
+{
+ gchar *sSessionName; /* Name of the session */
+ gchar *sSessionOwner; /* Owner of the session */
+ NsmSeat_e enSeat; /* Seat of the session */
+ NsmSessionState_e enState; /* State of the session */
+} NSMTST__tstDbRegisterSessionParam,
+ NSMTST__tstDbSetSessionStateParam;
+
+/* Configures parameters for getting session states using the D-Bus GetSessionState interface of the NSM. */
+typedef struct
+{
+ gchar *sSessionName; /* Name of the session */
+ NsmSeat_e enSeat; /* Seat of the session */
+} NSMTST__tstDbGetSessionStateParam;
+
+/* Configures parameters for getting session states using the D-Bus GetSessionState interface of the NSM. */
+typedef struct
+{
+ gchar *sSessionName; /* Name of the session */
+ gchar *sSessionOwner; /* Owner of the session */
+ NsmSeat_e enSeat; /* Seat of the session */
+} NSMTST__tstDbUnRegisterSessionParam;
+
+/*
+ * Configures the parameters for calling the LifecyclRequestComplete D-Bus interface of the NSM to finalize
+ * an asynchronous shut down. Furthermore, the same value is passed in ProcessLifecycleRequest to process an
+ * initial request.
+ */
+typedef struct
+{
+ NsmErrorStatus_e enErrorStatus; /* Error status returned to NSM */
+} NSMTST__tstDbLifecycleRequestCompleteParam,
+ NSMTST__tstTestProcessLifecycleRequestParam;
+
+/* The union includes all possible parameters needed by different NSM interfaces. */
+typedef union
+{
+ /* Parameters for internal functions that control the test */
+ NSMTST__tstTestDummyParam stTestDummy;
+ NSMTST__tstTestCreateLifecycleClientParam stTestCreateLcClient;
+
+ /* Parameters to control callback functions, which occur because of NSM signals */
+ NSMTST__tstTestProcessLifecycleRequestParam stTestProcessLifecycleRequest;
+
+ /* Parameters for D-Bus interfaces of the NSM */
+ NSMTST__tstDbSetNodeStateParam stDbSetNodeState;
+ NSMTST__tstDbSetApplicationModeParam stDbSetApplicationMode;
+ NSMTST__tstDbSetBootModeParam stDbSetBootMode;
+ NSMTST__tstDbGetSessionStateParam stDbGetSessionState;
+ NSMTST__tstDbSetSessionStateParam stDbSetSessionState;
+
+ NSMTST__tstDbRegisterSessionParam stDbRegisterSession;
+ NSMTST__tstDbUnRegisterSessionParam stDbUnRegisterSession;
+ NSMTST__tstDbSetAppHealthStatusParam stDbSetAppHealthStatus;
+ NSMTST__tstDbRegisterShutdownClientParam stDbRegisterShutdownClient;
+ NSMTST__tstDbUnRegisterShutdownClientParam stDbUnRegisterShutdownClient;
+ NSMTST__tstDbRequestNodeRestartParam stDbRequestNodeRestart;
+
+ NSMTST__tstDbLifecycleRequestCompleteParam stDbLifecycleRequestComplete;
+
+ /* Parameters for D-Bus interfaces of the test NSMC */
+ NSMTST__tstSmSetInvalidDataParam stSmSetInvalidData;
+ NSMTST__tstSmSetApplicationModeParam stSmSetApplicationMode;
+ NSMTST__tstSmSetNodeStateParam stSmSetNodeState;
+ NSMTST__tstSmSetSessionStateParam stSmSetSessionState;
+ NSMTST__tstSmSetShutdownReasonParam stSmSetShutdownReason;
+ NSMTST__tstSmSetBootModeParam stSmSetBootMode;
+
+ NSMTST__tstSmGetBootModeParam stSmGetBootMode;
+ NSMTST__tstSmGetRestartReasonParam stSmGetRestartReason;
+ NSMTST__tstSmGetRunningReasonParam stSmGetRunningReason;
+ NSMTST__tstSmGetShutdownReasonParam stSmGetShutdownReason;
+ NSMTST__tstSmGetNodeStateParam stSmGetNodeState;
+ NSMTST__tstSmGetApplicationModeParam stSmGetApplicationMode;
+ NSMTST__tstSmGetInvalidDataParam stSmGetInvalidData;
+ NSMTST__tstSmGetSessionStateParam stSmGetSessionState;
+} NSMTST__tunParameters;
+
+
+/* Configures dummy return value for test cases where no return value is expected. */
+typedef struct
+{
+ guint8 u8Dummy;
+} NSMTST__tstTestDummyReturn;
+
+/* Configures expected return values when calling the (internal) NsmGetData interface with invalid values. */
+typedef struct
+{
+ gint i32WrittenBytes; /* Number of bytes returned by NSM */
+} NSMTST__tstSmGetInvalidDataReturn;
+
+/* Configure expected return values when getting the ApplicationMode via the internal NsmGetData interface. */
+typedef struct
+{
+ gint i32WrittenBytes; /* Number of bytes returned by NSM */
+ NsmApplicationMode_e enApplicationMode; /* ApplicationMode returned by NSM */
+} NSMTST__tstSmGetAppModeReturn;
+
+/* Configures expected return values when getting the NodeState via the internal NsmGetData interface. */
+typedef struct
+{
+ gint i32WrittenBytes; /* Number of bytes returned by NSM */
+ NsmNodeState_e enNodeState; /* NodeState returned by NSM */
+} NSMTST__tstSmGetNodeStateReturn;
+
+/* Configures expected return values when getting the RestartReason via the internal NsmGetData interface. */
+typedef struct
+{
+ gint i32WrittenBytes; /* Number of bytes returned by NSM */
+ NsmRestartReason_e enRestartReason; /* RestartReason returned by NSM */
+} NSMTST__tstSmGetRestartReasonReturn;
+
+/* Configures expected return values when getting a SessionState via the internal NsmGetData interface. */
+typedef struct
+{
+ gint i32WrittenBytes; /* Number of bytes returned by NSM */
+ NsmSessionState_e enSessionState; /* SessionState returned by NSM */
+} NSMTST__tstSmGetSessionStateReturn;
+
+/* Configures expected return values when getting a ShutdownReason via the internal NsmGetData interface. */
+typedef struct
+{
+ gint i32WrittenBytes; /* Number of bytes returned by NSM */
+ NsmShutdownReason_e enShutdownReason; /* ShutdownReason returned by NSM */
+} NSMTST__tstSmGetShutdownReasonReturn;
+
+/* Configures expected return values when getting a BootMode via the internal NsmGetData interface. */
+typedef struct
+{
+ gint i32WrittenBytes; /* Number of bytes returned by NSM */
+ gint i32BootMode; /* BootMode returned by NSM */
+} NSMTST__tstSmGetBootModeReturn;
+
+/* Configures expected return values when getting a RunningReason via the internal NsmGetData interface. */
+typedef struct
+{
+ gint i32WrittenBytes; /* Number of bytes returned by NSM */
+ NsmRunningReason_e enRunningReason; /* RunningReason returned by NSM */
+} NSMTST__tstSmGetRunningReasonReturn;
+
+/* Configures expected return values when getting a SessionState via the GetSessionState D-Bus interface of the NSM. */
+typedef struct
+{
+ NsmErrorStatus_e enErrorStatus; /* ErrorStatus returned by NSM */
+ NsmSessionState_e enSessionState; /* SessionState returned by NSM */
+} NSMTST__tstDbGetSessionStateReturn;
+
+/* Configures expected return values when calling the CheckLucRequired D-Bus interface of the NSM. */
+typedef struct
+{
+ gboolean boLucRequired; /* LUC flag returned by NSM */
+} NSMTST__tstDbCheckLucRequired;
+
+/* Configures expected return values when calling the GetBootMode D-Bus interface of the NSM. */
+typedef struct
+{
+ gint i32BootMode; /* BootMdoe returned by NSM */
+} NSMTST__tstDbGetBootModeReturn;
+
+/* Configures expected return values when calling the GetRunningReason D-Bus interface of the NSM. */
+typedef struct
+{
+ NsmRunningReason_e enRunningReason; /* RunningReason returned by NSM */
+} NSMTST__tstDbGetRunningReasonReturn;
+
+/* Configures the expected return values when calling the GetShutdownReason D-Bus interface of the NSM. */
+typedef struct
+{
+ NsmShutdownReason_e enShutdownReason; /* ShutdownReason returned by NSM */
+} NSMTST__tstDbGetShutdownReasonReturn;
+
+/* Configures expected return values when calling the GetRestartReason D-Bus interface of the NSM. */
+typedef struct
+{
+ NsmRestartReason_e enRestartReason; /* RetsartReason returned by NSM */
+} NSMTST__tstDbGetRestartReasonReturn;
+
+/* Configures expected return values when calling the GetNodeState D-Bus interface of the NSM. */
+typedef struct
+{
+ NsmErrorStatus_e enErrorStatus; /* ErrorStatus returned by NSM */
+ NsmNodeState_e enNodeState; /* NodeState returned by NSM */
+} NSMTST__tstDbGetNodeStateReturn;
+
+/* Configures expected return values when calling the GetApplicationMode D-Bus interface of the NSM. */
+typedef struct
+{
+ NsmErrorStatus_e enErrorStatus; /* ErrorStatus returned by NSM */
+ NsmApplicationMode_e enApplicationMode; /* ApplicationMode returned by NSM */
+} NSMTST__tstDbGetApplicationModeReturn;
+
+/*
+ * Configures expected return values when getting the interface version using the internal
+ * NsmGetInterfaceVersion interface and the GetInterfaceVersion D-Bus interface of the NSM.
+ */
+typedef struct
+{
+ guint u32InterfaceVersion;
+} NSMTST__tstSmGetInterfaceVersionReturn,
+ NSMTST__tstDbGetInterfaceVersionReturn;
+
+/* Configures expected return values when calling the GetAppHealthCount D-Bus interface of the NSM. */
+typedef struct
+{
+ guint u32AppHealthCount; /* Number fo failed applications returned by NSM */
+} NSMTST__tstDbGetAppHealthCountReturn;
+
+/* Configures expected return value when calling different interface of the NSM. */
+typedef struct
+{
+ NsmErrorStatus_e enErrorStatus; /* ErrorStatus returned by NSM */
+} NSMTST__tstDbSetBootModeReturn,
+ NSMTST__tstDbSetNodeStateReturn,
+ NSMTST__tstDbSetApplicationReturn,
+ NSMTST__tstDbSetSessionStateReturn,
+ NSMTST__tstDbSetAppHealthStatusReturn,
+ NSMTST__tstDbRequestNodeRestartReturn,
+ NSMTST__tstDbRegisterShutdownClientReturn,
+ NSMTST__tstDbUnRegisterShutdownClientReturn,
+ NSMTST__tstDbRegisterSessionReturn,
+ NSMTST__tstDbUnRegisterSessionReturn,
+ NSMTST__tstSmSetBootModeReturn,
+ NSMTST__tstSmSetNodeStateReturn,
+ NSMTST__tstSmSetApplicationModeReturn,
+ NSMTST__tstSmSetInvalidDataReturn,
+ NSMTST__tstSmSetShutdownModeReturn,
+ NSMTST__tstSmSetSessionStateReturn,
+ NSMTST__tstTestLifecycleRequestCompleteReturn;
+
+/* Configures the expected values for the reception of the SessionState signal send by the NSM. */
+typedef struct
+{
+ gboolean boReceived; /* Flag if Session signal is expected */
+ gchar *sName; /* Name of the session for which signal is expected */
+ NsmSeat_e enSeat; /* Seat of the session for which signal is expected */
+ NsmSessionState_e enState; /* Expected session state */
+} NSMTST__tstCheckSessionSignal;
+
+/* Configures the expected values for the reception of the NodeState signal send by the NSM. */
+typedef struct
+{
+ gboolean boReceived; /* Flag if NodeState signal is expected */
+ NsmNodeState_e enNodeState; /* NodeState that is expected */
+} NSMTST__tstCheckNodeStateSignal;
+
+/* Configures the expected values for the reception of the ApplicationMode signal send by the NSM. */
+typedef struct
+{
+ gboolean boReceived; /* Flag if ApplicationMode signal is expected */
+ NsmApplicationMode_e enApplicationMode; /* ApplicationMode that is expected */
+} NSMTST__tstCheckApplicationMode;
+
+/* Configures the expected value that the NSM has passed when issuing a LifecyclRequest. */
+typedef struct
+{
+ guint u32RequestType; /* Expected RestartType (set by NSM) for life cycle client */
+} NSMTST__tstTestProcessLifecycleRequestReturn;
+
+/* The union includes all possible expected return values for the interfaces of the NSM. */
+typedef union
+{
+ /* Expected return values for internal functions that control the test */
+ NSMTST__tstTestDummyReturn stTestDummy;
+ NSMTST__tstTestProcessLifecycleRequestReturn stTestProcessLifecycleRequest;
+
+ /* Expected return values for D-Bus interfaces of the NSM */
+ NSMTST__tstDbSetBootModeReturn stDbSetBootMode;
+ NSMTST__tstDbSetNodeStateReturn stDbSetNodeState;
+ NSMTST__tstDbSetApplicationReturn stDbSetApplicationMode;
+ NSMTST__tstDbSetSessionStateReturn stDbSetSessionState;
+
+ NSMTST__tstDbGetNodeStateReturn stDbGetNodeState;
+ NSMTST__tstDbGetApplicationModeReturn stDbGetApplicationMode;
+ NSMTST__tstDbGetBootModeReturn stDbGetBootMode;
+ NSMTST__tstDbGetShutdownReasonReturn stDbGetShutdownReason;
+ NSMTST__tstDbGetRunningReasonReturn stDbGetRunningReason;
+ NSMTST__tstDbGetRestartReasonReturn stDbGetRestartReason;
+ NSMTST__tstDbGetSessionStateReturn stDbGetSessionState;
+
+ NSMTST__tstDbSetAppHealthStatusReturn stDbSetAppHealthStatus;
+ NSMTST__tstDbGetAppHealthCountReturn stDbGetAppHealthCount;
+ NSMTST__tstDbCheckLucRequired stDbCheckLucRequired;
+ NSMTST__tstDbRegisterSessionReturn stDbRegisterSession;
+ NSMTST__tstDbUnRegisterSessionReturn stDbUnRegisterSession;
+ NSMTST__tstDbRegisterShutdownClientReturn stDbRegisterShutdownClient;
+ NSMTST__tstDbUnRegisterShutdownClientReturn stDbUnRegisterShutdownClient;
+ NSMTST__tstDbRequestNodeRestartReturn stDbRequestNodeRestart;
+ NSMTST__tstDbGetInterfaceVersionReturn stDbGetInterfaceVersion;
+ NSMTST__tstTestLifecycleRequestCompleteReturn stDbLifecycleRequestComplete;
+
+ /* Expected return values for NSMC interfaces of the NSM */
+ NSMTST__tstSmSetShutdownModeReturn stSmSetShutdownReason;
+ NSMTST__tstSmSetBootModeReturn stSmSetBootMode;
+ NSMTST__tstSmSetNodeStateReturn stSmSetNodeState;
+ NSMTST__tstSmSetApplicationModeReturn stSmSetApplicationMode;
+ NSMTST__tstSmSetInvalidDataReturn stSmSetInvalidData;
+ NSMTST__tstSmSetSessionStateReturn stSmSetSessionState;
+
+ NSMTST__tstSmGetAppModeReturn stSmGetApplicationMode;
+ NSMTST__tstSmGetNodeStateReturn stSmGetNodeState;
+ NSMTST__tstSmGetRestartReasonReturn stSmGetRestartReason;
+ NSMTST__tstSmGetSessionStateReturn stSmGetSessionState;
+ NSMTST__tstSmGetShutdownReasonReturn stSmGetShutdownReason;
+ NSMTST__tstSmGetBootModeReturn stSmGetBootMode;
+ NSMTST__tstSmGetRunningReasonReturn stSmGetRunningReason;
+ NSMTST__tstSmGetInvalidDataReturn stSmGetInvalidData;
+
+ NSMTST__tstSmGetInterfaceVersionReturn stSmGetInterfaceVersion;
+
+ /* Expected signals send by NSM */
+ NSMTST__tstCheckSessionSignal stCheckSessionSignal;
+ NSMTST__tstCheckNodeStateSignal stCheckNodeStateSignal;
+ NSMTST__tstCheckApplicationMode stCheckApplicationModeSignal;
+} NSMTST__tunReturnValues;
+
+/* Type definition for a test call. */
+typedef struct
+{
+ NSMTST__tpfTestFunction pfTestCall; /* Function */
+ NSMTST__tunParameters unParameter; /* Parameters */
+ NSMTST__tunReturnValues unReturnValues; /* Expected return values */
+} NSMTST__tstTestCase;
+
+
+/**********************************************************************************************************************
+*
+* Prototypes for file local functions (see implementation for description)
+*
+**********************************************************************************************************************/
+
+/* Internal test functions. get connections, create and register objects */
+static gboolean NSMTST__boTestGetBusConnection (void);
+static gboolean NSMTST__boTestCreateConsumerProxy (void);
+static gboolean NSMTST__boTestCreateLifecycleControlProxy(void);
+static gboolean NSMTST__boTestCreateNodeStateMachineProxy(void);
+static gboolean NSMTST__boTestRegisterCallbacks (void);
+static gboolean NSMTST__boTestCreateLcClient (void);
+static gboolean NSMTST__boTestProcessLifecycleRequest (void);
+
+/* Functions to call D-Bus interfaces of the NSM */
+static gboolean NSMTST__boDbSetBootMode (void);
+static gboolean NSMTST__boDbSetApplicationMode (void);
+static gboolean NSMTST__boDbSetNodeState (void);
+static gboolean NSMTST__boDbSetSessionState (void);
+
+static gboolean NSMTST__boDbGetBootMode (void);
+static gboolean NSMTST__boDbGetApplicationMode (void);
+static gboolean NSMTST__boDbGetNodeState (void);
+static gboolean NSMTST__boDbGetSessionState (void);
+static gboolean NSMTST__boDbGetRestartReason (void);
+static gboolean NSMTST__boDbGetShutdownReason (void);
+static gboolean NSMTST__boDbGetRunningReason (void);
+
+static gboolean NSMTST__boDbCheckLucRequired (void);
+static gboolean NSMTST__boDbRegisterSession (void);
+static gboolean NSMTST__boDbUnRegisterSession (void);
+static gboolean NSMTST__boDbRegisterShutdownClient (void);
+static gboolean NSMTST__boDbUnRegisterShutdownClient (void);
+static gboolean NSMTST__boDbGetAppHealthCount (void);
+static gboolean NSMTST__boDbGetInterfaceVersion (void);
+static gboolean NSMTST__boDbRequestNodeRestart (void);
+static gboolean NSMTST__boDbSetAppHealthStatus (void);
+static gboolean NSMTST__boDbLifecycleRequestComplete (void);
+
+/* Functions to call (internal) NSMC interfaces of the NSM */
+static gboolean NSMTST__boSmSetApplicationMode (void);
+static gboolean NSMTST__boSmSetNodeState (void);
+static gboolean NSMTST__boSmSetSessionState (void);
+static gboolean NSMTST__boSmSetShutdownReason (void);
+static gboolean NSMTST__boSmSetBootMode (void);
+static gboolean NSMTST__boSmSetInvalidData (void);
+
+static gboolean NSMTST__boSmGetApplicationMode (void);
+static gboolean NSMTST__boSmGetNodeState (void);
+static gboolean NSMTST__boSmGetRestartReason (void);
+static gboolean NSMTST__boSmGetSessionState (void);
+static gboolean NSMTST__boSmGetShutdownReason (void);
+static gboolean NSMTST__boSmGetBootMode (void);
+static gboolean NSMTST__boSmGetRunningReason (void);
+static gboolean NSMTST__boSmGetInvalidData (void);
+
+static gboolean NSMTST__boSmGetInterfaceVersion (void);
+
+/* Functions to check for signals */
+static gboolean NSMTST__boCheckSessionSignal (void);
+static gboolean NSMTST__boCheckNodeStateSignal (void);
+static gboolean NSMTST__boCheckApplicationModeSignal (void);
+
+/* Internal HelperFunctions */
+static GVariant* NSMTST__pPrepareStateMachineData(guchar *pDataArray, const guint32 u32ArraySize);
+
+/* Internal callback functions to process signals */
+static gboolean NSMTST__boOnSessionSignal(NodeStateConsumer *pObject,
+ const gchar *sSessionName,
+ const gint i32SeatId,
+ const gint i32SessionState,
+ gpointer pUserData);
+
+static gboolean NSMTST__boOnApplicationModeSignal(NodeStateConsumer *pObject,
+ const gint i32ApplicationMode,
+ gpointer pUserData);
+
+static gboolean NSMTST__boOnNodeStateSignal(NodeStateConsumer *pObject,
+ const gint i32NodeState,
+ gpointer pUserData);
+
+static gboolean NSMTST__boOnLifecycleClientCb(NodeStateLifeCycleConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const guint32 u32LifeCycleRequest,
+ const guint32 u32RequestId,
+ gpointer pUserData);
+
+/**********************************************************************************************************************
+*
+* Local variables and constants
+*
+**********************************************************************************************************************/
+
+/* Basic variables for test frame */
+static GMainLoop *NSMTST__pMainLoop = NULL;
+static GDBusConnection *NSMTST__pConnection = NULL;
+
+static guint16 NSMTST__u16TestIdx = 0;
+static NSMTST__tstTestCase *NSMTST__pstTestCase = NULL;
+static gchar *NSMTST__sErrorDescription = NULL;
+static gchar *NSMTST__sTestDescription = NULL;
+static const gchar *NSMTST__sBusName = NULL;
+
+/* Created proxy objects */
+static NodeStateConsumer *NSMTST__pNodeStateConsumer = NULL;
+static NodeStateLifecycleControl *NSMTST__pLifecycleControl = NULL;
+static NodeStateTest *NSMTST__pNodeStateMachine = NULL;
+
+/* Store values from signals and LifecycleRequests */
+static NSMTST__tstCheckSessionSignal NSMTST__stReceivedSessionSignal = {0};
+static NSMTST__tstCheckNodeStateSignal NSMTST__stReceivedNodeStateSignal = {0};
+static NSMTST__tstCheckApplicationMode NSMTST__stApplicationModeSignal = {0};
+
+static NodeStateLifeCycleConsumer *NSMTST__pLifecycleConsumer = NULL;
+static GDBusMethodInvocation *NSMTST__pLifecycleInvocation = NULL;
+static guint32 NSMTST__u32LifecycleRequest = 0;
+static guint32 NSMTST__u32LifecycleRequestId = 0;
+
+/* List to handle created LifecycleConsumers */
+static GSList *NSMTST__pLifecycleClients = NULL;
+
+/*
+ * This table is the most important part of the test frame. All test cases are defined here.
+ * The test frame will perform one test case after the other, triggered by a timer.
+ *
+ * To define a test frame, the test function, the NSM parameters and the expected return values have to be configured.
+ */
+static NSMTST__tstTestCase NSMTST__astTestCases[] =
+{
+ { &NSMTST__boTestGetBusConnection, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boTestCreateConsumerProxy, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boTestCreateLifecycleControlProxy, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boTestCreateNodeStateMachineProxy, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boTestRegisterCallbacks, .unParameter.stTestDummy = {0x00}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boDbSetBootMode, .unParameter.stDbSetBootMode = {0x00}, .unReturnValues.stDbSetBootMode = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbGetBootMode, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetBootMode = {0x00} },
+ { &NSMTST__boDbSetBootMode, .unParameter.stDbSetBootMode = {0x01}, .unReturnValues.stDbSetBootMode = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbGetBootMode, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetBootMode = {0x01} },
+ { &NSMTST__boDbSetBootMode, .unParameter.stDbSetBootMode = {0x01}, .unReturnValues.stDbSetBootMode = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbGetBootMode, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetBootMode = {0x01} },
+ { &NSMTST__boSmSetBootMode, .unParameter.stSmSetBootMode = {sizeof(gint), 0x02}, .unReturnValues.stSmSetBootMode = {NsmErrorStatus_Ok } },
+ { &NSMTST__boSmSetBootMode, .unParameter.stSmSetBootMode = {sizeof(gint) + 1, 0x03}, .unReturnValues.stSmSetBootMode = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetBootMode, .unParameter.stSmSetBootMode = {sizeof(gint) - 1, 0x04}, .unReturnValues.stSmSetBootMode = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmGetBootMode, .unParameter.stSmGetBootMode = {sizeof(gint)}, .unReturnValues.stSmGetBootMode = {sizeof(gint), 0x02} },
+ { &NSMTST__boSmGetBootMode, .unParameter.stSmGetBootMode = {sizeof(gint) + 1}, .unReturnValues.stSmGetBootMode = {-1, 0x00} },
+ { &NSMTST__boSmGetBootMode, .unParameter.stSmGetBootMode = {sizeof(gint) - 1}, .unReturnValues.stSmGetBootMode = {-1, 0x00} },
+ { &NSMTST__boDbGetRunningReason, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetRunningReason = {NsmRunningReason_WakeupCan} },
+ { &NSMTST__boSmGetRunningReason, .unParameter.stSmGetRunningReason = {sizeof(NsmRunningReason_e) }, .unReturnValues.stSmGetRunningReason = {sizeof(NsmRunningReason_e), NsmRunningReason_WakeupCan} },
+ { &NSMTST__boSmGetRunningReason, .unParameter.stSmGetRunningReason = {sizeof(NsmRunningReason_e) + 1}, .unReturnValues.stSmGetRunningReason = {-1, NsmRunningReason_NotSet} },
+ { &NSMTST__boSmGetRunningReason, .unParameter.stSmGetRunningReason = {sizeof(NsmRunningReason_e) - 1}, .unReturnValues.stSmGetRunningReason = {-1, NsmRunningReason_NotSet} },
+ { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_NotSet}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), (NsmShutdownReason_e) 0xFFFFFFFF}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e) - 1, NsmShutdownReason_Normal}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e) + 1, NsmShutdownReason_Normal}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_Normal}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Ok} },
+ { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_Normal}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbGetShutdownReason, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetShutdownReason = {NsmShutdownReason_Normal} },
+ { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) }, .unReturnValues.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_Normal} },
+ { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) - 1}, .unReturnValues.stSmGetShutdownReason = {-1, NsmShutdownReason_NotSet} },
+ { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) + 1}, .unReturnValues.stSmGetShutdownReason = {-1, NsmShutdownReason_NotSet} },
+ { &NSMTST__boSmSetShutdownReason, .unParameter.stSmSetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_SupplyBad}, .unReturnValues.stSmSetShutdownReason = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbGetShutdownReason, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetShutdownReason = {NsmShutdownReason_SupplyBad} },
+ { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) }, .unReturnValues.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e), NsmShutdownReason_SupplyBad} },
+ { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) - 1}, .unReturnValues.stSmGetShutdownReason = {-1, NsmShutdownReason_NotSet} },
+ { &NSMTST__boSmGetShutdownReason, .unParameter.stSmGetShutdownReason = {sizeof(NsmShutdownReason_e) + 1}, .unReturnValues.stSmGetShutdownReason = {-1, NsmShutdownReason_NotSet} },
+ { &NSMTST__boDbGetRestartReason, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetRestartReason = {NsmRestartReason_NotSet} },
+ { &NSMTST__boSmGetRestartReason, .unParameter.stSmGetRestartReason = {sizeof(NsmRestartReason_e)}, .unReturnValues.stSmGetRestartReason = {sizeof(NsmRestartReason_e), NsmRestartReason_NotSet} },
+ { &NSMTST__boSmGetRestartReason, .unParameter.stSmGetRestartReason = {sizeof(NsmRestartReason_e) - 1}, .unReturnValues.stSmGetRestartReason = {-1, NsmRestartReason_NotSet} },
+ { &NSMTST__boSmGetRestartReason, .unParameter.stSmGetRestartReason = {sizeof(NsmRestartReason_e) + 1}, .unReturnValues.stSmGetRestartReason = {-1, NsmRestartReason_NotSet} },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_NotSet }, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {(NsmNodeState_e) 0xFFFFFFFF}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_BaseRunning }, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_BaseRunning }, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_LucRunning }, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boCheckNodeStateSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckNodeStateSignal = {TRUE, NsmNodeState_LucRunning} },
+ { &NSMTST__boDbGetNodeState, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetNodeState = {NsmErrorStatus_Ok, NsmNodeState_LucRunning} },
+ { &NSMTST__boSmSetNodeState, .unParameter.stSmSetNodeState = {sizeof(NsmNodeState_e), NsmNodeState_FullyRunning}, .unReturnValues.stSmSetNodeState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boCheckNodeStateSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckNodeStateSignal = {TRUE, NsmNodeState_FullyRunning} },
+ { &NSMTST__boSmSetNodeState, .unParameter.stSmSetNodeState = {3, NsmNodeState_FullyRunning}, .unReturnValues.stSmSetNodeState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetNodeState, .unParameter.stSmSetNodeState = {5, NsmNodeState_FullyRunning}, .unReturnValues.stSmSetNodeState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmGetNodeState, .unParameter.stSmGetNodeState = {sizeof(NsmNodeState_e) }, .unReturnValues.stSmGetNodeState = {sizeof(NsmNodeState_e), NsmNodeState_FullyRunning} },
+ { &NSMTST__boSmGetNodeState, .unParameter.stSmGetNodeState = {sizeof(NsmNodeState_e) - 1}, .unReturnValues.stSmGetNodeState = {-1, NsmNodeState_NotSet} },
+ { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {NsmApplicationMode_NotSet }, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {(NsmApplicationMode_e) 0xFFFFFFFF}, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {NsmApplicationMode_Parking }, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {NsmApplicationMode_Parking }, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetApplicationMode, .unParameter.stDbSetApplicationMode = {NsmApplicationMode_Factory }, .unReturnValues.stDbSetApplicationMode = {NsmErrorStatus_Ok} },
+ { &NSMTST__boCheckApplicationModeSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckApplicationModeSignal = {TRUE, NsmApplicationMode_Factory} },
+ { &NSMTST__boDbGetApplicationMode, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetApplicationMode = {NsmErrorStatus_Ok, NsmApplicationMode_Factory} },
+ { &NSMTST__boSmSetApplicationMode, .unParameter.stSmSetApplicationMode = {sizeof(NsmApplicationMode_e), NsmApplicationMode_Transport}, .unReturnValues.stSmSetApplicationMode = {NsmErrorStatus_Ok} },
+ { &NSMTST__boCheckApplicationModeSignal, .unParameter.stTestDummy = {0x00}, .unReturnValues.stCheckApplicationModeSignal = {TRUE, NsmApplicationMode_Transport} },
+ { &NSMTST__boSmSetApplicationMode, .unParameter.stSmSetApplicationMode = {3, NsmApplicationMode_Transport}, .unReturnValues.stSmSetApplicationMode = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetApplicationMode, .unParameter.stSmSetApplicationMode = {5, NsmApplicationMode_Transport}, .unReturnValues.stSmSetApplicationMode = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmGetApplicationMode, .unParameter.stSmGetApplicationMode = {sizeof(NsmApplicationMode_e) + 1}, .unReturnValues.stSmGetApplicationMode = {-1, NsmApplicationMode_NotSet} },
+ { &NSMTST__boSmGetApplicationMode, .unParameter.stSmGetApplicationMode = {sizeof(NsmApplicationMode_e) }, .unReturnValues.stSmGetApplicationMode = {sizeof(NsmApplicationMode_e), NsmApplicationMode_Transport} },
+ { &NSMTST__boDbGetInterfaceVersion, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetInterfaceVersion = {NSM_INTERFACE_VERSION} },
+ { &NSMTST__boSmGetInterfaceVersion, .unParameter.stTestDummy = {0x00}, .unReturnValues.stSmGetInterfaceVersion = {NSM_INTERFACE_VERSION} },
+ { &NSMTST__boSmSetInvalidData, .unParameter.stSmSetInvalidData = {sizeof(NsmRunningReason_e), NsmDataType_RunningReason}, .unReturnValues.stSmSetInvalidData = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetInvalidData, .unParameter.stSmSetInvalidData = {sizeof(NsmRestartReason_e), NsmDataType_RestartReason}, .unReturnValues.stSmSetInvalidData = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmSetInvalidData, .unParameter.stSmSetInvalidData = {sizeof(NsmRestartReason_e), 0xFFFFFFFF }, .unReturnValues.stSmSetInvalidData = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boSmGetInvalidData, .unParameter.stSmGetInvalidData = {sizeof(NsmRestartReason_e), 0xFFFFFFFF }, .unReturnValues.stSmGetInvalidData = {-1} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateManager", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {NSMTST__260CHAR_STRING, "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", NSMTST__260CHAR_STRING, NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateTest", NsmSeat_NotSet, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateTest", (NsmSeat_e) 0xFFFFFFFF, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Unregistered}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"VoiceControl", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {NSMTST__260CHAR_STRING, "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_Parameter } },
+ { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"VoiceControl", NSMTST__260CHAR_STRING, NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_Parameter } },
+ { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_WrongSession} },
+ { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"Unknown", "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_WrongSession} },
+ { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"VoiceControl", "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_Ok } },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {NSMTST__260CHAR_STRING, "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter } },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", NSMTST__260CHAR_STRING, NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter } },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_WrongSession} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateManager", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Unregistered}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateTest", NsmSeat_NotSet, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"VoiceControl", "NodeStateTest", (NsmSeat_e) 0xFFFFFFFF, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active }, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, (NsmSessionState_e) 0x03}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok } },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest02", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Error } },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok } },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_WrongSession} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Inactive}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbGetSessionState, .unParameter.stDbGetSessionState = {NSMTST__260CHAR_STRING, NsmSeat_Driver}, .unReturnValues.stDbGetSessionState = {NsmErrorStatus_Parameter, NsmSessionState_Unregistered } },
+ { &NSMTST__boDbGetSessionState, .unParameter.stDbGetSessionState = {"ProductSession", NsmSeat_Driver}, .unReturnValues.stDbGetSessionState = {NsmErrorStatus_Ok, NsmSessionState_Inactive } },
+ { &NSMTST__boDbGetSessionState, .unParameter.stDbGetSessionState = {"UnknownSession", NsmSeat_Driver}, .unReturnValues.stDbGetSessionState = {NsmErrorStatus_WrongSession, NsmSessionState_Unregistered} },
+ { &NSMTST__boSmGetSessionState, .unParameter.stSmGetSessionState = {sizeof(NsmSession_s), {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmGetSessionState = {sizeof(NsmSession_s), NsmSessionState_Inactive} },
+ { &NSMTST__boDbUnRegisterSession, .unParameter.stDbUnRegisterSession = {"ProductSession", "NodeStateTest", NsmSeat_Driver}, .unReturnValues.stDbUnRegisterSession = {NsmErrorStatus_Ok} },
+ { &NSMTST__boSmSetSessionState, .unParameter.stSmSetSessionState = {sizeof(NsmSession_s), {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmSetSessionState = {NsmErrorStatus_WrongSession} },
+ { &NSMTST__boSmSetSessionState, .unParameter.stSmSetSessionState = {4, {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmSetSessionState = {NsmErrorStatus_Parameter } },
+ { &NSMTST__boSmGetSessionState, .unParameter.stSmGetSessionState = {5, {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}}, .unReturnValues.stSmGetSessionState = {-1, NsmSessionState_Unregistered} },
+ { &NSMTST__boDbGetAppHealthCount, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbGetAppHealthCount = {0x00} },
+ { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {NSMTST__260CHAR_STRING, TRUE }, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", TRUE }, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Error} },
+ { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", FALSE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", TRUE }, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbRegisterSession, .unParameter.stDbRegisterSession = {"ProductSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbRegisterSession = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", FALSE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest1", FALSE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", TRUE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"DiagnosisSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetSessionState, .unParameter.stDbSetSessionState = {"HevacSession", "NodeStateTest", NsmSeat_Driver, NsmSessionState_Active}, .unReturnValues.stDbSetSessionState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbSetAppHealthStatus, .unParameter.stDbSetAppHealthStatus = {"NodeStateTest", FALSE}, .unReturnValues.stDbSetAppHealthStatus = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbCheckLucRequired, .unParameter.stTestDummy = {0x00}, .unReturnValues.stDbCheckLucRequired = {TRUE} },
+ { &NSMTST__boDbRequestNodeRestart, .unParameter.stDbRequestNodeRestart = {NsmRestartReason_ApplicationFailure, NSM_SHUTDOWNTYPE_NORMAL}, .unReturnValues.stDbRequestNodeRestart = {NsmErrorStatus_Ok} },
+ { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient01"}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient02"}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient03"}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient04"}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boTestCreateLcClient, .unParameter.stTestCreateLcClient = {"/org/genivi/NodeStateTest/LcClient05"}, .unReturnValues.stTestDummy = {0x00} },
+ { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient01", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient01", NSM_SHUTDOWNTYPE_FAST, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient02", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient02", NSM_SHUTDOWNTYPE_FAST, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient03", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient04", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient05", NSM_SHUTDOWNTYPE_NORMAL | NSM_SHUTDOWNTYPE_FAST, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbRegisterShutdownClient, .unParameter.stDbRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient06", NSM_SHUTDOWNTYPE_NORMAL, 2000}, .unReturnValues.stDbRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbUnRegisterShutdownClient, .unParameter.stDbUnRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient01", NSM_SHUTDOWNTYPE_FAST}, .unReturnValues.stDbUnRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbUnRegisterShutdownClient, .unParameter.stDbUnRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient06", NSM_SHUTDOWNTYPE_NORMAL}, .unReturnValues.stDbUnRegisterShutdownClient = {NsmErrorStatus_Ok} },
+ { &NSMTST__boDbUnRegisterShutdownClient, .unParameter.stDbUnRegisterShutdownClient = {"/org/genivi/NodeStateTest/LcClient07", NSM_SHUTDOWNTYPE_NORMAL}, .unReturnValues.stDbUnRegisterShutdownClient = {NsmErrorStatus_Parameter} },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_ShuttingDown}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok }, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok }, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Error }, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_ResponsePending}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
+ { &NSMTST__boDbLifecycleRequestComplete, .unParameter.stDbLifecycleRequestComplete = {NsmErrorStatus_Ok }, .unReturnValues.stDbLifecycleRequestComplete = {NsmErrorStatus_Ok } },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_BaseRunning}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_NORMAL} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_FastShutdown}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_FAST} },
+ { &NSMTST__boDbSetNodeState, .unParameter.stDbSetNodeState = {NsmNodeState_BaseRunning}, .unReturnValues.stDbSetNodeState = {NsmErrorStatus_Ok} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_FAST} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
+ { &NSMTST__boTestProcessLifecycleRequest, .unParameter.stTestProcessLifecycleRequest = {NsmErrorStatus_Ok}, .unReturnValues.stTestProcessLifecycleRequest = {NSM_SHUTDOWNTYPE_RUNUP} },
+};
+
+
+/**********************************************************************************************************************
+*
+* Local (static) functions
+*
+**********************************************************************************************************************/
+
+/**********************************************************************************************************************
+*
+* Helper function to prepare data for StateMachine. Data is read from the passed array and converted into a GVariant.
+*
+* @param pDataArray: Array which should be written to GVariant.
+* @param u32ArraySize: Number of bytes that the array at pDataArray contains.
+*
+* @return GVariant of type "ay" that includes the passed data.
+*
+**********************************************************************************************************************/
+static GVariant* NSMTST__pPrepareStateMachineData(guchar *pDataArray, const guint32 u32ArraySize)
+{
+ /* Function local variables */
+ guint32 u32ArrayIdx = 0; /* Index to loop through data */
+ GVariant **aArrayElements = NULL; /* GVariant elements to build "ay" */
+
+ aArrayElements = g_new(GVariant*, u32ArraySize); /* Create new variants */
+
+ /* Store bytes in new variants */
+ for(u32ArrayIdx = 0; u32ArrayIdx < u32ArraySize; u32ArrayIdx++)
+ {
+ aArrayElements[u32ArrayIdx] = g_variant_new_byte(pDataArray[u32ArrayIdx]);
+ }
+
+ /* Return a new varaint array */
+ return g_variant_new_array(G_VARIANT_TYPE_BYTE, aArrayElements, u32ArraySize);
+}
+
+/**********************************************************************************************************************
+*
+* Helper function to retrieve StateMachine data from received GVariant.
+*
+* @param pVariantArray: Pointer to the variant that contaions the data.
+* @param pDataArray: Pointer where the bytes from pVariantArray should be stored.
+* The caller has to assert that there are as many bytes reserved as the variant has children.
+*
+**********************************************************************************************************************/
+static void NSMTST__vGetStateMachineData(GVariant *pVariantArray, guchar *pDataArray)
+{
+ /* Function local variables */
+ guint u32ArrayIdx = 0; /* Index to loop through data */
+ GVariant *pArrayElement = NULL; /* Pointer to variant child */
+
+ /* Loop through all children iof the source variant */
+ for(u32ArrayIdx = 0; u32ArrayIdx < g_variant_n_children(pVariantArray); u32ArrayIdx++)
+ {
+ /* Get the variant child and get the byte value from it. */
+ pArrayElement = g_variant_get_child_value(pVariantArray, u32ArrayIdx);
+ pDataArray[u32ArrayIdx] = g_variant_get_byte(pArrayElement);
+ }
+
+ g_variant_unref(pVariantArray); /* Release the variant */
+}
+
+/**********************************************************************************************************************
+*
+* Test function to get the bus connection.
+*
+* @return TRUE: Test case successful. FALSE: Test case failed.
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boTestGetBusConnection(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL; /* DBus Error */
+
+ NSMTST__sTestDescription = g_strdup_printf("Get connection to %s bus.",
+ NSM_BUS_TYPE == G_BUS_TYPE_SYSTEM ? "system" : "session");
+
+ NSMTST__pConnection = g_bus_get_sync(NSM_BUS_TYPE, NULL, &pError);
+
+ if(pError == NULL)
+ {
+ NSMTST__sBusName = g_dbus_connection_get_unique_name(NSMTST__pConnection);
+
+ if(NSMTST__sBusName != NULL)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to get bus name.");
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to get bus connection. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+/**********************************************************************************************************************
+*
+* Test function to create NodeStateConsumer proxy.
+*
+* @return TRUE: Test case successful. FALSE: Test case failed.
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boTestCreateConsumerProxy(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL; /* DBus Error */
+
+ /* Write test description */
+ NSMTST__sTestDescription = g_strdup("Create NodeStateConsumer proxy.");
+
+ NSMTST__pNodeStateConsumer = node_state_consumer_proxy_new_sync(NSMTST__pConnection,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NSM_BUS_NAME,
+ NSM_CONSUMER_OBJECT,
+ NULL,
+ &pError);
+
+ if(pError != NULL)
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create proxy object. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+/**********************************************************************************************************************
+*
+* Test function to create LifecycleControl proxy.
+*
+* @return TRUE: Test case successful. FALSE: Test case failed.
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boTestCreateLifecycleControlProxy(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL; /* DBus Error */
+
+ /* Write test description */
+ NSMTST__sTestDescription = g_strdup("Create LifecycleControl proxy.");
+
+ NSMTST__pLifecycleControl = node_state_lifecycle_control_proxy_new_sync(NSMTST__pConnection,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NSM_BUS_NAME,
+ NSM_LIFECYCLE_OBJECT,
+ NULL,
+ &pError);
+
+ if(pError != NULL)
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create proxy object. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+/**********************************************************************************************************************
+*
+* Test function to create NodeStateMachineTest proxy.
+*
+* @return TRUE: Test case successful. FALSE: Test case failed.
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boTestCreateNodeStateMachineProxy(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL; /* DBus Error */
+
+ /* Write test description */
+ NSMTST__sTestDescription = g_strdup("Create NodeStateMachine proxy.");
+
+ NSMTST__pNodeStateMachine = node_state_test_proxy_new_sync(NSMTST__pConnection,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NSM_BUS_NAME,
+ "/com/contiautomotive/NodeStateMachineTest",
+ NULL,
+ &pError);
+
+ if(pError != NULL)
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create proxy object. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+/**********************************************************************************************************************
+*
+* Test function to register callbacks.
+*
+* @return TRUE: Test case successful. FALSE: Test case failed.
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boTestRegisterCallbacks(void)
+{
+ /* Provide test description */
+ NSMTST__sTestDescription = g_strdup("Register callbacks for SessionState, NodeState and ApplicationMode signals.");
+
+ /* Perform test calls */
+ g_signal_connect(NSMTST__pNodeStateConsumer, "node-state", G_CALLBACK(NSMTST__boOnNodeStateSignal), NULL);
+ g_signal_connect(NSMTST__pNodeStateConsumer, "node-application-mode", G_CALLBACK(NSMTST__boOnApplicationModeSignal), NULL);
+ g_signal_connect(NSMTST__pNodeStateConsumer, "session-state-changed", G_CALLBACK(NSMTST__boOnSessionSignal), NULL);
+
+ return TRUE;
+}
+
+/**********************************************************************************************************************
+*
+* Test function for trying to set invalid data via the (internal) NsmSetData of the NSM.
+*
+* @return TRUE: Test case successful. FALSE: Test case failed.
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boSmSetInvalidData(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set invalid data. Interface: StateMachine.");
+
+ /* Perform test call */
+ pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
+ (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
+ NSMTST__pstTestCase->unParameter.stSmSetInvalidData.enDataType,
+ pDataIn,
+ NSMTST__pstTestCase->unParameter.stSmSetInvalidData.u32DataLen,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmSetInvalidData.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmSetInvalidData.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmGetInvalidData(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ GVariant *pDataOut = NULL;
+ gint i32ReceivedNsmReturn = -1;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Get invalid data. Interface: StateMachine.");
+
+ /* Perform test call */
+ pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
+ (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
+ NSMTST__pstTestCase->unParameter.stSmGetInvalidData.enDataType,
+ pDataIn,
+ NSMTST__pstTestCase->unParameter.stSmGetInvalidData.u32DataLen,
+ &pDataOut,
+ &i32ReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+ g_variant_unref(pDataOut);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(i32ReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmGetInvalidData.i32WrittenBytes)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ i32ReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmGetInvalidData.i32WrittenBytes);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbGetRestartReason(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ NsmRestartReason_e enReceivedRestartReason = NsmRestartReason_NotSet; /* Value returned by NSM */
+ NsmRestartReason_e enExpectedRestartReason = NsmRestartReason_NotSet; /* Expected value */
+
+ enExpectedRestartReason = NSMTST__pstTestCase->unReturnValues.stDbGetRestartReason.enRestartReason;
+
+ /* Provide test description */
+ NSMTST__sTestDescription = g_strdup_printf("Get RestartReason. Interface: D-Bus. Expected value: 0x%02X.",
+ enExpectedRestartReason);
+
+ enReceivedRestartReason = (NsmRestartReason_e) node_state_consumer_get_restart_reason(NSMTST__pNodeStateConsumer);
+
+ if(enReceivedRestartReason != enExpectedRestartReason)
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedRestartReason, enExpectedRestartReason);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbGetShutdownReason(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ NsmShutdownReason_e enReceivedShutdownReason = NsmShutdownReason_NotSet; /* Value returned by NSM */
+ NsmShutdownReason_e enExpectedShutdownReason = NsmShutdownReason_NotSet; /* Expected value */
+
+ enExpectedShutdownReason = NSMTST__pstTestCase->unReturnValues.stDbGetShutdownReason.enShutdownReason;
+
+ NSMTST__sTestDescription = g_strdup_printf("Get ShutdownReason. Interface: D-Bus. Expected value: 0x%02X.",
+ enExpectedShutdownReason);
+
+ enReceivedShutdownReason = (NsmShutdownReason_e) node_state_consumer_get_shutdown_reason(NSMTST__pNodeStateConsumer);
+
+ if(enReceivedShutdownReason != enExpectedShutdownReason)
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedShutdownReason, enExpectedShutdownReason);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbGetRunningReason(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ NsmRunningReason_e enReceivedRunningReason = NsmShutdownReason_NotSet; /* Value returned by NSM */
+
+ /* Provide test description */
+ NSMTST__sTestDescription = g_strdup_printf("Get RunningReason. Interface: D-Bus. Expected value: 0x%02X.",
+ NSMTST__pstTestCase->unReturnValues.stDbGetRunningReason.enRunningReason);
+
+ enReceivedRunningReason = (NsmRunningReason_e) node_state_consumer_get_wake_up_reason(NSMTST__pNodeStateConsumer);
+
+ if(enReceivedRunningReason != NSMTST__pstTestCase->unReturnValues.stDbGetRunningReason.enRunningReason)
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedRunningReason, NSMTST__pstTestCase->unReturnValues.stDbGetRunningReason.enRunningReason);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbGetBootMode(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ gint i32ReceivedBootMode = 0x00; /* Value returned by NSM */
+ gint i32ExpectedBootMode = 0x00; /* Expected value */
+
+ i32ExpectedBootMode = NSMTST__pstTestCase->unReturnValues.stDbGetBootMode.i32BootMode;
+
+ /* Provide test description */
+ NSMTST__sTestDescription = g_strdup_printf("Get BootMode. Interface: D-Bus. Expected value: 0x%02X.",
+ i32ExpectedBootMode);
+
+ i32ReceivedBootMode = (gint) node_state_consumer_get_boot_mode(NSMTST__pNodeStateConsumer);
+
+ if(i32ReceivedBootMode != i32ExpectedBootMode)
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: 0x%02X. Expected: 0x%02X.",
+ i32ReceivedBootMode, i32ExpectedBootMode);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmGetApplicationMode(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ GVariant *pDataOut = NULL;
+ gint i32ReceivedNsmReturn = -1;
+ gchar *sExpectedValue = NULL;
+ guint u32ReceivedDataLen = 0x00;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetApplicationMode.u32DataLen;
+
+ /* Values read from return config */
+ const gint i32ExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmGetApplicationMode.i32WrittenBytes;
+ const NsmApplicationMode_e enExpectedApplicationMode = NSMTST__pstTestCase->unReturnValues.stSmGetApplicationMode.enApplicationMode;
+
+ /* Variables need to adapt test case */
+ NsmApplicationMode_e enReceivedApplicationMode = NsmApplicationMode_NotSet; /* Value returned by NSM */
+ const gchar *sNsmValue = "ApplicationMode";
+ const NsmDataType_e enDataType = NsmDataType_AppMode;
+ const guint u32RealDataLen = sizeof(NsmApplicationMode_e);
+
+ /* Create test case description */
+ sExpectedValue = (u32DataLen == u32RealDataLen)
+ ? g_strdup_printf("0x%02X", enExpectedApplicationMode)
+ : g_strdup_printf("%s", "-");
+
+ NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
+ sNsmValue, u32DataLen, sExpectedValue);
+ g_free(sExpectedValue);
+
+ /* Perform test call */
+ pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
+ (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ &pDataOut,
+ &i32ReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(i32ReceivedNsmReturn == i32ExpectedNsmReturn)
+ {
+ /* The NSM returned with the expected value. Check if the value should be valid. */
+ if(u32DataLen == u32RealDataLen)
+ {
+ /* We called the NSM with the correct DataLen. Check the received value. */
+ u32ReceivedDataLen = g_variant_n_children(pDataOut);
+ if(u32RealDataLen == u32ReceivedDataLen)
+ {
+ NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedApplicationMode);
+ if(enReceivedApplicationMode == enExpectedApplicationMode)
+ {
+
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
+ sNsmValue, enReceivedApplicationMode, enExpectedApplicationMode);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
+ u32ReceivedDataLen, u32RealDataLen);
+ }
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ i32ReceivedNsmReturn, i32ExpectedNsmReturn);
+ }
+
+ g_variant_unref(pDataOut);
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmGetNodeState(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ GVariant *pDataOut = NULL;
+ gint i32ReceivedNsmReturn = -1;
+ gchar *sExpectedValue = NULL;
+ guint u32ReceivedDataLen = 0x00;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetNodeState.u32DataLen;
+
+ /* Values read from return config */
+ const gint i32ExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmGetNodeState.i32WrittenBytes;
+ const NsmNodeState_e enExpectedNodeState = NSMTST__pstTestCase->unReturnValues.stSmGetNodeState.enNodeState;
+
+ /* Variables need to adapt test case */
+ NsmNodeState_e enReceivedNodeState = NsmNodeState_NotSet; /* Value returned by NSM */
+ const gchar *sNsmValue = "NodeState";
+ const NsmDataType_e enDataType = NsmDataType_NodeState;
+ const guint u32RealDataLen = sizeof(NsmNodeState_e);
+
+ /* Create test case description */
+ sExpectedValue = (u32DataLen == sizeof(NsmNodeState_e))
+ ? g_strdup_printf("0x%02X", enExpectedNodeState)
+ : g_strdup_printf("%s", "-");
+
+ NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
+ sNsmValue, u32DataLen, sExpectedValue);
+ g_free(sExpectedValue);
+
+ /* Perform test call */
+ pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
+ (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ &pDataOut,
+ &i32ReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(i32ReceivedNsmReturn == i32ExpectedNsmReturn)
+ {
+ /* The NSM returned with the expected value. Check if the value should be valid. */
+ if(u32DataLen == u32RealDataLen)
+ {
+ /* We called the NSM with the correct DataLen. Check the received value. */
+ u32ReceivedDataLen = g_variant_n_children(pDataOut);
+ if(u32RealDataLen == u32ReceivedDataLen)
+ {
+ NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedNodeState);
+ if(enReceivedNodeState == enExpectedNodeState)
+ {
+
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
+ sNsmValue, enReceivedNodeState, enExpectedNodeState);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
+ u32ReceivedDataLen, u32RealDataLen);
+ }
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ i32ReceivedNsmReturn, i32ExpectedNsmReturn);
+ }
+
+ g_variant_unref(pDataOut);
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmGetRestartReason(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ GVariant *pDataOut = NULL;
+ gint i32ReceivedNsmReturn = 0x00;
+ gchar *sExpectedValue = NULL;
+ guint u32ReceivedDataLen = 0x00;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetRestartReason.u32DataLen;
+
+ /* Values read from return config */
+ const NsmRestartReason_e enExpectedRestartReason = NSMTST__pstTestCase->unReturnValues.stSmGetRestartReason.enRestartReason;
+
+ /* Variables need to adapt test case */
+ NsmRestartReason_e enReceivedRestartReason = NsmRestartReason_NotSet; /* Value returned by NSM */
+ const gchar *sNsmValue = "RestartReason";
+ const NsmDataType_e enDataType = NsmDataType_RestartReason;
+ const guint u32RealDataLen = sizeof(NsmRestartReason_e);
+
+ /* Create test case description */
+ sExpectedValue = (u32DataLen == u32RealDataLen)
+ ? g_strdup_printf("0x%02X", enExpectedRestartReason)
+ : g_strdup_printf("%s", "-");
+
+ NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
+ sNsmValue, u32DataLen, sExpectedValue);
+ g_free(sExpectedValue);
+
+ /* Perform test call */
+ pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
+ (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ &pDataOut,
+ &i32ReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(i32ReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmGetRestartReason.i32WrittenBytes)
+ {
+ /* The NSM returned with the expected value. Check if the value should be valid. */
+ if(u32DataLen == u32RealDataLen)
+ {
+ /* We called the NSM with the correct DataLen. Check the received value. */
+ u32ReceivedDataLen = g_variant_n_children(pDataOut);
+ if(u32RealDataLen == u32ReceivedDataLen)
+ {
+ NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedRestartReason);
+ if(enReceivedRestartReason == enExpectedRestartReason)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
+ sNsmValue, enReceivedRestartReason, enExpectedRestartReason);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
+ u32ReceivedDataLen, u32RealDataLen);
+ }
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ i32ReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmGetRestartReason.i32WrittenBytes);
+ }
+
+ g_variant_unref(pDataOut);
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmGetSessionState(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ GVariant *pDataOut = NULL;
+ gint i32ReceivedNsmReturn = -1;
+ gchar *sExpectedValue = NULL;
+ guint u32ReceivedDataLen = 0x00;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetSessionState.u32DataLen;
+
+ /* Values read from return config */
+ const gint i32ExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmGetSessionState.i32WrittenBytes;
+ const NsmSessionState_e enExpectedSessionState = NSMTST__pstTestCase->unReturnValues.stSmGetSessionState.enSessionState;
+
+ /* Variables need to adapt test case */
+ NsmSession_s stReceivedSession; /* Value returned by NSM */
+ const gchar *sNsmValue = "SessionState";
+ const NsmDataType_e enDataType = NsmDataType_SessionState;
+ const guint u32RealDataLen = sizeof(NsmSession_s);
+
+ /* Create test case description */
+ sExpectedValue = (u32DataLen == u32RealDataLen)
+ ? g_strdup_printf("0x%02X", NSMTST__pstTestCase->unParameter.stSmGetSessionState.sSession.enState)
+ : g_strdup_printf("%s", "-");
+
+ NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
+ sNsmValue, u32DataLen, sExpectedValue);
+ g_free(sExpectedValue);
+
+ /* Perform test call */
+ pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &(NSMTST__pstTestCase->unParameter.stSmGetSessionState.sSession), u32RealDataLen);
+ (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ &pDataOut,
+ &i32ReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(i32ExpectedNsmReturn == i32ReceivedNsmReturn)
+ {
+ /* The NSM returned with the expected value. Check if the value should be valid. */
+ if(u32DataLen == u32RealDataLen)
+ {
+ /* We called the NSM with the correct DataLen. Check the received value. */
+ u32ReceivedDataLen = g_variant_n_children(pDataOut);
+ if(u32RealDataLen == u32ReceivedDataLen)
+ {
+ NSMTST__vGetStateMachineData(pDataOut, (guchar*) &stReceivedSession);
+ if(enExpectedSessionState == stReceivedSession.enState)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
+ sNsmValue, stReceivedSession.enState, enExpectedSessionState);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
+ u32ReceivedDataLen, u32RealDataLen);
+ }
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: %d. Expected: %d.",
+ i32ReceivedNsmReturn, i32ExpectedNsmReturn);
+ }
+
+ g_variant_unref(pDataOut);
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+static gboolean NSMTST__boSmGetShutdownReason(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ GVariant *pDataOut = NULL;
+ gint i32ReceivedNsmReturn = -1;
+ gchar *sExpectedValue = NULL;
+ guint u32ReceivedDataLen = 0x00;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetShutdownReason.u32DataLen;
+
+ /* Values read from return config */
+ const gint i32ExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmGetShutdownReason.i32WrittenBytes;
+ const NsmShutdownReason_e enExpectedShutdownReason = NSMTST__pstTestCase->unReturnValues.stSmGetShutdownReason.enShutdownReason;
+
+ /* Variables need to adapt test case */
+ NsmShutdownReason_e enReceivedShutdownReason = NsmShutdownReason_NotSet; /* Value returned by NSM */
+ const gchar *sNsmValue = "ShutdownReason";
+ const NsmDataType_e enDataType = NsmDataType_ShutdownReason;
+ const guint u32RealDataLen = sizeof(NsmShutdownReason_e);
+
+ /* Create test case description */
+ sExpectedValue = (u32DataLen == u32RealDataLen)
+ ? g_strdup_printf("0x%02X", enExpectedShutdownReason)
+ : g_strdup_printf("%s", "-");
+
+ NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
+ sNsmValue, u32DataLen, sExpectedValue);
+ g_free(sExpectedValue);
+
+ /* Perform test call */
+ pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
+ (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ &pDataOut,
+ &i32ReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(i32ReceivedNsmReturn == i32ExpectedNsmReturn)
+ {
+ /* The NSM returned with the expected value. Check if the value should be valid. */
+ if(u32DataLen == u32RealDataLen)
+ {
+ /* We called the NSM with the correct DataLen. Check the received value. */
+ u32ReceivedDataLen = g_variant_n_children(pDataOut);
+ if(u32RealDataLen == u32ReceivedDataLen)
+ {
+ NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedShutdownReason);
+ if(enReceivedShutdownReason == enExpectedShutdownReason)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
+ sNsmValue, enReceivedShutdownReason, enExpectedShutdownReason);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
+ u32ReceivedDataLen, u32RealDataLen);
+ }
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ i32ReceivedNsmReturn, i32ExpectedNsmReturn);
+ }
+
+ g_variant_unref(pDataOut);
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmGetBootMode(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn, *pDataOut = NULL;
+ gint i32ReceivedNsmReturn = -1;
+ gchar *sExpectedValue = NULL;
+ guint u32ReceivedDataLen = 0x00;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetBootMode.u32DataLen;
+
+ /* Values read from return config */
+ const gint i32ExpectedBootMode = NSMTST__pstTestCase->unReturnValues.stSmGetBootMode.i32BootMode;
+
+ /* Variables need to adapt test case */
+ gint i32ReceivedBootMode = 0x00; /* Value returned by NSM */
+ const gchar *sNsmValue = "BootMode";
+ const NsmDataType_e enDataType = NsmDataType_BootMode;
+ const guint u32RealDataLen = sizeof(gint);
+
+ /* Create test case description */
+ sExpectedValue = (u32DataLen == u32RealDataLen)
+ ? g_strdup_printf("0x%02X", i32ExpectedBootMode)
+ : g_strdup_printf("%s", "-");
+
+ NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
+ sNsmValue, u32DataLen, sExpectedValue);
+ g_free(sExpectedValue);
+
+ /* Perform test call */
+ pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
+ (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ &pDataOut,
+ &i32ReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(i32ReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmGetBootMode.i32WrittenBytes)
+ {
+ /* The NSM returned with the expected value. Check if the value should be valid. */
+ if(u32DataLen == u32RealDataLen)
+ {
+ /* We called the NSM with the correct DataLen. Check the received value. */
+ u32ReceivedDataLen = g_variant_n_children(pDataOut);
+ if(u32RealDataLen == u32ReceivedDataLen)
+ {
+ NSMTST__vGetStateMachineData(pDataOut, (guchar*) &i32ReceivedBootMode);
+ if(i32ReceivedBootMode == i32ExpectedBootMode)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
+ sNsmValue, i32ReceivedBootMode, i32ExpectedBootMode);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
+ u32ReceivedDataLen, u32RealDataLen);
+ }
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ i32ReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmGetBootMode.i32WrittenBytes);
+ }
+
+ g_variant_unref(pDataOut);
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmGetRunningReason(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ GVariant *pDataOut = NULL;
+ gint i32ReceivedNsmReturn = -1;
+ gchar *sExpectedValue = NULL;
+ guint u32ReceivedDataLen = 0x00;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmGetRunningReason.u32DataLen;
+
+ /* Values read from return config */
+ const NsmRunningReason_e enExpectedRunningReason = NSMTST__pstTestCase->unReturnValues.stSmGetRunningReason.enRunningReason;
+
+ /* Variables need to adapt test case */
+ NsmRunningReason_e enReceivedRunningReason = NsmRunningReason_NotSet; /* Value returned by NSM */
+ const gchar *sNsmValue = "RunningReason";
+ const NsmDataType_e enDataType = NsmDataType_RunningReason;
+ const guint u32RealDataLen = sizeof(NsmRunningReason_e);
+
+ /* Create test case description */
+ sExpectedValue = (u32DataLen == u32RealDataLen)
+ ? g_strdup_printf("0x%02X", enExpectedRunningReason)
+ : g_strdup_printf("%s", "-");
+
+ NSMTST__sTestDescription = g_strdup_printf("Get %s. Interface: StateMachine. Passed DataLen: %d. Expected value: %s.",
+ sNsmValue, u32DataLen, sExpectedValue);
+ g_free(sExpectedValue);
+
+ /* Perform test call */
+ pDataIn = g_variant_new_array(G_VARIANT_TYPE_BYTE, NULL, 0);
+ (void) node_state_test_call_get_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ &pDataOut,
+ &i32ReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(i32ReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stSmGetRunningReason.i32WrittenBytes)
+ {
+ /* The NSM returned with the expected value. Check if the value should be valid. */
+ if(u32DataLen == u32RealDataLen)
+ {
+ /* We called the NSM with the correct DataLen. Check the received value. */
+ u32ReceivedDataLen = g_variant_n_children(pDataOut);
+ if(u32RealDataLen == u32ReceivedDataLen)
+ {
+ NSMTST__vGetStateMachineData(pDataOut, (guchar*) &enReceivedRunningReason);
+ if(enReceivedRunningReason == enExpectedRunningReason)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected %s. Received: 0x%02X. Expected: 0x%02X.",
+ sNsmValue, enReceivedRunningReason, enExpectedRunningReason);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive data of expected length. Received: %d Byte. Expected: %d Byte.",
+ u32ReceivedDataLen, u32RealDataLen);
+ }
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: %d. Expected: %d.",
+ i32ReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stSmGetRunningReason.i32WrittenBytes);
+ }
+
+ g_variant_unref(pDataOut);
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+
+static gboolean NSMTST__boSmSetApplicationMode(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetApplicationMode.u32DataLen;
+ const NsmApplicationMode_e enApplicationMode = NSMTST__pstTestCase->unParameter.stSmSetApplicationMode.enApplicationMode;
+
+ /* Values read from return config */
+ const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetApplicationMode.enErrorStatus;
+
+ /* Variables need to adapt test case */
+ const gchar *sNsmValue = "ApplicationMode";
+ const NsmDataType_e enDataType = NsmDataType_AppMode;
+ const guint u32RealDataLen = sizeof(NsmApplicationMode_e);
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
+ sNsmValue, u32DataLen);
+
+ /* Perform test call */
+ pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &enApplicationMode, u32RealDataLen);
+ (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == enExpectedNsmReturn)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, enExpectedNsmReturn);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmSetNodeState(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetNodeState.u32DataLen;
+ const NsmNodeState_e enNodeState = NSMTST__pstTestCase->unParameter.stSmSetNodeState.enNodeState;
+
+ /* Values read from return config */
+ const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetNodeState.enErrorStatus;
+
+ /* Variables need to adapt test case */
+ const gchar *sNsmValue = "NodeState";
+ const NsmDataType_e enDataType = NsmDataType_NodeState;
+ const guint u32RealDataLen = sizeof(NsmNodeState_e);
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
+ sNsmValue, u32DataLen);
+
+ /* Perform test call */
+ pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &enNodeState, u32RealDataLen);
+ (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == enExpectedNsmReturn)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, enExpectedNsmReturn);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+static gboolean NSMTST__boSmSetSessionState(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetSessionState.u32DataLen;
+ const NsmSession_s stSession = NSMTST__pstTestCase->unParameter.stSmSetSessionState.stSession;
+
+ /* Values read from return config */
+ const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetSessionState.enErrorStatus;
+
+ /* Variables need to adapt test case */
+ const gchar *sNsmValue = "SessionState";
+ const NsmDataType_e enDataType = NsmDataType_SessionState;
+ const guint u32RealDataLen = sizeof(NsmSession_s);
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
+ sNsmValue, u32DataLen);
+ /* Perform test call */
+ pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &stSession, u32RealDataLen);
+ (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == enExpectedNsmReturn)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, enExpectedNsmReturn);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmSetShutdownReason(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetShutdownReason.u32DataLen;
+ const NsmShutdownReason_e enShutdownReason = NSMTST__pstTestCase->unParameter.stSmSetShutdownReason.enShutdownReason;
+
+ /* Values read from return config */
+ const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetShutdownReason.enErrorStatus;
+
+ /* Variables need to adapt test case */
+ const gchar *sNsmValue = "ShutdownReason";
+ const NsmDataType_e enDataType = NsmDataType_ShutdownReason;
+ const guint u32RealDataLen = sizeof(NsmShutdownReason_e);
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
+ sNsmValue, u32DataLen);
+
+ /* Perform test call */
+ pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &enShutdownReason, u32RealDataLen);
+ (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == enExpectedNsmReturn)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, enExpectedNsmReturn);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmSetBootMode(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ GVariant *pDataIn = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Values read from parameter config */
+ const guint u32DataLen = NSMTST__pstTestCase->unParameter.stSmSetBootMode.u32DataLen;
+ const gint i32BootMode = NSMTST__pstTestCase->unParameter.stSmSetBootMode.i32BootMode;
+
+ /* Values read from return config */
+ const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stSmSetBootMode.enErrorStatus;
+
+ /* Variables need to adapt test case */
+ const gchar *sNsmValue = "BootMode";
+ const NsmDataType_e enDataType = NsmDataType_BootMode;
+ const guint u32RealDataLen = sizeof(NsmDataType_BootMode);
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set %s. Interface: StateMachine. Passed DataLen: %d.",
+ sNsmValue, u32DataLen);
+
+ /* Perform test call */
+ pDataIn = NSMTST__pPrepareStateMachineData((guchar*) &i32BootMode, u32RealDataLen);
+ (void) node_state_test_call_set_nsm_data_sync(NSMTST__pNodeStateMachine,
+ enDataType,
+ pDataIn,
+ u32DataLen,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ g_variant_unref(pDataIn);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == enExpectedNsmReturn)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, enExpectedNsmReturn);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSMC via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbSetApplicationMode(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Values read from config */
+ const NsmApplicationMode_e enApplicationMode = NSMTST__pstTestCase->unParameter.stDbSetApplicationMode.enApplicationMode;
+ const NsmErrorStatus_e enExpectedNsmReturn = NSMTST__pstTestCase->unReturnValues.stDbSetApplicationMode.enErrorStatus;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set ApplicationMode. Interface: D-Bus. Value: 0x%02X.", enApplicationMode);
+
+ /* Perform test call */
+ (void) node_state_lifecycle_control_call_set_application_mode_sync(NSMTST__pLifecycleControl,
+ (gint) enApplicationMode,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == enExpectedNsmReturn)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, enExpectedNsmReturn);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbSetBootMode(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set BootMode. Interface: D-Bus. Value: 0x%02X.",
+ NSMTST__pstTestCase->unParameter.stDbSetBootMode.i32BootMode);
+
+ /* Perform test call */
+ (void) node_state_lifecycle_control_call_set_boot_mode_sync(NSMTST__pLifecycleControl,
+ (gint) NSMTST__pstTestCase->unParameter.stDbSetBootMode.i32BootMode,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbSetBootMode.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbSetBootMode.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+
+static gboolean NSMTST__boDbSetNodeState(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set NodeState. Interface: D-Bus. Value: 0x%02X.",
+ NSMTST__pstTestCase->unParameter.stDbSetNodeState.enNodeState);
+
+ /* Perform test call */
+ (void) node_state_lifecycle_control_call_set_node_state_sync(NSMTST__pLifecycleControl,
+ (gint) NSMTST__pstTestCase->unParameter.stDbSetNodeState.enNodeState,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbSetNodeState.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbSetNodeState.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+static gboolean NSMTST__boDbSetSessionState(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set SessionState. Interface: D-Bus. Value: (SessionName: %s. SessionOwner: %s. Seat: 0x%02X. State: 0x%02X.).",
+ NSMTST__pstTestCase->unParameter.stDbSetSessionState.sSessionName,
+ NSMTST__pstTestCase->unParameter.stDbSetSessionState.sSessionOwner,
+ NSMTST__pstTestCase->unParameter.stDbSetSessionState.enSeat,
+ NSMTST__pstTestCase->unParameter.stDbSetSessionState.enState);
+
+ /* Perform test call */
+ (void) node_state_consumer_call_set_session_state_sync(NSMTST__pNodeStateConsumer,
+ (gchar*) NSMTST__pstTestCase->unParameter.stDbSetSessionState.sSessionName,
+ (gchar*) NSMTST__pstTestCase->unParameter.stDbSetSessionState.sSessionOwner,
+ (gint) NSMTST__pstTestCase->unParameter.stDbSetSessionState.enSeat,
+ (gint) NSMTST__pstTestCase->unParameter.stDbSetSessionState.enState,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbSetSessionState.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbSetSessionState.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+
+/*********************************************** Get simple value via D-Bus ******************************************/
+
+static gboolean NSMTST__boDbGetApplicationMode(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+ NsmApplicationMode_e enReceivedApplicationMode = NsmApplicationMode_NotSet;
+
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Get ApplicationMode. Interface: D-Bus. Expected value: 0x%02X.",
+ NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enApplicationMode);
+
+ /* Perform test call */
+ (void) node_state_consumer_call_get_application_mode_sync(NSMTST__pNodeStateConsumer,
+ (gint*) &enReceivedApplicationMode,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enErrorStatus)
+ {
+ if(enReceivedApplicationMode == NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enApplicationMode)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected ApplicationMode. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedApplicationMode, NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enApplicationMode);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbGetApplicationMode.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbGetNodeState(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+ NsmNodeState_e enReceivedNodeState = NsmApplicationMode_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Get NodeState. Interface: D-Bus. Expected value: 0x%02X.",
+ NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enNodeState);
+
+ /* Perform test call */
+ (void) node_state_consumer_call_get_node_state_sync(NSMTST__pNodeStateConsumer,
+ (gint*) &enReceivedNodeState,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enErrorStatus)
+ {
+ if(enReceivedNodeState == NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enNodeState)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NodeState. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNodeState, NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enNodeState);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbGetNodeState.enNodeState);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbGetSessionState(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+ NsmSessionState_e enReceivedSessionState = NsmSessionState_Unregistered;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Get SessionState. Interface: D-Bus.");
+
+ /* Perform test call */
+ (void) node_state_consumer_call_get_session_state_sync(NSMTST__pNodeStateConsumer,
+ (gchar*) NSMTST__pstTestCase->unParameter.stDbGetSessionState.sSessionName,
+ (gint) NSMTST__pstTestCase->unParameter.stDbGetSessionState.enSeat,
+ (gint*) &enReceivedSessionState,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbGetSessionState.enErrorStatus)
+ {
+ if(enReceivedSessionState == NSMTST__pstTestCase->unReturnValues.stDbGetSessionState.enSessionState)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NodeState. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedSessionState, NSMTST__pstTestCase->unReturnValues.stDbGetSessionState.enSessionState);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbGetSessionState.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbGetAppHealthCount(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ guint u32ReceivedAppHealthCount = 0x00;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Get AppHealthCount. Interface: D-Bus.");
+
+ /* Perform test call */
+ (void) node_state_consumer_call_get_app_health_count_sync(NSMTST__pNodeStateConsumer,
+ &u32ReceivedAppHealthCount,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(u32ReceivedAppHealthCount == NSMTST__pstTestCase->unReturnValues.stDbGetAppHealthCount.u32AppHealthCount)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected AppHealthCount. Received: %d. Expected: %d.",
+ u32ReceivedAppHealthCount, NSMTST__pstTestCase->unReturnValues.stDbGetAppHealthCount.u32AppHealthCount);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbGetInterfaceVersion(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ guint u32ReceivedInterfaceVersion = 0x00;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Get InterfaceVersion. Interface: D-Bus.");
+
+ /* Perform test call */
+ (void) node_state_consumer_call_get_interface_version_sync(NSMTST__pNodeStateConsumer,
+ &u32ReceivedInterfaceVersion,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(u32ReceivedInterfaceVersion == NSMTST__pstTestCase->unReturnValues.stDbGetInterfaceVersion.u32InterfaceVersion)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected InterfaceVersion. Received: %i. Expected: %i.",
+ u32ReceivedInterfaceVersion,
+ NSMTST__pstTestCase->unReturnValues.stDbGetInterfaceVersion.u32InterfaceVersion);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+/*********************************************** Call methods via D-Bus *********************************************/
+
+static gboolean NSMTST__boDbRegisterSession(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Register Session. Interface: D-Bus. Value: (SessionName: %s. SessionOwner: %s. Seat: 0x%02X. State: 0x%02X.).",
+ NSMTST__pstTestCase->unParameter.stDbRegisterSession.sSessionName,
+ NSMTST__pstTestCase->unParameter.stDbRegisterSession.sSessionOwner,
+ NSMTST__pstTestCase->unParameter.stDbRegisterSession.enSeat,
+ NSMTST__pstTestCase->unParameter.stDbRegisterSession.enState);
+
+ /* Perform test call */
+ (void) node_state_consumer_call_register_session_sync(NSMTST__pNodeStateConsumer,
+ (gchar*) NSMTST__pstTestCase->unParameter.stDbRegisterSession.sSessionName,
+ (gchar*) NSMTST__pstTestCase->unParameter.stDbRegisterSession.sSessionOwner,
+ (gint) NSMTST__pstTestCase->unParameter.stDbRegisterSession.enSeat,
+ (gint) NSMTST__pstTestCase->unParameter.stDbRegisterSession.enState,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbRegisterSession.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbRegisterSession.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbUnRegisterSession(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Unregister Session. Interface: D-Bus. Value: (SessionName: %s. SessionOwner: %s. Seat: 0x%02X.).",
+ NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.sSessionName,
+ NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.sSessionOwner,
+ NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.enSeat);
+
+ /* Perform test call */
+ (void) node_state_consumer_call_un_register_session_sync(NSMTST__pNodeStateConsumer,
+ (gchar*) NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.sSessionName,
+ (gchar*) NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.sSessionOwner,
+ (gint) NSMTST__pstTestCase->unParameter.stDbUnRegisterSession.enSeat,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbUnRegisterSession.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbUnRegisterSession.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbRegisterShutdownClient(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Register shutdown client. Interface: D-Bus. Value: (BusName: %s. ObjName: %s. Mode: 0x%04X. Timeout: %d.).",
+ NSMTST__sBusName,
+ NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.sObjName,
+ NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.u32Mode,
+ NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.u32Timeout);
+
+ /* Perform test call */
+ (void) node_state_consumer_call_register_shutdown_client_sync(NSMTST__pNodeStateConsumer,
+ NSMTST__sBusName,
+ NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.sObjName,
+ NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.u32Mode,
+ NSMTST__pstTestCase->unParameter.stDbRegisterShutdownClient.u32Timeout,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbRegisterShutdownClient.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbRegisterShutdownClient.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbUnRegisterShutdownClient(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Unregister shutdown client. Interface: D-Bus. Value: (BusName: %s. ObjName: %s. Mode: 0x%04X.).",
+ NSMTST__sBusName,
+ NSMTST__pstTestCase->unParameter.stDbUnRegisterShutdownClient.sObjName,
+ NSMTST__pstTestCase->unParameter.stDbUnRegisterShutdownClient.u32Mode);
+
+ /* Perform test call */
+ (void) node_state_consumer_call_un_register_shutdown_client_sync(NSMTST__pNodeStateConsumer,
+ NSMTST__sBusName,
+ NSMTST__pstTestCase->unParameter.stDbUnRegisterShutdownClient.sObjName,
+ NSMTST__pstTestCase->unParameter.stDbUnRegisterShutdownClient.u32Mode,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbUnRegisterShutdownClient.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbUnRegisterShutdownClient.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+
+static gboolean NSMTST__boDbRequestNodeRestart(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Request Node Restart. Interface: D-Bus. Value: (RestartReason: 0x%02X. RestartType: 0x%04X.).",
+ NSMTST__pstTestCase->unParameter.stDbRequestNodeRestart.enRestartReason,
+ NSMTST__pstTestCase->unParameter.stDbRequestNodeRestart.u32RestartType);
+
+ /* Perform test call */
+ (void) node_state_lifecycle_control_call_request_node_restart_sync(NSMTST__pLifecycleControl,
+ NSMTST__pstTestCase->unParameter.stDbRequestNodeRestart.enRestartReason,
+ NSMTST__pstTestCase->unParameter.stDbRequestNodeRestart.u32RestartType,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbRequestNodeRestart.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbRequestNodeRestart.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbSetAppHealthStatus(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Set AppHealthStatus. Interface: D-Bus. Value: (AppName: %s. AppRunning: %s.).",
+ NSMTST__pstTestCase->unParameter.stDbSetAppHealthStatus.sAppName,
+ (NSMTST__pstTestCase->unParameter.stDbSetAppHealthStatus.boAppRunning == TRUE) ? "true" : "false");
+
+ /* Perform test call */
+ (void) node_state_lifecycle_control_call_set_app_health_status_sync(NSMTST__pLifecycleControl,
+ NSMTST__pstTestCase->unParameter.stDbSetAppHealthStatus.sAppName,
+ NSMTST__pstTestCase->unParameter.stDbSetAppHealthStatus.boAppRunning,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbSetAppHealthStatus.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return value. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbSetAppHealthStatus.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boSmGetInterfaceVersion(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = TRUE; /* Return value */
+ GError *pError = NULL;
+ guint u32ReceivedInterfaceVersion = 0;
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Get InterfaceVersion. Interface: StateMachine.");
+
+ /* Perform test call */
+ (void) node_state_test_call_get_nsm_interface_version_sync(NSMTST__pNodeStateMachine,
+ &u32ReceivedInterfaceVersion,
+ NULL,
+ &pError);
+
+ /* Evaluate result. Check if a D-Bus error occurred. */
+ if(pError == NULL)
+ {
+ /* D-Bus communication successful. Check if NSM returned with the expected value. */
+ if(u32ReceivedInterfaceVersion == NSMTST__pstTestCase->unReturnValues.stSmGetInterfaceVersion.u32InterfaceVersion)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected InterfaceVersion. Received: 0x%02X. Expected: 0x%02X.",
+ u32ReceivedInterfaceVersion, NSMTST__pstTestCase->unReturnValues.stSmGetInterfaceVersion.u32InterfaceVersion);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to create access NSM via D-Bus. Error msg.: %s.",
+ pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boCheckSessionSignal(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = FALSE; /* Return value */
+
+ /* Create test case description */
+ NSMTST__sTestDescription = g_strdup_printf("Check for Session signal.");
+
+ /* Compare the received with the expected values */
+ if( (NSMTST__pstTestCase->unReturnValues.stCheckSessionSignal.boReceived == NSMTST__stReceivedSessionSignal.boReceived )
+ && (NSMTST__pstTestCase->unReturnValues.stCheckSessionSignal.enSeat == NSMTST__stReceivedSessionSignal.enSeat )
+ && (NSMTST__pstTestCase->unReturnValues.stCheckSessionSignal.enState == NSMTST__stReceivedSessionSignal.enState )
+ && (g_strcmp0(NSMTST__pstTestCase->unReturnValues.stCheckSessionSignal.sName, NSMTST__stReceivedSessionSignal.sName) == 0 ))
+ {
+ /* We found what we expected */
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Check for SessionState signal reception failed.");
+ }
+
+ NSMTST__stReceivedSessionSignal.boReceived = FALSE;
+
+ if(NSMTST__stReceivedSessionSignal.sName != NULL)
+ {
+ g_free(NSMTST__stReceivedSessionSignal.sName);
+ NSMTST__stReceivedSessionSignal.sName = NULL;
+ }
+
+ NSMTST__stReceivedSessionSignal.enSeat = NsmSeat_NotSet;
+ NSMTST__stReceivedSessionSignal.enState = NsmSessionState_Unregistered;
+
+ return boRetVal;
+}
+
+
+static gboolean NSMTST__boCheckNodeStateSignal(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = FALSE; /* Return value */
+
+ NSMTST__sTestDescription = g_strdup("Check for NodeState signal.");
+
+ /* Compare the received with the expected values */
+ if( (NSMTST__pstTestCase->unReturnValues.stCheckNodeStateSignal.boReceived == NSMTST__stReceivedNodeStateSignal.boReceived )
+ && (NSMTST__pstTestCase->unReturnValues.stCheckNodeStateSignal.enNodeState == NSMTST__stReceivedNodeStateSignal.enNodeState))
+ {
+ /* We found what we expected */
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup("Check for NodeState reception failed.");
+ }
+
+ NSMTST__stReceivedNodeStateSignal.boReceived = FALSE;
+ NSMTST__stReceivedNodeStateSignal.enNodeState = NsmNodeState_NotSet;
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boCheckApplicationModeSignal(void)
+{
+ /* Function local variables */
+ gboolean boRetVal = FALSE; /* Return value */
+
+ NSMTST__sTestDescription = g_strdup("Check for Application mode signal.");
+
+ /* Compare the received with the expected values */
+ if( (NSMTST__pstTestCase->unReturnValues.stCheckApplicationModeSignal.boReceived == NSMTST__stApplicationModeSignal.boReceived )
+ && (NSMTST__pstTestCase->unReturnValues.stCheckApplicationModeSignal.enApplicationMode == NSMTST__stApplicationModeSignal.enApplicationMode))
+ {
+ /* We found what we expected */
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Check for ApplicationMode signal reception failed.");
+ }
+
+ NSMTST__stApplicationModeSignal.boReceived = FALSE;
+ NSMTST__stApplicationModeSignal.enApplicationMode = NsmApplicationMode_NotSet;
+
+ return boRetVal;
+
+
+
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boTestCreateLcClient(void)
+{
+ NodeStateLifeCycleConsumer *pLifeCycleConsumer = NULL;
+ gboolean boRetVal = FALSE;
+
+ NSMTST__sTestDescription = g_strdup_printf("Create LifecycleConsumer: %s.", NSMTST__pstTestCase->unParameter.stTestCreateLcClient.sObjName);
+
+ pLifeCycleConsumer = node_state_life_cycle_consumer_skeleton_new();
+ NSMTST__pLifecycleClients = g_slist_append(NSMTST__pLifecycleClients, (gpointer) pLifeCycleConsumer);
+
+ g_signal_connect(pLifeCycleConsumer, "handle-lifecycle-request", G_CALLBACK(NSMTST__boOnLifecycleClientCb), NULL);
+
+ if(g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(pLifeCycleConsumer),
+ NSMTST__pConnection,
+ NSMTST__pstTestCase->unParameter.stTestCreateLcClient.sObjName,
+ NULL) == TRUE)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ }
+
+ return boRetVal;
+}
+
+
+static gboolean NSMTST__boTestProcessLifecycleRequest(void)
+{
+ gboolean boRetVal = FALSE;
+
+ NSMTST__sTestDescription = g_strdup_printf("Processing Lifecycle request. Return 0x%02X to NSM.",
+ NSMTST__pstTestCase->unParameter.stTestProcessLifecycleRequest.enErrorStatus);
+
+ if( (NSMTST__pLifecycleConsumer != NULL)
+ && (NSMTST__pLifecycleInvocation != NULL))
+ {
+ if(NSMTST__u32LifecycleRequest == NSMTST__pstTestCase->unReturnValues.stTestProcessLifecycleRequest.u32RequestType)
+ {
+ boRetVal = TRUE;
+
+ node_state_life_cycle_consumer_complete_lifecycle_request(NSMTST__pLifecycleConsumer,
+ NSMTST__pLifecycleInvocation,
+ (gint) NSMTST__pstTestCase->unParameter.stTestProcessLifecycleRequest.enErrorStatus);
+
+ if( (NSMTST__pstTestCase->unParameter.stTestProcessLifecycleRequest.enErrorStatus == NsmErrorStatus_Ok)
+ || (NSMTST__pstTestCase->unParameter.stTestProcessLifecycleRequest.enErrorStatus == NsmErrorStatus_Error))
+ {
+ NSMTST__pLifecycleConsumer = NULL;
+ NSMTST__pLifecycleInvocation = NULL;
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected shutdown type.");
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected shutdown request.");
+ }
+
+ return boRetVal;
+}
+
+static gboolean NSMTST__boDbLifecycleRequestComplete(void)
+{
+ gboolean boRetVal = FALSE;
+ GError *pError = NULL;
+ NsmErrorStatus_e enReceivedNsmReturn = NsmErrorStatus_NotSet;
+
+ NSMTST__sTestDescription = g_strdup("Sending Lifecycle request finished.");
+
+ (void) node_state_consumer_call_lifecycle_request_complete_sync(NSMTST__pNodeStateConsumer,
+ NSMTST__u32LifecycleRequestId,
+ NSMTST__pstTestCase->unParameter.stDbLifecycleRequestComplete.enErrorStatus,
+ (gint*) &enReceivedNsmReturn,
+ NULL,
+ &pError);
+
+ if(pError == NULL)
+ {
+ if(enReceivedNsmReturn == NSMTST__pstTestCase->unReturnValues.stDbLifecycleRequestComplete.enErrorStatus)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected NSM return. Received: 0x%02X. Expected: 0x%02X.",
+ enReceivedNsmReturn, NSMTST__pstTestCase->unReturnValues.stDbLifecycleRequestComplete.enErrorStatus);
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to access NSM via D-Bus. Error msg.: %s.", pError->message);
+ g_error_free(pError);
+ }
+
+ return boRetVal;
+}
+
+
+
+static gboolean NSMTST__boDbCheckLucRequired(void)
+{
+ gboolean boReceivedLucRequired = FALSE;
+ GError *pError = NULL;
+ gboolean boRetVal = FALSE;
+
+ NSMTST__sTestDescription = g_strdup("Check LUC required.");
+
+ (void) node_state_lifecycle_control_call_check_luc_required_sync(NSMTST__pLifecycleControl,
+ &boReceivedLucRequired,
+ NULL,
+ &pError);
+
+ if(pError == NULL)
+ {
+ if(boReceivedLucRequired == NSMTST__pstTestCase->unReturnValues.stDbCheckLucRequired.boLucRequired)
+ {
+ boRetVal = TRUE;
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Did not receive expected value. Received: %s. Expected: %s.",
+ boReceivedLucRequired == TRUE ? "true" : "false",
+ NSMTST__pstTestCase->unReturnValues.stDbCheckLucRequired.boLucRequired == TRUE ? "true" : "false");
+ }
+ }
+ else
+ {
+ boRetVal = FALSE;
+ NSMTST__sErrorDescription = g_strdup_printf("Failed to access NSM via D-Bus. Error msg.: %s.", pError->message);
+ }
+
+ return boRetVal;
+}
+
+
+gboolean NSMTST__boOnApplicationModeSignal(NodeStateConsumer *pObject,
+ const gint i32ApplicationMode,
+ gpointer pUserData)
+{
+ NSMTST__stApplicationModeSignal.boReceived = TRUE;
+ NSMTST__stApplicationModeSignal.enApplicationMode = (NsmApplicationMode_e) i32ApplicationMode;
+
+ return TRUE;
+}
+
+
+gboolean NSMTST__boOnNodeStateSignal(NodeStateConsumer *pObject,
+ const gint i32NodeState,
+ gpointer pUserData)
+{
+ NSMTST__stReceivedNodeStateSignal.boReceived = TRUE;
+ NSMTST__stReceivedNodeStateSignal.enNodeState = (NsmNodeState_e) i32NodeState;
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* Callback for the SessionState signal. Store the parameters
+*
+* @param pConsumer: Lifecycle consumer object
+* @param pInvocation: D-Bus invocation object
+* @param u32LifeCycleRequest: Request (shutdown type)
+* @param u32RequestId: Unique ID, which a client needs to pass to "LifecycleRequestComplete" in case of an
+* asynchronous shut down handling.
+* @param pUserData: Optional user data (not used).
+*
+* @return: TRUE: Indicate D-Bus that the method has been processed,
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boOnSessionSignal(NodeStateConsumer *pObject,
+ const gchar *sSessionName,
+ const gint i32SeatId,
+ const gint i32SessionState,
+ gpointer pUserData)
+{
+ /* Store values passed by the NSM */
+ NSMTST__stReceivedSessionSignal.boReceived = TRUE;
+
+ if(NSMTST__stReceivedSessionSignal.sName != NULL)
+ {
+ g_free(NSMTST__stReceivedSessionSignal.sName);
+ NSMTST__stReceivedSessionSignal.sName = NULL;
+ }
+
+ NSMTST__stReceivedSessionSignal.sName = g_strdup(sSessionName);
+ NSMTST__stReceivedSessionSignal.enSeat = (NsmSeat_e) i32SeatId;
+ NSMTST__stReceivedSessionSignal.enState = (NsmSessionState_e) i32SessionState;
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* Callback for the life cycle request call used for ALL life cycle clients. The "completion" function to return
+* values to the NSM is NOT called here. Instead the parameters of the callback are saved and during the test
+* "NSMTST__boProcessLifecycleRequest" can be used to return different values.
+*
+* @param pConsumer: Lifecycle consumer object
+* @param pInvocation: D-Bus invocation object
+* @param u32LifeCycleRequest: Request (shutdown type)
+* @param u32RequestId: Unique ID, which a client needs to pass to "LifecycleRequestComplete" in case of an
+* asynchronous shut down handling.
+* @param pUserData: Optional user data (not used).
+*
+* @return: TRUE: Indicate D-Bus that the method has been processed,
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boOnLifecycleClientCb(NodeStateLifeCycleConsumer *pConsumer,
+ GDBusMethodInvocation *pInvocation,
+ const guint32 u32LifeCycleRequest,
+ const guint32 u32RequestId,
+ gpointer pUserData)
+{
+ /* Store values passed by the NSM */
+ NSMTST__pLifecycleConsumer = pConsumer;
+ NSMTST__pLifecycleInvocation = pInvocation;
+ NSMTST__u32LifecycleRequest = u32LifeCycleRequest;
+ NSMTST__u32LifecycleRequestId = u32RequestId;
+
+ return TRUE;
+}
+
+
+/**********************************************************************************************************************
+*
+* Timer callback in which the test cases are performed.
+*
+* @param pUserData: Data passed to callback by user.
+*
+* @return: TRUE: Keep the cyclic timer callback alive.
+* FALSE: Remove the cyclic timer event from MainLoop.
+*
+**********************************************************************************************************************/
+static gboolean NSMTST__boTestCaseTimerCb(gpointer pUserData)
+{
+ /* Function local variables */
+ gboolean boTestSuccess = FALSE; /* Flag to recognize error in test case */
+ gboolean boKeepTimerAlive = FALSE; /* Flag if timer should stay alive */
+
+ /* Perform the test call. Store return value for further evaluation */
+ NSMTST__pstTestCase = &NSMTST__astTestCases[NSMTST__u16TestIdx];
+ boTestSuccess = NSMTST__pstTestCase->pfTestCall();
+
+ /* Print the test result */
+ g_print(NSMTST__TESTPRINT, NSMTST__u16TestIdx,
+ NSMTST__sTestDescription == NULL ? "-" : NSMTST__sTestDescription,
+ NSMTST__sErrorDescription == NULL ? "-" : NSMTST__sErrorDescription,
+ boTestSuccess == TRUE ? "success" : "failed");
+
+ /* Free description string allocated by the test */
+ if(NSMTST__sTestDescription != NULL)
+ {
+ g_free(NSMTST__sTestDescription);
+ NSMTST__sTestDescription = NULL;
+ }
+
+ /* Free error string allocated by the test */
+ if(NSMTST__sErrorDescription != NULL)
+ {
+ g_free(NSMTST__sErrorDescription);
+ NSMTST__sErrorDescription = NULL;
+ }
+
+ NSMTST__u16TestIdx++; /* prepare system for next test */
+
+ /* The tests end if there was an error or there are no test cases left */
+ if( (boTestSuccess == TRUE )
+ && (NSMTST__u16TestIdx < sizeof(NSMTST__astTestCases)/sizeof(NSMTST__tstTestCase)))
+ {
+ boKeepTimerAlive = TRUE;
+ }
+ else
+ {
+ boKeepTimerAlive = FALSE;
+ g_main_loop_quit(pUserData);
+ }
+
+ return boKeepTimerAlive;
+}
+
+
+/**********************************************************************************************************************
+*
+* Main function of the test client executable.
+*
+* @return: 0: All tests ended successful
+* -1: At least one test was not successful
+*
+**********************************************************************************************************************/
+int main(void)
+{
+ int iRetVal = 0;
+
+ /* Initialize types in order to use glib */
+ g_type_init();
+
+ NSMTST__pLifecycleConsumer = NULL;
+ NSMTST__pLifecycleInvocation = NULL;
+
+ /* Create main loop. Function can not fail. */
+ NSMTST__pMainLoop = g_main_loop_new(NULL, FALSE);
+
+ /* Add a timeout to the loop in which's callback the test cases are performed */
+ g_timeout_add_full(G_PRIORITY_DEFAULT, NSMTST__TIMER_INTERVAL, &NSMTST__boTestCaseTimerCb, NSMTST__pMainLoop, NULL);
+
+ /* Blocking call: Run the main loop, wait for callbacks */
+ g_main_loop_run(NSMTST__pMainLoop);
+
+ iRetVal = (NSMTST__u16TestIdx == sizeof(NSMTST__astTestCases)/sizeof(NSMTST__tstTestCase)) ? 0 : -1;
+
+ if(NSMTST__pLifecycleControl != NULL) g_object_unref(NSMTST__pLifecycleControl);
+ if(NSMTST__pNodeStateConsumer != NULL) g_object_unref(NSMTST__pNodeStateConsumer);
+ if(NSMTST__pNodeStateMachine != NULL) g_object_unref(NSMTST__pNodeStateMachine);
+
+ g_slist_free_full(NSMTST__pLifecycleClients, &g_object_unref);
+
+ /* Free the main loop, when it was left */
+ g_main_loop_unref(NSMTST__pMainLoop);
+
+ return iRetVal;
+}
diff --git a/NodeStateTest/org.genivi.NodeStateMachineTest.xml b/NodeStateTest/org.genivi.NodeStateMachineTest.xml
new file mode 100644
index 0000000..9426f45
--- /dev/null
+++ b/NodeStateTest/org.genivi.NodeStateMachineTest.xml
@@ -0,0 +1,37 @@
+<!--
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* XML model of the dbus interfaces for the test NodeStateMachine
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*
+* Date Author Reason
+* 24.01.2013 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
+*
+-->
+
+<node>
+ <interface name="com.contiautomotive.NodeStateMachineTest.Test">
+ <method name="SetNsmData">
+ <arg name="DataType" direction="in" type="i"/>
+ <arg name="Data" direction="in" type="ay"/>
+ <arg name="DataLen" direction="in" type="u"/>
+ <arg name="ErrorCode" direction="out" type="i"/>
+ </method>
+ <method name="GetNsmData">
+ <arg name="DataType" direction="in" type="i"/>
+ <arg name="DataIn" direction="in" type="ay"/>
+ <arg name="DataOut" direction="out" type="ay"/>
+ <arg name="DataLen" direction="in" type="u"/>
+ <arg name="ErrorCode" direction="out" type="i"/>
+ </method>
+ <method name="GetNsmInterfaceVersion">
+ <arg name="Version" direction="out" type="u"/>
+ </method>
+ </interface>
+</node>
diff --git a/README b/README
index 9c8ec8d..dd44c9d 100644
--- a/README
+++ b/README
@@ -6,8 +6,6 @@ relevant documentation for this project is available in the GENIVI wiki on:
https://collab.genivi.org/wiki/display/genivi/SysInfraEGLifecycleNSMData
-Master location for GENIVI NodeStateManager
-http://git.projects.genivi.org/lifecycle/node-state-manager.git
License
-------
@@ -23,12 +21,8 @@ The NodeStateManager needs glib >= 2.30.0 to be compiled.
In addition, the NodeStateManager(NSM) has dependencies
to the NodeStateMachine (NSMC) and NodeStateAccess (NSMA).
-The NSMC and NSMA are delivered within this package as
-stubs. To understand the tasks of these two components,
-please see their interface headers.
+The NSMC is delivered within this package as a stub.
+To understand the task it, please see its interface header.
-Please note: Due to legal restrictions the NSMA had to be
-introduced. It is responsible for binding the NSM to the
-IPC. In most cases probably D-Bus is used for the IPC and
-the xml files in the "model" folder of the NSM describe the
-IPC interfaces offered by the NSM.
+Please note: Due to legal restrictions the NSMA currently
+is being built as a shared library that is used by the NSM.
diff --git a/autogen.sh b/autogen.sh
index c34b34d..42c0409 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,3 +1,24 @@
#!/bin/sh -e
-autoreconf --install --symlink
-./configure $@
+#
+#
+# Copyright (C) 2012 Continental Automotive Systems, Inc.
+#
+# Author: Jean-Pierre.Bogler@continental-corporation.com
+#
+# Script to create necessary files/folders from a fresh git check out.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Date Author Reason
+# 24.10.2012 Jean-Pierre Bogler Initial creation
+#
+###############################################################################
+
+mkdir -p m4
+mkdir -p NodeStateAccess/doc
+mkdir -p NodeStateAccess/generated
+
+autoreconf --verbose --install --force
+./configure $@
diff --git a/configure.ac b/configure.ac
index ed014e9..913c4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,76 +12,83 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
+# Date Author Reason
+# 24.01.2013 Jean-Pierre Bogler Added NodeStateTest/Makefile to output files
+# 14.03.2013 Jean-Pierre Bogler Updated usage for real NodeStateAccess library
+#
#######################################################################################################################
-dnl ***************************
-dnl *** Initialize autoconf ***
-dnl ***************************
-AC_INIT([node-state-manager], [1.2.0.0])
+# Initialize autoconf
+AC_INIT([node-state-manager],[1.2.0.0])
AC_COPYRIGHT([Copyright (c) 2012 Continental Automotive GmbH])
AC_PREREQ([2.50])
-dnl ***************************
-dnl *** Initialize automake ***
-dnl ***************************
-AM_INIT_AUTOMAKE()
+# Initialize automake
+AM_INIT_AUTOMAKE([tar-ustar])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST([ACLOCAL_AMFLAGS], ["$ACLOCAL_FLAGS -I m4"])
-dnl ********************************
-dnl *** Check for basic programs ***
-dnl ********************************
-AC_PROG_CC()
-AM_PROG_CC_C_O()
-AC_PROG_INSTALL()
+# Initialize libtool
+LT_INIT([disable-static])
-dnl ***************************************
-dnl *** Initialize lib tool ***
-dnl ***************************************
-AC_DISABLE_STATIC()
-AC_PROG_LIBTOOL()
+# Check for basic programs
+AC_PROG_CC
+AM_PROG_CC_C_O
-dnl ***************************************
-dnl *** Check for standard header files ***
-dnl ***************************************
+# Check for basic headers
AC_CHECK_HEADERS([string.h])
-dnl ************************************
-dnl *** Check for standard functions ***
-dnl ************************************
+# Check for basic functions
AC_CHECK_FUNCS([memcpy])
-dnl ***********************************
-dnl *** Check for required packages ***
-dnl ***********************************
-PKG_CHECK_MODULES([DLT], [automotive-dlt >= 2.2.0])
-PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.30.0])
-PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0])
-PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.30.0])
-PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.30.0])
+# Check for required packages
+PKG_CHECK_MODULES([DLT], [automotive-dlt >= 2.2.0] )
+PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.30.0] )
+PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0] )
+PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.30.0] )
+PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.30.0] )
+PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.4.10] )
-dnl *************************************
-dnl *** Define extra paths ***
-dnl *************************************
+# Derive path for storing systemd service files (e. g. /lib/systemd/system)
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[],
[with_systemdsystemunitdir=$(pkg-config --silence-errors --variable=systemdsystemunitdir systemd)])
+
+if test "x${with_systemdsystemunitdir}" = "x"; then
+ with_systemdsystemunitdir="/lib/systemd/system"
+fi
+
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+# Derive path for storing 'dbus' service files (e. g. /usr/share/dbus-1/system-services)
AC_ARG_WITH([dbussystemunitdir],
AS_HELP_STRING([--with-dbussystemunitdir=DIR], [Directory for D-Bus system service files]),
[],
[with_dbussystemunitdir=$(pkg-config --silence-errors --variable=system_bus_services_dir dbus-1)])
AC_SUBST([dbussystemunitdir], [$with_dbussystemunitdir])
+# Derive path for storing 'dbus' policy files (e. g. /etc)
AC_ARG_WITH([dbuspolicydir],
AS_HELP_STRING([--with-dbuspolicydirdir=DIR], [Directory for D-Bus system policy files]),
[],
[with_dbuspolicydir=$(pkg-config --silence-errors --variable=sysconfdir dbus-1)/dbus-1/system.d])
AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
-dnl ************************************
-dnl *** Define configure output ***
-dnl ************************************
-AC_OUTPUT(Makefile NodeStateManager/Makefile NodeStateAccessStub/Makefile NodeStateMachineStub/Makefile NodeStateManager/config/nodestatemanager-daemon.service NodeStateManager/config/org.genivi.NodeStateManager.LifeCycleControl.service)
+# Derive path for storing 'dbus' interface files (e. g. /usr/share/dbus-1/interfaces)
+AC_ARG_WITH([dbusinterfacesdir],
+ AS_HELP_STRING([--with-dbusinterfacesdir=DIR], [Directory for D-Bus interface files]),
+ [],
+ [with_dbusinterfacesdir=$(pkg-config --silence-errors --variable=interfaces_dir dbus-1)])
+AC_SUBST([dbusinterfacesdir], [$with_dbusinterfacesdir])
+
+# Define configure output
+AC_CONFIG_FILES([Makefile
+ NodeStateManager/Makefile
+ NodeStateTest/Makefile
+ NodeStateAccess/Makefile
+ NodeStateMachineStub/Makefile
+ NodeStateManager/config/nodestatemanager-daemon.service
+ NodeStateManager/config/org.genivi.NodeStateManager.LifeCycleControl.service
+ NodeStateManager/config/node-state-manager.pc])
+AC_OUTPUT