summaryrefslogtreecommitdiff
path: root/NodeStateManager/NodeStateTypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'NodeStateManager/NodeStateTypes.h')
-rw-r--r--NodeStateManager/NodeStateTypes.h298
1 files changed, 174 insertions, 124 deletions
diff --git a/NodeStateManager/NodeStateTypes.h b/NodeStateManager/NodeStateTypes.h
index 7451a19..8521487 100644
--- a/NodeStateManager/NodeStateTypes.h
+++ b/NodeStateManager/NodeStateTypes.h
@@ -4,6 +4,7 @@
/**********************************************************************************************************************
*
* Copyright (C) 2012 Continental Automotive Systems, Inc.
+* 2017 BMW AG
*
* Author: Jean-Pierre.Bogler@continental-corporation.com
*
@@ -16,7 +17,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Date Author Reason
-* 2012.09.27 uidu5846 1.0.0.0 CSP_WZ#1194: Introduced 'NodeStateTypes.h' to avoid circle includes
+* 2012.09.27 uidu5846 1.0.0.0 CSP_WZ#1194: Introduced 'NodeStateManagerTypes.h' to avoid circle includes
* and encapsulate type definitions.
* 2012.10.24 uidu5846 1.0.0.1 CSP_WZ#1322: Removed "ssw_types" redefinition from header.
* Since the same native types are used, no interface change.
@@ -43,12 +44,6 @@ extern "C"
*
**********************************************************************************************************************/
-/* Definitions of D-Bus names and addresses */
-#define NSM_BUS_TYPE 1 /**< Defines bus type according to GBusType */
-#define NSM_BUS_NAME "org.genivi.NodeStateManager" /**< The bus name of the NSM */
-#define NSM_LIFECYCLE_OBJECT "/org/genivi/NodeStateManager/LifecycleControl" /**< Address of the lifecycle object */
-#define NSM_CONSUMER_OBJECT "/org/genivi/NodeStateManager/Consumer" /**< Address of the consumer object */
-
/* Defines for session handling */
#define NSM_DEFAULT_SESSION_OWNER "NodeStateManager" /**< "Owner" of the default sessions */
@@ -63,12 +58,16 @@ extern "C"
#define NSM_SHUTDOWNTYPE_NOT 0x00000000U /**< Client not registered for any shutdown */
#define NSM_SHUTDOWNTYPE_NORMAL 0x00000001U /**< Client registered for normal shutdown */
#define NSM_SHUTDOWNTYPE_FAST 0x00000002U /**< Client registered for fast shutdown */
-#define NSM_SHUTDOWNTYPE_RUNUP 0x80000000U /**< The shutdown type "run up" can not be used for
+#define NSM_SHUTDOWNTYPE_PARALLEL 0x00000004U /**< Client registered for parallel shutdown */
+#define NSM_SHUTDOWNTYPE_RUNUP 0x00000008U /**< The shutdown type "run up" can not be used for
registration. Clients which are registered and
have been shut down, will automatically be
informed about the "run up", when the shut down
is canceled. */
+#define GENERATE_ENUM(ENUM) ENUM,
+#define GENERATE_STRING(STRING) #STRING,
+
/**********************************************************************************************************************
*
* TYPE
@@ -80,162 +79,214 @@ extern "C"
* and the NodeStateMachine (NSMC). Based on this value, the setter and getter functions of the NSM and NSMC will
* interpret data behind the passed byte pointer.
*/
-typedef enum _NsmDataType_e
-{
- NsmDataType_AppMode, /**< An ApplicationMode should be set or get */
- NsmDataType_NodeState, /**< A NodeState should be set or get */
- NsmDataType_RestartReason, /**< A RestartReason should be set or get */
- NsmDataType_SessionState, /**< A SessionState should be set or get */
- NsmDataType_ShutdownReason, /**< A ShutdownReason should be set or get */
- NsmDataType_BootMode, /**< A BootMode should be set or get */
- NsmDataType_RunningReason, /**< A RunningReason should be set or get */
- NsmDataType_RegisterSession, /**< A Session should be registered */
- NsmDataType_UnRegisterSession /**< A Session should be unregistered */
-} NsmDataType_e;
+#define FOREACH_DATATYPE(DATATYPE) \
+ DATATYPE(NsmDataType_AppMode) /**< An ApplicationMode should be set or get */ \
+ DATATYPE(NsmDataType_NodeState) /**< A NodeState should be set or get */ \
+ DATATYPE(NsmDataType_RestartReason) /**< A RestartReason should be set or get */ \
+ DATATYPE(NsmDataType_SessionState) /**< A SessionState should be set or get */ \
+ DATATYPE(NsmDataType_ShutdownReason) /**< A ShutdownReason should be set or get */ \
+ DATATYPE(NsmDataType_BootMode) /**< A BootMode should be set or get */ \
+ DATATYPE(NsmDataType_RunningReason) /**< A RunningReason should be set or get */ \
+ DATATYPE(NsmDataType_RegisterSession) /**< A Session should be registered */ \
+ DATATYPE(NsmDataType_UnRegisterSession) /**< A Session should be unregistered */ \
+ DATATYPE(NsmDataType_RequestNodeRestart) /**< A NodeRestart should be triggered */ \
+ DATATYPE(NsmDataType_BlockExternalNodeState)
+typedef enum _NsmDataType_e {
+ FOREACH_DATATYPE(GENERATE_ENUM)
+}NsmDataType_e;
+static const char *DATATYPE_STRING[] __attribute__((unused)) = {
+ FOREACH_DATATYPE(GENERATE_STRING)
+};
/**
* The enumeration defines the different wake up reasons.
*/
-typedef enum _NsmErrorStatus_e
-{
- NsmErrorStatus_NotSet, /**< Initial value when error type is not set */
- NsmErrorStatus_Ok, /**< Value when no error occurred */
- NsmErrorStatus_Error, /**< A general, non-specific error occurred */
- NsmErrorStatus_Dbus, /**< Error in D-Bus communication */
- NsmErrorStatus_Internal, /**< Internal error (memory alloc. failed, etc.) */
- NsmErrorStatus_Parameter, /**< A passed parameter was incorrect */
- NsmErrorStatus_WrongSession, /**< The requested session is unknown. */
- NsmErrorStatus_ResponsePending, /**< Command accepted, return value delivered asynch. */
- NsmErrorStatus_Last /**< Last error value to identify valid errors */
-} NsmErrorStatus_e;
+#define FOREACH_ERRORSTATUS(ERRORSTATUS) \
+ ERRORSTATUS(NsmErrorStatus_NotSet) /**< Initial value when error type is not set */ \
+ ERRORSTATUS(NsmErrorStatus_Ok) /**< Value when no error occurred */ \
+ ERRORSTATUS(NsmErrorStatus_Error) /**< A general, non-specific error occurred */ \
+ ERRORSTATUS(NsmErrorStatus_Dbus) /**< Error in D-Bus communication */ \
+ ERRORSTATUS(NsmErrorStatus_Internal) /**< Internal error (memory alloc. failed, etc.) */ \
+ ERRORSTATUS(NsmErrorStatus_Parameter) /**< A passed parameter was incorrect */ \
+ ERRORSTATUS(NsmErrorStatus_WrongSession) /**< The requested session is unknown. */ \
+ ERRORSTATUS(NsmErrorStatus_ResponsePending) /**< Command accepted, return value delivered asynch. */ \
+ ERRORSTATUS(NsmErrorStatus_WrongClient) /**< A client has returned with wrong id */ \
+ ERRORSTATUS(NsmErrorStatus_Last) /**< Last error value to identify valid errors */ \
+typedef enum _NsmErrorStatus_e {
+ FOREACH_ERRORSTATUS(GENERATE_ENUM)
+}NsmErrorStatus_e;
+
+static const char *ERRORSTATUS_STRING[] __attribute__((unused)) = {
+ FOREACH_ERRORSTATUS(GENERATE_STRING)
+};
/**
* Possible application modes of the node.
*/
-typedef enum _NsmApplicationMode_e
-{
- NsmApplicationMode_NotSet, /**< Initial state */
- NsmApplicationMode_Parking, /**< Parking mode */
- NsmApplicationMode_Factory, /**< Factory mode */
- NsmApplicationMode_Transport, /**< Transport mode */
- NsmApplicationMode_Normal, /**< Normal mode */
- NsmApplicationMode_Swl, /**< Software loading mode */
- NsmApplicationMode_Last /**< Last value to identify valid values */
+#define FOREACH_APPLICATIONMODE(APPLICATIONMODE) \
+ APPLICATIONMODE(NsmApplicationMode_NotSet) /**< Initial state */\
+ APPLICATIONMODE(NsmApplicationMode_Parking) /**< Parking mode */\
+ APPLICATIONMODE(NsmApplicationMode_Factory) /**< Factory mode */\
+ APPLICATIONMODE(NsmApplicationMode_Transport) /**< Transport mode */\
+ APPLICATIONMODE(NsmApplicationMode_Normal) /**< Normal mode */\
+ APPLICATIONMODE(NsmApplicationMode_Swl) /**< Software loading mode */\
+ APPLICATIONMODE(NsmApplicationMode_Last) /**< Last value to identify valid values */\
+
+typedef enum _NsmApplicationMode_e {
+ FOREACH_APPLICATIONMODE(GENERATE_ENUM)
}NsmApplicationMode_e;
+static const char *APPLICATIONMODE_STRING[] __attribute__((unused)) = {
+ FOREACH_APPLICATIONMODE(GENERATE_STRING)
+};
+
/**
* The enumeration defines the different restart reasons.
*/
-typedef enum _NsmRestartReason_e
-{
- NsmRestartReason_NotSet, /**< Initial value when reset reason is not set */
- NsmRestartReason_ApplicationFailure, /**< Reset was requested by System Health Mon. */
- NsmRestartReason_Diagnosis, /**< Reset was requested by diagnosis */
- NsmRestartReason_Swl, /**< Reset was requested by the SWL application */
- NsmRestartReason_User, /**< Reset was requested by an user application */
- NsmRestartReason_Last /**< Last value to identify valid reset reasons */
-} NsmRestartReason_e;
+#define FOREACH_RESTARTREASON(RESTARTREASON) \
+ RESTARTREASON(NsmRestartReason_NotSet) /**< Initial value when reset reason is not set */\
+ RESTARTREASON(NsmRestartReason_ApplicationFailure) /**< Reset was requested by System Health Mon. */\
+ RESTARTREASON(NsmRestartReason_Diagnosis) /**< Reset was requested by diagnosis */\
+ RESTARTREASON(NsmRestartReason_Swl) /**< Reset was requested by the SWL application */\
+ RESTARTREASON(NsmRestartReason_User) /**< Reset was requested by an user application */\
+ RESTARTREASON(NsmRestartReason_Last) /**< Last value to identify valid reset reasons */\
+
+typedef enum _NsmRestartReason_e {
+ FOREACH_RESTARTREASON(GENERATE_ENUM)
+}NsmRestartReason_e;
+static const char *RESTARTREASON_STRING[] __attribute__((unused)) = {
+ FOREACH_RESTARTREASON(GENERATE_STRING)
+};
/**
* Session can be enabled seat depended.
*/
-typedef enum _NsmSeat_e
-{
- NsmSeat_NotSet, /**< Initial state */
- NsmSeat_Driver, /**< Driver seat */
- NsmSeat_CoDriver, /**< CoDriver seat */
- NsmSeat_Rear1, /**< Rear 1 */
- NsmSeat_Rear2, /**< Rear 2 */
- NsmSeat_Rear3, /**< Rear 3 */
- NsmSeat_Last /**< Last valid state */
+#define FOREACH_SEAT(SEAT) \
+ SEAT(NsmSeat_NotSet) /**< Initial state */ \
+ SEAT(NsmSeat_Driver) /**< Driver seat */ \
+ SEAT(NsmSeat_CoDriver) /**< CoDriver seat */ \
+ SEAT(NsmSeat_Rear1) /**< Rear 1 */ \
+ SEAT(NsmSeat_Rear2) /**< Rear 2 */ \
+ SEAT(NsmSeat_Rear3) /**< Rear 3 */ \
+ SEAT(NsmSeat_Last) /**< Last valid state */ \
+
+typedef enum _NsmSeat_e {
+ FOREACH_SEAT(GENERATE_ENUM)
}NsmSeat_e;
+static const char *SEAT_STRING[] __attribute__((unused)) = {
+ FOREACH_SEAT(GENERATE_STRING)
+};
/**
* The enumeration defines the different wake up reasons.
*/
-typedef enum _NsmSessionState_e
-{
- NsmSessionState_Unregistered, /**< Initial state, equals "not set" */
- NsmSessionState_Inactive, /**< Session is inactive */
- NsmSessionState_Active /**< Session is active */
-} NsmSessionState_e;
+#define FOREACH_SESSIONSTATE(SESSIONSTATE) \
+ SESSIONSTATE(NsmSessionState_Unregistered) /**< Initial state, equals "not set" */ \
+ SESSIONSTATE(NsmSessionState_Inactive) /**< Session is inactive */ \
+ SESSIONSTATE(NsmSessionState_Active) /**< Session is active */\
+
+typedef enum _NsmSessionState_e {
+ FOREACH_SESSIONSTATE(GENERATE_ENUM)
+}NsmSessionState_e;
+
+static const char *SESSIONSTATE_STRING[] __attribute__((unused)) = {
+ FOREACH_SESSIONSTATE(GENERATE_STRING)
+};
/**
* The enumeration defines the different shutdown reasons.
*/
-typedef enum _NsmShutdownReason_e
-{
- NsmShutdownReason_NotSet, /**< Initial value when ShutdownReason not set */
- NsmShutdownReason_Normal, /**< A normal shutdown has been performed */
- NsmShutdownReason_SupplyBad, /**< Shutdown because of bad supply */
- NsmShutdownReason_SupplyPoor, /**< Shutdown because of poor supply */
- NsmShutdownReason_ThermalBad, /**< Shutdown because of bad thermal state */
- NsmShutdownReason_ThermalPoor, /**< Shutdown because of poor thermal state */
- NsmShutdownReason_SwlNotActive, /**< Shutdown after software loading */
- NsmShutdownReason_Last /**< Last value. Identify valid ShutdownReasons */
-} NsmShutdownReason_e;
+#define FOREACH_SHUTDOWNREASON(SHUTDOWNREASON) \
+ SHUTDOWNREASON(NsmShutdownReason_NotSet) /**< Initial value when ShutdownReason not set */ \
+ SHUTDOWNREASON(NsmShutdownReason_Normal) /**< A normal shutdown has been performed */ \
+ SHUTDOWNREASON(NsmShutdownReason_SupplyBad) /**< Shutdown because of bad supply */ \
+ SHUTDOWNREASON(NsmShutdownReason_SupplyPoor) /**< Shutdown because of poor supply */ \
+ SHUTDOWNREASON(NsmShutdownReason_ThermalBad) /**< Shutdown because of bad thermal state */ \
+ SHUTDOWNREASON(NsmShutdownReason_ThermalPoor) /**< Shutdown because of poor thermal state */ \
+ SHUTDOWNREASON(NsmShutdownReason_SwlNotActive) /**< Shutdown after software loading */ \
+ SHUTDOWNREASON(NsmShutdownReason_Last) /**< Last value. Identify valid ShutdownReasons */ \
+
+typedef enum _NsmShutdownReason_e {
+ FOREACH_SHUTDOWNREASON(GENERATE_ENUM)
+}NsmShutdownReason_e;
+
+static const char *SHUTDOWNREASON_STRING[] __attribute__((unused)) = {
+ FOREACH_SHUTDOWNREASON(GENERATE_STRING)
+};
/**
* The enumeration defines the different start or wake up reasons.
*/
-typedef enum _NsmRunningReason_e
-{
- NsmRunningReason_NotSet, /**< Initial value when reason is not set. */
- NsmRunningReason_WakeupCan, /**< Wake up because of CAN activity */
- NsmRunningReason_WakeupMediaEject, /**< Wake up because of 'Eject' button */
- NsmRunningReason_WakeupMediaInsertion, /**< Wake up because of media insertion */
- NsmRunningReason_WakeupHevac, /**< Wake up because of user uses the HEVAC unit in the car.
- Even if the HEVAC actually causes activity on the CAN bus a
- different wakeup reason is required as it could result in a
- different level of functionality being started */
- NsmRunningReason_WakeupPhone, /**< Wake up because of a phone call being received.
- Even if this is passed as a CAN event a different wakeup reason
- is required as it could result in a different level of
- functionality being started */
- NsmRunningReason_WakeupPowerOnButton, /**< Startup because user presses the "Power ON" button in the car.
- Even if this is passed as a CAN event a different wakeup reason
- is required as it could result in a different level of
- functionality being started */
- NsmRunningReason_StartupFstp, /**< System was started due to a first switch to power */
- NsmRunningReason_StartupSwitchToPower, /**< System was switched to power */
- NsmRunningReason_RestartSwRequest, /**< System was restarted due to an internal SW Request
- (i.e. SWL or Diagnosis) */
- NsmRunningReason_RestartInternalHealth, /**< System was restarted due to an internal health problem */
- NsmRunningReason_RestartExternalHealth, /**< System was restarted due to an external health problem
- (i.e. external wdog believed node was in failure) */
- NsmRunningReason_RestartUnexpected, /**< System was restarted due to an unexpected kernel restart.
- This will be the default catch when no other reason is known */
- NsmRunningReason_RestartUser, /**< Target was reset due to user action (i.e user 3 finger press) */
- NsmRunningReason_PlatformEnd = 0x7F, /**< Last value (127) to identify where the platform defines end
- (product will start from here on) */
- NsmRunningReason_ProductOffset = NsmRunningReason_PlatformEnd + 1 /**< product will start from here with index 0 */
-} NsmRunningReason_e;
+
+#define FOREACH_RUNNINGREASON(RUNNINGREASON) \
+ RUNNINGREASON(NsmRunningReason_NotSet) /**< Initial value when reason is not set. */\
+ RUNNINGREASON(NsmRunningReason_WakeupCan) /**< Wake up because of CAN activity */\
+ RUNNINGREASON(NsmRunningReason_WakeupMediaEject) /**< Wake up because of 'Eject' button */\
+ RUNNINGREASON(NsmRunningReason_WakeupMediaInsertion) /**< Wake up because of media insertion */\
+ RUNNINGREASON(NsmRunningReason_WakeupHevac) /**< Wake up because of user uses the HEVAC unit in the car.
+ Even if the HEVAC actually causes activity on the CAN bus a
+ different wakeup reason is required as it could result in a
+ different level of functionality being started */\
+ RUNNINGREASON(NsmRunningReason_WakeupPhone) /**< Wake up because of a phone call being received.
+ Even if this is passed as a CAN event a different wakeup reason
+ is required as it could result in a different level of
+ functionality being started */\
+ RUNNINGREASON(NsmRunningReason_WakeupPowerOnButton) /**< Startup because user presses the "Power ON" button in the car.
+ Even if this is passed as a CAN event a different wakeup reason
+ is required as it could result in a different level of
+ functionality being started */\
+ RUNNINGREASON(NsmRunningReason_StartupFstp) /**< System was started due to a first switch to power */\
+ RUNNINGREASON(NsmRunningReason_StartupSwitchToPower) /**< System was switched to power */\
+ RUNNINGREASON(NsmRunningReason_RestartSwRequest) /**< System was restarted due to an internal SW Request
+ (i.e. SWL or Diagnosis) */\
+ RUNNINGREASON(NsmRunningReason_RestartInternalHealth) /**< System was restarted due to an internal health problem */\
+ RUNNINGREASON(NsmRunningReason_RestartExternalHealth) /**< System was restarted due to an external health problem
+ (i.e. external wdog believed node was in failure) */\
+ RUNNINGREASON(NsmRunningReason_RestartUnexpected) /**< System was restarted due to an unexpected kernel restart.
+ This will be the default catch when no other reason is known */\
+ RUNNINGREASON(NsmRunningReason_RestartUser) /**< Target was reset due to user action (i.e user 3 finger press) */\
+ RUNNINGREASON(NsmRunningReason_PlatformEnd)\
+
+typedef enum _NsmRunningReason_e {
+ FOREACH_RUNNINGREASON(GENERATE_ENUM)
+}NsmRunningReason_e;
+
+static const char *RUNNINGREASON_STRING[] __attribute__((unused)) = {
+ FOREACH_RUNNINGREASON(GENERATE_STRING)
+};
/**
* The enumeration defines the different node states
*/
-typedef enum _NsmNodeState_e
-{
- NsmNodeState_NotSet, /**< Initial state when node state is not set */
- NsmNodeState_StartUp, /**< Basic system is starting up */
- NsmNodeState_BaseRunning, /**< Basic system components have been started */
- NsmNodeState_LucRunning, /**< All 'Last user context' components have been started */
- NsmNodeState_FullyRunning, /**< All 'foreground' components have been started */
- NsmNodeState_FullyOperational, /**< All components have been started */
- NsmNodeState_ShuttingDown, /**< The system is shutting down */
- NsmNodeState_ShutdownDelay, /**< Shutdown request active. System will shutdown soon */
- NsmNodeState_FastShutdown, /**< Fast shutdown active */
- NsmNodeState_DegradedPower, /**< Node is in degraded power state */
- NsmNodeState_Shutdown, /**< Node is completely shut down */
- NsmNodeState_Last /**< Last valid entry to identify valid node states */
-} NsmNodeState_e;
+#define FOREACH_NODESTATE(NODESTATE) \
+ NODESTATE(NsmNodeState_NotSet) \
+ NODESTATE(NsmNodeState_StartUp) \
+ NODESTATE(NsmNodeState_BaseRunning) \
+ NODESTATE(NsmNodeState_LucRunning) \
+ NODESTATE(NsmNodeState_FullyRunning) \
+ NODESTATE(NsmNodeState_FullyOperational) \
+ NODESTATE(NsmNodeState_ShuttingDown) \
+ NODESTATE(NsmNodeState_ShutdownDelay) \
+ NODESTATE(NsmNodeState_FastShutdown) \
+ NODESTATE(NsmNodeState_DegradedPower) \
+ NODESTATE(NsmNodeState_Shutdown) \
+ NODESTATE(NsmNodeState_Resume) \
+ NODESTATE(NsmNodeState_Last) \
+
+typedef enum _NsmNodeState_e {
+ FOREACH_NODESTATE(GENERATE_ENUM)
+}NsmNodeState_e;
+
+static const char *NODESTATE_STRING[] __attribute__((unused)) = {
+ FOREACH_NODESTATE(GENERATE_STRING)
+};
/** The type defines the structure for a session. */
typedef struct _NsmSession_s
@@ -246,7 +297,6 @@ typedef struct _NsmSession_s
NsmSessionState_e enState; /**< State of the session */
} NsmSession_s, *pNsmSession_s;
-
#ifdef __cplusplus
}
#endif