AudioManager  7.5.11
Native Application Runtime Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CAmDatabaseHandlerMap.cpp
Go to the documentation of this file.
1 
24 #include <iostream>
25 #include <cassert>
26 #include <stdexcept>
27 #include <vector>
28 #include <fstream>
29 #include <sstream>
30 #include <string>
31 #include <limits>
32 #include "CAmDatabaseHandlerMap.h"
33 #include "CAmDatabaseObserver.h"
34 #include "CAmRouter.h"
35 #include "CAmDltWrapper.h"
36 
37 
38 #ifdef WITH_DATABASE_CHANGE_CHECK
39 # define DB_COND_UPDATE_RIE(x,y) \
40  if (isDataEqual(x,y)) return (E_NO_CHANGE); else x = y
41 # define DB_COND_UPDATE_INIT \
42  bool modified = false
43 # define DB_COND_UPDATE(x,y) \
44  if (!isDataEqual(x,y)) { x = y; modified = true; }
45 # define DB_COND_ISMODIFIED \
46  (modified == true)
47 #else
48 # define DB_COND_UPDATE_RIE(x,y) \
49  x = y
50 # define DB_COND_UPDATE_INIT
51 # define DB_COND_UPDATE(x,y) \
52  x = y
53 # define DB_COND_ISMODIFIED \
54  (true)
55 #endif
56 
57 
58 namespace am
59 {
60 
61 /*
62  * Checks if content of data is equal
63  */
64 template <typename T> bool isDataEqual(const T & left, const T & right)
65 {
66  return static_cast<bool>(!std::memcmp(&left, &right, sizeof(T)));
67 }
68 
69 template <typename T, typename L = std::vector<T> > bool isDataEqual(const L & left, const L & right)
70 {
71  return std::equal(left.begin(), left.end(), right.begin(), isDataEqual);
72 }
73 
74 
75 /*
76  * Returns an object for given key
77  */
78 template <typename TMapKeyType, class TMapObjectType> TMapObjectType const * objectForKeyIfExistsInMap(const TMapKeyType & key, const std::unordered_map<TMapKeyType,TMapObjectType> & map)
79 {
80  typename std::unordered_map<TMapKeyType,TMapObjectType>::const_iterator iter = map.find(key);
81  if( iter!=map.end() )
82  return &iter->second;
83  return NULL;
84 }
85 
86 /*
87  * Checks whether any object with key exists in a given map
88  */
89 template <typename TMapKeyType, class TMapObjectType> bool existsObjectWithKeyInMap(const TMapKeyType & key, const std::unordered_map<TMapKeyType,TMapObjectType> & map)
90 {
91  return objectForKeyIfExistsInMap(key, map)!=NULL;
92 }
93 
103 template <class TReturn, typename TIdentifier> const TReturn * objectMatchingPredicate(const std::unordered_map<TIdentifier, TReturn> & map,
104  std::function<bool(const TReturn & refObject)> comparator)
105 {
106  typename std::unordered_map<TIdentifier, TReturn>::const_iterator elementIterator = map.begin();
107  for (;elementIterator != map.end(); ++elementIterator)
108  {
109  if( comparator(elementIterator->second) )
110  return &elementIterator->second;
111  }
112  return NULL;
113 }
114 
115 
116 /* Domain */
117 
118 void CAmDatabaseHandlerMap::CAmDomain::getDescription (std::string & outString) const
119 {
120  std::ostringstream fmt;
121  fmt << "Domain(" << name.c_str() << ") id(" << domainID << ")" << std::endl <<
122  "bus name(" << busname.c_str() <<
123  ") node name(" << nodename.c_str() <<
124  ") early(" << early <<
125  ") domainID(" << domainID <<
126  ") complete(" << complete <<
127  ") state(" << state <<
128  ") reserved(" << reserved << ")" << std::endl;
129  outString = fmt.str();
130 }
131 
132 /* Source */
133 
134 void CAmDatabaseHandlerMap::CAmSource::getSourceType(am_SourceType_s & sourceType) const
135 {
136  sourceType.name = name;
137  sourceType.sourceClassID = sourceClassID;
138  sourceType.availability = available;
139  sourceType.sourceID = sourceID;
140 }
141 
142 void CAmDatabaseHandlerMap::CAmSource::getDescription (std::string & outString) const
143 {
144  std::ostringstream fmt;
145  fmt << "Source(" << name.c_str() << ") id(" << sourceID << ")" << std::endl <<
146  "sourceClassID(" << sourceClassID <<
147  ") domainID(" << domainID <<
148  ") visible(" << visible <<
149  ") volume(" << volume <<
150  ") interruptState(" << interruptState <<
151  ") sourceState(" << sourceState <<
152  ") reserved(" << reserved << ")" <<
153  ") available([availability:" << available.availability << " availabilityReason:" << available.availabilityReason << "]"
154  ") listSoundProperties (";
155  std::for_each(listSoundProperties.begin(), listSoundProperties.end(), [&](const am_SoundProperty_s & ref) {
156  fmt << "[type:" << ref.type << " value:" << ref.value <<"]";
157  });
158  fmt << ") listConnectionFormats (";
159  std::for_each(listConnectionFormats.begin(), listConnectionFormats.end(), [&](const am_CustomConnectionFormat_t & ref) {
160  fmt << "[" << ref << "]";
161  });
162  fmt << ") listMainSoundProperties (";
163  std::for_each(listMainSoundProperties.begin(), listMainSoundProperties.end(), [&](const am_MainSoundProperty_s & ref) {
164  fmt << "[type:" << ref.type << " value:" << ref.value <<"]";
165  });
166  fmt << ") listMainNotificationConfigurations (";
167  std::for_each(listMainNotificationConfigurations.begin(), listMainNotificationConfigurations.end(), [&](const am_NotificationConfiguration_s & ref) {
168  fmt << "[type:" << ref.type << " status:" << ref.status << " parameter:" << ref.parameter <<"]";
169  });
170  fmt << ") listNotificationConfigurations (";
171  std::for_each(listNotificationConfigurations.begin(), listNotificationConfigurations.end(), [&](const am_NotificationConfiguration_s & ref) {
172  fmt << "[type:" << ref.type << " status:" << ref.status << " parameter:" << ref.parameter <<"]";
173  });
174  fmt << ")" << std::endl;
175  outString = fmt.str();
176 }
177 
178 /* Sink */
179 
180 void CAmDatabaseHandlerMap::CAmSink::getDescription (std::string & outString) const
181 {
182  std::ostringstream fmt;
183  fmt << "Sink(" << name.c_str() << ") id(" << sinkID << ")" << std::endl <<
184  "sinkClassID(" << sinkClassID <<
185  ") domainID(" << domainID <<
186  ") visible(" << visible <<
187  ") volume(" << volume <<
188  ") muteState(" << muteState <<
189  ") mainVolume(" << mainVolume <<
190  ") reserved(" << reserved << ")" <<
191  ") available([availability:" << available.availability << " availabilityReason:" << available.availabilityReason << "]"
192  ") listSoundProperties (";
193  std::for_each(listSoundProperties.begin(), listSoundProperties.end(), [&](const am_SoundProperty_s & ref) {
194  fmt << "[type:" << ref.type << " value:" << ref.value <<"]";
195  });
196  fmt << ") listConnectionFormats (";
197  std::for_each(listConnectionFormats.begin(), listConnectionFormats.end(), [&](const am_CustomConnectionFormat_t & ref) {
198  fmt << "[" << ref << "]";
199  });
200  fmt << ") listMainSoundProperties (";
201  std::for_each(listMainSoundProperties.begin(), listMainSoundProperties.end(), [&](const am_MainSoundProperty_s & ref) {
202  fmt << "[type:" << ref.type << " value:" << ref.value <<"]";
203  });
204  fmt << ") listMainNotificationConfigurations (";
205  std::for_each(listMainNotificationConfigurations.begin(), listMainNotificationConfigurations.end(), [&](const am_NotificationConfiguration_s & ref) {
206  fmt << "[type:" << ref.type << " status:" << ref.status << " parameter:" << ref.parameter <<"]";
207  });
208  fmt << ") listNotificationConfigurations (";
209  std::for_each(listNotificationConfigurations.begin(), listNotificationConfigurations.end(), [&](const am_NotificationConfiguration_s & ref) {
210  fmt << "[type:" << ref.type << " status:" << ref.status << " parameter:" << ref.parameter <<"]";
211  });
212  fmt << ")" << std::endl;
213  outString = fmt.str();
214 }
215 
216 void CAmDatabaseHandlerMap::CAmSink::getSinkType(am_SinkType_s & sinkType) const
217 {
218  sinkType.name = name;
219  sinkType.sinkID = sinkID;
220  sinkType.availability = available;
221  sinkType.muteState = muteState;
222  sinkType.volume = mainVolume;
223  sinkType.sinkClassID = sinkClassID;
224 }
225 
226 /* Connection */
227 
228 void CAmDatabaseHandlerMap::CAmConnection::getDescription (std::string & outString) const
229 {
230  std::ostringstream fmt;
231  fmt << "Connection id(" << connectionID << ") " << std::endl <<
232  "sourceID(" << sourceID <<
233  ") sinkID(" << sinkID <<
234  ") delay(" << delay <<
235  ") connectionFormat(" << connectionFormat <<
236  ") reserved(" << reserved << ")" << std::endl;
237  outString = fmt.str();
238 }
239 
240 /* Main Connection */
241 
242 void CAmDatabaseHandlerMap::CAmMainConnection::getDescription (std::string & outString) const
243 {
244  std::ostringstream fmt;
245  fmt << "MainConnection id(" << mainConnectionID << ") " << std::endl <<
246  "connectionState(" << connectionState <<
247  ") sinkID(" << sinkID <<
248  ") sourceID(" << sourceID <<
249  ") delay(" << delay <<
250  ") listConnectionID (";
251  std::for_each(listConnectionID.begin(), listConnectionID.end(), [&](const am_connectionID_t & connID) {
252  fmt << "["<< connID << "]";
253  });
254  fmt << ")" << std::endl;
255  outString = fmt.str();
256 }
257 
258 void CAmDatabaseHandlerMap::am_MainConnection_Database_s::getMainConnectionType(am_MainConnectionType_s & connectionType) const
259 {
260  connectionType.mainConnectionID = mainConnectionID;
261  connectionType.sourceID = sourceID;
262  connectionType.sinkID = sinkID;
263  connectionType.connectionState = connectionState;
264  connectionType.delay = delay;
265 }
266 
267 /* Source Class */
268 
269 void CAmDatabaseHandlerMap::CAmSourceClass::getDescription (std::string & outString) const
270 {
271  std::ostringstream fmt;
272  fmt << "Source class(" << name.c_str() << ") id(" << sourceClassID << ")\n" <<
273  ") listClassProperties (";
274  std::for_each(listClassProperties.begin(), listClassProperties.end(), [&](const am_ClassProperty_s & ref) {
275  fmt << "[classProperty:" << ref.classProperty << " value:" << ref.value << "]";
276  });
277  fmt << ")" << std::endl;
278  outString = fmt.str();
279 }
280 
281 /* Sink Class */
282 
283 void CAmDatabaseHandlerMap::CAmSinkClass::getDescription (std::string & outString) const
284 {
285  std::ostringstream fmt;
286  fmt << "Sink class(" << name.c_str() << ") id(" << sinkClassID << ")\n" <<
287  ") listClassProperties (";
288  std::for_each(listClassProperties.begin(), listClassProperties.end(), [&](const am_ClassProperty_s & ref) {
289  fmt << "[classProperty:" << ref.classProperty << " value:" << ref.value << "]";
290  });
291  fmt << ")" << std::endl;
292  outString = fmt.str();
293 }
294 
295 
296 /* Gateway */
297 
298 void CAmDatabaseHandlerMap::CAmGateway::getDescription (std::string & outString) const
299 {
300  std::ostringstream fmt;
301  fmt << "Gateway(" << name.c_str() << ") id(" << gatewayID << ")\n" <<
302  "sinkID(" << sinkID <<
303  ") sourceID(" << sourceID <<
304  ") domainSinkID(" << domainSinkID <<
305  ") domainSourceID(" << domainSourceID <<
306  ") controlDomainID(" << controlDomainID <<
307  ") listSourceFormats (";
308  std::for_each(listSourceFormats.begin(), listSourceFormats.end(), [&](const am_CustomConnectionFormat_t & ref) {
309  fmt << "[" << ref << "]";
310  });
311  fmt << ") listSinkFormats (";
312  std::for_each(listSinkFormats.begin(), listSinkFormats.end(), [&](const am_CustomConnectionFormat_t & ref) {
313  fmt << "[" << ref << "]";
314  });
315  fmt << ") convertionMatrix (";
316  std::for_each(convertionMatrix.begin(), convertionMatrix.end(), [&](const bool & ref) {
317  fmt << "[" << ref << "]";
318  });
319  fmt << ")" << std::endl;
320  outString = fmt.str();
321 }
322 
323 /* Crossfader */
324 
325 void CAmDatabaseHandlerMap::CAmCrossfader::getDescription (std::string & outString) const
326 {
327  std::ostringstream fmt;
328  fmt << "Crossfader(" << name.c_str() << ") id(" << crossfaderID << ")\n" <<
329  "sinkID_A(" << sinkID_A <<
330  ") sinkID_B(" << sinkID_B <<
331  ") sourceID(" << sourceID <<
332  ") hotSink(" << hotSink <<
333  ")" << std::endl;
334  outString = fmt.str();
335 }
336 
337 bool CAmDatabaseHandlerMap::CAmMappedData::increaseID(int16_t & resultID, am_Identifier_s & sourceID,
338  int16_t const desiredStaticID = 0)
339 {
340  if( desiredStaticID > 0 && desiredStaticID < sourceID.mMin )
341  {
342  resultID = desiredStaticID;
343  return true;
344  }
345  else if( sourceID.mCurrentValue < sourceID.mMax ) //The last used value is 'limit' - 1. e.g. SHRT_MAX - 1, SHRT_MAX is reserved.
346  {
347  resultID = sourceID.mCurrentValue++;
348  return true;
349  }
350  else
351  {
352  resultID = -1;
353  return false;
354  }
355  }
356 
357 template <typename TMapKey,class TMapObject> bool CAmDatabaseHandlerMap::CAmMappedData::getNextConnectionID(int16_t & resultID, am_Identifier_s & sourceID,
358  const std::unordered_map<TMapKey, TMapObject> & map)
359 {
360  TMapKey nextID;
361  int16_t const lastID = sourceID.mCurrentValue;
362  if( sourceID.mCurrentValue < sourceID.mMax )
363  nextID = sourceID.mCurrentValue++;
364  else
365  nextID = sourceID.mCurrentValue = sourceID.mMin;
366 
367  bool notFreeIDs = false;
368  while( existsObjectWithKeyInMap(nextID, map) )
369  {
370 
371  if( sourceID.mCurrentValue < sourceID.mMax )
372  nextID = sourceID.mCurrentValue++;
373  else
374  {
375  sourceID.mCurrentValue = sourceID.mMin;
376  nextID = sourceID.mCurrentValue++;
377  }
378 
379  if( sourceID.mCurrentValue == lastID )
380  {
381  notFreeIDs = true;
382  break;
383  }
384  }
385  if(notFreeIDs)
386  {
387  resultID = -1;
388  return false;
389  }
390  resultID = nextID;
391  return true;
392 }
393 
394 bool CAmDatabaseHandlerMap::CAmMappedData::increaseMainConnectionID(int16_t & resultID)
395 {
396  return getNextConnectionID(resultID, mCurrentMainConnectionID, mMainConnectionMap);
397 }
398 
399 bool CAmDatabaseHandlerMap::CAmMappedData::increaseConnectionID(int16_t & resultID)
400 {
401  return getNextConnectionID(resultID, mCurrentConnectionID, mConnectionMap);
402 }
403 
404 
405 CAmDatabaseHandlerMap::CAmDatabaseHandlerMap(): mFirstStaticSink(true), //
406  mFirstStaticSource(true), //
407  mFirstStaticGateway(true), //
408  mFirstStaticConverter(true), //
409  mFirstStaticSinkClass(true), //
410  mFirstStaticSourceClass(true), //
411  mFirstStaticCrossfader(true), //
412  mpDatabaseObserver(NULL), //
413  mListConnectionFormat(), //
414  mMappedData()
415 {
416  logVerbose(__func__,"Init ");
417 }
418 
420 {
421  logVerbose(__func__,"Destroy");
422  mpDatabaseObserver = NULL;
423 }
424 
426 {
427  if(domainData.name.empty())
428  {
429  logError(__func__,"DomainName must not be emtpy!");
430  return (E_NOT_POSSIBLE);
431  }
432  if(domainData.busname.empty())
433  {
434  logError(__func__,"Busname must not be emtpy!");
435  return (E_NOT_POSSIBLE);
436  }
437  if(!(domainData.state>=DS_UNKNOWN && domainData.state<=DS_MAX))
438  {
439  logError(__func__,"State must not be valid!");
440  return (E_NOT_POSSIBLE);
441  }
442  //first check for a reserved domain
443  am_Domain_s const *reservedDomain = objectMatchingPredicate<CAmDomain, am_domainID_t>(mMappedData.mDomainMap, [&](const CAmDomain & obj){
444  return domainData.name.compare(obj.name)==0;
445  });
446 
447  int16_t nextID = 0;
448 
449  if( NULL != reservedDomain )
450  {
451  nextID = reservedDomain->domainID;
452  domainID = nextID;
453  mMappedData.mDomainMap[nextID] = domainData;
454  mMappedData.mDomainMap[nextID].domainID = nextID;
455  mMappedData.mDomainMap[nextID].reserved = 0;
456  logVerbose("DatabaseHandler::enterDomainDB entered reserved domain with name=", domainData.name, "busname=", domainData.busname, "nodename=", domainData.nodename, "reserved ID:", domainID);
457  if (mpDatabaseObserver)
458  mpDatabaseObserver->newDomain(mMappedData.mDomainMap[nextID]);
459  return (E_OK);
460  }
461  else
462  {
463  if(mMappedData.increaseID(nextID, mMappedData.mCurrentDomainID, domainData.domainID))
464  {
465  domainID = nextID;
466  mMappedData.mDomainMap[nextID] = domainData;
467  mMappedData.mDomainMap[nextID].domainID = nextID;
468  logVerbose("DatabaseHandler::enterDomainDB entered new domain with name=", domainData.name, "busname=", domainData.busname, "nodename=", domainData.nodename, "assigned ID:", domainID);
469  if (mpDatabaseObserver)
470  mpDatabaseObserver->newDomain(mMappedData.mDomainMap[nextID]);
471  return (E_OK);
472  }
473  else
474  {
475  domainID = 0;
476  logVerbose(__func__,"Max limit reached.");
477  return (E_UNKNOWN);
478  }
479  }
480 }
481 
482 int16_t CAmDatabaseHandlerMap::calculateDelayForRoute(const std::vector<am_connectionID_t>& listConnectionID)
483 {
484  int16_t delay = 0;
485  std::vector<am_connectionID_t>::const_iterator elementIterator = listConnectionID.begin();
486  for (; elementIterator < listConnectionID.end(); ++elementIterator)
487  {
488  am_connectionID_t key = *elementIterator;
489  std::unordered_map<am_connectionID_t, am_Connection_Database_s>::const_iterator it = mMappedData.mConnectionMap.find(key);
490  if (it!=mMappedData.mConnectionMap.end())
491  {
492  int16_t temp_delay = it->second.delay;
493  if (temp_delay != -1 && delay != -1)
494  delay += temp_delay;
495  else
496  delay = -1;
497  }
498  }
499  return delay;
500 }
501 
503 {
504  if(mainConnectionData.mainConnectionID!=0)
505  {
506  logError(__func__,"mainConnectionID must be 0!");
507  return (E_NOT_POSSIBLE);
508  }
509  if(!(mainConnectionData.connectionState>=CS_UNKNOWN && mainConnectionData.connectionState<=CS_MAX))
510  {
511  logError(__func__,"connectionState must be valid!");
512  return (E_NOT_POSSIBLE);
513  }
514  if(!existSink(mainConnectionData.sinkID))
515  {
516  logError(__func__,"sinkID must be valid!");
517  return (E_NOT_POSSIBLE);
518  }
519  if(!existSource(mainConnectionData.sourceID))
520  {
521  logError(__func__,"sourceID must be valid!");
522  return (E_NOT_POSSIBLE);
523  }
524 
525  int16_t delay = 0;
526  int16_t nextID = 0;
527  if(mMappedData.increaseMainConnectionID(nextID))
528  {
529  connectionID = nextID;
530  mMappedData.mMainConnectionMap[nextID] = mainConnectionData;
531  mMappedData.mMainConnectionMap[nextID].mainConnectionID = nextID;
532  }
533  else
534  {
535  connectionID = 0;
536  logVerbose(__func__,"Max limit reached.");
537  return (E_UNKNOWN);
538  }
539 
540  //now check the connectionTable for all connections in the route. IF connectionID exist
541  delay = calculateDelayForRoute(mainConnectionData.listConnectionID);
542  logVerbose("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID", mainConnectionData.sourceID, "sinkID:", mainConnectionData.sinkID, "delay:", delay, "assigned ID:", connectionID);
543 
544  if (mpDatabaseObserver)
545  {
546  am_MainConnectionType_s mainConnection;
547  mMappedData.mMainConnectionMap[nextID].getMainConnectionType(mainConnection);
548  mpDatabaseObserver->newMainConnection(mainConnection);
549  mpDatabaseObserver->mainConnectionStateChanged(connectionID, mMappedData.mMainConnectionMap[nextID].connectionState);
550  }
551 
552  //finally, we update the delay value for the maintable
553  if (delay == 0)
554  delay = -1;
555  (void)changeDelayMainConnection(delay, connectionID);
556 
557  return (E_OK);
558 }
559 
564 bool CAmDatabaseHandlerMap::insertSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
565 {
566  int16_t nextID = 0;
567  if( mMappedData.increaseID(nextID, mMappedData.mCurrentSinkID, sinkData.sinkID) )
568  {
569  sinkID = nextID;
570  mMappedData.mSinkMap[nextID] = sinkData;
571  mMappedData.mSinkMap[nextID].sinkID = nextID;
572  filterDuplicateNotificationConfigurationTypes(mMappedData.mSinkMap[nextID].listNotificationConfigurations);
573  filterDuplicateNotificationConfigurationTypes(mMappedData.mSinkMap[nextID].listMainNotificationConfigurations);
574  return (true);
575  }
576  else
577  {
578  sinkID = 0;
579  logVerbose(__func__,"Max limit reached!");
580  return (false);
581  }
582 }
583 
585 {
586  if(sinkData.sinkID>DYNAMIC_ID_BOUNDARY)
587  {
588  logError(__func__,"sinkID must be below:",DYNAMIC_ID_BOUNDARY);
589  return (E_NOT_POSSIBLE);
590  }
591  if(!existDomain(sinkData.domainID))
592  {
593  logError(__func__,"domainID must be valid");
594  return (E_NOT_POSSIBLE);
595  }
596  if(sinkData.name.empty())
597  {
598  logError(__func__,"sinkName must not be zero");
599  return (E_NOT_POSSIBLE);
600  }
601  if(!existSinkClass(sinkData.sinkClassID))
602  {
603  logError(__func__,"sinkClass must be valid");
604  return (E_NOT_POSSIBLE);
605  }
606 
607  if(!(sinkData.muteState>=MS_UNKNOWN && sinkData.muteState<=MS_MAX))
608  {
609  logError(__func__,"muteState must be valid");
610  return (E_NOT_POSSIBLE);
611  }
612 
613  am_sinkID_t temp_SinkID = 0;
614  am_sinkID_t temp_SinkIndex = 0;
615  //if sinkID is zero and the first Static Sink was already entered, the ID is created
616  am_Sink_s const *reservedDomain = objectMatchingPredicate<CAmSink, am_sinkID_t>(mMappedData.mSinkMap, [&](const CAmSink & obj){
617  return true==obj.reserved && obj.name.compare(sinkData.name)==0;
618  });
619  if( NULL!=reservedDomain )
620  {
621  am_sinkID_t oldSinkID = reservedDomain->sinkID;
622  mMappedData.mSinkMap[oldSinkID] = sinkData;
623  mMappedData.mSinkMap[oldSinkID].reserved = 0;
624  temp_SinkID = oldSinkID;
625  temp_SinkIndex = oldSinkID;
626  }
627  else
628  {
629  bool result;
630  if ( sinkData.sinkID != 0 || mFirstStaticSink )
631  {
632  //check if the ID already exists
633  if (existSinkNameOrID(sinkData.sinkID, sinkData.name))
634  {
635  sinkID = sinkData.sinkID;
636  return (E_ALREADY_EXISTS);
637  }
638  }
639  result = insertSinkDB(sinkData, temp_SinkID);
640  if( false == result )
641  return (E_UNKNOWN);
642  temp_SinkIndex = temp_SinkID;
643  }
644  //if the first static sink is entered, we need to set it onto the boundary
645  if (sinkData.sinkID == 0 && mFirstStaticSink)
646  {
647  mFirstStaticSink = false;
648  }
649  mMappedData.mSinkMap[temp_SinkIndex].sinkID = temp_SinkID;
650  sinkID = temp_SinkID;
651 
652  am_Sink_s & sink = mMappedData.mSinkMap[temp_SinkID];
653  logVerbose("DatabaseHandler::enterSinkDB entered new sink with name", sink.name, "domainID:", sink.domainID, "classID:", sink.sinkClassID, "volume:", sink.volume, "assigned ID:", sink.sinkID);
654 
655  if (mpDatabaseObserver != NULL)
656  {
657  sink.sinkID=sinkID;
658  mpDatabaseObserver->newSink(sink);
659  }
660  return (E_OK);
661 }
662 
663 bool CAmDatabaseHandlerMap::insertCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
664 {
665  int16_t nextID = 0;
666  if(mMappedData.increaseID(nextID, mMappedData.mCurrentCrossfaderID, crossfaderData.crossfaderID))
667  {
668  crossfaderID = nextID;
669  mMappedData.mCrossfaderMap[nextID] = crossfaderData;
670  mMappedData.mCrossfaderMap[nextID].crossfaderID = nextID;
671  return (true);
672  }
673  else
674  {
675  crossfaderID = 0;
676  logVerbose(__func__,"Max limit reached.");
677  return (false);
678  }
679 }
680 
682 {
683  if(crossfaderData.crossfaderID>DYNAMIC_ID_BOUNDARY)
684  {
685  logError(__func__,"crossfaderID must be below:",DYNAMIC_ID_BOUNDARY);
686  return (E_NOT_POSSIBLE);
687  }
688 
689  if(!(crossfaderData.hotSink>=HS_UNKNOWN && crossfaderData.hotSink<=HS_MAX))
690  {
691  logError(__func__,"hotSink must be valid");
692  return (E_NOT_POSSIBLE);
693  }
694  if(crossfaderData.name.empty())
695  {
696  logError(__func__,"crossfaderName must not be zero");
697  return (E_NOT_POSSIBLE);
698  }
699 
700  if(!existSink(crossfaderData.sinkID_A))
701  {
702  logError(__func__,"sinkID_A must exist");
703  return (E_NOT_POSSIBLE);
704  }
705  if(!existSink(crossfaderData.sinkID_B))
706  {
707  logError(__func__,"sinkID_B must exist");
708  return (E_NOT_POSSIBLE);
709  }
710  if(!existSource(crossfaderData.sourceID))
711  {
712  logError(__func__,"sourceID must exist");
713  return (E_NOT_POSSIBLE);
714  }
715 
716  am_crossfaderID_t temp_CrossfaderID = 0;
717  am_crossfaderID_t temp_CrossfaderIndex = 0;
718 
719  bool result;
720  //if gatewayData is zero and the first Static Sink was already entered, the ID is created
721  if (crossfaderData.crossfaderID != 0 || mFirstStaticCrossfader)
722  {
723  //check if the ID already exists
724  if (existCrossFader(crossfaderData.crossfaderID))
725  {
726  crossfaderID = crossfaderData.crossfaderID;
727  return (E_ALREADY_EXISTS);
728  }
729  }
730  result = insertCrossfaderDB(crossfaderData, temp_CrossfaderID);
731  if( false == result )
732  return (E_UNKNOWN);
733  temp_CrossfaderIndex = temp_CrossfaderID;
734 
735  //if the first static sink is entered, we need to set it onto the boundary
736  if ( 0==crossfaderData.crossfaderID && mFirstStaticCrossfader)
737  {
738  mFirstStaticCrossfader = false;
739  }
740 
741  mMappedData.mCrossfaderMap[temp_CrossfaderIndex].crossfaderID = temp_CrossfaderID;
742  crossfaderID = temp_CrossfaderID;
743  logVerbose("DatabaseHandler::enterCrossfaderDB entered new crossfader with name=", crossfaderData.name, "sinkA= ", crossfaderData.sinkID_A, "sinkB=", crossfaderData.sinkID_B, "source=", crossfaderData.sourceID, "assigned ID:", crossfaderID);
744 
745  if (mpDatabaseObserver)
746  mpDatabaseObserver->newCrossfader(mMappedData.mCrossfaderMap[temp_CrossfaderIndex]);
747  return (E_OK);
748 }
749 
750 bool CAmDatabaseHandlerMap::insertGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
751 {
752  int16_t nextID = 0;
753  if(mMappedData.increaseID(nextID, mMappedData.mCurrentGatewayID, gatewayData.gatewayID))
754  {
755  gatewayID = nextID;
756  mMappedData.mGatewayMap[nextID] = gatewayData;
757  mMappedData.mGatewayMap[nextID].gatewayID = nextID;
758  return (true);
759  }
760  else
761  {
762  gatewayID = 0;
763  logVerbose(__func__,"Max limit reached.");
764  return (false);
765  }
766 }
767 
769 {
770 
771  if(gatewayData.gatewayID>DYNAMIC_ID_BOUNDARY)
772  {
773  logError(__func__,"gatewayID must be below:",DYNAMIC_ID_BOUNDARY);
774  return (E_NOT_POSSIBLE);
775  }
776 
777  if(!existDomain(gatewayData.controlDomainID))
778  {
779  logError(__func__,"controlDomainID must be exist");
780  return (E_NOT_POSSIBLE);
781  }
782 
783  if(gatewayData.name.empty())
784  {
785  logError(__func__,"gatewayName must not be empty");
786  return (E_NOT_POSSIBLE);
787  }
788 
789  //might be that the sinks and sources are not there during registration time
790  //assert(existSink(gatewayData.sinkID));
791  //assert(existSource(gatewayData.sourceID));
792 
793  am_gatewayID_t temp_GatewayID = 0;
794  am_gatewayID_t temp_GatewayIndex = 0;
795  //if gatewayData is zero and the first Static Sink was already entered, the ID is created
796  bool result;
797  if (gatewayData.gatewayID != 0 || mFirstStaticGateway)
798  {
799  //check if the ID already exists
800  if (existGateway(gatewayData.gatewayID))
801  {
802  gatewayID = gatewayData.gatewayID;
803  return (E_ALREADY_EXISTS);
804  }
805  }
806  result = insertGatewayDB(gatewayData, temp_GatewayID);
807  if( false == result )
808  return (E_UNKNOWN);
809 
810  temp_GatewayIndex = temp_GatewayID;
811  //if the ID is not created, we add it to the query
812  if (gatewayData.gatewayID == 0 && mFirstStaticGateway)
813  {
814  mFirstStaticGateway = false;
815  }
816  mMappedData.mGatewayMap[temp_GatewayIndex].gatewayID = temp_GatewayID;
817  gatewayID = temp_GatewayID;
818 
819  logVerbose("DatabaseHandler::enterGatewayDB entered new gateway with name", gatewayData.name, "sourceID:", gatewayData.sourceID, "sinkID:", gatewayData.sinkID, "assigned ID:", gatewayID);
820  if (mpDatabaseObserver)
821  mpDatabaseObserver->newGateway(mMappedData.mGatewayMap[temp_GatewayIndex]);
822  return (E_OK);
823 }
824 
825 bool CAmDatabaseHandlerMap::insertConverterDB(const am_Converter_s & converteData, am_converterID_t & converterID)
826 {
827  int16_t nextID = 0;
828  if(mMappedData.increaseID(nextID, mMappedData.mCurrentConverterID, converteData.converterID))
829  {
830  converterID = nextID;
831  mMappedData.mConverterMap[nextID] = converteData;
832  mMappedData.mConverterMap[nextID].converterID = nextID;
833  return (true);
834  }
835  else
836  {
837  converterID = 0;
838  logVerbose(__func__,"Max limit reached.");
839  return (false);
840  }
841 }
842 
844 {
845  if(converterData.converterID>DYNAMIC_ID_BOUNDARY)
846  {
847  logError(__func__,"converterID must be below:",DYNAMIC_ID_BOUNDARY);
848  return (E_NOT_POSSIBLE);
849  }
850 
851  if(!existSink(converterData.sinkID))
852  {
853  logError(__func__,"sinkID must exists");
854  return (E_NOT_POSSIBLE);
855  }
856 
857  if(!existSource(converterData.sourceID))
858  {
859  logError(__func__,"sourceID must exists");
860  return (E_NOT_POSSIBLE);
861  }
862 
863  if(!existDomain(converterData.domainID))
864  {
865  logError(__func__,"domainID must exists");
866  return (E_NOT_POSSIBLE);
867  }
868 
869  if(converterData.name.empty())
870  {
871  logError(__func__,"converterName must not be empty");
872  return (E_NOT_POSSIBLE);
873  }
874 
875  //might be that the sinks and sources are not there during registration time
876  //assert(existSink(gatewayData.sinkID));
877  //assert(existSource(gatewayData.sourceID));
878 
879  am_converterID_t tempID = 0;
880  am_converterID_t tempIndex = 0;
881  //if gatewayData is zero and the first Static Sink was already entered, the ID is created
882  bool result;
883  if (converterData.converterID != 0 || mFirstStaticConverter)
884  {
885  //check if the ID already exists
886  if (existConverter(converterData.converterID))
887  {
888  converterID = converterData.converterID;
889  return (E_ALREADY_EXISTS);
890  }
891  }
892  result = insertConverterDB(converterData, tempID);
893  if( false == result )
894  return (E_UNKNOWN);
895 
896  tempIndex = tempID;
897  //if the ID is not created, we add it to the query
898  if (converterData.converterID == 0 && mFirstStaticConverter)
899  {
900  mFirstStaticConverter = false;
901  }
902  mMappedData.mConverterMap[tempIndex].converterID = tempID;
903  converterID = tempID;
904 
905  logVerbose("DatabaseHandler::enterConverterDB entered new converter with name", converterData.name, "sourceID:", converterData.sourceID, "sinkID:", converterData.sinkID, "assigned ID:", converterID);
906  if (mpDatabaseObserver)
907  mpDatabaseObserver->newConverter(mMappedData.mConverterMap[tempIndex]);
908  return (E_OK);
909 }
910 
911 void CAmDatabaseHandlerMap::dump( std::ostream & output ) const
912 {
913  output << std::endl << "****************** DUMP START ******************" << std::endl;
914  CAmMappedData::printMap(mMappedData.mDomainMap, output);
915  CAmMappedData::printMap(mMappedData.mSourceMap, output);
916  CAmMappedData::printMap(mMappedData.mSinkMap, output);
917  CAmMappedData::printMap(mMappedData.mSourceClassesMap, output);
918  CAmMappedData::printMap(mMappedData.mSinkClassesMap, output);
919  CAmMappedData::printMap(mMappedData.mConnectionMap, output);
920  CAmMappedData::printMap(mMappedData.mMainConnectionMap, output);
921  CAmMappedData::printMap(mMappedData.mCrossfaderMap, output);
922  CAmMappedData::printMap(mMappedData.mGatewayMap, output);
923  CAmVectorSystemProperties::const_iterator iter = mMappedData.mSystemProperties.begin();
924  output << "System properties" << "\n";
925  for(; iter!=mMappedData.mSystemProperties.end(); iter++)
926  output << "[type:" << iter->type << " value:" << iter->value << "]";
927  output << std::endl << "****************** DUMP END ******************" << std::endl;
928 }
929 
930 bool CAmDatabaseHandlerMap::insertSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
931 {
932  int16_t nextID = 0;
933  if(mMappedData.increaseID(nextID, mMappedData.mCurrentSourceID, sourceData.sourceID))
934  {
935  sourceID = nextID;
936  mMappedData.mSourceMap[nextID] = sourceData;
937  mMappedData.mSourceMap[nextID].sourceID = nextID;
938  filterDuplicateNotificationConfigurationTypes(mMappedData.mSourceMap[nextID].listNotificationConfigurations);
939  filterDuplicateNotificationConfigurationTypes(mMappedData.mSourceMap[nextID].listMainNotificationConfigurations);
940  return (true);
941  }
942  else
943  {
944  sourceID = 0;
945  logVerbose(__func__,"Max limit reached.");
946  return (false);
947  }
948 }
949 
951 {
952  if(sourceData.sourceID>DYNAMIC_ID_BOUNDARY)
953  {
954  logError(__func__,"sourceID must be below:",DYNAMIC_ID_BOUNDARY);
955  return (E_NOT_POSSIBLE);
956  }
957  if(!existDomain(sourceData.domainID))
958  {
959  logError(__func__,"domainID must be valid");
960  return (E_NOT_POSSIBLE);
961  }
962  if(sourceData.name.empty())
963  {
964  logError(__func__,"sourceName must not be zero");
965  return (E_NOT_POSSIBLE);
966  }
967  if(!existSourceClass(sourceData.sourceClassID))
968  {
969  logError(__func__,"sourceClassID must be valid");
970  return (E_NOT_POSSIBLE);
971  }
972 
973  if(!(sourceData.sourceState>=SS_UNKNNOWN && sourceData.sourceState<=SS_MAX))
974  {
975  logError(__func__,"sourceState must be valid");
976  return (E_NOT_POSSIBLE);
977  }
978 
979  bool isFirstStatic = sourceData.sourceID == 0 && mFirstStaticSource;
980  am_sourceID_t temp_SourceID = 0;
981  am_sourceID_t temp_SourceIndex = 0;
982  CAmSource const *reservedSource = objectMatchingPredicate<CAmSource, am_sourceID_t>(mMappedData.mSourceMap, [&](const CAmSource & obj){
983  return true==obj.reserved && obj.name.compare(sourceData.name)==0;
984  });
985  if( NULL != reservedSource )
986  {
987  am_sourceID_t oldSourceID = reservedSource->sourceID;
988  mMappedData.mSourceMap[oldSourceID] = sourceData;
989  mMappedData.mSourceMap[oldSourceID].reserved = 0;
990  temp_SourceID = oldSourceID;
991  temp_SourceIndex = oldSourceID;
992  }
993  else
994  {
995  bool result;
996  if ( !isFirstStatic )
997  {
998  //check if the ID already exists
999  if (existSourceNameOrID(sourceData.sourceID, sourceData.name))
1000  {
1001  sourceID = sourceData.sourceID;
1002  return (E_ALREADY_EXISTS);
1003  }
1004  }
1005  result = insertSourceDB(sourceData, temp_SourceID);
1006  if( false == result )
1007  return (E_UNKNOWN);
1008  temp_SourceIndex = temp_SourceID;
1009  }
1010 
1011  if ( isFirstStatic )
1012  {
1013  //if the first static sink is entered, we need to set it onto the boundary if needed
1014  mFirstStaticSource = false;
1015  }
1016  mMappedData.mSourceMap[temp_SourceIndex].sourceID = temp_SourceID;
1017  sourceID = temp_SourceID;
1018 
1019  logVerbose("DatabaseHandler::enterSourceDB entered new source with name", sourceData.name, "domainID:", sourceData.domainID, "classID:", sourceData.sourceClassID, "visible:", sourceData.visible, "assigned ID:", sourceID);
1020 
1021  if (mpDatabaseObserver)
1022  mpDatabaseObserver->newSource(mMappedData.mSourceMap[temp_SourceIndex]);
1023  return (E_OK);
1024 }
1025 
1027 {
1028  if(connection.connectionID!=0)
1029  {
1030  logError(__func__,"connectionID must be 0!");
1031  return (E_NOT_POSSIBLE);
1032  }
1033 
1034  if(!existSink(connection.sinkID))
1035  {
1036  logError(__func__,"sinkID must exist!");
1037  return (E_NOT_POSSIBLE);
1038  }
1039 
1040  if(!existSource(connection.sourceID))
1041  {
1042  logError(__func__,"sourceID must exist!");
1043  return (E_NOT_POSSIBLE);
1044  }
1045  //connection format is not checked, because it's project specific
1046  int16_t nextID = 0;
1047  if(mMappedData.increaseConnectionID(nextID))
1048  {
1049  connectionID = nextID;
1050  mMappedData.mConnectionMap[nextID] = connection;
1051  mMappedData.mConnectionMap[nextID].connectionID = nextID;
1052  mMappedData.mConnectionMap[nextID].reserved = true;
1053  }
1054  else
1055  {
1056  connectionID = 0;
1057  logVerbose(__func__,"Max limit reached.");
1058  return (E_UNKNOWN);
1059  }
1060 
1061  logVerbose("DatabaseHandler::enterConnectionDB entered new connection sinkID=", connection.sinkID, "sourceID=", connection.sourceID, "connectionFormat=", connection.connectionFormat, "assigned ID=", connectionID);
1062  return (E_OK);
1063 }
1064 
1065 bool CAmDatabaseHandlerMap::insertSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
1066 {
1067  int16_t nextID = 0;
1068  if(mMappedData.increaseID(nextID, mMappedData.mCurrentSinkClassesID, sinkClass.sinkClassID))
1069  {
1070  sinkClassID = nextID;
1071  mMappedData.mSinkClassesMap[nextID] = sinkClass;
1072  mMappedData.mSinkClassesMap[nextID].sinkClassID = nextID;
1073  return (true);
1074  }
1075  else
1076  {
1077  sinkClassID = 0;
1078  logVerbose(__func__,"Max limit reached.");
1079  return (false);
1080  }
1081 }
1082 
1084 {
1085  if(sinkClass.sinkClassID>DYNAMIC_ID_BOUNDARY)
1086  {
1087  logError(__func__,"sinkClassID must be <",DYNAMIC_ID_BOUNDARY);
1088  return (E_NOT_POSSIBLE);
1089  }
1090 
1091  if(sinkClass.name.empty())
1092  {
1093  logError(__func__,"name must not be empty");
1094  return (E_NOT_POSSIBLE);
1095  }
1096 
1097  am_sinkClass_t temp_SinkClassID = 0;
1098  am_sinkClass_t temp_SinkClassIndex = 0;
1099 
1100  bool result;
1101  if (sinkClass.sinkClassID != 0 || mFirstStaticSinkClass)
1102  {
1103  //check if the ID already exists
1104  if (existSinkClass(sinkClass.sinkClassID))
1105  {
1106  sinkClassID = sinkClass.sinkClassID;
1107  return (E_ALREADY_EXISTS);
1108  }
1109  }
1110  result = insertSinkClassDB(sinkClass, temp_SinkClassID);
1111  if( false == result )
1112  return (E_UNKNOWN);
1113 
1114  temp_SinkClassIndex = temp_SinkClassID;
1115  //if the ID is not created, we add it to the query
1116  if (sinkClass.sinkClassID == 0 && mFirstStaticSinkClass)
1117  {
1118  mFirstStaticSinkClass = false;
1119  }
1120  mMappedData.mSinkClassesMap[temp_SinkClassIndex].sinkClassID = temp_SinkClassID;
1121  sinkClassID = temp_SinkClassID;
1122 
1123  //todo:change last_insert implementations for multithreaded usage...
1124  logVerbose("DatabaseHandler::enterSinkClassDB entered new sinkClass");
1125  if (mpDatabaseObserver)
1126  mpDatabaseObserver->numberOfSinkClassesChanged();
1127  return (E_OK);
1128 }
1129 
1130 bool CAmDatabaseHandlerMap::insertSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
1131 {
1132  int16_t nextID = 0;
1133  if(mMappedData.increaseID(nextID, mMappedData.mCurrentSourceClassesID, sourceClass.sourceClassID))
1134  {
1135  sourceClassID = nextID;
1136  mMappedData.mSourceClassesMap[nextID] = sourceClass;
1137  mMappedData.mSourceClassesMap[nextID].sourceClassID = nextID;
1138  return (true);
1139  }
1140  else
1141  {
1142  sourceClassID = 0;
1143  logVerbose(__func__,"Max limit reached.");
1144  return (false);
1145  }
1146 }
1147 
1149 {
1150  if(sourceClass.sourceClassID>DYNAMIC_ID_BOUNDARY)
1151  {
1152  logError(__func__,"sourceClassID must be <",DYNAMIC_ID_BOUNDARY);
1153  return (E_NOT_POSSIBLE);
1154  }
1155 
1156  if(sourceClass.name.empty())
1157  {
1158  logError(__func__,"name must not be empty");
1159  return (E_NOT_POSSIBLE);
1160  }
1161 
1162 
1163  am_sourceClass_t temp_SourceClassID = 0;
1164  am_sourceClass_t temp_SourceClassIndex = 0;
1165 
1166  bool result;
1167  if (sourceClass.sourceClassID != 0 || mFirstStaticSourceClass)
1168  {
1169  //check if the ID already exists
1170  if (existSourceClass(sourceClass.sourceClassID))
1171  {
1172  sourceClassID = sourceClass.sourceClassID;
1173  return (E_ALREADY_EXISTS);
1174  }
1175  }
1176  result = insertSourceClassDB(temp_SourceClassID, sourceClass);
1177  if( false == result )
1178  return (E_UNKNOWN);
1179 
1180  temp_SourceClassIndex = temp_SourceClassID;
1181  //if the ID is not created, we add it to the query
1182  if (sourceClass.sourceClassID == 0 && mFirstStaticSourceClass)
1183  {
1184  mFirstStaticSinkClass = false;
1185  }
1186  mMappedData.mSourceClassesMap[temp_SourceClassIndex].sourceClassID = temp_SourceClassID;
1187  sourceClassID = temp_SourceClassID;
1188 
1189  //todo:change last_insert implementations for multithread usage...
1190 
1191  logVerbose("DatabaseHandler::enterSourceClassDB entered new sourceClass");
1192 
1193  if (mpDatabaseObserver)
1194  mpDatabaseObserver->numberOfSourceClassesChanged();
1195  return (E_OK);
1196 }
1197 
1198 am_Error_e CAmDatabaseHandlerMap::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
1199 {
1200  if(listSystemProperties.empty())
1201  {
1202  logError(__func__,"listSystemProperties must not be empty");
1203  return (E_NOT_POSSIBLE);
1204  }
1205 
1206  mMappedData.mSystemProperties = listSystemProperties;
1207 
1208  logVerbose("DatabaseHandler::enterSystemProperties entered system properties");
1209  return (E_OK);
1210 }
1211 
1212 am_Error_e CAmDatabaseHandlerMap::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
1213 {
1214  if(mainconnectionID==0)
1215  {
1216  logError(__func__,"mainconnectionID must not be 0");
1217  return (E_NOT_POSSIBLE);
1218  }
1219 
1220  if (!existMainConnection(mainconnectionID))
1221  {
1222  logError(__func__,"existMainConnection must exist");
1223  return (E_NON_EXISTENT);
1224  }
1225 
1226  int16_t delay = calculateDelayForRoute(listConnectionID);
1227 
1228  //now we replace the data in the main connection object with the new one
1229  mMappedData.mMainConnectionMap[mainconnectionID].listConnectionID = listConnectionID;
1230 
1231  if (changeDelayMainConnection(delay,mainconnectionID) == E_NO_CHANGE)
1232  logError("DatabaseHandler::changeMainConnectionRouteDB error while changing mainConnectionDelay to ", delay);
1233 
1234  logVerbose("DatabaseHandler::changeMainConnectionRouteDB entered new route:", mainconnectionID);
1235  return (E_OK);
1236 }
1237 
1239 {
1240  if(mainconnectionID==0)
1241  {
1242  logError(__func__,"mainconnectionID must not be 0");
1243  return (E_NOT_POSSIBLE);
1244  }
1245 
1246  if(!(connectionState>=CS_UNKNOWN && connectionState<=CS_MAX))
1247  {
1248  logError(__func__,"connectionState must be valid");
1249  return (E_NOT_POSSIBLE);
1250  }
1251 
1252  if (!existMainConnection(mainconnectionID))
1253  {
1254  logError(__func__,"existMainConnection must exist");
1255  return (E_NON_EXISTENT);
1256  }
1257 
1258  DB_COND_UPDATE_RIE(mMappedData.mMainConnectionMap[mainconnectionID].connectionState, connectionState);
1259 
1260  logVerbose("DatabaseHandler::changeMainConnectionStateDB changed mainConnectionState of MainConnection:", mainconnectionID, "to:", connectionState);
1261  if (mpDatabaseObserver)
1262  mpDatabaseObserver->mainConnectionStateChanged(mainconnectionID, connectionState);
1263  return (E_OK);
1264 }
1265 
1267 {
1268  if (!existSink(sinkID))
1269  {
1270  logError(__func__,"sinkID must exist");
1271  return (E_NON_EXISTENT);
1272  }
1273 
1274  DB_COND_UPDATE_RIE(mMappedData.mSinkMap[sinkID].mainVolume, mainVolume);
1275 
1276  logVerbose("DatabaseHandler::changeSinkMainVolumeDB changed mainVolume of sink:", sinkID, "to:", mainVolume);
1277 
1278  if (mpDatabaseObserver)
1279  mpDatabaseObserver->volumeChanged(sinkID, mainVolume);
1280 
1281  return (E_OK);
1282 }
1283 
1285 {
1286  if (!(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX))
1287  {
1288  logError(__func__,"availability must be valid");
1289  return (E_NOT_POSSIBLE);
1290  }
1291 
1292  if (!existSink(sinkID))
1293  {
1294  logError(__func__,"sinkID must exist");
1295  return (E_NON_EXISTENT);
1296  }
1297 
1298  DB_COND_UPDATE_RIE(mMappedData.mSinkMap[sinkID].available, availability);
1299 
1300  logVerbose("DatabaseHandler::changeSinkAvailabilityDB changed sinkAvailability of sink:", sinkID, "to:", availability.availability, "Reason:", availability.availabilityReason);
1301 
1302  if (mpDatabaseObserver && sinkVisible(sinkID))
1303  mpDatabaseObserver->sinkAvailabilityChanged(sinkID, availability);
1304  return (E_OK);
1305 }
1306 
1308 {
1309 
1310  if(!(domainState>=DS_UNKNOWN && domainState<=DS_MAX))
1311  {
1312  logError(__func__,"domainState must be valid");
1313  return (E_NOT_POSSIBLE);
1314  }
1315 
1316  if (!existDomain(domainID))
1317  {
1318  logError(__func__,"domainID must exist");
1319  return (E_NON_EXISTENT);
1320  }
1321 
1322  DB_COND_UPDATE_RIE(mMappedData.mDomainMap[domainID].state, domainState);
1323 
1324  logVerbose("DatabaseHandler::changDomainStateDB changed domainState of domain:", domainID, "to:", domainState);
1325  return (E_OK);
1326 }
1327 
1329 {
1330 
1331  if(!(muteState>=MS_UNKNOWN && muteState<=MS_MAX))
1332  {
1333  logError(__func__,"muteState must be valid");
1334  return (E_NOT_POSSIBLE);
1335  }
1336 
1337  if (!existSink(sinkID))
1338  {
1339  logError(__func__,"sinkID must exist");
1340  return (E_NON_EXISTENT);
1341  }
1342 
1343  DB_COND_UPDATE_RIE(mMappedData.mSinkMap[sinkID].muteState, muteState);
1344 
1345  logVerbose("DatabaseHandler::changeSinkMuteStateDB changed sinkMuteState of sink:", sinkID, "to:", muteState);
1346 
1347  if (mpDatabaseObserver)
1348  mpDatabaseObserver->sinkMuteStateChanged(sinkID, muteState);
1349 
1350  return (E_OK);
1351 }
1352 
1354 {
1355 
1356  if (!existSink(sinkID))
1357  {
1358  logError(__func__,"sinkID must exist");
1359  return (E_NON_EXISTENT);
1360  }
1361  am_Sink_Database_s & sink = mMappedData.mSinkMap[sinkID];
1362  std::vector<am_MainSoundProperty_s>::iterator elementIterator = sink.listMainSoundProperties.begin();
1363  for (;elementIterator != sink.listMainSoundProperties.end(); ++elementIterator)
1364  {
1365  if (elementIterator->type == soundProperty.type)
1366  {
1367  DB_COND_UPDATE_RIE(elementIterator->value, soundProperty.value);
1368  if(sink.cacheMainSoundProperties.size())
1369  sink.cacheMainSoundProperties[soundProperty.type] = soundProperty.value;
1370  break;
1371  }
1372  }
1373 
1374  logVerbose("DatabaseHandler::changeMainSinkSoundPropertyDB changed MainSinkSoundProperty of sink:", sinkID, "type:", soundProperty.type, "to:", soundProperty.value);
1375  if (mpDatabaseObserver)
1376  mpDatabaseObserver->mainSinkSoundPropertyChanged(sinkID, soundProperty);
1377  return (E_OK);
1378 }
1379 
1381 {
1382 
1383  if (!existSource(sourceID))
1384  {
1385  logError(__func__,"sourceID must exist");
1386  return (E_NON_EXISTENT);
1387  }
1388  am_Source_Database_s & source = mMappedData.mSourceMap.at(sourceID);
1389  std::vector<am_MainSoundProperty_s>::iterator elementIterator = source.listMainSoundProperties.begin();
1390  for (;elementIterator != source.listMainSoundProperties.end(); ++elementIterator)
1391  {
1392  if (elementIterator->type == soundProperty.type)
1393  {
1394  DB_COND_UPDATE_RIE(elementIterator->value, soundProperty.value);
1395  if(source.cacheMainSoundProperties.size())
1396  source.cacheMainSoundProperties[soundProperty.type] = soundProperty.value;
1397  break;
1398  }
1399  }
1400 
1401  logVerbose("DatabaseHandler::changeMainSourceSoundPropertyDB changed MainSinkSoundProperty of source:", sourceID, "type:", soundProperty.type, "to:", soundProperty.value);
1402 
1403  if (mpDatabaseObserver)
1404  mpDatabaseObserver->mainSourceSoundPropertyChanged(sourceID, soundProperty);
1405  return (E_OK);
1406 }
1407 
1409 {
1410  if(!(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX))
1411  {
1412  logError(__func__,"availability must be valid");
1413  return (E_NOT_POSSIBLE);
1414  }
1415 
1416  if (!existSource(sourceID))
1417  {
1418  logError(__func__,"sourceID must exist");
1419  return (E_NON_EXISTENT);
1420  }
1421 
1422  DB_COND_UPDATE_RIE(mMappedData.mSourceMap[sourceID].available, availability);
1423 
1424  logVerbose("DatabaseHandler::changeSourceAvailabilityDB changed changeSourceAvailabilityDB of source:", sourceID, "to:", availability.availability, "Reason:", availability.availabilityReason);
1425 
1426  if (mpDatabaseObserver && sourceVisible(sourceID))
1427  mpDatabaseObserver->sourceAvailabilityChanged(sourceID, availability);
1428  return (E_OK);
1429 }
1430 
1432 {
1433  std::vector<am_SystemProperty_s>::iterator elementIterator = mMappedData.mSystemProperties.begin();
1434  for (;elementIterator != mMappedData.mSystemProperties.end(); ++elementIterator)
1435  {
1436  if (elementIterator->type == property.type)
1437  DB_COND_UPDATE_RIE(elementIterator->value, property.value);
1438  }
1439 
1440  logVerbose("DatabaseHandler::changeSystemPropertyDB changed system property");
1441 
1442  if (mpDatabaseObserver)
1443  mpDatabaseObserver->systemPropertyChanged(property);
1444 
1445  return (E_OK);
1446 }
1447 
1449 {
1450 
1451  if (!existMainConnection(mainConnectionID))
1452  {
1453  logError(__func__,"mainConnectionID must exist");
1454  return (E_NON_EXISTENT);
1455  }
1456 
1457  mMappedData.mMainConnectionMap.erase(mainConnectionID);
1458 
1459  logVerbose("DatabaseHandler::removeMainConnectionDB removed:", mainConnectionID);
1460  if (mpDatabaseObserver)
1461  {
1462  mpDatabaseObserver->mainConnectionStateChanged(mainConnectionID, CS_DISCONNECTED);
1463  mpDatabaseObserver->removedMainConnection(mainConnectionID);
1464  }
1465  return (E_OK);
1466 }
1467 
1469 {
1470 
1471  if (!existSink(sinkID))
1472  {
1473  logError(__func__,"sinkID must exist");
1474  return (E_NON_EXISTENT);
1475  }
1476 
1477  bool visible = sinkVisible(sinkID);
1478 
1479  mMappedData.mSinkMap.erase(sinkID);
1480  // todo: Check the tables SinkMainSoundProperty and SinkMainNotificationConfiguration with 'visible' set to true
1481  //if visible is true then delete SinkMainSoundProperty and SinkMainNotificationConfiguration ????
1482  logVerbose("DatabaseHandler::removeSinkDB removed:", sinkID);
1483 
1484  if (mpDatabaseObserver != NULL)
1485  mpDatabaseObserver->removedSink(sinkID, visible);
1486 
1487  return (E_OK);
1488 }
1489 
1491 {
1492 
1493  if (!existSource(sourceID))
1494  {
1495  logError(__func__,"sourceID must exist");
1496  return (E_NON_EXISTENT);
1497  }
1498 
1499  bool visible = sourceVisible(sourceID);
1500 
1501  mMappedData.mSourceMap.erase(sourceID);
1502 
1503  // todo: Check the tables SourceMainSoundProperty and SourceMainNotificationConfiguration with 'visible' set to true
1504  //if visible is true then delete SourceMainSoundProperty and SourceMainNotificationConfiguration ????
1505 
1506  logVerbose("DatabaseHandler::removeSourceDB removed:", sourceID);
1507  if (mpDatabaseObserver)
1508  mpDatabaseObserver->removedSource(sourceID, visible);
1509  return (E_OK);
1510 }
1511 
1513 {
1514 
1515  if (!existGateway(gatewayID))
1516  {
1517  logError(__func__,"gatewayID must exist");
1518  return (E_NON_EXISTENT);
1519  }
1520 
1521  mMappedData.mGatewayMap.erase(gatewayID);
1522 
1523  logVerbose("DatabaseHandler::removeGatewayDB removed:", gatewayID);
1524  if (mpDatabaseObserver)
1525  mpDatabaseObserver->removeGateway(gatewayID);
1526  return (E_OK);
1527 }
1528 
1530 {
1531 
1532  if (!existConverter(converterID))
1533  {
1534  logError(__func__,"converterID must exist");
1535  return (E_NON_EXISTENT);
1536  }
1537 
1538  mMappedData.mConverterMap.erase(converterID);
1539 
1540  logVerbose("DatabaseHandler::removeConverterDB removed:", converterID);
1541  if (mpDatabaseObserver)
1542  mpDatabaseObserver->removeConverter(converterID);
1543  return (E_OK);
1544 }
1545 
1547 {
1548 
1549  if (!existCrossFader(crossfaderID))
1550  {
1551  logError(__func__,"crossfaderID must exist");
1552  return (E_NON_EXISTENT);
1553  }
1554  mMappedData.mCrossfaderMap.erase(crossfaderID);
1555 
1556  logVerbose("DatabaseHandler::removeCrossfaderDB removed:", crossfaderID);
1557  if (mpDatabaseObserver)
1558  mpDatabaseObserver->removeCrossfader(crossfaderID);
1559  return (E_OK);
1560 }
1561 
1563 {
1564 
1565  if (!existDomain(domainID))
1566  {
1567  logError(__func__,"domainID must exist");
1568  return (E_NON_EXISTENT);
1569  }
1570  mMappedData.mDomainMap.erase(domainID);
1571 
1572  logVerbose("DatabaseHandler::removeDomainDB removed:", domainID);
1573  if (mpDatabaseObserver)
1574  mpDatabaseObserver->removeDomain(domainID);
1575  return (E_OK);
1576 }
1577 
1579 {
1580 
1581  if (!existSinkClass(sinkClassID))
1582  {
1583  logError(__func__,"sinkClassID must exist");
1584  return (E_NON_EXISTENT);
1585  }
1586 
1587  mMappedData.mSinkClassesMap.erase(sinkClassID);
1588 
1589  logVerbose("DatabaseHandler::removeSinkClassDB removed:", sinkClassID);
1590  if (mpDatabaseObserver)
1591  mpDatabaseObserver->numberOfSinkClassesChanged();
1592 
1593  return (E_OK);
1594 }
1595 
1597 {
1598 
1599  if (!existSourceClass(sourceClassID))
1600  {
1601  logError(__func__,"sourceClassID must exist");
1602  return (E_NON_EXISTENT);
1603  }
1604 
1605  mMappedData.mSourceClassesMap.erase(sourceClassID);
1606  logVerbose("DatabaseHandler::removeSourceClassDB removed:", sourceClassID);
1607  if (mpDatabaseObserver)
1608  mpDatabaseObserver->numberOfSourceClassesChanged();
1609  return (E_OK);
1610 }
1611 
1613 {
1614  if (!existConnectionID(connectionID))
1615  {
1616  logError(__func__,"connectionID must exist",connectionID);
1617  return (E_NON_EXISTENT);
1618  }
1619 
1620  mMappedData.mConnectionMap.erase(connectionID);
1621 
1622  logVerbose("DatabaseHandler::removeConnection removed:", connectionID);
1623  return (E_OK);
1624 }
1625 
1627 {
1628 
1629  if (!existSource(sourceID))
1630  {
1631  logWarning(__func__,"sourceID must exist");
1632  return (E_NON_EXISTENT);
1633  }
1634  am_Source_Database_s source = mMappedData.mSourceMap.at(sourceID);
1635  classInfo.sourceClassID = source.sourceClassID;
1636 
1637  if (!existSourceClass(classInfo.sourceClassID))
1638  {
1639  return (E_NON_EXISTENT);
1640  }
1641  am_SourceClass_s tmpClass = mMappedData.mSourceClassesMap.at(classInfo.sourceClassID);
1642  classInfo = tmpClass;
1643 
1644  return (E_OK);
1645 }
1646 
1648 {
1649 
1650  if (!existSink(sinkID))
1651  {
1652  logWarning(__func__,"sinkID",sinkID,"does not exist");
1653  return (E_NON_EXISTENT);
1654  }
1655 
1656  am_Sink_Database_s mappedSink = mMappedData.mSinkMap.at(sinkID);
1657  if( true == mappedSink.reserved )
1658  return (E_NON_EXISTENT);
1659  sinkData = mappedSink;
1660 
1661  return (E_OK);
1662 }
1663 
1665 {
1666 
1667  if (!existSource(sourceID))
1668  {
1669  logWarning(__func__,"sourceID",sourceID,"does not exist");
1670  return (E_NON_EXISTENT);
1671  }
1672 
1673  am_Source_Database_s mappedSource = mMappedData.mSourceMap.at(sourceID);
1674  if( true == mappedSource.reserved )
1675  return (E_NON_EXISTENT);
1676 
1677  sourceData = mappedSource;
1678 
1679  return (E_OK);
1680 }
1681 
1683 {
1684  if (!existMainConnection(mainConnectionID))
1685  {
1686  logError(__func__,"mainConnectionID must exist");
1687  return (E_NON_EXISTENT);
1688  }
1689  am_MainConnection_s temp = mMappedData.mMainConnectionMap.at(mainConnectionID);
1690  mainConnectionData = temp;
1691 
1692  return (E_OK);
1693 }
1694 
1696 {
1697  if(sinkClass.listClassProperties.empty())
1698  {
1699  logError(__func__,"listClassProperties must not be empty");
1700  return (E_NOT_POSSIBLE);
1701  }
1702 
1703  //check if the ID already exists
1704  if (!existSinkClass(sinkClass.sinkClassID))
1705  {
1706  logError(__func__,"sinkClassID must exist");
1707  return (E_NON_EXISTENT);
1708  }
1709 
1710  DB_COND_UPDATE_RIE(mMappedData.mSinkClassesMap[sinkClass.sinkClassID].listClassProperties, sinkClass.listClassProperties);
1711 
1712  logVerbose("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo");
1713  return (E_OK);
1714 }
1715 
1717 {
1718  if(sourceClass.listClassProperties.empty())
1719  {
1720  logError(__func__,"listClassProperties must not be empty");
1721  return (E_NOT_POSSIBLE);
1722  }
1723 
1724  //check if the ID already exists
1725  if (!existSourceClass(sourceClass.sourceClassID))
1726  {
1727  logError(__func__,"sourceClassID must exist");
1728  return (E_NON_EXISTENT);
1729  }
1730 
1731  DB_COND_UPDATE_RIE(mMappedData.mSourceClassesMap[sourceClass.sourceClassID].listClassProperties, sourceClass.listClassProperties);
1732 
1733  logVerbose("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo");
1734  return (E_OK);
1735 }
1736 
1738 {
1739 
1740  if (!existSink(sinkID))
1741  {
1742  logWarning(__func__,"sinkID must exist");
1743  return (E_NON_EXISTENT);
1744  }
1745  am_Sink_Database_s sink = mMappedData.mSinkMap.at(sinkID);
1746  sinkClass.sinkClassID = sink.sinkClassID;
1747 
1748  if (!existSinkClass(sinkClass.sinkClassID))
1749  {
1750  logWarning(__func__,"sinkClassID must exist");
1751  return (E_NON_EXISTENT);
1752  }
1753  am_SinkClass_s tmpSinkClass = mMappedData.mSinkClassesMap.at(sinkClass.sinkClassID);
1754  sinkClass = tmpSinkClass;
1755 
1756  return (E_OK);
1757 }
1758 
1760 {
1761  if (!existGateway(gatewayID))
1762  {
1763  logWarning(__func__,"gatewayID must exist");
1764  return (E_NON_EXISTENT);
1765  }
1766 
1767  gatewayData = mMappedData.mGatewayMap.at(gatewayID);
1768 
1769  return (E_OK);
1770 
1771 }
1772 
1774 {
1775  if (!existConverter(converterID))
1776  {
1777  logWarning(__func__,"converterID must exist");
1778  return (E_NON_EXISTENT);
1779  }
1780 
1781  converterData = mMappedData.mConverterMap.at(converterID);
1782 
1783  return (E_OK);
1784 
1785 }
1786 
1788 {
1789  if (!existCrossFader(crossfaderID))
1790  {
1791  logWarning(__func__,"crossfaderID must exist");
1792  return (E_NON_EXISTENT);
1793  }
1794 
1795  crossfaderData = mMappedData.mCrossfaderMap.at(crossfaderID);
1796 
1797  return (E_OK);
1798 }
1799 
1800 am_Error_e CAmDatabaseHandlerMap::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
1801 {
1802  listSinkID.clear();
1803  if (!existDomain(domainID))
1804  {
1805  logWarning(__func__,"domainID must exist");
1806  return (E_NON_EXISTENT);
1807  }
1808 
1809  std::unordered_map<am_sinkID_t, am_Sink_Database_s>::const_iterator elementIterator = mMappedData.mSinkMap.begin();
1810  for (;elementIterator != mMappedData.mSinkMap.end(); ++elementIterator)
1811  {
1812  if (0==elementIterator->second.reserved && domainID==elementIterator->second.domainID)
1813  listSinkID.push_back(elementIterator->second.sinkID);
1814  }
1815  return (E_OK);
1816 }
1817 
1818 am_Error_e CAmDatabaseHandlerMap::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
1819 {
1820  listSourceID.clear();
1821  if (!existDomain(domainID))
1822  {
1823  logWarning(__func__,"domainID must exist");
1824  return (E_NON_EXISTENT);
1825  }
1826  CAmMapSource::const_iterator elementIterator = mMappedData.mSourceMap.begin();
1827  for (;elementIterator != mMappedData.mSourceMap.end(); ++elementIterator)
1828  {
1829  if (0==elementIterator->second.reserved && domainID==elementIterator->second.domainID)
1830  listSourceID.push_back(elementIterator->second.sourceID);
1831  }
1832 
1833  return (E_OK);
1834 }
1835 
1836 am_Error_e CAmDatabaseHandlerMap::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
1837 {
1838  listCrossfader.clear();
1839  if (!existDomain(domainID))
1840  {
1841  logWarning(__func__,"domainID must exist");
1842  return (E_NON_EXISTENT);
1843  }
1844 
1845  CAmMapSource::const_iterator sourceIterator = mMappedData.mSourceMap.begin();
1846  for (;sourceIterator != mMappedData.mSourceMap.end(); ++sourceIterator)
1847  {
1848  if (domainID==sourceIterator->second.domainID)
1849  {
1850  CAmMapCrossfader::const_iterator elementIterator = mMappedData.mCrossfaderMap.begin();
1851  for (;elementIterator != mMappedData.mCrossfaderMap.end(); ++elementIterator)
1852  {
1853  if ( sourceIterator->second.sourceID==elementIterator->second.sourceID )
1854  listCrossfader.push_back(elementIterator->second.crossfaderID);
1855  }
1856  }
1857  }
1858 
1859  return (E_OK);
1860 
1861 }
1862 
1863 am_Error_e CAmDatabaseHandlerMap::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
1864 {
1865  listGatewaysID.clear();
1866  if (!existDomain(domainID))
1867  {
1868  logWarning(__func__,"domainID must exist");
1869  return (E_NON_EXISTENT);
1870  }
1871 
1872  CAmMapGateway::const_iterator elementIterator = mMappedData.mGatewayMap.begin();
1873  for (;elementIterator != mMappedData.mGatewayMap.end(); ++elementIterator)
1874  {
1875  if (domainID==elementIterator->second.controlDomainID)
1876  listGatewaysID.push_back(elementIterator->second.gatewayID);
1877  }
1878  return (E_OK);
1879 }
1880 
1881 am_Error_e CAmDatabaseHandlerMap::getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConvertersID) const
1882 {
1883  listConvertersID.clear();
1884  if (!existDomain(domainID))
1885  {
1886  logWarning(__func__,"domainID must exist");
1887  return (E_NON_EXISTENT);
1888  }
1889 
1890  CAmMapConverter::const_iterator elementIterator = mMappedData.mConverterMap.begin();
1891  for (;elementIterator != mMappedData.mConverterMap.end(); ++elementIterator)
1892  {
1893  if (domainID==elementIterator->second.domainID)
1894  listConvertersID.push_back(elementIterator->second.converterID);
1895  }
1896  return (E_OK);
1897 }
1898 
1899 am_Error_e CAmDatabaseHandlerMap::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
1900 {
1901  listMainConnections.clear();
1902 
1903  CAmMapMainConnection::const_iterator elementIterator = mMappedData.mMainConnectionMap.begin();
1904  for (;elementIterator != mMappedData.mMainConnectionMap.end(); ++elementIterator)
1905  {
1906  listMainConnections.push_back(elementIterator->second);
1907  }
1908 
1909  return (E_OK);
1910 }
1911 
1912 am_Error_e CAmDatabaseHandlerMap::getListDomains(std::vector<am_Domain_s> & listDomains) const
1913 {
1914  listDomains.clear();
1915 
1916  CAmMapDomain::const_iterator elementIterator = mMappedData.mDomainMap.begin();
1917  for (;elementIterator != mMappedData.mDomainMap.end(); ++elementIterator)
1918  {
1919  if( 0==elementIterator->second.reserved )
1920  listDomains.push_back(elementIterator->second);
1921  }
1922 
1923  return (E_OK);
1924 }
1925 
1926 am_Error_e CAmDatabaseHandlerMap::getListConnections(std::vector<am_Connection_s> & listConnections) const
1927 {
1928  listConnections.clear();
1929 
1930  CAmMapConnection::const_iterator elementIterator = mMappedData.mConnectionMap.begin();
1931  for (;elementIterator != mMappedData.mConnectionMap.end(); ++elementIterator)
1932  {
1933  if( 0==elementIterator->second.reserved )
1934  listConnections.push_back(elementIterator->second);
1935  }
1936 
1937  return (E_OK);
1938 }
1939 
1940 am_Error_e CAmDatabaseHandlerMap::getListConnectionsReserved(std::vector<am_Connection_s> & listConnections) const
1941 {
1942  listConnections.clear();
1943 
1944  CAmMapConnection::const_iterator elementIterator = mMappedData.mConnectionMap.begin();
1945  for (;elementIterator != mMappedData.mConnectionMap.end(); ++elementIterator)
1946  {
1947  if( elementIterator->second.reserved )
1948  listConnections.push_back(elementIterator->second);
1949  }
1950 
1951  return (E_OK);
1952 }
1953 
1954 am_Error_e CAmDatabaseHandlerMap::getListSinks(std::vector<am_Sink_s> & listSinks) const
1955 {
1956  listSinks.clear();
1957 
1958  std::for_each(mMappedData.mSinkMap.begin(), mMappedData.mSinkMap.end(), [&](const std::pair<am_sinkID_t, am_Sink_Database_s>& ref) {
1959  if( 0==ref.second.reserved )
1960  listSinks.push_back(ref.second);
1961  });
1962 
1963  return (E_OK);
1964 }
1965 
1966 am_Error_e CAmDatabaseHandlerMap::getListSources(std::vector<am_Source_s> & listSources) const
1967 {
1968  listSources.clear();
1969 
1970  std::for_each(mMappedData.mSourceMap.begin(), mMappedData.mSourceMap.end(), [&](const std::pair<am_sourceID_t, am_Source_Database_s>& ref) {
1971  if( 0==ref.second.reserved )
1972  {
1973  listSources.push_back(ref.second);
1974  }
1975  });
1976  return (E_OK);
1977 }
1978 
1979 am_Error_e CAmDatabaseHandlerMap::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
1980 {
1981  listSourceClasses.clear();
1982 
1983  std::for_each(mMappedData.mSourceClassesMap.begin(), mMappedData.mSourceClassesMap.end(), [&](const std::pair<am_sourceClass_t, am_SourceClass_s>& ref) {
1984  listSourceClasses.push_back(ref.second);
1985  });
1986 
1987  return (E_OK);
1988 }
1989 
1990 am_Error_e CAmDatabaseHandlerMap::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
1991 {
1992  listCrossfaders.clear();
1993 
1994  std::for_each(mMappedData.mCrossfaderMap.begin(), mMappedData.mCrossfaderMap.end(), [&](const std::pair<am_crossfaderID_t, am_Crossfader_s>& ref) {
1995  listCrossfaders.push_back(ref.second);
1996  });
1997 
1998  return (E_OK);
1999 }
2000 
2001 am_Error_e CAmDatabaseHandlerMap::getListGateways(std::vector<am_Gateway_s> & listGateways) const
2002 {
2003  listGateways.clear();
2004 
2005  std::for_each(mMappedData.mGatewayMap.begin(), mMappedData.mGatewayMap.end(), [&](const std::pair<am_gatewayID_t, am_Gateway_s>& ref) {
2006  listGateways.push_back(ref.second);
2007  });
2008 
2009  return (E_OK);
2010 }
2011 
2012 am_Error_e CAmDatabaseHandlerMap::getListConverters(std::vector<am_Converter_s> & listConverters) const
2013 {
2014  listConverters.clear();
2015 
2016  std::for_each(mMappedData.mConverterMap.begin(), mMappedData.mConverterMap.end(), [&](const std::pair<am_converterID_t, am_Converter_s>& ref) {
2017  listConverters.push_back(ref.second);
2018  });
2019 
2020  return (E_OK);
2021 }
2022 
2023 am_Error_e CAmDatabaseHandlerMap::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
2024 {
2025  listSinkClasses.clear();
2026 
2027  std::for_each(mMappedData.mSinkClassesMap.begin(), mMappedData.mSinkClassesMap.end(), [&](const std::pair<am_gatewayID_t, am_SinkClass_s>& ref) {
2028  listSinkClasses.push_back(ref.second);
2029  });
2030 
2031  return (E_OK);
2032 }
2033 
2034 am_Error_e CAmDatabaseHandlerMap::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
2035 {
2036  listConnections.clear();
2037  std::for_each(mMappedData.mMainConnectionMap.begin(), mMappedData.mMainConnectionMap.end(), [&](const std::pair<am_mainConnectionID_t, am_MainConnection_Database_s>& ref) {
2038  listConnections.emplace_back();
2039  ref.second.getMainConnectionType(listConnections.back());
2040  });
2041 
2042  return (E_OK);
2043 }
2044 
2045 am_Error_e CAmDatabaseHandlerMap::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
2046 {
2047  listMainSinks.clear();
2048  std::for_each(mMappedData.mSinkMap.begin(), mMappedData.mSinkMap.end(), [&](const std::pair<am_sinkID_t, am_Sink_Database_s>& ref) {
2049  if( 0==ref.second.reserved && 1==ref.second.visible )
2050  {
2051  listMainSinks.emplace_back();
2052  ref.second.getSinkType(listMainSinks.back());
2053  }
2054  });
2055 
2056  return (E_OK);
2057 }
2058 
2059 am_Error_e CAmDatabaseHandlerMap::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
2060 {
2061  listMainSources.clear();
2062  std::for_each(mMappedData.mSourceMap.begin(), mMappedData.mSourceMap.end(), [&](const std::pair<am_sourceID_t, am_Source_Database_s>& ref) {
2063  if( 0==ref.second.reserved && 1==ref.second.visible )
2064  {
2065  listMainSources.emplace_back();
2066  ref.second.getSourceType(listMainSources.back());
2067  }
2068  });
2069 
2070  return (E_OK);
2071 }
2072 
2073 am_Error_e CAmDatabaseHandlerMap::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
2074 {
2075  if (!existSink(sinkID))
2076  {
2077  logWarning(__func__,"sinkID must exist");
2078  return E_NON_EXISTENT;
2079  }
2080 
2081  const am_Sink_s & sink = mMappedData.mSinkMap.at(sinkID);
2082  listSoundProperties = sink.listMainSoundProperties;
2083 
2084  return (E_OK);
2085 }
2086 
2087 am_Error_e CAmDatabaseHandlerMap::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
2088 {
2089  if (!existSource(sourceID))
2090  {
2091  logWarning(__func__,"sourceID must exist");
2092  return E_NON_EXISTENT;
2093  }
2094  const am_Source_s & source = mMappedData.mSourceMap.at(sourceID);
2095  listSourceProperties = source.listMainSoundProperties;
2096 
2097  return (E_OK);
2098 }
2099 
2100 am_Error_e CAmDatabaseHandlerMap::getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s>& listSoundproperties) const
2101 {
2102  if (!existSink(sinkID))
2103  {
2104  logWarning(__func__,"sinkID must exist");
2105  return E_NON_EXISTENT;
2106  }
2107 
2108  const am_Sink_Database_s & sink = mMappedData.mSinkMap.at(sinkID);
2109  listSoundproperties = sink.listSoundProperties;
2110 
2111  return (E_OK);
2112 }
2113 
2114 am_Error_e CAmDatabaseHandlerMap::getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s>& listSoundproperties) const
2115 {
2116  if (!existSource(sourceID))
2117  {
2118  logWarning(__func__,"sourceID must exist");
2119  return E_NON_EXISTENT;
2120  }
2121 
2122  const am_Source_Database_s & source = mMappedData.mSourceMap.at(sourceID);
2123  listSoundproperties = source.listSoundProperties;
2124 
2125  return (E_OK);
2126 }
2127 
2128 am_Error_e CAmDatabaseHandlerMap::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
2129 {
2130  listSystemProperties = mMappedData.mSystemProperties;
2131  return (E_OK);
2132 }
2133 
2134 am_Error_e am::CAmDatabaseHandlerMap::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_CustomConnectionFormat_t> & listConnectionFormats) const
2135 {
2136  if (!existSink(sinkID))
2137  {
2138  logWarning(__func__,"sinkID must exist");
2139  return E_NON_EXISTENT;
2140  }
2141  const am_Sink_s & sink = mMappedData.mSinkMap.at(sinkID);
2142  listConnectionFormats = sink.listConnectionFormats;
2143 
2144  return (E_OK);
2145 }
2146 
2147 am_Error_e am::CAmDatabaseHandlerMap::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_CustomConnectionFormat_t> & listConnectionFormats) const
2148 {
2149  if (!existSource(sourceID))
2150  {
2151  logWarning(__func__,"sourceID must exist");
2152  return E_NON_EXISTENT;
2153  }
2154  const am_Source_s & source = mMappedData.mSourceMap.at(sourceID);
2155  listConnectionFormats = source.listConnectionFormats;
2156 
2157  return (E_OK);
2158 }
2159 
2160 am_Error_e am::CAmDatabaseHandlerMap::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
2161 {
2162  if (!existGateway(gatewayID))
2163  {
2164  logWarning(__func__,"gatewayID must exist");
2165  return E_NON_EXISTENT;
2166  }
2167  ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
2168  iter = mListConnectionFormat.find(gatewayID);
2169  if (iter == mListConnectionFormat.end())
2170  {
2171  logWarning("DatabaseHandler::getListGatewayConnectionFormats database error with convertionFormat");
2172 
2173  return E_NON_EXISTENT;
2174  }
2175  listConnectionFormat = iter->second;
2176 
2177  return (E_OK);
2178 }
2179 
2181 {
2182  if (!existMainConnection(mainConnectionID))
2183  {
2184  logWarning(__func__,"mainConnectionID must exist");
2185  return E_NON_EXISTENT;
2186  }
2187  delay = -1;
2188 
2189  const am_MainConnection_s & mainConnection = mMappedData.mMainConnectionMap.at(mainConnectionID);
2190  delay = mainConnection.delay;
2191 
2192  if (delay == -1)
2193  return (E_NOT_POSSIBLE);
2194 
2195  return (E_OK);
2196 }
2197 
2199 {
2200  if (!existMainConnection(connectionID))
2201  {
2202  logError(__func__,"connectionID must exist");
2203  return E_NON_EXISTENT;
2204  }
2205  DB_COND_UPDATE_RIE(mMappedData.mMainConnectionMap[connectionID].delay, delay);
2206  if (mpDatabaseObserver)
2207  mpDatabaseObserver->timingInformationChanged(connectionID, delay);
2208  return (E_OK);
2209 }
2210 
2217 {
2218  return existsObjectWithKeyInMap(mainConnectionID, mMappedData.mMainConnectionMap);
2219 }
2220 
2227 {
2228  am_Source_Database_s const * source = objectForKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
2229  if( NULL!=source )
2230  return (0==source->reserved);
2231 
2232  return false;
2233 }
2234 
2241 bool CAmDatabaseHandlerMap::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
2242 {
2243  return sourceWithNameOrID(sourceID, name);
2244 }
2245 
2251 bool CAmDatabaseHandlerMap::existSourceName(const std::string & name) const
2252 {
2253  return existSourceNameOrID(mMappedData.mCurrentSourceID.mMax, name);
2254 }
2255 
2262 {
2263  bool returnVal = false;
2264  CAmMapSink::const_iterator elementIterator = mMappedData.mSinkMap.begin();
2265  for (;elementIterator != mMappedData.mSinkMap.end(); ++elementIterator)
2266  {
2267  if( 0==elementIterator->second.reserved &&
2268  sinkID==elementIterator->second.sinkID)
2269  {
2270  returnVal = true;
2271  break;
2272  }
2273  }
2274  return (returnVal);
2275 }
2276 
2283 const CAmDatabaseHandlerMap::am_Source_Database_s * CAmDatabaseHandlerMap::sourceWithNameOrID(const am_sourceID_t sourceID, const std::string & name) const
2284 {
2285  std::function<bool(const CAmDatabaseHandlerMap::am_Source_Database_s & refObject)> comparator = [&](const CAmDatabaseHandlerMap::am_Source_Database_s & source)->bool{
2286  return ( 0==source.reserved &&
2287  (sourceID==source.sourceID || name.compare(source.name)==0));
2288  };
2289  return objectMatchingPredicate(mMappedData.mSourceMap, comparator);
2290 }
2291 
2298 const CAmDatabaseHandlerMap::am_Sink_Database_s * CAmDatabaseHandlerMap::sinkWithNameOrID(const am_sinkID_t sinkID, const std::string & name) const
2299 {
2300  std::function<bool(const CAmDatabaseHandlerMap::am_Sink_Database_s & refObject)> comparator = [&](const CAmDatabaseHandlerMap::am_Sink_Database_s & sink)->bool{
2301  return ( 0==sink.reserved &&
2302  (sinkID==sink.sinkID || name.compare(sink.name)==0));
2303  };
2304  return objectMatchingPredicate(mMappedData.mSinkMap, comparator);
2305 }
2306 
2313 bool CAmDatabaseHandlerMap::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
2314 {
2315  return sinkWithNameOrID( sinkID, name)!=NULL;
2316 }
2317 
2323 bool CAmDatabaseHandlerMap::existSinkName(const std::string & name) const
2324 {
2325  return existSinkNameOrID(mMappedData.mCurrentSinkID.mMax, name);
2326 }
2327 
2334 {
2335  am_Domain_Database_s const * source = objectForKeyIfExistsInMap(domainID, mMappedData.mDomainMap);
2336  if( NULL!=source )
2337  return (0==source->reserved);
2338 
2339  return false;
2340 }
2341 
2348 {
2349  return existsObjectWithKeyInMap(gatewayID, mMappedData.mGatewayMap);
2350 }
2351 
2353 {
2354  return existsObjectWithKeyInMap(converterID, mMappedData.mConverterMap);
2355 }
2356 
2358 {
2359  domainID=0;
2360 
2361  am_Source_Database_s const * source = objectForKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
2362  if( NULL!=source )
2363  {
2364  domainID = source->domainID;
2365  return E_OK;
2366  }
2367  return E_NON_EXISTENT;
2368 }
2369 
2371 {
2372  domainID=0;
2373 
2374  am_Sink_Database_s const * source = objectForKeyIfExistsInMap(sinkID, mMappedData.mSinkMap);
2375  if( NULL!=source )
2376  {
2377  domainID = source->domainID;
2378  return E_OK;
2379  }
2380  return E_NON_EXISTENT;
2381 }
2382 
2384 {
2385  domainID=0;
2386 
2387  am_Crossfader_Database_s const * cross = objectForKeyIfExistsInMap(crossfader, mMappedData.mCrossfaderMap);
2388  if( NULL!=cross )
2389  {
2390  getDomainOfSource(cross->sinkID_A,domainID);
2391  return E_OK;
2392  }
2393  return E_NON_EXISTENT;
2394 }
2395 
2402 {
2403  return existsObjectWithKeyInMap(sinkClassID, mMappedData.mSinkClassesMap);
2404 }
2405 
2412 {
2413  return existsObjectWithKeyInMap(sourceClassID, mMappedData.mSourceClassesMap);
2414 }
2415 
2417 {
2418  if(!existConnectionID(connectionID))
2419  {
2420  logError(__func__,"connectionID must exist");
2421  return (E_NON_EXISTENT);
2422  }
2423 
2424  mMappedData.mConnectionMap[connectionID].delay = delay;
2425 
2426  //now we need to find all mainConnections that use the changed connection and update their timing
2427 
2428  //first get all route tables for all mainconnections
2429  am_Error_e error = E_OK;
2430  CAmMapMainConnection::const_iterator iter = mMappedData.mMainConnectionMap.begin();
2431  for(; iter != mMappedData.mMainConnectionMap.end(); ++iter)
2432  {
2433  const am_MainConnection_s & mainConnection = iter->second;
2434  if (std::find(mainConnection.listConnectionID.begin(), mainConnection.listConnectionID.end(), connectionID) != mainConnection.listConnectionID.end())
2435  {
2436  // Got it.
2437  error = changeDelayMainConnection(calculateMainConnectionDelay(mainConnection.mainConnectionID), mainConnection.mainConnectionID);
2438  }
2439  }
2440 
2441  return error;
2442 }
2443 
2445 {
2446  am_Connection_Database_s const * connection = objectForKeyIfExistsInMap(connectionID, mMappedData.mConnectionMap);
2447  if( NULL!=connection )
2448  {
2449  mMappedData.mConnectionMap.at(connectionID).reserved = false;
2450  return E_OK;
2451  }
2452  logError(__func__,"connectionID must exist");
2453  return (E_NON_EXISTENT);
2454 }
2455 
2456 am_timeSync_t CAmDatabaseHandlerMap::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
2457 {
2458  if (!existMainConnection(mainConnectionID))
2459  return -1;
2460  const am_MainConnection_s & mainConnection = mMappedData.mMainConnectionMap.at(mainConnectionID);
2461  am_timeSync_t delay = 0;
2462  std::vector<am_connectionID_t>::const_iterator iter = mainConnection.listConnectionID.begin();
2463  for(;iter<mainConnection.listConnectionID.end(); ++iter)
2464  {
2465  am_Connection_Database_s const * source = objectForKeyIfExistsInMap(*iter, mMappedData.mConnectionMap);
2466  if( NULL!=source )
2467  {
2468  delay += std::max(source->delay, static_cast<am_timeSync_t>(0));
2469  }
2470  }
2471  return (delay == 0 ? -1 : std::min(delay, static_cast<am_timeSync_t>(SHRT_MAX)));
2472 }
2473 
2479 {
2480  assert(iObserver!=NULL);
2481  mpDatabaseObserver = iObserver;
2482 }
2483 
2490 {
2491  if (!existSource(sourceID))
2492  {
2493  logError(__func__,"sourceID must exist");
2494  return false;
2495  }
2496  am_Source_Database_s source = mMappedData.mSourceMap.at(sourceID);
2497  return source.visible;
2498 }
2499 
2506 {
2507  am_Sink_Database_s const * source = objectForKeyIfExistsInMap(sinkID, mMappedData.mSinkMap);
2508  if( NULL!=source )
2509  {
2510  if(0==source->reserved)
2511  return source->visible;
2512  }
2513  return false;
2514 }
2515 
2523 {
2524  am_Connection_Database_s const * connectionObject = objectMatchingPredicate<am_Connection_Database_s, am_connectionID_t>(mMappedData.mConnectionMap, [&](const am_Connection_Database_s & obj){
2525  return false==obj.reserved &&
2526  connection.sinkID == obj.sinkID &&
2527  connection.sourceID == obj.sourceID &&
2528  connection.connectionFormat == obj.connectionFormat;
2529  });
2530  return ( NULL!=connectionObject );
2531 }
2532 
2539 {
2540  am_Connection_Database_s const * connection = objectForKeyIfExistsInMap(connectionID, mMappedData.mConnectionMap);
2541  if( NULL!=connection )
2542  {
2543  return (true);
2544  }
2545  return false;
2546 }
2547 
2554 {
2555  return existsObjectWithKeyInMap(crossfaderID, mMappedData.mCrossfaderMap);
2556 }
2557 
2559 {
2560  am_Source_Database_s const * source = objectForKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
2561  if( NULL!=source )
2562  {
2563  sourceState = source->sourceState;
2564  return (E_OK);
2565  }
2566  else
2567  {
2568  sourceState = SS_UNKNNOWN;
2569  return (E_NON_EXISTENT);
2570  }
2571 }
2572 
2574 {
2575  if(!(sourceState>=SS_UNKNNOWN && sourceState<=SS_MAX))
2576  {
2577  logError(__func__,"sourceState must be valid");
2578  return (E_NOT_POSSIBLE);
2579  }
2580 
2581  if(existSource(sourceID))
2582  {
2583  mMappedData.mSourceMap.at(sourceID).sourceState = sourceState;
2584  return (E_OK);
2585  }
2586  logError(__func__,"sourceID must exist");
2587  return (E_NON_EXISTENT);
2588 }
2589 
2591 
2592 
2593  am_Sink_Database_s const * source = objectForKeyIfExistsInMap(sinkID, mMappedData.mSinkMap);
2594  if( NULL!=source )
2595  {
2596  mainVolume = source->mainVolume;
2597  return (E_OK);
2598  }
2599  mainVolume = -1;
2600  logWarning(__func__,"sinkID must be valid");
2601  return (E_NON_EXISTENT);
2602 }
2603 
2605 {
2606 
2607  am_Sink_Database_s const * source = objectForKeyIfExistsInMap(sinkID, mMappedData.mSinkMap);
2608  if( NULL!=source )
2609  {
2610  volume = source->volume;
2611  return (E_OK);
2612  }
2613  volume = -1;
2614  logWarning(__func__,"sinkID must be valid");
2615  return (E_NON_EXISTENT);
2616 }
2617 
2619 {
2620  am_Source_Database_s const * source = objectForKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
2621  if( NULL!=source )
2622  {
2623  volume = source->volume;
2624  return (E_OK);
2625  }
2626  volume = -1;
2627  logWarning(__func__,"sourceID must be valid");
2628  return (E_NON_EXISTENT);
2629 }
2630 
2632 {
2633 
2634  am_Sink_Database_s * pObject = (am_Sink_Database_s *)objectForKeyIfExistsInMap(sinkID, mMappedData.mSinkMap);
2635  if( NULL!=pObject )
2636  {
2637  if(pObject->listSoundProperties.size()>0 && 0==pObject->cacheSoundProperties.size())
2638  {
2639  std::vector<am_SoundProperty_s>::const_iterator iter = pObject->listSoundProperties.begin();
2640  for(; iter<pObject->listSoundProperties.end(); ++iter)
2641  pObject->cacheSoundProperties[iter->type] = iter->value;
2642  }
2643  auto it = pObject->cacheSoundProperties.find(propertyType);
2644  if(it!=pObject->cacheSoundProperties.end())
2645  {
2646  value = it->second;
2647  return (E_OK);
2648  }
2649  }
2650  value = -1;
2651  logWarning(__func__,"sinkID must be valid");
2652  return (E_NON_EXISTENT);
2653 }
2654 
2656 {
2657  am_Source_Database_s * pObject = (am_Source_Database_s *)objectForKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
2658  if( NULL!=pObject )
2659  {
2660  if(pObject->listSoundProperties.size()>0 && 0==pObject->cacheSoundProperties.size())
2661  {
2662  std::vector<am_SoundProperty_s>::const_iterator iter = pObject->listSoundProperties.begin();
2663  for(; iter<pObject->listSoundProperties.end(); ++iter)
2664  pObject->cacheSoundProperties[iter->type] = iter->value;
2665  }
2666  auto it = pObject->cacheSoundProperties.find(propertyType);
2667  if(it!=pObject->cacheSoundProperties.end())
2668  {
2669  value = it->second;
2670  return (E_OK);
2671  }
2672  }
2673  value = -1;
2674  logWarning(__func__,"sourceID must be valid");
2675  return (E_NON_EXISTENT);
2676 }
2677 
2679 {
2680  am_Sink_Database_s * pObject = (am_Sink_Database_s *)objectForKeyIfExistsInMap(sinkID, mMappedData.mSinkMap);
2681  if( NULL!=pObject )
2682  {
2683  if(pObject->listMainSoundProperties.size()>0 && 0==pObject->cacheMainSoundProperties.size())
2684  {
2685  std::vector<am_MainSoundProperty_s>::const_iterator iter = pObject->listMainSoundProperties.begin();
2686  for(; iter<pObject->listMainSoundProperties.end(); ++iter)
2687  pObject->cacheMainSoundProperties[iter->type] = iter->value;
2688  }
2689  auto it = pObject->cacheMainSoundProperties.find(propertyType);
2690  if(it!=pObject->cacheMainSoundProperties.end())
2691  {
2692  value = it->second;
2693  return (E_OK);
2694  }
2695  }
2696  value = -1;
2697  logWarning(__func__,"sinkID must be valid");
2698  return (E_NON_EXISTENT);
2699 }
2700 
2702 {
2703 
2704  am_Source_Database_s * pObject = (am_Source_Database_s *)objectForKeyIfExistsInMap(sourceID, mMappedData.mSourceMap);
2705  if( NULL!=pObject )
2706  {
2707  if(pObject->listMainSoundProperties.size()>0 && 0==pObject->cacheMainSoundProperties.size())
2708  {
2709  std::vector<am_MainSoundProperty_s>::const_iterator iter = pObject->listMainSoundProperties.begin();
2710  for(; iter<pObject->listMainSoundProperties.end(); ++iter)
2711  pObject->cacheMainSoundProperties[iter->type] = iter->value;
2712  }
2713  auto it = pObject->cacheMainSoundProperties.find(propertyType);
2714  if(it!=pObject->cacheMainSoundProperties.end())
2715  {
2716  value = it->second;
2717  return (E_OK);
2718  }
2719  }
2720 
2721  value = -1;
2722  logWarning(__func__,"sourceID must be valid");
2723  return (E_NON_EXISTENT);
2724 }
2725 
2727 {
2728 
2729  am_Domain_Database_s const * source = objectForKeyIfExistsInMap(domainID, mMappedData.mDomainMap);
2730  if( NULL!=source )
2731  {
2732  state = source->state;
2733  return (E_OK);
2734  }
2735  state = DS_UNKNOWN;
2736  logWarning(__func__,"domainID must be valid");
2737  return (E_NON_EXISTENT);
2738 }
2739 
2740 am_Error_e CAmDatabaseHandlerMap::peekDomain(const std::string & name, am_domainID_t & domainID)
2741 {
2742  domainID=0;
2743 
2744  am_Domain_Database_s const *reservedDomain = objectMatchingPredicate<am_Domain_Database_s, am_domainID_t>(mMappedData.mDomainMap, [&](const am_Domain_Database_s & obj){
2745  return name.compare(obj.name)==0;
2746  });
2747 
2748  if( NULL != reservedDomain )
2749  {
2750  domainID = reservedDomain->domainID;
2751  return E_OK;
2752  }
2753  else
2754  {
2755  int16_t nextID = 0;
2756  if( mMappedData.increaseID( nextID, mMappedData.mCurrentDomainID) )
2757  {
2758  domainID = nextID;
2759  am_Domain_Database_s domain;
2760  domain.domainID = nextID;
2761  domain.name = name;
2762  domain.reserved = 1;
2763  mMappedData.mDomainMap[nextID] = domain;
2764  return E_OK;
2765  }
2766  return E_UNKNOWN;
2767  }
2768  return (E_OK);
2769 }
2770 
2771 am_Error_e CAmDatabaseHandlerMap::peekSink(const std::string & name, am_sinkID_t & sinkID)
2772 {
2773  am_Sink_Database_s const *reservedSink = objectMatchingPredicate<am_Sink_Database_s, am_sinkID_t>(mMappedData.mSinkMap, [&](const am_Sink_Database_s & obj){
2774  return name.compare(obj.name)==0;
2775  });
2776  if( NULL!=reservedSink )
2777  {
2778  sinkID = reservedSink->sinkID;
2779  return E_OK;
2780  }
2781  else
2782  {
2783  int16_t nextID = 0;
2784  if(mMappedData.increaseID(nextID, mMappedData.mCurrentSinkID))
2785  {
2786  if(mFirstStaticSink)
2787  {
2788  nextID = DYNAMIC_ID_BOUNDARY;
2789  mFirstStaticSink = false;
2790  }
2791  sinkID = nextID;
2792  am_Sink_Database_s object;
2793  object.sinkID = nextID;
2794  object.name = name;
2795  object.reserved = 1;
2796  mMappedData.mSinkMap[nextID] = object;
2797  return E_OK;
2798  }
2799  return E_UNKNOWN;
2800  }
2801 }
2802 
2803 am_Error_e CAmDatabaseHandlerMap::peekSource(const std::string & name, am_sourceID_t & sourceID)
2804 {
2805  am_Source_Database_s const *reservedSrc = objectMatchingPredicate<am_Source_Database_s, am_sourceID_t>(mMappedData.mSourceMap, [&](const am_Source_Database_s & obj){
2806  return name.compare(obj.name)==0;
2807  });
2808  if( NULL!=reservedSrc )
2809  {
2810  sourceID = reservedSrc->sourceID;
2811  return E_OK;
2812  }
2813  else
2814  {
2815  int16_t nextID = 0;
2816  if(mMappedData.increaseID(nextID, mMappedData.mCurrentSourceID))
2817  {
2818  if(mFirstStaticSource)
2819  {
2820 // nextID = DYNAMIC_ID_BOUNDARY;
2821  mFirstStaticSource = false;
2822  }
2823  sourceID = nextID;
2824  am_Source_Database_s object;
2825  object.sourceID = nextID;
2826  object.name = name;
2827  object.reserved = 1;
2828  mMappedData.mSourceMap[nextID] = object;
2829  return E_OK;
2830  }
2831  else
2832  return E_UNKNOWN;
2833  }
2834 }
2835 
2837 {
2838  if (!existSink(sinkID))
2839  {
2840  logError(__func__,"sinkID must be valid");
2841  return (E_NON_EXISTENT);
2842  }
2843 
2844  mMappedData.mSinkMap[sinkID].volume = volume;
2845  return (E_OK);
2846 }
2847 
2849 {
2850  if (!existSource(sourceID))
2851  {
2852  logError(__func__,"sourceID must be valid");
2853  return (E_NON_EXISTENT);
2854  }
2855  mMappedData.mSourceMap[sourceID].volume = volume;
2856 
2857  return (E_OK);
2858 }
2859 
2861 {
2862  if (!existSource(sourceID))
2863  {
2864  logError(__func__,"sourceID must be valid");
2865  return (E_NON_EXISTENT);
2866  }
2867 
2868  am_Source_Database_s & source = mMappedData.mSourceMap[sourceID];
2869  std::vector<am_SoundProperty_s>::iterator iter = source.listSoundProperties.begin();
2870  for(; iter<source.listSoundProperties.end(); ++iter)
2871  {
2872  if( soundProperty.type == iter->type )
2873  {
2874  iter->value = soundProperty.value;
2875  if(source.cacheSoundProperties.size())
2876  source.cacheSoundProperties[soundProperty.type] = soundProperty.value;
2877  return (E_OK);
2878  }
2879  }
2880  logError(__func__,"soundproperty type must be valid source:",sourceID,"type",soundProperty.type);
2881  return (E_NON_EXISTENT);
2882 }
2883 
2885 {
2886 
2887  if (!existSink(sinkID))
2888  {
2889  logError(__func__,"sinkID must be valid");
2890  return (E_NON_EXISTENT);
2891  }
2892  am_Sink_Database_s & sink = mMappedData.mSinkMap[sinkID];
2893  std::vector<am_SoundProperty_s>::iterator iter = sink.listSoundProperties.begin();
2894  for(; iter<sink.listSoundProperties.end(); ++iter)
2895  {
2896  if( soundProperty.type == iter->type )
2897  {
2898  iter->value = soundProperty.value;
2899  if(sink.cacheSoundProperties.size())
2900  sink.cacheSoundProperties[soundProperty.type] = soundProperty.value;
2901  return (E_OK);
2902  }
2903  }
2904  logError(__func__,"soundproperty type must be valid sinkID:",sinkID,"type",soundProperty.type);
2905  return (E_NON_EXISTENT);
2906 }
2907 
2909 {
2910 
2911  if (!existCrossFader(crossfaderID))
2912  {
2913  logError(__func__,"crossfaderID must be valid");
2914  return (E_NON_EXISTENT);
2915  }
2916 
2917  mMappedData.mCrossfaderMap[crossfaderID].hotSink = hotsink;
2918  return (E_OK);
2919 }
2920 
2922 {
2923  bool ret = isConnected(gateway);
2924  return ret;
2925 }
2926 
2928 {
2929  bool ret = isConnected(converter);
2930  return ret;
2931 }
2932 
2934 {
2935  if (name.empty())
2936  return (E_NON_EXISTENT);
2937  am_SinkClass_Database_s const *reserved = objectMatchingPredicate<am_SinkClass_Database_s, am_sinkClass_t>(mMappedData.mSinkClassesMap, [&](const am_SinkClass_Database_s & obj){
2938  return name.compare(obj.name)==0;
2939  });
2940  if( NULL!=reserved )
2941  {
2942  sinkClassID = reserved->sinkClassID;
2943  return E_OK;
2944  }
2945  return (E_NON_EXISTENT);
2946 }
2947 
2949 {
2950  if (name.empty())
2951  return (E_NON_EXISTENT);
2952  am_SourceClass_Database_s const *ptrSource = objectMatchingPredicate<am_SourceClass_Database_s, am_sourceClass_t>(mMappedData.mSourceClassesMap, [&](const am_SourceClass_Database_s & obj){
2953  return name.compare(obj.name)==0;
2954  });
2955  if( NULL!=ptrSource )
2956  {
2957  sourceClassID = ptrSource->sourceClassID;
2958  return E_OK;
2959  }
2960  return (E_NON_EXISTENT);
2961 }
2962 
2963 
2964 am_Error_e CAmDatabaseHandlerMap::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)
2965 {
2966 
2967  if (!existSource(sourceID))
2968  {
2969  logError(__func__,"sourceID must be valid");
2970  return (E_NON_EXISTENT);
2971  }
2972 
2974  am_sourceClass_t sourceClassOut(sourceClassID);
2975  std::vector<am_MainSoundProperty_s> listMainSoundPropertiesOut(listMainSoundProperties);
2976  //check if sinkClass needs to be changed
2977 
2978  std::unordered_map<am_sourceID_t, am_Source_Database_s>::iterator iter = mMappedData.mSourceMap.begin();
2979  for(; iter!=mMappedData.mSourceMap.end(); ++iter)
2980  {
2981  if( iter->second.sourceID == sourceID )
2982  {
2983  if (sourceClassID != 0)
2984  {
2985  DB_COND_UPDATE(iter->second.sourceClassID, sourceClassID);
2986  }
2987  else if (0 == iter->second.reserved)
2988  {
2989  sourceClassOut = iter->second.sourceClassID;
2990  }
2991  break;
2992  }
2993  }
2994 
2995  //check if soundProperties need to be updated
2996  if (!listSoundProperties.empty())
2997  {
2998  mMappedData.mSourceMap.at(sourceID).listSoundProperties = listSoundProperties;
2999  mMappedData.mSourceMap.at(sourceID).cacheSoundProperties.clear();
3000  }
3001 
3002  //check if we have to update the list of connectionformats
3003  if (!listConnectionFormats.empty())
3004  {
3005  mMappedData.mSourceMap.at(sourceID).listConnectionFormats = listConnectionFormats;
3006  }
3007 
3008  //then we need to check if we need to update the listMainSoundProperties
3009  if (sourceVisible(sourceID))
3010  {
3011  if (!listMainSoundProperties.empty())
3012  {
3013  DB_COND_UPDATE(mMappedData.mSourceMap.at(sourceID).listMainSoundProperties, listMainSoundProperties);
3014  mMappedData.mSourceMap.at(sourceID).cacheMainSoundProperties.clear();
3015  }
3016  else
3017  {
3018  getListMainSourceSoundProperties(sourceID,listMainSoundPropertiesOut);
3019  }
3020  }
3021 
3022  if (DB_COND_ISMODIFIED)
3023  {
3024  logVerbose("DatabaseHandler::changeSource changed changeSource of source:", sourceID);
3025 
3026  if (mpDatabaseObserver != NULL)
3027  {
3028  mpDatabaseObserver->sourceUpdated(sourceID,sourceClassOut,listMainSoundPropertiesOut,sourceVisible(sourceID));
3029  }
3030  }
3031 
3032  return (E_OK);
3033 
3034 }
3035 
3036 am_Error_e CAmDatabaseHandlerMap::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)
3037 {
3038 
3040  am_sinkClass_t sinkClassOut(sinkClassID);
3041  std::vector<am_MainSoundProperty_s> listMainSoundPropertiesOut(listMainSoundProperties);
3042 
3043  if (!existSink(sinkID))
3044  {
3045  logError(__func__,"sinkID must be valid");
3046  return (E_NON_EXISTENT);
3047  }
3048 
3049  std::unordered_map<am_sinkID_t, am_Sink_Database_s>::iterator iter = mMappedData.mSinkMap.begin();
3050  for(; iter!=mMappedData.mSinkMap.end(); ++iter)
3051  {
3052  if (iter->second.sinkID == sinkID)
3053  {
3054  if (sinkClassID != 0)
3055  {
3056  DB_COND_UPDATE(iter->second.sinkClassID, sinkClassID);
3057  }
3058  else if (0 == iter->second.reserved)
3059  {
3060  sinkClassOut = iter->second.sinkClassID;
3061  }
3062  break;
3063  }
3064  }
3065 
3066  //check if soundProperties need to be updated
3067  if (!listSoundProperties.empty())
3068  {
3069  mMappedData.mSinkMap.at(sinkID).listSoundProperties = listSoundProperties;
3070  mMappedData.mSinkMap.at(sinkID).cacheSoundProperties.clear();
3071  }
3072 
3073  //check if we have to update the list of connectionformats
3074  if (!listConnectionFormats.empty())
3075  {
3076  mMappedData.mSinkMap.at(sinkID).listConnectionFormats = listConnectionFormats;
3077  }
3078 
3079  //then we need to check if we need to update the listMainSoundProperties
3080  if (sinkVisible(sinkID))
3081  {
3082  if (!listMainSoundProperties.empty())
3083  {
3084  DB_COND_UPDATE(mMappedData.mSinkMap.at(sinkID).listMainSoundProperties, listMainSoundProperties);
3085  mMappedData.mSinkMap.at(sinkID).cacheMainSoundProperties.clear();
3086  }
3087  else //read out the properties
3088  {
3089  getListMainSinkSoundProperties(sinkID,listMainSoundPropertiesOut);
3090  }
3091  }
3092 
3093  if (DB_COND_ISMODIFIED)
3094  {
3095  logVerbose("DatabaseHandler::changeSink changed changeSink of sink:", sinkID);
3096 
3097  if (mpDatabaseObserver != NULL)
3098  {
3099  mpDatabaseObserver->sinkUpdated(sinkID,sinkClassOut,listMainSoundPropertiesOut,sinkVisible(sinkID));
3100  }
3101  }
3102 
3103  return (E_OK);
3104 }
3105 
3106 am_Error_e CAmDatabaseHandlerMap::getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
3107 {
3108 
3109  if (!existSink(sinkID))
3110  {
3111  logWarning(__func__,"sinkID must be valid");
3112  return (E_DATABASE_ERROR);
3113  }
3114  listMainNotificationConfigurations.clear();
3115 
3116  listMainNotificationConfigurations = mMappedData.mSinkMap.at(sinkID).listMainNotificationConfigurations;
3117 
3118  return (E_OK);
3119 }
3120 
3121 am_Error_e CAmDatabaseHandlerMap::getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations)
3122 {
3123 
3124  if (!existSource(sourceID))
3125  {
3126  logWarning(__func__,"sourceID must be valid");
3127  return (E_DATABASE_ERROR);
3128  }
3129 
3130  listMainNotificationConfigurations = mMappedData.mSourceMap.at(sourceID).listMainNotificationConfigurations;
3131 
3132  return (E_OK);
3133 }
3134 
3135 bool changeMainNotificationConfiguration(std::vector<am_NotificationConfiguration_s> & listMainNotificationConfigurations,
3136  const am_NotificationConfiguration_s & mainNotificationConfiguration)
3137 {
3138  std::vector<am_NotificationConfiguration_s>::iterator iter = listMainNotificationConfigurations.begin();
3139  for(; iter<listMainNotificationConfigurations.end(); ++iter)
3140  {
3141  if( mainNotificationConfiguration.type == iter->type )
3142  {
3143 #ifdef WITH_DATABASE_CHANGE_CHECK
3144  if( iter->status == mainNotificationConfiguration.status && iter->parameter == mainNotificationConfiguration.parameter )
3145  return false;
3146 #endif
3147  *iter = mainNotificationConfiguration;
3148  return true;
3149  }
3150  }
3151  return false;
3152 }
3153 
3155 {
3156 
3157  if (!existSink(sinkID))
3158  {
3159  logError(__func__,"sinkID must be valid");
3160  return (E_NON_EXISTENT);
3161  }
3162  if(!changeMainNotificationConfiguration(mMappedData.mSinkMap.at(sinkID).listMainNotificationConfigurations, mainNotificationConfiguration))
3163  return (E_NO_CHANGE);
3164 
3165  logVerbose("DatabaseHandler::changeMainSinkNotificationConfigurationDB changed MainNotificationConfiguration of source:", sinkID, "type:", mainNotificationConfiguration.type, "to status=", mainNotificationConfiguration.status, "and parameter=",mainNotificationConfiguration.parameter);
3166 
3167  if (mpDatabaseObserver)
3168  mpDatabaseObserver->sinkMainNotificationConfigurationChanged(sinkID, mainNotificationConfiguration);
3169  return (E_OK);
3170 }
3171 
3173 {
3174 
3175  if (!existSource(sourceID))
3176  {
3177  logError(__func__,"sourceID must be valid");
3178  return (E_NON_EXISTENT);
3179  }
3180 
3181  if(!changeMainNotificationConfiguration(mMappedData.mSourceMap.at(sourceID).listMainNotificationConfigurations, mainNotificationConfiguration))
3182  return (E_NO_CHANGE);
3183 
3184  logVerbose("DatabaseHandler::changeMainSourceNotificationConfigurationDB changed MainNotificationConfiguration of source:", sourceID, "type:", mainNotificationConfiguration.type, "to status=", mainNotificationConfiguration.status, "and parameter=",mainNotificationConfiguration.parameter);
3185 
3186  if (mpDatabaseObserver)
3187  mpDatabaseObserver->sourceMainNotificationConfigurationChanged(sourceID, mainNotificationConfiguration);
3188  return (E_OK);
3189 }
3190 
3191 am_Error_e CAmDatabaseHandlerMap::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)
3192 {
3193 
3194  if (!existGateway(gatewayID))
3195  {
3196  logError(__func__,"gatewayID must be valid");
3197  return (E_NON_EXISTENT);
3198  }
3199 
3200  if (!listSourceConnectionFormats.empty())
3201  {
3202  mMappedData.mGatewayMap.at(gatewayID).listSourceFormats = listSourceConnectionFormats;
3203  }
3204 
3205  if (!listSinkConnectionFormats.empty())
3206  {
3207  mMappedData.mGatewayMap.at(gatewayID).listSinkFormats = listSinkConnectionFormats;
3208  }
3209 
3210  if (!convertionMatrix.empty())
3211  {
3212  mListConnectionFormat.clear();
3213  mListConnectionFormat.insert(std::make_pair(gatewayID, convertionMatrix));
3214  }
3215 
3216  logVerbose("DatabaseHandler::changeGatewayDB changed Gateway with ID", gatewayID);
3217 
3218  //todo: check if observer needs to be adopted.
3219  return (E_OK);
3220 }
3221 
3222 am_Error_e CAmDatabaseHandlerMap::changeConverterDB(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
3223 {
3224 
3225  if (!existConverter(converterID))
3226  {
3227  logError(__func__,"converterID must be valid");
3228  return (E_NON_EXISTENT);
3229  }
3230 
3231  if (!listSourceConnectionFormats.empty())
3232  {
3233  mMappedData.mConverterMap.at(converterID).listSourceFormats = listSourceConnectionFormats;
3234  }
3235 
3236  if (!listSinkConnectionFormats.empty())
3237  {
3238  mMappedData.mConverterMap.at(converterID).listSinkFormats = listSinkConnectionFormats;
3239  }
3240 
3241  if (!convertionMatrix.empty())
3242  {
3243  mListConnectionFormat.clear();
3244  mListConnectionFormat.insert(std::make_pair(converterID, convertionMatrix));
3245  }
3246 
3247  logVerbose("DatabaseHandler::changeConverterDB changed Gateway with ID", converterID);
3248 
3249  //todo: check if observer needs to be adopted.
3250  return (E_OK);
3251 }
3252 
3253 bool changeNotificationConfiguration(std::vector<am_NotificationConfiguration_s> & listNotificationConfigurations, const am_NotificationConfiguration_s & notificationConfiguration)
3254 {
3255  bool changed = false;
3256  std::vector<am_NotificationConfiguration_s>::iterator iter = listNotificationConfigurations.begin();
3257  for(; iter<listNotificationConfigurations.end(); ++iter)
3258  {
3259  if( notificationConfiguration.type == iter->type )
3260  {
3261  iter->status = notificationConfiguration.status;
3262  iter->parameter = notificationConfiguration.parameter;
3263  changed |= true;
3264  }
3265  }
3266  return changed;
3267 }
3268 
3270 {
3271 
3272  if (!existSink(sinkID))
3273  {
3274  logError(__func__,"sinkID must be valid");
3275  return (E_NON_EXISTENT);
3276  }
3277  if(!changeNotificationConfiguration(mMappedData.mSinkMap.at(sinkID).listNotificationConfigurations, notificationConfiguration))
3278  return (E_NO_CHANGE);
3279 
3280  logVerbose("DatabaseHandler::changeMainSinkNotificationConfigurationDB changed MainNotificationConfiguration of source:", sinkID, "type:", notificationConfiguration.type, "to status=", notificationConfiguration.status, "and parameter=",notificationConfiguration.parameter);
3281 
3282  //todo:: inform obsever here...
3283  return (E_NON_EXISTENT);
3284 }
3285 
3287 {
3288 
3289  if (!existSource(sourceID))
3290  {
3291  logError(__func__,"sourceID must be valid");
3292  return (E_NON_EXISTENT);
3293  }
3294 
3295  if(!changeNotificationConfiguration(mMappedData.mSourceMap.at(sourceID).listNotificationConfigurations, notificationConfiguration))
3296  return (E_NO_CHANGE);
3297 
3298  logVerbose("DatabaseHandler::changeSourceNotificationConfigurationDB changed MainNotificationConfiguration of source:", sourceID, "type:", notificationConfiguration.type, "to status=", notificationConfiguration.status, "and parameter=",notificationConfiguration.parameter);
3299 
3300  //todo:: implement observer function
3301  return (E_NON_EXISTENT);
3302 }
3303 
3304 am_Error_e CAmDatabaseHandlerMap::enumerateSources(std::function<void(const am_Source_s & element)> cb) const
3305 {
3306  for(auto it = mMappedData.mSourceMap.begin(); it!=mMappedData.mSourceMap.end(); it++)
3307  {
3308  const am_Source_Database_s *pObject = &it->second;
3309  if( 0==pObject->reserved )
3310  cb(*pObject);
3311  }
3312  return E_OK;
3313 }
3314 
3315 am_Error_e CAmDatabaseHandlerMap::enumerateSinks(std::function<void(const am_Sink_s & element)> cb) const
3316 {
3317  for(auto it = mMappedData.mSinkMap.begin(); it!=mMappedData.mSinkMap.end(); it++)
3318  {
3319  const am_Sink_Database_s *pObject = &it->second;
3320  if( 0==pObject->reserved )
3321  cb(*pObject);
3322  }
3323  return E_OK;
3324 }
3325 
3326 am_Error_e CAmDatabaseHandlerMap::enumerateGateways(std::function<void(const am_Gateway_s & element)> cb) const
3327 {
3328  for(auto it = mMappedData.mGatewayMap.begin(); it!=mMappedData.mGatewayMap.end(); it++)
3329  {
3330  const am_Gateway_s *pObject = &it->second;
3331  cb(*pObject);
3332  }
3333  return E_OK;
3334 }
3335 
3336 am_Error_e CAmDatabaseHandlerMap::enumerateConverters(std::function<void(const am_Converter_s & element)> cb) const
3337 {
3338  for(auto it = mMappedData.mConverterMap.begin(); it!=mMappedData.mConverterMap.end(); it++)
3339  {
3340  const am_Converter_s *pObject = &it->second;
3341  cb(*pObject);
3342  }
3343  return E_OK;
3344 }
3345 
3346 }
am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s &mainConnectionData) const
am_Error_e getListSinkClasses(std::vector< am_SinkClass_s > &listSinkClasses) const
am_sourceID_t sourceID
The sourceID of the converter sink-end.
am_Error_e removeConverterDB(const am_converterID_t converterID)
am_Error_e getListGateways(std::vector< am_Gateway_s > &listGateways) const
std::string busname
the busname.
am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
am_Error_e getListConnections(std::vector< am_Connection_s > &listConnections) const
std::string name
The name of the crossfader.
am_Error_e changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
am_Error_e changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector< am_SoundProperty_s > &listSoundProperties, const std::vector< am_CustomAvailabilityReason_t > &listConnectionFormats, const std::vector< am_MainSoundProperty_s > &listMainSoundProperties)
am_MuteState_e muteState
This attribute reflects the muteState of the sink.
uint16_t am_connectionID_t
a connection ID
uint16_t am_CustomSoundPropertyType_t
Within genivi only the some example properties are defined.
void mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s &SoundProperty)
am_Error_e changeDelayMainConnection(const am_timeSync_t &delay, const am_mainConnectionID_t &connectionID)
am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector< am_sourceID_t > &listSourceID) const
std::vector< am_ClassProperty_s > listClassProperties
the list of the class properties.
bool sourceVisible(const am_sourceID_t sourceID) const
gives information about the visibility of a source
void logWarning(T value, TArgs...args)
logs given values with warninglevel with the default context
am_converterID_t converterID
This is the ID of the converter, it is unique in the system.
am_sourceClass_t sourceClassID
the source ID
the desired object is non existent
bool existsObjectWithKeyInMap(const TMapKeyType &key, const std::unordered_map< TMapKeyType, TMapObjectType > &map)
bool existSourceName(const std::string &name) const
checks if a name exits
uint16_t am_sinkClass_t
am_CustomNotificationType_t type
The notification type of the notification.
am_Error_e
the errors of the audiomanager.
am_Error_e changeConnectionFinal(const am_connectionID_t connectionID)
This struct holds information about the configuration for notifications.
the desired object already exists
am_Error_e peekDomain(const std::string &name, am_domainID_t &domainID)
am_Error_e changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s notificationConfiguration)
am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector< am_SoundProperty_s > &listSoundproperties) const
am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector< am_MainSoundProperty_s > &listSoundProperties) const
std::vector< am_ClassProperty_s > listClassProperties
the list of the class properties.
void sourceMainNotificationConfigurationChanged(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration)
void newConverter(const am_Converter_s &coverter)
struct describing source classes
This struct describes the attribiutes of a sink.
bool sinkVisible(const am_sinkID_t sinkID) const
gives information about the visibility of a sink
int16_t value
the actual value
am_DomainState_e state
the current domain state
am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector< am_NotificationConfiguration_s > &listMainNotificationConfigurations)
am_sinkID_t sinkID_A
The sinkID of the SinkA.
void sourceUpdated(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector< am_MainSoundProperty_s > &listMainSoundProperties, const bool visible)
am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t &domainID) const
am_Error_e changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s &sinkData) const
am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
am_Error_e getListSources(std::vector< am_Source_s > &lisSources) const
const TReturn * objectMatchingPredicate(const std::unordered_map< TIdentifier, TReturn > &map, std::function< bool(const TReturn &refObject)> comparator)
Returns an object matching predicate.
am_Error_e enumerateSinks(std::function< void(const am_Sink_s &element)> cb) const
am_sinkID_t sinkID
This is the ID of the sink, it is unique in the system.
am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID)
This struct describes the attribiutes of a domain.
void sinkUpdated(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector< am_MainSoundProperty_s > &listMainSoundProperties, const bool visible)
am_domainID_t controlDomainID
This is the ID of the domain that registers the gateway.
void newSource(const am_Source_s &source)
uint16_t am_crossfaderID_t
a crossfader ID
am_sinkID_t sinkID
the sinkID
uint16_t am_CustomConnectionFormat_t
This type classifies the format in which data is exchanged within a connection.
void removedSink(const am_sinkID_t sinkID, const bool visible)
am_sinkID_t sinkID
The sinkID of the convertersink-end.
am_HotSink_e hotSink
This enum can have 3 states:
am_Error_e getListMainSources(std::vector< am_SourceType_s > &listMainSources) const
uint16_t am_CustomMainSoundPropertyType_t
Here are all SoundProperties that can be set via the CommandInterface.
am_Error_e changeSinkAvailabilityDB(const am_Availability_s &availability, const am_sinkID_t sinkID)
am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector< am_crossfaderID_t > &listGatewaysID) const
am_Error_e changeDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
am_crossfaderID_t crossfaderID
This is the ID of the crossfader, it is unique in the system.
am_SourceState_e sourceState
The source state is an indication towards the source if it is actively heard or not.
bool isDataEqual(const T &left, const T &right)
int16_t am_timeSync_t
offset time that is introduced in milli seconds.
am_Error_e enumerateSources(std::function< void(const am_Source_s &element)> cb) const
am_Error_e changeSystemPropertyDB(const am_SystemProperty_s &property)
void registerObserver(CAmDatabaseObserver *iObserver)
registers the Observer at the Database
am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector< am_SoundProperty_s > &listSoundproperties) const
bool existSink(const am_sinkID_t sinkID) const
checks for a certain Sink
am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector< am_sinkID_t > &listSinkID) const
am_gatewayID_t gatewayID
This is the ID of the gateway, it is unique in the system.
am_Error_e getConverterInfoDB(const am_converterID_t converterID, am_Converter_s &converterData) const
am_sourceClass_t sourceClassID
the sourceClassID, indicates the class the source is in.
void sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
SPDX license identifier: MPL-2.0.
am_Error_e getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector< am_CustomAvailabilityReason_t > &listConnectionFormats) const
std::string name
the name of the sourceClass - must be unique in the system
void newDomain(const am_Domain_s &domain)
struct that holds attribiutes of a mainconnection
am_Error_e getSoureState(const am_sourceID_t sourceID, am_SourceState_e &sourceState) const
am_Error_e getListMainConnections(std::vector< am_MainConnection_s > &listMainConnections) const
bool existConverter(const am_converterID_t converterID) const
am_sinkID_t sinkID
The sinkID of the gateway sink-end.
void sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s &availability)
am_Error_e peekSink(const std::string &name, am_sinkID_t &sinkID)
am_Error_e changeSourceClassInfoDB(const am_SourceClass_s &sourceClass)
SPDX license identifier: MPL-2.0.
bool existDomain(const am_domainID_t domainID) const
checks for a certain domain
bool existConnectionID(const am_connectionID_t connectionID) const
checks if a connection with the given ID exists
am_Error_e enterSourceDB(const am_Source_s &sourceData, am_sourceID_t &sourceID)
am_Error_e changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
am_Error_e changeSinkClassInfoDB(const am_SinkClass_s &sinkClass)
am_Error_e getListSystemProperties(std::vector< am_SystemProperty_s > &listSystemProperties) const
am_CustomConnectionFormat_t connectionFormat
the used connectionformat
am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector< am_gatewayID_t > &listGatewaysID) const
std::string name
The name of the sink.
void mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s &SoundProperty)
am_Error_e getListSinks(std::vector< am_Sink_s > &listSinks) const
std::vector< am_MainSoundProperty_s > listMainSoundProperties
This is the list of the available mainSoundProperties.
am_Error_e getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t &mainVolume) const
struct describing system properties
am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t &value) const
am_mainConnectionID_t mainConnectionID
the assigned ID
bool existConnection(const am_Connection_s &connection) const
checks if a connection already exists.
uint16_t am_converterID_t
a converter ID
void logVerbose(T value, TArgs...args)
logs given values with verbose with the default context
am_sourceID_t sourceID
The sourceID of the crossfader source.
am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s &sourceData) const
void removeGateway(const am_gatewayID_t gatewayID)
am_Error_e removeDomainDB(const am_domainID_t domainID)
am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector< am_connectionID_t > &listConnectionID)
bool existCrossFader(const am_crossfaderID_t crossfaderID) const
checks if a CrossFader exists
am_Error_e peekSourceClassID(const std::string &name, am_sourceClass_t &sourceClassID)
am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t &volume) const
am_Error_e enterSinkClassDB(const am_SinkClass_s &sinkClass, am_sinkClass_t &sinkClassID)
struct describung mainsound property
void mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
am_Error_e getListDomains(std::vector< am_Domain_s > &listDomains) const
SPDX license identifier: MPL-2.0.
void systemPropertyChanged(const am_SystemProperty_s &SystemProperty)
am_ConnectionState_e connectionState
the current connection state
bool existSourceNameOrID(const am_sourceID_t sourceID, const std::string &name) const
checks if a source name or ID exists
void removedSource(const am_sourceID_t sourceID, const bool visible)
am_Error_e removeConnection(const am_connectionID_t connectionID)
am_domainID_t domainID
The domainID is the domain the source belongs to.
#define DB_COND_UPDATE(x, y)
std::string name
The name of the gateway.
am_Error_e enterSourceClassDB(am_sourceClass_t &sourceClassID, const am_SourceClass_s &sourceClass)
am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s &classInfo) const
am_Error_e getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector< am_CustomAvailabilityReason_t > &listConnectionFormats) const
bool existSourceClass(const am_sourceClass_t sourceClassID) const
checks for certain sourceClass
am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
am_Error_e peekSource(const std::string &name, am_sourceID_t &sourceID)
am_Error_e changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
void removedMainConnection(const am_mainConnectionID_t mainConnection)
am_Error_e enumerateConverters(std::function< void(const am_Converter_s &element)> cb) const
uint16_t am_sourceID_t
a source ID
am_CustomMainSoundPropertyType_t type
the type of the property
void removeDomain(const am_domainID_t domainID)
void newGateway(const am_Gateway_s &gateway)
void newMainConnection(const am_MainConnectionType_s &mainConnection)
struct describing the sound property
am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t &domainID) const
am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
am_CustomSystemPropertyType_t type
the type that is set
am_sourceID_t sourceID
the source the audio flows from
am_sourceID_t sourceID
the sourceID
am_sinkClass_t sinkClassID
The sinkClassID references to a sinkClass.
am_Error_e enterCrossfaderDB(const am_Crossfader_s &crossfaderData, am_crossfaderID_t &crossfaderID)
struct describing sinkclasses
bool visible
This Boolean flag indicates whether a source is visible to the commandInterface or not...
am_NotificationStatus_e status
The Notification status.
am_Error_e removeSinkDB(const am_sinkID_t sinkID)
am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t &value) const
bool existSinkClass(const am_sinkClass_t sinkClassID) const
checks for certain SinkClass
am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t &volume) const
am_Error_e enterDomainDB(const am_Domain_s &domainData, am_domainID_t &domainID)
#define DB_COND_ISMODIFIED
am_CustomAvailabilityReason_t availabilityReason
the reason for the last change.
bool changeNotificationConfiguration(std::vector< am_NotificationConfiguration_s > &listNotificationConfigurations, const am_NotificationConfiguration_s &notificationConfiguration)
am_Error_e getListCrossfaders(std::vector< am_Crossfader_s > &listCrossfaders) const
am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s &gatewayData) const
std::string nodename
the name of the node
std::vector< am_connectionID_t > listConnectionID
the list of sub connection IDs the mainconnection consists of
am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s &crossfaderData) const
void sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s &availability)
am_ConnectionState_e
represents the connection state
std::vector< am_MainSoundProperty_s > listMainSoundProperties
This is the list of the available mainSoundProperties.
This struct describes the attributes of a converter.
am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector< am_MainSoundProperty_s > &listSourceProperties) const
bool existSource(const am_sourceID_t sourceID) const
checks for a certain Source
bool changeMainNotificationConfiguration(std::vector< am_NotificationConfiguration_s > &listMainNotificationConfigurations, const am_NotificationConfiguration_s &mainNotificationConfiguration)
am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID)
am_Error_e getListSourceClasses(std::vector< am_SourceClass_s > &listSourceClasses) const
am_HotSink_e
describes the active sink of a crossfader.
am_Availability_e availability
the current availability state
am_Error_e enumerateGateways(std::function< void(const am_Gateway_s &element)> cb) const
int16_t am_volume_t
The unit is 0.1 db steps,The smallest value -3000 (=AM_MUTE).
This struct describes the attribiutes of a crossfader.
am_sourceID_t sourceID
This is the ID of the source, it is unique in the system.
am_CustomSoundPropertyType_t type
the type of the property - a project specific enum
am_sinkID_t sinkID_B
The sinkID of the SinkB.
void removeCrossfader(const am_crossfaderID_t crossfaderID)
am_Error_e enterConnectionDB(const am_Connection_s &connection, am_connectionID_t &connectionID)
am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration)
am_Error_e getListConnectionsReserved(std::vector< am_Connection_s > &listConnections) const
am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration)
am_Error_e changeSourceSoundPropertyDB(const am_SoundProperty_s &soundProperty, const am_sourceID_t sourceID)
am_Error_e getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t &value) const
bool isComponentConnected(const am_Gateway_s &gateway) const
am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
this type holds all information of connections relevant to the HMI
the desired action is not possible
void timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sinkID_t sinkID)
bool existGateway(const am_gatewayID_t gatewayID) const
checks for certain gateway
am_sourceID_t sourceID
The sourceID of the gateway sink-end.
uint16_t am_sourceClass_t
am_connectionID_t connectionID
the assigned ID
std::string name
the name of the sinkClass - must be unique in the system
am_domainID_t domainID
the domain ID
void volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
am_domainID_t domainID
This is the ID of the domain that registers the converter.
am_Error_e enterMainConnectionDB(const am_MainConnection_s &mainConnectionData, am_mainConnectionID_t &connectionID)
am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID)
am_Error_e peekSinkClassID(const std::string &name, am_sinkClass_t &sinkClassID)
this describes the availability of a sink or a source together with the latest change ...
am_Error_e getDomainState(const am_domainID_t domainID, am_DomainState_e &state) const
am_Error_e changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector< am_SoundProperty_s > &listSoundProperties, const std::vector< am_CustomAvailabilityReason_t > &listConnectionFormats, const std::vector< am_MainSoundProperty_s > &listMainSoundProperties)
This struct describes the attributes of a gateway.
void newSink(const am_Sink_s &sink)
am_Error_e getListConvertersOfDomain(const am_domainID_t domainID, std::vector< am_converterID_t > &listConvertersID) const
void logError(T value, TArgs...args)
logs given values with errorlevel with the default context
am_Error_e changeSourceAvailabilityDB(const am_Availability_s &availability, const am_sourceID_t sourceID)
void removeConverter(const am_converterID_t converterID)
am_Error_e changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
SPDX license identifier: MPL-2.0.
am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sourceID_t sourceID)
void dump(std::ostream &output) const
uint16_t am_domainID_t
a domain ID
am_Error_e enterSystemProperties(const std::vector< am_SystemProperty_s > &listSystemProperties)
am_Error_e enterSinkDB(const am_Sink_s &sinkData, am_sinkID_t &sinkID)
int16_t am_mainVolume_t
This is the volume presented on the command interface.
std::string name
The name of the converter.
am_Error_e changeSinkSoundPropertyDB(const am_SoundProperty_s &soundProperty, const am_sinkID_t sinkID)
no error - positive reply
bool existSinkName(const std::string &name) const
checks if a sink with the name exists
void newCrossfader(const am_Crossfader_s &crossfader)
TMapObjectType const * objectForKeyIfExistsInMap(const TMapKeyType &key, const std::unordered_map< TMapKeyType, TMapObjectType > &map)
am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector< am_NotificationConfiguration_s > &listMainNotificationConfigurations)
int16_t value
the actual value of the property
am_Error_e getListVisibleMainConnections(std::vector< am_MainConnectionType_s > &listConnections) const
am_Error_e getDomainOfCrossfader(const am_converterID_t crossfader, am_domainID_t &domainID) const
there is no change
#define DB_COND_UPDATE_RIE(x, y)
std::vector< am_CustomConnectionFormat_t > listConnectionFormats
This list holds information about the formats that the Source is capable of supporting when deliverin...
#define DB_COND_UPDATE_INIT
only relevant for connectionStatechanged.
bool existSinkNameOrID(const am_sinkID_t sinkID, const std::string &name) const
checks if a sink with the ID or the name exists
uint16_t am_gatewayID_t
a gateway ID
This struct describes the attribiutes of a source.
am_Error_e removeSourceDB(const am_sourceID_t sourceID)
am_Error_e enterGatewayDB(const am_Gateway_s &gatewayData, am_gatewayID_t &gatewayID)
am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t &delay) const
am_volume_t volume
This is the volume of the sink.
am_Error_e getListConverters(std::vector< am_Converter_s > &listConverters) const
std::string name
The name of the source.
std::string name
the name of the domain
uint16_t am_sinkID_t
a sink ID
uint16_t am_mainConnectionID_t
a mainConnection ID
am_Error_e changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration)
am_Error_e changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector< am_CustomAvailabilityReason_t > &listSourceConnectionFormats, const std::vector< am_CustomAvailabilityReason_t > &listSinkConnectionFormats, const std::vector< bool > &convertionMatrix)
int16_t parameter
This gives additional information to the notification status.
am_domainID_t domainID
The domainID is the domain the sink belongs to.
am_SourceState_e
The source state reflects the state of the source.
am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s &sinkClass) const
am_Error_e changeConverterDB(const am_converterID_t converterID, const std::vector< am_CustomConnectionFormat_t > &listSourceConnectionFormats, const std::vector< am_CustomConnectionFormat_t > &listSinkConnectionFormats, const std::vector< bool > &convertionMatrix)
am_Error_e getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector< bool > &listConnectionFormat) const
am_Error_e getListMainSinks(std::vector< am_SinkType_s > &listMainSinks) const
a database error occurred
am_Error_e enterConverterDB(const am_Converter_s &converterData, am_converterID_t &converterID)
bool existMainConnection(const am_mainConnectionID_t mainConnectionID) const
checks for a certain mainConnection
This class observes the Database and notifies other classes about important events, mainly the CommandSender.
void sinkMainNotificationConfigurationChanged(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration)
am_timeSync_t delay
the delay of the connection
am_sinkClass_t sinkClassID
the ID of the sinkClass
std::vector< am_CustomConnectionFormat_t > listConnectionFormats
This list holds information about the formats that the Source is capable of supporting when deliverin...
am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t &value) const
am_sinkID_t sinkID
the sink the audio flows to