2 * Copyright (C) 2011, BMW AG
4 * GeniviAudioMananger AudioManagerDaemon
6 * \file ControlSender.cpp
8 * \date 20-Oct-2011 3:42:04 PM
9 * \author Christian Mueller (christian.ei.mueller@bmw.de)
12 * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
13 * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
15 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
16 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
17 * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
18 * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
19 * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
20 * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
21 * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
25 #include "ControlSender.h"
29 #include "PluginTemplate.h"
31 DLT_IMPORT_CONTEXT(AudioManager)
35 #define REQUIRED_MIN_INTERFACE_VERSION 1
37 ControlSender::ControlSender(std::string controlPluginFile) :
41 std::ifstream isfile(controlPluginFile.c_str());
44 DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("ControlSender::ControlSender: Controller plugin not found:"), DLT_STRING(controlPluginFile.c_str()));
46 else if (!controlPluginFile.empty())
48 ControlSendInterface* (*createFunc)();
49 createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile, mlibHandle);
50 assert(createFunc!=NULL);
51 mController = createFunc();
54 assert(REQUIRED_MIN_INTERFACE_VERSION<=mController->getInterfaceVersion());
58 DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("ControlSender::ControlSender: No controller loaded !"));
62 ControlSender::~ControlSender()
64 if (mlibHandle) dlclose(mlibHandle);
67 void ControlSender::hookAllPluginsLoaded()
69 mController->hookAllPluginsLoaded();
72 am_Error_e ControlSender::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
74 return mController->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID);
77 am_Error_e ControlSender::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
79 return mController->hookUserDisconnectionRequest(connectionID);
82 am_Error_e ControlSender::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
84 return mController->hookUserSetMainSinkSoundProperty(sinkID, soundProperty);
87 am_Error_e ControlSender::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
89 return mController->hookUserSetMainSourceSoundProperty(sourceID, soundProperty);
92 am_Error_e ControlSender::hookUserSetSystemProperty(const am_SystemProperty_s & property)
94 return mController->hookUserSetSystemProperty(property);
97 am_Error_e ControlSender::hookUserVolumeChange(const am_sinkID_t sinkID, const am_mainVolume_t newVolume)
99 return mController->hookUserVolumeChange(sinkID, newVolume);
102 am_Error_e ControlSender::hookUserVolumeStep(const am_sinkID_t sinkID, const int16_t increment)
104 return mController->hookUserVolumeStep(sinkID, increment);
107 am_Error_e ControlSender::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
109 return mController->hookUserSetSinkMuteState(sinkID, muteState);
112 am_Error_e ControlSender::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
114 return mController->hookSystemRegisterDomain(domainData, domainID);
117 am_Error_e ControlSender::hookSystemDeregisterDomain(const am_domainID_t domainID)
119 return mController->hookSystemDeregisterDomain(domainID);
122 void ControlSender::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
124 return mController->hookSystemDomainRegistrationComplete(domainID);
127 am_Error_e ControlSender::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
129 return mController->hookSystemRegisterSink(sinkData, sinkID);
132 am_Error_e ControlSender::hookSystemDeregisterSink(const am_sinkID_t sinkID)
134 return mController->hookSystemDeregisterSink(sinkID);
137 am_Error_e ControlSender::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
139 return mController->hookSystemRegisterSource(sourceData, sourceID);
142 am_Error_e ControlSender::hookSystemDeregisterSource(const am_sourceID_t sourceID)
144 return mController->hookSystemDeregisterSource(sourceID);
147 am_Error_e ControlSender::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
149 return mController->hookSystemRegisterGateway(gatewayData, gatewayID);
152 am_Error_e ControlSender::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
154 return mController->hookSystemDeregisterGateway(gatewayID);
157 am_Error_e ControlSender::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
159 return mController->hookSystemRegisterCrossfader(crossfaderData, crossfaderID);
162 am_Error_e ControlSender::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
164 return mController->hookSystemDeregisterCrossfader(crossfaderID);
167 void ControlSender::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
169 mController->hookSystemSinkVolumeTick(handle, sinkID, volume);
172 void ControlSender::hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
174 mController->hookSystemSourceVolumeTick(handle, sourceID, volume);
177 void ControlSender::hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
179 mController->hookSystemInterruptStateChange(sourceID, interruptState);
182 void ControlSender::hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
184 mController->hookSystemSinkAvailablityStateChange(sinkID, availability);
187 void ControlSender::hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
189 mController->hookSystemSourceAvailablityStateChange(sourceID, availability);
192 void ControlSender::hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
194 mController->hookSystemDomainStateChange(domainID, state);
197 void ControlSender::hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> & data)
199 mController->hookSystemReceiveEarlyData(data);
202 void ControlSender::hookSystemSpeedChange(const am_speed_t speed)
204 mController->hookSystemSpeedChange(speed);
207 void ControlSender::hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
209 mController->hookSystemTimingInformationChanged(mainConnectionID, time);
212 void ControlSender::cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
214 mController->cbAckConnect(handle, errorID);
217 void ControlSender::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
219 mController->cbAckDisconnect(handle, errorID);
222 void ControlSender::cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
224 mController->cbAckCrossFade(handle, hostsink, error);
227 void ControlSender::cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
229 mController->cbAckSetSinkVolumeChange(handle, volume, error);
232 void ControlSender::cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
234 mController->cbAckSetSourceVolumeChange(handle, volume, error);
237 void ControlSender::cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
239 mController->cbAckSetSourceState(handle, error);
242 void ControlSender::cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
244 mController->cbAckSetSourceSoundProperty(handle, error);
247 am_Error_e ControlSender::startupController(ControlReceiveInterface *controlreceiveinterface)
249 return mController->startupController(controlreceiveinterface);
252 am_Error_e ControlSender::stopController()
254 return mController->stopController();
257 void ControlSender::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
259 mController->cbAckSetSinkSoundProperty(handle, error);
262 void ControlSender::cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
264 mController->cbAckSetSinkSoundProperties(handle, error);
267 void ControlSender::cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
269 mController->cbAckSetSourceSoundProperties(handle, error);
272 am_Error_e ControlSender::getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e> & listPrioConnectionFormats)
274 return mController->getConnectionFormatChoice(sourceID, sinkID, listPossibleConnectionFormats, listPrioConnectionFormats);
277 uint16_t ControlSender::getInterfaceVersion() const
279 return ControlSendVersion;