From 8f43ba9159a4f9f5efbf9c2515f314cc58737d48 Mon Sep 17 00:00:00 2001 From: christian linke Date: Mon, 7 Jan 2013 13:32:52 +0100 Subject: * take away mandatory NSM dependency and ship NSM headers as fallback Signed-off-by: christian linke --- nodeStateManagerIncludes/NodeStateManager.h | 129 ++++++++++++++ nodeStateManagerIncludes/NodeStateTypes.h | 252 ++++++++++++++++++++++++++++ 2 files changed, 381 insertions(+) create mode 100644 nodeStateManagerIncludes/NodeStateManager.h create mode 100644 nodeStateManagerIncludes/NodeStateTypes.h (limited to 'nodeStateManagerIncludes') diff --git a/nodeStateManagerIncludes/NodeStateManager.h b/nodeStateManagerIncludes/NodeStateManager.h new file mode 100644 index 0000000..61b9995 --- /dev/null +++ b/nodeStateManagerIncludes/NodeStateManager.h @@ -0,0 +1,129 @@ +#ifndef NODESTATEMANAGER_H +#define NODESTATEMANAGER_H + +/********************************************************************************************************************** +* +* Copyright (C) 2012 Continental Automotive Systems, Inc. +* +* Author: Jean-Pierre.Bogler@continental-corporation.com +* +* Interface between NodeStateManager and other components in the same process +* +* The file defines the interfaces and data types, which components in the same process or on the D-Bus +* can use to communicate to the NodeStateManager (NSM). Please note that there are further interfaces +* defined in XML to access the NSM via D-Bus. +* +* 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 +* 2012.06.01 uidu5846 1.0.0.0 CSP_WZ#388: Initial version of the NodeStateManager interface +* 2012.09.27 uidu5846 1.1.0.0 CSP_WZ#1194: Changed file header structure and license to be released +* as open source package. Introduced 'NodeStateTypes.h' to +* avoid circle includes and encapsulate type definitions. +* 2012.10.24 uidu5846 1.2.0.0 CSP_WZ#1322: Changed types of interface parameters to native types. +* Since the same native types are used, no interface change. +* +**********************************************************************************************************************/ + +/** \ingroup SSW_LCS */ +/** \defgroup SSW_NSM_TEMPLATE Node State Manager + * \{ + */ +/** \defgroup SSW_NSM_INTERFACE API document + * \{ + */ + +#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 NSM_INTERFACE_VERSION 0x01020000U + +/********************************************************************************************************************** +* +* TYPE +* +**********************************************************************************************************************/ + +/* There are no types defined here */ + +/********************************************************************************************************************** +* +* GLOBAL VARIABLES +* +**********************************************************************************************************************/ + +/* There are no exported global variables */ + + +/********************************************************************************************************************** +* +* FUNCTION PROTOTYPE +* +**********************************************************************************************************************/ + +/** \brief Set data (property) of the NodeStateManager. +\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 NSMc to write a specific data item that from the NSM. */ +NsmErrorStatus_e NsmSetData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen); + + +/** \brief Get data (property) of the NodeStateManager. +\param[in] enData Type of the data to get (see ::NsmDataType_e). +\param[out] pData Pointer to the memory location where the data should be stored. +\param[in] u32DataLen Length of the data that should be stored (in byte). +\retval A positive value indicates the number of bytes that have been written to the out buffer pData. + A negative value indicates an error. + +This is a generic interface that can be used by the NSMc to read a specific data item that from the NSM. */ +int NsmGetData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen); + + +/** \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 NsmGetInterfaceVersion(void); + + +/********************************************************************************************************************** +* +* MACROS +* +**********************************************************************************************************************/ + +/* There are no macros defined */ + + +#ifdef __cplusplus +} +#endif +/** \} */ /* End of SSW_NSM_INTERFACE */ +/** \} */ /* End of SSW_NSM_TEMPLATE */ +#endif /* NSM_NODESTATEMANAGER_H */ diff --git a/nodeStateManagerIncludes/NodeStateTypes.h b/nodeStateManagerIncludes/NodeStateTypes.h new file mode 100644 index 0000000..023dfa9 --- /dev/null +++ b/nodeStateManagerIncludes/NodeStateTypes.h @@ -0,0 +1,252 @@ +#ifndef NODESTATETYPES_H +#define NODESTATETYPES_H + +/********************************************************************************************************************** +* +* Copyright (C) 2012 Continental Automotive Systems, Inc. +* +* Author: Jean-Pierre.Bogler@continental-corporation.com +* +* Type and constant definitions to communicate with the NSM. +* +* The file defines types and constants to be able to communicate with the NSM. +* +* 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 +* 2012.09.27 uidu5846 1.0.0.0 CSP_WZ#1194: Introduced 'NodeStateTypes.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. +* +**********************************************************************************************************************/ + +/** \ingroup SSW_LCS */ +/** \defgroup SSW_NSM_TEMPLATE Node State Manager + * \{ + */ +/** \defgroup SSW_NSM_INTERFACE API document + * \{ + */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/********************************************************************************************************************** +* +* CONSTANTS +* +**********************************************************************************************************************/ + +/* 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 */ + +/* Defines for internal settings like max. string lenghts */ +#define NSM_MAX_SESSION_NAME_LENGTH 256 /**< Max. number of chars a session name can have */ +#define NSM_MAX_SESSION_OWNER_LENGTH 256 /**< Max. number of chars for name of session owner */ + +/* + * Defines for shutdown handling as bit masks. Used to register for multiple shutdown types and as parameter to + * inform clients about the shutdown type via the LifecycleConsumer interface. + */ +#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 + registration. Clients which are registered and + have been shut down, will automatically be + informed about the "run up", when the shut down + is canceled. */ + +/********************************************************************************************************************** +* +* TYPE +* +**********************************************************************************************************************/ + +/** + * The enumeration defines the different types of data that can be exchanged between the NodeStateManager (NSM) + * 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_e; + + +/** + * 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; + + +/** + * 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 */ +}NsmApplicationMode_e; + + +/** + * 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; + + +/** + * 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 */ +}NsmSeat_e; + + +/** + * 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; + +/** + * 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; + +/** + * 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; + + +/** + * 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; + + +/** The type defines the structure for a session. */ +typedef struct _NsmSession_s +{ + char sName[NSM_MAX_SESSION_NAME_LENGTH]; /**< Name of the session */ + char sOwner[NSM_MAX_SESSION_OWNER_LENGTH]; /**< Owner of the session */ + NsmSeat_e enSeat; /**< Seat of the session */ + NsmSessionState_e enState; /**< State of the session */ +} NsmSession_s, *pNsmSession_s; + + +#ifdef __cplusplus +} +#endif +/** \} */ /* End of SSW_NSM_INTERFACE */ +/** \} */ /* End of SSW_NSM_TEMPLATE */ +#endif /* NODESTATETYPES_H */ -- cgit v1.2.1