1 /** Copyright (c) 2012 GENIVI Alliance
2 * Copyright (c) 2012 BMW
4 * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
7 * 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,
8 * 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,
9 * subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11 * 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.
12 * 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
13 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 * For further information see http://www.genivi.org/.
18 #ifndef DBUSCOMMANDSENDER_H_
19 #define DBUSCOMMANDSENDER_H_
21 #include <dbus/dbus.h>
23 #include "shared/CAmDbusWrapper.h"
24 #include "CAmDbusMessageHandler.h"
25 #include "IAmCommandReceiverShadow.h"
26 #include "command/IAmCommandSend.h"
29 #include "../test/CAmCommandSenderDbusBackdoor.h"
37 const char MY_NODE[] = "CommandInterface";
40 * Dbus Implementation of CommandSendInterface
42 class CAmCommandSenderDbus: public IAmCommandSend
45 CAmCommandSenderDbus();
46 virtual ~CAmCommandSenderDbus();
47 am_Error_e startupInterface(IAmCommandReceive* commandreceiveinterface);
48 void setCommandReady(const uint16_t handle);
49 void setCommandRundown(const uint16_t handle);
50 void cbNewMainConnection(const am_MainConnectionType_s mainConnection);
51 void cbRemovedMainConnection(const am_mainConnectionID_t mainConnection);
52 void cbNewSink(const am_SinkType_s& sink);
53 void cbRemovedSink(const am_sinkID_t sinkID);
54 void cbNewSource(const am_SourceType_s& source);
55 void cbRemovedSource(const am_sourceID_t source);
56 void cbNumberOfSinkClassesChanged();
57 void cbNumberOfSourceClassesChanged();
58 void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState);
59 void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty);
60 void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty);
61 void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability);
62 void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability);
63 void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume);
64 void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
65 void cbSystemPropertyChanged(const am_SystemProperty_s& systemProperty);
66 void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
67 void getInterfaceVersion(std::string& version) const;
70 friend class CAmCommandSenderDbusBackdoor;
73 CAmDbusMessageHandler mCAmDbusMessageHandler; ///< ! instance of message handler
74 IAmCommandReceiverShadow mIAmCommandReceiverShadow; ///< ! instance of shadow
75 CAmDbusWrapper* mpCAmDbusWrapper; ///< ! pointer to dbus wrapper
76 IAmCommandReceive* mpIAmCommandReceive; ///< ! pointer to commandReceive Interface
77 bool mReady; ///< ! if false, calls shall be ignored.
80 * list of sinks, needed to send out only deltas
82 std::vector<am_SinkType_s> mlistSinks;
85 * list of sources, needed to send out only deltas
87 std::vector<am_SourceType_s> mlistSources;
90 * used as comparison function for am_SinkType_s
94 bool operator()(const am_SinkType_s & a, const am_SinkType_s & b)
96 return (a.sinkID < b.sinkID);
101 * used as comparison function for am_SourceType_s
103 struct sortBySourceID
105 bool operator()(const am_SourceType_s & a, const am_SourceType_s & b)
107 return (a.sourceID < b.sourceID);
115 #endif /* DBUSCOMMANDSENDER_H_ */