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 CAmCommandSender.h
18 * For further information see http://www.genivi.org/.
22 #ifndef COMMANDSENDER_H_
23 #define COMMANDSENDER_H_
26 #include "../test/IAmCommandBackdoor.h" //we need this for the unit test
29 #include "command/IAmCommandSend.h"
34 class CAmCommandReceiver;
38 * This class is used to send data to the CommandInterface.
39 * All loaded plugins will be called when a callback is invoked.
41 class CAmCommandSender
44 CAmCommandSender(const std::vector<std::string>& listOfPluginDirectories);
46 am_Error_e startupInterfaces(CAmCommandReceiver* iCommandReceiver);
47 void setCommandReady();
48 void setCommandRundown();
49 void cbNewMainConnection(const am_MainConnectionType_s mainConnection);
50 void cbRemovedMainConnection(const am_mainConnectionID_t mainConnection);
51 void cbNewSink(am_SinkType_s sink);
52 void cbRemovedSink(const am_sinkID_t sink);
53 void cbNewSource(const am_SourceType_s source);
54 void cbRemovedSource(const am_sourceID_t source);
55 void cbNumberOfSinkClassesChanged();
56 void cbNumberOfSourceClassesChanged();
57 void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState);
58 void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty);
59 void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty);
60 void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability);
61 void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability);
62 void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume);
63 void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
64 void cbSystemPropertyChanged(const am_SystemProperty_s& systemProperty);
65 void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
66 void getInterfaceVersion(std::string& version) const;
67 am_Error_e getListPlugins(std::vector<std::string>& interfaces) const;
68 void cbSinkUpdated(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
69 void cbSourceUpdated(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
70 void cbSinkNotification(const am_sinkID_t sinkID, const am_NotificationPayload_s& notification);
71 void cbSourceNotification(const am_sourceID_t sourceID, const am_NotificationPayload_s& notification);
72 void cbSinkMainNotificationConfigurationChanged(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration);
73 void cbSourceMainNotificationConfigurationChanged(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration);
76 friend class IAmCommandBackdoor; //this is to get access to the loaded plugins and be able to exchange the interfaces
79 void unloadLibraries(void); //!< unload the shared libraries
80 std::vector<IAmCommandSend*> mListInterfaces; //!< list of all interfaces
81 std::vector<void*> mListLibraryHandles; //!< list of all library handles. This information is used to unload the plugins correctly.
82 std::vector<std::string> mListLibraryNames; //!< list of all library names. This information is used for getListPlugins.
84 CAmCommandReceiver *mCommandReceiver;
89 #endif /* COMMANDSENDER_H_ */