1 #ifndef NODESTATETYPES_H
2 #define NODESTATETYPES_H
4 /**********************************************************************************************************************
6 * Copyright (C) 2012 Continental Automotive Systems, Inc.
8 * Author: Jean-Pierre.Bogler@continental-corporation.com
10 * Type and constant definitions to communicate with the NSM.
12 * The file defines types and constants to be able to communicate with the NSM.
14 * This Source Code Form is subject to the terms of the Mozilla Public
15 * License, v. 2.0. If a copy of the MPL was not distributed with this
16 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
19 * 2012.09.27 uidu5846 1.0.0.0 CSP_WZ#1194: Introduced 'NodeStateTypes.h' to avoid circle includes
20 * and encapsulate type definitions.
21 * 2012.10.24 uidu5846 1.0.0.1 CSP_WZ#1322: Removed "ssw_types" redefinition from header.
22 * Since the same native types are used, no interface change.
24 **********************************************************************************************************************/
26 /** \ingroup SSW_LCS */
27 /** \defgroup SSW_NSM_TEMPLATE Node State Manager
30 /** \defgroup SSW_NSM_INTERFACE API document
39 /**********************************************************************************************************************
43 **********************************************************************************************************************/
45 /* Definitions of D-Bus names and addresses */
46 #define NSM_BUS_TYPE 1 /**< Defines bus type according to GBusType */
47 #define NSM_BUS_NAME "org.genivi.NodeStateManager" /**< The bus name of the NSM */
48 #define NSM_LIFECYCLE_OBJECT "/org/genivi/NodeStateManager/LifecycleControl" /**< Address of the lifecycle object */
49 #define NSM_CONSUMER_OBJECT "/org/genivi/NodeStateManager/Consumer" /**< Address of the consumer object */
51 /* Defines for session handling */
52 #define NSM_DEFAULT_SESSION_OWNER "NodeStateManager" /**< "Owner" of the default sessions */
54 /* Defines for internal settings like max. string lenghts */
55 #define NSM_MAX_SESSION_NAME_LENGTH 256 /**< Max. number of chars a session name can have */
56 #define NSM_MAX_SESSION_OWNER_LENGTH 256 /**< Max. number of chars for name of session owner */
59 * Defines for shutdown handling as bit masks. Used to register for multiple shutdown types and as parameter to
60 * inform clients about the shutdown type via the LifecycleConsumer interface.
62 #define NSM_SHUTDOWNTYPE_NOT 0x00000000U /**< Client not registered for any shutdown */
63 #define NSM_SHUTDOWNTYPE_NORMAL 0x00000001U /**< Client registered for normal shutdown */
64 #define NSM_SHUTDOWNTYPE_FAST 0x00000002U /**< Client registered for fast shutdown */
65 #define NSM_SHUTDOWNTYPE_RUNUP 0x80000000U /**< The shutdown type "run up" can not be used for
66 registration. Clients which are registered and
67 have been shut down, will automatically be
68 informed about the "run up", when the shut down
71 /**********************************************************************************************************************
75 **********************************************************************************************************************/
78 * The enumeration defines the different types of data that can be exchanged between the NodeStateManager (NSM)
79 * and the NodeStateMachine (NSMC). Based on this value, the setter and getter functions of the NSM and NSMC will
80 * interpret data behind the passed byte pointer.
82 typedef enum _NsmDataType_e
84 NsmDataType_AppMode, /**< An ApplicationMode should be set or get */
85 NsmDataType_NodeState, /**< A NodeState should be set or get */
86 NsmDataType_RestartReason, /**< A RestartReason should be set or get */
87 NsmDataType_SessionState, /**< A SessionState should be set or get */
88 NsmDataType_ShutdownReason, /**< A ShutdownReason should be set or get */
89 NsmDataType_BootMode, /**< A BootMode should be set or get */
90 NsmDataType_RunningReason /**< A RunningReason should be set or get */
95 * The enumeration defines the different wake up reasons.
97 typedef enum _NsmErrorStatus_e
99 NsmErrorStatus_NotSet, /**< Initial value when error type is not set */
100 NsmErrorStatus_Ok, /**< Value when no error occurred */
101 NsmErrorStatus_Error, /**< A general, non-specific error occurred */
102 NsmErrorStatus_Dbus, /**< Error in D-Bus communication */
103 NsmErrorStatus_Internal, /**< Internal error (memory alloc. failed, etc.) */
104 NsmErrorStatus_Parameter, /**< A passed parameter was incorrect */
105 NsmErrorStatus_WrongSession, /**< The requested session is unknown. */
106 NsmErrorStatus_ResponsePending, /**< Command accepted, return value delivered asynch. */
107 NsmErrorStatus_Last /**< Last error value to identify valid errors */
112 * Possible application modes of the node.
114 typedef enum _NsmApplicationMode_e
116 NsmApplicationMode_NotSet, /**< Initial state */
117 NsmApplicationMode_Parking, /**< Parking mode */
118 NsmApplicationMode_Factory, /**< Factory mode */
119 NsmApplicationMode_Transport, /**< Transport mode */
120 NsmApplicationMode_Normal, /**< Normal mode */
121 NsmApplicationMode_Swl, /**< Software loading mode */
122 NsmApplicationMode_Last /**< Last value to identify valid values */
123 }NsmApplicationMode_e;
127 * The enumeration defines the different restart reasons.
129 typedef enum _NsmRestartReason_e
131 NsmRestartReason_NotSet, /**< Initial value when reset reason is not set */
132 NsmRestartReason_ApplicationFailure, /**< Reset was requested by System Health Mon. */
133 NsmRestartReason_Diagnosis, /**< Reset was requested by diagnosis */
134 NsmRestartReason_Swl, /**< Reset was requested by the SWL application */
135 NsmRestartReason_User, /**< Reset was requested by an user application */
136 NsmRestartReason_Last /**< Last value to identify valid reset reasons */
137 } NsmRestartReason_e;
141 * Session can be enabled seat depended.
143 typedef enum _NsmSeat_e
145 NsmSeat_NotSet, /**< Initial state */
146 NsmSeat_Driver, /**< Driver seat */
147 NsmSeat_CoDriver, /**< CoDriver seat */
148 NsmSeat_Rear1, /**< Rear 1 */
149 NsmSeat_Rear2, /**< Rear 2 */
150 NsmSeat_Rear3, /**< Rear 3 */
151 NsmSeat_Last /**< Last valid state */
156 * The enumeration defines the different wake up reasons.
158 typedef enum _NsmSessionState_e
160 NsmSessionState_Unregistered, /**< Initial state, equals "not set" */
161 NsmSessionState_Inactive, /**< Session is inactive */
162 NsmSessionState_Active /**< Session is active */
166 * The enumeration defines the different shutdown reasons.
168 typedef enum _NsmShutdownReason_e
170 NsmShutdownReason_NotSet, /**< Initial value when ShutdownReason not set */
171 NsmShutdownReason_Normal, /**< A normal shutdown has been performed */
172 NsmShutdownReason_SupplyBad, /**< Shutdown because of bad supply */
173 NsmShutdownReason_SupplyPoor, /**< Shutdown because of poor supply */
174 NsmShutdownReason_ThermalBad, /**< Shutdown because of bad thermal state */
175 NsmShutdownReason_ThermalPoor, /**< Shutdown because of poor thermal state */
176 NsmShutdownReason_SwlNotActive, /**< Shutdown after software loading */
177 NsmShutdownReason_Last /**< Last value. Identify valid ShutdownReasons */
178 } NsmShutdownReason_e;
181 * The enumeration defines the different start or wake up reasons.
183 typedef enum _NsmRunningReason_e
185 NsmRunningReason_NotSet, /**< Initial value when reason is not set. */
186 NsmRunningReason_WakeupCan, /**< Wake up because of CAN activity */
187 NsmRunningReason_WakeupMediaEject, /**< Wake up because of 'Eject' button */
188 NsmRunningReason_WakeupMediaInsertion, /**< Wake up because of media insertion */
189 NsmRunningReason_WakeupHevac, /**< Wake up because of user uses the HEVAC unit in the car.
190 Even if the HEVAC actually causes activity on the CAN bus a
191 different wakeup reason is required as it could result in a
192 different level of functionality being started */
193 NsmRunningReason_WakeupPhone, /**< Wake up because of a phone call being received.
194 Even if this is passed as a CAN event a different wakeup reason
195 is required as it could result in a different level of
196 functionality being started */
197 NsmRunningReason_WakeupPowerOnButton, /**< Startup because user presses the "Power ON" button in the car.
198 Even if this is passed as a CAN event a different wakeup reason
199 is required as it could result in a different level of
200 functionality being started */
201 NsmRunningReason_StartupFstp, /**< System was started due to a first switch to power */
202 NsmRunningReason_StartupSwitchToPower, /**< System was switched to power */
203 NsmRunningReason_RestartSwRequest, /**< System was restarted due to an internal SW Request
204 (i.e. SWL or Diagnosis) */
205 NsmRunningReason_RestartInternalHealth, /**< System was restarted due to an internal health problem */
206 NsmRunningReason_RestartExternalHealth, /**< System was restarted due to an external health problem
207 (i.e. external wdog believed node was in failure) */
208 NsmRunningReason_RestartUnexpected, /**< System was restarted due to an unexpected kernel restart.
209 This will be the default catch when no other reason is known */
210 NsmRunningReason_RestartUser, /**< Target was reset due to user action (i.e user 3 finger press) */
211 NsmRunningReason_PlatformEnd = 0x7F, /**< Last value (127) to identify where the platform defines end
212 (product will start from here on) */
213 NsmRunningReason_ProductOffset = NsmRunningReason_PlatformEnd + 1 /**< product will start from here with index 0 */
214 } NsmRunningReason_e;
218 * The enumeration defines the different node states
220 typedef enum _NsmNodeState_e
222 NsmNodeState_NotSet, /**< Initial state when node state is not set */
223 NsmNodeState_StartUp, /**< Basic system is starting up */
224 NsmNodeState_BaseRunning, /**< Basic system components have been started */
225 NsmNodeState_LucRunning, /**< All 'Last user context' components have been started */
226 NsmNodeState_FullyRunning, /**< All 'foreground' components have been started */
227 NsmNodeState_FullyOperational, /**< All components have been started */
228 NsmNodeState_ShuttingDown, /**< The system is shutting down */
229 NsmNodeState_ShutdownDelay, /**< Shutdown request active. System will shutdown soon */
230 NsmNodeState_FastShutdown, /**< Fast shutdown active */
231 NsmNodeState_DegradedPower, /**< Node is in degraded power state */
232 NsmNodeState_Shutdown, /**< Node is completely shut down */
233 NsmNodeState_Last /**< Last valid entry to identify valid node states */
237 /** The type defines the structure for a session. */
238 typedef struct _NsmSession_s
240 char sName[NSM_MAX_SESSION_NAME_LENGTH]; /**< Name of the session */
241 char sOwner[NSM_MAX_SESSION_OWNER_LENGTH]; /**< Owner of the session */
242 NsmSeat_e enSeat; /**< Seat of the session */
243 NsmSessionState_e enState; /**< State of the session */
244 } NsmSession_s, *pNsmSession_s;
250 /** \} */ /* End of SSW_NSM_INTERFACE */
251 /** \} */ /* End of SSW_NSM_TEMPLATE */
252 #endif /* NODESTATETYPES_H */