2 * Copyright (C) 2012, BMW AG
4 * This file is part of GENIVI Project AudioManager.
6 * Contributions are licensed to the GENIVI Alliance under one or more
7 * Contribution License Agreements.
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/.
15 * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
17 * \file CAmCommandReceiver.h
18 * For further information see http://www.genivi.org/.
22 #ifndef COMMANDRECEIVER_H_
23 #define COMMANDRECEIVER_H_
25 #include "command/IAmCommandReceive.h"
30 class CAmDatabaseHandlerInterface;
31 class CAmControlSender;
33 class CAmSocketHandler;
36 * This class realizes the command Interface
38 class CAmCommandReceiver: public IAmCommandReceive
41 CAmCommandReceiver(CAmDatabaseHandlerInterface* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler);
42 CAmCommandReceiver(CAmDatabaseHandlerInterface* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler, CAmDbusWrapper* iDBusWrapper);
43 ~CAmCommandReceiver();
44 am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID);
45 am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID);
46 am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume);
47 am_Error_e volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep);
48 am_Error_e setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState);
49 am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
50 am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
51 am_Error_e setSystemProperty(const am_SystemProperty_s& property);
52 am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const;
53 am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const;
54 am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const;
55 am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const;
56 am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const;
57 am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
58 am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
59 am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
60 am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const;
61 am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const;
62 am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const;
63 void confirmCommandReady(const uint16_t handle, const am_Error_e error);
64 void confirmCommandRundown(const uint16_t handle, const am_Error_e error);
65 void getInterfaceVersion(std::string& version) const;
66 am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const ;
67 am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const ;
68 am_Error_e setMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
69 am_Error_e setMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
71 uint16_t getStartupHandle(); //!< returns a startup handle
72 uint16_t getRundownHandle(); //!< returns a rundown handle
74 void waitOnStartup(bool startup); //!< tells the ComandReceiver to start waiting for all handles to be confirmed
75 void waitOnRundown(bool rundown); //!< tells the ComandReceiver to start waiting for all handles to be confirmed
78 CAmDatabaseHandlerInterface* mDatabaseHandler; //!< pointer to the databasehandler
79 CAmControlSender* mControlSender; //!< pointer to the control sender
80 CAmDbusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper
81 CAmSocketHandler* mSocketHandler; //!< pointer to the SocketHandler
83 uint16_t handleCount; //!< counts all handles
84 std::vector<uint16_t> mListStartupHandles; //!< list of handles that wait for a confirm
85 std::vector<uint16_t> mListRundownHandles; //!< list of handles that wait for a confirm
86 bool mWaitStartup; //!< if true confirmation will be sent if list of handles = 0
87 bool mWaitRundown; //!< if true confirmation will be sent if list of handles = 0
88 am_Error_e mLastErrorStartup;
89 am_Error_e mLastErrorRundown;
94 #endif /* COMMANDRECEIVER_H_ */