* Bug #100 - removed projecttypes.h which causes compiling conflicts
[profile/ivi/genivi/genivi-audio-manager.git] / AudioManagerDaemon / src / CAmControlReceiver.cpp
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 Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
16  *
17  * \file CAmControlReceiver.cpp
18  * For further information see http://www.genivi.org/.
19  *
20  */
21
22 #include "CAmControlReceiver.h"
23 #include <cassert>
24 #include <stdlib.h>
25 #include <stdexcept>
26 #include "config.h"
27 #include "IAmDatabaseHandler.h"
28 #include "CAmRoutingSender.h"
29 #include "CAmCommandSender.h"
30 #include "CAmRouter.h"
31 #include "shared/CAmDltWrapper.h"
32 #include "shared/CAmSocketHandler.h"
33 #ifdef WITH_NSM
34     #include "CAmNodeStateCommunicator.h"
35 #endif
36
37
38
39 namespace am {
40
41 CAmControlReceiver::CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter, CAmNodeStateCommunicator* iNodeStateCommunicator) :
42         mDatabaseHandler(iDatabaseHandler), //
43         mRoutingSender(iRoutingSender), //
44         mCommandSender(iCommandSender), //
45         mSocketHandler(iSocketHandler), //
46         mRouter(iRouter), //
47         mNodeStateCommunicator(iNodeStateCommunicator)
48 {
49     assert(mDatabaseHandler!=NULL);
50     assert(mRoutingSender!=NULL);
51     assert(mCommandSender!=NULL);
52     assert(mSocketHandler!=NULL);
53     assert(mRouter!=NULL);
54     assert(iNodeStateCommunicator!=NULL);
55 }
56
57 CAmControlReceiver::CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter) :
58         mDatabaseHandler(iDatabaseHandler), //
59         mRoutingSender(iRoutingSender), //
60         mCommandSender(iCommandSender), //
61         mSocketHandler(iSocketHandler), //
62         mRouter(iRouter), //
63         mNodeStateCommunicator(NULL)
64 {
65     assert(mDatabaseHandler!=NULL);
66     assert(mRoutingSender!=NULL);
67     assert(mCommandSender!=NULL);
68     assert(mSocketHandler!=NULL);
69     assert(mRouter!=NULL);
70 }
71
72 CAmControlReceiver::~CAmControlReceiver()
73 {
74 }
75
76 am_Error_e CAmControlReceiver::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
77 {
78     return (mRouter->getRoute(onlyfree, sourceID, sinkID, returnList));
79 }
80
81 am_Error_e CAmControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & connectionID, const am_CustomConnectionFormat_t format, const am_sourceID_t sourceID, const am_sinkID_t sinkID)
82 {
83     logInfo("CAmControlReceiver::connect got called, connectionFormat=", format, "sourceID=", sourceID, "sinkID=", sinkID);
84
85     am_Connection_s tempConnection;
86     tempConnection.sinkID = sinkID;
87     tempConnection.sourceID = sourceID;
88     tempConnection.connectionFormat = format;
89     tempConnection.connectionID = 0;
90     tempConnection.delay=-1;
91
92     mDatabaseHandler->enterConnectionDB(tempConnection, connectionID);
93     return (mRoutingSender->asyncConnect(handle, connectionID, sourceID, sinkID, format));
94 }
95
96 am_Error_e CAmControlReceiver::disconnect(am_Handle_s & handle, const am_connectionID_t connectionID)
97 {
98     logInfo("CAmControlReceiver::disconnect got called, connectionID=", connectionID);
99     return (mRoutingSender->asyncDisconnect(handle, connectionID));
100 }
101
102 am_Error_e CAmControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_CustomRampType_t rampType, const am_time_t rampTime)
103 {
104     logInfo("CAmControlReceiver::crossfade got called, hotSource=", hotSource, "crossfaderID=", crossfaderID, "rampType=", rampType, "rampTime=", rampTime);
105     return (mRoutingSender->asyncCrossFade(handle, crossfaderID, hotSource, rampType, rampTime));
106 }
107
108 am_Error_e CAmControlReceiver::setSourceState(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SourceState_e state)
109 {
110     logInfo("CAmControlReceiver::setSourceState got called, sourceID=", sourceID, "state=", state);
111     return (mRoutingSender->asyncSetSourceState(handle, sourceID, state));
112 }
113
114 am_Error_e CAmControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time)
115 {
116     logInfo("CAmControlReceiver::setSinkVolume got called, sinkID=", sinkID, "volume=", volume, "ramp=", ramp, "time=", time);
117     return (mRoutingSender->asyncSetSinkVolume(handle, sinkID, volume, ramp, time));
118 }
119
120 am_Error_e CAmControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t rampType, const am_time_t time)
121 {
122     logInfo("CAmControlReceiver::setSourceVolume got called, sourceID=", sourceID, "volume=", volume, "ramp=", rampType, "time=", time);
123     return (mRoutingSender->asyncSetSourceVolume(handle, sourceID, volume, rampType, time));
124 }
125
126 am_Error_e CAmControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
127 {
128     logInfo("CAmControlReceiver::setSinkSoundProperty got called, sinkID=", sinkID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value);
129     return (mRoutingSender->asyncSetSinkSoundProperty(handle, sinkID, soundProperty));
130 }
131
132 am_Error_e CAmControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
133 {
134     logInfo("CAmControlReceiver::setSinkSoundProperties got called, sinkID=", sinkID);
135     return (mRoutingSender->asyncSetSinkSoundProperties(handle, listSoundProperties, sinkID));
136 }
137
138 am_Error_e CAmControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
139 {
140     logInfo("CAmControlReceiver::setSourceSoundProperty got called, sourceID=", sourceID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value);
141     return (mRoutingSender->asyncSetSourceSoundProperty(handle, sourceID, soundProperty));
142 }
143
144 am_Error_e CAmControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
145 {
146     logInfo("CAmControlReceiver::setSourceSoundProperties got called, sourceID=", sourceID);
147     return (mRoutingSender->asyncSetSourceSoundProperties(handle, listSoundProperties, sourceID));
148 }
149
150 am_Error_e CAmControlReceiver::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
151 {
152     logInfo("CAmControlReceiver::setDomainState got called, domainID=", domainID, "domainState=", domainState);
153     return (mRoutingSender->setDomainState(domainID, domainState));
154 }
155
156 am_Error_e CAmControlReceiver::abortAction(const am_Handle_s handle)
157 {
158     logInfo("CAmControlReceiver::abortAction got called, handle.type=", handle.handle, "handle.handleType=", handle.handleType);
159     return (mRoutingSender->asyncAbort(handle));
160 }
161
162 am_Error_e CAmControlReceiver::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
163 {
164     return (mDatabaseHandler->enterDomainDB(domainData, domainID));
165 }
166
167 am_Error_e CAmControlReceiver::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
168 {
169     return (mDatabaseHandler->enterMainConnectionDB(mainConnectionData, connectionID));
170 }
171
172 am_Error_e CAmControlReceiver::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
173 {
174     return (mDatabaseHandler->enterSinkDB(sinkData, sinkID));
175 }
176
177 am_Error_e CAmControlReceiver::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
178 {
179     return (mDatabaseHandler->enterCrossfaderDB(crossfaderData, crossfaderID));
180 }
181
182 am_Error_e CAmControlReceiver::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
183 {
184     return (mDatabaseHandler->enterGatewayDB(gatewayData, gatewayID));
185 }
186
187 am_Error_e CAmControlReceiver::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
188 {
189     return (mDatabaseHandler->enterSourceDB(sourceData, sourceID));
190 }
191
192 am_Error_e CAmControlReceiver::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
193 {
194     return (mDatabaseHandler->enterSinkClassDB(sinkClass, sinkClassID));
195 }
196
197 am_Error_e CAmControlReceiver::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
198 {
199     return (mDatabaseHandler->enterSourceClassDB(sourceClassID, sourceClass));
200 }
201
202 am_Error_e CAmControlReceiver::enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s> & listSystemProperties)
203 {
204     return (mDatabaseHandler->enterSystemProperties(listSystemProperties));
205 }
206
207 am_Error_e CAmControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
208 {
209     return (mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, listConnectionID));
210 }
211
212 am_Error_e CAmControlReceiver::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
213 {
214     return (mDatabaseHandler->changeMainConnectionStateDB(mainconnectionID, connectionState));
215 }
216
217 am_Error_e CAmControlReceiver::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
218 {
219     return (mDatabaseHandler->changeSinkMainVolumeDB(mainVolume, sinkID));
220 }
221
222 am_Error_e CAmControlReceiver::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
223 {
224     return (mDatabaseHandler->changeSinkAvailabilityDB(availability, sinkID));
225 }
226
227 am_Error_e CAmControlReceiver::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
228 {
229     return (mDatabaseHandler->changDomainStateDB(domainState, domainID));
230 }
231
232 am_Error_e CAmControlReceiver::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
233 {
234     return (mDatabaseHandler->changeSinkMuteStateDB(muteState, sinkID));
235 }
236
237 am_Error_e CAmControlReceiver::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
238 {
239     return (mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sinkID));
240 }
241
242 am_Error_e CAmControlReceiver::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
243 {
244     return (mDatabaseHandler->changeMainSourceSoundPropertyDB(soundProperty, sourceID));
245 }
246
247 am_Error_e CAmControlReceiver::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
248 {
249     return (mDatabaseHandler->changeSourceAvailabilityDB(availability, sourceID));
250 }
251
252 am_Error_e CAmControlReceiver::changeSystemPropertyDB(const am_SystemProperty_s & property)
253 {
254     return (mDatabaseHandler->changeSystemPropertyDB(property));
255 }
256
257 am_Error_e CAmControlReceiver::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
258 {
259     return (mDatabaseHandler->removeMainConnectionDB(mainConnectionID));
260 }
261
262 am_Error_e CAmControlReceiver::removeSinkDB(const am_sinkID_t sinkID)
263 {
264     return (mDatabaseHandler->removeSinkDB(sinkID));
265 }
266
267 am_Error_e CAmControlReceiver::removeSourceDB(const am_sourceID_t sourceID)
268 {
269     return (mDatabaseHandler->removeSourceDB(sourceID));
270 }
271
272 am_Error_e CAmControlReceiver::removeGatewayDB(const am_gatewayID_t gatewayID)
273 {
274     return (mDatabaseHandler->removeGatewayDB(gatewayID));
275 }
276
277 am_Error_e CAmControlReceiver::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
278 {
279     return (mDatabaseHandler->removeCrossfaderDB(crossfaderID));
280 }
281
282 am_Error_e CAmControlReceiver::removeDomainDB(const am_domainID_t domainID)
283 {
284     return (mDatabaseHandler->removeDomainDB(domainID));
285 }
286
287 am_Error_e CAmControlReceiver::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
288 {
289     return (mDatabaseHandler->getSourceClassInfoDB(sourceID, classInfo));
290 }
291
292 am_Error_e CAmControlReceiver::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
293 {
294     return (mDatabaseHandler->getSinkClassInfoDB(sinkID, sinkClass));
295 }
296
297 am_Error_e CAmControlReceiver::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
298 {
299     return (mDatabaseHandler->getSinkInfoDB(sinkID, sinkData));
300 }
301
302 am_Error_e CAmControlReceiver::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
303 {
304     return (mDatabaseHandler->getSourceInfoDB(sourceID, sourceData));
305 }
306
307 am_Error_e CAmControlReceiver::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
308 {
309     return (mDatabaseHandler->getMainConnectionInfoDB(mainConnectionID, mainConnectionData));
310 }
311
312 am_Error_e CAmControlReceiver::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
313 {
314     return (mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData));
315 }
316
317 am_Error_e CAmControlReceiver::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
318 {
319     return (mDatabaseHandler->getCrossfaderInfoDB(crossfaderID, crossfaderData));
320 }
321
322 am_Error_e CAmControlReceiver::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
323 {
324     return (mDatabaseHandler->getListSinksOfDomain(domainID, listSinkID));
325 }
326
327 am_Error_e CAmControlReceiver::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
328 {
329     return (mDatabaseHandler->getListSourcesOfDomain(domainID, listSourceID));
330 }
331
332 am_Error_e CAmControlReceiver::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listGatewaysID) const
333 {
334     return (mDatabaseHandler->getListCrossfadersOfDomain(domainID, listGatewaysID));
335 }
336
337 am_Error_e CAmControlReceiver::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
338 {
339     return (mDatabaseHandler->getListGatewaysOfDomain(domainID, listGatewaysID));
340 }
341
342 am_Error_e CAmControlReceiver::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
343 {
344     return (mDatabaseHandler->getListMainConnections(listMainConnections));
345 }
346
347 am_Error_e CAmControlReceiver::getListDomains(std::vector<am_Domain_s> & listDomains) const
348 {
349     return (mDatabaseHandler->getListDomains(listDomains));
350 }
351
352 am_Error_e CAmControlReceiver::getListConnections(std::vector<am_Connection_s> & listConnections) const
353 {
354     return (mDatabaseHandler->getListConnections(listConnections));
355 }
356
357 am_Error_e CAmControlReceiver::getListSinks(std::vector<am_Sink_s> & listSinks) const
358 {
359     return (mDatabaseHandler->getListSinks(listSinks));
360 }
361
362 am_Error_e CAmControlReceiver::getListSources(std::vector<am_Source_s> & listSources) const
363 {
364     return (mDatabaseHandler->getListSources(listSources));
365 }
366
367 am_Error_e CAmControlReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
368 {
369     return (mDatabaseHandler->getListSourceClasses(listSourceClasses));
370 }
371
372 am_Error_e CAmControlReceiver::getListHandles(std::vector<am_Handle_s> & listHandles) const
373 {
374     return (mRoutingSender->getListHandles(listHandles));
375 }
376
377 am_Error_e CAmControlReceiver::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
378 {
379     return (mDatabaseHandler->getListCrossfaders(listCrossfaders));
380 }
381
382 am_Error_e CAmControlReceiver::getListGateways(std::vector<am_Gateway_s> & listGateways) const
383 {
384     return (mDatabaseHandler->getListGateways(listGateways));
385 }
386
387 am_Error_e CAmControlReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
388 {
389     return (mDatabaseHandler->getListSinkClasses(listSinkClasses));
390 }
391
392 am_Error_e CAmControlReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
393 {
394     return (mDatabaseHandler->getListSystemProperties(listSystemProperties));
395 }
396
397 am_Error_e CAmControlReceiver::changeSinkClassInfoDB(const am_SinkClass_s & classInfo)
398 {
399     return (mDatabaseHandler->changeSinkClassInfoDB(classInfo));
400 }
401
402 am_Error_e CAmControlReceiver::changeSourceClassInfoDB(const am_SourceClass_s & classInfo)
403 {
404     return(mDatabaseHandler->changeSourceClassInfoDB(classInfo));
405 }
406
407 am_Error_e CAmControlReceiver::removeSinkClassDB(const am_sinkClass_t sinkClassID)
408 {
409     return (mDatabaseHandler->removeSinkClassDB(sinkClassID));
410 }
411
412 am_Error_e CAmControlReceiver::removeSourceClassDB(const am_sourceClass_t sourceClassID)
413 {
414     return (mDatabaseHandler->removeSourceClassDB(sourceClassID));
415 }
416
417 void CAmControlReceiver::setCommandReady()
418 {
419     logInfo("CAmControlReceiver::setCommandReady got called");
420     mCommandSender->setCommandReady();
421 }
422
423 void CAmControlReceiver::setRoutingReady()
424 {
425     logInfo("CAmControlReceiver::setRoutingReady got called");
426     mRoutingSender->setRoutingReady();
427 }
428
429 void CAmControlReceiver::confirmControllerReady(const am_Error_e error)
430 {
431     //todo: one time implement here system interaction with NSM
432         if (error!=E_OK)
433                 logError("CAmControlReceiver::confirmControllerReady controller reported error", error);
434 }
435
436 void CAmControlReceiver::confirmControllerRundown(const am_Error_e error)
437 {
438         if (error!=E_OK)
439         {
440                 logError("CAmControlReceiver::confirmControllerRundown() exited with error ",error);
441                 //we might be blocked here -> so lets better exit right away
442                 throw std::runtime_error("controller Confirmed with error");
443         }
444
445         logInfo ("CAmControlReceiver::confirmControllerRundown(), will exit now");
446
447         //end the mainloop here...
448         mSocketHandler->exit_mainloop();
449 }
450
451 am_Error_e CAmControlReceiver::getSocketHandler(CAmSocketHandler *& socketHandler)
452 {
453     socketHandler = mSocketHandler;
454     return (E_OK);
455 }
456
457 void CAmControlReceiver::setCommandRundown()
458 {
459     logInfo("CAmControlReceiver::setCommandRundown got called");
460     mCommandSender->setCommandRundown();
461 }
462
463 void CAmControlReceiver::setRoutingRundown()
464 {
465     logInfo("CAmControlReceiver::setRoutingRundown got called");
466     mRoutingSender->setRoutingRundown();
467 }
468
469 void CAmControlReceiver::getInterfaceVersion(std::string & version) const
470 {
471     version = ControlReceiveVersion;
472 }
473
474 am_Error_e CAmControlReceiver::changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
475 {
476     logInfo("CAmControlReceiver::changeSourceDB was called, sourceID", sourceID);
477     return (mDatabaseHandler->changeSourceDB(sourceID,sourceClassID,listSoundProperties,listConnectionFormats,listMainSoundProperties));
478 }
479
480 am_Error_e CAmControlReceiver::changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
481 {
482     logInfo("CAmControlReceiver::changeSinkDB was called with sinkID", sinkID);
483     return (mDatabaseHandler->changeSinkDB(sinkID,sinkClassID,listSoundProperties,listConnectionFormats,listMainSoundProperties));
484 }
485
486 am_Error_e CAmControlReceiver::changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
487 {
488     logInfo("CAmControlReceiver::changeGatewayDB was called with gatewayID", gatewayID);
489     return (mDatabaseHandler->changeGatewayDB(gatewayID,listSourceConnectionFormats,listSinkConnectionFormats,convertionMatrix));
490 }
491
492 am_Error_e CAmControlReceiver::setVolumes(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes)
493 {
494     logInfo("CAmControlReceiver::setVolumes got called");
495     return (mRoutingSender->asyncSetVolumes(handle,listVolumes));
496 }
497
498 am_Error_e CAmControlReceiver::setSinkNotificationConfiguration(am_Handle_s& handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration)
499 {
500     logInfo("CAmControlReceiver::setSinkNotificationConfiguration called, sinkID=",sinkID,"notificationConfiguration.type=",notificationConfiguration.type,"notificationConfiguration.status",notificationConfiguration.status,"notificationConfiguration.parameter",notificationConfiguration.parameter);
501     return (mRoutingSender->asyncSetSinkNotificationConfiguration(handle,sinkID,notificationConfiguration));
502 }
503
504 am_Error_e CAmControlReceiver::setSourceNotificationConfiguration(am_Handle_s& handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration)
505 {
506     logInfo("CAmControlReceiver::setSourceNotificationConfiguration called, sourceID=",sourceID,"notificationConfiguration.type=",notificationConfiguration.type,"notificationConfiguration.status",notificationConfiguration.status,"notificationConfiguration.parameter",notificationConfiguration.parameter);
507     return (mRoutingSender->asyncSetSourceNotificationConfiguration(handle,sourceID,notificationConfiguration));
508 }
509
510 void CAmControlReceiver::sendMainSinkNotificationPayload(const am_sinkID_t sinkID, const am_NotificationPayload_s& notificationPayload)
511 {
512     logInfo("CAmControlReceiver::sendSinkMainNotificationPayload called, sinkID=",sinkID,"type=",notificationPayload.type,"value=",notificationPayload.value);
513     mCommandSender->cbSinkNotification(sinkID,notificationPayload);
514 }
515
516 void CAmControlReceiver::sendMainSourceNotificationPayload(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload)
517 {
518     logInfo("CAmControlReceiver::sendSourceMainNotificationPayload called, sourceID=",sourceID,"type=",notificationPayload.type,"value=",notificationPayload.value);
519     mCommandSender->cbSourceNotification(sourceID,notificationPayload);
520 }
521
522 am_Error_e CAmControlReceiver::changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration)
523 {
524     logInfo("CAmControlReceiver::changeMainSinkNotificationConfigurationDB was called with sinkID", sinkID);
525     return (mDatabaseHandler->changeMainSinkNotificationConfigurationDB(sinkID,mainNotificationConfiguration));
526 }
527
528 am_Error_e CAmControlReceiver::changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration)
529 {
530     logInfo("CAmControlReceiver::changeMainSourceNotificationConfigurationDB was called with sourceID", sourceID);
531     return (mDatabaseHandler->changeMainSourceNotificationConfigurationDB(sourceID,mainNotificationConfiguration));
532 }
533
534 am_Error_e CAmControlReceiver::getRestartReasonPropertyNSM(NsmRestartReason_e& restartReason)
535 {
536     if (!mNodeStateCommunicator)
537         return (E_NON_EXISTENT);
538 #ifdef WITH_NSM
539     return (mNodeStateCommunicator->nsmGetRestartReasonProperty(restartReason));
540 #else
541     (void)restartReason;
542     return (E_NON_EXISTENT);
543 #endif
544 }
545
546 am_Error_e CAmControlReceiver::getShutdownReasonPropertyNSM(NsmShutdownReason_e& ShutdownReason)
547 {
548     if (!mNodeStateCommunicator)
549         return (E_NON_EXISTENT);
550 #ifdef WITH_NSM
551     return (mNodeStateCommunicator->nsmGetShutdownReasonProperty(ShutdownReason));
552 #else
553     (void)ShutdownReason;
554     return (E_NON_EXISTENT);
555 #endif
556
557 }
558
559 am_Error_e CAmControlReceiver::getRunningReasonPropertyNSM(NsmRunningReason_e& nsmRunningReason)
560 {
561     if (!mNodeStateCommunicator)
562         return (E_NON_EXISTENT);
563 #ifdef WITH_NSM
564     return (mNodeStateCommunicator->nsmGetRunningReasonProperty(nsmRunningReason));
565 #else
566     (void)nsmRunningReason;
567     return (E_NON_EXISTENT);
568 #endif
569
570 }
571
572 NsmErrorStatus_e CAmControlReceiver::getNodeStateNSM(NsmNodeState_e& nsmNodeState)
573 {
574     if (!mNodeStateCommunicator)
575         return (NsmErrorStatus_Error);
576 #ifdef WITH_NSM
577     return (mNodeStateCommunicator->nsmGetNodeState(nsmNodeState));
578 #else
579     (void) nsmNodeState;
580     return (NsmErrorStatus_Error);
581 #endif
582 }
583
584 NsmErrorStatus_e CAmControlReceiver::getSessionStateNSM(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState)
585 {
586     if (!mNodeStateCommunicator)
587         return (NsmErrorStatus_Error);
588 #ifdef WITH_NSM
589     return (mNodeStateCommunicator->nsmGetSessionState(sessionName,seatID,sessionState));
590 #else
591     (void) sessionName;
592     (void) seatID;
593     (void) sessionState;
594     return (NsmErrorStatus_Error);
595 #endif
596
597 }
598
599 NsmErrorStatus_e CAmControlReceiver::getApplicationModeNSM(NsmApplicationMode_e& applicationMode)
600 {
601     if (!mNodeStateCommunicator)
602         return (NsmErrorStatus_Error);
603 #ifdef WITH_NSM
604     return (mNodeStateCommunicator->nsmGetApplicationMode(applicationMode));
605 #else
606     (void) applicationMode;
607     return (NsmErrorStatus_Error);
608 #endif
609
610 }
611
612 NsmErrorStatus_e CAmControlReceiver::registerShutdownClientNSM(const uint32_t shutdownMode, const uint32_t timeoutMs)
613 {
614     if (!mNodeStateCommunicator)
615         return (NsmErrorStatus_Error);
616 #ifdef WITH_NSM
617     return (mNodeStateCommunicator->nsmRegisterShutdownClient(shutdownMode,timeoutMs));
618 #else
619     (void) shutdownMode;
620     (void) timeoutMs;
621     return (NsmErrorStatus_Error);
622 #endif
623
624 }
625
626 NsmErrorStatus_e CAmControlReceiver::unRegisterShutdownClientNSM(const uint32_t shutdownMode)
627 {
628     if (!mNodeStateCommunicator)
629         return (NsmErrorStatus_Error);
630 #ifdef WITH_NSM
631     return (mNodeStateCommunicator->nsmUnRegisterShutdownClient(shutdownMode));
632 #else
633     (void) shutdownMode;
634     return (NsmErrorStatus_Error);
635 #endif
636
637 }
638
639 am_Error_e CAmControlReceiver::getInterfaceVersionNSM(uint32_t& version)
640 {
641     if (!mNodeStateCommunicator)
642         return (E_NON_EXISTENT);
643 #ifdef WITH_NSM
644     return (mNodeStateCommunicator->nsmGetInterfaceVersion(version));
645 #else
646     (void) version;
647     return (E_NON_EXISTENT);
648 #endif
649
650 }
651
652 NsmErrorStatus_e CAmControlReceiver::sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status)
653 {
654     if (!mNodeStateCommunicator)
655         return (NsmErrorStatus_Error);
656 #ifdef WITH_NSM
657     return (mNodeStateCommunicator->nsmSendLifecycleRequestComplete(RequestId,status));
658 #else
659     (void) RequestId;
660     (void) status;
661     return (NsmErrorStatus_Error);
662 #endif
663
664 }
665
666 }
667