update changelog
[profile/ivi/genivi/genivi-audio-manager.git] / AudioManagerDaemon / include / CAmNodeStateCommunicatorDBus.h
1 /**
2  * Copyright (C) 2012, BMW AG
3  *
4  * This file is part of GENIVI Project AudioManager.
5  *
6  * Contributions are licensed to the GENIVI Alliance under one or more
7  * Contribution License Agreements.
8  *
9  * \copyright
10  * This Source Code Form is subject to the terms of the
11  * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with
12  * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
13  *
14  *
15  * \author Christian Linke, christian.linke@bmw.de BMW 2012
16  *
17  * \file CAmNodeStateCommunicatorDBus.h
18  * For further information see http://www.genivi.org/.
19  *
20  */
21 #ifndef CAMNODESTATECOMMUNICATORDBUS_H_
22 #define CAMNODESTATECOMMUNICATORDBUS_H_
23
24 #include "shared/CAmDbusWrapper.h"
25 #include "CAmNodeStateCommunicator.h"
26
27 namespace am
28 {
29 /** communicates with the NSM
30  *  The CAmNodeStateCommunicator communicates with the NodeStateManager via Dbus. Only works, if CAmDbusWrapper is enabled.
31  */
32
33 class CAmNodeStateCommunicatorDBus : public CAmNodeStateCommunicator
34 {
35 public:
36         CAmNodeStateCommunicatorDBus(CAmDbusWrapper* iDbusWrapper);
37     virtual ~CAmNodeStateCommunicatorDBus();
38     am_Error_e nsmGetRestartReasonProperty(NsmRestartReason_e& restartReason) ;
39     am_Error_e nsmGetShutdownReasonProperty(NsmShutdownReason_e& ShutdownReason) ;
40     am_Error_e nsmGetRunningReasonProperty(NsmRunningReason_e& nsmRunningReason) ;
41     NsmErrorStatus_e nsmGetNodeState(NsmNodeState_e& nsmNodeState) ;
42     NsmErrorStatus_e nsmGetSessionState(const std::string& sessionName, const NsmSeat_e& seatID, NsmSessionState_e& sessionState) ;
43     NsmErrorStatus_e nsmGetApplicationMode(NsmApplicationMode_e& applicationMode) ;
44     NsmErrorStatus_e nsmRegisterShutdownClient(const uint32_t shutdownMode, const uint32_t timeoutMs) ;
45     NsmErrorStatus_e nsmUnRegisterShutdownClient(const uint32_t shutdownMode) ;
46     am_Error_e nsmGetInterfaceVersion(uint32_t& version) ;
47     NsmErrorStatus_e nsmSendLifecycleRequestComplete(const uint32_t RequestId, const NsmErrorStatus_e status) ;
48
49     static DBusHandlerResult receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
50     static DBusHandlerResult signalCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
51
52
53 private:
54     void sendIntrospection(DBusConnection* conn, DBusMessage* msg);
55     void sendMessage(DBusMessage* message, DBusMessage* origMessage);
56     DBusHandlerResult receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg);
57     am_Error_e readIntegerProperty(const std::string property, int32_t &value);
58     CAmDbusWrapper* mpDbusWrapper;
59     DBusConnection* mpDBusConnection;
60 };
61
62 } /* namespace am */
63 #endif /* CAMNODESTATECOMMUNICATORDBUS_H_ */