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 \
43 # define DB_COND_UPDATE(x,y) \
44 if (!isDataEqual(x,y)) { x = y; modified = true; }
45 # define DB_COND_ISMODIFIED \
48 # define DB_COND_UPDATE_RIE(x,y) \
50 # define DB_COND_UPDATE_INIT
51 # define DB_COND_UPDATE(x,y) \
53 # define DB_COND_ISMODIFIED \
64 template <
typename T>
bool isDataEqual(
const T & left,
const T & right)
66 return static_cast<bool>(!std::memcmp(&left, &right,
sizeof(T)));
69 template <
typename T,
typename L = std::vector<T> >
bool isDataEqual(
const L & left,
const L & right)
71 return std::equal(left.begin(), left.end(), right.begin(),
isDataEqual);
78 template <
typename TMapKeyType,
class TMapObjectType> TMapObjectType
const *
objectForKeyIfExistsInMap(
const TMapKeyType & key,
const std::unordered_map<TMapKeyType,TMapObjectType> & map)
80 typename std::unordered_map<TMapKeyType,TMapObjectType>::const_iterator iter = map.find(key);
89 template <
typename TMapKeyType,
class TMapObjectType>
bool existsObjectWithKeyInMap(
const TMapKeyType & key,
const std::unordered_map<TMapKeyType,TMapObjectType> & map)
103 template <
class TReturn,
typename TIdentifier>
const TReturn *
objectMatchingPredicate(
const std::unordered_map<TIdentifier, TReturn> & map,
104 std::function<
bool(
const TReturn & refObject)> comparator)
106 typename std::unordered_map<TIdentifier, TReturn>::const_iterator elementIterator = map.begin();
107 for (;elementIterator != map.end(); ++elementIterator)
109 if( comparator(elementIterator->second) )
110 return &elementIterator->second;
118 void CAmDatabaseHandlerMap::CAmDomain::getDescription (std::string & outString)
const
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();
134 void CAmDatabaseHandlerMap::CAmSource::getSourceType(am_SourceType_s & sourceType)
const
136 sourceType.name = name;
137 sourceType.sourceClassID = sourceClassID;
138 sourceType.availability = available;
139 sourceType.sourceID = sourceID;
142 void CAmDatabaseHandlerMap::CAmSource::getDescription (std::string & outString)
const
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 <<
"]";
158 fmt <<
") listConnectionFormats (";
160 fmt <<
"[" << ref <<
"]";
162 fmt <<
") listMainSoundProperties (";
163 std::for_each(listMainSoundProperties.begin(), listMainSoundProperties.end(), [&](
const am_MainSoundProperty_s & ref) {
164 fmt <<
"[type:" << ref.type <<
" value:" << ref.value <<
"]";
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 <<
"]";
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 <<
"]";
174 fmt <<
")" << std::endl;
175 outString = fmt.str();
180 void CAmDatabaseHandlerMap::CAmSink::getDescription (std::string & outString)
const
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 <<
"]";
196 fmt <<
") listConnectionFormats (";
198 fmt <<
"[" << ref <<
"]";
200 fmt <<
") listMainSoundProperties (";
201 std::for_each(listMainSoundProperties.begin(), listMainSoundProperties.end(), [&](
const am_MainSoundProperty_s & ref) {
202 fmt <<
"[type:" << ref.type <<
" value:" << ref.value <<
"]";
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 <<
"]";
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 <<
"]";
212 fmt <<
")" << std::endl;
213 outString = fmt.str();
216 void CAmDatabaseHandlerMap::CAmSink::getSinkType(am_SinkType_s & sinkType)
const
218 sinkType.name = name;
219 sinkType.sinkID = sinkID;
220 sinkType.availability = available;
221 sinkType.muteState = muteState;
222 sinkType.volume = mainVolume;
223 sinkType.sinkClassID = sinkClassID;
228 void CAmDatabaseHandlerMap::CAmConnection::getDescription (std::string & outString)
const
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();
242 void CAmDatabaseHandlerMap::CAmMainConnection::getDescription (std::string & outString)
const
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 <<
"]";
254 fmt <<
")" << std::endl;
255 outString = fmt.str();
258 void CAmDatabaseHandlerMap::am_MainConnection_Database_s::getMainConnectionType(am_MainConnectionType_s & connectionType)
const
260 connectionType.mainConnectionID = mainConnectionID;
261 connectionType.sourceID = sourceID;
262 connectionType.sinkID = sinkID;
263 connectionType.connectionState = connectionState;
264 connectionType.delay = delay;
269 void CAmDatabaseHandlerMap::CAmSourceClass::getDescription (std::string & outString)
const
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 <<
"]";
277 fmt <<
")" << std::endl;
278 outString = fmt.str();
283 void CAmDatabaseHandlerMap::CAmSinkClass::getDescription (std::string & outString)
const
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 <<
"]";
291 fmt <<
")" << std::endl;
292 outString = fmt.str();
298 void CAmDatabaseHandlerMap::CAmGateway::getDescription (std::string & outString)
const
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 (";
309 fmt <<
"[" << ref <<
"]";
311 fmt <<
") listSinkFormats (";
313 fmt <<
"[" << ref <<
"]";
315 fmt <<
") convertionMatrix (";
316 std::for_each(convertionMatrix.begin(), convertionMatrix.end(), [&](
const bool & ref) {
317 fmt <<
"[" << ref <<
"]";
319 fmt <<
")" << std::endl;
320 outString = fmt.str();
325 void CAmDatabaseHandlerMap::CAmCrossfader::getDescription (std::string & outString)
const
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 <<
334 outString = fmt.str();
337 bool CAmDatabaseHandlerMap::CAmMappedData::increaseID(int16_t & resultID, am_Identifier_s & sourceID,
338 int16_t
const desiredStaticID = 0)
340 if( desiredStaticID > 0 && desiredStaticID < sourceID.mMin )
342 resultID = desiredStaticID;
345 else if( sourceID.mCurrentValue < sourceID.mMax )
347 resultID = sourceID.mCurrentValue++;
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)
361 int16_t
const lastID = sourceID.mCurrentValue;
362 if( sourceID.mCurrentValue < sourceID.mMax )
363 nextID = sourceID.mCurrentValue++;
365 nextID = sourceID.mCurrentValue = sourceID.mMin;
367 bool notFreeIDs =
false;
371 if( sourceID.mCurrentValue < sourceID.mMax )
372 nextID = sourceID.mCurrentValue++;
375 sourceID.mCurrentValue = sourceID.mMin;
376 nextID = sourceID.mCurrentValue++;
379 if( sourceID.mCurrentValue == lastID )
394 bool CAmDatabaseHandlerMap::CAmMappedData::increaseMainConnectionID(int16_t & resultID)
396 return getNextConnectionID(resultID, mCurrentMainConnectionID, mMainConnectionMap);
399 bool CAmDatabaseHandlerMap::CAmMappedData::increaseConnectionID(int16_t & resultID)
401 return getNextConnectionID(resultID, mCurrentConnectionID, mConnectionMap);
406 mFirstStaticSource(true),
407 mFirstStaticGateway(true),
408 mFirstStaticConverter(true),
409 mFirstStaticSinkClass(true),
410 mFirstStaticSourceClass(true),
411 mFirstStaticCrossfader(true),
412 mpDatabaseObserver(NULL),
413 mListConnectionFormat(),
422 mpDatabaseObserver = NULL;
427 if(domainData.
name.empty())
429 logError(__func__,
"DomainName must not be emtpy!");
434 logError(__func__,
"Busname must not be emtpy!");
439 logError(__func__,
"State must not be valid!");
443 am_Domain_s const *reservedDomain = objectMatchingPredicate<CAmDomain, am_domainID_t>(mMappedData.mDomainMap, [&](
const CAmDomain & obj){
444 return domainData.
name.compare(obj.name)==0;
449 if( NULL != reservedDomain )
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]);
463 if(mMappedData.increaseID(nextID, mMappedData.mCurrentDomainID, domainData.
domainID))
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]);
482 int16_t CAmDatabaseHandlerMap::calculateDelayForRoute(
const std::vector<am_connectionID_t>& listConnectionID)
485 std::vector<am_connectionID_t>::const_iterator elementIterator = listConnectionID.begin();
486 for (; elementIterator < listConnectionID.end(); ++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())
492 int16_t temp_delay = it->second.delay;
493 if (temp_delay != -1 && delay != -1)
506 logError(__func__,
"mainConnectionID must be 0!");
511 logError(__func__,
"connectionState must be valid!");
516 logError(__func__,
"sinkID must be valid!");
521 logError(__func__,
"sourceID must be valid!");
527 if(mMappedData.increaseMainConnectionID(nextID))
529 connectionID = nextID;
530 mMappedData.mMainConnectionMap[nextID] = mainConnectionData;
531 mMappedData.mMainConnectionMap[nextID].mainConnectionID = nextID;
542 logVerbose(
"DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID", mainConnectionData.
sourceID,
"sinkID:", mainConnectionData.
sinkID,
"delay:", delay,
"assigned ID:", connectionID);
544 if (mpDatabaseObserver)
547 mMappedData.mMainConnectionMap[nextID].getMainConnectionType(mainConnection);
567 if( mMappedData.increaseID(nextID, mMappedData.mCurrentSinkID, sinkData.
sinkID) )
570 mMappedData.mSinkMap[nextID] = sinkData;
571 mMappedData.mSinkMap[nextID].sinkID = nextID;
572 filterDuplicateNotificationConfigurationTypes(mMappedData.mSinkMap[nextID].listNotificationConfigurations);
573 filterDuplicateNotificationConfigurationTypes(mMappedData.mSinkMap[nextID].listMainNotificationConfigurations);
586 if(sinkData.
sinkID>DYNAMIC_ID_BOUNDARY)
588 logError(__func__,
"sinkID must be below:",DYNAMIC_ID_BOUNDARY);
593 logError(__func__,
"domainID must be valid");
596 if(sinkData.
name.empty())
598 logError(__func__,
"sinkName must not be zero");
603 logError(__func__,
"sinkClass must be valid");
609 logError(__func__,
"muteState must be valid");
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;
619 if( NULL!=reservedDomain )
622 mMappedData.mSinkMap[oldSinkID] = sinkData;
623 mMappedData.mSinkMap[oldSinkID].reserved = 0;
624 temp_SinkID = oldSinkID;
625 temp_SinkIndex = oldSinkID;
630 if ( sinkData.
sinkID != 0 || mFirstStaticSink )
639 result = insertSinkDB(sinkData, temp_SinkID);
640 if(
false == result )
642 temp_SinkIndex = temp_SinkID;
645 if (sinkData.
sinkID == 0 && mFirstStaticSink)
647 mFirstStaticSink =
false;
649 mMappedData.mSinkMap[temp_SinkIndex].sinkID = temp_SinkID;
650 sinkID = temp_SinkID;
652 am_Sink_s & sink = mMappedData.mSinkMap[temp_SinkID];
655 if (mpDatabaseObserver != NULL)
658 mpDatabaseObserver->
newSink(sink);
666 if(mMappedData.increaseID(nextID, mMappedData.mCurrentCrossfaderID, crossfaderData.
crossfaderID))
668 crossfaderID = nextID;
669 mMappedData.mCrossfaderMap[nextID] = crossfaderData;
670 mMappedData.mCrossfaderMap[nextID].crossfaderID = nextID;
685 logError(__func__,
"crossfaderID must be below:",DYNAMIC_ID_BOUNDARY);
691 logError(__func__,
"hotSink must be valid");
694 if(crossfaderData.
name.empty())
696 logError(__func__,
"crossfaderName must not be zero");
702 logError(__func__,
"sinkID_A must exist");
707 logError(__func__,
"sinkID_B must exist");
712 logError(__func__,
"sourceID must exist");
721 if (crossfaderData.
crossfaderID != 0 || mFirstStaticCrossfader)
730 result = insertCrossfaderDB(crossfaderData, temp_CrossfaderID);
731 if(
false == result )
733 temp_CrossfaderIndex = temp_CrossfaderID;
736 if ( 0==crossfaderData.
crossfaderID && mFirstStaticCrossfader)
738 mFirstStaticCrossfader =
false;
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);
745 if (mpDatabaseObserver)
746 mpDatabaseObserver->
newCrossfader(mMappedData.mCrossfaderMap[temp_CrossfaderIndex]);
753 if(mMappedData.increaseID(nextID, mMappedData.mCurrentGatewayID, gatewayData.
gatewayID))
756 mMappedData.mGatewayMap[nextID] = gatewayData;
757 mMappedData.mGatewayMap[nextID].gatewayID = nextID;
771 if(gatewayData.
gatewayID>DYNAMIC_ID_BOUNDARY)
773 logError(__func__,
"gatewayID must be below:",DYNAMIC_ID_BOUNDARY);
779 logError(__func__,
"controlDomainID must be exist");
783 if(gatewayData.
name.empty())
785 logError(__func__,
"gatewayName must not be empty");
797 if (gatewayData.
gatewayID != 0 || mFirstStaticGateway)
806 result = insertGatewayDB(gatewayData, temp_GatewayID);
807 if(
false == result )
810 temp_GatewayIndex = temp_GatewayID;
812 if (gatewayData.
gatewayID == 0 && mFirstStaticGateway)
814 mFirstStaticGateway =
false;
816 mMappedData.mGatewayMap[temp_GatewayIndex].gatewayID = temp_GatewayID;
817 gatewayID = temp_GatewayID;
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]);
828 if(mMappedData.increaseID(nextID, mMappedData.mCurrentConverterID, converteData.
converterID))
830 converterID = nextID;
831 mMappedData.mConverterMap[nextID] = converteData;
832 mMappedData.mConverterMap[nextID].converterID = nextID;
847 logError(__func__,
"converterID must be below:",DYNAMIC_ID_BOUNDARY);
853 logError(__func__,
"sinkID must exists");
859 logError(__func__,
"sourceID must exists");
865 logError(__func__,
"domainID must exists");
869 if(converterData.
name.empty())
871 logError(__func__,
"converterName must not be empty");
883 if (converterData.
converterID != 0 || mFirstStaticConverter)
892 result = insertConverterDB(converterData, tempID);
893 if(
false == result )
898 if (converterData.
converterID == 0 && mFirstStaticConverter)
900 mFirstStaticConverter =
false;
902 mMappedData.mConverterMap[tempIndex].converterID = tempID;
903 converterID = tempID;
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]);
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;
933 if(mMappedData.increaseID(nextID, mMappedData.mCurrentSourceID, sourceData.
sourceID))
936 mMappedData.mSourceMap[nextID] = sourceData;
937 mMappedData.mSourceMap[nextID].sourceID = nextID;
938 filterDuplicateNotificationConfigurationTypes(mMappedData.mSourceMap[nextID].listNotificationConfigurations);
939 filterDuplicateNotificationConfigurationTypes(mMappedData.mSourceMap[nextID].listMainNotificationConfigurations);
952 if(sourceData.
sourceID>DYNAMIC_ID_BOUNDARY)
954 logError(__func__,
"sourceID must be below:",DYNAMIC_ID_BOUNDARY);
959 logError(__func__,
"domainID must be valid");
962 if(sourceData.
name.empty())
964 logError(__func__,
"sourceName must not be zero");
969 logError(__func__,
"sourceClassID must be valid");
975 logError(__func__,
"sourceState must be valid");
979 bool isFirstStatic = sourceData.
sourceID == 0 && mFirstStaticSource;
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;
985 if( NULL != reservedSource )
988 mMappedData.mSourceMap[oldSourceID] = sourceData;
989 mMappedData.mSourceMap[oldSourceID].reserved = 0;
990 temp_SourceID = oldSourceID;
991 temp_SourceIndex = oldSourceID;
996 if ( !isFirstStatic )
1005 result = insertSourceDB(sourceData, temp_SourceID);
1006 if(
false == result )
1008 temp_SourceIndex = temp_SourceID;
1011 if ( isFirstStatic )
1014 mFirstStaticSource =
false;
1016 mMappedData.mSourceMap[temp_SourceIndex].sourceID = temp_SourceID;
1017 sourceID = temp_SourceID;
1019 logVerbose(
"DatabaseHandler::enterSourceDB entered new source with name", sourceData.
name,
"domainID:", sourceData.
domainID,
"classID:", sourceData.
sourceClassID,
"visible:", sourceData.
visible,
"assigned ID:", sourceID);
1021 if (mpDatabaseObserver)
1022 mpDatabaseObserver->
newSource(mMappedData.mSourceMap[temp_SourceIndex]);
1030 logError(__func__,
"connectionID must be 0!");
1036 logError(__func__,
"sinkID must exist!");
1042 logError(__func__,
"sourceID must exist!");
1047 if(mMappedData.increaseConnectionID(nextID))
1049 connectionID = nextID;
1050 mMappedData.mConnectionMap[nextID] = connection;
1051 mMappedData.mConnectionMap[nextID].connectionID = nextID;
1052 mMappedData.mConnectionMap[nextID].reserved =
true;
1061 logVerbose(
"DatabaseHandler::enterConnectionDB entered new connection sinkID=", connection.
sinkID,
"sourceID=", connection.
sourceID,
"connectionFormat=", connection.
connectionFormat,
"assigned ID=", connectionID);
1068 if(mMappedData.increaseID(nextID, mMappedData.mCurrentSinkClassesID, sinkClass.
sinkClassID))
1070 sinkClassID = nextID;
1071 mMappedData.mSinkClassesMap[nextID] = sinkClass;
1072 mMappedData.mSinkClassesMap[nextID].sinkClassID = nextID;
1087 logError(__func__,
"sinkClassID must be <",DYNAMIC_ID_BOUNDARY);
1091 if(sinkClass.
name.empty())
1093 logError(__func__,
"name must not be empty");
1101 if (sinkClass.
sinkClassID != 0 || mFirstStaticSinkClass)
1110 result = insertSinkClassDB(sinkClass, temp_SinkClassID);
1111 if(
false == result )
1114 temp_SinkClassIndex = temp_SinkClassID;
1116 if (sinkClass.
sinkClassID == 0 && mFirstStaticSinkClass)
1118 mFirstStaticSinkClass =
false;
1120 mMappedData.mSinkClassesMap[temp_SinkClassIndex].sinkClassID = temp_SinkClassID;
1121 sinkClassID = temp_SinkClassID;
1124 logVerbose(
"DatabaseHandler::enterSinkClassDB entered new sinkClass");
1125 if (mpDatabaseObserver)
1133 if(mMappedData.increaseID(nextID, mMappedData.mCurrentSourceClassesID, sourceClass.
sourceClassID))
1135 sourceClassID = nextID;
1136 mMappedData.mSourceClassesMap[nextID] = sourceClass;
1137 mMappedData.mSourceClassesMap[nextID].sourceClassID = nextID;
1152 logError(__func__,
"sourceClassID must be <",DYNAMIC_ID_BOUNDARY);
1156 if(sourceClass.
name.empty())
1158 logError(__func__,
"name must not be empty");
1167 if (sourceClass.
sourceClassID != 0 || mFirstStaticSourceClass)
1176 result = insertSourceClassDB(temp_SourceClassID, sourceClass);
1177 if(
false == result )
1180 temp_SourceClassIndex = temp_SourceClassID;
1182 if (sourceClass.
sourceClassID == 0 && mFirstStaticSourceClass)
1184 mFirstStaticSinkClass =
false;
1186 mMappedData.mSourceClassesMap[temp_SourceClassIndex].sourceClassID = temp_SourceClassID;
1187 sourceClassID = temp_SourceClassID;
1191 logVerbose(
"DatabaseHandler::enterSourceClassDB entered new sourceClass");
1193 if (mpDatabaseObserver)
1200 if(listSystemProperties.empty())
1202 logError(__func__,
"listSystemProperties must not be empty");
1206 mMappedData.mSystemProperties = listSystemProperties;
1208 logVerbose(
"DatabaseHandler::enterSystemProperties entered system properties");
1214 if(mainconnectionID==0)
1216 logError(__func__,
"mainconnectionID must not be 0");
1222 logError(__func__,
"existMainConnection must exist");
1226 int16_t delay = calculateDelayForRoute(listConnectionID);
1229 mMappedData.mMainConnectionMap[mainconnectionID].listConnectionID = listConnectionID;
1232 logError(
"DatabaseHandler::changeMainConnectionRouteDB error while changing mainConnectionDelay to ", delay);
1234 logVerbose(
"DatabaseHandler::changeMainConnectionRouteDB entered new route:", mainconnectionID);
1240 if(mainconnectionID==0)
1242 logError(__func__,
"mainconnectionID must not be 0");
1248 logError(__func__,
"connectionState must be valid");
1254 logError(__func__,
"existMainConnection must exist");
1258 DB_COND_UPDATE_RIE(mMappedData.mMainConnectionMap[mainconnectionID].connectionState, connectionState);
1260 logVerbose(
"DatabaseHandler::changeMainConnectionStateDB changed mainConnectionState of MainConnection:", mainconnectionID,
"to:", connectionState);
1261 if (mpDatabaseObserver)
1270 logError(__func__,
"sinkID must exist");
1276 logVerbose(
"DatabaseHandler::changeSinkMainVolumeDB changed mainVolume of sink:", sinkID,
"to:", mainVolume);
1278 if (mpDatabaseObserver)
1288 logError(__func__,
"availability must be valid");
1294 logError(__func__,
"sinkID must exist");
1312 logError(__func__,
"domainState must be valid");
1318 logError(__func__,
"domainID must exist");
1324 logVerbose(
"DatabaseHandler::changDomainStateDB changed domainState of domain:", domainID,
"to:", domainState);
1333 logError(__func__,
"muteState must be valid");
1339 logError(__func__,
"sinkID must exist");
1345 logVerbose(
"DatabaseHandler::changeSinkMuteStateDB changed sinkMuteState of sink:", sinkID,
"to:", muteState);
1347 if (mpDatabaseObserver)
1358 logError(__func__,
"sinkID must exist");
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)
1365 if (elementIterator->type == soundProperty.
type)
1368 if(sink.cacheMainSoundProperties.size())
1369 sink.cacheMainSoundProperties[soundProperty.
type] = soundProperty.
value;
1374 logVerbose(
"DatabaseHandler::changeMainSinkSoundPropertyDB changed MainSinkSoundProperty of sink:", sinkID,
"type:", soundProperty.
type,
"to:", soundProperty.
value);
1375 if (mpDatabaseObserver)
1385 logError(__func__,
"sourceID must exist");
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)
1392 if (elementIterator->type == soundProperty.
type)
1395 if(source.cacheMainSoundProperties.size())
1396 source.cacheMainSoundProperties[soundProperty.
type] = soundProperty.
value;
1401 logVerbose(
"DatabaseHandler::changeMainSourceSoundPropertyDB changed MainSinkSoundProperty of source:", sourceID,
"type:", soundProperty.
type,
"to:", soundProperty.
value);
1403 if (mpDatabaseObserver)
1412 logError(__func__,
"availability must be valid");
1418 logError(__func__,
"sourceID must exist");
1433 std::vector<am_SystemProperty_s>::iterator elementIterator = mMappedData.mSystemProperties.begin();
1434 for (;elementIterator != mMappedData.mSystemProperties.end(); ++elementIterator)
1436 if (elementIterator->type == property.
type)
1440 logVerbose(
"DatabaseHandler::changeSystemPropertyDB changed system property");
1442 if (mpDatabaseObserver)
1453 logError(__func__,
"mainConnectionID must exist");
1457 mMappedData.mMainConnectionMap.erase(mainConnectionID);
1459 logVerbose(
"DatabaseHandler::removeMainConnectionDB removed:", mainConnectionID);
1460 if (mpDatabaseObserver)
1473 logError(__func__,
"sinkID must exist");
1479 mMappedData.mSinkMap.erase(sinkID);
1482 logVerbose(
"DatabaseHandler::removeSinkDB removed:", sinkID);
1484 if (mpDatabaseObserver != NULL)
1495 logError(__func__,
"sourceID must exist");
1501 mMappedData.mSourceMap.erase(sourceID);
1506 logVerbose(
"DatabaseHandler::removeSourceDB removed:", sourceID);
1507 if (mpDatabaseObserver)
1517 logError(__func__,
"gatewayID must exist");
1521 mMappedData.mGatewayMap.erase(gatewayID);
1523 logVerbose(
"DatabaseHandler::removeGatewayDB removed:", gatewayID);
1524 if (mpDatabaseObserver)
1534 logError(__func__,
"converterID must exist");
1538 mMappedData.mConverterMap.erase(converterID);
1540 logVerbose(
"DatabaseHandler::removeConverterDB removed:", converterID);
1541 if (mpDatabaseObserver)
1551 logError(__func__,
"crossfaderID must exist");
1554 mMappedData.mCrossfaderMap.erase(crossfaderID);
1556 logVerbose(
"DatabaseHandler::removeCrossfaderDB removed:", crossfaderID);
1557 if (mpDatabaseObserver)
1567 logError(__func__,
"domainID must exist");
1570 mMappedData.mDomainMap.erase(domainID);
1572 logVerbose(
"DatabaseHandler::removeDomainDB removed:", domainID);
1573 if (mpDatabaseObserver)
1583 logError(__func__,
"sinkClassID must exist");
1587 mMappedData.mSinkClassesMap.erase(sinkClassID);
1589 logVerbose(
"DatabaseHandler::removeSinkClassDB removed:", sinkClassID);
1590 if (mpDatabaseObserver)
1601 logError(__func__,
"sourceClassID must exist");
1605 mMappedData.mSourceClassesMap.erase(sourceClassID);
1606 logVerbose(
"DatabaseHandler::removeSourceClassDB removed:", sourceClassID);
1607 if (mpDatabaseObserver)
1616 logError(__func__,
"connectionID must exist",connectionID);
1620 mMappedData.mConnectionMap.erase(connectionID);
1622 logVerbose(
"DatabaseHandler::removeConnection removed:", connectionID);
1634 am_Source_Database_s source = mMappedData.mSourceMap.at(sourceID);
1642 classInfo = tmpClass;
1652 logWarning(__func__,
"sinkID",sinkID,
"does not exist");
1656 am_Sink_Database_s mappedSink = mMappedData.mSinkMap.at(sinkID);
1657 if(
true == mappedSink.reserved )
1659 sinkData = mappedSink;
1669 logWarning(__func__,
"sourceID",sourceID,
"does not exist");
1673 am_Source_Database_s mappedSource = mMappedData.mSourceMap.at(sourceID);
1674 if(
true == mappedSource.reserved )
1677 sourceData = mappedSource;
1684 if (!existMainConnection(mainConnectionID))
1686 logError(__func__,
"mainConnectionID must exist");
1690 mainConnectionData = temp;
1699 logError(__func__,
"listClassProperties must not be empty");
1706 logError(__func__,
"sinkClassID must exist");
1712 logVerbose(
"DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo");
1720 logError(__func__,
"listClassProperties must not be empty");
1727 logError(__func__,
"sourceClassID must exist");
1733 logVerbose(
"DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo");
1745 am_Sink_Database_s sink = mMappedData.mSinkMap.at(sinkID);
1750 logWarning(__func__,
"sinkClassID must exist");
1754 sinkClass = tmpSinkClass;
1767 gatewayData = mMappedData.mGatewayMap.at(gatewayID);
1777 logWarning(__func__,
"converterID must exist");
1781 converterData = mMappedData.mConverterMap.at(converterID);
1791 logWarning(__func__,
"crossfaderID must exist");
1795 crossfaderData = mMappedData.mCrossfaderMap.at(crossfaderID);
1809 std::unordered_map<am_sinkID_t, am_Sink_Database_s>::const_iterator elementIterator = mMappedData.mSinkMap.begin();
1810 for (;elementIterator != mMappedData.mSinkMap.end(); ++elementIterator)
1812 if (0==elementIterator->second.reserved && domainID==elementIterator->second.domainID)
1813 listSinkID.push_back(elementIterator->second.sinkID);
1820 listSourceID.clear();
1826 CAmMapSource::const_iterator elementIterator = mMappedData.mSourceMap.begin();
1827 for (;elementIterator != mMappedData.mSourceMap.end(); ++elementIterator)
1829 if (0==elementIterator->second.reserved && domainID==elementIterator->second.domainID)
1830 listSourceID.push_back(elementIterator->second.sourceID);
1838 listCrossfader.clear();
1845 CAmMapSource::const_iterator sourceIterator = mMappedData.mSourceMap.begin();
1846 for (;sourceIterator != mMappedData.mSourceMap.end(); ++sourceIterator)
1848 if (domainID==sourceIterator->second.domainID)
1850 CAmMapCrossfader::const_iterator elementIterator = mMappedData.mCrossfaderMap.begin();
1851 for (;elementIterator != mMappedData.mCrossfaderMap.end(); ++elementIterator)
1853 if ( sourceIterator->second.sourceID==elementIterator->second.sourceID )
1854 listCrossfader.push_back(elementIterator->second.crossfaderID);
1865 listGatewaysID.clear();
1872 CAmMapGateway::const_iterator elementIterator = mMappedData.mGatewayMap.begin();
1873 for (;elementIterator != mMappedData.mGatewayMap.end(); ++elementIterator)
1875 if (domainID==elementIterator->second.controlDomainID)
1876 listGatewaysID.push_back(elementIterator->second.gatewayID);
1883 listConvertersID.clear();
1890 CAmMapConverter::const_iterator elementIterator = mMappedData.mConverterMap.begin();
1891 for (;elementIterator != mMappedData.mConverterMap.end(); ++elementIterator)
1893 if (domainID==elementIterator->second.domainID)
1894 listConvertersID.push_back(elementIterator->second.converterID);
1901 listMainConnections.clear();
1903 CAmMapMainConnection::const_iterator elementIterator = mMappedData.mMainConnectionMap.begin();
1904 for (;elementIterator != mMappedData.mMainConnectionMap.end(); ++elementIterator)
1906 listMainConnections.push_back(elementIterator->second);
1914 listDomains.clear();
1916 CAmMapDomain::const_iterator elementIterator = mMappedData.mDomainMap.begin();
1917 for (;elementIterator != mMappedData.mDomainMap.end(); ++elementIterator)
1919 if( 0==elementIterator->second.reserved )
1920 listDomains.push_back(elementIterator->second);
1928 listConnections.clear();
1930 CAmMapConnection::const_iterator elementIterator = mMappedData.mConnectionMap.begin();
1931 for (;elementIterator != mMappedData.mConnectionMap.end(); ++elementIterator)
1933 if( 0==elementIterator->second.reserved )
1934 listConnections.push_back(elementIterator->second);
1942 listConnections.clear();
1944 CAmMapConnection::const_iterator elementIterator = mMappedData.mConnectionMap.begin();
1945 for (;elementIterator != mMappedData.mConnectionMap.end(); ++elementIterator)
1947 if( elementIterator->second.reserved )
1948 listConnections.push_back(elementIterator->second);
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);
1968 listSources.clear();
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 )
1973 listSources.push_back(ref.second);
1981 listSourceClasses.clear();
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);
1992 listCrossfaders.clear();
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);
2003 listGateways.clear();
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);
2014 listConverters.clear();
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);
2025 listSinkClasses.clear();
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);
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());
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 )
2051 listMainSinks.emplace_back();
2052 ref.second.getSinkType(listMainSinks.back());
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 )
2065 listMainSources.emplace_back();
2066 ref.second.getSourceType(listMainSources.back());
2081 const am_Sink_s & sink = mMappedData.mSinkMap.at(sinkID);
2094 const am_Source_s & source = mMappedData.mSourceMap.at(sourceID);
2108 const am_Sink_Database_s & sink = mMappedData.mSinkMap.at(sinkID);
2109 listSoundproperties = sink.listSoundProperties;
2122 const am_Source_Database_s & source = mMappedData.mSourceMap.at(sourceID);
2123 listSoundproperties = source.listSoundProperties;
2130 listSystemProperties = mMappedData.mSystemProperties;
2136 if (!existSink(sinkID))
2141 const am_Sink_s & sink = mMappedData.mSinkMap.at(sinkID);
2149 if (!existSource(sourceID))
2154 const am_Source_s & source = mMappedData.mSourceMap.at(sourceID);
2162 if (!existGateway(gatewayID))
2167 ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
2168 iter = mListConnectionFormat.find(gatewayID);
2169 if (iter == mListConnectionFormat.end())
2171 logWarning(
"DatabaseHandler::getListGatewayConnectionFormats database error with convertionFormat");
2175 listConnectionFormat = iter->second;
2184 logWarning(__func__,
"mainConnectionID must exist");
2189 const am_MainConnection_s & mainConnection = mMappedData.mMainConnectionMap.at(mainConnectionID);
2190 delay = mainConnection.
delay;
2202 logError(__func__,
"connectionID must exist");
2206 if (mpDatabaseObserver)
2230 return (0==source->reserved);
2243 return sourceWithNameOrID(sourceID, name);
2263 bool returnVal =
false;
2264 CAmMapSink::const_iterator elementIterator = mMappedData.mSinkMap.begin();
2265 for (;elementIterator != mMappedData.mSinkMap.end(); ++elementIterator)
2267 if( 0==elementIterator->second.reserved &&
2268 sinkID==elementIterator->second.sinkID)
2283 const CAmDatabaseHandlerMap::am_Source_Database_s * CAmDatabaseHandlerMap::sourceWithNameOrID(
const am_sourceID_t sourceID,
const std::string & name)
const
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));
2298 const CAmDatabaseHandlerMap::am_Sink_Database_s * CAmDatabaseHandlerMap::sinkWithNameOrID(
const am_sinkID_t sinkID,
const std::string & name)
const
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));
2315 return sinkWithNameOrID( sinkID, name)!=NULL;
2337 return (0==source->reserved);
2364 domainID = source->domainID;
2377 domainID = source->domainID;
2390 getDomainOfSource(cross->sinkID_A,domainID);
2420 logError(__func__,
"connectionID must exist");
2424 mMappedData.mConnectionMap[connectionID].delay = delay;
2430 CAmMapMainConnection::const_iterator iter = mMappedData.mMainConnectionMap.begin();
2431 for(; iter != mMappedData.mMainConnectionMap.end(); ++iter)
2447 if( NULL!=connection )
2449 mMappedData.mConnectionMap.at(connectionID).reserved =
false;
2452 logError(__func__,
"connectionID must exist");
2460 const am_MainConnection_s & mainConnection = mMappedData.mMainConnectionMap.at(mainConnectionID);
2462 std::vector<am_connectionID_t>::const_iterator iter = mainConnection.
listConnectionID.begin();
2468 delay += std::max(source->delay, static_cast<am_timeSync_t>(0));
2471 return (delay == 0 ? -1 : std::min(delay, static_cast<am_timeSync_t>(SHRT_MAX)));
2480 assert(iObserver!=NULL);
2481 mpDatabaseObserver = iObserver;
2493 logError(__func__,
"sourceID must exist");
2496 am_Source_Database_s source = mMappedData.mSourceMap.at(sourceID);
2497 return source.visible;
2510 if(0==source->reserved)
2511 return source->visible;
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 &&
2530 return ( NULL!=connectionObject );
2541 if( NULL!=connection )
2563 sourceState = source->sourceState;
2577 logError(__func__,
"sourceState must be valid");
2583 mMappedData.mSourceMap.at(sourceID).sourceState = sourceState;
2586 logError(__func__,
"sourceID must exist");
2596 mainVolume = source->mainVolume;
2610 volume = source->volume;
2623 volume = source->volume;
2627 logWarning(__func__,
"sourceID must be valid");
2637 if(pObject->listSoundProperties.size()>0 && 0==pObject->cacheSoundProperties.size())
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;
2643 auto it = pObject->cacheSoundProperties.find(propertyType);
2644 if(it!=pObject->cacheSoundProperties.end())
2660 if(pObject->listSoundProperties.size()>0 && 0==pObject->cacheSoundProperties.size())
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;
2666 auto it = pObject->cacheSoundProperties.find(propertyType);
2667 if(it!=pObject->cacheSoundProperties.end())
2674 logWarning(__func__,
"sourceID must be valid");
2683 if(pObject->listMainSoundProperties.size()>0 && 0==pObject->cacheMainSoundProperties.size())
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;
2689 auto it = pObject->cacheMainSoundProperties.find(propertyType);
2690 if(it!=pObject->cacheMainSoundProperties.end())
2707 if(pObject->listMainSoundProperties.size()>0 && 0==pObject->cacheMainSoundProperties.size())
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;
2713 auto it = pObject->cacheMainSoundProperties.find(propertyType);
2714 if(it!=pObject->cacheMainSoundProperties.end())
2722 logWarning(__func__,
"sourceID must be valid");
2732 state = source->state;
2736 logWarning(__func__,
"domainID must be valid");
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;
2748 if( NULL != reservedDomain )
2750 domainID = reservedDomain->domainID;
2756 if( mMappedData.increaseID( nextID, mMappedData.mCurrentDomainID) )
2759 am_Domain_Database_s domain;
2760 domain.domainID = nextID;
2762 domain.reserved = 1;
2763 mMappedData.mDomainMap[nextID] = domain;
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;
2776 if( NULL!=reservedSink )
2778 sinkID = reservedSink->sinkID;
2784 if(mMappedData.increaseID(nextID, mMappedData.mCurrentSinkID))
2786 if(mFirstStaticSink)
2788 nextID = DYNAMIC_ID_BOUNDARY;
2789 mFirstStaticSink =
false;
2792 am_Sink_Database_s object;
2793 object.sinkID = nextID;
2795 object.reserved = 1;
2796 mMappedData.mSinkMap[nextID] = object;
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;
2808 if( NULL!=reservedSrc )
2810 sourceID = reservedSrc->sourceID;
2816 if(mMappedData.increaseID(nextID, mMappedData.mCurrentSourceID))
2818 if(mFirstStaticSource)
2821 mFirstStaticSource =
false;
2824 am_Source_Database_s object;
2825 object.sourceID = nextID;
2827 object.reserved = 1;
2828 mMappedData.mSourceMap[nextID] = object;
2840 logError(__func__,
"sinkID must be valid");
2844 mMappedData.mSinkMap[sinkID].volume = volume;
2852 logError(__func__,
"sourceID must be valid");
2855 mMappedData.mSourceMap[sourceID].volume = volume;
2864 logError(__func__,
"sourceID must be valid");
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)
2872 if( soundProperty.
type == iter->type )
2874 iter->value = soundProperty.
value;
2875 if(source.cacheSoundProperties.size())
2876 source.cacheSoundProperties[soundProperty.
type] = soundProperty.
value;
2880 logError(__func__,
"soundproperty type must be valid source:",sourceID,
"type",soundProperty.
type);
2889 logError(__func__,
"sinkID must be valid");
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)
2896 if( soundProperty.
type == iter->type )
2898 iter->value = soundProperty.
value;
2899 if(sink.cacheSoundProperties.size())
2900 sink.cacheSoundProperties[soundProperty.
type] = soundProperty.
value;
2904 logError(__func__,
"soundproperty type must be valid sinkID:",sinkID,
"type",soundProperty.
type);
2913 logError(__func__,
"crossfaderID must be valid");
2917 mMappedData.mCrossfaderMap[crossfaderID].hotSink = hotsink;
2923 bool ret = isConnected(gateway);
2929 bool ret = isConnected(converter);
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;
2940 if( NULL!=reserved )
2942 sinkClassID = reserved->sinkClassID;
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;
2955 if( NULL!=ptrSource )
2957 sourceClassID = ptrSource->sourceClassID;
2969 logError(__func__,
"sourceID must be valid");
2975 std::vector<am_MainSoundProperty_s> listMainSoundPropertiesOut(listMainSoundProperties);
2978 std::unordered_map<am_sourceID_t, am_Source_Database_s>::iterator iter = mMappedData.mSourceMap.begin();
2979 for(; iter!=mMappedData.mSourceMap.end(); ++iter)
2981 if( iter->second.sourceID == sourceID )
2983 if (sourceClassID != 0)
2987 else if (0 == iter->second.reserved)
2989 sourceClassOut = iter->second.sourceClassID;
2996 if (!listSoundProperties.empty())
2998 mMappedData.mSourceMap.at(sourceID).listSoundProperties = listSoundProperties;
2999 mMappedData.mSourceMap.at(sourceID).cacheSoundProperties.clear();
3003 if (!listConnectionFormats.empty())
3005 mMappedData.mSourceMap.at(sourceID).listConnectionFormats = listConnectionFormats;
3011 if (!listMainSoundProperties.empty())
3013 DB_COND_UPDATE(mMappedData.mSourceMap.at(sourceID).listMainSoundProperties, listMainSoundProperties);
3014 mMappedData.mSourceMap.at(sourceID).cacheMainSoundProperties.clear();
3024 logVerbose(
"DatabaseHandler::changeSource changed changeSource of source:", sourceID);
3026 if (mpDatabaseObserver != NULL)
3041 std::vector<am_MainSoundProperty_s> listMainSoundPropertiesOut(listMainSoundProperties);
3045 logError(__func__,
"sinkID must be valid");
3049 std::unordered_map<am_sinkID_t, am_Sink_Database_s>::iterator iter = mMappedData.mSinkMap.begin();
3050 for(; iter!=mMappedData.mSinkMap.end(); ++iter)
3052 if (iter->second.sinkID == sinkID)
3054 if (sinkClassID != 0)
3058 else if (0 == iter->second.reserved)
3060 sinkClassOut = iter->second.sinkClassID;
3067 if (!listSoundProperties.empty())
3069 mMappedData.mSinkMap.at(sinkID).listSoundProperties = listSoundProperties;
3070 mMappedData.mSinkMap.at(sinkID).cacheSoundProperties.clear();
3074 if (!listConnectionFormats.empty())
3076 mMappedData.mSinkMap.at(sinkID).listConnectionFormats = listConnectionFormats;
3082 if (!listMainSoundProperties.empty())
3084 DB_COND_UPDATE(mMappedData.mSinkMap.at(sinkID).listMainSoundProperties, listMainSoundProperties);
3085 mMappedData.mSinkMap.at(sinkID).cacheMainSoundProperties.clear();
3095 logVerbose(
"DatabaseHandler::changeSink changed changeSink of sink:", sinkID);
3097 if (mpDatabaseObserver != NULL)
3114 listMainNotificationConfigurations.clear();
3116 listMainNotificationConfigurations = mMappedData.mSinkMap.at(sinkID).listMainNotificationConfigurations;
3126 logWarning(__func__,
"sourceID must be valid");
3130 listMainNotificationConfigurations = mMappedData.mSourceMap.at(sourceID).listMainNotificationConfigurations;
3138 std::vector<am_NotificationConfiguration_s>::iterator iter = listMainNotificationConfigurations.begin();
3139 for(; iter<listMainNotificationConfigurations.end(); ++iter)
3141 if( mainNotificationConfiguration.
type == iter->type )
3143 #ifdef WITH_DATABASE_CHANGE_CHECK
3144 if( iter->status == mainNotificationConfiguration.
status && iter->parameter == mainNotificationConfiguration.
parameter )
3147 *iter = mainNotificationConfiguration;
3159 logError(__func__,
"sinkID must be valid");
3165 logVerbose(
"DatabaseHandler::changeMainSinkNotificationConfigurationDB changed MainNotificationConfiguration of source:", sinkID,
"type:", mainNotificationConfiguration.
type,
"to status=", mainNotificationConfiguration.
status,
"and parameter=",mainNotificationConfiguration.
parameter);
3167 if (mpDatabaseObserver)
3177 logError(__func__,
"sourceID must be valid");
3184 logVerbose(
"DatabaseHandler::changeMainSourceNotificationConfigurationDB changed MainNotificationConfiguration of source:", sourceID,
"type:", mainNotificationConfiguration.
type,
"to status=", mainNotificationConfiguration.
status,
"and parameter=",mainNotificationConfiguration.
parameter);
3186 if (mpDatabaseObserver)
3196 logError(__func__,
"gatewayID must be valid");
3200 if (!listSourceConnectionFormats.empty())
3202 mMappedData.mGatewayMap.at(gatewayID).listSourceFormats = listSourceConnectionFormats;
3205 if (!listSinkConnectionFormats.empty())
3207 mMappedData.mGatewayMap.at(gatewayID).listSinkFormats = listSinkConnectionFormats;
3210 if (!convertionMatrix.empty())
3212 mListConnectionFormat.clear();
3213 mListConnectionFormat.insert(std::make_pair(gatewayID, convertionMatrix));
3216 logVerbose(
"DatabaseHandler::changeGatewayDB changed Gateway with ID", gatewayID);
3227 logError(__func__,
"converterID must be valid");
3231 if (!listSourceConnectionFormats.empty())
3233 mMappedData.mConverterMap.at(converterID).listSourceFormats = listSourceConnectionFormats;
3236 if (!listSinkConnectionFormats.empty())
3238 mMappedData.mConverterMap.at(converterID).listSinkFormats = listSinkConnectionFormats;
3241 if (!convertionMatrix.empty())
3243 mListConnectionFormat.clear();
3244 mListConnectionFormat.insert(std::make_pair(converterID, convertionMatrix));
3247 logVerbose(
"DatabaseHandler::changeConverterDB changed Gateway with ID", converterID);
3255 bool changed =
false;
3256 std::vector<am_NotificationConfiguration_s>::iterator iter = listNotificationConfigurations.begin();
3257 for(; iter<listNotificationConfigurations.end(); ++iter)
3259 if( notificationConfiguration.
type == iter->type )
3261 iter->status = notificationConfiguration.
status;
3262 iter->parameter = notificationConfiguration.
parameter;
3274 logError(__func__,
"sinkID must be valid");
3280 logVerbose(
"DatabaseHandler::changeMainSinkNotificationConfigurationDB changed MainNotificationConfiguration of source:", sinkID,
"type:", notificationConfiguration.
type,
"to status=", notificationConfiguration.
status,
"and parameter=",notificationConfiguration.
parameter);
3291 logError(__func__,
"sourceID must be valid");
3298 logVerbose(
"DatabaseHandler::changeSourceNotificationConfigurationDB changed MainNotificationConfiguration of source:", sourceID,
"type:", notificationConfiguration.
type,
"to status=", notificationConfiguration.
status,
"and parameter=",notificationConfiguration.
parameter);
3306 for(
auto it = mMappedData.mSourceMap.begin(); it!=mMappedData.mSourceMap.end(); it++)
3308 const am_Source_Database_s *pObject = &it->second;
3309 if( 0==pObject->reserved )
3317 for(
auto it = mMappedData.mSinkMap.begin(); it!=mMappedData.mSinkMap.end(); it++)
3319 const am_Sink_Database_s *pObject = &it->second;
3320 if( 0==pObject->reserved )
3328 for(
auto it = mMappedData.mGatewayMap.begin(); it!=mMappedData.mGatewayMap.end(); it++)
3338 for(
auto it = mMappedData.mConverterMap.begin(); it!=mMappedData.mConverterMap.end(); it++)
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.
void numberOfSourceClassesChanged()
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
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)
virtual ~CAmDatabaseHandlerMap()
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 ¬ificationConfiguration)
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
#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.
void numberOfSinkClassesChanged()
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