diff options
author | Aleksandar Donchev <aleksander.donchev@partner.bmw.de> | 2013-09-02 11:57:28 +0200 |
---|---|---|
committer | Christian Linke <Christian.Linke@bmw.de> | 2013-09-03 17:26:04 +0200 |
commit | a2edae5cee4254b933f42399edc0e092abd4f5cf (patch) | |
tree | ead58f525b947deed4b8c76ab9c89c80b5056227 /AudioManagerDaemon/include/CAmNodeStateCommunicator.h | |
parent | 7aee1baeea1777318932cc49a8eac18f194233cd (diff) | |
download | audiomanager-a2edae5cee4254b933f42399edc0e092abd4f5cf.tar.gz |
*PluginCommandInterfaceCAPI, PluginRoutingInterfaceCAPI, NodeStateCommunicatorCAPI with unit tests first version.
Choosing between DBUS and Common-API via cmake.
CommonAPI - legacy support for DBus properties (Set 1)
Signed-off-by: Christian Linke <christian.linke@bmw.de>
(cherry picked from commit ea96ef59e29466667c90b506426e2a5a9cdb82d2)
Diffstat (limited to 'AudioManagerDaemon/include/CAmNodeStateCommunicator.h')
-rw-r--r-- | AudioManagerDaemon/include/CAmNodeStateCommunicator.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/AudioManagerDaemon/include/CAmNodeStateCommunicator.h b/AudioManagerDaemon/include/CAmNodeStateCommunicator.h index dfc6689..8cf0dce 100644 --- a/AudioManagerDaemon/include/CAmNodeStateCommunicator.h +++ b/AudioManagerDaemon/include/CAmNodeStateCommunicator.h @@ -13,16 +13,22 @@ * * * \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 CAMNODESTATECOMMUNICATOR_H_ -#define CAMNODESTATECOMMUNICATOR_H_ -#include "shared/CAmDbusWrapper.h" +#ifndef CAMNODESTATECOMMUNICATORBASE_H_ +#define CAMNODESTATECOMMUNICATORBASE_H_ + +#include <assert.h> +#include "config.h" #include "NodeStateManager.h" +#include "audiomanagertypes.h" + + namespace am { @@ -30,43 +36,37 @@ namespace am class CAmControlSender; /** communicates with the NSM - * The CAmNodeStateCommunicator communicates with the NodeStateManager via Dbus. Only works, if CAmDBusWrapper is enabled. + * The CAmNodeStateCommunicator communicates with the NodeStateManager. * The CAmNodeStateCommunicator is triggered via CAmControlReceiver, so you can communicate from the ControllerPlugin with it. - * Most if the interfaces are passive, so you get the information you need via retrieving it. If you need to register the AudioManager + * 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 { -public: - CAmNodeStateCommunicator(CAmDbusWrapper* iDbusWrapper); - virtual ~CAmNodeStateCommunicator(); - 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) ; - - void registerControlSender(CAmControlSender* iControlSender); - 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; +protected: CAmControlSender* mpControlSender; - DBusConnection* mpDBusConnection; +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; + } }; -} /* namespace am */ -#endif /* CAMNODESTATECOMMUNICATOR_H_ */ +} + +#endif /* CAMNODESTATECOMMUNICATORBASE_H_ */ |