diff options
author | christian mueller <christian.ei.mueller@bmw.de> | 2012-02-13 14:55:12 +0100 |
---|---|---|
committer | christian mueller <christian.ei.mueller@bmw.de> | 2012-02-13 14:55:12 +0100 |
commit | d8dc623c4e00b72ef4868aca222d7159f533e741 (patch) | |
tree | 2921f2f058168eb61bb0177db26ce0b5547e6a7b | |
parent | d31807abef3e8f02de5ae4452527769f6c35b3db (diff) | |
download | audiomanager-d8dc623c4e00b72ef4868aca222d7159f533e741.tar.gz |
* added new functions to controlreceiver / databasehandler:
getSinkInfoDB
getSourceInfoDB
getMainConnectionInfoDB
* adopted changeMainConnectionRouteDB to new type
* added tests for these types
* recreation of interfaces
21 files changed, 693 insertions, 243 deletions
@@ -3,4 +3,6 @@ build/ doc/ packages/ .* +CHANGELOG +includes/config.h diff --git a/AudioManagerDaemon/include/ControlReceiver.h b/AudioManagerDaemon/include/ControlReceiver.h index a40f800..45788f5 100644 --- a/AudioManagerDaemon/include/ControlReceiver.h +++ b/AudioManagerDaemon/include/ControlReceiver.h @@ -68,7 +68,7 @@ public: am_Error_e enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID); am_Error_e enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass); am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties); - am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s& route); + am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID); am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState); am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID); am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID); @@ -90,8 +90,11 @@ public: am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID); am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const; am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const; + am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s& sinkData) const; + am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const; am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const; am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const; + am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const; am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const; am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const; am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listGatewaysID) const; diff --git a/AudioManagerDaemon/include/DatabaseHandler.h b/AudioManagerDaemon/include/DatabaseHandler.h index 1337c3d..550c13d 100644 --- a/AudioManagerDaemon/include/DatabaseHandler.h +++ b/AudioManagerDaemon/include/DatabaseHandler.h @@ -64,7 +64,7 @@ public: am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID); am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass); am_Error_e enterSystemProperties(const std::vector<am_SystemProperty_s>& listSystemProperties); - am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s& route); + am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID); am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState); am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID); am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID); @@ -97,7 +97,10 @@ public: am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const; am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const; am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const; + am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s& sinkData) const; + am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const; am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const; + am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const; am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t& volume) const; am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t& volume) const; am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t& value) const; diff --git a/AudioManagerDaemon/src/CommandSender.cpp b/AudioManagerDaemon/src/CommandSender.cpp index 810eec4..d2cc1ca 100644 --- a/AudioManagerDaemon/src/CommandSender.cpp +++ b/AudioManagerDaemon/src/CommandSender.cpp @@ -32,8 +32,6 @@ using namespace am; #define REQUIRED_INTERFACE_VERSION 1 -DLT_IMPORT_CONTEXT(AudioManager) - //!< macro to call all interfaces #define CALL_ALL_INTERFACES(...) \ std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin(); \ diff --git a/AudioManagerDaemon/src/ControlReceiver.cpp b/AudioManagerDaemon/src/ControlReceiver.cpp index b32ffdd..b352d0d 100644 --- a/AudioManagerDaemon/src/ControlReceiver.cpp +++ b/AudioManagerDaemon/src/ControlReceiver.cpp @@ -66,8 +66,7 @@ ControlReceiver::~ControlReceiver() am_Error_e ControlReceiver::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList) { - mRouter->getRoute(onlyfree, sourceID, sinkID, returnList); - return E_NOT_USED; + return mRouter->getRoute(onlyfree, sourceID, sinkID, returnList); } am_Error_e ControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & connectionID, const am_ConnectionFormat_e format, const am_sourceID_t sourceID, const am_sinkID_t sinkID) @@ -99,7 +98,7 @@ am_Error_e ControlReceiver::disconnect(am_Handle_s & handle, const am_connection am_Error_e ControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime) { - logInfo("ControlReceiver::crossfade got called, hotSource=",hotSource,"crossfaderID=",crossfaderID,"rampType=",rampType,"rampTime=",rampTime); + logInfo("ControlReceiver::crossfade got called, hotSource=", hotSource, "crossfaderID=", crossfaderID, "rampType=", rampType, "rampTime=", rampTime); if (!mDatabaseHandler->existcrossFader(crossfaderID)) return E_NON_EXISTENT; @@ -108,7 +107,7 @@ am_Error_e ControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e h am_Error_e ControlReceiver::setSourceState(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SourceState_e state) { - logInfo("ControlReceiver::setSourceState got called, sourceID=",sourceID,"state=",state); + logInfo("ControlReceiver::setSourceState got called, sourceID=", sourceID, "state=", state); am_SourceState_e sourceState; if (mDatabaseHandler->getSoureState(sourceID, sourceState) != E_OK) @@ -120,7 +119,7 @@ am_Error_e ControlReceiver::setSourceState(am_Handle_s & handle, const am_source am_Error_e ControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) { - logInfo("ControlReceiver::setSinkVolume got called, sinkID=",sinkID,"volume=",volume,"ramp=",ramp, "time=",time); + logInfo("ControlReceiver::setSinkVolume got called, sinkID=", sinkID, "volume=", volume, "ramp=", ramp, "time=", time); am_volume_t tempVolume; if (mDatabaseHandler->getSinkVolume(sinkID, tempVolume) != E_OK) @@ -132,7 +131,7 @@ am_Error_e ControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_ am_Error_e ControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e rampType, const am_time_t time) { - logInfo("ControlReceiver::setSourceVolume got called, sourceID=",sourceID,"volume=",volume,"ramp=",rampType,"time=",time); + logInfo("ControlReceiver::setSourceVolume got called, sourceID=", sourceID, "volume=", volume, "ramp=", rampType, "time=", time); am_volume_t tempVolume; if (mDatabaseHandler->getSourceVolume(sourceID, tempVolume) != E_OK) @@ -144,7 +143,7 @@ am_Error_e ControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourc am_Error_e ControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty) { - logInfo("ControlReceiver::setSinkSoundProperty got called, sinkID=",sinkID,"soundProperty.Type=",soundProperty.type,"soundProperty.value=",soundProperty.value); + logInfo("ControlReceiver::setSinkSoundProperty got called, sinkID=", sinkID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value); uint16_t value; if (mDatabaseHandler->getSinkSoundPropertyValue(sinkID, soundProperty.type, value) != E_OK) @@ -156,7 +155,7 @@ am_Error_e ControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_ am_Error_e ControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties) { - logInfo("ControlReceiver::setSinkSoundProperties got called, sinkID=",sinkID); + logInfo("ControlReceiver::setSinkSoundProperties got called, sinkID=", sinkID); uint16_t value; bool noChange = true; @@ -175,7 +174,7 @@ am_Error_e ControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const a am_Error_e ControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty) { - logInfo("ControlReceiver::setSourceSoundProperty got called, sourceID=",sourceID,"soundProperty.Type=",soundProperty.type,"soundProperty.value=",soundProperty.value); + logInfo("ControlReceiver::setSourceSoundProperty got called, sourceID=", sourceID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value); uint16_t value; if (mDatabaseHandler->getSourceSoundPropertyValue(sourceID, soundProperty.type, value) != E_OK) @@ -187,7 +186,7 @@ am_Error_e ControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const a am_Error_e ControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties) { - logInfo("ControlReceiver::setSourceSoundProperties got called, sourceID=",sourceID); + logInfo("ControlReceiver::setSourceSoundProperties got called, sourceID=", sourceID); uint16_t value; bool noChange = true; @@ -206,7 +205,7 @@ am_Error_e ControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const am_Error_e ControlReceiver::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) { - logInfo("ControlReceiver::setDomainState got called, domainID=",domainID,"domainState=",domainState); + logInfo("ControlReceiver::setDomainState got called, domainID=", domainID, "domainState=", domainState); am_DomainState_e tempState = DS_MIN; if (mDatabaseHandler->getDomainState(domainID, tempState) != E_OK) @@ -218,7 +217,7 @@ am_Error_e ControlReceiver::setDomainState(const am_domainID_t domainID, const a am_Error_e ControlReceiver::abortAction(const am_Handle_s handle) { - logInfo("ControlReceiver::abortAction got called, handle.type=",handle.handle,"handle.handleType=",handle.handleType); + logInfo("ControlReceiver::abortAction got called, handle.type=", handle.handle, "handle.handleType=", handle.handleType); return mRoutingSender->asyncAbort(handle); } @@ -268,9 +267,9 @@ am_Error_e ControlReceiver::enterSystemPropertiesListDB(const std::vector<am_Sys return mDatabaseHandler->enterSystemProperties(listSystemProperties); } -am_Error_e ControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s & route) +am_Error_e ControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID) { - return mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, route); + return mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, listConnectionID); } am_Error_e ControlReceiver::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState) @@ -358,6 +357,21 @@ am_Error_e ControlReceiver::getSinkClassInfoDB(const am_sinkID_t sinkID, am_Sink return mDatabaseHandler->getSinkClassInfoDB(sinkID, sinkClass); } +am_Error_e ControlReceiver::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const +{ + return mDatabaseHandler->getSinkInfoDB(sinkID, sinkData); +} + +am_Error_e ControlReceiver::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const +{ + return mDatabaseHandler->getSourceInfoDB(sourceID, sourceData); +} + +am_Error_e ControlReceiver::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const +{ + return mDatabaseHandler->getMainConnectionInfoDB(mainConnectionID, mainConnectionData); +} + am_Error_e ControlReceiver::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const { return mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData); diff --git a/AudioManagerDaemon/src/DatabaseHandler.cpp b/AudioManagerDaemon/src/DatabaseHandler.cpp index 1082c25..645da7c 100644 --- a/AudioManagerDaemon/src/DatabaseHandler.cpp +++ b/AudioManagerDaemon/src/DatabaseHandler.cpp @@ -176,17 +176,18 @@ am_Error_e DatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_dom am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID) { - assert(mainConnectionData.connectionID==0); + assert(mainConnectionData.mainConnectionID==0); assert(mainConnectionData.connectionState>=CS_MIN && mainConnectionData.connectionState<=CS_MAX); - assert(mainConnectionData.route.sinkID!=0); - assert(mainConnectionData.route.sourceID!=0); + assert(mainConnectionData.sinkID!=0); + assert(mainConnectionData.sourceID!=0); sqlite3_stmt* query = NULL; int eCode = 0; + int16_t delay = 0; std::string command = "INSERT INTO " + std::string(MAINCONNECTION_TABLE) + "(sourceID, sinkID, connectionState, delay) VALUES (?,?,?,-1)"; sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); - sqlite3_bind_int(query, 1, mainConnectionData.route.sourceID); - sqlite3_bind_int(query, 2, mainConnectionData.route.sinkID); + sqlite3_bind_int(query, 1, mainConnectionData.sourceID); + sqlite3_bind_int(query, 2, mainConnectionData.sinkID); sqlite3_bind_int(query, 3, mainConnectionData.connectionState); if ((eCode = sqlite3_step(query)) != SQLITE_DONE) @@ -203,21 +204,16 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma connectionID = sqlite3_last_insert_rowid(mDatabase); - //now check the connectionTable for all connections in the route. IF a particular route is not found, we return with error - std::vector<uint16_t> listOfConnections; - int16_t delay = 0; - command = "SELECT connectionID, delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE sourceID=? AND sinkID=? AND connectionFormat=?"); + //now check the connectionTable for all connections in the route. IF connectionID exist + command = "SELECT delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE connectionID=?"); sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); - std::vector<am_RoutingElement_s>::const_iterator elementIterator = mainConnectionData.route.route.begin(); - for (; elementIterator < mainConnectionData.route.route.end(); ++elementIterator) + std::vector<am_connectionID_t>::const_iterator elementIterator = mainConnectionData.listConnectionID.begin(); + for (; elementIterator < mainConnectionData.listConnectionID.end(); ++elementIterator) { - sqlite3_bind_int(query, 1, elementIterator->sourceID); - sqlite3_bind_int(query, 2, elementIterator->sinkID); - sqlite3_bind_int(query, 3, elementIterator->connectionFormat); + sqlite3_bind_int(query, 1, *elementIterator); if ((eCode = sqlite3_step(query)) == SQLITE_ROW) { - listOfConnections.push_back(sqlite3_column_int(query, 0)); int16_t temp_delay = sqlite3_column_int(query, 1); if (temp_delay != -1 && delay != -1) delay += temp_delay; @@ -227,7 +223,6 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma else { logError("DatabaseHandler::enterMainConnectionDB did not find route for MainConnection:", eCode); - return E_DATABASE_ERROR; } sqlite3_reset(query); @@ -245,8 +240,8 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma command = "INSERT INTO MainConnectionRoute" + i2s(connectionID) + "(connectionID) VALUES (?)"; sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); - std::vector<uint16_t>::iterator listConnectionIterator = listOfConnections.begin(); - for (; listConnectionIterator < listOfConnections.end(); ++listConnectionIterator) + std::vector<am_connectionID_t>::const_iterator listConnectionIterator(mainConnectionData.listConnectionID.begin()); + for (; listConnectionIterator < mainConnectionData.listConnectionID.end(); ++listConnectionIterator) { sqlite3_bind_int(query, 1, *listConnectionIterator); if ((eCode = sqlite3_step(query)) != SQLITE_DONE) @@ -263,7 +258,7 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma return E_DATABASE_ERROR; } - logInfo("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID", mainConnectionData.route.sourceID, "sinkID:", mainConnectionData.route.sinkID, "delay:", delay, "assigned ID:", connectionID); + logInfo("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID", mainConnectionData.sourceID, "sinkID:", mainConnectionData.sinkID, "delay:", delay, "assigned ID:", connectionID); if (mDatabaseObserver) { @@ -832,7 +827,7 @@ am_Error_e DatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sou return E_OK; } -am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s & route) +am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID) { assert(mainconnectionID!=0); if (!existMainConnection(mainconnectionID)) @@ -843,20 +838,16 @@ am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionI int eCode = 0; std::string command; - std::vector<uint16_t> listOfConnections; int16_t delay = 0; - command = "SELECT connectionID, delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE sourceID=? AND sinkID=? AND connectionFormat=?"); + command = "SELECT delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE connectionID=?"); sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); - std::vector<am_RoutingElement_s>::const_iterator elementIterator = route.route.begin(); - for (; elementIterator < route.route.end(); ++elementIterator) + std::vector<am_connectionID_t>::const_iterator elementIterator = listConnectionID.begin(); + for (; elementIterator < listConnectionID.end(); ++elementIterator) { - sqlite3_bind_int(query, 1, elementIterator->sourceID); - sqlite3_bind_int(query, 2, elementIterator->sinkID); - sqlite3_bind_int(query, 3, elementIterator->connectionFormat); + sqlite3_bind_int(query, 1, *elementIterator); if ((eCode = sqlite3_step(query)) == SQLITE_ROW) { - listOfConnections.push_back(sqlite3_column_int(query, 0)); int16_t temp_delay = sqlite3_column_int(query, 1); if (temp_delay != -1 && delay != -1) delay += temp_delay; @@ -885,8 +876,8 @@ am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionI command = "INSERT INTO MainConnectionRoute" + i2s(mainconnectionID) + "(connectionID) VALUES (?)"; sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); - std::vector<uint16_t>::iterator listConnectionIterator = listOfConnections.begin(); - for (; listConnectionIterator < listOfConnections.end(); ++listConnectionIterator) + std::vector<am_connectionID_t>::const_iterator listConnectionIterator(listConnectionID.begin()); + for (; listConnectionIterator != listConnectionID.end(); ++listConnectionIterator) { sqlite3_bind_int(query, 1, *listConnectionIterator); if ((eCode = sqlite3_step(query)) != SQLITE_DONE) @@ -1477,6 +1468,246 @@ am_Error_e DatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, a return E_OK; } +am_Error_e DatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const +{ + + assert(sinkID!=0); + + if (!existSink(sinkID)) + { + return E_NON_EXISTENT; + } + + sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL; + int eCode = 0; + am_ConnectionFormat_e tempConnectionFormat; + am_SoundProperty_s tempSoundProperty; + am_MainSoundProperty_s tempMainSoundProperty; + std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 and sinkID=" + i2s(sinkID); + sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); + + if ((eCode = sqlite3_step(query)) == SQLITE_ROW) + { + sinkData.name = std::string((const char*) sqlite3_column_text(query, 0)); + sinkData.domainID = sqlite3_column_int(query, 1); + sinkData.sinkClassID = sqlite3_column_int(query, 2); + sinkData.volume = sqlite3_column_int(query, 3); + sinkData.visible = sqlite3_column_int(query, 4); + sinkData.available.availability = (am_Availablility_e) sqlite3_column_int(query, 5); + sinkData.available.availabilityReason = (am_AvailabilityReason_e) sqlite3_column_int(query, 6); + sinkData.muteState = (am_MuteState_e) sqlite3_column_int(query, 7); + sinkData.mainVolume = sqlite3_column_int(query, 8); + sinkData.sinkID = sqlite3_column_int(query, 9); + + //read out the connectionFormats + std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(sinkID); + sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL); + while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW) + { + tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0); + sinkData.listConnectionFormats.push_back(tempConnectionFormat); + } + + if ((eCode = sqlite3_finalize(qConnectionFormat)) != SQLITE_OK) + { + logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode); + + return E_DATABASE_ERROR; + } + + //read out sound properties + std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(sinkID); + sqlite3_prepare_v2(mDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL); + while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW) + { + tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0); + tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1); + sinkData.listSoundProperties.push_back(tempSoundProperty); + } + + if ((eCode = sqlite3_finalize(qSoundProperty)) != SQLITE_OK) + { + logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode); + + return E_DATABASE_ERROR; + } + + //read out MainSoundProperties + std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(sinkID); + sqlite3_prepare_v2(mDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL); + while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW) + { + tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0); + tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1); + sinkData.listMainSoundProperties.push_back(tempMainSoundProperty); + } + + if ((eCode = sqlite3_finalize(qMAinSoundProperty)) != SQLITE_OK) + { + logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode); + + return E_DATABASE_ERROR; + } + } + + else if (eCode != SQLITE_DONE) + { + logError("DatabaseHandler::getSinkInfoDB SQLITE error code:", eCode); + + return E_DATABASE_ERROR; + } + + if ((eCode = sqlite3_finalize(query)) != SQLITE_OK) + { + logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode); + + return E_DATABASE_ERROR; + } + + return E_OK; +} + +am_Error_e DatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const +{ + assert(sourceID!=0); + + if (!existSource(sourceID)) + { + return E_NON_EXISTENT; + } + + sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL; + int eCode = 0; + am_ConnectionFormat_e tempConnectionFormat; + am_SoundProperty_s tempSoundProperty; + am_MainSoundProperty_s tempMainSoundProperty; + std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID); + sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); + + if ((eCode = sqlite3_step(query)) == SQLITE_ROW) + { + sourceData.name = std::string((const char*) sqlite3_column_text(query, 0)); + sourceData.domainID = sqlite3_column_int(query, 1); + sourceData.sourceClassID = sqlite3_column_int(query, 2); + sourceData.sourceState = (am_SourceState_e) sqlite3_column_int(query, 3); + sourceData.volume = sqlite3_column_int(query, 4); + sourceData.visible = sqlite3_column_int(query, 5); + sourceData.available.availability = (am_Availablility_e) sqlite3_column_int(query, 6); + sourceData.available.availabilityReason = (am_AvailabilityReason_e) sqlite3_column_int(query, 7); + sourceData.interruptState = (am_InterruptState_e) sqlite3_column_int(query, 8); + sourceData.sourceID = sqlite3_column_int(query, 9); + + //read out the connectionFormats + std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(sourceID); + sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL); + while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW) + { + tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0); + sourceData.listConnectionFormats.push_back(tempConnectionFormat); + } + + if ((eCode = sqlite3_finalize(qConnectionFormat)) != SQLITE_OK) + { + logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode); + + return E_DATABASE_ERROR; + } + + //read out sound properties + std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(sourceID); + sqlite3_prepare_v2(mDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL); + while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW) + { + tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0); + tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1); + sourceData.listSoundProperties.push_back(tempSoundProperty); + } + + if ((eCode = sqlite3_finalize(qSoundProperty)) != SQLITE_OK) + { + logError("DatabaseHandler::getSourceInfoDB SQLITE Finalize error code:", eCode); + + return E_DATABASE_ERROR; + } + + //read out MainSoundProperties + std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(sourceID); + sqlite3_prepare_v2(mDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL); + while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW) + { + tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0); + tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1); + sourceData.listMainSoundProperties.push_back(tempMainSoundProperty); + } + + if ((eCode = sqlite3_finalize(qMAinSoundProperty)) != SQLITE_OK) + { + logError("DatabaseHandler::getSourceInfoDB SQLITE Finalize error code:", eCode); + + return E_DATABASE_ERROR; + } + } + else if (eCode != SQLITE_DONE) + { + logError("DatabaseHandler::getSourceInfoDB SQLITE error code:", eCode); + + return E_DATABASE_ERROR; + } + + if ((eCode = sqlite3_finalize(query)) != SQLITE_OK) + { + logError("DatabaseHandler::getSourceInfoDB SQLITE Finalize error code:", eCode); + + return E_DATABASE_ERROR; + } + + return E_OK; +} + +am_Error_e am::DatabaseHandler::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const +{ + assert(mainConnectionID!=0); + if (!existMainConnection(mainConnectionID)) + { + return E_NON_EXISTENT; + } + sqlite3_stmt *query = NULL, *query1 = NULL; + int eCode = 0; + am_MainConnection_s temp; + std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID); + std::string command1 = "SELECT connectionID FROM MainConnectionRoute"; + sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); + + while ((eCode = sqlite3_step(query)) == SQLITE_ROW) + { + mainConnectionData.mainConnectionID = sqlite3_column_int(query, 0); + mainConnectionData.sourceID = sqlite3_column_int(query, 1); + mainConnectionData.sinkID = sqlite3_column_int(query, 2); + mainConnectionData.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3); + mainConnectionData.delay = sqlite3_column_int(query, 4); + std::string statement = command1 + i2s(mainConnectionID); + sqlite3_prepare_v2(mDatabase, statement.c_str(), -1, &query1, NULL); + while ((eCode = sqlite3_step(query1)) == SQLITE_ROW) + { + mainConnectionData.listConnectionID.push_back(sqlite3_column_int(query1, 0)); + } + } + + if (eCode != SQLITE_DONE) + { + logError("DatabaseHandler::getMainConnectionInfoDB SQLITE error code:", eCode); + return E_DATABASE_ERROR; + } + + if ((eCode = sqlite3_finalize(query)) != SQLITE_OK) + { + logError("DatabaseHandler::getMainConnectionInfoDB SQLITE Finalize error code:", eCode); + return E_DATABASE_ERROR; + } + + return E_OK; +} + am_Error_e DatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass) { assert(sinkClass.sinkClassID!=0); @@ -1893,39 +2124,25 @@ am_Error_e DatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domainID am_Error_e DatabaseHandler::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const { listMainConnections.clear(); - sqlite3_stmt *query = NULL, *query1 = NULL, *query2 = NULL; + sqlite3_stmt *query = NULL, *query1 = NULL; int eCode = 0; am_MainConnection_s temp; - am_RoutingElement_s tempRoute; - std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE); std::string command1 = "SELECT connectionID FROM MainConnectionRoute"; - std::string command2 = "SELECT sourceID, sinkID, connectionFormat FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=?"; sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL); - sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &query2, NULL); while ((eCode = sqlite3_step(query)) == SQLITE_ROW) { - temp.connectionID = sqlite3_column_int(query, 0); - temp.route.sourceID = sqlite3_column_int(query, 1); - temp.route.sinkID = sqlite3_column_int(query, 2); + temp.mainConnectionID = sqlite3_column_int(query, 0); + temp.sourceID = sqlite3_column_int(query, 1); + temp.sinkID = sqlite3_column_int(query, 2); temp.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3); temp.delay = sqlite3_column_int(query, 4); - std::string statement = command1 + i2s(temp.connectionID); + std::string statement = command1 + i2s(temp.mainConnectionID); sqlite3_prepare_v2(mDatabase, statement.c_str(), -1, &query1, NULL); while ((eCode = sqlite3_step(query1)) == SQLITE_ROW) { - int k = sqlite3_column_int(query1, 0); - sqlite3_bind_int(query2, 1, k); - while ((eCode = sqlite3_step(query2)) == SQLITE_ROW) - { - tempRoute.sourceID = sqlite3_column_int(query2, 0); - tempRoute.sinkID = sqlite3_column_int(query2, 1); - tempRoute.connectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(query2, 2); - getDomainOfSource(tempRoute.sourceID, tempRoute.domainID); - temp.route.route.push_back(tempRoute); - } - sqlite3_reset(query2); + temp.listConnectionID.push_back(sqlite3_column_int(query1, 0)); } listMainConnections.push_back(temp); } diff --git a/AudioManagerDaemon/src/SocketHandler.cpp b/AudioManagerDaemon/src/SocketHandler.cpp index fa7fee4..d9fdc3a 100644 --- a/AudioManagerDaemon/src/SocketHandler.cpp +++ b/AudioManagerDaemon/src/SocketHandler.cpp @@ -219,7 +219,8 @@ void SocketHandler::stop_listening() * @param callback the callback that shall be called if the filedescriptor poll succeeded * @return E_OK if the descriptor was added, E_NON_EXISTENT if the fd is not valid */ -am_Error_e SocketHandler::addFDPoll(const int fd, const int16_t event, shPollPrepare *prepare, shPollFired *fired, shPollCheck *check, shPollDispatch *dispatch, void* userData, sh_pollHandle_t& handle) + +am_Error_e SocketHandler::addFDPoll(const int fd, const short event, shPollPrepare *prepare, shPollFired *fired, shPollCheck *check, shPollDispatch *dispatch, void *userData, sh_pollHandle_t & handle) { if (!fdIsValid(fd)) return E_NON_EXISTENT; @@ -386,7 +387,7 @@ am_Error_e SocketHandler::stopTimer(const sh_timerHandle_t handle) * @param event the event flags * @return E_OK on succsess, E_NON_EXISTENT if fd was not found */ -am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const int16_t events) +am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const short events) { mListPoll_t::iterator iterator = mListPoll.begin(); diff --git a/AudioManagerDaemon/test/CommonFunctions.cpp b/AudioManagerDaemon/test/CommonFunctions.cpp index 30c8725..10245d7 100644 --- a/AudioManagerDaemon/test/CommonFunctions.cpp +++ b/AudioManagerDaemon/test/CommonFunctions.cpp @@ -300,14 +300,6 @@ void CommonFunctions::createConnection(am_Connection_s & connection) const connection.connectionFormat = CF_ANALOG; } -void CommonFunctions::createMainConnection(am_MainConnection_s & mainConnection, am_Route_s route) const -{ - mainConnection.connectionID = 0; - mainConnection.connectionState = CS_CONNECTED; - mainConnection.route = route; - mainConnection.delay = -1; -} - std::vector<bool> CommonFunctions::getStandardConvertionMatrix() { std::vector<bool> convMatrix; diff --git a/AudioManagerDaemon/test/CommonFunctions.h b/AudioManagerDaemon/test/CommonFunctions.h index 7bc7e04..6e5a996 100644 --- a/AudioManagerDaemon/test/CommonFunctions.h +++ b/AudioManagerDaemon/test/CommonFunctions.h @@ -51,7 +51,6 @@ public: void createDomain(am_Domain_s& domain) const; void createGateway(am_Gateway_s& gateway); void createConnection(am_Connection_s& connection) const; - void createMainConnection(am_MainConnection_s& mainConnection, am_Route_s route) const; void connectionList2RoutingList(std::vector<am_RoutingElement_s>& routingList, const std::vector<am_Connection_s>& connectionList); struct sortBySinkID diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp index 58bd0e7..caaac76 100644 --- a/AudioManagerDaemon/test/database/databaseTest.cpp +++ b/AudioManagerDaemon/test/database/databaseTest.cpp @@ -40,7 +40,7 @@ using namespace testing; //extern int GetRandomNumber(int nLow, int nHigh); //extern bool equalSoundProperty (const am_SoundProperty_s a, const am_SoundProperty_s b); extern bool equalMainSoundProperty(const am_MainSoundProperty_s a, const am_MainSoundProperty_s b); -extern bool equalRoutingElement(const am_RoutingElement_s a, const am_RoutingElement_s b); +//extern bool equalRoutingElement(const am_RoutingElement_s a, const am_RoutingElement_s b); extern bool equalClassProperties(const am_ClassProperty_s a, const am_ClassProperty_s b); extern std::string int2string(int i); @@ -72,7 +72,7 @@ void databasetest::createMainConnectionSetup() am_Connection_s connection; am_Source_s source; am_Sink_s sink; - std::vector<am_Connection_s> connectionList; + std::vector<am_connectionID_t> connectionList; //we create 9 sources and sinks: EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9); @@ -82,12 +82,7 @@ void databasetest::createMainConnectionSetup() { am_sinkID_t forgetSink; am_sourceID_t forgetSource; - am_connectionID_t forgetConnection; - - pCF.createConnection(connection); - connection.sinkID = i; - connection.sourceID = i; - connectionList.push_back(connection); + am_connectionID_t connectionID; pCF.createSink(sink); sink.sinkID = i; @@ -98,38 +93,36 @@ void databasetest::createMainConnectionSetup() source.name = "source" + int2string(i); source.domainID = 4; - ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink)) - << "ERROR: database error"; - ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource)) - << "ERROR: database error"; - ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection)) - << "ERROR: database error"; - ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(forgetConnection)); - } + connection.sinkID = i; + connection.sourceID = i; + connection.delay = -1; + connection.connectionFormat = CF_ANALOG; + connection.connectionID = 0; - //fill the route - std::vector<am_RoutingElement_s> routingList; - pCF.connectionList2RoutingList(routingList, connectionList); + ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,forgetSink)); + ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,forgetSource)); + ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID)); + ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID)); + connectionList.push_back(connectionID); - //create the Route - am_Route_s route; - route.route = routingList; - route.sinkID = 1; - route.sourceID = 1; + } //create a mainConnection am_MainConnection_s mainConnection; am_mainConnectionID_t mainConnectionID; std::vector<am_MainConnection_s> mainConnectionList; - pCF.createMainConnection(mainConnection, route); + mainConnection.listConnectionID = connectionList; + mainConnection.mainConnectionID = 0; + mainConnection.sinkID = 1; + mainConnection.sourceID = 1; + mainConnection.connectionState = CS_CONNECTED; + mainConnection.delay = -1; //enter mainconnection in database EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1); EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1); - ASSERT_EQ(E_OK,pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID)) - << "ERROR: database error"; - ASSERT_NE(0,mainConnectionID) - << "ERROR: connectionID zero"; + ASSERT_EQ(E_OK, pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID)); + ASSERT_NE(0, mainConnectionID); //read out the mainconnections and check if they are equal to the data written. ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(mainConnectionList)); @@ -137,9 +130,9 @@ void databasetest::createMainConnectionSetup() std::vector<am_MainConnection_s>::iterator listIterator = mainConnectionList.begin(); for (; listIterator < mainConnectionList.end(); ++listIterator) { - if (listIterator->connectionID == mainConnectionID) + if (listIterator->mainConnectionID == mainConnectionID) { - equal = equal && (listIterator->connectionState == mainConnection.connectionState) && (listIterator->route.sinkID == mainConnection.route.sinkID) && (listIterator->route.sourceID == mainConnection.route.sourceID) && (listIterator->delay == mainConnection.delay) && (std::equal(listIterator->route.route.begin(), listIterator->route.route.end(), routingList.begin(), equalRoutingElement)); + equal = equal && (listIterator->connectionState == mainConnection.connectionState) && (listIterator->sinkID == mainConnection.sinkID) && (listIterator->sourceID == mainConnection.sourceID) && (listIterator->delay == mainConnection.delay) && (std::equal(listIterator->listConnectionID.begin(), listIterator->listConnectionID.end(), connectionList.begin())); } } ASSERT_EQ(true, equal); @@ -153,6 +146,209 @@ void databasetest::TearDown() { } +TEST_F(databasetest,getMainConnectionInfo) +{ + //fill the connection database + am_Connection_s connection; + am_Source_s source; + am_Sink_s sink; + std::vector<am_connectionID_t> connectionList; + + //we create 9 sources and sinks: + EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9); + EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9); + + for (uint16_t i = 1; i < 10; i++) + { + am_sinkID_t forgetSink; + am_sourceID_t forgetSource; + am_connectionID_t connectionID; + + pCF.createSink(sink); + sink.sinkID = i; + sink.name = "sink" + int2string(i); + sink.domainID = 4; + pCF.createSource(source); + source.sourceID = i; + source.name = "source" + int2string(i); + source.domainID = 4; + + connection.sinkID = i; + connection.sourceID = i; + connection.delay = -1; + connection.connectionFormat = CF_ANALOG; + connection.connectionID = 0; + + ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,forgetSink)); + ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,forgetSource)); + ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID)); + ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID)); + connectionList.push_back(connectionID); + + } + + //create a mainConnection + am_MainConnection_s mainConnection; + am_mainConnectionID_t mainConnectionID; + std::vector<am_MainConnection_s> mainConnectionList; + mainConnection.listConnectionID = connectionList; + mainConnection.mainConnectionID = 0; + mainConnection.sinkID = 1; + mainConnection.sourceID = 1; + mainConnection.connectionState = CS_CONNECTED; + mainConnection.delay = -1; + + //enter mainconnection in database + EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1); + EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1); + ASSERT_EQ(E_OK, pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID)); + ASSERT_NE(0, mainConnectionID); + + //read out the mainconnections and check if they are equal to the data written. + ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(mainConnectionList)); + bool equal = true; + std::vector<am_MainConnection_s>::iterator listIterator = mainConnectionList.begin(); + for (; listIterator < mainConnectionList.end(); ++listIterator) + { + if (listIterator->mainConnectionID == mainConnectionID) + { + equal = equal && (listIterator->connectionState == mainConnection.connectionState) && (listIterator->sinkID == mainConnection.sinkID) && (listIterator->sourceID == mainConnection.sourceID) && (listIterator->delay == mainConnection.delay) && (std::equal(listIterator->listConnectionID.begin(), listIterator->listConnectionID.end(), connectionList.begin())); + } + }ASSERT_EQ(true, equal); + + am_MainConnection_s mainConnectionT; + ASSERT_EQ(E_OK, pDatabaseHandler.getMainConnectionInfoDB(mainConnectionID,mainConnectionT)); + ASSERT_TRUE( (mainConnection.connectionState==mainConnectionT.connectionState) && (mainConnection.delay==mainConnectionT.delay) && (std::equal(mainConnection.listConnectionID.begin(),mainConnection.listConnectionID.end(),mainConnectionT.listConnectionID.begin())) && (mainConnection.sinkID==mainConnectionT.sinkID) && (mainConnection.sourceID==mainConnectionT.sourceID) && (mainConnectionID==mainConnectionT.mainConnectionID)); + +} + +TEST_F(databasetest,getSinKInfo) +{ + //fill the connection database + am_Sink_s staticSink, firstDynamicSink, secondDynamicSink; + am_sinkID_t staticSinkID, firstDynamicSinkID, secondDynamicSinkID; + std::vector<am_Sink_s> sinkList; + + pCF.createSink(staticSink); + staticSink.sinkID = 4; + + EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3); + ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID)) + << "ERROR: database error"; + ASSERT_EQ(staticSink.sinkID,staticSinkID) + << "ERROR: ID not the one given in staticSink"; + + pCF.createSink(firstDynamicSink); + firstDynamicSink.name = "firstdynamic"; + ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(firstDynamicSink,firstDynamicSinkID)) + << "ERROR: database error"; + ASSERT_EQ(firstDynamicSinkID,DYNAMIC_ID_BOUNDARY) + << "ERROR: ID not the one given in firstDynamicSink"; + + pCF.createSink(secondDynamicSink); + secondDynamicSink.name = "seconddynamic"; + + ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(secondDynamicSink,secondDynamicSinkID)) + << "ERROR: database error"; + ASSERT_NEAR(secondDynamicSinkID,DYNAMIC_ID_BOUNDARY,10) + << "ERROR: ID not the one given in secondDynamicSink"; + + //now read back and check the returns agains the given values + ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(sinkList)) + << "ERROR: database error"; + bool equal = true; + + std::vector<am_Sink_s>::iterator listIterator = sinkList.begin(); + for (; listIterator < sinkList.end(); ++listIterator) + { + if (listIterator->sinkID == staticSinkID) + { + equal = equal && pCF.compareSink(listIterator, staticSink); + } + + if (listIterator->sinkID == firstDynamicSinkID) + { + equal = equal && pCF.compareSink(listIterator, firstDynamicSink); + } + + if (listIterator->sinkID == secondDynamicSinkID) + { + equal = equal && pCF.compareSink(listIterator, secondDynamicSink); + } + }ASSERT_EQ(true, equal); + + am_Sink_s sinkData; + ASSERT_EQ(E_OK, pDatabaseHandler.getSinkInfoDB(secondDynamicSinkID,sinkData)); + ASSERT_TRUE( (secondDynamicSink.available.availability == sinkData.available.availability) && (secondDynamicSink.available.availabilityReason == sinkData.available.availabilityReason) && (secondDynamicSink.sinkClassID == sinkData.sinkClassID) && (secondDynamicSink.domainID == sinkData.domainID) && (secondDynamicSink.visible == sinkData.visible) && (secondDynamicSink.name.compare(sinkData.name) == 0) && (secondDynamicSink.volume == sinkData.volume) && std::equal(secondDynamicSink.listConnectionFormats.begin(), secondDynamicSink.listConnectionFormats.end(), sinkData.listConnectionFormats.begin()) && std::equal(secondDynamicSink.listMainSoundProperties.begin(), secondDynamicSink.listMainSoundProperties.end(), sinkData.listMainSoundProperties.begin(), equalMainSoundProperty)); + +} + +TEST_F(databasetest,getSourceInfo) +{ + //fill the connection database + am_Source_s staticSource, firstDynamicSource, secondDynamicSource; + am_sourceID_t staticSourceID, firstDynamicSourceID, secondDynamicSourceID; + std::vector<am_Source_s> sourceList; + + pCF.createSource(staticSource); + staticSource.sourceID = 4; + staticSource.name = "Static"; + + EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3); + ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID)) + << "ERROR: database error"; + ASSERT_EQ(staticSource.sourceID,staticSourceID) + << "ERROR: ID not the one given in staticSource"; + + pCF.createSource(firstDynamicSource); + firstDynamicSource.name = "firstDynamicSource"; + + ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(firstDynamicSource,firstDynamicSourceID)) + << "ERROR: database error"; + ASSERT_EQ(firstDynamicSourceID,DYNAMIC_ID_BOUNDARY) + << "ERROR: ID not the one given in firstDynamicSink"; + + pCF.createSource(secondDynamicSource); + secondDynamicSource.name = "secondDynamicSource"; + + ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(secondDynamicSource,secondDynamicSourceID)) + << "ERROR: database error"; + ASSERT_NEAR(secondDynamicSourceID,DYNAMIC_ID_BOUNDARY,10) + << "ERROR: ID not the one given in secondDynamicSink"; + + //now read back and check the returns agains the given values + ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(sourceList)) + << "ERROR: database error"; + bool equal = true; + + std::vector<am_Source_s>::iterator listIterator = sourceList.begin(); + for (; listIterator < sourceList.end(); ++listIterator) + { + if (listIterator->sourceID == staticSourceID) + { + equal = equal && pCF.compareSource(listIterator, staticSource); + } + + if (listIterator->sourceID == firstDynamicSourceID) + { + equal = equal && pCF.compareSource(listIterator, firstDynamicSource); + } + + if (listIterator->sourceID == secondDynamicSourceID) + { + equal = equal && pCF.compareSource(listIterator, secondDynamicSource); + } + pCF.compareSource(listIterator, secondDynamicSource); + + }ASSERT_EQ(true, equal); + + am_Source_s sourceData; + ASSERT_EQ(E_OK, pDatabaseHandler.getSourceInfoDB(secondDynamicSourceID,sourceData)); + ASSERT_TRUE( + (secondDynamicSource.available.availability == sourceData.available.availability) && (secondDynamicSource.available.availabilityReason == sourceData.available.availabilityReason) && (secondDynamicSource.sourceClassID == sourceData.sourceClassID) && (secondDynamicSource.domainID == sourceData.domainID) && (secondDynamicSource.interruptState == sourceData.interruptState) && (secondDynamicSource.visible == sourceData.visible) && (secondDynamicSource.name.compare(sourceData.name) == 0) && (secondDynamicSource.volume == sourceData.volume) && std::equal(secondDynamicSource.listConnectionFormats.begin(), secondDynamicSource.listConnectionFormats.end(), sourceData.listConnectionFormats.begin()) && std::equal(secondDynamicSource.listMainSoundProperties.begin(), secondDynamicSource.listMainSoundProperties.end(), sourceData.listMainSoundProperties.begin(), equalMainSoundProperty)); + +} + TEST_F(databasetest, peekSourceID) { EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1); @@ -260,9 +456,9 @@ TEST_F(databasetest,crossfadersGetFromDomain) sinkB.name = "sinkB"; pCF.createSource(source); ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID)); - source.domainID=domainID; - sinkA.domainID=domainID; - sinkB.domainID=domainID; + source.domainID = domainID; + sinkA.domainID = domainID; + sinkB.domainID = domainID; ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID)); ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sinkA,sinkAID)); @@ -279,7 +475,7 @@ TEST_F(databasetest,crossfadersGetFromDomain) std::vector<am_crossfaderID_t> listCrossfaders; ASSERT_EQ(E_OK, pDatabaseHandler.enterCrossfaderDB(crossfader,crossfaderID)); - ASSERT_EQ(E_OK,pDatabaseHandler.getListCrossfadersOfDomain(source.domainID,listCrossfaders)); + ASSERT_EQ(E_OK, pDatabaseHandler.getListCrossfadersOfDomain(source.domainID,listCrossfaders)); ASSERT_EQ(100, listCrossfaders[0]); } @@ -466,10 +662,8 @@ TEST_F(databasetest, peekSinkDouble) TEST_F(databasetest,changeConnectionTimingInformationCheckMainConnection) { - am_Connection_s connection; std::vector<am_Connection_s> connectionList; std::vector<am_MainConnectionType_s> mainList; - pCF.createConnection(connection); //prepare the test, it is one mainconnection, so we expect one callback createMainConnectionSetup(); @@ -1013,8 +1207,8 @@ TEST_F(databasetest, changeMainConnectionState) std::vector<am_MainConnection_s> listMainConnections; createMainConnectionSetup(); EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1); - ASSERT_EQ(E_OK,pDatabaseHandler.changeMainConnectionStateDB(1,CS_DISCONNECTING)) - << "ERROR: database error";ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(listMainConnections)); + ASSERT_EQ(E_OK, pDatabaseHandler.changeMainConnectionStateDB(1,CS_DISCONNECTING)); + ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(listMainConnections)); ASSERT_EQ(CS_DISCONNECTING, listMainConnections[0].connectionState); } @@ -1064,7 +1258,7 @@ TEST_F(databasetest,changeMainConnectionRoute) am_Connection_s connection; am_Source_s source; am_Sink_s sink; - std::vector<am_Connection_s> connectionList; + std::vector<am_connectionID_t> listConnectionID; EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9); EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9); @@ -1072,13 +1266,13 @@ TEST_F(databasetest,changeMainConnectionRoute) { am_sinkID_t forgetSink; am_sourceID_t forgetSource; - am_connectionID_t forgetConnection; + am_connectionID_t connectionID; - pCF.createConnection(connection); connection.sinkID = i + 20; connection.sourceID = i + 20; connection.delay = -1; - connectionList.push_back(connection); + connection.connectionFormat = CF_ANALOG; + connection.connectionID = 0; pCF.createSink(sink); sink.sinkID = i + 20; @@ -1089,31 +1283,17 @@ TEST_F(databasetest,changeMainConnectionRoute) source.name = "source" + int2string(i + 30); source.domainID = 4; - ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink)) - << "ERROR: database error"; - ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource)) - << "ERROR: database error"; - ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection)) - << "ERROR: database error"; - ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(originalList)) - << "ERROR: database error"; + ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,forgetSink)); + ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,forgetSource)); + ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID)); + listConnectionID.push_back(connectionID); + ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(originalList)); } - //fill the route - std::vector<am_RoutingElement_s> routingList; - pCF.connectionList2RoutingList(routingList, connectionList); - - //create the Route - am_Route_s route; - route.route = routingList; - route.sinkID = 2; - route.sourceID = 2; - - ASSERT_EQ(E_OK, pDatabaseHandler.changeMainConnectionRouteDB(1,route)); - ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(newList)) - << "ERROR: database error";ASSERT_TRUE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),routingList.begin(),equalRoutingElement)); - ASSERT_FALSE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),originalList[0].route.route.begin(),equalRoutingElement)); + ASSERT_EQ(E_OK, pDatabaseHandler.changeMainConnectionRouteDB(1,listConnectionID)); + ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(newList)); + ASSERT_FALSE(std::equal(newList[0].listConnectionID.begin(),newList[0].listConnectionID.end(),originalList[0].listConnectionID.begin())); } TEST_F(databasetest,changeMainSinkVolume) @@ -1227,16 +1407,15 @@ TEST_F(databasetest,getMainSinks) TEST_F(databasetest,getVisibleMainConnections) { createMainConnectionSetup(); - am_MainConnection_s mainConnection; - am_Route_s route; - pCF.createMainConnection(mainConnection, route); - std::vector<am_MainConnectionType_s> visibleMainConnection; - ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(visibleMainConnection)); - ASSERT_TRUE(1==visibleMainConnection[0].mainConnectionID); - ASSERT_TRUE(mainConnection.connectionState==visibleMainConnection[0].connectionState); - ASSERT_TRUE(mainConnection.delay==visibleMainConnection[0].delay); - ASSERT_TRUE(1==visibleMainConnection[0].sinkID); - ASSERT_TRUE(1==visibleMainConnection[0].sourceID); + std::vector<am_MainConnectionType_s> listVisibleMainConnections; + std::vector<am_MainConnection_s> listMainConnections; + ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(listVisibleMainConnections)); + ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(listMainConnections)); + ASSERT_EQ(listMainConnections[0].mainConnectionID, listVisibleMainConnections[0].mainConnectionID); + ASSERT_EQ(listMainConnections[0].connectionState, listVisibleMainConnections[0].connectionState); + ASSERT_EQ(listMainConnections[0].delay, listVisibleMainConnections[0].delay); + ASSERT_EQ(listMainConnections[0].sinkID, listVisibleMainConnections[0].sinkID); + ASSERT_EQ(listMainConnections[0].sourceID, listVisibleMainConnections[0].sourceID); } TEST_F(databasetest,getListSourcesOfDomain) @@ -1,3 +1,9 @@ +commit e124310a45e6e7798a077fa44ef3ee518193b2cf +Author: christian mueller <christian.ei.mueller@bmw.de> + + * modify RoutingSender Async to match with TestHMI + * modify ControlSenderPlugin to have dummy behaviour + commit 2ddacca29eccd4192add2b17ad6af357b52ea29b Author: Frank Herchet <frank.fh.herchet@bmw.de> diff --git a/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp b/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp index 460382f..ec53a82 100644 --- a/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp +++ b/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp @@ -80,6 +80,7 @@ am_Error_e DbusCommandSender::startupInterface(CommandReceiveInterface* commandr assert(mDBusWrapper!=NULL); DBusConnection * connection; mDBusWrapper->getDBusConnection(connection); + assert(connection!=NULL); mDBUSMessageHandler.setDBusConnection(connection); return (E_OK); } diff --git a/PluginControlInterface/include/ControlSender.h b/PluginControlInterface/include/ControlSender.h index bd8d88f..f003222 100644 --- a/PluginControlInterface/include/ControlSender.h +++ b/PluginControlInterface/include/ControlSender.h @@ -132,7 +132,7 @@ private: } bool operator()(const am_MainConnection_s& mainConnection) { - if (mMainConnection.connectionID == mainConnection.connectionID) + if (mMainConnection.mainConnectionID == mainConnection.mainConnectionID) return true; return false; } diff --git a/PluginControlInterface/src/ControlSender.cpp b/PluginControlInterface/src/ControlSender.cpp index 4592459..161d76b 100644 --- a/PluginControlInterface/src/ControlSender.cpp +++ b/PluginControlInterface/src/ControlSender.cpp @@ -72,8 +72,8 @@ void ControlSenderPlugin::hookAllPluginsLoaded() am_Error_e ControlSenderPlugin::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID) { std::vector<am_Route_s> listRoutes; + std::vector<am_connectionID_t> listConnectionIDs; am_Handle_s handle; - am_connectionID_t connectionID; mControlReceiveInterface->getRoute(true, sourceID, sinkID, listRoutes); if (listRoutes.empty()) return E_NOT_POSSIBLE; @@ -82,17 +82,19 @@ am_Error_e ControlSenderPlugin::hookUserConnectionRequest(const am_sourceID_t so std::vector<am_RoutingElement_s>::iterator it(listRoutes[0].route.begin()); for (; it != listRoutes[0].route.end(); ++it) { + am_connectionID_t connectionID; mControlReceiveInterface->connect(handle, connectionID, it->connectionFormat, it->sourceID, it->sinkID); handleStatus status; status.handle = handle; status.status = false; listHandleStaus.push_back(status); + listConnectionIDs.push_back(connectionID); } am_MainConnection_s mainConnectionData; - mainConnectionData.connectionID = 0; + mainConnectionData.mainConnectionID = 0; mainConnectionData.connectionState = CS_CONNECTING; mainConnectionData.delay = 0; - mainConnectionData.route = listRoutes[0]; + mainConnectionData.listConnectionID = listConnectionIDs; mControlReceiveInterface->enterMainConnectionDB(mainConnectionData, mainConnectionID); mainConnectionSet set; set.connectionID = mainConnectionID; @@ -288,13 +290,13 @@ void ControlSenderPlugin::cbAckConnect(const am_Handle_s handle, const am_Error_ { std::vector<handleStatus>::iterator hit; handleStatus status; - status.status=true; - status.handle=handle; + status.status = true; + status.handle = handle; hit = std::find_if(it->listHandleStaus.begin(), it->listHandleStaus.end(), findHandle(status)); if (hit == it->listHandleStaus.end()) continue; - hit->status=true; - if (it->listHandleStaus.end()==std::find_if(it->listHandleStaus.begin(),it->listHandleStaus.end(),checkHandle(status))) + hit->status = true; + if (it->listHandleStaus.end() == std::find_if(it->listHandleStaus.begin(), it->listHandleStaus.end(), checkHandle(status))) { mControlReceiveInterface->changeMainConnectionStateDB(it->connectionID, CS_CONNECTED); mListOpenConnections.erase(it); diff --git a/includes/audiomanagertypes.h b/includes/audiomanagertypes.h index 6c39ad8..e0a6c21 100644 --- a/includes/audiomanagertypes.h +++ b/includes/audiomanagertypes.h @@ -22,8 +22,8 @@ *
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_C4520781_52CF_4636_BE82_37A28F483C93__INCLUDED_)
-#define EA_C4520781_52CF_4636_BE82_37A28F483C93__INCLUDED_
+#if !defined(EA_2D7F1C82_8717_47ce_B755_51DDED15BC18__INCLUDED_)
+#define EA_2D7F1C82_8717_47ce_B755_51DDED15BC18__INCLUDED_
#include <stdint.h>
#include "projecttypes.h"
@@ -124,56 +124,56 @@ namespace am { * After the buildup of a connection the first timing information needs to be sent within 5 seconds, the timing information from the routing adaptors need to be sent via 4 seconds. If the latency for a connection is variable and changes over lifetime of the connection, the routing adaptors shall resend the value and the audiomanger will correct the over all latency.\n * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:00 PM */ typedef uint16_t am_domainID_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:00 PM */ typedef uint16_t am_sourceID_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:00 PM */ typedef uint16_t am_sinkID_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:00 PM */ typedef uint16_t am_gatewayID_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:00 PM */ typedef uint16_t am_crossfaderID_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:00 PM */ typedef uint16_t am_connectionID_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:00 PM */ typedef uint16_t am_mainConnectionID_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ typedef uint16_t am_speed_t; @@ -181,7 +181,7 @@ namespace am { * The unit is 0.1 db steps,The smallest value -3000 (=AM_MUTE). The minimum and maximum can be limited by actual project. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ typedef int16_t am_volume_t; @@ -190,21 +190,21 @@ namespace am { * The range of this type is customer specific. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ typedef int16_t am_mainVolume_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ typedef uint16_t am_sourceClass_t; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ typedef uint16_t am_sinkClass_t; @@ -212,7 +212,7 @@ namespace am { * time in ms! * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ typedef uint16_t am_time_t; @@ -220,7 +220,7 @@ namespace am { * offset time that is introduced in milli seconds. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ typedef int16_t am_timeSync_t; @@ -228,7 +228,7 @@ namespace am { * with the help of this enum, sinks and sources can report their availability state * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_Availablility_e { @@ -243,7 +243,7 @@ namespace am { * represents the connection state * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_ConnectionState_e { @@ -274,7 +274,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_DomainState_e { @@ -289,7 +289,7 @@ namespace am { * This enum characterizes the data of the EarlyData_t * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_EarlyDataType_e { @@ -305,7 +305,7 @@ namespace am { * the errors of the audiomanager. All possible errors are in here. This enum is used widely as return parameter. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_Error_e { @@ -330,7 +330,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_MuteState_e { @@ -344,7 +344,7 @@ namespace am { * The source state reflects the state of the source * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_SourceState_e { @@ -368,7 +368,7 @@ namespace am { * This enumeration is used to define the type of the action that is correlated to a handle. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_Handle_e { @@ -389,7 +389,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:48 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_InterruptState_e { @@ -403,7 +403,7 @@ namespace am { * describes the active sink of a crossfader. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:01 PM */ enum am_HotSink_e { @@ -418,7 +418,7 @@ namespace am { * this describes the availability of a sink or a source together with the latest change * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:01 PM */ struct am_Availability_s { @@ -438,7 +438,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:01 PM */ struct am_ClassProperty_s { @@ -452,7 +452,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:01 PM */ struct am_Crossfader_s { @@ -470,7 +470,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:01 PM */ struct am_Gateway_s { @@ -511,7 +511,7 @@ namespace am { * This represents one "hopp" in a route * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:01 PM */ struct am_RoutingElement_s { @@ -527,7 +527,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:02 PM */ struct am_Route_s { @@ -542,7 +542,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:02 PM */ struct am_SoundProperty_s { @@ -556,7 +556,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:49 PM + * @created 10-Feb-2012 1:31:02 PM */ struct am_SystemProperty_s { @@ -576,7 +576,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:50 PM + * @created 10-Feb-2012 1:31:02 PM */ struct am_SinkClass_s { @@ -591,7 +591,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:50 PM + * @created 10-Feb-2012 1:31:02 PM */ struct am_SourceClass_s { @@ -610,7 +610,7 @@ namespace am { * this type holds all information of sources relevant to the HMI * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:50 PM + * @created 10-Feb-2012 1:31:02 PM */ struct am_SourceType_s { @@ -627,7 +627,7 @@ namespace am { * this type holds all information of sinks relevant to the HMI * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:50 PM + * @created 10-Feb-2012 1:31:02 PM */ struct am_SinkType_s { @@ -645,7 +645,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:50 PM + * @created 10-Feb-2012 1:31:03 PM */ struct am_Handle_s { @@ -659,7 +659,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:50 PM + * @created 10-Feb-2012 1:31:03 PM */ struct am_MainSoundProperty_s { @@ -674,7 +674,7 @@ namespace am { * this type holds all information of connections relevant to the HMI * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:50 PM + * @created 10-Feb-2012 1:31:03 PM */ struct am_MainConnectionType_s { @@ -691,23 +691,31 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:50 PM + * @created 10-Feb-2012 1:31:03 PM */ struct am_MainConnection_s { public: - am_mainConnectionID_t connectionID; + am_mainConnectionID_t mainConnectionID; am_ConnectionState_e connectionState; - am_Route_s route; + /** + * the sinkID + */ + am_sinkID_t sinkID; + /** + * the sourceID + */ + am_sourceID_t sourceID; am_timeSync_t delay; + std::vector<am_connectionID_t> listConnectionID; }; /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:51 PM + * @created 10-Feb-2012 1:31:03 PM */ struct am_Sink_s { @@ -731,7 +739,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:51 PM + * @created 10-Feb-2012 1:31:03 PM */ struct am_Source_s { @@ -764,7 +772,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:51 PM + * @created 10-Feb-2012 1:31:03 PM */ struct am_Domain_s { @@ -783,7 +791,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:51 PM + * @created 10-Feb-2012 1:31:04 PM */ struct am_Connection_s { @@ -803,7 +811,7 @@ namespace am { * soundProperty_t in case of ED_SOURCE_PROPERTY, ED_SINK_PROPERTY * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:51 PM + * @created 10-Feb-2012 1:31:04 PM */ union am_EarlyData_u { @@ -820,7 +828,7 @@ namespace am { * sinkID in case of ED_SINK_VOLUME, ED_SINK_PROPERTY * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:51 PM + * @created 10-Feb-2012 1:31:04 PM */ union am_DataType_u { @@ -834,7 +842,7 @@ namespace am { /** * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:51 PM + * @created 10-Feb-2012 1:31:04 PM */ struct am_EarlyData_s { @@ -846,4 +854,4 @@ namespace am { }; } -#endif // !defined(EA_C4520781_52CF_4636_BE82_37A28F483C93__INCLUDED_) +#endif // !defined(EA_2D7F1C82_8717_47ce_B755_51DDED15BC18__INCLUDED_) diff --git a/includes/command/CommandReceiveInterface.h b/includes/command/CommandReceiveInterface.h index 20e4455..257d5d9 100644 --- a/includes/command/CommandReceiveInterface.h +++ b/includes/command/CommandReceiveInterface.h @@ -22,8 +22,8 @@ *
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_6FE1E594_3CEA_4eaa_BAD0_7BB39D3150D2__INCLUDED_)
-#define EA_6FE1E594_3CEA_4eaa_BAD0_7BB39D3150D2__INCLUDED_
+#if !defined(EA_C6A85AF3_95A7_4c37_90ED_CA847BA7F31D__INCLUDED_)
+#define EA_C6A85AF3_95A7_4c37_90ED_CA847BA7F31D__INCLUDED_
#include <vector>
#include <string>
@@ -40,7 +40,7 @@ namespace am { * The interface towards the Controlling Instance (e.g HMI). It handles the communication towards the HMI and other system components who need to interact with the audiomanagement. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:52 PM + * @created 10-Feb-2012 1:31:04 PM */ class CommandReceiveInterface { @@ -204,4 +204,4 @@ namespace am { }; } -#endif // !defined(EA_6FE1E594_3CEA_4eaa_BAD0_7BB39D3150D2__INCLUDED_) +#endif // !defined(EA_C6A85AF3_95A7_4c37_90ED_CA847BA7F31D__INCLUDED_) diff --git a/includes/command/CommandSendInterface.h b/includes/command/CommandSendInterface.h index f1ec602..bd970d0 100644 --- a/includes/command/CommandSendInterface.h +++ b/includes/command/CommandSendInterface.h @@ -22,8 +22,8 @@ *
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_B298DDFD_7AC9_4a18_BB8C_595921C525B6__INCLUDED_)
-#define EA_B298DDFD_7AC9_4a18_BB8C_595921C525B6__INCLUDED_
+#if !defined(EA_1EBB5273_A222_43b8_B7C9_435405DF9AA2__INCLUDED_)
+#define EA_1EBB5273_A222_43b8_B7C9_435405DF9AA2__INCLUDED_
#include <vector>
#include <string>
@@ -41,7 +41,7 @@ namespace am { * This interface handles all communication from the AudioManagerDaemon towards the system. It is designed in such a way that only callbacks with no return types are implemented. So when the CommandInterfacePlugins are designed in such a way that they broadcast signals to any node who is interested in the particular information (like signals on Dbus for example), more information can be retrieved via the CommandReceiveInterface. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:52 PM + * @created 10-Feb-2012 1:31:05 PM */ class CommandSendInterface { @@ -165,4 +165,4 @@ namespace am { }; } -#endif // !defined(EA_B298DDFD_7AC9_4a18_BB8C_595921C525B6__INCLUDED_) +#endif // !defined(EA_1EBB5273_A222_43b8_B7C9_435405DF9AA2__INCLUDED_) diff --git a/includes/control/ControlReceiveInterface.h b/includes/control/ControlReceiveInterface.h index 4a2334c..d01327b 100644 --- a/includes/control/ControlReceiveInterface.h +++ b/includes/control/ControlReceiveInterface.h @@ -22,8 +22,8 @@ *
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_9550F257_23AE_4781_B149_0E4B3A9889AC__INCLUDED_)
-#define EA_9550F257_23AE_4781_B149_0E4B3A9889AC__INCLUDED_
+#if !defined(EA_C0D10ABE_48CA_4a18_9932_CB970D9C3723__INCLUDED_)
+#define EA_C0D10ABE_48CA_4a18_9932_CB970D9C3723__INCLUDED_
#include <vector>
#include <string>
@@ -39,7 +39,7 @@ namespace am { * This interface gives access to all important functions of the audiomanager that are used by the AudioManagerController to control the system. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:52 PM + * @created 10-Feb-2012 1:31:05 PM */ class ControlReceiveInterface { @@ -278,9 +278,9 @@ namespace am { * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if mainconnection * * @param mainconnectionID - * @param route + * @param listConnectionID */ - virtual am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s& route) =0; + virtual am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID) =0; /** * changes the mainConnectionState of MainConnection
* @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if mainconnection @@ -425,6 +425,22 @@ namespace am { */ virtual am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const =0; /** + * returns the sinkData of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found + * + * @param sinkID + * @param sinkData + */ + virtual am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s& sinkData) const =0; + /** + * returns the sourcekData of a source
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was not found + * + * @param sourceID + * @param sourceData + */ + virtual am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const =0; + /** * return source and sink of a gateway
* @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if gateway was not found * @@ -441,6 +457,14 @@ namespace am { */ virtual am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const =0; /** + * returns sources and the sink of a crossfader
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if crossfader was not found + * + * @param mainConnectionID + * @param mainConnectionData + */ + virtual am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const =0; + /** * returns all sinks of a domain
* @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain was not found * @@ -570,4 +594,4 @@ namespace am { }; } -#endif // !defined(EA_9550F257_23AE_4781_B149_0E4B3A9889AC__INCLUDED_) +#endif // !defined(EA_C0D10ABE_48CA_4a18_9932_CB970D9C3723__INCLUDED_) diff --git a/includes/control/ControlSendInterface.h b/includes/control/ControlSendInterface.h index 401d176..2d49593 100644 --- a/includes/control/ControlSendInterface.h +++ b/includes/control/ControlSendInterface.h @@ -22,8 +22,8 @@ *
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_7C94464D_AE95_434a_A108_201C19F97A85__INCLUDED_)
-#define EA_7C94464D_AE95_434a_A108_201C19F97A85__INCLUDED_
+#if !defined(EA_F931365D_53A0_4830_8B3E_29C95C767ADC__INCLUDED_)
+#define EA_F931365D_53A0_4830_8B3E_29C95C767ADC__INCLUDED_
#include <vector>
#include <string>
@@ -40,7 +40,7 @@ namespace am { * All the hooks represent system events that need to be handled. The callback functions are used to handle for example answers to function calls on the AudioManagerCoreInterface. * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:53 PM + * @created 10-Feb-2012 1:31:06 PM */ class ControlSendInterface { @@ -367,4 +367,4 @@ namespace am { }; } -#endif // !defined(EA_7C94464D_AE95_434a_A108_201C19F97A85__INCLUDED_) +#endif // !defined(EA_F931365D_53A0_4830_8B3E_29C95C767ADC__INCLUDED_) diff --git a/includes/routing/RoutingReceiveInterface.h b/includes/routing/RoutingReceiveInterface.h index c2438a9..00e4666 100644 --- a/includes/routing/RoutingReceiveInterface.h +++ b/includes/routing/RoutingReceiveInterface.h @@ -22,8 +22,8 @@ *
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_21C9D5F3_73BF_4121_9A14_1D76799A05A0__INCLUDED_)
-#define EA_21C9D5F3_73BF_4121_9A14_1D76799A05A0__INCLUDED_
+#if !defined(EA_C1FDE688_5CB0_42b2_B2CC_C407D50C2D87__INCLUDED_)
+#define EA_C1FDE688_5CB0_42b2_B2CC_C407D50C2D87__INCLUDED_
#include <vector>
#include <string>
@@ -41,7 +41,7 @@ namespace am { * Routing Receive sendInterface description. This class implements everything from RoutingAdapter -> Audiomanager * @author christian * @version 1.0 - * @created 01-Feb-2012 9:42:02 AM + * @created 10-Feb-2012 1:31:06 PM */ class RoutingReceiveInterface { @@ -248,7 +248,7 @@ namespace am { virtual am_Error_e deregisterCrossfader(const am_crossfaderID_t crossfaderID) =0; /** * this function peeks a sourceclassID. It is used by the RoutingPlugins to determine the SinkClassIDs of a sinkClass.
- * @return E_OK on succes, E_DATABASE_ERROR on error, E_NON_EXISTENT if no sourceclass with name is registered + * @return E_OK on succes, E_DATABASE_ERROR on error * * @param name * @param sourceClassID @@ -256,7 +256,7 @@ namespace am { virtual am_Error_e peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID) =0; /** * this function peeks a sourceclassID. It is used by the RoutingPlugins to determine the SinkClassIDs of a sinkClass.
- * @return E_OK on succes, E_DATABASE_ERROR on error, E_NON_EXISTENT if no sourceclass with name is registered + * @return E_OK on succes, E_DATABASE_ERROR on error * * @param name * @param sinkClassID @@ -305,7 +305,8 @@ namespace am { */ virtual void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay) =0; /** - * this function is used to send out all data that has been changed in an early state. + * this function is used to send out all data that has been changed in an early state.
+ * @return E_OK on success, E_UNKNOWN on error * * @param earlyData */ @@ -331,4 +332,4 @@ namespace am { }; } -#endif // !defined(EA_21C9D5F3_73BF_4121_9A14_1D76799A05A0__INCLUDED_) +#endif // !defined(EA_C1FDE688_5CB0_42b2_B2CC_C407D50C2D87__INCLUDED_) diff --git a/includes/routing/RoutingSendInterface.h b/includes/routing/RoutingSendInterface.h index 6c73d4e..35c07cd 100644 --- a/includes/routing/RoutingSendInterface.h +++ b/includes/routing/RoutingSendInterface.h @@ -22,8 +22,8 @@ *
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_A00AD21A_AC6F_456e_B4DC_9C6AF4F44C3D__INCLUDED_)
-#define EA_A00AD21A_AC6F_456e_B4DC_9C6AF4F44C3D__INCLUDED_
+#if !defined(EA_E1ED14D4_6A57_4661_8587_FA302E2A9951__INCLUDED_)
+#define EA_E1ED14D4_6A57_4661_8587_FA302E2A9951__INCLUDED_
#include <vector>
#include <string>
@@ -41,7 +41,7 @@ namespace am { * This class implements everything from Audiomanager -> RoutingAdapter * @author christian * @version 1.0 - * @created 01-Feb-2012 9:42:02 AM + * @created 10-Feb-2012 1:31:06 PM */ class RoutingSendInterface { @@ -196,4 +196,4 @@ namespace am { }; } -#endif // !defined(EA_A00AD21A_AC6F_456e_B4DC_9C6AF4F44C3D__INCLUDED_) +#endif // !defined(EA_E1ED14D4_6A57_4661_8587_FA302E2A9951__INCLUDED_) |