diff options
-rw-r--r-- | AudioManagerDaemon/CMakeLists.txt | 3 | ||||
-rw-r--r-- | PluginControlInterface/CMakeLists.txt | 3 | ||||
-rwxr-xr-x | README | 11 | ||||
-rw-r--r-- | README.html | 16 | ||||
-rw-r--r-- | cmake/FindNSM.cmake | 32 | ||||
-rw-r--r-- | nodeStateManagerIncludes/NodeStateManager.h | 129 | ||||
-rw-r--r-- | nodeStateManagerIncludes/NodeStateTypes.h | 252 |
7 files changed, 438 insertions, 8 deletions
diff --git a/AudioManagerDaemon/CMakeLists.txt b/AudioManagerDaemon/CMakeLists.txt index 4704864..bfc026f 100644 --- a/AudioManagerDaemon/CMakeLists.txt +++ b/AudioManagerDaemon/CMakeLists.txt @@ -40,6 +40,8 @@ IF(WITH_DBUS_WRAPPER) FIND_PACKAGE(DBUS REQUIRED) ENDIF(WITH_DBUS_WRAPPER) +FIND_PACKAGE(NSM REQUIRED) + SET(AUDIOMAN_SRCS_CXX src/main.cpp src/CAmCommandReceiver.cpp @@ -86,6 +88,7 @@ INCLUDE_DIRECTORIES( ${AUDIO_INCLUDE_FOLDER} ${PROJECT_INCLUDE_FOLDER} ${INCLUDE_FOLDER} + ${NSM_INCLUDE_DIR} ) IF(WITH_DLT) diff --git a/PluginControlInterface/CMakeLists.txt b/PluginControlInterface/CMakeLists.txt index b1be2d1..f90fe04 100644 --- a/PluginControlInterface/CMakeLists.txt +++ b/PluginControlInterface/CMakeLists.txt @@ -27,6 +27,8 @@ STRING(REGEX MATCH "ControlSendVersion*.[^0-9]*[0-9].[0-9]*[0-9]" LIB_INTERFACE_ STRING(REGEX REPLACE "ControlSendVersion*.." "" LIB_INTERFACE_VERSION ${LIB_INTERFACE_VERSION_STRING}) MESSAGE(STATUS "Building against control interface version ${LIB_INTERFACE_VERSION}") +FIND_PACKAGE(NSM REQUIRED) + INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${STD_INCLUDE_DIRS} @@ -34,6 +36,7 @@ INCLUDE_DIRECTORIES( ${AUDIO_INCLUDE_FOLDER} ${PROJECT_INCLUDE_FOLDER} ${INCLUDE_FOLDER} + ${NSM_INCLUDE_DIR} ) # all source files go here @@ -94,6 +94,12 @@ sets the default telnetport, default 6060. Can be overwriten by command line par .-DMAX_TELNETCONNECTIONS="XXX" sets the default maximum number of telnetconnections, default is 3 +.-DNSM_PATH="XXX" +sets the path of the NSM DBUS interface + +.-DNSM_INTERFACE="XXX" +sets the interface to the NSM DBUS interface + In order to change these options, you can modify this values with ccmake, do the appropriate changes in CmakeList.txt or via the commandline for cmake or (when installed via ccmake) @@ -104,13 +110,16 @@ You will need to fullfill some dependencies in order to comile the GENIVI AudioM * sqlite3 [tested on version 3.6.22] * automotive-dlt [greater 2.5.0] * doxygen (only when WITH_DOCUMENTATION==ON) [tested on version 1.6.3] -* nodestatemanager headers [tested with version 0.1.0] To install them in a build environment like Ubuntu you can use: ---- sudo apt-get install libdbus-1-dev libsqlite3-dev doxygen git cmake build-essential ---- +=== The NodeStateManager + +The nodestatemanager headers are needed to compile the audiomanager. If the nodestatemanagerincludes are not found, +the headers shipped with the audiomanager are used. The nodestatemanager can be retrieved from projects.genivi.org . You can install the headers on you system by ---- diff --git a/README.html b/README.html index c1be5ea..e37c8c9 100644 --- a/README.html +++ b/README.html @@ -830,6 +830,8 @@ gtest_force_shared_crt OFF</tt></pre> <div class="paragraph"><div class="title">-DDBUS_SERVICE_OBJECT_PATH="XXX"</div><p>sets the object path for Dbus, default "/org/genivi/audiomanager\0"</p></div>
<div class="paragraph"><div class="title">-DDEFAULT_TELNETPORT="XXX"</div><p>sets the default telnetport, default 6060. Can be overwriten by command line parameter</p></div>
<div class="paragraph"><div class="title">-DMAX_TELNETCONNECTIONS="XXX"</div><p>sets the default maximum number of telnetconnections, default is 3</p></div>
+<div class="paragraph"><div class="title">-DNSM_PATH="XXX"</div><p>sets the path of the NSM DBUS interface</p></div>
+<div class="paragraph"><div class="title">-DNSM_INTERFACE="XXX"</div><p>sets the interface to the NSM DBUS interface</p></div>
<div class="paragraph"><p>In order to change these options, you can modify this values with ccmake, do the appropriate changes in
CmakeList.txt or via the commandline for cmake or (when installed via ccmake)</p></div>
</div>
@@ -857,18 +859,18 @@ automotive-dlt [greater 2.5.0] doxygen (only when WITH_DOCUMENTATION==ON) [tested on version 1.6.3]
</p>
</li>
-<li>
-<p>
-nodestatemanager headers [tested with version 0.1.0]
-</p>
-</li>
</ul></div>
<div class="paragraph"><p>To install them in a build environment like Ubuntu you can use:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>sudo apt-get install libdbus-1-dev libsqlite3-dev doxygen git cmake build-essential</tt></pre>
</div></div>
-<div class="paragraph"><p>The nodestatemanager can be retrieved from projects.genivi.org . You can install the headers on you system by</p></div>
+</div>
+<div class="sect2">
+<h3 id="_the_nodestatemanager">The NodeStateManager</h3>
+<div class="paragraph"><p>The nodestatemanager headers are needed to compile the audiomanager. If the nodestatemanagerincludes are not found,
+the headers shipped with the audiomanager are used.
+The nodestatemanager can be retrieved from projects.genivi.org . You can install the headers on you system by</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>sudo make install-includeHEADERS</tt></pre>
@@ -1200,7 +1202,7 @@ handle later on.</p></div> <div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2012-12-17 13:07:13 CET
+Last updated 2013-01-07 13:31:14 CET
</div>
</div>
</body>
diff --git a/cmake/FindNSM.cmake b/cmake/FindNSM.cmake new file mode 100644 index 0000000..df7b11e --- /dev/null +++ b/cmake/FindNSM.cmake @@ -0,0 +1,32 @@ +# Copyright (C) 2013, BMW AG +# +# This file is part of GENIVI Project AudioManager. +# +# Contributions are licensed to the GENIVI Alliance under one or more +# Contribution License Agreements. +# +# copyright +# 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/. +# +# author Christian Linke, christian.linke@bmw.de BMW 2013 +# +# For further information see http://www.genivi.org/. +# + +FIND_PATH (NSM_INCLUDE_DIR NodeStateManager.h + DOC "The nodestatemanager include directory" +) + +IF(NSM_INCLUDE_DIR) + message(STATUS "Found NSM include: ${NSM_INCLUDE_DIR}") +ELSE(NSM_INCLUDE_DIR) + SET(NSM_FOUND "YES") + SET (NSM_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/nodeStateManagerIncludes") + message(STATUS "Did not find NSM include, using own include dir: ${NSM_INCLUDE_DIR}") +ENDIF(NSM_INCLUDE_DIR) + +MARK_AS_ADVANCED( + NSM_INCLUDE_DIR +)
\ No newline at end of file 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 */ |