summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Linke <christian.linke@bmw.de>2015-09-22 17:32:01 +0100
committerChristian Linke <christian.linke@bmw.de>2015-09-22 17:32:01 +0100
commitbd7ec24a2abe47ae4398b23282e8288e00eaec47 (patch)
tree778cf5ffa440b44752bb1cbcfd4c75d950bd48c4
parenta9f86b94f3cc83a9474e8a0d7e21de4c8e452526 (diff)
downloadaudiomanager-7.2.tar.gz
Remove nodestatemanager7.2
Make audiomanager compile with Dbus and CommonAPI Wrapper at the same time Signed-off-by: Christian Linke <christian.linke@bmw.de>
-rw-r--r--AudioManagerDaemon/CMakeLists.txt68
-rw-r--r--AudioManagerDaemon/docx/02_license.dox1
-rw-r--r--AudioManagerDaemon/docx/14_z_nodeStateManagement.dox39
-rw-r--r--AudioManagerDaemon/fidls/NodeStateManager.fdepl6
-rw-r--r--AudioManagerDaemon/fidls/NodeStateManager.fidl152
-rw-r--r--AudioManagerDaemon/include/CAmControlReceiver.h10
-rw-r--r--AudioManagerDaemon/include/CAmControlSender.h6
-rw-r--r--AudioManagerDaemon/include/CAmNodeStateCommunicator.h74
-rw-r--r--AudioManagerDaemon/include/CAmNodeStateCommunicatorCAPI.h113
-rw-r--r--AudioManagerDaemon/include/CAmNodeStateCommunicatorDBus.h65
-rw-r--r--AudioManagerDaemon/src/CAmControlReceiver.cpp154
-rw-r--r--AudioManagerDaemon/src/CAmControlSender.cpp24
-rw-r--r--AudioManagerDaemon/src/CAmNodeStateCommunicatorCAPI.cpp386
-rw-r--r--AudioManagerDaemon/src/CAmNodeStateCommunicatorDBus.cpp778
-rwxr-xr-xAudioManagerDaemon/src/main.cpp27
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp266
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.h67
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CMakeLists.txt113
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/nsm.py179
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/org.genivi.NodeStateManager.Consumer.xml259
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/send2nsm.py68
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CAmNodeStateCommunicatorTest.cpp250
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CAmNodeStateCommunicatorTest.h63
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CMakeLists.txt103
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/nsm.py179
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/org.genivi.NodeStateManager.Consumer.xml259
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/send2nsm.py68
-rw-r--r--AudioManagerDaemon/test/CMakeLists.txt8
-rw-r--r--AudioManagerDaemon/test/MockIAmControlSend.h8
-rw-r--r--AudioManagerUtilities/include/CAmCommonAPIWrapper.h5
-rw-r--r--AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp47
-rwxr-xr-xCMakeLists.txt76
-rw-r--r--Foo/LifecycleConsumer.xml23
-rwxr-xr-xREADME3
-rw-r--r--cmake/CommonAPI.cmake299
-rw-r--r--cmake/FindNSM.cmake34
-rw-r--r--cmake/audiomanagerConfig.cmake.in6
-rw-r--r--cmake/config.cmake.in6
-rw-r--r--include/IAmControl.h72
-rw-r--r--nodeStateManagerIncludes/NodeStateManager.h131
-rw-r--r--nodeStateManagerIncludes/NodeStateTypes.h254
41 files changed, 30 insertions, 4719 deletions
diff --git a/AudioManagerDaemon/CMakeLists.txt b/AudioManagerDaemon/CMakeLists.txt
index 6ad0aff..ff8b70e 100644
--- a/AudioManagerDaemon/CMakeLists.txt
+++ b/AudioManagerDaemon/CMakeLists.txt
@@ -50,8 +50,7 @@ if(WITH_DBUS_WRAPPER)
endif(WITH_DBUS_WRAPPER)
if(WITH_CAPI_WRAPPER)
- INCLUDE (CommonAPI)
- LOAD_COMMONAPI()
+ find_package(CommonAPI REQUIRED)
endif(WITH_CAPI_WRAPPER)
set (AM_LINK_LIBS
@@ -103,33 +102,10 @@ if(WITH_DBUS_WRAPPER)
endif(WITH_DBUS_WRAPPER)
if(WITH_CAPI_WRAPPER)
- set (AUDIOMAN_SRCS_CXX ${AUDIOMAN_SRCS_CXX} "${AUDIOMANAGER_UTILITIES_SRC}/CAmCommonAPIWrapper.cpp")
+ set (AUDIOMAN_SRCS_CXX ${AUDIOMAN_SRCS_CXX} "${AUDIOMANAGER_UTILITIES_SRC}/CAmCommonAPIWrapper.cpp")
set (AM_LINK_LIBS ${AM_LINK_LIBS} ${CommonAPI_LIBRARY})
- if(${COMMONAPI_USED_BINDING} EQUAL 0)
- set (AM_LINK_LIBS ${AM_LINK_LIBS}
- ${CommonAPI-DBus_LIBRARY}
- ${DBUS_LIBRARIES}
- ${CommonAPI_LIBRARY})
- else()
- set (AM_LINK_LIBS ${AM_LINK_LIBS}
- ${CommonAPI-SomeIP_LIBRARY}
- ${CommonAPI_LIBRARY})
- endif()
-
endif(WITH_CAPI_WRAPPER)
-if(WITH_NSM)
- if(WITH_DBUS_WRAPPER)
- set (AUDIOMAN_SRCS_CXX
- ${AUDIOMAN_SRCS_CXX}
- src/CAmNodeStateCommunicatorDBus.cpp)
- else(WITH_DBUS_WRAPPER)
- set (AUDIOMAN_SRCS_CXX
- ${AUDIOMAN_SRCS_CXX}
- src/CAmNodeStateCommunicatorCAPI.cpp)
- endif(WITH_DBUS_WRAPPER)
-endif(WITH_NSM)
-
if(WITH_DATABASE_STORAGE)
set (AUDIOMAN_SRCS_CXX
${AUDIOMAN_SRCS_CXX}
@@ -150,47 +126,13 @@ INCLUDE_DIRECTORIES(
${AUDIOMANAGER_INCLUDE_FOLDER}
${AUDIOMANAGER_UTILITIES_INCLUDE}
${INCLUDE_FOLDER}
- ${NSM_INCLUDE_DIR}
${TCLAP_INCLUDE_DIR}
)
if(WITH_CAPI_WRAPPER)
- if(WITH_NSM)
- IF(${COMMONAPI_USED_BINDING} EQUAL 1)#SomeIP
- SET(SRC_GEN src-gen/v${COMMONAPI_SOMEIP_VERSION_NUMBER}/someip)
- ELSE()#Dbus
- SET(SRC_GEN src-gen/v${COMMONAPI_DBUS_VERSION_NUMBER}/dbus)
- ENDIF()
- COMMON_API_GENERATE_SOURCES(
- TARGET COMMON_API
- # A list with fidls for the generic generator.
- FIDLS_GENERIC fidls/NodeStateManager.fdepl
- # A list with fidls for the binding generator.
- FIDLS_BINDING fidls/NodeStateManager.fdepl
- # A relative path to the build directory or an absolute path.
- DESTINATION ${SRC_GEN}
- # An alternative relative/absolute path with common-api sources, usually in the source tree.
- ALT_DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/src-gen
- )
-
- set(AUDIOMAN_SRCS_CXX
- ${AUDIOMAN_SRCS_CXX}
- ${COMMON_API_GEN_SOURCES})
- endif(WITH_NSM)
-
- if(${COMMONAPI_USED_BINDING} EQUAL 0)
- INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES}
- ${COMMONAPI_DBUS_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDE_DIRS}
- ${COMMON_API_GEN_INCLUDE_DIR}
- ${DBUS_INCLUDE_DIRS})
- else()
- INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES}
- ${VSOMEIP_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDE_DIRS}
- ${COMMONAPI_SOMEIP_INCLUDE_DIRS}
- ${COMMON_API_GEN_INCLUDE_DIR})
- endif()
+
+INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES}
+ ${COMMONAPI_INCLUDE_DIRS})
endif(WITH_CAPI_WRAPPER)
if(WITH_DLT)
diff --git a/AudioManagerDaemon/docx/02_license.dox b/AudioManagerDaemon/docx/02_license.dox
index c54190e..d7fc220 100644
--- a/AudioManagerDaemon/docx/02_license.dox
+++ b/AudioManagerDaemon/docx/02_license.dox
@@ -21,7 +21,6 @@
The AudioManger comes with some open source software distributed in the source tree:
- Google Mock (in \googleMock), licensed under MIT license
- Tclap ( in \tclap-1.2.1), licensed under MIT license
-- The headers of the NSM, licensed under MPL 2.0
\section split License Split
The licenses of this project are split into two parts:\n
1. the AudioManagerDaemon, licensed under MPL 2.0\n
diff --git a/AudioManagerDaemon/docx/14_z_nodeStateManagement.dox b/AudioManagerDaemon/docx/14_z_nodeStateManagement.dox
deleted file mode 100644
index e149310..0000000
--- a/AudioManagerDaemon/docx/14_z_nodeStateManagement.dox
+++ /dev/null
@@ -1,39 +0,0 @@
- /*
- * Copyright (C) 2012, 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)
- *
- */
-
-/*!
-\page nsm The Node state management
-\section The Node state managemer
-The nodestatemanager is part of the GENIVI compliance. It basically handles startup and rundown of components in the IVI context.\n
-For more information, please go to http://projects.genivi.org
-
-The Nodestatemanagement will either work with CommonAPI or DBus native.
-
-\section nsmiact The Interaction between the NodeStateManager and the AudioManager
-It is the job of am::CAmNodeStateCommunicator to interact with the nodestatemanager via DBUS.\n
-The ControllerPlugin can register by the NSM to be informed when a shutdown will occour. For this, the Audiomanager presents an DBus interface, defined in LifeCycleConsumer.xml that will be called from the NSM during a shutdown,
-but only after the Controller registered by the NSM via am::CAmNodeStateCommunicator::nsmRegisterShutdownClient.\n
-The controller has to answer this request during the timeout with am::CAmNodeStateCommunicator::nsmSendLifecycleRequestComplete .
-For more information, check am::CAmNodeStateCommunicator and http://projects.genivi.org\n
-\section nsm_overview Overview of the relations between AudioManager and NSM:
-\image html NodeStateManagementRelations.png
-\section nsm_reg Registering at startup
-\image html Registrations.png
-\section nsm_lifec Handling of Lifecyclerequests:
-\image html Lifecylerequest.png
-
- */
diff --git a/AudioManagerDaemon/fidls/NodeStateManager.fdepl b/AudioManagerDaemon/fidls/NodeStateManager.fdepl
deleted file mode 100644
index e772022..0000000
--- a/AudioManagerDaemon/fidls/NodeStateManager.fdepl
+++ /dev/null
@@ -1,6 +0,0 @@
-import "platform:/plugin/org.genivi.commonapi.dbus/deployment/CommonAPI-DBus_deployment_spec.fdepl"
-import "NodeStateManager.fidl"
-
-define org.genivi.commonapi.dbus.deployment for interface org.genivi.NodeStateManager.Consumer {
- DBusDefaultAttributeType=freedesktop
-}
diff --git a/AudioManagerDaemon/fidls/NodeStateManager.fidl b/AudioManagerDaemon/fidls/NodeStateManager.fidl
deleted file mode 100644
index 84d8d26..0000000
--- a/AudioManagerDaemon/fidls/NodeStateManager.fidl
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.genivi.NodeStateManager
-
-<**
- @author : Christian Linke
-**>
-
-interface Consumer {
- version {
- major 1
- minor 0
- }
-
- attribute Int32 BootMode readonly noSubscriptions
-
- attribute Int32 RestartReason readonly noSubscriptions
-
- attribute Int32 ShutdownReason readonly noSubscriptions
-
- attribute Int32 WakeUpReason readonly noSubscriptions
-
- method GetAppHealthCount {
- out {
- UInt32 Count
- }
- }
- method LifecycleRequestComplete {
- in {
- UInt32 RequestId
- Int32 Status
- }
- out {
- Int32 ErrorCode
- }
- }
- method GetInterfaceVersion {
- out {
- UInt32 Version
- }
- }
- method GetApplicationMode {
- out {
- Int32 ErrorCode
- Int32 ApplicationModeId
- }
- }
- method UnRegisterSession {
- in {
- String SessionName
- String SessionOwner
- Int32 SeatID
- }
- out {
- Int32 ErrorCode
- }
- }
- method RegisterSession {
- in {
- String SessionName
- String SessionOwner
- Int32 SeatID
- Int32 SessionState
- }
- out {
- Int32 ErrorCode
- }
- }
- method UnRegisterShutdownClient {
- in {
- String BusName
- String ObjName
- UInt32 ShutdownMode
- }
- out {
- Int32 ErrorCode
- }
- }
- method RegisterShutdownClient {
- in {
- String BusName
- String ObjName
- UInt32 ShutdownMode
- UInt32 TimeoutMs
- }
- out {
- Int32 ErrorCode
- }
- }
- method GetNodeState {
- out {
- Int32 ErrorCode
- Int32 NodeStateId
- }
- }
- method GetSessionState {
- in {
- String SessionName
- Int32 SeatID
- }
- out {
- Int32 SessionState
- Int32 ErrorCode
- }
- }
- method SetSessionState {
- in {
- String SessionName
- String SessionOwner
- Int32 SessionState
- Int32 SeatID
- }
- out {
- Int32 ErrorCode
- }
- }
- broadcast NodeApplicationMode {
- out {
- Int32 ApplicationModeId
- }
- }
- broadcast SessionStateChanged {
- out {
- String SessionStateName
- Int32 SeatID
- Int32 SessionState
- }
- }
- broadcast NodeState {
- out {
- Int32 NodeState
- }
- }
-}
-
-<**
- @author : Christian Linke
-**>
-
-interface LifeCycleConsumer {
- version {
- major 1
- minor 0
- }
- method LifecycleRequest {
- in {
- UInt32 Request
- UInt32 RequestId
- }
- out {
- Int32 ErrorCode
- }
- }
-} \ No newline at end of file
diff --git a/AudioManagerDaemon/include/CAmControlReceiver.h b/AudioManagerDaemon/include/CAmControlReceiver.h
index 029845c..88ba507 100644
--- a/AudioManagerDaemon/include/CAmControlReceiver.h
+++ b/AudioManagerDaemon/include/CAmControlReceiver.h
@@ -133,16 +133,6 @@ public:
void sendMainSourceNotificationPayload(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload) ;
am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
- am_Error_e getRestartReasonPropertyNSM(NsmRestartReason_e& restartReason) ;
- am_Error_e getShutdownReasonPropertyNSM(NsmShutdownReason_e& ShutdownReason) ;
- am_Error_e getRunningReasonPropertyNSM(NsmRunningReason_e& nsmRunningReason) ;
- NsmErrorStatus_e getNodeStateNSM(NsmNodeState_e& nsmNodeState) ;
- NsmErrorStatus_e getSessionStateNSM(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState) ;
- NsmErrorStatus_e getApplicationModeNSM(NsmApplicationMode_e& applicationMode) ;
- NsmErrorStatus_e registerShutdownClientNSM(const uint32_t shutdownMode, const uint32_t timeoutMs) ;
- NsmErrorStatus_e unRegisterShutdownClientNSM(const uint32_t shutdownMode) ;
- am_Error_e getInterfaceVersionNSM(uint32_t& version) ;
- NsmErrorStatus_e sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status) ;
am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundproperties) const;
am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSoundproperties) const;
am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s>& listSoundproperties) const;
diff --git a/AudioManagerDaemon/include/CAmControlSender.h b/AudioManagerDaemon/include/CAmControlSender.h
index e709155..40ab379 100644
--- a/AudioManagerDaemon/include/CAmControlSender.h
+++ b/AudioManagerDaemon/include/CAmControlSender.h
@@ -104,10 +104,6 @@ public:
void hookSourceNotificationDataChanged(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) ;
am_Error_e hookUserSetMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) ;
am_Error_e hookUserSetMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) ;
- void hookSystemNodeStateChanged(const NsmNodeState_e NodeStateId) ;
- void hookSystemNodeApplicationModeChanged(const NsmApplicationMode_e ApplicationModeId) ;
- void hookSystemSessionStateChanged(const std::string& sessionName, const NsmSeat_e seatID, const NsmSessionState_e sessionStateID) ;
- NsmErrorStatus_e hookSystemLifecycleRequest(const uint32_t Request, const uint32_t RequestId) ;
void hookSystemSingleTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t time);
void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
@@ -125,8 +121,6 @@ public:
TAmShPollCheck<CAmControlSender> checkerCallbackT;
TAmShPollDispatch<CAmControlSender> dispatcherCallbackT;
- //todo: add getSessionstate, interface nachbilden von org.genivi.NodeStateManager.LifeCycleConsumer, antwort nach NSM
- //chek interface version RegisterShutdownClient, UnRegisterShutdownClient, GetSessionState, GetApplicationMode, GetNodeState
//we need this here to call the rundown from the signal handler. In case everything screwed up
static void CallsetControllerRundown(int16_t signal)
diff --git a/AudioManagerDaemon/include/CAmNodeStateCommunicator.h b/AudioManagerDaemon/include/CAmNodeStateCommunicator.h
deleted file mode 100644
index e0805ad..0000000
--- a/AudioManagerDaemon/include/CAmNodeStateCommunicator.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 2012
- * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
- *
- * \file CAmNodeStateCommunicator.h
- * For further information see http://www.genivi.org/.
- *
- */
-
-#ifndef CAMNODESTATECOMMUNICATORBASE_H_
-#define CAMNODESTATECOMMUNICATORBASE_H_
-
-#include <assert.h>
-#include "audiomanagerconfig.h"
-#include "NodeStateManager.h"
-#include "audiomanagertypes.h"
-
-
-
-namespace am
-{
-
-class CAmControlSender;
-
-/** communicates with the NSM
- * The CAmNodeStateCommunicator communicates with the NodeStateManager.
- * The CAmNodeStateCommunicator is triggered via CAmControlReceiver, so you can communicate from the ControllerPlugin with it.
- * Most of the interfaces are passive, so you get the information you need via retrieving it. If you need to register the AudioManager
- * as LifeCycleConsumer, you need to call CAmNodeStateCommunicator::nsmRegisterShutdownClient which can be undone with CAmNodeStateCommunicator::nsmUnRegisterShutdownClient.
- * After you have registered, you will get hookSystemLifecycleRequest on the ControlSendInterface of the controller.
- * You should answer this within your set timeout with CAmNodeStateCommunicator::nsmSendLifecycleRequestComplete.
- */
-
-class CAmNodeStateCommunicator
-{
-protected:
- CAmControlSender* mpControlSender;
-public:
- CAmNodeStateCommunicator():mpControlSender(NULL) {}
- virtual ~CAmNodeStateCommunicator() {}
- virtual am_Error_e nsmGetRestartReasonProperty(NsmRestartReason_e& restartReason) = 0;
- virtual am_Error_e nsmGetShutdownReasonProperty(NsmShutdownReason_e& ShutdownReason) = 0;
- virtual am_Error_e nsmGetRunningReasonProperty(NsmRunningReason_e& nsmRunningReason) = 0;
- virtual NsmErrorStatus_e nsmGetNodeState(NsmNodeState_e& nsmNodeState) = 0;
- virtual NsmErrorStatus_e nsmGetSessionState(const std::string& sessionName, const NsmSeat_e& seatID, NsmSessionState_e& sessionState) = 0;
- virtual NsmErrorStatus_e nsmGetApplicationMode(NsmApplicationMode_e& applicationMode) = 0;
- virtual NsmErrorStatus_e nsmRegisterShutdownClient(const uint32_t shutdownMode, const uint32_t timeoutMs) = 0;
- virtual NsmErrorStatus_e nsmUnRegisterShutdownClient(const uint32_t shutdownMode) = 0;
- virtual am_Error_e nsmGetInterfaceVersion(uint32_t& version) = 0;
- virtual NsmErrorStatus_e nsmSendLifecycleRequestComplete(const uint32_t RequestId, const NsmErrorStatus_e status) = 0;
- virtual void registerControlSender(CAmControlSender* iControlSender) {
- assert(NULL!=iControlSender);
- mpControlSender = iControlSender;
- }
-};
-
-}
-
-#endif /* CAMNODESTATECOMMUNICATORBASE_H_ */
diff --git a/AudioManagerDaemon/include/CAmNodeStateCommunicatorCAPI.h b/AudioManagerDaemon/include/CAmNodeStateCommunicatorCAPI.h
deleted file mode 100644
index ab89526..0000000
--- a/AudioManagerDaemon/include/CAmNodeStateCommunicatorCAPI.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
- *
- * \file CAmNodeStateCommunicatorCAPI.h
- * For further information see http://www.genivi.org/.
- *
- */
-#ifndef CAMNODESTATECOMMUNICATORCAPI_H_
-#define CAMNODESTATECOMMUNICATORCAPI_H_
-
-#include "CAmNodeStateCommunicator.h"
-#include "CAmCommonAPIWrapper.h"
-#include <v1_0/org/genivi/NodeStateManager/ConsumerProxy.hpp>
-#include <v1_0/org/genivi/NodeStateManager/LifeCycleConsumerStubDefault.hpp>
-
-
-namespace am
-{
-
-#define am_nodestatemanager v1_0::org::genivi::NodeStateManager
-
-
-class CAmCommonAPIWrapper;
-/** communicates with the NSM
- * The CAmNodeStateCommunicator communicates with the NodeStateManager via Common-API wrapping mechanism. It works only, if CAmCommonAPIWrapper is enabled.
- */
-class CAmNodeStateCommunicatorCAPI : public CAmNodeStateCommunicator
-{
- static const char * DEFAULT_DOMAIN_STRING;
- static const char * CLIENT_INSTANCE_STRING;
- static const char * CLIENT_INTERFACE_STRING;
- static const char * LIFECYCLE_SERVICE_INSTANCE_STRING;
- static const char * LIFECYCLE_SERVICE_INTERFACE_STRING;
- static const char * OBJECT_NAME;
- static const char * BUS_NAME;
-
- /* A concrete implementation of the life cycle stub.
- * An object from this class is instantiated from the common-api factory.
- * It forwards the invocations to its delegate CAmNodeStateCommunicatorCAPI.
- */
- class CAmNodeStateCommunicatorServiceImpl : public am_nodestatemanager::LifeCycleConsumerStubDefault
- {
- CAmNodeStateCommunicatorCAPI *mpDelegate;
- public:
- CAmNodeStateCommunicatorServiceImpl ():mpDelegate(NULL) {}
- CAmNodeStateCommunicatorServiceImpl (CAmNodeStateCommunicatorCAPI *aNSCommunicator):mpDelegate(aNSCommunicator) {}
- ~CAmNodeStateCommunicatorServiceImpl() { mpDelegate = NULL; }
-
- CAmNodeStateCommunicatorCAPI *getDelegate() { return mpDelegate; };
- void setDelegate(CAmNodeStateCommunicatorCAPI *aDelegate) { mpDelegate = aDelegate; };
-
- void LifecycleRequest(uint32_t Request, uint32_t RequestId, int32_t& ErrorCode) {
- if(mpDelegate)
- mpDelegate->cbReceivedLifecycleRequest(Request, RequestId, ErrorCode);
- }
-
- void LifecycleRequest(const std::shared_ptr<CommonAPI::ClientId> client, uint32_t Request, uint32_t RequestId, LifecycleRequestReply_t reply){
- int32_t ErrorCode;
- LifecycleRequest(Request, RequestId, ErrorCode);
- reply(ErrorCode);
- }
- };
-
- CAmCommonAPIWrapper *mpCAPIWrapper;
- std::shared_ptr<am_nodestatemanager::ConsumerProxy<> > mNSMProxy;
- std::shared_ptr<CAmNodeStateCommunicatorCAPI::CAmNodeStateCommunicatorServiceImpl> mNSMStub;
-
- /* Client events */
- void onNodeStateEvent(const int32_t nodeState);
- void onNodeApplicationModeEvent(const int32_t nodeApplicationMode);
- void onSessionStateChangedEvent(const std::string & sessionName, const int32_t seatID, const int32_t sessionState);
- void onServiceStatusEvent(const CommonAPI::AvailabilityStatus& serviceStatus);
- /* Service callbacks */
- void cbReceivedLifecycleRequest(uint32_t Request, uint32_t RequestId, int32_t& ErrorCode);
-
-protected:
- bool mIsServiceAvailable;
-
-public:
- CAmNodeStateCommunicatorCAPI(CAmCommonAPIWrapper* iCAPIWrapper);
- virtual ~CAmNodeStateCommunicatorCAPI();
-
- am_Error_e nsmGetRestartReasonProperty(NsmRestartReason_e& restartReason) ;
- am_Error_e nsmGetShutdownReasonProperty(NsmShutdownReason_e& ShutdownReason) ;
- am_Error_e nsmGetRunningReasonProperty(NsmRunningReason_e& nsmRunningReason) ;
- NsmErrorStatus_e nsmGetNodeState(NsmNodeState_e& nsmNodeState) ;
- NsmErrorStatus_e nsmGetSessionState(const std::string& sessionName, const NsmSeat_e& seatID, NsmSessionState_e& sessionState) ;
- NsmErrorStatus_e nsmGetApplicationMode(NsmApplicationMode_e& applicationMode) ;
- NsmErrorStatus_e nsmRegisterShutdownClient(const uint32_t shutdownMode, const uint32_t timeoutMs) ;
- NsmErrorStatus_e nsmUnRegisterShutdownClient(const uint32_t shutdownMode) ;
- am_Error_e nsmGetInterfaceVersion(uint32_t& version) ;
- NsmErrorStatus_e nsmSendLifecycleRequestComplete(const uint32_t RequestId, const NsmErrorStatus_e status) ;
- bool isServiceAvailable();
-};
-
-}
-/* namespace am */
-#endif /* CAMNODESTATECOMMUNICATORCAPI_H_ */
diff --git a/AudioManagerDaemon/include/CAmNodeStateCommunicatorDBus.h b/AudioManagerDaemon/include/CAmNodeStateCommunicatorDBus.h
deleted file mode 100644
index 62eafbf..0000000
--- a/AudioManagerDaemon/include/CAmNodeStateCommunicatorDBus.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 2012
- *
- * \file CAmNodeStateCommunicatorDBus.h
- * For further information see http://www.genivi.org/.
- *
- */
-#ifndef CAMNODESTATECOMMUNICATORDBUS_H_
-#define CAMNODESTATECOMMUNICATORDBUS_H_
-
-#include "CAmDbusWrapper.h"
-#include "CAmNodeStateCommunicator.h"
-
-namespace am
-{
-/** communicates with the NSM
- * The CAmNodeStateCommunicator communicates with the NodeStateManager via Dbus. Only works, if CAmDbusWrapper is enabled.
- */
-
-class CAmNodeStateCommunicatorDBus : public CAmNodeStateCommunicator
-{
-public:
- CAmNodeStateCommunicatorDBus(CAmDbusWrapper* iDbusWrapper);
- virtual ~CAmNodeStateCommunicatorDBus();
- am_Error_e nsmGetRestartReasonProperty(NsmRestartReason_e& restartReason) ;
- am_Error_e nsmGetShutdownReasonProperty(NsmShutdownReason_e& ShutdownReason) ;
- am_Error_e nsmGetRunningReasonProperty(NsmRunningReason_e& nsmRunningReason) ;
- NsmErrorStatus_e nsmGetNodeState(NsmNodeState_e& nsmNodeState) ;
- NsmErrorStatus_e nsmGetSessionState(const std::string& sessionName, const NsmSeat_e& seatID, NsmSessionState_e& sessionState) ;
- NsmErrorStatus_e nsmGetApplicationMode(NsmApplicationMode_e& applicationMode) ;
- NsmErrorStatus_e nsmRegisterShutdownClient(const uint32_t shutdownMode, const uint32_t timeoutMs) ;
- NsmErrorStatus_e nsmUnRegisterShutdownClient(const uint32_t shutdownMode) ;
- am_Error_e nsmGetInterfaceVersion(uint32_t& version) ;
- NsmErrorStatus_e nsmSendLifecycleRequestComplete(const uint32_t RequestId, const NsmErrorStatus_e status) ;
-
- static DBusHandlerResult receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
- static DBusHandlerResult signalCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
-
-
-private:
- void sendIntrospection(DBusConnection* conn, DBusMessage* msg);
- void sendMessage(DBusMessage* message, DBusMessage* origMessage);
- DBusHandlerResult receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg);
- am_Error_e readIntegerProperty(const std::string property, int32_t &value);
- CAmDbusWrapper* mpDbusWrapper;
- DBusConnection* mpDBusConnection;
-};
-
-} /* namespace am */
-#endif /* CAMNODESTATECOMMUNICATORDBUS_H_ */
diff --git a/AudioManagerDaemon/src/CAmControlReceiver.cpp b/AudioManagerDaemon/src/CAmControlReceiver.cpp
index 2915f5e..198109d 100644
--- a/AudioManagerDaemon/src/CAmControlReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmControlReceiver.cpp
@@ -32,30 +32,9 @@
#include "CAmRouter.h"
#include "CAmDltWrapper.h"
#include "CAmSocketHandler.h"
-#ifdef WITH_NSM
- #include "CAmNodeStateCommunicator.h"
-#endif
-
-
namespace am {
-CAmControlReceiver::CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter, CAmNodeStateCommunicator* iNodeStateCommunicator) :
- mDatabaseHandler(iDatabaseHandler), //
- mRoutingSender(iRoutingSender), //
- mCommandSender(iCommandSender), //
- mSocketHandler(iSocketHandler), //
- mRouter(iRouter), //
- mNodeStateCommunicator(iNodeStateCommunicator)
-{
- assert(mDatabaseHandler!=NULL);
- assert(mRoutingSender!=NULL);
- assert(mCommandSender!=NULL);
- assert(mSocketHandler!=NULL);
- assert(mRouter!=NULL);
- assert(iNodeStateCommunicator!=NULL);
-}
-
CAmControlReceiver::CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
@@ -456,7 +435,6 @@ void CAmControlReceiver::setRoutingReady()
void CAmControlReceiver::confirmControllerReady(const am_Error_e error)
{
- //todo: one time implement here system interaction with NSM
if (error!=E_OK)
logError("CAmControlReceiver::confirmControllerReady controller reported error", error);
}
@@ -565,138 +543,6 @@ am_Error_e CAmControlReceiver::changeMainSourceNotificationConfigurationDB(const
return (mDatabaseHandler->changeMainSourceNotificationConfigurationDB(sourceID,mainNotificationConfiguration));
}
-am_Error_e CAmControlReceiver::getRestartReasonPropertyNSM(NsmRestartReason_e& restartReason)
-{
- if (!mNodeStateCommunicator)
- return (E_NON_EXISTENT);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmGetRestartReasonProperty(restartReason));
-#else
- (void)restartReason;
- return (E_NON_EXISTENT);
-#endif
-}
-
-am_Error_e CAmControlReceiver::getShutdownReasonPropertyNSM(NsmShutdownReason_e& ShutdownReason)
-{
- if (!mNodeStateCommunicator)
- return (E_NON_EXISTENT);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmGetShutdownReasonProperty(ShutdownReason));
-#else
- (void)ShutdownReason;
- return (E_NON_EXISTENT);
-#endif
-
-}
-
-am_Error_e CAmControlReceiver::getRunningReasonPropertyNSM(NsmRunningReason_e& nsmRunningReason)
-{
- if (!mNodeStateCommunicator)
- return (E_NON_EXISTENT);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmGetRunningReasonProperty(nsmRunningReason));
-#else
- (void)nsmRunningReason;
- return (E_NON_EXISTENT);
-#endif
-
-}
-
-NsmErrorStatus_e CAmControlReceiver::getNodeStateNSM(NsmNodeState_e& nsmNodeState)
-{
- if (!mNodeStateCommunicator)
- return (NsmErrorStatus_Error);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmGetNodeState(nsmNodeState));
-#else
- (void) nsmNodeState;
- return (NsmErrorStatus_Error);
-#endif
-}
-
-NsmErrorStatus_e CAmControlReceiver::getSessionStateNSM(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState)
-{
- if (!mNodeStateCommunicator)
- return (NsmErrorStatus_Error);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmGetSessionState(sessionName,seatID,sessionState));
-#else
- (void) sessionName;
- (void) seatID;
- (void) sessionState;
- return (NsmErrorStatus_Error);
-#endif
-
-}
-
-NsmErrorStatus_e CAmControlReceiver::getApplicationModeNSM(NsmApplicationMode_e& applicationMode)
-{
- if (!mNodeStateCommunicator)
- return (NsmErrorStatus_Error);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmGetApplicationMode(applicationMode));
-#else
- (void) applicationMode;
- return (NsmErrorStatus_Error);
-#endif
-
-}
-
-NsmErrorStatus_e CAmControlReceiver::registerShutdownClientNSM(const uint32_t shutdownMode, const uint32_t timeoutMs)
-{
- if (!mNodeStateCommunicator)
- return (NsmErrorStatus_Error);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmRegisterShutdownClient(shutdownMode,timeoutMs));
-#else
- (void) shutdownMode;
- (void) timeoutMs;
- return (NsmErrorStatus_Error);
-#endif
-
-}
-
-NsmErrorStatus_e CAmControlReceiver::unRegisterShutdownClientNSM(const uint32_t shutdownMode)
-{
- if (!mNodeStateCommunicator)
- return (NsmErrorStatus_Error);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmUnRegisterShutdownClient(shutdownMode));
-#else
- (void) shutdownMode;
- return (NsmErrorStatus_Error);
-#endif
-
-}
-
-am_Error_e CAmControlReceiver::getInterfaceVersionNSM(uint32_t& version)
-{
- if (!mNodeStateCommunicator)
- return (E_NON_EXISTENT);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmGetInterfaceVersion(version));
-#else
- (void) version;
- return (E_NON_EXISTENT);
-#endif
-
-}
-
-NsmErrorStatus_e CAmControlReceiver::sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status)
-{
- if (!mNodeStateCommunicator)
- return (NsmErrorStatus_Error);
-#ifdef WITH_NSM
- return (mNodeStateCommunicator->nsmSendLifecycleRequestComplete(RequestId,status));
-#else
- (void) RequestId;
- (void) status;
- return (NsmErrorStatus_Error);
-#endif
-
-}
-
am_Error_e CAmControlReceiver::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundproperties) const
{
logInfo("CAmControlReceiver::getListMainSinkSoundProperties was called, sinkID", sinkID);
diff --git a/AudioManagerDaemon/src/CAmControlSender.cpp b/AudioManagerDaemon/src/CAmControlSender.cpp
index c85bd57..672c2d5 100644
--- a/AudioManagerDaemon/src/CAmControlSender.cpp
+++ b/AudioManagerDaemon/src/CAmControlSender.cpp
@@ -398,18 +398,6 @@ void CAmControlSender::confirmRoutingRundown(const am_Error_e error)
mController->confirmRoutingRundown(error);
}
-void CAmControlSender::hookSystemNodeStateChanged(const NsmNodeState_e NodeStateId)
-{
- assert(mController);
- mController->hookSystemNodeStateChanged(NodeStateId);
-}
-
-void CAmControlSender::hookSystemNodeApplicationModeChanged(const NsmApplicationMode_e ApplicationModeId)
-{
- assert(mController);
- mController->hookSystemNodeApplicationModeChanged(ApplicationModeId);
-}
-
am_Error_e CAmControlSender::hookSystemUpdateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
{
assert(mController);
@@ -491,18 +479,6 @@ bool CAmControlSender::checkerCallback(const sh_pollHandle_t handle, void* userD
return (true);
}
-void CAmControlSender::hookSystemSessionStateChanged(const std::string& sessionName, const NsmSeat_e seatID, const NsmSessionState_e sessionStateID)
-{
- assert(mController);
- mController->hookSystemSessionStateChanged(sessionName,seatID,sessionStateID);
-}
-
-NsmErrorStatus_e CAmControlSender::hookSystemLifecycleRequest(const uint32_t Request, const uint32_t RequestId)
-{
- assert(mController);
- return (mController->hookSystemLifecycleRequest(Request,RequestId));
-}
-
void CAmControlSender::hookSystemSingleTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t time)
{
assert(mController);
diff --git a/AudioManagerDaemon/src/CAmNodeStateCommunicatorCAPI.cpp b/AudioManagerDaemon/src/CAmNodeStateCommunicatorCAPI.cpp
deleted file mode 100644
index 07c8b1f..0000000
--- a/AudioManagerDaemon/src/CAmNodeStateCommunicatorCAPI.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
- *
- * \file CAmNodeStateCommunicatorCAPI.cpp
- * For further information see http://www.genivi.org/.
- *
- */
-
-#include <assert.h>
-#include <string>
-#include <fstream>
-#include <sstream>
-#include <stdexcept>
-#include <functional>
-#include <memory>
-#include "audiomanagerconfig.h"
-#include "CAmDltWrapper.h"
-#include "CAmNodeStateCommunicatorCAPI.h"
-#include "CAmControlSender.h"
-#include <v1_0/org/genivi/NodeStateManager/LifeCycleConsumerProxy.hpp>
-
-
-namespace am
-{
-
-#define LIFECYCLE_SERVICE_INTERFACE NSM_BUS_INTERFACE ".LifeCycleConsumer"
-
-const char * CAmNodeStateCommunicatorCAPI::DEFAULT_DOMAIN_STRING = "local";
-
-const char * CAmNodeStateCommunicatorCAPI::CLIENT_INSTANCE_STRING = NSM_BUS_INTERFACE;
-const char * CAmNodeStateCommunicatorCAPI::CLIENT_INTERFACE_STRING = NSM_INTERFACE;
-
-const char * CAmNodeStateCommunicatorCAPI::LIFECYCLE_SERVICE_INSTANCE_STRING = DBUS_SERVICE_PREFIX;
-const char * CAmNodeStateCommunicatorCAPI::LIFECYCLE_SERVICE_INTERFACE_STRING = LIFECYCLE_SERVICE_INTERFACE;
-
-const char * CAmNodeStateCommunicatorCAPI::OBJECT_NAME = DBUS_SERVICE_OBJECT_PATH;
-const char * CAmNodeStateCommunicatorCAPI::BUS_NAME = LIFECYCLE_SERVICE_INTERFACE "_" DBUS_SERVICE_PREFIX;
-
-
-#define IF_NOT_AVAILABLE_RETURN(error) \
-if(!mIsServiceAvailable) { logError(__PRETTY_FUNCTION__, "Node State Manager not available yet"); return error; }
-
-/**
- * Retrieves the value from given attribute wrapper.
- */
-template <typename TValueReturnType, class TValueClass> am_Error_e getAttributeValue(CommonAPI::Attribute<TValueClass>* attribute, TValueReturnType & resultValue)
-{
- CommonAPI::CallStatus status;
- typename CommonAPI::Attribute<TValueClass>::ValueType value;
- attribute->getValue(status, value);
- std::cout << std::endl << "CallStatus : " << static_cast<int>(status) << std::endl;
- if( CommonAPI::CallStatus::SUCCESS == status)
- {
- resultValue = static_cast<TValueReturnType>(value);
- return E_OK;
- }
- return E_UNKNOWN;
-}
-
-
-CAmNodeStateCommunicatorCAPI::CAmNodeStateCommunicatorCAPI(CAmCommonAPIWrapper* iCAPIWrapper) :
- CAmNodeStateCommunicator(),
- mpCAPIWrapper(iCAPIWrapper),
- mIsServiceAvailable(false)
-{
- assert(mpCAPIWrapper);
- logInfo("CAmNodeStateCommunicatorCAPI::CAmNodeStateCommunicatorCAPI started");
-
- //Gets the factory pointer and build a proxy object
- mNSMProxy = iCAPIWrapper->buildProxy<am_nodestatemanager::ConsumerProxy>( CAmNodeStateCommunicatorCAPI::DEFAULT_DOMAIN_STRING,
- CAmNodeStateCommunicatorCAPI::CLIENT_INSTANCE_STRING);
- //Makes subscriptions to the following 3 events
- mNSMProxy->getNodeStateEvent().subscribe(
- std::bind(&CAmNodeStateCommunicatorCAPI::onNodeStateEvent, this, std::placeholders::_1)
- );
- mNSMProxy->getNodeApplicationModeEvent().subscribe(
- std::bind(&CAmNodeStateCommunicatorCAPI::onNodeApplicationModeEvent, this, std::placeholders::_1)
- );
- mNSMProxy->getSessionStateChangedEvent().subscribe(
- std::bind(&CAmNodeStateCommunicatorCAPI::onSessionStateChangedEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)
- );
- mNSMProxy->getProxyStatusEvent().subscribe(std::bind(&CAmNodeStateCommunicatorCAPI::onServiceStatusEvent,this,std::placeholders::_1));
- //Instantiates the concrete stub implementation
- mNSMStub = std::make_shared<CAmNodeStateCommunicatorCAPI::CAmNodeStateCommunicatorServiceImpl>(this);
-
- //Registers the service
- if(!iCAPIWrapper->registerService(mNSMStub,CAmNodeStateCommunicatorCAPI::DEFAULT_DOMAIN_STRING,CAmNodeStateCommunicatorCAPI::LIFECYCLE_SERVICE_INSTANCE_STRING))
- logError("AudioManager can't register service");
-}
-
-CAmNodeStateCommunicatorCAPI::~CAmNodeStateCommunicatorCAPI()
-{
- mNSMProxy.reset();
- mpCAPIWrapper->unregisterService(CAmNodeStateCommunicatorCAPI::DEFAULT_DOMAIN_STRING,
- CAmNodeStateCommunicatorCAPI::LIFECYCLE_SERVICE_INTERFACE_STRING,
- CAmNodeStateCommunicatorCAPI::LIFECYCLE_SERVICE_INSTANCE_STRING);
- mNSMStub->setDelegate(NULL);
- mNSMStub.reset();
- mpCAPIWrapper = NULL;
-}
-
-bool CAmNodeStateCommunicatorCAPI::isServiceAvailable()
-{
- return mIsServiceAvailable;
-}
-
-/** retrieves the actual restart reason
- *
- * @param restartReason
- * @return E_OK on success
- */
-am_Error_e CAmNodeStateCommunicatorCAPI::nsmGetRestartReasonProperty(NsmRestartReason_e& restartReason)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(E_NOT_POSSIBLE)
- //Get the attribute
- int32_t value;
- CommonAPI::CallStatus status;
- mNSMProxy->getRestartReasonAttribute().getValue(status,value);
- if (status!=CommonAPI::CallStatus::SUCCESS)
- return (E_UNKNOWN);
- restartReason=static_cast<NsmRestartReason_e>(value);
- return (E_OK);
-}
-
-/** retrieves the actual shutdown reason
- *
- * @param ShutdownReason
- * @return E_OK on success
- */
-am_Error_e CAmNodeStateCommunicatorCAPI::nsmGetShutdownReasonProperty(NsmShutdownReason_e& ShutdownReason)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(E_NOT_POSSIBLE)
- //Get the attribute
- int32_t value;
- CommonAPI::CallStatus status;
- mNSMProxy->getShutdownReasonAttribute().getValue(status,value);
- if (status!=CommonAPI::CallStatus::SUCCESS)
- return (E_UNKNOWN);
- ShutdownReason=static_cast<NsmShutdownReason_e>(value);
- return (E_OK);
-}
-
-/** retrieves the actual running reason
- *
- * @param nsmRunningReason
- * @return E_OK on success
- */
-am_Error_e CAmNodeStateCommunicatorCAPI::nsmGetRunningReasonProperty(NsmRunningReason_e& nsmRunningReason)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(E_NOT_POSSIBLE)
- //Get the attribute
- int32_t value;
- CommonAPI::CallStatus status;
- mNSMProxy->getWakeUpReasonAttribute().getValue(status,value);
- if (status!=CommonAPI::CallStatus::SUCCESS)
- return (E_UNKNOWN);
- nsmRunningReason=static_cast<NsmRunningReason_e>(value);
- return (E_OK);
-}
-
-/** gets the node state
- *
- * @param nsmNodeState
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorCAPI::nsmGetNodeState(NsmNodeState_e& nsmNodeState)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(NsmErrorStatus_Error)
-
- CommonAPI::CallStatus callStatus;
- int32_t tmpNodeState = 0, errorCode = 0;
- mNSMProxy->GetNodeState(callStatus, tmpNodeState, errorCode);
- if( CommonAPI::CallStatus::SUCCESS == callStatus )
- {
- nsmNodeState = static_cast<NsmNodeState_e>(tmpNodeState);
- return (static_cast<NsmErrorStatus_e>(errorCode));
- }
- return NsmErrorStatus_Error;
-}
-
-/** gets the session state for a session and seatID
- *
- * @param sessionName the name of the session
- * @param seatID the seatID
- * @param sessionState
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorCAPI::nsmGetSessionState(const std::string& sessionName, const NsmSeat_e& seatID, NsmSessionState_e& sessionState)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(NsmErrorStatus_Error)
-
- CommonAPI::CallStatus callStatus;
- int32_t tmpSessionState = 0 , errorCode = 0;
- mNSMProxy->GetSessionState(sessionName,seatID,callStatus, tmpSessionState, errorCode);
-
- if( CommonAPI::CallStatus::SUCCESS == callStatus)
- {
- sessionState = static_cast<NsmSessionState_e>(tmpSessionState);
- return (static_cast<NsmErrorStatus_e>(errorCode));
- }
- return NsmErrorStatus_Error;
-}
-
-/** gets the application mode
- *
- * @param applicationMode
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorCAPI::nsmGetApplicationMode(NsmApplicationMode_e& applicationMode)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(NsmErrorStatus_Error)
-
- CommonAPI::CallStatus callStatus;
- int32_t tmpAppMode = 0 , errorCode = 0;
- mNSMProxy->GetApplicationMode(callStatus, tmpAppMode, errorCode);
- if( CommonAPI::CallStatus::SUCCESS == callStatus)
- {
- applicationMode = static_cast<NsmApplicationMode_e>(tmpAppMode);
- return (static_cast<NsmErrorStatus_e>(errorCode));
- }
- return NsmErrorStatus_Dbus;
-}
-
-/** this function registers the AudioManager as shutdown client at the NSM
- * for more information check the Nodestatemanager
- * @param shutdownMode the shutdownmode you wish to set
- * @param timeoutMs the timeout you need to have
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorCAPI::nsmRegisterShutdownClient(const uint32_t shutdownMode, const uint32_t timeoutMs)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(NsmErrorStatus_Error)
-
- CommonAPI::CallStatus callStatus;
- int32_t errorCode = 0;
- std::string objName = std::string(CAmNodeStateCommunicatorCAPI::OBJECT_NAME);
- std::string busName = std::string(CAmNodeStateCommunicatorCAPI::BUS_NAME);
- mNSMProxy->RegisterShutdownClient(busName, objName, shutdownMode, timeoutMs, callStatus, errorCode);
- if( CommonAPI::CallStatus::SUCCESS == callStatus)
- return (static_cast<NsmErrorStatus_e>(errorCode));
- return NsmErrorStatus_Dbus;
-
-}
-
-/** this function unregisters the AudioManager as shutdown client at the NSM
- *
- * @param shutdownMode
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorCAPI::nsmUnRegisterShutdownClient(const uint32_t shutdownMode)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(NsmErrorStatus_Error)
-
- CommonAPI::CallStatus callStatus;
- int32_t errorCode = 0;
- std::string objName = std::string(CAmNodeStateCommunicatorCAPI::OBJECT_NAME);
- std::string busName = std::string(CAmNodeStateCommunicatorCAPI::BUS_NAME);
- mNSMProxy->UnRegisterShutdownClient(busName, objName, shutdownMode, callStatus, errorCode);
- if( CommonAPI::CallStatus::SUCCESS == callStatus)
- return (static_cast<NsmErrorStatus_e>(errorCode));
- return NsmErrorStatus_Dbus;
-}
-
-/** returns the interface version
- *
- * @param version
- * @return E_OK on success
- */
-am_Error_e CAmNodeStateCommunicatorCAPI::nsmGetInterfaceVersion(uint32_t& version)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(E_NOT_POSSIBLE)
-
- CommonAPI::CallStatus callStatus;
- mNSMProxy->GetInterfaceVersion(callStatus, version);
- if( CommonAPI::CallStatus::SUCCESS == callStatus)
- return E_OK;
- return E_UNKNOWN;
-}
-
-/** sends out the Lifecycle request complete message
- *
- * @param RequestId
- * @param status
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorCAPI::nsmSendLifecycleRequestComplete(const uint32_t RequestId, const NsmErrorStatus_e status)
-{
- //Check the service via the proxy object is available
- IF_NOT_AVAILABLE_RETURN(NsmErrorStatus_Error)
-
- CommonAPI::CallStatus callStatus;
- int32_t errorCode = 0;
- mNSMProxy->LifecycleRequestComplete(RequestId, status, callStatus, errorCode);
- if( CommonAPI::CallStatus::SUCCESS == callStatus)
- {
- return (static_cast<NsmErrorStatus_e>(errorCode));
- }
- return NsmErrorStatus_Dbus;
-}
-
-/** notification handler for changed node state
- *
- * @param nodeState
- * @return none
- */
-void CAmNodeStateCommunicatorCAPI::onNodeStateEvent(const int32_t nodeState)
-{
- logInfo(__PRETTY_FUNCTION__, " got signal NodeState, with nodeState",nodeState);
- assert(mpControlSender);
- mpControlSender->hookSystemNodeStateChanged(static_cast<NsmNodeState_e>(nodeState));
-}
-
-/** notification handler for changed node application mode
- *
- * @param nodeApplicationMode
- * @return none
- */
-void CAmNodeStateCommunicatorCAPI::onNodeApplicationModeEvent(const int32_t nodeApplicationMode)
-{
- logInfo(__PRETTY_FUNCTION__, " got signal nodeApplicationMode, with applicationMode",nodeApplicationMode);
- assert(mpControlSender);
- mpControlSender->hookSystemNodeApplicationModeChanged(static_cast<NsmApplicationMode_e>(nodeApplicationMode));
-}
-
-/** notification handler for changed session state
- *
- * @param sessionName
- * @param seatID
- * @param sessionState
- * @return none
- */
-void CAmNodeStateCommunicatorCAPI::onSessionStateChangedEvent(const std::string & sessionName, const int32_t seatID, const int32_t sessionState)
-{
- logInfo(__PRETTY_FUNCTION__, " got signal sessionStateChanged, with session",sessionName,"seatID=",seatID,"sessionState",sessionState);
- assert(mpControlSender);
- mpControlSender->hookSystemSessionStateChanged(sessionName, static_cast<NsmSeat_e>(seatID), static_cast<NsmSessionState_e>(sessionState));
-}
-
-void CAmNodeStateCommunicatorCAPI::onServiceStatusEvent(const CommonAPI::AvailabilityStatus& serviceStatus)
-{
- std::stringstream avail;
- avail << "(" << static_cast<int>(serviceStatus) << ")";
-
- logInfo("Service Status of the NSM changed to ", avail.str());
- std::cout << std::endl << "Service Status of the NSM changed to " << avail.str();
- mIsServiceAvailable = (serviceStatus==CommonAPI::AvailabilityStatus::AVAILABLE);
-}
-
-/** implements the service part, which is invoked from the node state manager
- *
- * @param sessionName
- * @param seatID
- * @param sessionState
- * @return none
- */
-void CAmNodeStateCommunicatorCAPI::cbReceivedLifecycleRequest(uint32_t Request, uint32_t RequestId, int32_t& ErrorCode)
-{
- assert(mpControlSender);
- ErrorCode = mpControlSender->hookSystemLifecycleRequest(Request, RequestId);
-}
-
-} /* namespace am */
diff --git a/AudioManagerDaemon/src/CAmNodeStateCommunicatorDBus.cpp b/AudioManagerDaemon/src/CAmNodeStateCommunicatorDBus.cpp
deleted file mode 100644
index 501dfd8..0000000
--- a/AudioManagerDaemon/src/CAmNodeStateCommunicatorDBus.cpp
+++ /dev/null
@@ -1,778 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 2012
- *
- * \file CAmNodeStateCommunicatorDBus.cpp
- * For further information see http://www.genivi.org/.
- *
- */
-
-#include "CAmNodeStateCommunicatorDBus.h"
-#include <assert.h>
-#include <string>
-#include <fstream>
-#include <sstream>
-#include <stdexcept>
-#include "CAmControlSender.h"
-#include "CAmDltWrapper.h"
-#include "audiomanagerconfig.h"
-
-namespace am
-{
-
-static DBusObjectPathVTable gObjectPathVTable;
-
-CAmNodeStateCommunicatorDBus::CAmNodeStateCommunicatorDBus(CAmDbusWrapper* iDbusWrapper) : CAmNodeStateCommunicator(),
- mpDbusWrapper(iDbusWrapper), //
- mpDBusConnection(NULL)
-{
- assert(mpDbusWrapper);
- logInfo("CAmNodeStateCommunicator::CAmNodeStateCommunicator started");
-
- //save the DBusConnection
- mpDbusWrapper->getDBusConnection(mpDBusConnection);
- assert(mpDBusConnection!=NULL);
-
- //register the path and the callback for receiving messages
- std::string path("LifeCycleConsumer");
- gObjectPathVTable.message_function=CAmNodeStateCommunicatorDBus::receiveCallback;
- mpDbusWrapper->registerCallback(&gObjectPathVTable, path, this);
-
- //now we need to make sure we catch the signals from the NSM:
- dbus_bus_add_match(mpDBusConnection, "type=\'signal\',path=\'/org/genivi/NodeStateManager\'", NULL);
- if (!dbus_connection_add_filter(mpDBusConnection, CAmNodeStateCommunicatorDBus::signalCallback, this, NULL))
- {
- logError("CAmNodeStateCommunicator::CAmNodeStateCommunicator not enought memory!");
- throw std::runtime_error("CAmNodeStateCommunicator::CAmNodeStateCommunicator not enought memory!");
- }
- dbus_connection_flush(mpDBusConnection);
-}
-
-CAmNodeStateCommunicatorDBus::~CAmNodeStateCommunicatorDBus()
-{}
-
-/** retrieves the actual restartReason
- *
- * @param restartReason
- * @return E_OK on success
- */
-am_Error_e CAmNodeStateCommunicatorDBus::nsmGetRestartReasonProperty(NsmRestartReason_e& restartReason)
-{
- int32_t answer(0);
- am_Error_e error=readIntegerProperty("RestartReason",answer);
- restartReason=static_cast<NsmRestartReason_e>(answer);
- return(error);
-}
-
-/** retrieves the actual shutdownreason
- *
- * @param ShutdownReason
- * @return E_OK on success
- */
-am_Error_e CAmNodeStateCommunicatorDBus::nsmGetShutdownReasonProperty(NsmShutdownReason_e& ShutdownReason)
-{
- int32_t answer(0);
- am_Error_e error=readIntegerProperty("ShutdownReason",answer);
- ShutdownReason=static_cast<NsmShutdownReason_e>(answer);
- return(error);
-}
-
-/** retrieves the actual runnuing reason
- *
- * @param nsmRunningReason
- * @return E_OK on success
- */
-am_Error_e CAmNodeStateCommunicatorDBus::nsmGetRunningReasonProperty(NsmRunningReason_e& nsmRunningReason)
-{
- int32_t answer(0);
- am_Error_e error=readIntegerProperty("WakeUpReason",answer);
- nsmRunningReason=static_cast<NsmRunningReason_e>(answer);
- return(error);
-}
-
-/** gets the node state
- *
- * @param nsmNodeState
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorDBus::nsmGetNodeState(NsmNodeState_e& nsmNodeState)
-{
- DBusError error;
- dbus_error_init(&error);
-
- uint32_t nodeStateID;
- uint32_t returnedError;
-
- DBusMessage * message = dbus_message_new_method_call(NSM_BUS_INTERFACE, NSM_PATH, NSM_INTERFACE, "GetNodeState");
-
- if (!message)
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetNodeState dbus error:", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- DBusMessage* reply(dbus_connection_send_with_reply_and_block(mpDBusConnection, message, -1, &error));
- if (!reply)
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetNodeState failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- if(!dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &nodeStateID, DBUS_TYPE_INT32, &returnedError, DBUS_TYPE_INVALID))
- return (NsmErrorStatus_Dbus);
-
- dbus_message_unref(reply);
-
- nsmNodeState=static_cast<NsmNodeState_e>(nodeStateID);
- return (static_cast<NsmErrorStatus_e>(returnedError));
-}
-
-/** gets the session state for a session and seatID
- *
- * @param sessionName the name of the session
- * @param seatID the seatID
- * @param sessionState
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorDBus::nsmGetSessionState(const std::string& sessionName, const NsmSeat_e& seatID, NsmSessionState_e& sessionState)
-{
- DBusError error;
- dbus_error_init(&error);
- DBusMessageIter iter;
-
- uint32_t returnedError;
- int32_t BsessionState(0);
-
- DBusMessage * message = dbus_message_new_method_call(NSM_BUS_INTERFACE, NSM_PATH, NSM_INTERFACE, "GetSessionState");
-
- if (!message)
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetSessionState dbus error:", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- dbus_message_iter_init_append(message, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &sessionName))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmGetSessionState no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &seatID))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmGetSessionState no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- DBusMessage* reply(dbus_connection_send_with_reply_and_block(mpDBusConnection, message, -1, &error));
- if (!reply)
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetSessionState failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- if(!dbus_message_get_args(reply, &error,
- DBUS_TYPE_INT32, &BsessionState,
- DBUS_TYPE_INT32, &returnedError,DBUS_TYPE_INVALID))
- return (NsmErrorStatus_Dbus);
-
- dbus_message_unref(reply);
-
- sessionState=static_cast<NsmSessionState_e>(BsessionState);
- return (static_cast<NsmErrorStatus_e>(returnedError));
-}
-
-/** gets the application mode
- *
- * @param applicationMode
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorDBus::nsmGetApplicationMode(NsmApplicationMode_e& applicationMode)
-{
- DBusError error;
- dbus_error_init(&error);
-
- uint32_t BapplicationMode(0),returnedError(0);
-
- DBusMessage * message = dbus_message_new_method_call(NSM_BUS_INTERFACE, NSM_PATH, NSM_INTERFACE, "GetApplicationMode");
-
- if (!message)
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetApplicationMode dbus error:", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- DBusMessage* reply(dbus_connection_send_with_reply_and_block(mpDBusConnection, message, -1, &error));
- if (!reply)
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetApplicationMode failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- if(!dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &BapplicationMode, DBUS_TYPE_INT32, &returnedError, DBUS_TYPE_INVALID))
- return (NsmErrorStatus_Dbus);
-
- dbus_message_unref(reply);
-
- applicationMode=static_cast<NsmApplicationMode_e>(BapplicationMode);
- return (static_cast<NsmErrorStatus_e>(returnedError));
-}
-
-/** this function registers the AudioManager as shutdown client at the NSM
- * for more information check the Nodestatemanager
- * @param shutdownMode the shutdownmode you wish to set
- * @param timeoutMs the timeout you need to have
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorDBus::nsmRegisterShutdownClient(const uint32_t shutdownMode, const uint32_t timeoutMs)
-{
- DBusError error;
- DBusMessageIter iter;
- dbus_error_init(&error);
- int32_t returnError(0);
- std::string path = std::string(DBUS_SERVICE_OBJECT_PATH) + "/LifeCycleConsumer";
- const char* charPath = path.c_str();
- const char* service =DBUS_SERVICE_PREFIX;
- DBusMessage * message = dbus_message_new_method_call(NSM_BUS_INTERFACE, NSM_PATH, NSM_INTERFACE, "RegisterShutdownClient");
-
- if (!message)
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmRegisterShutdownClient dbus error:", error.message);
- return (NsmErrorStatus_Dbus);
- }
- dbus_message_iter_init_append(message, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &service))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmRegisterShutdownClient no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &charPath))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmRegisterShutdownClient no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &shutdownMode))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmRegisterShutdownClient no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &timeoutMs))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmRegisterShutdownClient no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- DBusMessage* reply(dbus_connection_send_with_reply_and_block(mpDBusConnection, message, -1, &error));
- dbus_message_unref(message);
-
- if (!reply)
- {
- logError( "CAmRoutingDbusSend::send failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- if(!dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &returnError,DBUS_TYPE_INVALID))
- {
- logError( "CAmRoutingDbusSend::send failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
- dbus_message_unref(reply);
-
- return (static_cast<NsmErrorStatus_e>(returnError));
-
-}
-
-/** this function unregisters the AudioManager as shutdown client at the NSM
- *
- * @param shutdownMode
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorDBus::nsmUnRegisterShutdownClient(const uint32_t shutdownMode)
-{
- DBusError error;
- DBusMessageIter iter;
- dbus_error_init(&error);
- int32_t returnError(0);
- std::string path = std::string(DBUS_SERVICE_OBJECT_PATH) + "/LifeCycleConsumer";
- const char* charPath = path.c_str();
- const char* service =DBUS_SERVICE_PREFIX;
- DBusMessage * message = dbus_message_new_method_call(NSM_BUS_INTERFACE, NSM_PATH, NSM_INTERFACE, "UnRegisterShutdownClient");
-
- if (!message)
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmUnRegisterShutdownClient dbus error:", error.message);
- return (NsmErrorStatus_Dbus);
- }
- dbus_message_iter_init_append(message, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &service))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmUnRegisterShutdownClient no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &charPath))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmUnRegisterShutdownClient no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &shutdownMode))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmUnRegisterShutdownClient no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- DBusMessage* reply(dbus_connection_send_with_reply_and_block(mpDBusConnection, message, -1, &error));
- dbus_message_unref(message);
-
- if (!reply)
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmUnRegisterShutdownClient failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- if(!dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &returnError, DBUS_TYPE_INVALID))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmUnRegisterShutdownClient failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
- dbus_message_unref(reply);
-
- return (static_cast<NsmErrorStatus_e>(returnError));
-}
-
-/** returns the interface version
- *
- * @param version
- * @return E_OK on success
- */
-am_Error_e CAmNodeStateCommunicatorDBus::nsmGetInterfaceVersion(uint32_t& version)
-{
- DBusError error;
- dbus_error_init(&error);
-
- DBusMessage * message = dbus_message_new_method_call(NSM_BUS_INTERFACE, NSM_PATH, NSM_INTERFACE, "GetInterfaceVersion");
-
- if (!message)
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetInterfaceVersion dbus error:", error.message);
- return (E_UNKNOWN);
- }
-
- DBusMessage* reply(dbus_connection_send_with_reply_and_block(mpDBusConnection, message, -1, &error));
-
- dbus_message_unref(message);
-
- if (!reply)
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetInterfaceVersion failed, dbus error", error.message);
- return (E_UNKNOWN);
- }
-
- if(!dbus_message_get_args(reply, &error, DBUS_TYPE_UINT32, &version, DBUS_TYPE_INVALID))
- {
- logError("CAmNodeStateCommunicatorDBus::nsmGetInterfaceVersion failed, dbus error", error.message);
- return (E_UNKNOWN);
- }
-
- dbus_message_unref(reply);
-
- return (E_OK);
-}
-
-/** sends out the Lifecycle request complete message
- *
- * @param RequestId
- * @param status
- * @return NsmErrorStatus_Ok on success
- */
-NsmErrorStatus_e CAmNodeStateCommunicatorDBus::nsmSendLifecycleRequestComplete(const uint32_t RequestId, const NsmErrorStatus_e status)
-{
- DBusError error;
- DBusMessageIter iter;
- dbus_error_init(&error);
- int32_t returnError(0);
- DBusMessage * message = dbus_message_new_method_call(NSM_BUS_INTERFACE, NSM_PATH, NSM_INTERFACE, "LifecycleRequestComplete");
-
- if (!message)
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmSendLifecycleRequestComplete dbus error:", error.message);
- return (NsmErrorStatus_Dbus);
- }
- dbus_message_iter_init_append(message, &iter);
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &RequestId))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmSendLifecycleRequestComplete no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32,&status))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmSendLifecycleRequestComplete no more memory");
- return (NsmErrorStatus_Dbus);
- }
-
- DBusMessage* reply(dbus_connection_send_with_reply_and_block(mpDBusConnection, message, -1, &error));
- dbus_message_unref(message);
-
- if (!reply)
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmSendLifecycleRequestComplete failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
-
- if(!dbus_message_get_args(reply, &error,DBUS_TYPE_INT32, &returnError, DBUS_TYPE_INVALID))
- {
- logError( "CAmNodeStateCommunicatorDBus::nsmSendLifecycleRequestComplete failed, dbus error", error.message);
- return (NsmErrorStatus_Dbus);
- }
- dbus_message_unref(reply);
-
- return (static_cast<NsmErrorStatus_e>(returnError));
-}
-
-DBusHandlerResult CAmNodeStateCommunicatorDBus::receiveCallback(DBusConnection* conn, DBusMessage* msg, void* user_data)
-{
- CAmNodeStateCommunicatorDBus* instance = static_cast<CAmNodeStateCommunicatorDBus*>(user_data);
- assert(instance);
- return (instance->receiveCallbackDelegate(conn,msg));
-}
-
-DBusHandlerResult CAmNodeStateCommunicatorDBus::receiveCallbackDelegate(DBusConnection* conn, DBusMessage* msg)
-{
- if (dbus_message_is_method_call(msg, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- {
- sendIntrospection(conn, msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
- else
- {
- DBusMessage * returnMessage;
- dbus_uint32_t Request(0),RequestId(0);
- //no introspection - ok. So we are only interested in out LifecycleRequest message...
- std::string method(dbus_message_get_member(msg));
- if (method=="LifecycleRequest")
- {
- DBusMessageIter iter,replyIter;
- if (!dbus_message_iter_init(msg, &iter))
- {
- logError("CAmNodeStateCommunicatorDBus::receiveCallbackDelegate DBus Message has no arguments!");
- returnMessage = dbus_message_new_error(msg,DBUS_ERROR_INVALID_ARGS, "DBUS Message has no arguments!");
- sendMessage(returnMessage,msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- if (dbus_message_iter_get_arg_type(&iter)!=DBUS_TYPE_UINT32)
- {
- logError("CAmNodeStateCommunicatorDBus::receiveCallbackDelegate DBus Message has invalid arguments!");
- returnMessage = dbus_message_new_error(msg,DBUS_ERROR_INVALID_ARGS,"DBus argument is not uint32_t!");
- sendMessage(returnMessage,msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- dbus_message_iter_get_basic(&iter, &Request);
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter)!=DBUS_TYPE_UINT32)
- {
- logError("CAmNodeStateCommunicatorDBus::receiveCallbackDelegate DBus Message has invalid arguments!");
- returnMessage = dbus_message_new_error(msg,DBUS_ERROR_INVALID_ARGS,"DBus argument is not uint32_t!");
- sendMessage(returnMessage,msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- dbus_message_iter_get_basic(&iter, &RequestId);
-
- assert(mpControlSender);
- NsmErrorStatus_e returnError = mpControlSender->hookSystemLifecycleRequest(static_cast<uint32_t>(Request),static_cast<uint32_t>(RequestId));
-
- returnMessage = dbus_message_new_method_return(msg);
-
- if (returnMessage == NULL)
- {
- logError("CAmNodeStateCommunicatorDBus::receiveCallbackDelegate Cannot allocate DBus message!");
- returnMessage = dbus_message_new_error(msg,DBUS_ERROR_NO_MEMORY,"Cannot create reply!");
- sendMessage(returnMessage,msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- dbus_message_iter_init_append(returnMessage, &replyIter);
-
- if (!dbus_message_iter_append_basic(&replyIter, DBUS_TYPE_INT32, &returnError))
- {
- logError("CAmNodeStateCommunicatorDBus::receiveCallbackDelegate Cannot allocate DBus message!");
- returnMessage = dbus_message_new_error(msg,DBUS_ERROR_NO_MEMORY,"Cannot create reply!");
- }
- sendMessage(returnMessage,msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
- }
- return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
-}
-
-void CAmNodeStateCommunicatorDBus::sendIntrospection(DBusConnection* conn, DBusMessage* msg)
-{
- assert(conn != NULL);
- assert(msg != NULL);
- DBusMessage* reply;
- DBusMessageIter args;
- dbus_uint32_t serial = 0;
-
- // create a reply from the message
- reply = dbus_message_new_method_return(msg);
- std::string fullpath(NSM_INTROSPECTION_FILE);
- std::ifstream in(fullpath.c_str(), std::ifstream::in);
- if (!in)
- {
- logError("IAmCommandReceiverShadow::sendIntrospection could not load xml file ",fullpath);
- throw std::runtime_error("IAmCommandReceiverShadow::sendIntrospection Could not load introspecton XML");
- }
- std::stringstream buffer;
- buffer << in.rdbuf();
- std::string introspect = buffer.str();
- const char* string = introspect.c_str();
-
- // add the arguments to the reply
- dbus_message_iter_init_append(reply, &args);
- if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &string))
- {
- logError( "CAmNodeStateCommunicatorDBus::sendIntrospection DBUS handler Out Of Memory!");
- }
-
- // send the reply && flush the connection
- if (!dbus_connection_send(conn, reply, &serial))
- {
- logError( "CAmNodeStateCommunicatorDBus::sendIntrospection DBUS handler Out Of Memory!");
- }
- dbus_connection_flush(conn);
-
- // free the reply
- dbus_message_unref(reply);
-}
-
-void CAmNodeStateCommunicatorDBus::sendMessage(DBusMessage* message, DBusMessage* origMessage)
-{
- dbus_uint32_t serial = dbus_message_get_serial(origMessage);
-
- if(!dbus_connection_send(mpDBusConnection, message, &serial))
- {
- logError( "CAmNodeStateCommunicatorDBus::sendMessage DBUS handler Out Of Memory!");
- }
- dbus_connection_flush(mpDBusConnection);
- dbus_message_unref(message);
-}
-
-DBusHandlerResult CAmNodeStateCommunicatorDBus::signalCallback(DBusConnection* conn, DBusMessage* msg, void* user_data)
-{
- (void) conn;
- CAmNodeStateCommunicatorDBus* instance(static_cast<CAmNodeStateCommunicatorDBus*>(user_data));
-
- const char* iface = dbus_message_get_interface(msg);
- if (iface==NULL)
- return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
- std::string interface(iface);
- std::string member = dbus_message_get_member(msg);
-
- if (interface=="org.genivi.NodeStateManager.Consumer")
- {
- if (member=="NodeState")
- {
- int32_t nodeState;
- DBusMessageIter iter;
- if (!dbus_message_iter_init(msg, &iter))
- {
- logError("CAmNodeStateCommunicatorDBus::signalCallback NodeState DBus Message has no arguments!");
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- if (dbus_message_iter_get_arg_type(&iter)!=DBUS_TYPE_INT32)
- {
- logError("CAmNodeStateCommunicatorDBus::signalCallback NodeState DBus Message has invalid arguments!");
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- dbus_message_iter_get_basic(&iter, &nodeState);
-
- logInfo("CAmNodeStateCommunicatorDBus::signalCallback got signal NodeState, with nodeState",nodeState);
-
- assert(instance->mpControlSender);
- instance->mpControlSender->hookSystemNodeStateChanged(static_cast<NsmNodeState_e>(nodeState));
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- else if (member=="NodeApplicationMode")
- {
- int32_t nodeApplicationMode;
- DBusMessageIter iter;
- if (!dbus_message_iter_init(msg, &iter))
- {
- logError("CAmNodeStateCommunicatorDBus::signalCallback nodeApplicationMode DBus Message has no arguments!");
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- if (dbus_message_iter_get_arg_type(&iter)!=DBUS_TYPE_INT32)
- {
- logError("CAmNodeStateCommunicatorDBus::signalCallback nodeApplicationMode DBus Message has invalid arguments!");
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- dbus_message_iter_get_basic(&iter, &nodeApplicationMode);
-
- logInfo("CAmNodeStateCommunicatorDBus::signalCallback got signal nodeApplicationMode, with applicationMode",nodeApplicationMode);
-
- assert(instance->mpControlSender);
- instance->mpControlSender->hookSystemNodeApplicationModeChanged(static_cast<NsmApplicationMode_e>(nodeApplicationMode));
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- else if (member=="SessionStateChanged")
- {
- std::string sessionName;
- NsmSeat_e seatID;
- NsmSessionState_e sessionState;
- DBusMessageIter iter;
- if (!dbus_message_iter_init(msg, &iter))
- {
- logError("CAmNodeStateCommunicatorDBus::signalCallback nodeApplicationMode DBus Message has no arguments!");
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- if (dbus_message_iter_get_arg_type(&iter)!=DBUS_TYPE_STRING)
- {
- logError("CAmNodeStateCommunicatorDBus::signalCallback nodeApplicationMode DBus Message has invalid arguments!");
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- char * sessionNameChar;
- dbus_message_iter_get_basic(&iter, &sessionNameChar);
- sessionName=std::string(sessionNameChar);
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter)!=DBUS_TYPE_INT32)
- {
- logError("CAmNodeStateCommunicatorDBus::signalCallback nodeApplicationMode DBus Message has invalid arguments!");
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- dbus_message_iter_get_basic(&iter, &seatID);
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter)!=DBUS_TYPE_INT32)
- {
- logError("CAmNodeStateCommunicatorDBus::signalCallback nodeApplicationMode DBus Message has invalid arguments!");
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- dbus_message_iter_get_basic(&iter, &sessionState);
-
-
- logInfo("CAmNodeStateCommunicatorDBus::signalCallback got signal sessionStateChanged, with session",sessionName,"seatID=",seatID,"sessionState",sessionState);
-
- assert(instance->mpControlSender);
- instance->mpControlSender->hookSystemSessionStateChanged(sessionName,seatID,sessionState);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- else
- {
- return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
- }
- }
-
- return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
-}
-
-am_Error_e CAmNodeStateCommunicatorDBus::readIntegerProperty(const std::string property, int32_t& value)
-{
- DBusError error;
- dbus_error_init(&error);
- DBusMessageIter iter,iterVariant;
-
- DBusMessage * message = dbus_message_new_method_call(NSM_BUS_INTERFACE, NSM_PATH, "org.freedesktop.DBus.Properties", "Get");
-
- if (!message)
- {
- logError("CAmNodeStateCommunicatorDBus::readIntegerProperty dbus error:", error.message);
- dbus_message_unref(message);
- return (E_UNKNOWN);
- }
-
-
- dbus_message_iter_init_append(message, &iter);
- const char *interface=NSM_INTERFACE;
- const char *propertyChar=property.c_str();
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &interface))
- {
- logError("CAmNodeStateCommunicatorDBus::readIntegerProperty append error");
- dbus_message_unref(message);
- return (E_UNKNOWN);
- }
-
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &propertyChar))
- {
- logError("CAmNodeStateCommunicatorDBus::readIntegerProperty append error");
- dbus_message_unref(message);
- return (E_UNKNOWN);
- }
-
- DBusMessage* reply(dbus_connection_send_with_reply_and_block(mpDBusConnection, message, -1, &error));
- if (!reply)
- {
- logError("CAmNodeStateCommunicatorDBus::readIntegerProperty failed, dbus error", error.message);
- dbus_message_unref(message);
- return (E_UNKNOWN);
- }
-
- if(!dbus_message_iter_init(reply,&iterVariant))
- {
- logError("CAmNodeStateCommunicatorDBus::readIntegerProperty failed, dbus error", error.message);
- dbus_message_unref(message);
- dbus_message_unref(reply);
- return (E_UNKNOWN);
- }
- if (dbus_message_iter_get_arg_type (&iterVariant)!= DBUS_TYPE_VARIANT)
- {
- logError("CAmNodeStateCommunicatorDBus::readIntegerProperty failed, dbus return type wrong");
- dbus_message_unref(reply);
- dbus_message_unref(message);
- return (E_UNKNOWN);
- }
- DBusMessageIter subiter;
- dbus_message_iter_recurse (&iterVariant, &subiter);
- if (dbus_message_iter_get_arg_type (&subiter)!= DBUS_TYPE_INT32)
- {
- logError("CAmNodeStateCommunicatorDBus::readIntegerProperty failed, dbus return type wrong");
- dbus_message_unref(reply);
- dbus_message_unref(message);
- return (E_UNKNOWN);
- }
-
- dbus_message_iter_get_basic(&subiter,&value);
- dbus_message_unref(reply);
- dbus_message_unref(message);
-
- return (E_OK);
-}
-
-} /* namespace am */
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index 6db7715..5942e18 100755
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -30,20 +30,13 @@
#ifdef WITH_CAPI_WRAPPER
#include "CAmCommonAPIWrapper.h"
-#else
- #ifdef WITH_DBUS_WRAPPER
- #include "CAmDbusWrapper.h"
- #endif
#endif
-#ifdef WITH_NSM
- #ifdef WITH_DBUS_WRAPPER
- #include "CAmNodeStateCommunicatorDBus.h"
- #else
- #include "CAmNodeStateCommunicatorCAPI.h"
- #endif
+#ifdef WITH_DBUS_WRAPPER
+ #include "CAmDbusWrapper.h"
#endif
+
#ifdef WITH_DATABASE_STORAGE
#include "CAmDatabaseHandlerSQLite.h"
#else
@@ -336,19 +329,12 @@ void mainProgram(int argc, char *argv[])
#ifdef WITH_CAPI_WRAPPER
//We instantiate a singleton with the current socket handler, which loads the common-api runtime.
CAmCommonAPIWrapper *pCAPIWrapper = CAmCommonAPIWrapper::instantiateOnce(&iSocketHandler, "AudioManager");
- CAmCommonAPIWrapper iDBusWrapper = *pCAPIWrapper;
-#ifdef WITH_NSM
- CAmNodeStateCommunicatorCAPI iNodeStateCommunicator(&iDBusWrapper);
-#endif /*WITH_NSM*/
#endif /*WITH_CAPI_WRAPPER */
#ifdef WITH_DBUS_WRAPPER
if (dbusWrapperTypeBool.getValue())
dbusWrapperType=DBUS_BUS_SYSTEM;
CAmDbusWrapper iDBusWrapper(&iSocketHandler,dbusWrapperType);
-#ifdef WITH_NSM
- CAmNodeStateCommunicatorDBus iNodeStateCommunicator(&iDBusWrapper);
-#endif /*WITH_NSM*/
#endif /*WITH_DBUS_WRAPPER */
#ifdef WITH_SYSTEMD_WATCHDOG
@@ -371,12 +357,7 @@ void mainProgram(int argc, char *argv[])
CAmRoutingReceiver iRoutingReceiver(pDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
#endif /*WITH_DBUS_WRAPPER*/
-#ifdef WITH_NSM
- CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter, &iNodeStateCommunicator);
- iNodeStateCommunicator.registerControlSender(&iControlSender);
-#else /*WITH_NSM*/
- CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
-#endif /*WITH_NSM*/
+CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
#ifdef WITH_TELNET
CAmTelnetServer iTelnetServer(&iSocketHandler, &iCommandSender, &iCommandReceiver, &iRoutingSender, &iRoutingReceiver, &iControlSender, &iControlReceiver, pDatabaseHandler, &iRouter, telnetPort.getValue(), maxConnections.getValue());
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp
deleted file mode 100644
index d9e0fd0..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
- *
- * \file CAmNodeStateCommunicatorTest.cpp
- * For further information see http://www.genivi.org/.
- *
- */
-
-#include "CAmNodeStateCommunicatorTest.h"
-#include "CAmDltWrapper.h"
-#include "CAmSocketHandler.h"
-
-#include <unistd.h>
-
-using namespace testing;
-using namespace am;
-
-static CAmEnvironment* env;
-
-
-CAmNodeStateCommunicatorTest::CAmNodeStateCommunicatorTest()
-{
- std::cout<<"Exec path : " << EXECUTABLE_OUTPUT_PATH <<std::endl;
-}
-
-CAmNodeStateCommunicatorTest::~CAmNodeStateCommunicatorTest()
-{
- // TODO Auto-generated destructor stub
-}
-
-/**This is the thread for the nsm python fake
- *
- * @param
- */
-void* nsmThread (void*)
-{
- if(-1 == system("python nsm.py"))
- logError("Something went wrong with nsm.py!");
- return (NULL);
-}
-
-/**this is the thread the mainloop runs in
- *
- * @param importHandler
- */
-void* mainLoop(void* importHandler)
-{
- CAmSocketHandler* handler=static_cast<CAmSocketHandler*>(importHandler);
- handler->start_listenting();
- return (NULL);
-}
-
-
-TEST_F(CAmNodeStateCommunicatorTest, nsmChangeNodeState)
-{
- assert(true == env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface));
- NsmNodeState_e newstate(NsmNodeState_BaseRunning) ;
- EXPECT_CALL(pMockControlInterface,hookSystemNodeStateChanged(newstate));
- std::ostringstream send;
- send<<"python send2nsm.py nodeState "<<static_cast<std::int32_t>(newstate);
- system(send.str().c_str());
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, nsmChangeApplicationMode)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmApplicationMode_e appmode(NsmApplicationMode_Swl) ;
- EXPECT_CALL(pMockControlInterface,hookSystemNodeApplicationModeChanged(appmode));
- std::ostringstream send;
- send<<"python send2nsm.py appMode "<<static_cast<std::int32_t>(appmode);
- system(send.str().c_str());
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, nsmChangeSessionState)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- std::string sessionName("mySession");
- NsmSeat_e seatID(NsmSeat_CoDriver);
- NsmSessionState_e sessionState(NsmSessionState_Inactive) ;
- EXPECT_CALL(pMockControlInterface,hookSystemSessionStateChanged(sessionName,seatID,sessionState));
- std::ostringstream send;
- send<<"python send2nsm.py sessionState "<<sessionName<<" "<<static_cast<std::int32_t>(seatID)<<" "<<static_cast<int32_t>(sessionState);
- system(send.str().c_str());
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getRestartReason)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmRestartReason_e restartReason;
- ASSERT_EQ(E_OK,env->nsmController.nsmGetRestartReasonProperty(restartReason));
- ASSERT_EQ(restartReason,1);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getShutdownReason)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmShutdownReason_e ShutdownReason;
- ASSERT_EQ(E_OK,env->nsmController.nsmGetShutdownReasonProperty(ShutdownReason));
- ASSERT_EQ(ShutdownReason,2);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getWakeUpReason)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmRunningReason_e WakeUpReason;
- ASSERT_EQ(E_OK,env->nsmController.nsmGetRunningReasonProperty(WakeUpReason));
- ASSERT_EQ(WakeUpReason,3);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getNodeState)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmNodeState_e nodeState;
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmGetNodeState(nodeState));
- ASSERT_EQ(nodeState,1);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getApplicationMode)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmApplicationMode_e applicationMode;
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Error,env->nsmController.nsmGetApplicationMode(applicationMode));
- ASSERT_EQ(applicationMode,5);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getSessionState)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- std::string sessionName("mySession");
- NsmSeat_e seatID(NsmSeat_Driver);
- NsmSessionState_e sessionState;
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmGetSessionState(sessionName,seatID,sessionState));
- ASSERT_EQ(sessionState,5);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, RegisterShutdownClient)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t shutdownmode(1), timeoutMs(100);
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmRegisterShutdownClient(shutdownmode,timeoutMs));
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, receiveLifecycleRequest)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t shutdownmode(1);
- uint32_t timeoutMs(100);
- int32_t Request(1);
- int32_t RequestID(4);
- EXPECT_CALL(pMockControlInterface,hookSystemLifecycleRequest(_,RequestID)).WillOnce(Return(NsmErrorStatus_e::NsmErrorStatus_Ok));
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmRegisterShutdownClient(shutdownmode,timeoutMs));
- std::ostringstream send;
- send << "python send2nsm.py LifecycleRequest "<<Request<<" "<<RequestID;
- system(send.str().c_str());
- sleep(2);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, UnRegisterShutdownClient)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t shutdownmode(1),timeoutMs(100);
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmRegisterShutdownClient(shutdownmode,timeoutMs));
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmUnRegisterShutdownClient(shutdownmode));
-
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, sendLifecycleRequestComplete)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t RequestID(22);
- NsmErrorStatus_e errorStatus(NsmErrorStatus_Internal);
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmSendLifecycleRequestComplete(RequestID,errorStatus));
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getInterfaceVersion)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t version(0);
- ASSERT_EQ(E_OK,env->nsmController.nsmGetInterfaceVersion(version));
- ASSERT_EQ(version,static_cast<uint32_t>(23));
-}
-
-void CAmNodeStateCommunicatorTest::SetUp()
-{
-}
-
-void CAmNodeStateCommunicatorTest::TearDown()
-{
-}
-
-int main(int argc, char **argv)
-{
- CAmDltWrapper::instance()->registerApp("nsm", "nsmtest");
- logInfo("nsmtest Test started ");
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::Environment* const env = ::testing::AddGlobalTestEnvironment(new CAmEnvironment);
- (void) env;
- return RUN_ALL_TESTS();
-}
-
-CAmEnvironment::CAmEnvironment() :
- pControlInterfaceBackdoor(),
- pControlSender(),
- iSocketHandler(),
- wrapper(CAmCommonAPIWrapper::instantiateOnce(&iSocketHandler)),
- nsmController(wrapper),
- pNsmThread(0),
- pMainLoopThread(0)
-{
- env=this;
-}
-
-CAmEnvironment::~CAmEnvironment()
-{
-}
-
-void CAmEnvironment::waitUntilAvailable(unsigned short seconds = 10)
-{
- int countTries = 0;
- printf("\nWaiting for service");
- while( countTries++<seconds )
- {
- printf(".");
- if(nsmController.isServiceAvailable())
- break;
- else
- sleep(1);
- }
- printf("\n");
-}
-
-void CAmEnvironment::SetUp()
-{
- //create the nsm thread
- pthread_create(&pNsmThread, NULL, nsmThread, NULL);
- nsmController.registerControlSender(&pControlSender);
- //create the mainloop thread
- pthread_create(&pMainLoopThread, NULL, mainLoop, (void*)&iSocketHandler);
- printf("[----------] Waiting for interface to be ready....\r\n");
- waitUntilAvailable(10);
-}
-
-void CAmEnvironment::TearDown()
-{
- //end the nsm per dbus
- system("python send2nsm.py finish");
- pthread_join(pNsmThread, NULL);
- //end the mainloop
- iSocketHandler.exit_mainloop();
- pthread_join(pMainLoopThread, NULL);
-}
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.h b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.h
deleted file mode 100644
index b00a27a..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
- *
- * \file CAmNodeStateCommunicatorTest.h
- * For further information see http://www.genivi.org/.
- *
- */
-
-
-#ifndef CAMNODESTATECOMMUNICATORTEST_H_
-#define CAMNODESTATECOMMUNICATORTEST_H_
-
-#include "CAmNodeStateCommunicatorCAPI.h"
-#include "CAmControlSender.h"
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-#include "../IAmControlBackdoor.h"
-#include "../MockIAmControlSend.h"
-#include "CAmCommonAPIWrapper.h"
-
-using namespace testing;
-using namespace am;
-
-class CAmEnvironment : public ::testing::Environment
-{
-public:
- IAmControlBackdoor pControlInterfaceBackdoor;
- CAmControlSender pControlSender;
- CAmSocketHandler iSocketHandler;
- CAmCommonAPIWrapper *wrapper;
- CAmNodeStateCommunicatorCAPI nsmController;
- pthread_t pNsmThread, pMainLoopThread;
- CAmEnvironment();
- ~CAmEnvironment();
- void SetUp();
- // Override this to define how to tear down the environment.
- void TearDown();
- void waitUntilAvailable(unsigned short seconds);
-};
-
-class CAmNodeStateCommunicatorTest:public ::testing::Test
-{
-public:
- MockIAmControlSend pMockControlInterface;
- CAmNodeStateCommunicatorTest();
- virtual ~CAmNodeStateCommunicatorTest();
- void SetUp();
- void TearDown();
-};
-
-
-#endif /* CAMNODESTATECOMMUNICATORTEST_H_ */
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CMakeLists.txt b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CMakeLists.txt
deleted file mode 100644
index 12032ab..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CMakeLists.txt
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright (c) 2012 GENIVI Alliance
-# Copyright (c) 2012 BMW
-#
-# author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
-#
-# copyright
-# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
-# THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-project(AmNodeStateCommunicatorCAPITest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1")
-
-find_package(Threads)
-find_package(PythonLibs REQUIRED)
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- rt)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${PYTHON_INCLUDE_DIRS}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
- ${COMMONAPI_DBUS_INCLUDE_DIRS}
- ${COMMONAPI_INCLUDE_DIRS}
- ${COMMON_API_GEN_INCLUDE_DIR}
- ${DBUS_INCLUDE_DIRS}
-)
-
-if(WITH_DLT)
-INCLUDE_DIRECTORIES(
- ${INCLUDE_DIRECTORIES}
- ${DLT_INCLUDE_DIRS})
-endif(WITH_DLT)
-
-
-file(GLOB NODESTATECOMMUNICATORCAPI_SRCS_CXX
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandler.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseObserver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmNodeStateCommunicatorCAPI.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "${AUDIOMANAGER_UTILITIES_SRC}/CAmCommonAPIWrapper.cpp"
- "${AUDIOMANAGER_UTILITIES_SRC}/CAmDltWrapper.cpp"
- "${AUDIOMANAGER_UTILITIES_SRC}/CAmSocketHandler.cpp"
- "../CAmCommonFunctions.cpp"
- "*.cpp")
-
-ADD_EXECUTABLE(AmNodeStateCommunicatorCAPITest ${NODESTATECOMMUNICATORCAPI_SRCS_CXX} ${COMMON_API_GEN_SOURCES})
-
-TARGET_LINK_LIBRARIES(AmNodeStateCommunicatorCAPITest
- ${AM_LINK_LIBS}
- ${CMAKE_THREAD_LIBS_INIT}
- ${PYTHON_LIBRARY}
- ${CommonAPI-DBus_LIBRARY}
- ${CommonAPI_LIBRARY}
- ${DBUS_LIBRARIES}
- gtest
- gmock
-)
-
-ADD_DEPENDENCIES(AmNodeStateCommunicatorCAPITest gtest gmock)
-
-INSTALL(TARGETS AmNodeStateCommunicatorCAPITest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
-INSTALL(FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/org.genivi.NodeStateManager.Consumer.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/nsm.py
- ${CMAKE_CURRENT_SOURCE_DIR}/send2nsm.py
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
-if(USE_BUILD_LIBS)
- execute_process(
- COMMAND mkdir -p ${EXECUTABLE_OUTPUT_PATH}
- COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/org.genivi.NodeStateManager.Consumer.xml" ${EXECUTABLE_OUTPUT_PATH}/org.genivi.NodeStateManager.Consumer.xml
- COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/nsm.py" ${EXECUTABLE_OUTPUT_PATH}/nsm.py
- COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/send2nsm.py" ${EXECUTABLE_OUTPUT_PATH}/send2nsm.py
-# COMMAND cp "${AUDIOMANAGER_DAEMON_FOLDER}/fidls/NodeStateManager_dbus.conf" ${EXECUTABLE_OUTPUT_PATH}/AmNodeStateCommunicatorCAPITest_dbus.conf
- )
-endif(USE_BUILD_LIBS)
-
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/nsm.py b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/nsm.py
deleted file mode 100644
index c648484..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/nsm.py
+++ /dev/null
@@ -1,179 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012, 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 2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-import sys
-import traceback
-import gobject
-import math
-import dbus
-import dbus.service
-import dbus.mainloop.glib
-
-loop = gobject.MainLoop()
-dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-
-class NodeStateManager(dbus.service.Object):
- def __init__(self, loop):
- busName = dbus.service.BusName('org.genivi.NodeStateManager.Consumer_org.genivi.NodeStateManager', bus = dbus.SessionBus())
- dbus.service.Object.__init__(self, busName, '/org/genivi/NodeStateManager')
- self.properties = {'RestartReason': 1, 'ShutdownReason': 2, 'WakeUpReason' :3, 'BootMode' :4}
- self.ABus=""
- self.APath=""
- self.loop=loop
-
- @dbus.service.method(dbus_interface='org.freedesktop.DBus.Introspectable', out_signature = 's')
- def Introspect(self):
- f = open('org.genivi.NodeStateManager.Consumer.xml', "r")
- text = f.read()
- return text
-
- @dbus.service.method(dbus_interface='org.genivi.NodeStateManager.Consumer', out_signature = 'ii')
- def GetNodeState(self):
- NodeStateId=1
- ErrorCode=1
- print('[-----nsm-----] send out nodeState' + str(NodeStateId) + ' ErrorCode '+ str(1))
- return NodeStateId, ErrorCode
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', out_signature = 'ii')
- def GetApplicationMode(self):
- ApplicationModeId=5
- ErrorCode=2
- print('[-----nsm-----] send out ApplicationMode' + str(ApplicationModeId) + ' ErrorCode '+ str(2))
- return ApplicationModeId, ErrorCode
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', in_signature='si', out_signature = 'ii')
- def GetSessionState(self,SessionName,seatID):
- SessionState=0
- ErrorCode=2
-
- if SessionName=="mySession" and seatID==1:
- SessionState=5
- ErrorCode=1
-
- print('[-----nsm-----] GetSessionState for session ' + SessionName + ' seatID '+ str(seatID) + ' returnState ' + str (SessionState))
- return SessionState, ErrorCode
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', in_signature='ssuu', out_signature = 'i')
- def RegisterShutdownClient(self,BName,ObjName,ShutdownMode,TimeoutMs):
- print('[-----nsm-----] Busname: ' + BName)
- print('[-----nsm-----] ObjName: ' + ObjName)
- print('[-----nsm-----] ShutdownMode: ' + str(ShutdownMode))
- print('[-----nsm-----] TimeoutMs: ' + str(TimeoutMs))
- ErrorCode=1
- if TimeoutMs!=100:
- ErrorCode=3
- if BName!="org.genivi.NodeStateManager.LifeCycleConsumer_org.genivi.audiomanager":
- ErrorCode=4
- if ShutdownMode!=1:
- ErrorCode=5
- if ObjName!="/org/genivi/audiomanager":
- ErrorCode=6
- self.ABus=BName
- self.APath=ObjName
- return ErrorCode
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', in_signature='ssu', out_signature = 'i')
- def UnRegisterShutdownClient(self,BusName,ObjName,ShutdownMode):
- print('[-----nsm-----] Busname: ' + str(BusName))
- print('[-----nsm-----] ObjName: ' + str(ObjName))
- print('[-----nsm-----] ShutdownMode: ' + str(ShutdownMode))
- ErrorCode=1
- if BusName!=self.ABus:
- ErrorCode=2
- if ObjName!=self.APath:
- ErrorCode=2
- if ShutdownMode!=1:
- ErrorCode=2
- return ErrorCode
-
- @dbus.service.method(dbus_interface='org.genivi.NodeStateManager.Consumer', out_signature = 'u')
- def GetInterfaceVersion(self):
- version=23
- return version
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', in_signature='ui', out_signature='i')
- def LifecycleRequestComplete(self,RequestID,Status):
- print('[-----nsm-----] RequestId: ' + str(RequestID))
- print('[-----nsm-----] Status: ' + str(Status))
- ErrorCode=1
- if RequestID!=22:
- ErrorCode=2
- if Status!=4:
- ErrorCode=2
- return ErrorCode
-
- @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='ss', out_signature='v')
- def Get(self, interface, prop):
- if prop in self.properties:
- print('[-----nsm-----] send out ' + str(self.properties[prop]) + ' for property '+ prop)
- return self.properties[prop]
- return 0
-
- @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='ssv')
- def Set(self, interface, prop, value):
- return 3
-
- @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='s', out_signature='a{sv}')
- def GetAll(self, interface):
- return self.properties
-
- @dbus.service.signal(dbus_interface='org.genivi.NodeStateManager.Consumer', signature='i')
- def NodeApplicationMode(self, ApplicationModeId):
- print "[-----nsm-----] Send out application mode ID %d" % (ApplicationModeId)
-
- @dbus.service.signal(dbus_interface='org.genivi.NodeStateManager.Consumer', signature='i')
- def NodeState(self, NodeState):
- print "[-----nsm-----] Send out NodeState %d" % (NodeState)
-
- @dbus.service.signal(dbus_interface='org.genivi.NodeStateManager.Consumer', signature='sii')
- def SessionStateChanged(self, SessionStateName,SeatID,SessionState):
- print "[-----nsm-----] Send out SessionStateChanged " + SessionStateName
-
- @dbus.service.method('org.genivi.NodeStateManager.Control', in_signature='i')
- def sendNodeApplicationMode(self, input):
- self.NodeApplicationMode(input)
- return input
-
- @dbus.service.method('org.genivi.NodeStateManager.Control', in_signature='i')
- def sendNodeState(self, input):
- self.NodeState(input)
- return input
-
- @dbus.service.method('org.genivi.NodeStateManager.Control', in_signature='sii')
- def sendSessionState(self, SessionStateName,SeatID,SessionState):
- self.SessionStateChanged (SessionStateName,SeatID,SessionState)
- return SeatID
-
- @dbus.service.method('org.genivi.NodeStateManager.Control', in_signature='uu', out_signature='i')
- def sendLifeCycleRequest(self, request, requestID):
- bus = dbus.SessionBus()
- remote_object = bus.get_object(self.ABus,self.APath)
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.LifeCycleConsumer')
- iface.LifecycleRequest(request,requestID)
- return 42
-
- @dbus.service.method('org.genivi.NodeStateManager.Control')
- def finish(self):
- print '[-----nsm-----] Going to exit now!'
- self.loop.quit()
- return 0
-
-nsm = NodeStateManager(loop)
-loop.run()
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/org.genivi.NodeStateManager.Consumer.xml b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/org.genivi.NodeStateManager.Consumer.xml
deleted file mode 100644
index bb40a96..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/org.genivi.NodeStateManager.Consumer.xml
+++ /dev/null
@@ -1,259 +0,0 @@
-<!-- Auto-Generated interface from Rhapsody: 'Repository::ssw_LifecycleSupport::NodeStateManagement::Concept::Interface::INSM_Consumer' -->
-<!-- Created at 2012-06-01 09:36:05 by uid65904 -->
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
-<interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" direction="out" type="s"/>
- </method>
-</interface>
-<interface name="org.freedesktop.DBus.Properties">
- <method name="Get">
- <arg name="interface" direction="in" type="s"/>
- <arg name="propname" direction="in" type="s"/>
- <arg name="value" direction="out" type="v"/>
- </method>
-
- <method name="Set">
- <arg name="interface" direction="in" type="s"/>
- <arg name="propname" direction="in" type="s"/>
- <arg name="value" direction="in" type="v"/>
- </method>
-
- <method name="GetAll">
- <arg name="interface" direction="in" type="s"/>
- <arg name="props" direction="out" type="a{sv}"/>
- </method>
-</interface>
- <!--
- org.genivi.NodeStateManager.Consumer:
- @short_description: "Consumer" interface of the NodeStateManager.
-
- This interface contains functions which are not safety critical and can be accessed by "every" client without further restrictions.
- -->
- <interface name="org.genivi.NodeStateManager.Consumer">
- <!--
- RestartReason: This property informs clients about the reason for the last restart. The values are based upon the enummeration NsmRestartReason_e. Note: The value is only set once at start-up.
- -->
- <property name="RestartReason" type="i" access="read"/>
-
- <!--
- ShutdownReason: This property informs clients about the reason for the last shutdown. The values are based upon the enummeration NsmShutdownReason_e. Note: The value is only set once at start-up.
- -->
- <property name="ShutdownReason" type="i" access="read"/>
-
- <!--
- WakeUpReason: This property informs clients about the recent reason for waking up the target. The values are based upon the enummeration NsmWakeUpReason_e. Note: The value is only set once at start-up.
- -->
- <property name="WakeUpReason" type="i" access="read"/>
-
- <!--
- BootMode: This property informs clients about the recent BootMode of the target. The values will be defined by a third party header, which has not been delivered yet. The description needs to be updated as soon as the header is available.
- -->
- <property name="BootMode" type="i" access="read"/>
-
- <!--
- NodeState:
- @NodeState: Numeric value for the current NodeState, defined in NsmNodeState_e.
-
- Clients can register for notifications when the NodeState is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeState as a parameter.
- -->
- <signal name="NodeState">
- <arg name="NodeState" type="i"/>
- </signal>
-
- <!--
- NodeApplicationMode:
- @ApplicationModeId: Numeric value for the current ApplicationMode, defined in NsmAplicationMode_e.
-
- Clients can register for notifications when the NodeApplicationMode is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeApplicationMode as a parameter.
- -->
- <signal name="NodeApplicationMode">
- <arg name="ApplicationModeId" type="i"/>
- </signal>
-
- <!--
- SessionStateChanged:
- @SessionStateName: The SessionName will be based upon either the pre-defined platform SessionNames or using a newly added product defined session name.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.
-
- This signal is sent to registered clients when a particular session is state is changed. The client can register for notification about a specific session through the use of the SessionName, as a "match rule".
- -->
- <signal name="SessionStateChanged">
- <arg name="SessionStateName" type="s"/>
- <arg name="SeatID" type="i"/>
- <arg name="SessionState" type="i"/>
- </signal>
-
- <!--
- GetNodeState:
- @NodeStateId: Will be based on the NsmNodeState_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to get the NodeState without the need of registration to the signal.
- -->
- <method name="GetNodeState">
- <arg name="NodeStateId" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- SetSessionState:
- @SessionName: The SessionName will be based upon either the pre-defined platform SessionNames (see NSM content page) or using a newly added product defined session name.
- @SessionOwner: This parameter defines the name of the application that is setting the state of the session. This must be the applications systemd unit filename.
- @SeatID: This parameter will be based upon the enum NsmSeat_e
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by applications to set the state of a session.
- -->
- <method name="SetSessionState">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetSessionState:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by applications to get the state of a session.
- -->
- <method name="GetSessionState">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetApplicationMode:
- @ApplicationModeId: This parameter will be based upon the NsmNodeApplicationMode_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to get the application mode.
- -->
- <method name="GetApplicationMode">
- <arg name="ApplicationModeId" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- RegisterShutdownClient:
- @BusName: Bus name of remote application.
- @ObjName: Object name of remote object that provides the shutdown interface.
- @ShutdownMode: Shutdown mode for which client wants to be informed (i.e normal, fast etc).
- @TimeoutMs: Max. Timeout to wait for response from shutdown client in ms.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to register themselves as shutdown client. Any client that registers must provide a method in their D-Bus object called "LifecycleRequest". This method will take one parameter which is the RequestType (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST). For an example of the required client interface please see the BootManager component who will be a client of the NSM.
- -->
- <method name="RegisterShutdownClient">
- <arg name="BusName" direction="in" type="s"/>
- <arg name="ObjName" direction="in" type="s"/>
- <arg name="ShutdownMode" direction="in" type="u"/>
- <arg name="TimeoutMs" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- UnRegisterShutdownClient:
- @BusName: Bus name of remote application.
- @ObjName: Object name of remote object that provides the shutdown interface.
- @ShutdownMode: Shutdown mode for which client wants to unregister (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST).
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to unregister themselves as shutdown client.
- -->
- <method name="UnRegisterShutdownClient">
- <arg name="BusName" direction="in" type="s"/>
- <arg name="ObjName" direction="in" type="s"/>
- <arg name="ShutdownMode" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- RegisterSession:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SessionOwner: This is the name of the application that is registering the new session (this must be the applications systemd unit filename).
- @SeatID: This parameter will be based upon the enum NsmSeatId_e
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to register a new session whose state should be observed and distributed by the NSM.
- -->
- <method name="RegisterSession">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- UnRegisterSession:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SessionOwner: This is the name of the application that originally registered the session. It will be validated that this value matches the stored value from the registration.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to remove a new session from the session list hosted by NSM.
- -->
- <method name="UnRegisterSession">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetAppHealthCount:
- @Count: Return value passed to the caller. Number of applications that crashed or terminated accidentally.
-
- The method returns the number of applications that crashed or terminated accidentally, within the current life cycle. It can be used to observe the system state.
- -->
- <method name="GetAppHealthCount">
- <arg name="Count" direction="out" type="u"/>
- </method>
-
- <!--
- GetInterfaceVersion:
- @Version: Unsigned integer that represents the version number of the Node State Manager.
-
- The method returns the version number of the Node State Manager. The number is organized in four bytes:
-
- Version: VVV.RRR.PPP.BBB
-
- <literallayout>
- VVV => Version [1..255]
- RRR => Release [0..255]
- PPP => Patch [0..255]
- BBB => Build [0..255]
- </literallayout>
- -->
- <method name="GetInterfaceVersion">
- <arg name="Version" direction="out" type="u"/>
- </method>
-
- <!--
- LifecycleRequestComplete:
- @RequestId: The request Id of the called life cycle client. The value has been passed when "LifecycleRequest" was called.
- @Status: The result of the call to "LifecycleRequest". NsmErrorStatus_Ok: Request successfully processed. NsmErrorStatus_Error: An error occured while processing the "LifecycleRequest".
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The function has to be called by a "asynchrounous" lifecycle client, when he processed the "LifecycleRequest".
- -->
- <method name="LifecycleRequestComplete">
- <arg name="RequestId" direction="in" type="u"/>
- <arg name="Status" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
- </interface>
-</node>
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/send2nsm.py b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/send2nsm.py
deleted file mode 100644
index 5ed6c0c..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/send2nsm.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012, 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 2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-import sys
-import traceback
-import gobject
-import math
-import dbus
-import dbus.service
-
-def nodeState (nodeState):
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager.Consumer_org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.sendNodeState(int(nodeState))
-
-def appMode (appMode):
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager.Consumer_org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.sendNodeApplicationMode(int(appMode))
-
-def sessionState (SessionStateName,SeatID,SessionState):
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager.Consumer_org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.sendSessionState(SessionStateName,int(SeatID),int(SessionState))
-
-def finish():
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager.Consumer_org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.finish()
-
-def LifecycleRequest(Request,RequestID):
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager.Consumer_org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.sendLifeCycleRequest(dbus.UInt32(Request),dbus.UInt32(RequestID))
-
-command=sys.argv[1]
-if command=="nodeState":
- nodeState(sys.argv[2])
-if command=="finish":
- finish()
-if command=="appMode":
- appMode(sys.argv[2])
-if command=="sessionState":
- sessionState(sys.argv[2],sys.argv[3],sys.argv[4])
-if command=="LifecycleRequest":
- LifecycleRequest(sys.argv[2],sys.argv[3])
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CAmNodeStateCommunicatorTest.cpp b/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CAmNodeStateCommunicatorTest.cpp
deleted file mode 100644
index 6acce61..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CAmNodeStateCommunicatorTest.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 2012
- *
- * \file CAmNodeStateCommunicatorTest.cpp
- * For further information see http://www.genivi.org/.
- *
- */
-
-#include "CAmNodeStateCommunicatorTest.h"
-#include "CAmDltWrapper.h"
-#include "CAmSocketHandler.h"
-#include "CAmDbusWrapper.h"
-
-#include <unistd.h>
-
-using namespace testing;
-using namespace am;
-
-static CAmEnvironment* env;
-
-
-
-CAmNodeStateCommunicatorTest::CAmNodeStateCommunicatorTest()
-{
-
-}
-
-CAmNodeStateCommunicatorTest::~CAmNodeStateCommunicatorTest()
-{
- // TODO Auto-generated destructor stub
-}
-
-/**This is the thread for the nsm python fake
- *
- * @param
- */
-void* nsmThread (void*)
-{
- system("python nsm.py");
- return (NULL);
-}
-
-/**this is the thread the mainloop runs in
- *
- * @param importHandler
- */
-void* mainLoop(void* importHandler)
-{
- CAmSocketHandler* handler=static_cast<CAmSocketHandler*>(importHandler);
- handler->start_listenting();
- return (NULL);
-}
-
-
-
-TEST_F(CAmNodeStateCommunicatorTest, nsmChangeNodeState)
-{
- assert(true == env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface));
- NsmNodeState_e newstate(NsmNodeState_BaseRunning) ;
- EXPECT_CALL(pMockControlInterface,hookSystemNodeStateChanged(newstate));
- std::ostringstream send;
- send<<"python send2nsm.py nodeState "<<static_cast<std::int32_t>(newstate);
- system(send.str().c_str());
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, nsmChangeApplicationMode)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmApplicationMode_e appmode(NsmApplicationMode_Swl) ;
- EXPECT_CALL(pMockControlInterface,hookSystemNodeApplicationModeChanged(appmode));
- std::ostringstream send;
- send<<"python send2nsm.py appMode "<<static_cast<std::int32_t>(appmode);
- system(send.str().c_str());
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, nsmChangeSessionState)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- std::string sessionName("mySession");
- NsmSeat_e seatID(NsmSeat_CoDriver);
- NsmSessionState_e sessionState(NsmSessionState_Inactive) ;
- EXPECT_CALL(pMockControlInterface,hookSystemSessionStateChanged(sessionName,seatID,sessionState));
- std::ostringstream send;
- send<<"python send2nsm.py sessionState "<<sessionName<<" "<<static_cast<std::int32_t>(seatID)<<" "<<static_cast<int32_t>(sessionState);
- system(send.str().c_str());
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getRestartReason)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmRestartReason_e restartReason;
- ASSERT_EQ(E_OK,env->nsmController.nsmGetRestartReasonProperty(restartReason));
- ASSERT_EQ(restartReason,1);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getShutdownReason)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmShutdownReason_e ShutdownReason;
- ASSERT_EQ(E_OK,env->nsmController.nsmGetShutdownReasonProperty(ShutdownReason));
- ASSERT_EQ(ShutdownReason,2);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getWakeUpReason)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmRunningReason_e WakeUpReason;
- ASSERT_EQ(E_OK,env->nsmController.nsmGetRunningReasonProperty(WakeUpReason));
- ASSERT_EQ(WakeUpReason,3);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getNodeState)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmNodeState_e nodeState;
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmGetNodeState(nodeState));
- ASSERT_EQ(nodeState,1);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getApplicationMode)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- NsmApplicationMode_e applicationMode;
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Error,env->nsmController.nsmGetApplicationMode(applicationMode));
- ASSERT_EQ(applicationMode,5);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getSessionState)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- std::string sessionName("mySession");
- NsmSeat_e seatID(NsmSeat_Driver);
- NsmSessionState_e sessionState;
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmGetSessionState(sessionName,seatID,sessionState));
- ASSERT_EQ(sessionState,5);
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, RegisterShutdownClient)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t shutdownmode(1), timeoutMs(100);
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmRegisterShutdownClient(shutdownmode,timeoutMs));
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, receiveLifecycleRequest)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t shutdownmode(1);
- uint32_t timeoutMs(100);
- int32_t Request(1);
- int32_t RequestID(4);
- EXPECT_CALL(pMockControlInterface,hookSystemLifecycleRequest(_,RequestID)).WillOnce(Return(NsmErrorStatus_e::NsmErrorStatus_Ok));
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmRegisterShutdownClient(shutdownmode,timeoutMs));
- std::ostringstream send;
- send << "python send2nsm.py LifecycleRequest "<<Request<<" "<<RequestID;
- system(send.str().c_str());
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, UnRegisterShutdownClient)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t shutdownmode(1),timeoutMs(100);
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmRegisterShutdownClient(shutdownmode,timeoutMs));
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmUnRegisterShutdownClient(shutdownmode));
-
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, sendLifecycleRequestComplete)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t RequestID(22);
- NsmErrorStatus_e errorStatus(NsmErrorStatus_Internal);
- ASSERT_EQ(NsmErrorStatus_e::NsmErrorStatus_Ok,env->nsmController.nsmSendLifecycleRequestComplete(RequestID,errorStatus));
-}
-
-TEST_F(CAmNodeStateCommunicatorTest, getInterfaceVersion)
-{
- env->pControlInterfaceBackdoor.replaceController(&env->pControlSender,&pMockControlInterface);
- uint32_t version(0);
- ASSERT_EQ(E_OK,env->nsmController.nsmGetInterfaceVersion(version));
- ASSERT_EQ(version,static_cast<uint32_t>(23));
-}
-
-void CAmNodeStateCommunicatorTest::SetUp()
-{
-}
-
-void CAmNodeStateCommunicatorTest::TearDown()
-{
-}
-
-int main(int argc, char **argv)
-{
- CAmDltWrapper::instance()->registerApp("nsm", "nsmtest");
- logInfo("nsmtest Test started ");
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::Environment* const env = ::testing::AddGlobalTestEnvironment(new CAmEnvironment);
- (void) env;
- return RUN_ALL_TESTS();
-}
-
-CAmEnvironment::CAmEnvironment() :
- pControlInterfaceBackdoor(),
- pControlSender(),
- iSocketHandler(),
- wrapper(&iSocketHandler,DBusBusType::DBUS_BUS_SESSION),
- nsmController(&wrapper)
-{
- env=this;
-}
-
-CAmEnvironment::~CAmEnvironment()
-{
-}
-
-void CAmEnvironment::SetUp()
-{
- //create the nsm thread
- pthread_create(&pNsmThread, NULL, nsmThread, NULL);
- nsmController.registerControlSender(&pControlSender);
- //create the mainloop thread
- pthread_create(&pMainLoopThread, NULL, mainLoop, (void*)&iSocketHandler);
- printf("[----------] Waiting for interface to be ready....\r\n");
- sleep(2);
-}
-
-void CAmEnvironment::TearDown()
-{
- //end the nsm per dbus
- system("python send2nsm.py finish");
- pthread_join(pNsmThread, NULL);
- //end the mainloop
- iSocketHandler.exit_mainloop();
- pthread_join(pMainLoopThread, NULL);
-}
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CAmNodeStateCommunicatorTest.h b/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CAmNodeStateCommunicatorTest.h
deleted file mode 100644
index 985d594..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CAmNodeStateCommunicatorTest.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, 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 2012
- *
- * \file CAmNodeStateCommunicatorTest.h
- * For further information see http://www.genivi.org/.
- *
- */
-#ifndef CAMNODESTATECOMMUNICATORTEST_H_
-#define CAMNODESTATECOMMUNICATORTEST_H_
-
-#include "CAmNodeStateCommunicatorDBus.h"
-#include "CAmControlSender.h"
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-#include "../IAmControlBackdoor.h"
-#include "../MockIAmControlSend.h"
-
-using namespace testing;
-using namespace am;
-
-class CAmEnvironment : public ::testing::Environment
-{
-public:
- IAmControlBackdoor pControlInterfaceBackdoor;
- CAmControlSender pControlSender;
- CAmSocketHandler iSocketHandler;
- CAmDbusWrapper wrapper;
- CAmNodeStateCommunicatorDBus nsmController;
- pthread_t pNsmThread, pMainLoopThread;
- CAmEnvironment();
- ~CAmEnvironment();
- void SetUp();
- // Override this to define how to tear down the environment.
- void TearDown();
-};
-
-class CAmNodeStateCommunicatorTest:public ::testing::Test
-{
-public:
- MockIAmControlSend pMockControlInterface;
- CAmNodeStateCommunicatorTest();
- virtual ~CAmNodeStateCommunicatorTest();
- void SetUp();
- void TearDown();
-};
-
-
-#endif /* CAMNODESTATECOMMUNICATORTEST_H_ */
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CMakeLists.txt b/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CMakeLists.txt
deleted file mode 100644
index 29e0e4e..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/CMakeLists.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright (c) 2012 GENIVI Alliance
-# Copyright (c) 2012 BMW
-#
-# author Christian Linke, christian.linke@bmw.de BMW 2011,2012
-#
-# copyright
-# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
-# including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
-# THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# For further information see http://www.genivi.org/.
-#
-
-cmake_minimum_required(VERSION 2.8.8)
-
-project(AmNodeStateCommunicatorDBusTest)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1")
-
-find_package(Threads)
-find_package(CommonAPI REQUIRED)
-find_package(PythonLibs REQUIRED)
-
-set (AM_LINK_LIBS
- ${CMAKE_DL_LIBS}
- rt)
-
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
- set (AM_LINK_LIBS
- ${AM_LINK_LIBS}
- ${DLT_LIBRARIES})
-endif(WITH_DLT)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${PYTHON_INCLUDE_DIRS}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
- ${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDE_FOLDER}
-)
-
-file(GLOB NODESTATECOMMUNICATOR
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseHandler.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDatabaseObserver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRoutingReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmDbusWrapper.cpp"
- "${AUDIOMANAGER_UTILITIES_SRC}/CAmDltWrapper.cpp"
- "${AUDIOMANAGER_UTILITIES_SRC}/CAmSocketHandler.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmNodeStateCommunicatorDBus.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmControlSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandSender.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmCommandReceiver.cpp"
- "${AUDIOMANAGER_DAEMON_FOLDER}/src/CAmRouter.cpp"
- "../CAmCommonFunctions.cpp"
- "*.cpp"
- )
-
-ADD_EXECUTABLE(AmNodeStateCommunicatorDBusTest ${NODESTATECOMMUNICATOR})
-
-TARGET_LINK_LIBRARIES(AmNodeStateCommunicatorCAPITest
- ${AM_LINK_LIBS}
- ${CMAKE_THREAD_LIBS_INIT}
- ${PYTHON_LIBRARY}
- ${COMMON_API_LIBRARIES}
- ${COMMON_API_DBUS_LIBRARIES}
- gtest
- gmock
-)
-
-ADD_DEPENDENCIES(AmNodeStateCommunicatorDBusTest gtest gmock)
-
-INSTALL(TARGETS AmNodeStateCommunicatorDBusTest
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
-INSTALL(FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/org.genivi.NodeStateManager.Consumer.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/nsm.py
- ${CMAKE_CURRENT_SOURCE_DIR}/send2nsm.py
- DESTINATION ${TEST_EXECUTABLE_INSTALL_PATH}
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
-IF(USE_BUILD_LIBS)
- execute_process(
- COMMAND mkdir -p ${EXECUTABLE_OUTPUT_PATH}
- COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/org.genivi.NodeStateManager.Consumer.xml" ${EXECUTABLE_OUTPUT_PATH}/org.genivi.NodeStateManager.Consumer.xml
- COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/nsm.py" ${EXECUTABLE_OUTPUT_PATH}/nsm.py
- COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/send2nsm.py" ${EXECUTABLE_OUTPUT_PATH}/send2nsm.py)
-ENDIF(USE_BUILD_LIBS)
-
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/nsm.py b/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/nsm.py
deleted file mode 100644
index 7a02d05..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/nsm.py
+++ /dev/null
@@ -1,179 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012, 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 2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-import sys
-import traceback
-import gobject
-import math
-import dbus
-import dbus.service
-import dbus.mainloop.glib
-
-loop = gobject.MainLoop()
-dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-
-class NodeStateManager(dbus.service.Object):
- def __init__(self, loop):
- busName = dbus.service.BusName('org.genivi.NodeStateManager', bus = dbus.SessionBus())
- dbus.service.Object.__init__(self, busName, '/org/genivi/NodeStateManager')
- self.properties = {'RestartReason': 1, 'ShutdownReason': 2, 'WakeUpReason' :3, 'BootMode' :4}
- self.ABus=""
- self.APath=""
- self.loop=loop
-
- @dbus.service.method(dbus_interface='org.freedesktop.DBus.Introspectable', out_signature = 's')
- def Introspect(self):
- f = open('org.genivi.NodeStateManager.Consumer.xml', "r")
- text = f.read()
- return text
-
- @dbus.service.method(dbus_interface='org.genivi.NodeStateManager.Consumer', out_signature = 'ii')
- def GetNodeState(self):
- NodeStateId=1
- ErrorCode=1
- print('[----------] send out nodeState' + str(NodeStateId) + ' ErrorCode '+ str(1))
- return NodeStateId, ErrorCode
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', out_signature = 'ii')
- def GetApplicationMode(self):
- ApplicationModeId=5
- ErrorCode=2
- print('[----------] send out ApplicationMode' + str(ApplicationModeId) + ' ErrorCode '+ str(2))
- return ApplicationModeId, ErrorCode
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', in_signature='si', out_signature = 'ii')
- def GetSessionState(self,SessionName,seatID):
- SessionState=0
- ErrorCode=2
-
- if SessionName=="mySession" and seatID==1:
- SessionState=5
- ErrorCode=1
-
- print('[----------] GetSessionState for session ' + SessionName + ' seatID '+ str(seatID) + ' returnState ' + str (SessionState))
- return SessionState, ErrorCode
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', in_signature='ssuu', out_signature = 'i')
- def RegisterShutdownClient(self,BName,ObjName,ShutdownMode,TimeoutMs):
- print('[----------] Busname: ' + BName)
- print('[----------] ObjName: ' + ObjName)
- print('[----------] ShutdownMode: ' + str(ShutdownMode))
- print('[----------] TimeoutMs: ' + str(TimeoutMs))
- ErrorCode=1
- if TimeoutMs!=100:
- ErrorCode=3
- if BName!="org.genivi.audiomanager":
- ErrorCode=4
- if ShutdownMode!=1:
- ErrorCode=5
- if ObjName!="/org/genivi/audiomanager/LifeCycleConsumer":
- ErrorCode=6
- self.ABus=BName
- self.APath=ObjName
- return ErrorCode
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', in_signature='ssu', out_signature = 'i')
- def UnRegisterShutdownClient(self,BusName,ObjName,ShutdownMode):
- print('[----------] Busname: ' + str(BusName))
- print('[----------] ObjName: ' + str(ObjName))
- print('[----------] ShutdownMode: ' + str(ShutdownMode))
- ErrorCode=1
- if BusName!=self.ABus:
- ErrorCode=2
- if ObjName!=self.APath:
- ErrorCode=2
- if ShutdownMode!=1:
- ErrorCode=2
- return ErrorCode
-
- @dbus.service.method(dbus_interface='org.genivi.NodeStateManager.Consumer', out_signature = 'u')
- def GetInterfaceVersion(self):
- version=23
- return version
-
- @dbus.service.method('org.genivi.NodeStateManager.Consumer', in_signature='ui', out_signature='i')
- def LifecycleRequestComplete(self,RequestID,Status):
- print('[----------] RequestId: ' + str(RequestID))
- print('[----------] Status: ' + str(Status))
- ErrorCode=1
- if RequestID!=22:
- ErrorCode=2
- if Status!=4:
- ErrorCode=2
- return ErrorCode
-
- @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='ss', out_signature='v')
- def Get(self, interface, prop):
- if prop in self.properties:
- print('[----------] send out ' + str(self.properties[prop]) + ' for property '+ prop)
- return self.properties[prop]
- return 0
-
- @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='ssv')
- def Set(self, interface, prop, value):
- return 3
-
- @dbus.service.method(dbus.PROPERTIES_IFACE, in_signature='s', out_signature='a{sv}')
- def GetAll(self, interface):
- return self.properties
-
- @dbus.service.signal(dbus_interface='org.genivi.NodeStateManager.Consumer', signature='i')
- def NodeApplicationMode(self, ApplicationModeId):
- print "[----------] Send out application mode ID %d" % (ApplicationModeId)
-
- @dbus.service.signal(dbus_interface='org.genivi.NodeStateManager.Consumer', signature='i')
- def NodeState(self, NodeState):
- print "[----------] Send out NodeState %d" % (NodeState)
-
- @dbus.service.signal(dbus_interface='org.genivi.NodeStateManager.Consumer', signature='sii')
- def SessionStateChanged(self, SessionStateName,SeatID,SessionState):
- print "[----------] Send out SessionStateChanged " + SessionStateName
-
- @dbus.service.method('org.genivi.NodeStateManager.Control', in_signature='i')
- def sendNodeApplicationMode(self, input):
- self.NodeApplicationMode(input)
- return input
-
- @dbus.service.method('org.genivi.NodeStateManager.Control', in_signature='i')
- def sendNodeState(self, input):
- self.NodeState(input)
- return input
-
- @dbus.service.method('org.genivi.NodeStateManager.Control', in_signature='sii')
- def sendSessionState(self, SessionStateName,SeatID,SessionState):
- self.SessionStateChanged (SessionStateName,SeatID,SessionState)
- return SeatID
-
- @dbus.service.method('org.genivi.NodeStateManager.Control', in_signature='uu', out_signature='i')
- def sendLifeCycleRequest(self, request, requestID):
- bus = dbus.SessionBus()
- remote_object = bus.get_object(self.ABus,self.APath)
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.LifeCycleConsumer')
- iface.LifecycleRequest(request,requestID)
- return 42
-
- @dbus.service.method('org.genivi.NodeStateManager.Control')
- def finish(self):
- print '[----------] Going to exit now!'
- self.loop.quit()
- return 0
-
-nsm = NodeStateManager(loop)
-loop.run()
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/org.genivi.NodeStateManager.Consumer.xml b/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/org.genivi.NodeStateManager.Consumer.xml
deleted file mode 100644
index bb40a96..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/org.genivi.NodeStateManager.Consumer.xml
+++ /dev/null
@@ -1,259 +0,0 @@
-<!-- Auto-Generated interface from Rhapsody: 'Repository::ssw_LifecycleSupport::NodeStateManagement::Concept::Interface::INSM_Consumer' -->
-<!-- Created at 2012-06-01 09:36:05 by uid65904 -->
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
-<interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" direction="out" type="s"/>
- </method>
-</interface>
-<interface name="org.freedesktop.DBus.Properties">
- <method name="Get">
- <arg name="interface" direction="in" type="s"/>
- <arg name="propname" direction="in" type="s"/>
- <arg name="value" direction="out" type="v"/>
- </method>
-
- <method name="Set">
- <arg name="interface" direction="in" type="s"/>
- <arg name="propname" direction="in" type="s"/>
- <arg name="value" direction="in" type="v"/>
- </method>
-
- <method name="GetAll">
- <arg name="interface" direction="in" type="s"/>
- <arg name="props" direction="out" type="a{sv}"/>
- </method>
-</interface>
- <!--
- org.genivi.NodeStateManager.Consumer:
- @short_description: "Consumer" interface of the NodeStateManager.
-
- This interface contains functions which are not safety critical and can be accessed by "every" client without further restrictions.
- -->
- <interface name="org.genivi.NodeStateManager.Consumer">
- <!--
- RestartReason: This property informs clients about the reason for the last restart. The values are based upon the enummeration NsmRestartReason_e. Note: The value is only set once at start-up.
- -->
- <property name="RestartReason" type="i" access="read"/>
-
- <!--
- ShutdownReason: This property informs clients about the reason for the last shutdown. The values are based upon the enummeration NsmShutdownReason_e. Note: The value is only set once at start-up.
- -->
- <property name="ShutdownReason" type="i" access="read"/>
-
- <!--
- WakeUpReason: This property informs clients about the recent reason for waking up the target. The values are based upon the enummeration NsmWakeUpReason_e. Note: The value is only set once at start-up.
- -->
- <property name="WakeUpReason" type="i" access="read"/>
-
- <!--
- BootMode: This property informs clients about the recent BootMode of the target. The values will be defined by a third party header, which has not been delivered yet. The description needs to be updated as soon as the header is available.
- -->
- <property name="BootMode" type="i" access="read"/>
-
- <!--
- NodeState:
- @NodeState: Numeric value for the current NodeState, defined in NsmNodeState_e.
-
- Clients can register for notifications when the NodeState is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeState as a parameter.
- -->
- <signal name="NodeState">
- <arg name="NodeState" type="i"/>
- </signal>
-
- <!--
- NodeApplicationMode:
- @ApplicationModeId: Numeric value for the current ApplicationMode, defined in NsmAplicationMode_e.
-
- Clients can register for notifications when the NodeApplicationMode is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeApplicationMode as a parameter.
- -->
- <signal name="NodeApplicationMode">
- <arg name="ApplicationModeId" type="i"/>
- </signal>
-
- <!--
- SessionStateChanged:
- @SessionStateName: The SessionName will be based upon either the pre-defined platform SessionNames or using a newly added product defined session name.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.
-
- This signal is sent to registered clients when a particular session is state is changed. The client can register for notification about a specific session through the use of the SessionName, as a "match rule".
- -->
- <signal name="SessionStateChanged">
- <arg name="SessionStateName" type="s"/>
- <arg name="SeatID" type="i"/>
- <arg name="SessionState" type="i"/>
- </signal>
-
- <!--
- GetNodeState:
- @NodeStateId: Will be based on the NsmNodeState_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to get the NodeState without the need of registration to the signal.
- -->
- <method name="GetNodeState">
- <arg name="NodeStateId" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- SetSessionState:
- @SessionName: The SessionName will be based upon either the pre-defined platform SessionNames (see NSM content page) or using a newly added product defined session name.
- @SessionOwner: This parameter defines the name of the application that is setting the state of the session. This must be the applications systemd unit filename.
- @SeatID: This parameter will be based upon the enum NsmSeat_e
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by applications to set the state of a session.
- -->
- <method name="SetSessionState">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetSessionState:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by applications to get the state of a session.
- -->
- <method name="GetSessionState">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetApplicationMode:
- @ApplicationModeId: This parameter will be based upon the NsmNodeApplicationMode_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to get the application mode.
- -->
- <method name="GetApplicationMode">
- <arg name="ApplicationModeId" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- RegisterShutdownClient:
- @BusName: Bus name of remote application.
- @ObjName: Object name of remote object that provides the shutdown interface.
- @ShutdownMode: Shutdown mode for which client wants to be informed (i.e normal, fast etc).
- @TimeoutMs: Max. Timeout to wait for response from shutdown client in ms.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to register themselves as shutdown client. Any client that registers must provide a method in their D-Bus object called "LifecycleRequest". This method will take one parameter which is the RequestType (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST). For an example of the required client interface please see the BootManager component who will be a client of the NSM.
- -->
- <method name="RegisterShutdownClient">
- <arg name="BusName" direction="in" type="s"/>
- <arg name="ObjName" direction="in" type="s"/>
- <arg name="ShutdownMode" direction="in" type="u"/>
- <arg name="TimeoutMs" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- UnRegisterShutdownClient:
- @BusName: Bus name of remote application.
- @ObjName: Object name of remote object that provides the shutdown interface.
- @ShutdownMode: Shutdown mode for which client wants to unregister (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST).
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to unregister themselves as shutdown client.
- -->
- <method name="UnRegisterShutdownClient">
- <arg name="BusName" direction="in" type="s"/>
- <arg name="ObjName" direction="in" type="s"/>
- <arg name="ShutdownMode" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- RegisterSession:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SessionOwner: This is the name of the application that is registering the new session (this must be the applications systemd unit filename).
- @SeatID: This parameter will be based upon the enum NsmSeatId_e
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to register a new session whose state should be observed and distributed by the NSM.
- -->
- <method name="RegisterSession">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- UnRegisterSession:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SessionOwner: This is the name of the application that originally registered the session. It will be validated that this value matches the stored value from the registration.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to remove a new session from the session list hosted by NSM.
- -->
- <method name="UnRegisterSession">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetAppHealthCount:
- @Count: Return value passed to the caller. Number of applications that crashed or terminated accidentally.
-
- The method returns the number of applications that crashed or terminated accidentally, within the current life cycle. It can be used to observe the system state.
- -->
- <method name="GetAppHealthCount">
- <arg name="Count" direction="out" type="u"/>
- </method>
-
- <!--
- GetInterfaceVersion:
- @Version: Unsigned integer that represents the version number of the Node State Manager.
-
- The method returns the version number of the Node State Manager. The number is organized in four bytes:
-
- Version: VVV.RRR.PPP.BBB
-
- <literallayout>
- VVV => Version [1..255]
- RRR => Release [0..255]
- PPP => Patch [0..255]
- BBB => Build [0..255]
- </literallayout>
- -->
- <method name="GetInterfaceVersion">
- <arg name="Version" direction="out" type="u"/>
- </method>
-
- <!--
- LifecycleRequestComplete:
- @RequestId: The request Id of the called life cycle client. The value has been passed when "LifecycleRequest" was called.
- @Status: The result of the call to "LifecycleRequest". NsmErrorStatus_Ok: Request successfully processed. NsmErrorStatus_Error: An error occured while processing the "LifecycleRequest".
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The function has to be called by a "asynchrounous" lifecycle client, when he processed the "LifecycleRequest".
- -->
- <method name="LifecycleRequestComplete">
- <arg name="RequestId" direction="in" type="u"/>
- <arg name="Status" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
- </interface>
-</node>
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/send2nsm.py b/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/send2nsm.py
deleted file mode 100644
index c7e8bf5..0000000
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorDBusTest/send2nsm.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012, 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 2012
-#
-# For further information see http://www.genivi.org/.
-#
-
-import sys
-import traceback
-import gobject
-import math
-import dbus
-import dbus.service
-
-def nodeState (nodeState):
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.sendNodeState(int(nodeState))
-
-def appMode (appMode):
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.sendNodeApplicationMode(int(appMode))
-
-def sessionState (SessionStateName,SeatID,SessionState):
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.sendSessionState(SessionStateName,int(SeatID),int(SessionState))
-
-def finish():
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.finish()
-
-def LifecycleRequest(Request,RequestID):
- bus = dbus.SessionBus()
- remote_object = bus.get_object('org.genivi.NodeStateManager','/org/genivi/NodeStateManager')
- iface = dbus.Interface(remote_object, 'org.genivi.NodeStateManager.Control')
- iface.sendLifeCycleRequest(dbus.UInt32(Request),dbus.UInt32(RequestID))
-
-command=sys.argv[1]
-if command=="nodeState":
- nodeState(sys.argv[2])
-if command=="finish":
- finish()
-if command=="appMode":
- appMode(sys.argv[2])
-if command=="sessionState":
- sessionState(sys.argv[2],sys.argv[3],sys.argv[4])
-if command=="LifecycleRequest":
- LifecycleRequest(sys.argv[2],sys.argv[3])
diff --git a/AudioManagerDaemon/test/CMakeLists.txt b/AudioManagerDaemon/test/CMakeLists.txt
index 5460897..a52f5ae 100644
--- a/AudioManagerDaemon/test/CMakeLists.txt
+++ b/AudioManagerDaemon/test/CMakeLists.txt
@@ -36,14 +36,6 @@ add_subdirectory (AmRouterMapTest)
add_subdirectory (AmRoutingInterfaceTest)
add_subdirectory (AmSocketHandlerTest)
-IF(WITH_NSM)
- IF(WITH_DBUS_WRAPPER)
- add_subdirectory (AmNodeStateCommunicatorDBusTest)
- ELSEIF(WITH_CAPI_WRAPPER)
- add_subdirectory (AmNodeStateCommunicatorCAPITest)
- ENDIF()
-ENDIF(WITH_NSM)
-
IF(WITH_TELNET)
add_subdirectory (AmTelnetServerTest)
ENDIF(WITH_TELNET)
diff --git a/AudioManagerDaemon/test/MockIAmControlSend.h b/AudioManagerDaemon/test/MockIAmControlSend.h
index 46329e1..e628068 100644
--- a/AudioManagerDaemon/test/MockIAmControlSend.h
+++ b/AudioManagerDaemon/test/MockIAmControlSend.h
@@ -151,14 +151,6 @@ class MockIAmControlSend : public IAmControlSend {
am_Error_e(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration));
MOCK_METHOD2(hookUserSetMainSourceNotificationConfiguration,
am_Error_e(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration));
- MOCK_METHOD1(hookSystemNodeStateChanged,
- void(const NsmNodeState_e NodeStateId));
- MOCK_METHOD1(hookSystemNodeApplicationModeChanged,
- void(const NsmApplicationMode_e ApplicationModeId));
- MOCK_METHOD3(hookSystemSessionStateChanged,
- void(const std::string& sessionName, const NsmSeat_e seatID, const NsmSessionState_e sessionStateID));
- MOCK_METHOD2(hookSystemLifecycleRequest,
- NsmErrorStatus_e(const uint32_t Request, const uint32_t RequestId));
MOCK_METHOD2(hookSystemSingleTimingInformationChanged,
void(const am_connectionID_t connectionID, const am_timeSync_t time));
};
diff --git a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h
index ce02a44..fd5a784 100644
--- a/AudioManagerUtilities/include/CAmCommonAPIWrapper.h
+++ b/AudioManagerUtilities/include/CAmCommonAPIWrapper.h
@@ -26,11 +26,6 @@
#include <memory>
#include <cassert>
#include <CommonAPI/CommonAPI.hpp>
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#include <CommonAPI/MainLoopContext.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-#endif
#include <CommonAPI/Utils.hpp>
#include "audiomanagerconfig.h"
#include "CAmSocketHandler.h"
diff --git a/AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp b/AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp
index b6ac399..238fa32 100644
--- a/AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp
+++ b/AudioManagerUtilities/src/CAmCommonAPIWrapper.cpp
@@ -30,18 +30,6 @@
#include "CAmDltWrapper.h"
#include "CAmCommonAPIWrapper.h"
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#if COMMONAPI_USED_BINDING > 0
-#include <CommonAPI/SomeIP/Factory.hpp>
-#else
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#endif
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
namespace am
{
@@ -58,42 +46,31 @@ CAmCommonAPIWrapper::CAmCommonAPIWrapper(CAmSocketHandler* socketHandler, const
mWatchToCheck(NULL)
{
assert(NULL!=socketHandler);
-//Get the runtime
-#if COMMONAPI_VERSION_NUMBER < 300
- mRuntime = CommonAPI::Runtime::load();
-#else
+
+ //Get the runtime
CommonAPI::Runtime::setProperty("LogContext", "AMCAPI");
mRuntime = CommonAPI::Runtime::get();
logInfo("CommonAPI runtime has been loaded! Default Binding is", mRuntime->getDefaultBinding());
-#endif
assert(NULL!=mRuntime);
//Create the context
-#if COMMONAPI_VERSION_NUMBER < 300
- mContext = std::make_shared<CommonAPI::MainLoopContext>();
-#else
if(applicationName.size())
mContext = std::make_shared<CommonAPI::MainLoopContext>(applicationName);
else
mContext = std::make_shared<CommonAPI::MainLoopContext>();
-#endif
assert(NULL!=mContext);
logInfo("CommonAPI main loop context with name '", mContext->getName(), "' has been created!");
-#if COMMONAPI_VERSION_NUMBER < 300
- mFactory = mRuntime->createFactory(mContext);
- assert(mFactory);
-#else
- #if COMMONAPI_USED_BINDING > 0
- mFactory = CommonAPI::SomeIP::Factory::get();
- assert(mFactory);
- mRuntime->registerFactory("someip", mFactory);
- #else
- mFactory = CommonAPI::DBus::Factory::get();
- assert(mFactory);
- mRuntime->registerFactory("dbus", mFactory);
- #endif
-#endif
+// #if COMMONAPI_USED_BINDING > 0
+// mFactory = CommonAPI::SomeIP::Factory::get();
+// assert(mFactory);
+// mRuntime->registerFactory("someip", mFactory);
+// #else
+// mFactory = CommonAPI::DBus::Factory::get();
+// assert(mFactory);
+// mRuntime->registerFactory("dbus", mFactory);
+// #endif
+
//Make subscriptions
mDispatchSourceListenerSubscription = mContext->subscribeForDispatchSources(
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58ca879..2ce1a31 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,12 +32,7 @@ if (NOT ${CMAKE_TOOLCHAIN_FILE} EQUAL "")
endif (NOT ${CMAKE_TOOLCHAIN_FILE} EQUAL "")
find_package(PkgConfig)
-
-#we need this anyway - even if not installed, then we take our stuff.
-find_package(NSM REQUIRED)
-
-set(WITH_ENABLED_IPC "CAPI" CACHE STRING "Disable 'NONE' / Enable Common-API 'CAPI' or Dbus 'DBUS' Support")
-set_property(CACHE WITH_ENABLED_IPC PROPERTY STRINGS "NONE" "CAPI" "DBUS")
+find_package(CommonAPI)
option( WITH_TESTS
"Build together with all available unitTest" ON )
@@ -63,37 +58,17 @@ option ( USE_BUILD_LIBS
option ( GLIB_DBUS_TYPES_TOLERANT
"Build dbus with tolerance towards glib 16bit/32bit handling" ON)
-option( WITH_NSM
- "build with NSM support" OFF)
-
- option ( WITH_DATABASE_STORAGE
+option ( WITH_DATABASE_STORAGE
"Build with sqlite as in memory storage" OFF)
+option ( WITH_CAPI_WRAPPER
+ "Build with commonapi wrapper" ON)
+
+option ( WITH_DBUS_WRAPPER
+ "Build with Dbus wrapper" ON)
+
set (WITH_COMMON_API_GEN ON CACHE INTERNAL "hide this!" FORCE)
-if (WITH_ENABLED_IPC STREQUAL "DBUS")
- set (WITH_DBUS_WRAPPER ON CACHE INTERNAL "hide this!" FORCE)
- set (WITH_CAPI_WRAPPER OFF CACHE INTERNAL "hide this!" FORCE)
- unset(USE_CAPI_BINDING CACHE)
-elseif(WITH_ENABLED_IPC STREQUAL "CAPI")
- set (WITH_CAPI_WRAPPER ON CACHE INTERNAL "hide this!" FORCE)
- set (WITH_DBUS_WRAPPER OFF CACHE INTERNAL "hide this!" FORCE)
- set (USE_CAPI_BINDING "DBUS" CACHE STRING "Select prefered binding for common-api 'DBUS' or 'SOMEIP'")
- set_property(CACHE USE_CAPI_BINDING PROPERTY STRINGS "DBUS" "SOMEIP")
-elseif(WITH_ENABLED_IPC STREQUAL "NONE")
- set (WITH_CAPI_WRAPPER OFF CACHE INTERNAL "hide this!" FORCE)
- set (WITH_DBUS_WRAPPER OFF CACHE INTERNAL "hide this!" FORCE)
- unset(USE_CAPI_BINDING CACHE)
-endif ()
-
-if (USE_CAPI_BINDING STREQUAL "SOMEIP")
- set(COMMONAPI_USED_BINDING 1 CACHE INTERNAL "hide this!" FORCE)
-elseif (USE_CAPI_BINDING STREQUAL "DBUS")
- set(COMMONAPI_USED_BINDING 0 CACHE INTERNAL "hide this!" FORCE)
-else()
- unset(COMMONAPI_USED_BINDING CACHE)
-endif()
-
set(DBUS_SERVICE_PREFIX "org.genivi.audiomanager"
CACHE PROPERTY "The dbus service prefix for the AM - only changable for legacy dbus")
@@ -106,15 +81,6 @@ set(DEFAULT_TELNETPORT 6080
set(MAX_TELNETCONNECTIONS 3
CACHE INTEGER "The maximum of allowed telnet connections, only valid if TELNET is ON")
-set(NSM_BUS_INTERFACE "org.genivi.NodeStateManager"
- CACHE PROPERTY "The Dbus interface of the NSM - only relevant for legacy dbus" )
-
-set(NSM_PATH "/org/genivi/NodeStateManager"
- CACHE PROPERTY "The Dbus path of the NSM - only relevant for legacy dbus")
-
-set(NSM_INTERFACE "org.genivi.NodeStateManager.Consumer"
- CACHE PROPERTY "The NSM interface - only relevant for legacy dbus")
-
set(DYNAMIC_ID_BOUNDARY 100
CACHE INTEGER "The ID boundary between static and dynamic ID ranges")
@@ -180,34 +146,10 @@ else(USE_BUILD_LIBS)
endif(USE_BUILD_LIBS)
-if (WITH_ENABLED_IPC STREQUAL "NONE")
- set (ENABLE_NSM OFF)
-else ()
- set (ENABLE_NSM ON)
-endif ()
-
-if (NOT WITH_DBUS_WRAPPER AND NOT WITH_CAPI_WRAPPER)
- set (WITH_NSM OFF)
-endif (NOT WITH_DBUS_WRAPPER AND NOT WITH_CAPI_WRAPPER)
-
-
if(USE_BUILD_LIBS)
execute_process(COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/bin")
endif(USE_BUILD_LIBS)
-if(WITH_NSM AND WITH_DBUS_WRAPPER)
- if(USE_BUILD_LIBS)
- set(NSM_INTROSPECTION_FILE ${EXECUTABLE_OUTPUT_PATH}/bin/LifeCycleConsumer.xml)
- execute_process(COMMAND cp "${CMAKE_SOURCE_DIR}/Foo/LifecycleConsumer.xml" ${NSM_INTROSPECTION_FILE})
- else(USE_BUILD_LIBS)
- set(NSM_INTROSPECTION_FILE ${AM_SHARE_FOLDER}/LifecycleConsumer.xml)
- INSTALL(
- FILES ${CMAKE_SOURCE_DIR}/Foo/LifecycleConsumer.xml
- DESTINATION "${NSM_INTROSPECTION_FILE}"
- COMPONENT bin)
- endif(USE_BUILD_LIBS)
-endif(WITH_NSM AND WITH_DBUS_WRAPPER)
-
if(WITH_DLT)
pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
add_definitions(${DLT_CFLAGS_OTHER})
@@ -248,8 +190,6 @@ configure_file( ${CMAKE_SOURCE_DIR}/cmake/audiomanager.pc.in ${CMAKE_BINARY_DIR}
install(FILES ${CMAKE_BINARY_DIR}/audiomanager.pc DESTINATION lib/pkgconfig COMPONENT devel)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/audiomanagerConfig.cmake
- ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CommonAPI.cmake
- ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindNSM.cmake
DESTINATION lib/${LIB_INSTALL_SUFFIX}/cmake
COMPONENT dev)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/audiomanagerconfig.h
diff --git a/Foo/LifecycleConsumer.xml b/Foo/LifecycleConsumer.xml
deleted file mode 100644
index ec1162b..0000000
--- a/Foo/LifecycleConsumer.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<node>
- <!--
- org.genivi.NodeStateManager.LifeCycleConsumer:
- @short_description: Interface of a life cycle client.
-
- This interface contains functions, which need to be implemented by life cycle clients, to be able to receive life cycle requests.
- -->
- <interface name="org.genivi.NodeStateManager.LifeCycleConsumer">
- <!--
- LifecycleRequest:
- @Request: The type of the life cycle request. Can be NSM_SHUTDOWNTYPE_RUNUP, NSM_SHUTDOWNTYPE_NORMAL or NSM_SHUTDOWNTYPE_FAST.
- @RequestId: The Id of the client (current request). This Id needs to be passed to the NSM again via the interface "LifecycleRequestComplete", when the client has processed the "LifecycleRequest".
- @ErrorCode: Client's return value, passed to the NodeStateManager. Based upon NsmErrorStatus_e. NsmErrorStatus_Ok: Request was successfully processed. NsmErrorStatus_ResponsePending: Processing of request started. LifecycleRequestComplete will be called to pass the status after completion. NsmErrorStatus_Error: An error occured, the request could not be processed.
-
- The method has to be implemented by every life cycle client and is called by the NodeStateManager, when the node is shutting down (fast or normal) or an ongoing shutdown is cancelled (run up).
- -->
- <method name="LifecycleRequest">
- <arg name="Request" direction="in" type="u"/>
- <arg name="RequestId" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
- </interface>
-</node>
diff --git a/README b/README
index 6d06625..07ab941 100755
--- a/README
+++ b/README
@@ -95,8 +95,7 @@ These are the compile options with default values:
WITH_DATABASE_STORAGE OFF
WITH_DLT ON
WITH_DOCUMENTATION OFF
- WITH_ENABLED_IPC CAPI
- WITH_NSM OFF
+ WITH_ENABLED_IPC CAPI
WITH_SYSTEMD_WATCHDOG OFF
WITH_TELNET ON
WITH_TESTS ON
diff --git a/cmake/CommonAPI.cmake b/cmake/CommonAPI.cmake
deleted file mode 100644
index a97d75c..0000000
--- a/cmake/CommonAPI.cmake
+++ /dev/null
@@ -1,299 +0,0 @@
-#
-# Find common-api sources
-#
-# This module defines these variables:
-#
-# ${PARAMS_TARGET}_GEN_HEADERS
-# A list with generated headers
-# ${PARAMS_TARGET}_GEN_SOURCES
-# A list with generated sources
-# ${PARAMS_TARGET}_GEN_INCLUDE_DIR
-# A list with include directories
-
-include(CMakeParseArguments)
-
-
-MACRO(LOAD_COMMONAPI)
- #parse the input parameters
- set(options DBUS SOMEIP)
- set(oneValueArgs "")
- set(multiValueArgs "")
- cmake_parse_arguments(PARAMS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- if(PARAMS_DBUS)
- SET(COMMONAPI_USED_BINDING 0 CACHE INTERNAL "hide this!" FORCE)
- elseif(PARAMS_SOMEIP)
- SET(COMMONAPI_USED_BINDING 1 CACHE INTERNAL "hide this!" FORCE)
- endif()
-
- # load the proper libs ...
- IF(NOT CommonAPI_FOUND)
- FIND_PACKAGE(CommonAPI REQUIRED)
- FIND_LIBRARY(CommonAPI_LIBRARY
- REQUIRED
- NAMES CommonAPI
- PATHS
- "/usr/local/lib"
- "/usr/lib"
- )
- ENDIF(NOT CommonAPI_FOUND)
- message(STATUS "CommonAPI Version: ${CommonAPI_VERSION}")
-
- string(REPLACE "." "" COMMONAPI_VERSION_NUMBER ${CommonAPI_VERSION})
- SET(COMMONAPI_VERSION_NUMBER ${COMMONAPI_VERSION_NUMBER} CACHE INTERNAL "hide this!" FORCE)
- SET(CommonAPI_VERSION ${CommonAPI_VERSION} PARENT_SCOPE)
-
- IF(${COMMONAPI_USED_BINDING} EQUAL 1)
- IF(NOT CommonAPI-SomeIP_FOUND)
- FIND_PACKAGE (vsomeip REQUIRED)
- FIND_PACKAGE(CommonAPI-SomeIP REQUIRED)
- FIND_LIBRARY(CommonAPI-SomeIP_LIBRARY
- REQUIRED
- NAMES CommonAPI-SomeIP
- PATHS
- "/usr/local/lib"
- "/usr/lib"
- )
-
- ENDIF(NOT CommonAPI-SomeIP_FOUND)
- message(STATUS "CommonAPI-SomeIP Version: ${CommonAPI-SomeIP_VERSION}")
-
- string(REPLACE "." "" COMMONAPI_SOMEIP_VERSION_NUMBER ${CommonAPI-SomeIP_VERSION})
- SET(COMMONAPI_SOMEIP_VERSION_NUMBER ${COMMONAPI_SOMEIP_VERSION_NUMBER} CACHE INTERNAL "hide this!" FORCE)
- ELSE()
- SET(COMMONAPI_USED_BINDING 0 CACHE INTERNAL "hide this!" FORCE)
- IF(NOT CommonAPI-DBus_FOUND)
- pkg_check_modules (DBUS "dbus-1 >= 1.4" REQUIRED)
- FIND_PACKAGE(CommonAPI-DBus REQUIRED)
- FIND_LIBRARY(CommonAPI-DBus_LIBRARY
- REQUIRED
- NAMES CommonAPI-DBus
- PATHS
- "/usr/local/lib"
- "/usr/lib"
- )
- ENDIF(NOT CommonAPI-DBus_FOUND)
- message(STATUS "CommonAPI-DBus Version: ${CommonAPI-DBus_VERSION}")
-
- string(REPLACE "." "" COMMONAPI_DBUS_VERSION_NUMBER ${CommonAPI-DBus_VERSION})
- SET(COMMONAPI_DBUS_VERSION_NUMBER ${COMMONAPI_DBUS_VERSION_NUMBER} CACHE INTERNAL "hide this!" FORCE)
- ENDIF()
-
-ENDMACRO()
-
-# helper function giving a string with the current architecture
-function(GET_TARGET_ARCH OUT_ARCH)
- IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(${OUT_ARCH} "x86_64" PARENT_SCOPE)
- ELSE()
- SET(${OUT_ARCH} "x86" PARENT_SCOPE)
- ENDIF()
-endfunction()
-
-# helper function giving a string with the current host
-function(GET_TARGET_HOST OUT_HOST)
- IF(CMAKE_HOST_WIN32)
- SET(${OUT_HOST} "windows" PARENT_SCOPE)
- ELSE()#CMAKE_HOST_UNIX
- SET(${OUT_HOST} "linux" PARENT_SCOPE)
- ENDIF()
-endfunction()
-
-# get lists with headers and sources after they has been generated
-macro(GET_GENERATED_FILES GEN_DESTINATION)
-
- #searching for generated headers
- execute_process(COMMAND find ${GEN_DESTINATION} -name *.hpp
- RESULT_VARIABLE EXIT_CODE
- OUTPUT_VARIABLE _CAPI_HEADERS
- ERROR_VARIABLE CAPI_HEADERS_ERROR
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_STRIP_TRAILING_WHITESPACE)
-
- IF(CAPI_HEADERS_ERROR)
- MESSAGE(FATAL_ERROR "Can't find common-api generated headers!")
- ENDIF()
- string(REPLACE "\n" ";" CAPI_HEADERS ${_CAPI_HEADERS})
-
- FOREACH(INCLUDE_ITER ${CAPI_HEADERS})
- GET_FILENAME_COMPONENT(TEMP_PATH ${INCLUDE_ITER} PATH)
- SET(CAPI_INCLUDES ${CAPI_INCLUDES} ${TEMP_PATH})
- ENDFOREACH(INCLUDE_ITER ${CAPI_HEADERS})
- LIST(REMOVE_DUPLICATES CAPI_INCLUDES)
-
- #searching for generated sources
- execute_process(COMMAND find ${GEN_DESTINATION} -name *.cpp
- RESULT_VARIABLE EXIT_CODE
- OUTPUT_VARIABLE _CAPI_SOURCES
- ERROR_VARIABLE CAPI_SOURCES_ERROR
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_STRIP_TRAILING_WHITESPACE)
- IF(CAPI_SOURCES_ERROR)
- MESSAGE(FATAL_ERROR "Can't find common-api generated sources!")
- ENDIF()
- string(REPLACE "\n" ";" CAPI_SOURCES ${_CAPI_SOURCES})
- LIST(REMOVE_DUPLICATES CAPI_SOURCES)
-
- set(${PARAMS_TARGET}_GEN_HEADERS ${CAPI_HEADERS} PARENT_SCOPE)
- set(${PARAMS_TARGET}_GEN_SOURCES ${CAPI_SOURCES} PARENT_SCOPE)
- #add base path src-gen
- SET(${PARAMS_TARGET}_GEN_INCLUDE_DIR ${CAPI_INCLUDES} ${GEN_DESTINATION} PARENT_SCOPE)
-endmacro(GET_GENERATED_FILES)
-
-macro(FIND_AND_EXEC_GENERATOR GENERATOR_EXECUTABLE SHOULD_GENERATE_STUB_DEFAULT FIDLS)
- MESSAGE(STATUS "Searching for common-api generator executable ${GENERATOR_EXECUTABLE} ...")
- # find the generator binary ...
- execute_process(COMMAND find "/usr/local/share/CommonAPI-${CommonAPI_VERSION}" -name ${GENERATOR_EXECUTABLE}
- RESULT_VARIABLE EXIT_CODE
- OUTPUT_VARIABLE OUT_RESULT
- ERROR_VARIABLE OUT_ERROR
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_STRIP_TRAILING_WHITESPACE)
-
- IF(OUT_ERROR)
- # in case of error just try to find the sources in the alternative folder
- SET(TEMP_GEN_DST ${PARAMS_ALT_DESTINATION})
- message(STATUS "Common-api generator error / ${OUT_ERROR} /. Will try the alternative folder!")
- ELSEIF(NOT OUT_RESULT)
- # in case of error just try to find the sources in the alternative folder
- SET(TEMP_GEN_DST ${PARAMS_ALT_DESTINATION})
- message(STATUS "Common-api generator can't be found. Will try the alternative folder!")
- ELSE()
- # the generator binary is found
- MESSAGE(STATUS "Will execute common-api generator at path ${OUT_RESULT} with ${FIDLS}")
- function(mktmpdir OUTVAR)
- while(NOT TEMP_DESTINATION OR EXISTS ${TEMP_DESTINATION})
- string(RANDOM LENGTH 16 TEMP_DESTINATION)
- set(TEMP_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${TEMP_DESTINATION}")
- endwhile()
-
- file(MAKE_DIRECTORY ${TEMP_DESTINATION})
-
- set(${OUTVAR} ${TEMP_DESTINATION} PARENT_SCOPE)
- endfunction()
- # execute the generate command ...
- IF(${SHOULD_GENERATE_STUB_DEFAULT} EQUAL 1)
- execute_process(COMMAND ${OUT_RESULT} -sk Default -d ${PARAMS_DESTINATION} ${FIDLS}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE EXIT_CODE
- OUTPUT_VARIABLE GENERATOR_OUTPUT
- ERROR_VARIABLE GENERATOR_ERR_OUTPUT
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_STRIP_TRAILING_WHITESPACE)
- ELSE()
- execute_process(COMMAND ${OUT_RESULT} -d ${PARAMS_DESTINATION} ${FIDLS}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE EXIT_CODE
- OUTPUT_VARIABLE GENERATOR_OUTPUT
- ERROR_VARIABLE GENERATOR_ERR_OUTPUT
- OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_STRIP_TRAILING_WHITESPACE)
- ENDIF()
- if(EXIT_CODE)
- message(FATAL_ERROR "Failed to generate files from FIDL:${GENERATOR_OUTPUT}")
- elseif(GENERATOR_ERR_OUTPUT)
- message(FATAL_ERROR "Common-API generator error:${GENERATOR_ERR_OUTPUT}")
- endif()
- SET(TEMP_GEN_DST ${PARAMS_DESTINATION})
- ENDIF()
-endmacro(FIND_AND_EXEC_GENERATOR GENERATOR_EXECUTABLE SHOULD_GENERATE_STUB_DEFAULT FIDLS)
-
-# generate common-api sources and retreive a list with them
-MACRO(EXECUTE_GENERATOR)
- # construct the generator binary name...
- GET_TARGET_HOST(_TARGET_HOST)
- GET_TARGET_ARCH(_TARGET_ARCH)
- SET(COMMONAPI_GENERATOR_EXECUTABLE commonapi-generator-${_TARGET_HOST}-${_TARGET_ARCH})
- IF(${COMMONAPI_USED_BINDING} EQUAL 1)
- SET(COMMONAPI_BINDING_GENERATOR_EXECUTABLE commonapi-someip-generator-${_TARGET_HOST}-${_TARGET_ARCH})
- ELSE()
- SET(COMMONAPI_BINDING_GENERATOR_EXECUTABLE commonapi-dbus-generator-${_TARGET_HOST}-${_TARGET_ARCH})
- ENDIF()
- # prepare an additional compatibilty flag for generators prior 3.x.x ...
- IF(${COMMONAPI_VERSION_NUMBER} GREATER 300 OR ${COMMONAPI_VERSION_NUMBER} EQUAL 300)
- # >= 3.x.x the stubs are generated by the binding generator
- SET(GENERATE_STUB 1)
- ELSE()
- # < 3.0.0 the stubs are generated by the genric generator
- SET(GENERATE_STUB 0)
- ENDIF()
- # searching for common-api-generator executable ...
- FOREACH(FIDL ${IN_FIDLS_GENERIC})
- FIND_AND_EXEC_GENERATOR(${COMMONAPI_GENERATOR_EXECUTABLE} ${GENERATE_STUB} ${FIDL})
- ENDFOREACH()
- FOREACH(FIDL ${IN_FIDLS_BINDING})
- FIND_AND_EXEC_GENERATOR(${COMMONAPI_BINDING_GENERATOR_EXECUTABLE} FALSE ${FIDL})
- ENDFOREACH()
- # get the lists with the sources and headers
- message(STATUS "Looking for generated common-api files...")
- GET_GENERATED_FILES(${TEMP_GEN_DST})
-ENDMACRO(EXECUTE_GENERATOR)
-
-# Function COMMON_API_GENERATE_SOUCRES
-#
-# TARGET COMMON_API
-# FIDLS_GENERIC a list with fidls for the generic generator.
-# FIDLS_BINDING a list with fidls for the binding generator.
-# DESTINATION a relative path to the build directory or an absolute path.
-# ALT_DESTINATION an alternative relative/absolute path with common-api sources, usually in the source tree.
-FUNCTION(COMMON_API_GENERATE_SOURCES)
- #parse the input parameters
- set(options "")
- set(oneValueArgs TARGET DESTINATION ALT_DESTINATION HEADER_TEMPLATE)
- set(multiValueArgs FIDLS_GENERIC FIDLS_BINDING)
-
- cmake_parse_arguments(PARAMS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- if(NOT PARAMS_TARGET)
- message(FATAL_ERROR "TARGET must be specified")
- endif()
-
- if(NOT IS_ABSOLUTE ${PARAMS_DESTINATION})
- set(PARAMS_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${PARAMS_DESTINATION})
- endif()
-
- if(NOT IS_ABSOLUTE ${PARAMS_ALT_DESTINATION})
- set(PARAMS_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${PARAMS_ALT_DESTINATION})
- endif()
- # check the cmake option, whether to use the generator or not ...
- IF(NOT WITH_COMMON_API_GEN)
- message(STATUS "Looking for generated common-api files...")
- # check which of the given folders exists and get it as destination
- IF(EXISTS ${PARAMS_DESTINATION})
- GET_GENERATED_FILES(${PARAMS_DESTINATION})
- ELSE()
- GET_GENERATED_FILES(${PARAMS_ALT_DESTINATION})
- ENDIF()
- ELSE()
- if(NOT PARAMS_FIDLS_GENERIC)
- message(FATAL_ERROR "FIDLS must be specified")
- endif()
-
- if(PARAMS_HEADER_TEMPLATE)
- list(APPEND ARGS -pref ${PARAMS_HEADER_TEMPLATE})
- endif()
-
- # Run configure_file on each .fidl which forces cmake to reexecute its configure phase if the input file changes.
- foreach(FIDL ${PARAMS_FIDLS_GENERIC})
- get_filename_component(FIDL_PATH ${FIDL} ABSOLUTE)
- string(MD5 ${FIDL_PATH} FIDL_CHECKSUM)
- configure_file(${FIDL_PATH} ${CMAKE_CURRENT_BINARY_DIR}/${FIDL_CHECKSUM}.fidl.done)
- list(APPEND IN_FIDLS_GENERIC ${FIDL_PATH})
- endforeach()
-
- if(PARAMS_FIDLS_BINDING)
- foreach(FIDL ${PARAMS_FIDLS_BINDING})
- get_filename_component(FIDL_PATH ${FIDL} ABSOLUTE)
- string(MD5 ${FIDL_PATH} FIDL_CHECKSUM)
- configure_file(${FIDL_PATH} ${CMAKE_CURRENT_BINARY_DIR}/${FIDL_CHECKSUM}.fidl.done)
- list(APPEND IN_FIDLS_BINDING ${FIDL_PATH})
- endforeach()
- else()
- SET(IN_FIDLS_BINDING ${IN_FIDLS_GENERIC})
- endif()
-
- # run the generator ...
- EXECUTE_GENERATOR()
- ENDIF()
-ENDFUNCTION()
-
diff --git a/cmake/FindNSM.cmake b/cmake/FindNSM.cmake
deleted file mode 100644
index 1b34c45..0000000
--- a/cmake/FindNSM.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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
- PATHS
- ${CMAKE_INSTALL_PATH}
- "/usr/include"
- "/usr/local/include"
- DOC "The nodestatemanager include directory")
-
-if(NSM_INCLUDE_DIR)
- set (NSM_FOUND "YES")
- 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/cmake/audiomanagerConfig.cmake.in b/cmake/audiomanagerConfig.cmake.in
index a7f4d2c..5da3b13 100644
--- a/cmake/audiomanagerConfig.cmake.in
+++ b/cmake/audiomanagerConfig.cmake.in
@@ -5,7 +5,6 @@ set(AudioManagerVersion @DAEMONVERSION@ )
set(CMAKE_MODULE_PATH "@CMAKE_MODULE_PATH@")
set(DAEMONVERSION "@DAEMONVERSION@")
-set(NSM_INCLUDE_DIR "@NSM_INCLUDE_DIR@")
set(TEST_EXECUTABLE_OUTPUT_PATH "@TEST_EXECUTABLE_OUTPUT_PATH@")
set(TEST_EXECUTABLE_INSTALL_PATH "@TEST_EXECUTABLE_INSTALL_PATH@")
set(AM_SHARE_FOLDER "@AM_SHARE_FOLDER@")
@@ -29,12 +28,7 @@ set(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
set(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
set(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
set(AUDIOMANAGER_UTILITIES_SRC "@AUDIOMANAGER_UTILITIES_SRC@")
-set(WITH_COMMON_API_GEN "@WITH_COMMON_API_GEN@")
-set(WRITE_COMMONAPI_DBUS_CONFIG_FILE "@WRITE_COMMONAPI_DBUS_CONFIG_FILE@")
set(COMMONAPI_VERSION_NUMBER "@COMMONAPI_VERSION_NUMBER@")
-set(COMMONAPI_DBUS_VERSION_NUMBER "@COMMONAPI_DBUS_VERSION_NUMBER@")
-set(COMMONAPI_SOMEIP_VERSION_NUMBER "@COMMONAPI_SOMEIP_VERSION_NUMBER@")
-set(COMMONAPI_USED_BINDING "@COMMONAPI_USED_BINDING@")
IF(WITH_TESTS)
set_and_check(GOOGLE_MOCK_PROJECT_FOLDER "@GOOGLE_MOCK_PROJECT_FOLDER@")
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
index a62ee65..6f26bbc 100644
--- a/cmake/config.cmake.in
+++ b/cmake/config.cmake.in
@@ -12,8 +12,6 @@
#cmakedefine GLIB_DBUS_TYPES_TOLERANT
#cmakedefine WITH_SYSTEMD_WATCHDOG
#cmakedefine SYSTEMD_FOUND
-#cmakedefine WITH_NSM
-
#cmakedefine DEFAULT_PLUGIN_COMMAND_DIR "@DEFAULT_PLUGIN_COMMAND_DIR@"
#cmakedefine DEFAULT_PLUGIN_ROUTING_DIR "@DEFAULT_PLUGIN_ROUTING_DIR@"
@@ -27,10 +25,6 @@
#cmakedefine EXECUTABLE_OUTPUT_PATH "@EXECUTABLE_OUTPUT_PATH@"
-#cmakedefine NSM_BUS_INTERFACE "@NSM_BUS_INTERFACE@"
-#cmakedefine NSM_PATH "@NSM_PATH@"
-#cmakedefine NSM_INTERFACE "@NSM_INTERFACE@"
-#cmakedefine NSM_INTROSPECTION_FILE "@NSM_INTROSPECTION_FILE@"
#cmakedefine AM_SHARE_FOLDER "@AM_SHARE_FOLDER@"
#cmakedefine COMMONAPI_VERSION_NUMBER @COMMONAPI_VERSION_NUMBER@
#cmakedefine COMMONAPI_DBUS_VERSION_NUMBER @COMMONAPI_DBUS_VERSION_NUMBER@
diff --git a/include/IAmControl.h b/include/IAmControl.h
index a95bb05..8220728 100644
--- a/include/IAmControl.h
+++ b/include/IAmControl.h
@@ -30,8 +30,6 @@ namespace am {
class CAmSocketHandler;
}
-#include "NodeStateManager.h"
-
#include "audiomanagertypes.h"
#define ControlVersion "4.0"
@@ -601,58 +599,6 @@ public:
*/
virtual am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
/**
- * Retrieves the Restart Reason Property
- * @return E_OK on success E_UNKNOWN if property could not be retrieved.
- */
- virtual am_Error_e getRestartReasonPropertyNSM(NsmRestartReason_e& restartReason) =0;
- /**
- * Retrieves the shutdown reason property
- * @return E_OK on success E_UNKNOWN if property could not be retrieved.
- */
- virtual am_Error_e getShutdownReasonPropertyNSM(NsmShutdownReason_e& ShutdownReason) =0;
- /**
- * Retrieves the running reason
- * @return E_OK on success E_UNKNOWN if property could not be retrieved.
- */
- virtual am_Error_e getRunningReasonPropertyNSM(NsmRunningReason_e& nsmRunningReason) =0;
- /**
- * @return NsmErrorStatus_Ok in case of success
- */
- virtual NsmErrorStatus_e getNodeStateNSM(NsmNodeState_e& nsmNodeState) =0;
- /**
- * Retrieves the current session state
- * @return NsmErrorStatus_Ok on success E_UNKNOWN if property could not be
- * retrieved.
- */
- virtual NsmErrorStatus_e getSessionStateNSM(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState) =0;
- /**
- * Retrieves the current applicationmode
- * @return NsmErrorStatus_Ok on success E_UNKNOWN if property could not be
- * retrieved.
- */
- virtual NsmErrorStatus_e getApplicationModeNSM(NsmApplicationMode_e& applicationMode) =0;
- /**
- * Registers the AudioManager as shutdown client
- * @return NsmErrorStatus_Ok on success
- * The interface for the client will be provided by the AudioManagerDeamon,
- * therefore is no need to mention it here.
- */
- virtual NsmErrorStatus_e registerShutdownClientNSM(const uint32_t shutdownMode, const uint32_t timeoutMs) =0;
- /**
- * unregisters the AudioManager as shutdown client
- * @return NsmErrorStatus_Ok on success
- */
- virtual NsmErrorStatus_e unRegisterShutdownClientNSM(const uint32_t shutdownMode) =0;
- /**
- * @return E_OK on success, E_UNKOWN if interface could not be reached
- */
- virtual am_Error_e getInterfaceVersionNSM(uint32_t& version) =0;
- /**
- * Sends out the lifecyclerequest complete to the NSM
- * @return NsmErrorStatus_Ok in case of success
- */
- virtual NsmErrorStatus_e sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status) =0;
- /**
* This function retrieves a list of all sink mainsoundproperties with its values
* @return E_OK when successful, E_DATABASE on error
*/
@@ -1009,24 +955,6 @@ public:
*/
virtual am_Error_e hookUserSetMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
/**
- * This hook is connected to the NodeState signal of the NodeStateManager
- */
- virtual void hookSystemNodeStateChanged(const NsmNodeState_e NodeStateId) =0;
- /**
- * This hook is connected to the NodeApplicationMode signal of the NodeStateManager
- */
- virtual void hookSystemNodeApplicationModeChanged(const NsmApplicationMode_e ApplicationModeId) =0;
- /**
- * the sessionstate change was send by the NSM
- */
- virtual void hookSystemSessionStateChanged(const std::string& sessionName, const NsmSeat_e seatID, const NsmSessionState_e sessionStateID) =0;
- /**
- * A lifecycle request comes in from the NSM and must be processed.
- * @return NsmErrorStatus_Ok if successful
- * The controller has to respond to this message with LifecycleRequestComplete.
- */
- virtual NsmErrorStatus_e hookSystemLifecycleRequest(const uint32_t Request, const uint32_t RequestId) =0;
- /**
* This hook is fired whenever the timing information of a connection has changed.
*/
virtual void hookSystemSingleTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t time) =0;
diff --git a/nodeStateManagerIncludes/NodeStateManager.h b/nodeStateManagerIncludes/NodeStateManager.h
deleted file mode 100644
index 3866cd2..0000000
--- a/nodeStateManagerIncludes/NodeStateManager.h
+++ /dev/null
@@ -1,131 +0,0 @@
-#ifndef NODESTATEMANAGER_H
-#define NODESTATEMANAGER_H
-
-/**********************************************************************************************************************
-*
-* SPDX license identifier: MPL-2.0
-*
-* 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
deleted file mode 100644
index 947531c..0000000
--- a/nodeStateManagerIncludes/NodeStateTypes.h
+++ /dev/null
@@ -1,254 +0,0 @@
-#ifndef NODESTATETYPES_H
-#define NODESTATETYPES_H
-
-/**********************************************************************************************************************
-*
-* SPDX license identifier: MPL-2.0
-*
-* 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 */