summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Donchev <Aleksander.Donchev@partner.bmw.de>2014-08-26 18:15:19 +0200
committerChristian Linke <christian.linke@bmw.de>2014-11-05 18:35:35 +0100
commit57c2f4ea0148287d0bcea913cb34ba716489df4b (patch)
tree0aa026a28c4f4f2d727da882b0bee03cc671cb28
parentafadaf4260e8d436b454289e61e85ac8c5bab071 (diff)
downloadaudiomanager-57c2f4ea0148287d0bcea913cb34ba716489df4b.tar.gz
* Converter Implementation .6.2
Signed-off-by: Christian Linke <christian.linke@bmw.de>
-rw-r--r--AudioManagerDaemon/CMakeLists.txt2
-rw-r--r--AudioManagerDaemon/docx/03_architecture_overview.dox6
-rw-r--r--AudioManagerDaemon/fidls/AudioManagerTypes.fidl55
-rw-r--r--AudioManagerDaemon/include/CAmControlReceiver.h6
-rw-r--r--AudioManagerDaemon/include/CAmControlSender.h3
-rw-r--r--AudioManagerDaemon/include/CAmDatabaseHandlerMap.h36
-rw-r--r--AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h18
-rw-r--r--AudioManagerDaemon/include/CAmDatabaseObserver.h2
-rw-r--r--AudioManagerDaemon/include/CAmGraph.h622
-rw-r--r--AudioManagerDaemon/include/CAmRouter.h298
-rw-r--r--AudioManagerDaemon/include/CAmRoutingReceiver.h3
-rw-r--r--AudioManagerDaemon/include/IAmDatabaseHandler.h17
-rw-r--r--AudioManagerDaemon/src/CAmControlReceiver.cpp32
-rw-r--r--AudioManagerDaemon/src/CAmControlSender.cpp18
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp270
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp1085
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseObserver.cpp12
-rw-r--r--AudioManagerDaemon/src/CAmRouter.cpp1114
-rw-r--r--AudioManagerDaemon/src/CAmRoutingReceiver.cpp15
-rw-r--r--AudioManagerDaemon/src/CAmRoutingSender.cpp16
-rw-r--r--AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp209
-rw-r--r--AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp251
-rw-r--r--AudioManagerDaemon/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp4
-rw-r--r--AudioManagerDaemon/test/AmMapHandlerTest/MockDatabaseObserver.h4
-rw-r--r--AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp1122
-rw-r--r--AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.h24
-rw-r--r--AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt2
-rw-r--r--AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp7
-rw-r--r--AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt2
-rw-r--r--AudioManagerDaemon/test/CAmCommonFunctions.cpp23
-rw-r--r--AudioManagerDaemon/test/CAmCommonFunctions.h3
-rw-r--r--AudioManagerDaemon/test/MockIAmControlSend.h6
-rw-r--r--PluginControlInterface/include/CAmControlSenderBase.h3
-rw-r--r--PluginControlInterface/src/CAmControlSenderBase.cpp20
-rw-r--r--PluginControlInterface/test/MockIAmControlReceive.h382
-rw-r--r--PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h197
-rwxr-xr-xPluginRoutingInterfaceCAPI/fidl/RoutingInterface.fidl61
-rw-r--r--PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCommon.h1
-rw-r--r--PluginRoutingInterfaceCAPI/include/CAmRoutingService.h6
-rw-r--r--PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp12
-rw-r--r--PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp23
-rw-r--r--PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp105
-rw-r--r--PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h6
-rw-r--r--PluginRoutingInterfaceDbus/include/CAmDbusMessageHandler.h1
-rw-r--r--PluginRoutingInterfaceDbus/include/IAmRoutingReceiverShadow.h3
-rw-r--r--PluginRoutingInterfaceDbus/include/RoutingReceiver.xml15
-rw-r--r--PluginRoutingInterfaceDbus/src/CAmDbusMessageHandler.cpp45
-rw-r--r--PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp52
-rwxr-xr-xinclude/audiomanagertypes.h2840
-rwxr-xr-xinclude/command/IAmCommandReceive.h440
-rwxr-xr-xinclude/command/IAmCommandSend.h389
-rwxr-xr-xinclude/control/IAmControlReceive.h1278
-rwxr-xr-xinclude/control/IAmControlSend.h732
-rwxr-xr-xinclude/routing/IAmRoutingReceive.h645
-rwxr-xr-xinclude/routing/IAmRoutingSend.h369
55 files changed, 8585 insertions, 4327 deletions
diff --git a/AudioManagerDaemon/CMakeLists.txt b/AudioManagerDaemon/CMakeLists.txt
index 438c263..e263aea 100644
--- a/AudioManagerDaemon/CMakeLists.txt
+++ b/AudioManagerDaemon/CMakeLists.txt
@@ -163,7 +163,7 @@ IF(WITH_NSM)
# The ALT_DESTINATION is used as fall back if the DESTINATION directory dosen't contain the sources or you just don't want to use the generator.
INCLUDE(CommonAPIGenerator)
COMMON_API_GENERATE_SOUCRES(TARGET COMMON_API
- FIDLS fidls/NodeStateManager.fidl # a list with fidls
+ FIDLS fidls/NodeStateManager.fdepl # a list with fidls
DESTINATION src-gen # a relative path to the build directory or an absolute path
ALT_DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/src-gen # an alternative relative/absolute path with common-api sources, usually in the source tree
DBUS)
diff --git a/AudioManagerDaemon/docx/03_architecture_overview.dox b/AudioManagerDaemon/docx/03_architecture_overview.dox
index 230a99a..c38bb60 100644
--- a/AudioManagerDaemon/docx/03_architecture_overview.dox
+++ b/AudioManagerDaemon/docx/03_architecture_overview.dox
@@ -76,4 +76,10 @@ For every gateway, a controlDomain is defined, this is the domain that registere
the "other end" of the gateway might be unknown. To handle this situation, a domain can "peek" Domains, Sources and Sinks. When
something is peeked, it means that an ID is reserved for a unique name without registering it.\n
If a gateway is deregistered, the source or sink of the controlling domain is deregistered as well - not the one in the "other" domain.
+
+\section converter Converter
+
+Converters are very similar to gateways - the only difference is that they work inside a domain. The usage of gateways is analog to
+gateways.
+
*/
diff --git a/AudioManagerDaemon/fidls/AudioManagerTypes.fidl b/AudioManagerDaemon/fidls/AudioManagerTypes.fidl
index bdfed45..956b400 100644
--- a/AudioManagerDaemon/fidls/AudioManagerTypes.fidl
+++ b/AudioManagerDaemon/fidls/AudioManagerTypes.fidl
@@ -54,7 +54,12 @@ typeCollection am {
<**
@description : a gateway ID
**>
- typedef am_gatewayID_t is UInt16
+ typedef am_gatewayID_t is UInt16
+
+ <**
+ @description : a converter ID
+ **>
+ typedef am_converterID_t is UInt16
<**
@description : a connection ID
@@ -634,6 +639,54 @@ The data is stored row orientated, where the rows are related to the sinksFormat
**>
am_Convertion_L convertionMatrix
}
+
+<**
+ @description : This struct describes the attributes of a gateway.
+ **>
+ struct am_Converter_s {
+
+ <**
+ @description : This is the ID of the gateway, it is unique in the system. There are 2 ways, ID can be created: either it is assigned during the registration process (in a dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it is a fixed (the project has to ensure the uniqueness of the ID).
+ **>
+ am_converterID_t converterID
+
+ <**
+ @description : The name of the gateway. Must be unique in the whole system.
+ **>
+ String name
+
+ <**
+ @description : The sinkID of the gateway sink-end. The sink is a full blown sink with connectionFormats, sinkClassIDs etc... It makes sense to register the sinks of a gateway as non-visible. Care needs to be taken that the connectionsFormats match with the ones in the conversionMatrix. If the sink is located in the controllingDomain, the ID needs to be retrieved by registering the sink before registering the gateway. In case the sink is in a different domain, the ID needs to be retrieved via peeking.
+ **>
+ am_sinkID_t sinkID
+
+ <**
+ @description : The sourceID of the gateway sink-end. The sink is a full blown source with connectionFormats, sinkClassIDs etc... It makes sense to register the sources of a gateway as non-visible. Care needs to be taken that the connectionsFormats match with the ones in the conversionMatrix. If the source is located in the controllingDomain, the ID needs to be retrieved by registering the source before registering the gateway. In case the source is in a different domain, the ID needs to be retrieved via peeking.
+ **>
+ am_sourceID_t sourceID
+
+ <**
+ @description : The ID of the sink. If the domain is the same like the controlling domain, the ID is known due to registration. If the domain is different, the ID needs to be retrieved via peeking.
+ **>
+ am_domainID_t domainID
+
+ <**
+ @description : This is the list of available formats on the source side of the gateway. It is not defined during the gateway registration but copied from the source registration.
+ **>
+ am_ConnectionFormat_L listSourceFormats
+
+ <**
+ @description : This is the list of available formats on the sink side of the gateway. It is not defined during the gateway registration but copied from the sink registration.
+ **>
+ am_ConnectionFormat_L listSinkFormats
+
+ <**
+ @description : This is matrix holding information about the conversion capability of the gateway, it's length is defined by the length(listSinkFormats) x length(listSourceFormats).
+If a SinkFormat can be converted into a SourceFormat, the vector will hold a 1, if no conversion is possible, a 0.
+The data is stored row orientated, where the rows are related to the sinksFormats and the columns to the sourceFormats. The first value will hold the conversion information from the first sourceFormat to the first sinkFormat for example and the seventh value the information about the 3rd sinkFormat to the 1st sourceFormat in case we would have 3 sourceFormats.
+ **>
+ am_Convertion_L convertionMatrix
+ }
<**
@description : This represents one "hopp" in a route
diff --git a/AudioManagerDaemon/include/CAmControlReceiver.h b/AudioManagerDaemon/include/CAmControlReceiver.h
index 9487d17..b0a9d1a 100644
--- a/AudioManagerDaemon/include/CAmControlReceiver.h
+++ b/AudioManagerDaemon/include/CAmControlReceiver.h
@@ -61,6 +61,7 @@ public:
am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e enterConverterDB(const am_Converter_s & converterData, am_converterID_t & converterID);
am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID);
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);
@@ -81,6 +82,7 @@ public:
am_Error_e removeSinkDB(const am_sinkID_t sinkID);
am_Error_e removeSourceDB(const am_sourceID_t sourceID);
am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID);
+ am_Error_e removeConverterDB(const am_converterID_t converterID);
am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID);
am_Error_e removeDomainDB(const am_domainID_t domainID);
am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
@@ -90,12 +92,14 @@ public:
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 getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) 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>& listCrossfadersID) const;
am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const;
+ am_Error_e getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConverterID) const;
am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const;
am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const;
am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const;
@@ -105,6 +109,7 @@ public:
am_Error_e getListHandles(std::vector<am_Handle_s>& listHandles) const;
am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const;
am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const;
+ am_Error_e getListConverters(std::vector<am_Converter_s>& listConverters) const;
am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
void setCommandReady();
@@ -118,6 +123,7 @@ public:
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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
am_Error_e changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) ;
+ 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 setVolumes(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes) ;
am_Error_e setSinkNotificationConfiguration(am_Handle_s& handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) ;
am_Error_e setSourceNotificationConfiguration(am_Handle_s& handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) ;
diff --git a/AudioManagerDaemon/include/CAmControlSender.h b/AudioManagerDaemon/include/CAmControlSender.h
index 58bae0b..fb82484 100644
--- a/AudioManagerDaemon/include/CAmControlSender.h
+++ b/AudioManagerDaemon/include/CAmControlSender.h
@@ -61,7 +61,9 @@ public:
am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) ;
am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID) ;
am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
+ am_Error_e hookSystemRegisterConverter(const am_Converter_s& converterData, am_converterID_t& converterID);
am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID) ;
+ am_Error_e hookSystemDeregisterConverter(const am_converterID_t converterID) ;
am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID) ;
void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) ;
@@ -92,6 +94,7 @@ public:
am_Error_e hookSystemUpdateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
am_Error_e hookSystemUpdateSource(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
am_Error_e hookSystemUpdateGateway(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFromats, const std::vector<bool>& convertionMatrix) ;
+ am_Error_e hookSystemUpdateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFromats, const std::vector<bool>& convertionMatrix);
void cbAckSetVolume(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error) ;
void cbAckSetSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) ;
void cbAckSetSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) ;
diff --git a/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h b/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h
index 0793bf8..0c97185 100644
--- a/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h
+++ b/AudioManagerDaemon/include/CAmDatabaseHandlerMap.h
@@ -27,7 +27,9 @@
#include <sstream>
#include <iostream>
#include <unordered_map>
+#include <algorithm>
#include <assert.h>
+#include <vector>
#include "IAmDatabaseHandler.h"
namespace am
@@ -62,6 +64,7 @@ class CAmDatabaseHandlerMap : public IAmDatabaseHandler
bool mFirstStaticSink; //!< bool for dynamic range handling
bool mFirstStaticSource; //!< bool for dynamic range handling
bool mFirstStaticGateway; //!< bool for dynamic range handling
+ bool mFirstStaticConverter; //!< bool for dynamic range handling
bool mFirstStaticSinkClass; //!< bool for dynamic range handling
bool mFirstStaticSourceClass; //!< bool for dynamic range handling
bool mFirstStaticCrossfader; //!< bool for dynamic range handling
@@ -74,6 +77,7 @@ public:
am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e enterConverterDB(const am_Converter_s & converterData, am_converterID_t & converterID);
am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID);
am_Error_e enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID);
am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID);
@@ -104,6 +108,7 @@ public:
am_Error_e removeSinkDB(const am_sinkID_t sinkID);
am_Error_e removeSourceDB(const am_sourceID_t sourceID);
am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID);
+ am_Error_e removeConverterDB(const am_converterID_t converterID);
am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID);
am_Error_e removeDomainDB(const am_domainID_t domainID);
am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
@@ -112,6 +117,7 @@ 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 getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) 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;
@@ -124,6 +130,7 @@ public:
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;
am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const;
+ am_Error_e getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConvertersID) const;
am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const;
am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const;
am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const;
@@ -132,6 +139,7 @@ public:
am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const;
am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const;
+ am_Error_e getListConverters(std::vector<am_Converter_s> & listConverters) const;
am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
am_Error_e getListVisibleMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const;
am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const;
@@ -147,7 +155,6 @@ public:
am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const;
am_Error_e getSoureState(const am_sourceID_t sourceID, am_SourceState_e& sourceState) const;
am_Error_e getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const;
- am_Error_e getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree);
am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
@@ -160,11 +167,12 @@ public:
am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration);
am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration);
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);
+ 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 changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID,const am_NotificationConfiguration_s notificationConfiguration);
am_Error_e changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID,const am_NotificationConfiguration_s notificationConfiguration);
bool existMainConnection(const am_mainConnectionID_t mainConnectionID) const;
- bool existcrossFader(const am_crossfaderID_t crossfaderID) const;
+ bool existCrossFader(const am_crossfaderID_t crossfaderID) const;
bool existConnection(const am_Connection_s & connection) const;
bool existConnectionID(const am_connectionID_t connectionID) const;
bool existSource(const am_sourceID_t sourceID) const;
@@ -175,13 +183,19 @@ public:
bool existSinkName(const std::string& name) const;
bool existDomain(const am_domainID_t domainID) const;
bool existGateway(const am_gatewayID_t gatewayID) const;
+ bool existConverter(const am_converterID_t converterID) const;
bool existSinkClass(const am_sinkClass_t sinkClassID) const;
bool existSourceClass(const am_sourceClass_t sourceClassID) const;
void registerObserver(CAmDatabaseObserver *iObserver);
bool sourceVisible(const am_sourceID_t sourceID) const;
bool sinkVisible(const am_sinkID_t sinkID) const;
-
+ bool isComponentConnected(const am_Gateway_s & gateway) const;
+ bool isComponentConnected(const am_Converter_s & converter) const;
void dump( std::ostream & output ) const;
+ am_Error_e enumerateSources(std::function<void(const am_Source_s & element)> cb) const;
+ am_Error_e enumerateSinks(std::function<void(const am_Sink_s & element)> cb) const;
+ am_Error_e enumerateGateways(std::function<void(const am_Gateway_s & element)> cb) const;
+ am_Error_e enumerateConverters(std::function<void(const am_Converter_s & element)> cb) const;
/**
* The following structures extend the base structures with the field 'reserved'.
*/
@@ -260,6 +274,9 @@ public:
AM_TYPEDEF_SUBCLASS_BEGIN(am_Gateway_Database_s, am_Gateway_s)
AM_TYPEDEF_SUBCLASS_END(CAmGateway)
+ AM_TYPEDEF_SUBCLASS_BEGIN(am_Converter_Database_s, am_Converter_s)
+ AM_TYPEDEF_SUBCLASS_END(CAmConverter)
+
AM_TYPEDEF_SUBCLASS_BEGIN(am_Crossfader_Database_s, am_Crossfader_s)
AM_TYPEDEF_SUBCLASS_END(CAmCrossfader)
@@ -270,6 +287,7 @@ public:
typedef std::unordered_map<am_sinkID_t, CAmSink> CAmMapSink;
typedef std::unordered_map<am_sourceID_t, CAmSource> CAmMapSource;
typedef std::unordered_map<am_gatewayID_t, CAmGateway> CAmMapGateway;
+ typedef std::unordered_map<am_converterID_t, CAmConverter> CAmMapConverter;
typedef std::unordered_map<am_crossfaderID_t, CAmCrossfader> CAmMapCrossfader;
typedef std::unordered_map<am_connectionID_t, CAmConnection> CAmMapConnection;
typedef std::unordered_map<am_mainConnectionID_t, CAmMainConnection> CAmMapMainConnection;
@@ -303,6 +321,7 @@ public:
am_Identifier_s mCurrentSinkID; //!< sink ID
am_Identifier_s mCurrentSourceID; //!< source ID
am_Identifier_s mCurrentGatewayID; //!< gateway ID
+ am_Identifier_s mCurrentConverterID; //!< converter ID
am_Identifier_s mCurrentCrossfaderID; //!< crossfader ID
am_Identifier_s mCurrentConnectionID; //!< connection ID
am_Identifier_s mCurrentMainConnectionID; //!< mainconnection ID
@@ -314,6 +333,7 @@ public:
CAmMapSink mSinkMap; //!< map for sink structures
CAmMapSource mSourceMap; //!< map for source structures
CAmMapGateway mGatewayMap; //!< map for gateway structures
+ CAmMapConverter mConverterMap; //!< map for converter structures
CAmMapCrossfader mCrossfaderMap; //!< map for crossfader structures
CAmMapConnection mConnectionMap; //!< map for connection structures
CAmMapMainConnection mMainConnectionMap; //!< map for main connection structures
@@ -325,13 +345,14 @@ public:
mCurrentSinkID(DYNAMIC_ID_BOUNDARY, SHRT_MAX),
mCurrentSourceID(DYNAMIC_ID_BOUNDARY, SHRT_MAX),
mCurrentGatewayID(DYNAMIC_ID_BOUNDARY, SHRT_MAX),
+ mCurrentConverterID(DYNAMIC_ID_BOUNDARY, SHRT_MAX),
mCurrentCrossfaderID(DYNAMIC_ID_BOUNDARY, SHRT_MAX),
mCurrentConnectionID(1, AM_MAX_CONNECTIONS),
mCurrentMainConnectionID(1, AM_MAX_MAIN_CONNECTIONS),
mSystemProperties(),
mDomainMap(),mSourceClassesMap(), mSinkClassesMap(), mSinkMap(AM_MAP_CAPACITY), mSourceMap(AM_MAP_CAPACITY),
- mGatewayMap(), mCrossfaderMap(), mConnectionMap(), mMainConnectionMap()
+ mGatewayMap(), mConverterMap(), mCrossfaderMap(), mConnectionMap(), mMainConnectionMap()
{};
/**
* \brief Increases a given map ID.
@@ -386,11 +407,18 @@ public:
bool insertSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID);
bool insertCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID);
bool insertGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID);
+ bool insertConverterDB(const am_Converter_s & converteData, am_converterID_t & converterID);
bool insertSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID);
bool insertSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID);
bool insertSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass);
const am_Sink_Database_s * sinkWithNameOrID(const am_sinkID_t sinkID, const std::string & name) const;
const am_Source_Database_s * sourceWithNameOrID(const am_sourceID_t sourceID, const std::string & name) const;
+ template <class Component> bool isConnected(const Component & comp) const
+ {
+ return std::find_if(mMappedData.mConnectionMap.begin(), mMappedData.mConnectionMap.end(),[&](const std::pair<am_connectionID_t, am_Connection_Database_s>& rConnection){
+ return (rConnection.second.sinkID == comp.sinkID ||rConnection.second.sourceID ==comp.sourceID);})!=mMappedData.mConnectionMap.end();
+ }
+
CAmDatabaseObserver *mpDatabaseObserver; //!< pointer to the Observer
ListConnectionFormat mListConnectionFormat; //!< list of connection formats
diff --git a/AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h b/AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h
index fad2e57..b53bd7f 100644
--- a/AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h
+++ b/AudioManagerDaemon/include/CAmDatabaseHandlerSQLite.h
@@ -53,6 +53,7 @@ private:
bool mFirstStaticSink; //!< bool for dynamic range handling
bool mFirstStaticSource; //!< bool for dynamic range handling
bool mFirstStaticGateway; //!< bool for dynamic range handling
+ bool mFirstStaticConverter; //!< bool for dynamic range handling
bool mFirstStaticSinkClass; //!< bool for dynamic range handling
bool mFirstStaticSourceClass; //!< bool for dynamic range handling
bool mFirstStaticCrossfader; //!< bool for dynamic range handling
@@ -71,6 +72,7 @@ public:
am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e enterConverterDB(const am_Converter_s & converteData, am_converterID_t & converterID);
am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID);
am_Error_e enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID);
am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID);
@@ -101,6 +103,7 @@ public:
am_Error_e removeSinkDB(const am_sinkID_t sinkID);
am_Error_e removeSourceDB(const am_sourceID_t sourceID);
am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID);
+ am_Error_e removeConverterDB(const am_converterID_t converterID);
am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID);
am_Error_e removeDomainDB(const am_domainID_t domainID);
am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
@@ -109,6 +112,7 @@ 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 getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) 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;
@@ -121,6 +125,7 @@ public:
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;
am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const;
+ am_Error_e getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConvertersID) const;
am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const;
am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const;
am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const;
@@ -129,6 +134,7 @@ public:
am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const;
am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const;
+ am_Error_e getListConverters(std::vector<am_Converter_s> & listConverters) const;
am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
am_Error_e getListVisibleMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const;
am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const;
@@ -139,12 +145,12 @@ public:
am_Error_e getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_CustomAvailabilityReason_t> & listConnectionFormats) const;
am_Error_e getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_CustomAvailabilityReason_t> & listConnectionFormats) const;
am_Error_e getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const;
+ am_Error_e getListConverterConnectionFormats(const am_converterID_t converterID, std::vector<bool> & listConnectionFormat) const;
am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const;
am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t& domainID) const;
am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const;
am_Error_e getSoureState(const am_sourceID_t sourceID, am_SourceState_e& sourceState) const;
am_Error_e getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const;
- am_Error_e getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree);
am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
@@ -157,11 +163,12 @@ public:
am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration);
am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration);
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);
+ 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 changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID,const am_NotificationConfiguration_s notificationConfiguration);
am_Error_e changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID,const am_NotificationConfiguration_s notificationConfiguration);
bool existMainConnection(const am_mainConnectionID_t mainConnectionID) const;
- bool existcrossFader(const am_crossfaderID_t crossfaderID) const;
+ bool existCrossFader(const am_crossfaderID_t crossfaderID) const;
bool existConnection(const am_Connection_s & connection) const;
bool existConnectionID(const am_connectionID_t connectionID) const;
bool existSource(const am_sourceID_t sourceID) const;
@@ -172,13 +179,20 @@ public:
bool existSinkName(const std::string& name) const;
bool existDomain(const am_domainID_t domainID) const;
bool existGateway(const am_gatewayID_t gatewayID) const;
+ bool existConverter(const am_converterID_t converterID) const;
bool existSinkClass(const am_sinkClass_t sinkClassID) const;
bool existSourceClass(const am_sourceClass_t sourceClassID) const;
void registerObserver(CAmDatabaseObserver *iObserver);
bool sourceVisible(const am_sourceID_t sourceID) const;
bool sinkVisible(const am_sinkID_t sinkID) const;
+ bool isComponentConnected(const am_Gateway_s & gateway) const;
+ bool isComponentConnected(const am_Converter_s & converter) const;
//todo: Implement dump for SQLite database handler
void dump( std::ostream & output) const { output << __FUNCTION__ << " not implemented!"; };
+ am_Error_e enumerateSources(std::function<void(const am_Source_s & element)> cb) const;
+ am_Error_e enumerateSinks(std::function<void(const am_Sink_s & element)> cb) const;
+ am_Error_e enumerateGateways(std::function<void(const am_Gateway_s & element)> cb) const;
+ am_Error_e enumerateConverters(std::function<void(const am_Converter_s & element)> cb) const;
};
}
diff --git a/AudioManagerDaemon/include/CAmDatabaseObserver.h b/AudioManagerDaemon/include/CAmDatabaseObserver.h
index e3a016d..d6f980d 100644
--- a/AudioManagerDaemon/include/CAmDatabaseObserver.h
+++ b/AudioManagerDaemon/include/CAmDatabaseObserver.h
@@ -49,6 +49,7 @@ public:
void newSource(const am_Source_s& source);
void newDomain(const am_Domain_s& domain);
void newGateway(const am_Gateway_s& gateway);
+ void newConverter(const am_Converter_s& coverter);
void newCrossfader(const am_Crossfader_s& crossfader);
void newMainConnection(const am_MainConnectionType_s& mainConnection);
void removedMainConnection(const am_mainConnectionID_t mainConnection);
@@ -56,6 +57,7 @@ public:
void removedSource(const am_sourceID_t sourceID, const bool visible);
void removeDomain(const am_domainID_t domainID);
void removeGateway(const am_gatewayID_t gatewayID);
+ void removeConverter(const am_converterID_t converterID);
void removeCrossfader(const am_crossfaderID_t crossfaderID);
void mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState);
void mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty);
diff --git a/AudioManagerDaemon/include/CAmGraph.h b/AudioManagerDaemon/include/CAmGraph.h
new file mode 100644
index 0000000..16783e6
--- /dev/null
+++ b/AudioManagerDaemon/include/CAmGraph.h
@@ -0,0 +1,622 @@
+/**
+ * Copyright (C) 2012, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2014
+ *
+ * \file CAmGraph.h
+ * For further information see http://www.genivi.org/.
+ *
+ */
+
+#ifndef GRAPH_H
+#define GRAPH_H
+
+#include <functional>
+#include <iostream>
+#include <vector>
+#include <map>
+#include <list>
+#include <stack>
+#include <queue>
+#include <algorithm>
+#include <limits.h>
+#include <iomanip>
+#include <cstring>
+#include <set>
+
+
+namespace am
+{
+ /**
+ * Graph element status.
+ */
+ typedef enum:uint8_t
+ {
+ GES_NOT_VISITED,
+ GES_IN_PROGRESS,
+ GES_VISITED
+ }am_GraphElementStatus_e;
+
+ /**
+ * Callback parameter telling on which position in the path we are.
+ */
+ typedef enum:uint8_t
+ {
+ GRAPH_PATH_START, //at the beginning of the path
+ GRAPH_PATH_MIDDLE, //in middle of the path
+ GRAPH_PATH_END //at the end of the path
+ }am_GraphPathPosition_e;
+
+
+ /**
+ * This class is base class for nodes and vertices.
+ */
+ class CAmGraphElement
+ {
+ am_GraphElementStatus_e mStatus; //!< item status
+ public:
+ CAmGraphElement(): mStatus(GES_NOT_VISITED) { };
+ ~CAmGraphElement() { };
+ /**
+ * Setter and getter.
+ */
+ void setStatus(const am_GraphElementStatus_e s) { mStatus = s; };
+ am_GraphElementStatus_e getStatus() const { return mStatus; };
+ };
+
+ template <class NodeData> class CAmNode : public CAmGraphElement
+ {
+ uint16_t mIndex; //!< uint16_t index used for direct access
+ NodeData mData; //!< NodeData user data
+ public:
+ CAmNode(const NodeData & in):CAmGraphElement(), mIndex(0), mData(in) { };
+ CAmNode(const NodeData & in, const uint16_t index):CAmGraphElement(), mIndex(index), mData(in) { };
+ ~CAmNode() { };
+ /**
+ * Setters and getters.
+ */
+ NodeData & getData() { return mData; }
+ uint16_t getIndex() const { return mIndex; }
+ void setIndex(uint16_t index) { mIndex = index; }
+ };
+
+ template <class NodeData, class VertexData> class CAmVertex : public CAmGraphElement
+ {
+ CAmNode<NodeData>* mpNode; //!< CAmNode<NodeData>* pointer to a node
+ VertexData mVertexData; //!< VertexData vertex user data
+ uint16_t mWeight; //!< uint16_t a positive value used in the shortest path algorithms
+ public:
+ CAmVertex(CAmNode<NodeData> *aNode, const VertexData & vertexData, const uint16_t weight):CAmGraphElement(),
+ mpNode(aNode), mVertexData(vertexData), mWeight(weight) { };
+ ~CAmVertex() { };
+ /**
+ * Setters and getters.
+ */
+ CAmNode<NodeData>* getNode() const { return mpNode; }
+ VertexData & getData() { return mVertexData; }
+ uint16_t getWeight() const { return mWeight; }
+ void setWeight(const uint16_t weight) { mWeight=weight; }
+ };
+
+ /**
+ * Class representing a directed or undirected graph. It contains nodes and connections.
+ * T, V are types for custom user data.
+ */
+ template <class T, class V> class CAmGraph
+ {
+ typedef typename std::vector<CAmNode<T>*> CAmListNodePtrs;
+ typedef typename std::list<CAmVertex<T,V>> CAmListVertices;
+ typedef typename std::list<CAmVertex<T,V>>::iterator CAmListVerticesItr;
+ typedef typename std::list<CAmVertex<T,V>>::const_iterator CAmListVerticesItrConst;
+ typedef typename std::list<CAmListVertices> CAmNodesAdjList;
+ typedef typename std::list<CAmListVertices>::iterator CAmNodesAdjListItr;
+ typedef typename std::list<CAmListVertices>::const_iterator CAmNodesAdjListItrConst;
+ typedef typename std::list<CAmNode<T>> CAmListNodes;
+ typedef typename std::list<CAmNode<T>>::iterator CAmListNodesItr;
+ typedef typename std::list<CAmNode<T>>::const_iterator CAmListNodesItrConst;
+ typedef typename std::vector<CAmNode<T>*> CAmNodeReferenceList;
+ typedef typename std::vector<CAmListVertices*> CAmVertexReferenceList;
+
+ CAmListNodes mStoreNodes; //!< CAmListNodes list with all nodes
+ CAmNodesAdjList mStoreAdjList; //!< CAmNodesAdjList adjacency list
+ CAmNodeReferenceList mPointersNodes; //!< CAmNodeReferenceList vector with pointers to nodes for direct access
+ CAmVertexReferenceList mPointersAdjList; //!< CAmVertexReferenceList vector with pointers to vertices for direct access
+ bool mIsCyclic; //!< bool the graph has cycles or not
+
+ /**
+ * Updates the node indexes after adding or removing nodes.
+ *
+ * @param fromIndex updates all nodes from given index.
+ */
+ void updateIndexes(const int16_t fromIndex)
+ {
+ if( fromIndex<mPointersNodes.size() )
+ {
+ for(auto iter = mPointersNodes.begin()+fromIndex; iter!=mPointersNodes.end(); iter++)
+ (*iter)->setIndex(iter-mPointersNodes.begin());
+ }
+ }
+
+
+ /**
+ * Finds the shortest path and the minimal weights from given node.
+ *
+ * @param node start node.
+ * @param minDistance vector with all result distances.
+ * @param previous vector with previous nodes.
+ */
+
+ typedef uint16_t vertex_t;
+ typedef uint16_t weight_t;
+
+ void findShortestsPathsFromNode(const CAmNode<T> & node, std::vector<weight_t> &minDistance, std::vector<CAmNode<T> *> &previous)
+ {
+ typename CAmListVertices::const_iterator nIter;
+ CAmListVertices * neighbors;
+ weight_t dist, weight, v, distanceThroughU;
+ CAmNode<T>* pU;
+ CAmVertex<T,V> * pVertex;
+ CAmNode<T> *pDstNode;
+
+ size_t n = mPointersAdjList.size();
+ std::set<std::pair<weight_t, CAmNode<T>*> > vertexQueue;
+
+ minDistance.clear();
+ minDistance.resize(n, std::numeric_limits<weight_t>::max());
+ minDistance[node.getIndex()] = 0;
+ previous.clear();
+ previous.resize(n, NULL);
+
+ vertexQueue.insert(std::make_pair(minDistance[node.getIndex()], (CAmNode<T>*)&node));
+
+ while (!vertexQueue.empty())
+ {
+ dist = vertexQueue.begin()->first;
+ pU = vertexQueue.begin()->second;
+ vertexQueue.erase(vertexQueue.begin());
+ //todo: terminate the search at this position if you want the path to a target node ( if(pU==target)break; )
+
+ // Visit each edge exiting u
+ neighbors = mPointersAdjList[pU->getIndex()];
+ nIter = neighbors->begin();
+ for (; nIter != neighbors->end(); nIter++)
+ {
+ pVertex = (CAmVertex<T,V> *)&(*nIter);
+ pDstNode = pVertex->getNode();
+
+ v = pDstNode->getIndex();
+ weight = pVertex->getWeight();
+ distanceThroughU = dist + weight;
+ if (distanceThroughU < minDistance[pDstNode->getIndex()])
+ {
+ vertexQueue.erase(std::make_pair(minDistance[v], pDstNode));
+ minDistance[v] = distanceThroughU;
+ previous[v] = pU;
+ vertexQueue.insert(std::make_pair(minDistance[v], pDstNode));
+ }
+ }
+ }
+ }
+
+ /**
+ * Constructs a path to given node after findShortestsPathsFromNode has been called.
+ *
+ * @param node end node.
+ * @param previous vector with previous nodes.
+ * @param result result path.
+ */
+ void constructShortestPathTo(const CAmNode<T> & node, const std::vector<CAmNode<T> *> &previous, CAmListNodePtrs & result)
+ {
+ CAmNode<T> * vertex = (CAmNode<T> *)&node;
+
+ int i=0;
+ while ( (vertex = previous[vertex->getIndex()])!=NULL )
+ {
+ result.insert(result.begin(), vertex);
+ i++;
+ }
+ if(i)
+ result.push_back((CAmNode<T> *)&node);
+ }
+
+ /**
+ * Calls a function with every node from this path after findShortestsPathsFromNode has been called.
+ * The construction of the path is delegated to the caller.
+ *
+ * @param node end node.
+ * @param previous vector with previous nodes.
+ * @param cb callback which is mostly used for constructing.
+ */
+ void constructShortestPathTo(const CAmNode<T> & node, const std::vector<CAmNode<T> *> &previous, std::function<void(const am_GraphPathPosition_e pos, CAmNode<T> &)> cb)
+ {
+ CAmNode<T> * vertex = (CAmNode<T> *)&node;
+ CAmNode<T> * prev = vertex;
+ int i=0;
+ while ( (vertex = previous[vertex->getIndex()])!=NULL )
+ {
+ cb(i==0?GRAPH_PATH_START:GRAPH_PATH_MIDDLE, *prev);
+ prev = vertex;
+ i++;
+ }
+ if(i)
+ cb(GRAPH_PATH_END, *prev);
+ }
+
+ /**
+ * Generates list with all possible paths to given destination node after findShortestsPathsFromNode has been called.
+ * Finding paths is observed through the callback. The caller is informed after a new path has been found.
+ *
+ * @param dst end node.
+ * @param visited vector with current path.
+ * @param cb callback which is mostly used for constructing.
+ */
+ void goThroughAllPaths(const CAmNode<T> & dst, std::vector<CAmNode<T>*> & visited, std::function<void(const CAmNodeReferenceList & path)> cb)
+ {
+ CAmListVertices * nodes = mPointersAdjList[visited.back()->getIndex()];
+ CAmListVerticesItrConst vItr(nodes->begin());
+ for (; vItr != nodes->end(); ++vItr)
+ {
+ const CAmVertex<T,V> & vertex = (*vItr);
+ if(vertex.getNode()->getStatus()!=GES_NOT_VISITED)
+ continue;
+ if (vertex.getNode()==&dst)
+ {
+ vertex.getNode()->setStatus(GES_IN_PROGRESS);
+ visited.push_back(vertex.getNode());
+ //notify observer
+ cb(visited);
+ //remove last node from the list
+ auto last = visited.end()-1;
+ visited.erase(last);
+ vertex.getNode()->setStatus(GES_NOT_VISITED);
+ break;
+ }
+ }
+ vItr = nodes->begin();
+ //bfs like loop
+ for (; vItr != nodes->end(); ++vItr)
+ {
+ const CAmVertex<T,V> & vertex = (*vItr);
+ if(vertex.getNode()->getStatus()!=GES_NOT_VISITED||vertex.getNode()==&dst)
+ continue;
+ vertex.getNode()->setStatus(GES_IN_PROGRESS);
+ visited.push_back(vertex.getNode());
+ goThroughAllPaths(dst, visited, cb);
+ //remove last node from the list
+ auto last = visited.end()-1;
+ visited.erase(last);
+ vertex.getNode()->setStatus(GES_NOT_VISITED);
+ }
+ reset();
+ }
+
+ public:
+ explicit CAmGraph(const std::vector<T> &v):mStoreNodes(), mStoreAdjList(), mPointersNodes(), mPointersAdjList()
+ {
+ typedef typename std::vector<T>::const_iterator inItr;
+ inItr itr(v.begin());
+
+ for (; itr != v.end(); ++itr)
+ {
+ addNode(*itr);
+ }
+
+ mIsCyclic = false;
+ };
+ CAmGraph():mStoreNodes(), mStoreAdjList(), mPointersNodes(), mPointersAdjList(), mIsCyclic(false){};
+ ~CAmGraph(){}
+
+ const CAmListNodes & getNodes() const
+ {
+ return mStoreNodes;
+ }
+
+ /**
+ * Returns pointer to a node which data is equal to the given.
+ * @return pointer to a node or NULL.
+ */
+ const CAmNode<T>* findNode(const T & in)
+ {
+ typename CAmNodeReferenceList::const_iterator itr (mPointersNodes.begin());
+
+ for (; itr != mPointersNodes.end(); ++itr)
+ {
+ if ((*itr)->getData() == in) {
+ return (*itr);
+ }
+ }
+ return NULL;
+ }
+
+ /**
+ * Returns pointer to a vertex which two ends are equal to the given nodes.
+ * @return pointer to a vertex or NULL.
+ */
+ const CAmVertex<T,V>* findVertex(const CAmNode<T> & edge1, const CAmNode<T> & edge2) const
+ {
+ const CAmNode<T> * pEdge2 = (CAmNode<T> *)&edge2;
+ const CAmListVertices * list = mPointersAdjList[edge1.getIndex()];
+ CAmListVerticesItrConst result = std::find_if(list->begin(), list->end(), [&](const CAmVertex<T,V> & refObject){
+ return refObject.getNode()==pEdge2;
+ });
+ if(result!=list->end())
+ return (CAmVertex<T,V>*)&(*result);
+
+ return NULL;
+ }
+
+ bool hasCycles() const
+ {
+ return mIsCyclic;
+ }
+
+
+ /**
+ * Adds a new node to the graph with given user data.
+ * @return reference to the newly inserted node.
+ */
+ CAmNode<T> & addNode(const T & in)
+ {
+ size_t index = mStoreNodes.size();
+ mStoreNodes.emplace_back(in, index);
+ mStoreAdjList.emplace_back();
+ mPointersNodes.push_back(&mStoreNodes.back());
+ mPointersAdjList.push_back(&mStoreAdjList.back());
+ return mStoreNodes.back();
+ }
+
+ /**
+ * Removes a vertex with two ends equal to the given nodes .
+ */
+ void removeVertex(const CAmNode<T> & edge1, const CAmNode<T> & edge2)
+ {
+ const CAmListVertices * list = mPointersAdjList[edge1.getIndex()];
+ CAmListVerticesItr iter = std::find_if(list->begin(), list->end(), [&edge2](const CAmVertex<T,V> & refVertex){
+ return (refVertex.getNode()==&edge2);
+ });
+ if(iter!=list->end())
+ list->erase(iter);
+ }
+
+ /**
+ * Removes all vertices to given node .
+ */
+ void removeAllVerticesToNode(const CAmNode<T> & node)
+ {
+ auto comparator = [&node](const CAmVertex<T,V> & refVertex){
+ return (refVertex.getNode()==&node);
+ };
+ auto itr = mPointersAdjList.begin();
+ for(;itr!=mPointersAdjList.end();itr++)
+ {
+ CAmListVertices * vertices = *itr;
+ auto iterVert = std::find_if(vertices->begin(), vertices->end(), comparator);
+ if(iterVert!=vertices->end())
+ vertices->erase(iterVert);
+ }
+ }
+
+ /**
+ * Removes a node with given user data .
+ */
+ void removeNode(const T & in)
+ {
+ CAmNode<T> * node = findNode(in);
+ if(node!=NULL)
+ removeNode(*node);
+ }
+
+ /**
+ * Removes the given node from the graph .
+ */
+ void removeNode(const CAmNode<T> & node)
+ {
+ uint16_t index = node.getIndex();
+ removeAllVerticesToNode(node);
+ mPointersAdjList.erase(mPointersAdjList.begin()+index);
+ mPointersNodes.erase(mPointersNodes.begin()+index);
+ auto iter = std::find_if(mStoreNodes.begin(), mStoreNodes.end(), [&node](const CAmNode<T> & otherNode){
+ return &otherNode==&node;
+ });
+ if(iter!=mStoreNodes.end())
+ mStoreNodes.erase(iter);
+ updateIndexes(index);
+ }
+
+ /**
+ * Connect first with last node and set user data and weight to the vertex.
+ */
+ void connectNodes(const CAmNode<T> & first, const CAmNode<T> & last, const V & vertexData, const int16_t weight = 1)
+ {
+ CAmListVertices * list = mPointersAdjList[first.getIndex()];
+ CAmNode<T> * node = mPointersNodes[last.getIndex()];
+ list->emplace_back(node, vertexData, weight);
+ }
+
+ /**
+ * Exists any vertex with two given ends.
+ * @return TRUE on successfully changed ID.
+ */
+ bool isAnyVertex(const CAmNode<T> & edge1, const CAmNode<T> & edge2) const
+ {
+ return findVertex(edge1, edge2)!=NULL;
+ }
+
+ /**
+ * Sets the status of all nodes and vertices to GES_NOT_VISITED.
+ */
+ void reset()
+ {
+ // set all nodes to GES_NOT_VISITED
+ std::for_each(mPointersNodes.begin(), mPointersNodes.end(), [](CAmNode<T> * refNode){
+ if(refNode->getStatus()!= GES_NOT_VISITED)
+ refNode->setStatus(GES_NOT_VISITED);
+ });
+ // set all vertices to GES_NOT_VISITED
+ auto action = [](CAmVertex<T,V> & refVertex){
+ if(refVertex.getStatus()!= GES_NOT_VISITED)
+ refVertex.setStatus(GES_NOT_VISITED);
+ };
+ auto itr1(mPointersAdjList.begin());
+ for (; itr1 != mPointersAdjList.end(); ++itr1)
+ {
+ CAmListVertices * vertices = *itr1;
+ std::for_each(vertices->begin(), vertices->end(), action);
+ }
+ }
+
+ /**
+ * Clears all nodes and vertices.
+ */
+ void clear()
+ {
+ mStoreNodes.clear();
+ mStoreAdjList.clear();
+ mPointersAdjList.clear();
+ mPointersNodes.clear();
+ mPointersAdjList.clear();
+ }
+
+ /**
+ * Goes through all nodes and vertices and calls the callback.
+ */
+ void trace(std::function<void(const CAmNode<T> &, const std::vector<CAmVertex<T,V>*> &)> cb)
+ {
+ std::for_each(mPointersNodes.begin(), mPointersNodes.end(), [&](CAmNode<T> * refNode){
+ CAmListVertices * vertices = mPointersAdjList[refNode->getIndex()];
+ std::vector<CAmVertex<T,V>*> list;
+ std::for_each(vertices->begin(), vertices->end(), [&list](CAmVertex<T,V> & refVertex){
+ list.push_back(&refVertex);
+ });
+ cb(*refNode, list);
+ });
+ }
+
+ /**
+ * Finds the shortest path from given node to all nodes in listTargets.
+ *
+ * @param source start node.
+ * @param listTargets destination nodes.
+ * @param resultPath list with all shortest paths.
+ */
+ void getShortestPath(const CAmNode<T> & source, const CAmListNodePtrs & listTargets, std::vector<CAmListNodePtrs> & resultPath )
+ {
+ const size_t numberOfNodes = mPointersNodes.size();
+ if(numberOfNodes==0)
+ return;
+
+ std::vector<weight_t> min_distance;
+ std::vector<CAmNode<T>*> previous;
+ findShortestsPathsFromNode(source, min_distance, previous);
+
+ for(auto it=listTargets.begin(); it!=listTargets.end(); it++)
+ {
+ CAmNode<T> *node = *it;
+ resultPath.emplace_back();
+ CAmListNodePtrs & path = resultPath.back();
+ constructShortestPathTo(*node, previous, path);
+ if(path.empty())
+ {
+ typename std::vector<CAmListNodePtrs>::iterator iter = resultPath.end();
+ resultPath.erase(--iter);
+ }
+ }
+ }
+
+ /**
+ * Finds the shortest path between two nodes.
+ *
+ * @param source start node.
+ * @param destination destination node.
+ * @param resultPath list with the found shortest paths.
+ */
+ void getShortestPath(const CAmNode<T> & source, const CAmNode<T> & destination, CAmListNodePtrs & resultPath )
+ {
+ const size_t numberOfNodes = mPointersNodes.size();
+ if(numberOfNodes==0)
+ return;
+ std::vector<weight_t> min_distance;
+ std::vector<CAmNode<T>*> previous;
+ findShortestsPathsFromNode(source, min_distance, previous);
+ constructShortestPathTo(destination, previous, resultPath);
+ }
+
+ /**
+ * Finds the shortest path from given node to all nodes in listTargets.
+ * Delegates the construction of the path to the caller.
+ *
+ * @param source start node.
+ * @param listTargets destination nodes.
+ * @param cb callabck.
+ */
+ void getShortestPath(const CAmNode<T> & source,
+ const CAmListNodePtrs & listTargets,
+ std::function<void(const am_GraphPathPosition_e, CAmNode<T> &)> cb )
+ {
+ const size_t numberOfNodes = mPointersNodes.size();
+ if(numberOfNodes==0)
+ return;
+
+ std::vector<weight_t> min_distance;
+ std::vector<CAmNode<T>*> previous;
+ findShortestsPathsFromNode(source, min_distance, previous);
+
+ for(auto it=listTargets.begin(); it!=listTargets.end(); it++)
+ {
+ CAmNode<T>* node = *it;
+ constructShortestPathTo(*node, previous, cb);
+ }
+ }
+
+ /**
+ * Finds the shortest path between two given nodes.
+ * Delegates the construction of the path to the caller.
+ *
+ * @param source start node.
+ * @param destination destination node.
+ * @param cb callabck.
+ */
+ void getShortestPath(const CAmNode<T> & source,
+ const CAmNode<T> & destination,
+ std::function<void(const am_GraphPathPosition_e, CAmNode<T> &)> cb )
+ {
+ const size_t numberOfNodes = mPointersNodes.size();
+ if(numberOfNodes==0)
+ return;
+
+ std::vector<weight_t> min_distance;
+ std::vector<CAmNode<T>*> previous;
+ findShortestsPathsFromNode(source, min_distance, previous);
+ constructShortestPathTo(destination, previous, cb);
+ }
+
+ /**
+ * Finds all possible paths between two given nodes.
+ * Delegates the construction of the path to the caller.
+ *
+ * @param src start node.
+ * @param dst destination node.
+ * @param cb callabck.
+ */
+ void getAllPaths(const CAmNode<T> & src, const CAmNode<T> & dst, std::function<void(const CAmNodeReferenceList & path)> cb)
+ {
+ CAmNodeReferenceList visited;
+ visited.push_back((CAmNode<T>*)&src);
+ goThroughAllPaths(dst, visited, cb);
+ }
+ };
+
+}
+
+#endif
diff --git a/AudioManagerDaemon/include/CAmRouter.h b/AudioManagerDaemon/include/CAmRouter.h
index 76cf5fc..6a3aacc 100644
--- a/AudioManagerDaemon/include/CAmRouter.h
+++ b/AudioManagerDaemon/include/CAmRouter.h
@@ -13,6 +13,7 @@
*
*
* \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ * \author Aleksandar Donchev, Aleksander.Donchev@partner.bmw.de BMW 2013,2014
*
* \file CAmRouter.h
* For further information see http://www.genivi.org/.
@@ -22,68 +23,281 @@
#ifndef ROUTER_H_
#define ROUTER_H_
+#include <assert.h>
+#include <vector>
#include "audiomanagertypes.h"
+#include "CAmGraph.h"
+#include "IAmDatabaseHandler.h"
+
namespace am
{
+/**
+ * Optimal path search between a source and a sink is implemented with a graph which contains nodes - sinks, sources, gateways, converters.
+ *
+ * If EXTENDED_ROUTING_GRAPH is defined the graph will contain nodes, which are identified by sinkID, sourceID, gatewayID, converterID and connectionFormat.
+ * All possible connections between all nodes (1 connection is 1 connection format) are represented in the graph (Node[id=1, connectionFormat=1] ---> Node[id=2, connectionFormat=1]).
+ *
+ * If EXTENDED_ROUTING_GRAPH is NOT defined the graph will contain nodes, which are identified by sinkID, sourceID, gatewayID, converterID.
+ * A possible connection between two nodes represents the facts that the nodes can be connected with one or more connectionFormats (Node[id=1] ---> Node[id=2]).
+ * It is assumption that the two nodes can be connected. The controller itself decides later whether the connection is possible or not. This is default.
+ *
+ */
+#undef EXTENDED_ROUTING_GRAPH
+
+/**
+ * Trace on/off.
+ */
+#undef TRACE_GRAPH
+
+
+class CAmRouter;
+
+/**
+ * A structure used as user data in the graph nodes.
+ */
+struct am_RoutingNodeData_s
+{
+ typedef enum:uint8_t {SINK, SOURCE, GATEWAY, CONVERTER} am_NodeDataType_e;
+ am_NodeDataType_e type; //!< data type:sink, source, gateway or converter
+#ifdef EXTENDED_ROUTING_GRAPH
+ am_CustomConnectionFormat_t inConnectionFormat; //!< input connection format for sink, source, gateway or converter
+ am_CustomConnectionFormat_t outConnectionFormat; //!< output connection format usually for gateways and converters
+#endif
+ union
+ {
+ am_Source_s *source;
+ am_Sink_s *sink;
+ am_Gateway_s *gateway;
+ am_Converter_s *converter;
+ } data; //!< union pointer to sink, source, gateway or converter
+
+ am_RoutingNodeData_s():type(SINK)
+#ifdef EXTENDED_ROUTING_GRAPH
+ ,inConnectionFormat(CF_UNKNOWN)
+ ,outConnectionFormat(CF_UNKNOWN)
+#endif
+ {}
+
+ bool operator==(const am_RoutingNodeData_s & anotherObject) const
+ {
+ bool result = false;
+ if(type==anotherObject.type)
+ {
+#ifdef EXTENDED_ROUTING_GRAPH
+ result = (inConnectionFormat==anotherObject.inConnectionFormat && outConnectionFormat==anotherObject.outConnectionFormat);
+#else
+ result = true;
+#endif
+ if(type==SINK)
+ result &= (data.sink->sinkID==anotherObject.data.sink->sinkID);
+ else if(type==SOURCE)
+ result &= (data.source->sourceID==anotherObject.data.source->sourceID);
+ else if(type==GATEWAY)
+ result &= (data.gateway->gatewayID==anotherObject.data.gateway->gatewayID);
+ else if(type==CONVERTER)
+ result &= (data.converter->converterID==anotherObject.data.converter->converterID);
+ }
+ return result;
+ };
+
+#ifdef TRACE_GRAPH
+ void trace() const
+ {
+ if(type==SINK)
+ std::cout << "[SINK:" << data.sink->sinkID << ":" << data.sink->name
+#ifdef EXTENDED_ROUTING_GRAPH
+ << "(" << inConnectionFormat << "," << outConnectionFormat << ")"
+#endif
+ << "]";
+ else if(type==SOURCE)
+ std::cout << "[SOUR:" << data.source->sourceID << ":" << data.source->name
+#ifdef EXTENDED_ROUTING_GRAPH
+ << "(" << inConnectionFormat << "," << outConnectionFormat << ")"
+#endif
+ << "]";
+ else if(type==GATEWAY)
+ std::cout << "[GATE:" << data.gateway->gatewayID << ":" << data.gateway->name
+#ifdef EXTENDED_ROUTING_GRAPH
+ << "(" << inConnectionFormat << "," << outConnectionFormat << ")"
+#endif
+ << "]";
+ else if(type==CONVERTER)
+ std::cout << "[CONV:" << data.converter->converterID << ":" << data.converter->name
+#ifdef EXTENDED_ROUTING_GRAPH
+ << "(" << inConnectionFormat << "," << outConnectionFormat << ")"
+#endif
+ << "]";
+ };
+#endif
+};
+
+#define NodeDataType am_RoutingNodeData_s::am_NodeDataType_e
+
-class IAmDatabaseHandler;
class CAmControlSender;
+
/**
* Implements an autorouting algorithm for connecting sinks and sources via different audio domains.
*/
class CAmRouter
{
+ IAmDatabaseHandler* mpDatabaseHandler; //!< pointer to database handler
+ CAmControlSender* mpControlSender; //!< pointer the controlsender - is used to retrieve information for the optimal route
+ bool mOnlyFreeConversionNodes; //!< bool flag whether only disconnected elements should be considered or not
+ CAmGraph<am_RoutingNodeData_s, uint16_t> mRoutingGraph; //!< graph object
+ std::vector<CAmNode<am_RoutingNodeData_s>*> mNodeListSources; //!< vector with pointers to nodes with sources, used for quick access
+ std::vector<CAmNode<am_RoutingNodeData_s>*> mNodeListSinks; //!< vector with pointers to nodes with sinks, used for quick access
+ std::vector<CAmNode<am_RoutingNodeData_s>*> mNodeListGateways; //!< vector with pointers to nodes with gateways, used for quick access
+ std::vector<CAmNode<am_RoutingNodeData_s>*> mNodeListConverters;//!< vector with pointers to nodes with converters, used for quick access
+ std::map<am_sourceID_t, bool> mNodeListSourceStatus; //!< vector with flags preventing going through group of nodes during the path search
+ std::map<am_sinkID_t, bool> mNodeListSinkStatus; //!< vector with flags preventing going through group of nodes during the path search
+ std::map<am_converterID_t, bool> mNodeListConverterStatus; //!< vector with flags preventing going through group of nodes during the path search
+ std::map<am_gatewayID_t, bool> mNodeListGatewayStatus; //!< vector with flags preventing going through group of nodes during the path search
+#ifdef EXTENDED_ROUTING_GRAPH
+ am_Source_s *mpRootSource; //!< pointer to source
+ am_Sink_s *mpRootSink; //!< pointer to sink
+
+ /*
+ * Methods for getting shortest path from the graph.
+ */
+ void getShortestPath(const am_Source_s & aSource, const am_Sink_s & aSink, std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultPath);
+ void getShortestPath(std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultPath);
+ void getShortestPath(const am_Source_s & aSource, const am_Sink_s & aSink,
+ std::vector<am_Route_s> & resultPath, std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultNodesPath);
+ void getShortestPath(std::vector<am_Route_s> & routes, std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & nodes);
+
+ /**
+ * Returns a sink node with given sinkID and connection format.
+ *
+ * @param sinkID sink id.
+ * @param connectionFormat connection format.
+ * @return pointer to node or NULL.
+ */
+
+ CAmNode<am_RoutingNodeData_s>* sinkNodeWithID(const am_sinkID_t sinkID, const am_CustomConnectionFormat_t connectionFormat);
+ /**
+ * Returns a source node with given sourceID and connection format.
+ *
+ * @param sourceID source id.
+ * @param connectionFormat connection format.
+ * @return pointer to node or NULL.
+ */
+ CAmNode<am_RoutingNodeData_s>* sourceNodeWithID(const am_sourceID_t sourceID, const am_CustomConnectionFormat_t connectionFormat);
+#else
+ CAmNode<am_RoutingNodeData_s> *mpRootSource; //!< pointer to source node
+ CAmNode<am_RoutingNodeData_s> *mpRootSink; //!< pointer to sink node
+
+ am_Error_e determineConnectionFormatsForPath(am_Route_s & routeObjects, std::vector<CAmNode<am_RoutingNodeData_s>*> & nodes);
+ am_Error_e doConnectionFormatsForPath(am_Route_s & routeObjects,
+ std::vector<CAmNode<am_RoutingNodeData_s>*> & route,
+ std::vector<am_RoutingElement_s>::iterator routingElementIterator,
+ std::vector<CAmNode<am_RoutingNodeData_s>*>::iterator routeIterator);
+ void getShortestPath(const CAmNode<am_RoutingNodeData_s> & source,
+ const CAmNode<am_RoutingNodeData_s> & destination,
+ std::vector<CAmNode<am_RoutingNodeData_s>*> & resultPath);
+ void getShortestPath(std::vector<CAmNode<am_RoutingNodeData_s>*> & resultPath);
+ void getShortestPath(CAmNode<am_RoutingNodeData_s> & aSource, CAmNode<am_RoutingNodeData_s> & aSink,
+ am_Route_s & resultPath, std::vector<CAmNode<am_RoutingNodeData_s>*> & resultNodesPath);
+ void getShortestPath(am_Route_s & resultPath, std::vector<CAmNode<am_RoutingNodeData_s>*> & resultNodesPath);
+ am_Error_e getAllPaths(CAmNode<am_RoutingNodeData_s> & aSource, CAmNode<am_RoutingNodeData_s> & aSink,
+ std::vector<am_Route_s> & resultPath, std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultNodesPath);
+ am_Error_e getAllPaths(std::vector<am_Route_s> & resultPath, std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultNodesPath);
+
+ /**
+ * Returns a sink node with given sinkID.
+ *
+ * @param sinkID sink id.
+ * @return pointer to node or NULL.
+ */
+ CAmNode<am_RoutingNodeData_s>* sinkNodeWithID(const am_sinkID_t sinkID);
+
+ /**
+ * Returns a source node with given sourceID.
+ *
+ * @param sourceID source id.
+ * @return pointer to node or NULL.
+ */
+ CAmNode<am_RoutingNodeData_s>* sourceNodeWithID(const am_sourceID_t sourceID);
+#endif
+
+ /**
+ * Makes connection between two nodes.
+ *
+ * @param node1.
+ * @param node2.
+ * @param vertexData associated data.
+ * @param weight connection weight used for finding optimal path.
+ */
+ void connectNodes(const CAmNode<am_RoutingNodeData_s> & node1,
+ const CAmNode<am_RoutingNodeData_s> & node2,
+ const am_CustomConnectionFormat_t vertexData,
+ const int16_t weight = 1);
+ /**
+ * Builds path in a domain from source to sink.
+ *
+ * @param aSource starting point.
+ * @param aSink ending point.
+ */
+ bool routeInSameDomain(CAmNode<am_RoutingNodeData_s> & aSource, CAmNode<am_RoutingNodeData_s> & aSink);
+
+ /**
+ * Builds path from source to sink when the source and the sink belongs to different domains.
+ *
+ * @param aSource starting point.
+ * @param aSink ending point.
+ */
+ bool routeInAnotherDomain(CAmNode<am_RoutingNodeData_s> & aSource, CAmNode<am_RoutingNodeData_s> & aSink);
+ void clear();
+
+ /**
+ * Fills the graph with nodes and connections.
+ *
+ * @param aSource starting point.
+ * @param aSink ending point.
+ */
+ void buildGraph(const am_Source_s & aSource, const am_Sink_s & aSink);
+ template <class Component> bool isComponentConnected(const Component & comp)
+ {
+ return mpDatabaseHandler->isComponentConnected(comp);
+ }
+
public:
CAmRouter(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSender);
~CAmRouter();
+
+ /**
+ * Finds all possible paths between given source and sink.
+ *
+ * @param onlyfree only disconnected elements should be included or not.
+ * @param sourceID starting point.
+ * @param sinkID ending point.
+ * @param returnList list with all possible paths
+ * @return E_OK on success(0 or more paths) or E_NOT_POSSIBLE on failure.
+ */
am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
+ am_Error_e getRoute(const bool onlyfree, const am_Source_s & aSource, const am_Sink_s & aSink, std::vector<am_Route_s> & listRoutes);
-private:
- am_Error_e findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, std::vector<am_RoutingElement_s>& listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator);
- void listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_CustomConnectionFormat_t>& listFormats) const;
- void listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_CustomConnectionFormat_t sinkConnectionFormat, std::vector<am_CustomConnectionFormat_t>& listFormats) const;
- IAmDatabaseHandler* mpDatabaseHandler; //!< pointer to database handler
- CAmControlSender* mpControlSender; //!< pointer the controlsender - is used to retrieve information for the optimal route
-};
+ /**
+ * Helper methods.
+ */
+ static bool getAllowedFormatsFromConvMatrix(const std::vector<bool> & convertionMatrix,
+ const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
+ const std::vector<am_CustomConnectionFormat_t> & listSinkFormats,
+ std::vector<am_CustomConnectionFormat_t> & sourceFormats,
+ std::vector<am_CustomConnectionFormat_t> & sinkFormats);
+ static bool getRestrictedOutputFormats(const std::vector<bool> & convertionMatrix,
+ const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
+ const std::vector<am_CustomConnectionFormat_t> & listSinkFormats,
+ const am_CustomConnectionFormat_t connectionFormat,
+ std::vector<am_CustomConnectionFormat_t> & listFormats);
-/**
- * an item in the routing tree
- */
-class CAmRoutingTreeItem
-{
-public:
- CAmRoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID = 0, CAmRoutingTreeItem *parent = 0);
- ~CAmRoutingTreeItem();
- void appendChild(CAmRoutingTreeItem *newChild); //!< appends a new child
- void returnChildItems(std::vector<CAmRoutingTreeItem*> listChildItems); //!< returns the list of childs
- am_domainID_t returnDomainID() const; //!< returns the domainID of the tree
- am_gatewayID_t returnGatewayID() const; //!< returns the gatewayID of the tree
- CAmRoutingTreeItem* returnParent() const; //!< returns the parent item of the tree
-private:
- std::vector<CAmRoutingTreeItem*> mListChildItems; //!< List of all child items
- am_domainID_t mDomainID; //!< the domain ID of the item
- am_gatewayID_t mGatewayID; //!< the gateway Id
- CAmRoutingTreeItem *mpParentItem; //!< pointer to the parent item
+ static void listPossibleConnectionFormats(std::vector<am_CustomConnectionFormat_t> & inListSourceFormats,
+ std::vector<am_CustomConnectionFormat_t> & inListSinkFormats,
+ std::vector<am_CustomConnectionFormat_t> & outConnectionFormats);
};
-/**
- * a routing tree
- */
-class CAmRoutingTree
-{
-public:
- CAmRoutingTree(const am_domainID_t rootDomainID);
- ~CAmRoutingTree();
- CAmRoutingTreeItem* insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, CAmRoutingTreeItem *parent);
- void getRoute(CAmRoutingTreeItem* targetItem, std::vector<am_gatewayID_t>& listGateways);
- am_domainID_t returnRootDomainID() const;
- CAmRoutingTreeItem* returnRootItem();
-private:
- CAmRoutingTreeItem mRootItem; //!< pointer to root item
- std::vector<CAmRoutingTreeItem*> mListChild; //!< list of all childs
-};
} /* namespace am */
#endif /* ROUTER_H_ */
diff --git a/AudioManagerDaemon/include/CAmRoutingReceiver.h b/AudioManagerDaemon/include/CAmRoutingReceiver.h
index 4eca2aa..bf42f6b 100644
--- a/AudioManagerDaemon/include/CAmRoutingReceiver.h
+++ b/AudioManagerDaemon/include/CAmRoutingReceiver.h
@@ -58,7 +58,9 @@ public:
am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID);
am_Error_e deregisterDomain(const am_domainID_t domainID);
am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e registerConverter(const am_Converter_s& converterData, am_converterID_t& converterID);
am_Error_e deregisterGateway(const am_gatewayID_t gatewayID);
+ am_Error_e deregisterConverter(const am_converterID_t converterID);
am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
am_Error_e registerSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
am_Error_e deregisterSink(const am_sinkID_t sinkID);
@@ -82,6 +84,7 @@ public:
void confirmRoutingReady(const uint16_t handle, const am_Error_e error);
void confirmRoutingRundown(const uint16_t handle, const am_Error_e error);
am_Error_e updateGateway(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix) ;
+ am_Error_e updateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix);
am_Error_e updateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
am_Error_e updateSource(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
void ackSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listvolumes, const am_Error_e error) ;
diff --git a/AudioManagerDaemon/include/IAmDatabaseHandler.h b/AudioManagerDaemon/include/IAmDatabaseHandler.h
index 8a36801..e053635 100644
--- a/AudioManagerDaemon/include/IAmDatabaseHandler.h
+++ b/AudioManagerDaemon/include/IAmDatabaseHandler.h
@@ -27,6 +27,7 @@
#include <vector>
#include <string>
#include <iostream>
+#include <functional>
namespace am
{
@@ -62,6 +63,7 @@ public:
virtual am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID) = 0;
virtual am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) = 0;
virtual am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) = 0;
+ virtual am_Error_e enterConverterDB(const am_Converter_s & converteData, am_converterID_t & converterID) = 0;
virtual am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID) = 0;
virtual am_Error_e enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID) = 0;
virtual am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID) = 0;
@@ -92,6 +94,7 @@ public:
virtual am_Error_e removeSinkDB(const am_sinkID_t sinkID) = 0;
virtual am_Error_e removeSourceDB(const am_sourceID_t sourceID) = 0;
virtual am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID) = 0;
+ virtual am_Error_e removeConverterDB(const am_converterID_t converterID) = 0;
virtual am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID) = 0;
virtual am_Error_e removeDomainDB(const am_domainID_t domainID) = 0;
virtual am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID) = 0;
@@ -100,6 +103,7 @@ public:
virtual am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const = 0;
virtual am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const = 0;
virtual am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const = 0;
+ virtual am_Error_e getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) const = 0;
virtual am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s& sinkData) const = 0;
virtual am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const = 0;
virtual am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const = 0;
@@ -112,6 +116,7 @@ public:
virtual am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const = 0;
virtual am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listGatewaysID) const = 0;
virtual am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const = 0;
+ virtual am_Error_e getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConvertersID) const = 0;
virtual am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const = 0;
virtual am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const = 0;
virtual am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const = 0;
@@ -120,6 +125,7 @@ public:
virtual am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const = 0;
virtual am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const = 0;
virtual am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const = 0;
+ virtual am_Error_e getListConverters(std::vector<am_Converter_s> & listConverters) const = 0;
virtual am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const = 0;
virtual am_Error_e getListVisibleMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const = 0;
virtual am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const = 0;
@@ -135,7 +141,6 @@ public:
virtual am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const = 0;
virtual am_Error_e getSoureState(const am_sourceID_t sourceID, am_SourceState_e& sourceState) const = 0;
virtual am_Error_e getDomainState(const am_domainID_t domainID, am_DomainState_e& state) const = 0;
- virtual am_Error_e getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree) = 0;
virtual am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID) = 0;
virtual am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID) = 0;
virtual am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID) = 0;
@@ -148,11 +153,12 @@ public:
virtual am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s mainNotificationConfiguration) = 0;
virtual am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s mainNotificationConfiguration) = 0;
virtual am_Error_e changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) = 0;
+ virtual 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) = 0;
virtual am_Error_e changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID,const am_NotificationConfiguration_s notificationConfiguration) = 0;
virtual am_Error_e changeSourceNotificationConfigurationDB(const am_sourceID_t sourceID,const am_NotificationConfiguration_s notificationConfiguration) = 0;
virtual bool existMainConnection(const am_mainConnectionID_t mainConnectionID) const = 0;
- virtual bool existcrossFader(const am_crossfaderID_t crossfaderID) const = 0;
+ virtual bool existCrossFader(const am_crossfaderID_t crossfaderID) const = 0;
virtual bool existConnection(const am_Connection_s & connection) const = 0;
virtual bool existConnectionID(const am_connectionID_t connectionID) const = 0;
virtual bool existSource(const am_sourceID_t sourceID) const = 0;
@@ -168,9 +174,14 @@ public:
virtual void registerObserver(CAmDatabaseObserver *iObserver) = 0;
virtual bool sourceVisible(const am_sourceID_t sourceID) const = 0;
virtual bool sinkVisible(const am_sinkID_t sinkID) const = 0;
-
+ virtual bool isComponentConnected(const am_Gateway_s & gateway) const = 0;
+ virtual bool isComponentConnected(const am_Converter_s & converter) const = 0;
virtual am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const = 0; //!< calculates a new main connection delay
virtual void dump( std::ostream & output) const = 0 ;
+ virtual am_Error_e enumerateSources(std::function<void(const am_Source_s & element)> cb) const = 0 ;
+ virtual am_Error_e enumerateSinks(std::function<void(const am_Sink_s & element)> cb) const = 0 ;
+ virtual am_Error_e enumerateGateways(std::function<void(const am_Gateway_s & element)> cb) const = 0 ;
+ virtual am_Error_e enumerateConverters(std::function<void(const am_Converter_s & element)> cb) const = 0 ;
};
diff --git a/AudioManagerDaemon/src/CAmControlReceiver.cpp b/AudioManagerDaemon/src/CAmControlReceiver.cpp
index ae017e2..f576f5e 100644
--- a/AudioManagerDaemon/src/CAmControlReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmControlReceiver.cpp
@@ -184,6 +184,11 @@ am_Error_e CAmControlReceiver::enterGatewayDB(const am_Gateway_s & gatewayData,
return (mDatabaseHandler->enterGatewayDB(gatewayData, gatewayID));
}
+am_Error_e CAmControlReceiver::enterConverterDB(const am_Converter_s & converterData, am_converterID_t & converterID)
+{
+ return (mDatabaseHandler->enterConverterDB(converterData, converterID));
+}
+
am_Error_e CAmControlReceiver::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
return (mDatabaseHandler->enterSourceDB(sourceData, sourceID));
@@ -274,6 +279,11 @@ am_Error_e CAmControlReceiver::removeGatewayDB(const am_gatewayID_t gatewayID)
return (mDatabaseHandler->removeGatewayDB(gatewayID));
}
+am_Error_e CAmControlReceiver::removeConverterDB(const am_converterID_t converterID)
+{
+ return (mDatabaseHandler->removeConverterDB(converterID));
+}
+
am_Error_e CAmControlReceiver::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
return (mDatabaseHandler->removeCrossfaderDB(crossfaderID));
@@ -314,6 +324,12 @@ am_Error_e CAmControlReceiver::getGatewayInfoDB(const am_gatewayID_t gatewayID,
return (mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData));
}
+am_Error_e CAmControlReceiver::getConverterInfoDB(const am_converterID_t converterID, am_Converter_s & converterData) const
+{
+ return (mDatabaseHandler->getConverterInfoDB(converterID, converterData));
+}
+
+
am_Error_e CAmControlReceiver::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
return (mDatabaseHandler->getCrossfaderInfoDB(crossfaderID, crossfaderData));
@@ -339,6 +355,11 @@ am_Error_e CAmControlReceiver::getListGatewaysOfDomain(const am_domainID_t domai
return (mDatabaseHandler->getListGatewaysOfDomain(domainID, listGatewaysID));
}
+am_Error_e CAmControlReceiver::getListConvertersOfDomain(const am_domainID_t domainID,std::vector<am_converterID_t>& listConverterID) const
+{
+ return (mDatabaseHandler->getListConvertersOfDomain(domainID,listConverterID));
+}
+
am_Error_e CAmControlReceiver::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
return (mDatabaseHandler->getListMainConnections(listMainConnections));
@@ -384,6 +405,11 @@ am_Error_e CAmControlReceiver::getListGateways(std::vector<am_Gateway_s> & listG
return (mDatabaseHandler->getListGateways(listGateways));
}
+am_Error_e CAmControlReceiver::getListConverters(std::vector<am_Converter_s>& listConverters) const
+{
+ return (mDatabaseHandler->getListConverters(listConverters));
+}
+
am_Error_e CAmControlReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
return (mDatabaseHandler->getListSinkClasses(listSinkClasses));
@@ -489,6 +515,12 @@ am_Error_e CAmControlReceiver::changeGatewayDB(const am_gatewayID_t gatewayID, c
return (mDatabaseHandler->changeGatewayDB(gatewayID,listSourceConnectionFormats,listSinkConnectionFormats,convertionMatrix));
}
+am_Error_e CAmControlReceiver::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)
+{
+ logInfo("CAmControlReceiver::changeConverterDB was called with converterID", converterID);
+ return (mDatabaseHandler->changeConverterDB(converterID,listSourceConnectionFormats,listSinkConnectionFormats,convertionMatrix));
+}
+
am_Error_e CAmControlReceiver::setVolumes(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes)
{
logInfo("CAmControlReceiver::setVolumes got called");
diff --git a/AudioManagerDaemon/src/CAmControlSender.cpp b/AudioManagerDaemon/src/CAmControlSender.cpp
index 229a28b..dd3558e 100644
--- a/AudioManagerDaemon/src/CAmControlSender.cpp
+++ b/AudioManagerDaemon/src/CAmControlSender.cpp
@@ -193,12 +193,24 @@ am_Error_e CAmControlSender::hookSystemRegisterGateway(const am_Gateway_s & gate
return (mController->hookSystemRegisterGateway(gatewayData, gatewayID));
}
+am_Error_e CAmControlSender::hookSystemRegisterConverter(const am_Converter_s& converterData, am_converterID_t& converterID)
+{
+ assert(mController);
+ return (mController->hookSystemRegisterConverter(converterData, converterID));
+}
+
am_Error_e CAmControlSender::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
{
assert(mController);
return (mController->hookSystemDeregisterGateway(gatewayID));
}
+am_Error_e CAmControlSender::hookSystemDeregisterConverter(const am_converterID_t converterID)
+{
+ assert(mController);
+ return (mController->hookSystemDeregisterConverter(converterID));
+}
+
am_Error_e CAmControlSender::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
assert(mController);
@@ -414,6 +426,12 @@ am_Error_e CAmControlSender::hookSystemUpdateGateway(const am_gatewayID_t gatewa
return (mController->hookSystemUpdateGateway(gatewayID,listSourceConnectionFormats,listSinkConnectionFromats,convertionMatrix));
}
+am_Error_e CAmControlSender::hookSystemUpdateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFromats, const std::vector<bool>& convertionMatrix)
+{
+ assert(mController);
+ return (mController->hookSystemUpdateConverter(converterID,listSourceConnectionFormats,listSinkConnectionFromats,convertionMatrix));
+}
+
void CAmControlSender::cbAckSetVolume(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error)
{
assert(mController);
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp b/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp
index a7b765d..713eea1 100644
--- a/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseHandlerMap.cpp
@@ -26,13 +26,13 @@
#include <fstream>
#include <sstream>
#include <string>
-#include <algorithm>
#include <limits>
#include "CAmDatabaseHandlerMap.h"
#include "CAmDatabaseObserver.h"
#include "CAmRouter.h"
#include "shared/CAmDltWrapper.h"
+
namespace am
{
@@ -428,6 +428,7 @@ bool CAmDatabaseHandlerMap::CAmMappedData::increaseConnectionID(int16_t & result
CAmDatabaseHandlerMap::CAmDatabaseHandlerMap(): mFirstStaticSink(true), //
mFirstStaticSource(true), //
mFirstStaticGateway(true), //
+ mFirstStaticConverter(true), //
mFirstStaticSinkClass(true), //
mFirstStaticSourceClass(true), //
mFirstStaticCrossfader(true), //
@@ -665,7 +666,7 @@ am_Error_e CAmDatabaseHandlerMap::enterCrossfaderDB(const am_Crossfader_s & cros
if (crossfaderData.crossfaderID != 0 || mFirstStaticCrossfader)
{
//check if the ID already exists
- if (existcrossFader(crossfaderData.crossfaderID))
+ if (existCrossFader(crossfaderData.crossfaderID))
{
crossfaderID = crossfaderData.crossfaderID;
return (E_ALREADY_EXISTS);
@@ -758,6 +759,71 @@ am_Error_e CAmDatabaseHandlerMap::enterGatewayDB(const am_Gateway_s & gatewayDat
return (E_OK);
}
+bool CAmDatabaseHandlerMap::insertConverterDB(const am_Converter_s & converteData, am_converterID_t & converterID)
+{
+ int16_t nextID = 0;
+ if(mMappedData.increaseID(nextID, mMappedData.mCurrentConverterID, converteData.converterID))
+ {
+ converterID = nextID;
+ mMappedData.mConverterMap[nextID] = converteData;
+ mMappedData.mConverterMap[nextID].converterID = nextID;
+ return (true);
+ }
+ else
+ {
+ converterID = 0;
+ logInfo(__PRETTY_FUNCTION__,"Max limit reached.");
+ return (false);
+ }
+}
+
+am_Error_e CAmDatabaseHandlerMap::enterConverterDB(const am_Converter_s & converterData, am_converterID_t & converterID)
+{
+ assert(converterData.converterID<DYNAMIC_ID_BOUNDARY);
+ assert(converterData.sinkID!=0);
+ assert(converterData.sourceID!=0);
+ assert(converterData.domainID!=0);
+ assert(!converterData.name.empty());
+ assert(!converterData.convertionMatrix.empty());
+ assert(!converterData.listSinkFormats.empty());
+ assert(!converterData.listSourceFormats.empty());
+
+ //might be that the sinks and sources are not there during registration time
+ //assert(existSink(gatewayData.sinkID));
+ //assert(existSource(gatewayData.sourceID));
+
+ am_converterID_t tempID = 0;
+ am_converterID_t tempIndex = 0;
+ //if gatewayData is zero and the first Static Sink was already entered, the ID is created
+ bool result;
+ if (converterData.converterID != 0 || mFirstStaticConverter)
+ {
+ //check if the ID already exists
+ if (existGateway(converterData.converterID))
+ {
+ converterID = converterData.converterID;
+ return (E_ALREADY_EXISTS);
+ }
+ }
+ result = insertConverterDB(converterData, tempID);
+ if( false == result )
+ return (E_UNKNOWN);
+
+ tempIndex = tempID;
+ //if the ID is not created, we add it to the query
+ if (converterData.converterID == 0 && mFirstStaticConverter)
+ {
+ mFirstStaticConverter = false;
+ }
+ mMappedData.mConverterMap[tempIndex].converterID = tempID;
+ converterID = tempID;
+
+ logInfo("DatabaseHandler::enterConverterDB entered new converter with name", converterData.name, "sourceID:", converterData.sourceID, "sinkID:", converterData.sinkID, "assigned ID:", converterID);
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->newConverter(mMappedData.mConverterMap[tempIndex]);
+ return (E_OK);
+}
+
void CAmDatabaseHandlerMap::dump( std::ostream & output ) const
{
output << std::endl << "****************** DUMP START ******************" << std::endl;
@@ -1274,11 +1340,28 @@ am_Error_e CAmDatabaseHandlerMap::removeGatewayDB(const am_gatewayID_t gatewayID
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerMap::removeConverterDB(const am_converterID_t converterID)
+{
+ assert(converterID!=0);
+
+ if (!existConverter(converterID))
+ {
+ return (E_NON_EXISTENT);
+ }
+
+ mMappedData.mConverterMap.erase(converterID);
+
+ logInfo("DatabaseHandler::removeConverterDB removed:", converterID);
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->removeConverter(converterID);
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerMap::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
assert(crossfaderID!=0);
- if (!existcrossFader(crossfaderID))
+ if (!existCrossFader(crossfaderID))
{
return (E_NON_EXISTENT);
}
@@ -1480,10 +1563,24 @@ am_Error_e CAmDatabaseHandlerMap::getGatewayInfoDB(const am_gatewayID_t gatewayI
}
+am_Error_e CAmDatabaseHandlerMap::getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) const
+{
+ assert(converterID!=0);
+ if (!existConverter(converterID))
+ {
+ return (E_NON_EXISTENT);
+ }
+
+ converterData = mMappedData.mConverterMap.at(converterID);
+
+ return (E_OK);
+
+}
+
am_Error_e CAmDatabaseHandlerMap::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
assert(crossfaderID!=0);
- if (!existcrossFader(crossfaderID))
+ if (!existCrossFader(crossfaderID))
{
return (E_NON_EXISTENT);
}
@@ -1574,6 +1671,24 @@ am_Error_e CAmDatabaseHandlerMap::getListGatewaysOfDomain(const am_domainID_t do
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerMap::getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConvertersID) const
+{
+ assert(domainID!=0);
+ listConvertersID.clear();
+ if (!existDomain(domainID))
+ {
+ return (E_NON_EXISTENT);
+ }
+
+ CAmMapConverter::const_iterator elementIterator = mMappedData.mConverterMap.begin();
+ for (;elementIterator != mMappedData.mConverterMap.end(); ++elementIterator)
+ {
+ if (domainID==elementIterator->second.domainID)
+ listConvertersID.push_back(elementIterator->second.converterID);
+ }
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerMap::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
listMainConnections.clear();
@@ -1673,6 +1788,17 @@ am_Error_e CAmDatabaseHandlerMap::getListGateways(std::vector<am_Gateway_s> & li
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerMap::getListConverters(std::vector<am_Converter_s> & listConverters) const
+{
+ listConverters.clear();
+
+ std::for_each(mMappedData.mConverterMap.begin(), mMappedData.mConverterMap.end(), [&](const std::pair<am_converterID_t, am_Converter_s>& ref) {
+ listConverters.push_back(ref.second);
+ });
+
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerMap::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
listSinkClasses.clear();
@@ -1959,6 +2085,11 @@ bool CAmDatabaseHandlerMap::existGateway(const am_gatewayID_t gatewayID) const
return existsObjectWithKeyInMap(gatewayID, mMappedData.mGatewayMap);
}
+bool CAmDatabaseHandlerMap::existConverter(const am_converterID_t converterID) const
+{
+ return existsObjectWithKeyInMap(converterID, mMappedData.mConverterMap);
+}
+
am_Error_e CAmDatabaseHandlerMap::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
{
assert(sourceID!=0);
@@ -2141,7 +2272,7 @@ bool CAmDatabaseHandlerMap::existConnectionID(const am_connectionID_t connection
* @param crossfaderID the ID of the crossfader to be checked
* @return true if exists
*/
-bool CAmDatabaseHandlerMap::existcrossFader(const am_crossfaderID_t crossfaderID) const
+bool CAmDatabaseHandlerMap::existCrossFader(const am_crossfaderID_t crossfaderID) const
{
return existsObjectWithKeyInMap(crossfaderID, mMappedData.mCrossfaderMap);
}
@@ -2421,7 +2552,7 @@ am_Error_e CAmDatabaseHandlerMap::changeCrossFaderHotSink(const am_crossfaderID_
assert(crossfaderID!=0);
assert(hotsink!=HS_UNKNOWN);
- if (!existcrossFader(crossfaderID))
+ if (!existCrossFader(crossfaderID))
{
return (E_NON_EXISTENT);
}
@@ -2430,54 +2561,16 @@ am_Error_e CAmDatabaseHandlerMap::changeCrossFaderHotSink(const am_crossfaderID_
return (E_OK);
}
-am_Error_e CAmDatabaseHandlerMap::getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree)
+bool CAmDatabaseHandlerMap::isComponentConnected(const am_Gateway_s & gateway) const
{
- am_domainID_t rootID = tree.returnRootDomainID();
- CAmRoutingTreeItem *parent = tree.returnRootItem();
- size_t i = 0;
-
- do
- {
- if (i != 0)
- {
- parent = flatTree.at(i - 1);
- rootID = parent->returnDomainID();
- }
- std::for_each(mMappedData.mGatewayMap.begin(),mMappedData.mGatewayMap.end(), [&](const std::pair<am_gatewayID_t, am_Gateway_s>& refGateway) {
- if( rootID==refGateway.second.domainSinkID )
- {
- if(!onlyfree || std::find_if(mMappedData.mConnectionMap.begin(),
- mMappedData.mConnectionMap.end(),
- [&](const std::pair<am_connectionID_t, am_Connection_Database_s>& refConnection)
- {
- return (refConnection.second.sinkID == refGateway.second.sinkID ||
- refConnection.second.sourceID ==refGateway.second.sourceID);
- })==mMappedData.mConnectionMap.end() )
- {
- // additional check to avoid cyclic routes
- const am_domainID_t domainSourceID = refGateway.second.domainSourceID;
- bool sourceDomainAlreadyHandledAsSink = false;
- for (std::vector<CAmRoutingTreeItem*>::const_iterator iFT = flatTree.begin(); iFT != flatTree.end(); ++iFT)
- {
- if (domainSourceID == (*iFT)->returnParent()->returnDomainID())
- {
- sourceDomainAlreadyHandledAsSink = true;
- break;
- }
- }
-
- if (!sourceDomainAlreadyHandledAsSink)
- {
- // logInfo("DatabaseHandler::getRoutingTree ", rootID, ", ", domainSourceID, ", ", sqlite3_column_int(query, 1));
- flatTree.push_back(tree.insertItem(domainSourceID, refGateway.second.gatewayID, parent));
- }
- }
- }
- });
- i++;
- } while (flatTree.size() > (i - 1));
+ bool ret = isConnected(gateway);
+ return ret;
+}
- return (E_OK);
+bool CAmDatabaseHandlerMap::isComponentConnected(const am_Converter_s & converter) const
+{
+ bool ret = isConnected(converter);
+ return ret;
}
am_Error_e am::CAmDatabaseHandlerMap::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
@@ -2731,6 +2824,37 @@ am_Error_e CAmDatabaseHandlerMap::changeGatewayDB(const am_gatewayID_t gatewayID
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerMap::changeConverterDB(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
+{
+ assert(converterID!=0);
+
+ if (!existConverter(converterID))
+ {
+ return (E_NON_EXISTENT);
+ }
+
+ if (!listSourceConnectionFormats.empty())
+ {
+ mMappedData.mConverterMap.at(converterID).listSourceFormats = listSourceConnectionFormats;
+ }
+
+ if (!listSinkConnectionFormats.empty())
+ {
+ mMappedData.mConverterMap.at(converterID).listSinkFormats = listSinkConnectionFormats;
+ }
+
+ if (!convertionMatrix.empty())
+ {
+ mListConnectionFormat.clear();
+ mListConnectionFormat.insert(std::make_pair(converterID, convertionMatrix));
+ }
+
+ logInfo("DatabaseHandler::changeConverterDB changed Gateway with ID", converterID);
+
+ //todo: check if observer needs to be adopted.
+ return (E_OK);
+}
+
bool changeNotificationConfiguration(std::vector<am_NotificationConfiguration_s> & listNotificationConfigurations, const am_NotificationConfiguration_s & notificationConfiguration)
{
bool changed = false;
@@ -2782,4 +2906,46 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceNotificationConfigurationDB(const
return (E_NON_EXISTENT);
}
+am_Error_e CAmDatabaseHandlerMap::enumerateSources(std::function<void(const am_Source_s & element)> cb) const
+{
+ for(auto it = mMappedData.mSourceMap.begin(); it!=mMappedData.mSourceMap.end(); it++)
+ {
+ const am_Source_Database_s *pObject = &it->second;
+ if( 0==pObject->reserved )
+ cb(*pObject);
+ }
+ return E_OK;
+}
+
+am_Error_e CAmDatabaseHandlerMap::enumerateSinks(std::function<void(const am_Sink_s & element)> cb) const
+{
+ for(auto it = mMappedData.mSinkMap.begin(); it!=mMappedData.mSinkMap.end(); it++)
+ {
+ const am_Sink_Database_s *pObject = &it->second;
+ if( 0==pObject->reserved )
+ cb(*pObject);
+ }
+ return E_OK;
+}
+
+am_Error_e CAmDatabaseHandlerMap::enumerateGateways(std::function<void(const am_Gateway_s & element)> cb) const
+{
+ for(auto it = mMappedData.mGatewayMap.begin(); it!=mMappedData.mGatewayMap.end(); it++)
+ {
+ const am_Gateway_s *pObject = &it->second;
+ cb(*pObject);
+ }
+ return E_OK;
+}
+
+am_Error_e CAmDatabaseHandlerMap::enumerateConverters(std::function<void(const am_Converter_s & element)> cb) const
+{
+ for(auto it = mMappedData.mConverterMap.begin(); it!=mMappedData.mConverterMap.end(); it++)
+ {
+ const am_Converter_s *pObject = &it->second;
+ cb(*pObject);
+ }
+ return E_OK;
+}
+
}
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp b/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp
index 1390fc4..cb95ec6 100644
--- a/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseHandlerSQLite.cpp
@@ -104,6 +104,7 @@ namespace am
#define SOURCE_TABLE "Sources" //!< source table
#define SINK_TABLE "Sinks" //!< sink table
#define GATEWAY_TABLE "Gateways" //!< gateway table
+#define CONVERTER_TABLE "Converters" //!< converter table
#define CROSSFADER_TABLE "Crossfaders" //!< crossfader table
#define CONNECTION_TABLE "Connections" //!< connection table
#define MAINCONNECTION_TABLE "MainConnections" //!< main connection table
@@ -118,6 +119,7 @@ const std::string databaseTables[] =
" Sources (sourceID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, domainID INTEGER, name VARCHAR(50), sourceClassID INTEGER, sourceState INTEGER, volume INTEGER, visible BOOL, availability INTEGER, availabilityReason INTEGER, interruptState INTEGER, reserved BOOL);", //
" Sinks (sinkID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), domainID INTEGER, sinkClassID INTEGER, volume INTEGER, visible BOOL, availability INTEGER, availabilityReason INTEGER, muteState INTEGER, mainVolume INTEGER, reserved BOOL);", //
" Gateways (gatewayID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID INTEGER, sourceID INTEGER, domainSinkID INTEGER, domainSourceID INTEGER, controlDomainID INTEGER);", //
+ " Converters (converterID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID INTEGER, sourceID INTEGER, domainID INTEGER);", //
" Crossfaders (crossfaderID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID_A INTEGER, sinkID_B INTEGER, sourceID INTEGER, hotSink INTEGER);", //
" Connections (connectionID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, sourceID INTEGER, sinkID INTEGER, delay INTEGER, connectionFormat INTEGER, reserved BOOL);", //
" MainConnections (mainConnectionID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, sourceID INTEGER, sinkID INTEGER, connectionState INTEGER, delay INTEGER);", //
@@ -140,6 +142,7 @@ CAmDatabaseHandlerSQLite::CAmDatabaseHandlerSQLite():mpDatabaseObserver(NULL), /
mFirstStaticSink(true), //
mFirstStaticSource(true), //
mFirstStaticGateway(true), //
+ mFirstStaticConverter(true),
mFirstStaticSinkClass(true), //
mFirstStaticSourceClass(true), //
mFirstStaticCrossfader(true), //
@@ -154,6 +157,7 @@ CAmDatabaseHandlerSQLite::CAmDatabaseHandlerSQLite(std::string databasePath):mpD
mFirstStaticSink(true), //
mFirstStaticSource(true), //
mFirstStaticGateway(true), //
+ mFirstStaticConverter(true),
mFirstStaticSinkClass(true), //
mFirstStaticSourceClass(true), //
mFirstStaticCrossfader(true), //
@@ -582,7 +586,7 @@ am_Error_e CAmDatabaseHandlerSQLite::enterCrossfaderDB(const am_Crossfader_s & c
else
{
//check if the ID already exists
- if (existcrossFader(crossfaderData.crossfaderID))
+ if (existCrossFader(crossfaderData.crossfaderID))
return (E_ALREADY_EXISTS);
command = "INSERT INTO " + std::string(CROSSFADER_TABLE) + "(name, sinkID_A, sinkID_B, sourceID, hotSink, crossfaderID) VALUES (?,?,?,?,?,?)";
}
@@ -760,6 +764,119 @@ am_Error_e CAmDatabaseHandlerSQLite::enterGatewayDB(const am_Gateway_s & gateway
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerSQLite::enterConverterDB(const am_Converter_s & converterData, am_converterID_t & converterID)
+{
+ assert(converterData.converterID<DYNAMIC_ID_BOUNDARY);
+ assert(converterData.sinkID!=0);
+ assert(converterData.sourceID!=0);
+ assert(converterData.domainID!=0);
+ assert(!converterData.name.empty());
+ assert(!converterData.convertionMatrix.empty());
+ assert(!converterData.listSinkFormats.empty());
+ assert(!converterData.listSourceFormats.empty());
+
+ //might be that the sinks and sources are not there during registration time
+ //assert(existSink(gatewayData.sinkID));
+ //assert(existSource(gatewayData.sourceID));
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+
+ //if gatewayData is zero and the first Static Sink was already entered, the ID is created
+ if (converterData.converterID == 0 && !mFirstStaticConverter)
+ {
+ command = "INSERT INTO " + std::string(CONVERTER_TABLE) + "(name, sinkID, sourceID, domainID) VALUES (?,?,?,?)";
+ }
+ else
+ {
+ //check if the ID already exists
+ if (existConverter(converterData.converterID))
+ return (E_ALREADY_EXISTS);
+ command = "INSERT INTO " + std::string(CONVERTER_TABLE) + "(name, sinkID, sourceID, domainID, converterID) VALUES (?,?,?,?,?)";
+ }
+
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+ MY_SQLITE_BIND_TEXT(query, 1, converterData.name.c_str(), converterData.name.size(), SQLITE_STATIC)
+ MY_SQLITE_BIND_INT(query, 2, converterData.sinkID)
+ MY_SQLITE_BIND_INT(query, 3, converterData.sourceID)
+ MY_SQLITE_BIND_INT(query, 4, converterData.domainID)
+
+ //if the ID is not created, we add it to the query
+ if (converterData.converterID != 0)
+ {
+ MY_SQLITE_BIND_INT(query, 5, converterData.converterID)
+ }
+
+ //if the first static sink is entered, we need to set it onto the boundary
+ else if (mFirstStaticConverter)
+ {
+ MY_SQLITE_BIND_INT(query, 5, DYNAMIC_ID_BOUNDARY)
+ mFirstStaticConverter = false;
+ }
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+
+ MY_SQLITE_FINALIZE(query)
+
+ converterID = sqlite3_last_insert_rowid(mpDatabase);
+
+ //now the convertion matrix todo: change the map implementation sometimes to blob in sqlite
+ mListConnectionFormat.insert(std::make_pair(converterID, converterData.convertionMatrix));
+
+ command = "CREATE TABLE ConverterSourceFormat" + i2s(converterID) + std::string("(soundFormat INTEGER)");
+ if (!this->sqQuery(command))
+ return (E_DATABASE_ERROR);
+ command = "CREATE TABLE ConverterSinkFormat" + i2s(converterID) + std::string("(soundFormat INTEGER)");
+ if (!this->sqQuery(command))
+ return (E_DATABASE_ERROR);
+
+ //fill ConnectionFormats
+ command = "INSERT INTO ConverterSourceFormat" + i2s(converterID) + std::string("(soundFormat) VALUES (?)");
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+ std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = converterData.listSourceFormats.begin();
+ for (; connectionFormatIterator < converterData.listSourceFormats.end(); ++connectionFormatIterator)
+ {
+ MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+ MY_SQLITE_RESET(query)
+ }
+ MY_SQLITE_FINALIZE(query)
+
+ command = "INSERT INTO ConverterSinkFormat" + i2s(converterID) + std::string("(soundFormat) VALUES (?)");
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+ connectionFormatIterator = converterData.listSinkFormats.begin();
+ for (; connectionFormatIterator < converterData.listSinkFormats.end(); ++connectionFormatIterator)
+ {
+ MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+ MY_SQLITE_RESET(query)
+ }
+ MY_SQLITE_FINALIZE(query)
+
+ logInfo("DatabaseHandler::enterConverterDB entered new gateway with name", converterData.name, "sourceID:", converterData.sourceID, "sinkID:", converterData.sinkID, "assigned ID:", converterID);
+ am_Converter_s converter = converterData;
+ converter.converterID = converterID;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->newConverter(converter);
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerSQLite::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
assert(sourceData.sourceID<DYNAMIC_ID_BOUNDARY);
@@ -1438,11 +1555,28 @@ am_Error_e CAmDatabaseHandlerSQLite::removeGatewayDB(const am_gatewayID_t gatewa
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerSQLite::removeConverterDB(const am_converterID_t converterID)
+{
+ assert(converterID!=0);
+
+ if (!existConverter(converterID))
+ {
+ return (E_NON_EXISTENT);
+ }
+ std::string command = "DELETE from " + std::string(CONVERTER_TABLE) + " WHERE converterID=" + i2s(converterID);
+ if (!sqQuery(command))
+ return (E_DATABASE_ERROR);
+ logInfo("DatabaseHandler::removeConverterDB removed:", converterID);
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->removeConverter(converterID);
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerSQLite::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
assert(crossfaderID!=0);
- if (!existcrossFader(crossfaderID))
+ if (!existCrossFader(crossfaderID))
{
return (E_NON_EXISTENT);
}
@@ -2061,10 +2195,79 @@ am_Error_e CAmDatabaseHandlerSQLite::getGatewayInfoDB(const am_gatewayID_t gatew
}
+am_Error_e CAmDatabaseHandlerSQLite::getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) const
+{
+ assert(converterID!=0);
+ if (!existConverter(converterID))
+ {
+ return (E_NON_EXISTENT);
+ }
+ sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
+ int eCode = 0;
+ am_CustomConnectionFormat_t tempConnectionFormat;
+ std::string command = "SELECT name, sinkID, sourceID, domainID, converterID FROM " + std::string(CONVERTER_TABLE) + " WHERE converterID=" + i2s(converterID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ converterData.name = std::string((const char*) sqlite3_column_text(query, 0));
+ converterData.sinkID = sqlite3_column_int(query, 1);
+ converterData.sourceID = sqlite3_column_int(query, 2);
+ converterData.domainID = sqlite3_column_int(query, 3);
+ converterData.converterID = sqlite3_column_int(query, 4);
+
+ //convertionMatrix:
+ ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
+ iter = mListConnectionFormat.find(converterData.converterID);
+ if (iter == mListConnectionFormat.end())
+ {
+ logError("DatabaseHandler::getConverterInfoDB database error with convertionFormat");
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+ converterData.convertionMatrix = iter->second;
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM ConverterSourceFormat" + i2s(converterData.converterID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL)
+ while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSourceConnectionFormat, 0);
+ converterData.listSourceFormats.push_back(tempConnectionFormat);
+ }
+
+ MY_SQLITE_FINALIZE(qSourceConnectionFormat)
+
+ //read out sound properties
+ commandConnectionFormat = "SELECT soundFormat FROM ConverterSinkFormat" + i2s(converterData.converterID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL)
+ while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSinkConnectionFormat, 0);
+ converterData.listSinkFormats.push_back(tempConnectionFormat);
+ }
+
+ MY_SQLITE_FINALIZE(qSinkConnectionFormat)
+
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getConverterInfoDB SQLITE error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+
+ MY_SQLITE_FINALIZE(query)
+
+ return (E_OK);
+
+}
+
am_Error_e CAmDatabaseHandlerSQLite::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
assert(crossfaderID!=0);
- if (!existcrossFader(crossfaderID))
+ if (!existCrossFader(crossfaderID))
{
return (E_NON_EXISTENT);
}
@@ -2226,6 +2429,39 @@ am_Error_e CAmDatabaseHandlerSQLite::getListGatewaysOfDomain(const am_domainID_t
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerSQLite::getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConvertersID) const
+{
+ assert(domainID!=0);
+ listConvertersID.clear();
+ if (!existDomain(domainID))
+ {
+ return (E_NON_EXISTENT);
+ }
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_gatewayID_t temp;
+
+ std::string command = "SELECT converterID FROM " + std::string(CONVERTER_TABLE) + " WHERE domainID=" + i2s(domainID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp = sqlite3_column_int(query, 0);
+ listConvertersID.push_back(temp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getListConvertersOfDomain SQLITE error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+
+ MY_SQLITE_FINALIZE(query)
+
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerSQLite::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
listMainConnections.clear();
@@ -2332,217 +2568,13 @@ am_Error_e CAmDatabaseHandlerSQLite::getListConnections(std::vector<am_Connectio
am_Error_e CAmDatabaseHandlerSQLite::getListSinks(std::vector<am_Sink_s> & listSinks) const
{
listSinks.clear();
- sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qNotificationConfiguration= NULL, *qMAinSoundProperty = NULL, *qMainNotificationConfiguration= NULL;
- int eCode = 0;
- am_Sink_s temp;
- am_CustomConnectionFormat_t tempConnectionFormat;
- am_SoundProperty_s tempSoundProperty;
- am_MainSoundProperty_s tempMainSoundProperty;
- am_NotificationConfiguration_s tempNotificationConfiguration;
- am_NotificationConfiguration_s tempMainNotificationConfiguration;
- std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.domainID = sqlite3_column_int(query, 1);
- temp.sinkClassID = sqlite3_column_int(query, 2);
- temp.volume = sqlite3_column_int(query, 3);
- temp.visible = sqlite3_column_int(query, 4);
- temp.available.availability = (am_Availability_e) sqlite3_column_int(query, 5);
- temp.available.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 6);
- temp.muteState = (am_MuteState_e) sqlite3_column_int(query, 7);
- temp.mainVolume = sqlite3_column_int(query, 8);
- temp.sinkID = sqlite3_column_int(query, 9);
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
- temp.listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qConnectionFormat)
-
- //read out sound properties
- std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL)
- while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
- {
- tempSoundProperty.type = (am_CustomSoundPropertyType_t) sqlite3_column_int(qSoundProperty, 0);
- tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
- temp.listSoundProperties.push_back(tempSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qSoundProperty)
-
- //read out notifications
- std::string commandNotificationConfiguration = "SELECT type, status, parameter FROM SinkNotificationConfiguration" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandNotificationConfiguration.c_str(), -1, &qNotificationConfiguration, NULL)
- while ((eCode = sqlite3_step(qNotificationConfiguration)) == SQLITE_ROW)
- {
- tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t> (sqlite3_column_int(qNotificationConfiguration, 0));
- tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e> (sqlite3_column_int(qNotificationConfiguration, 1));
- tempNotificationConfiguration.parameter = static_cast<int16_t> (sqlite3_column_int(qNotificationConfiguration, 2));
- temp.listNotificationConfigurations.push_back(tempNotificationConfiguration);
- }
-
- MY_SQLITE_FINALIZE(qNotificationConfiguration)
-
- //read out MainSoundProperties if sink is visible
- if(temp.visible)
- {
- std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL)
- while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
- {
- tempMainSoundProperty.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(qMAinSoundProperty, 0);
- tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
- temp.listMainSoundProperties.push_back(tempMainSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qMAinSoundProperty)
-
- //and mainNotificationConfigurations
- std::string commandMainNotificationConfiguration = "SELECT type, status, parameter FROM SinkMainNotificationConfiguration" + i2s(temp.sinkID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandMainNotificationConfiguration.c_str(), -1, &qMainNotificationConfiguration, NULL)
- while ((eCode = sqlite3_step(qMainNotificationConfiguration)) == SQLITE_ROW)
- {
- tempMainNotificationConfiguration.type = static_cast <am_CustomNotificationType_t> (sqlite3_column_int(qMainNotificationConfiguration, 0));
- tempMainNotificationConfiguration.status = static_cast <am_NotificationStatus_e> (sqlite3_column_int(qMainNotificationConfiguration, 1));
- tempMainNotificationConfiguration.parameter = static_cast <uint16_t>(sqlite3_column_int(qMainNotificationConfiguration, 2));
- temp.listMainNotificationConfigurations.push_back(tempMainNotificationConfiguration);
- }
-
- MY_SQLITE_FINALIZE(qMainNotificationConfiguration)
- }
-
- listSinks.push_back(temp);
- temp.listConnectionFormats.clear();
- temp.listMainSoundProperties.clear();
- temp.listSoundProperties.clear();
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSinks SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
+ return enumerateSinks([&](const am_Sink_s & sink){ listSinks.push_back(sink);});
}
am_Error_e CAmDatabaseHandlerSQLite::getListSources(std::vector<am_Source_s> & listSources) const
{
listSources.clear();
- sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL, *qNotification(NULL), *qMainNotification(NULL);
- int eCode = 0;
- am_Source_s temp;
- am_CustomConnectionFormat_t tempConnectionFormat;
- am_SoundProperty_s tempSoundProperty;
- am_MainSoundProperty_s tempMainSoundProperty;
- am_NotificationConfiguration_s tempNotificationConfiguration;
- std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0";
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.domainID = sqlite3_column_int(query, 1);
- temp.sourceClassID = sqlite3_column_int(query, 2);
- temp.sourceState = (am_SourceState_e) sqlite3_column_int(query, 3);
- temp.volume = sqlite3_column_int(query, 4);
- temp.visible = sqlite3_column_int(query, 5);
- temp.available.availability = (am_Availability_e) sqlite3_column_int(query, 6);
- temp.available.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 7);
- temp.interruptState = (am_InterruptState_e) sqlite3_column_int(query, 8);
- temp.sourceID = sqlite3_column_int(query, 9);
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
- temp.listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qConnectionFormat)
-
- //read out sound properties
- std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL)
- while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
- {
- tempSoundProperty.type = (am_CustomSoundPropertyType_t) sqlite3_column_int(qSoundProperty, 0);
- tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
- temp.listSoundProperties.push_back(tempSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qSoundProperty)
-
- std::string notificationCommand = "SELECT type, status, parameter FROM SourceNotificationConfiguration" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, notificationCommand.c_str(), -1, &qNotification, NULL)
-
- while ((eCode = sqlite3_step(qNotification)) == SQLITE_ROW)
- {
- tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qNotification, 0));
- tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qNotification, 1));
- tempNotificationConfiguration.parameter= static_cast<int16_t>(sqlite3_column_int(qNotification, 2));
- temp.listNotificationConfigurations.push_back(tempNotificationConfiguration);
- }
- MY_SQLITE_FINALIZE(qNotification)
-
- //read out MainSoundProperties if source is visible
- if(temp.visible)
- {
- std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL)
- while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
- {
- tempMainSoundProperty.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(qMAinSoundProperty, 0);
- tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
- temp.listMainSoundProperties.push_back(tempMainSoundProperty);
- }
-
- MY_SQLITE_FINALIZE(qMAinSoundProperty)
-
- std::string mainNotificationCommand = "SELECT type, status, parameter FROM SourceMainNotificationConfiguration" + i2s(temp.sourceID);
- MY_SQLITE_PREPARE_V2(mpDatabase, mainNotificationCommand.c_str(), -1, &qMainNotification, NULL)
-
- while ((eCode = sqlite3_step(qMainNotification)) == SQLITE_ROW)
- {
- tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qMainNotification, 0));
- tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qMainNotification, 1));
- tempNotificationConfiguration.parameter= static_cast<int16_t>(sqlite3_column_int(qMainNotification, 2));
- temp.listMainNotificationConfigurations.push_back(tempNotificationConfiguration);
- }
- MY_SQLITE_FINALIZE(qMainNotification)
- }
-
-
- listSources.push_back(temp);
- temp.listConnectionFormats.clear();
- temp.listMainSoundProperties.clear();
- temp.listSoundProperties.clear();
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListSources SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
-
- return (E_OK);
+ return enumerateSources([&](const am_Source_s & source){ listSources.push_back(source);});
}
am_Error_e CAmDatabaseHandlerSQLite::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
@@ -2634,72 +2666,13 @@ am_Error_e CAmDatabaseHandlerSQLite::getListCrossfaders(std::vector<am_Crossfade
am_Error_e CAmDatabaseHandlerSQLite::getListGateways(std::vector<am_Gateway_s> & listGateways) const
{
listGateways.clear();
- sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
- int eCode = 0;
- am_Gateway_s temp;
- am_CustomConnectionFormat_t tempConnectionFormat;
-
- std::string command = "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE);
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- temp.name = std::string((const char*) sqlite3_column_text(query, 0));
- temp.sinkID = sqlite3_column_int(query, 1);
- temp.sourceID = sqlite3_column_int(query, 2);
- temp.domainSinkID = sqlite3_column_int(query, 3);
- temp.domainSourceID = sqlite3_column_int(query, 4);
- temp.controlDomainID = sqlite3_column_int(query, 5);
- temp.gatewayID = sqlite3_column_int(query, 6);
-
- //convertionMatrix:
- ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
- iter = mListConnectionFormat.find(temp.gatewayID);
- if (iter == mListConnectionFormat.end())
- {
- logError("DatabaseHandler::getListGateways database error with convertionFormat");
-
- return (E_DATABASE_ERROR);
- }
- temp.convertionMatrix = iter->second;
-
- //read out the connectionFormats
- std::string commandConnectionFormat = "SELECT soundFormat FROM GatewaySourceFormat" + i2s(temp.gatewayID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSourceConnectionFormat, 0);
- temp.listSourceFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSourceConnectionFormat)
-
- //read out sound properties
- commandConnectionFormat = "SELECT soundFormat FROM GatewaySinkFormat" + i2s(temp.gatewayID);
- MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL)
- while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
- {
- tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSinkConnectionFormat, 0);
- temp.listSinkFormats.push_back(tempConnectionFormat);
- }
-
- MY_SQLITE_FINALIZE(qSinkConnectionFormat)
-
- listGateways.push_back(temp);
- temp.listSinkFormats.clear();
- temp.listSourceFormats.clear();
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getListGateways SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
+ return enumerateGateways([&](const am_Gateway_s & gateway){ listGateways.push_back(gateway);});
+}
- return (E_OK);
+am_Error_e CAmDatabaseHandlerSQLite::getListConverters(std::vector<am_Converter_s> & listConverters) const
+{
+ listConverters.clear();
+ return enumerateConverters([&](const am_Converter_s & converter){ listConverters.push_back(converter);});
}
am_Error_e CAmDatabaseHandlerSQLite::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
@@ -3001,6 +2974,21 @@ am_Error_e am::CAmDatabaseHandlerSQLite::getListGatewayConnectionFormats(const a
return (E_OK);
}
+am_Error_e am::CAmDatabaseHandlerSQLite::getListConverterConnectionFormats(const am_converterID_t converterID, std::vector<bool> & listConnectionFormat) const
+{
+ ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
+ iter = mListConnectionFormat.find(converterID);
+ if (iter == mListConnectionFormat.end())
+ {
+ logError("DatabaseHandler::getListConverterConnectionFormats database error with convertionFormat");
+
+ return (E_DATABASE_ERROR);
+ }
+ listConnectionFormat = iter->second;
+
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerSQLite::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
{
assert(mainConnectionID!=0);
@@ -3573,6 +3561,26 @@ bool CAmDatabaseHandlerSQLite::existGateway(const am_gatewayID_t gatewayID) cons
return (returnVal);
}
+bool CAmDatabaseHandlerSQLite::existConverter(const am_converterID_t converterID) const
+{
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT converterID FROM " + std::string(CONVERTER_TABLE) + " WHERE converterID=" + i2s(converterID);
+ int eCode = 0;
+ bool returnVal = true;
+ MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ logError("DatabaseHandler::existConverter database error!:", eCode);
+ }
+
+ MY_SQLITE_FINALIZE_BOOL(query)
+ return (returnVal);
+}
+
am_Error_e CAmDatabaseHandlerSQLite::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
{
assert(sourceID!=0);
@@ -3928,7 +3936,7 @@ bool CAmDatabaseHandlerSQLite::existConnectionID(const am_connectionID_t connect
* @param crossfaderID the ID of the crossfader to be checked
* @return true if exists
*/
-bool CAmDatabaseHandlerSQLite::existcrossFader(const am_crossfaderID_t crossfaderID) const
+bool CAmDatabaseHandlerSQLite::existCrossFader(const am_crossfaderID_t crossfaderID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=?";
@@ -4367,7 +4375,7 @@ am_Error_e CAmDatabaseHandlerSQLite::changeCrossFaderHotSink(const am_crossfader
int eCode = 0;
std::string command;
- if (!existcrossFader(crossfaderID))
+ if (!existCrossFader(crossfaderID))
{
return (E_NON_EXISTENT);
}
@@ -4385,63 +4393,53 @@ am_Error_e CAmDatabaseHandlerSQLite::changeCrossFaderHotSink(const am_crossfader
return (E_OK);
}
-am_Error_e CAmDatabaseHandlerSQLite::getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree)
+bool CAmDatabaseHandlerSQLite::isComponentConnected(const am_Gateway_s & gateway) const
{
- sqlite3_stmt* query = NULL;
- int eCode = 0;
- size_t i = 0;
- std::string command;
- am_domainID_t rootID = tree.returnRootDomainID();
- CAmRoutingTreeItem *parent = tree.returnRootItem();
-
- if (onlyfree)
- {
- command = "SELECT g.domainSourceID,g.gatewayID FROM " + std::string(GATEWAY_TABLE) + " g WHERE domainSinkID=? AND NOT EXISTS (SELECT NULL FROM " + std::string(CONNECTION_TABLE) + " c WHERE c.sinkID = g.sinkID OR c.sourceID = g.sourceID )";
- }
- else
- {
- command = "SELECT domainSourceID,gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE domainSinkID=?";
- }
-
- do
- {
- if (i != 0)
- {
- parent = flatTree.at(i - 1);
- rootID = parent->returnDomainID();
- }
- MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
- MY_SQLITE_BIND_INT(query, 1, rootID)
-
- while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
- {
- // additional check to avoid cyclic routes
- const am_domainID_t domainSourceID = sqlite3_column_int(query, 0);
- bool sourceDomainAlreadyHandledAsSink = false;
- for (std::vector<CAmRoutingTreeItem*>::const_iterator iFT = flatTree.begin(); iFT != flatTree.end(); ++iFT)
- {
- if (domainSourceID == (*iFT)->returnParent()->returnDomainID()) sourceDomainAlreadyHandledAsSink = true;
- }
-
- if (!sourceDomainAlreadyHandledAsSink)
- {
- // logInfo("DatabaseHandler::getRoutingTree ", rootID, ", ", domainSourceID, ", ", sqlite3_column_int(query, 1));
- flatTree.push_back(tree.insertItem(domainSourceID, sqlite3_column_int(query, 1), parent));
- }
- }
-
- if (eCode != SQLITE_DONE)
- {
- logError("DatabaseHandler::getRoutingTree SQLITE error code:", eCode);
- MY_SQLITE_FINALIZE(query)
- return (E_DATABASE_ERROR);
- }
-
- MY_SQLITE_FINALIZE(query)
- i++;
- } while (flatTree.size() > (i - 1));
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+ bool returnVal = true;
+ command = "SELECT 1 FROM " + std::string(CONNECTION_TABLE) + " c WHERE c.sinkID = ? OR c.sourceID = ?";
+
+ MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
+ MY_SQLITE_BIND_INT(query, 1, gateway.sinkID)
+ MY_SQLITE_BIND_INT(query, 2, gateway.sourceID)
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ returnVal = false;
+ }
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ logError("DatabaseHandler::isComponentConnected database error!:", eCode);
+ }
+ MY_SQLITE_FINALIZE(query)
+ return returnVal;
+}
- return (E_OK);
+bool CAmDatabaseHandlerSQLite::isComponentConnected(const am_Converter_s & converter) const
+{
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+ bool returnVal = true;
+ command = "SELECT 1 FROM " + std::string(CONNECTION_TABLE) + " c WHERE c.sinkID = ? OR c.sourceID = ?";
+
+ MY_SQLITE_PREPARE_V2_BOOL(mpDatabase, command.c_str(), -1, &query, NULL)
+ MY_SQLITE_BIND_INT(query, 1, converter.sinkID)
+ MY_SQLITE_BIND_INT(query, 2, converter.sourceID)
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ returnVal = false;
+ }
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ logError("DatabaseHandler::isComponentConnected database error!:", eCode);
+ }
+ MY_SQLITE_FINALIZE(query)
+
+ return returnVal;
}
am_Error_e am::CAmDatabaseHandlerSQLite::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
@@ -4979,6 +4977,80 @@ am_Error_e CAmDatabaseHandlerSQLite::changeGatewayDB(const am_gatewayID_t gatewa
return (E_OK);
}
+am_Error_e CAmDatabaseHandlerSQLite::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)
+{
+ assert(converterID!=0);
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+
+ if (!existConverter(converterID))
+ {
+ return (E_NON_EXISTENT);
+ }
+
+ if (!listSourceConnectionFormats.empty())
+ {
+ //clear Database
+ command = "DELETE from ConverterSourceFormat" + i2s(converterID);
+ if (!sqQuery(command))
+ return (E_DATABASE_ERROR);
+
+ //fill ConnectionFormats
+ command = "INSERT INTO ConverterSourceFormat" + i2s(converterID) + std::string("(soundFormat) VALUES (?)");
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+ std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = listSourceConnectionFormats.begin();
+ for (; connectionFormatIterator < listSourceConnectionFormats.end(); ++connectionFormatIterator)
+ {
+ MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+ MY_SQLITE_RESET(query)
+ }
+ MY_SQLITE_FINALIZE(query)
+ }
+
+ if (!listSinkConnectionFormats.empty())
+ {
+ //clear Database
+ command = "DELETE from ConverterSinkFormat" + i2s(converterID);
+ if (!sqQuery(command))
+ return (E_DATABASE_ERROR);
+
+ command = "INSERT INTO ConverterSinkFormat" + i2s(converterID) + std::string("(soundFormat) VALUES (?)");
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+ std::vector<am_CustomConnectionFormat_t>::const_iterator connectionFormatIterator = listSinkConnectionFormats.begin();
+ for (; connectionFormatIterator < listSinkConnectionFormats.end(); ++connectionFormatIterator)
+ {
+ MY_SQLITE_BIND_INT(query, 1, *connectionFormatIterator)
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::enterConverterDB SQLITE Step error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+ MY_SQLITE_RESET(query)
+ }
+ MY_SQLITE_FINALIZE(query)
+ }
+
+ if (!convertionMatrix.empty())
+ {
+ mListConnectionFormat.clear();
+ mListConnectionFormat.insert(std::make_pair(converterID, convertionMatrix));
+ }
+
+ logInfo("DatabaseHandler::changeConverterDB changed Gateway with ID", converterID);
+
+ //todo: check if observer needs to be adopted.
+ return (E_OK);
+}
+
am_Error_e CAmDatabaseHandlerSQLite::changeSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration)
{
assert(sinkID!=0);
@@ -5048,4 +5120,355 @@ void CAmDatabaseHandlerSQLite::createTables()
}
}
+am_Error_e CAmDatabaseHandlerSQLite::enumerateSources(std::function<void(const am_Source_s & element)> cb) const
+{
+ sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL, *qNotification(NULL), *qMainNotification(NULL);
+ int eCode = 0;
+ am_Source_s temp;
+ am_CustomConnectionFormat_t tempConnectionFormat;
+ am_SoundProperty_s tempSoundProperty;
+ am_MainSoundProperty_s tempMainSoundProperty;
+ am_NotificationConfiguration_s tempNotificationConfiguration;
+ std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0";
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.domainID = sqlite3_column_int(query, 1);
+ temp.sourceClassID = sqlite3_column_int(query, 2);
+ temp.sourceState = (am_SourceState_e) sqlite3_column_int(query, 3);
+ temp.volume = sqlite3_column_int(query, 4);
+ temp.visible = sqlite3_column_int(query, 5);
+ temp.available.availability = (am_Availability_e) sqlite3_column_int(query, 6);
+ temp.available.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 7);
+ temp.interruptState = (am_InterruptState_e) sqlite3_column_int(query, 8);
+ temp.sourceID = sqlite3_column_int(query, 9);
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(temp.sourceID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
+ while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
+ temp.listConnectionFormats.push_back(tempConnectionFormat);
+ }
+
+ MY_SQLITE_FINALIZE(qConnectionFormat)
+
+ //read out sound properties
+ std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(temp.sourceID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL)
+ while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
+ {
+ tempSoundProperty.type = (am_CustomSoundPropertyType_t) sqlite3_column_int(qSoundProperty, 0);
+ tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
+ temp.listSoundProperties.push_back(tempSoundProperty);
+ }
+
+ MY_SQLITE_FINALIZE(qSoundProperty)
+
+ std::string notificationCommand = "SELECT type, status, parameter FROM SourceNotificationConfiguration" + i2s(temp.sourceID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, notificationCommand.c_str(), -1, &qNotification, NULL)
+
+ while ((eCode = sqlite3_step(qNotification)) == SQLITE_ROW)
+ {
+ tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qNotification, 0));
+ tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qNotification, 1));
+ tempNotificationConfiguration.parameter= static_cast<int16_t>(sqlite3_column_int(qNotification, 2));
+ temp.listNotificationConfigurations.push_back(tempNotificationConfiguration);
+ }
+ MY_SQLITE_FINALIZE(qNotification)
+
+ //read out MainSoundProperties if source is visible
+ if(temp.visible)
+ {
+ std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(temp.sourceID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL)
+ while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
+ {
+ tempMainSoundProperty.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(qMAinSoundProperty, 0);
+ tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
+ temp.listMainSoundProperties.push_back(tempMainSoundProperty);
+ }
+
+ MY_SQLITE_FINALIZE(qMAinSoundProperty)
+
+ std::string mainNotificationCommand = "SELECT type, status, parameter FROM SourceMainNotificationConfiguration" + i2s(temp.sourceID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, mainNotificationCommand.c_str(), -1, &qMainNotification, NULL)
+
+ while ((eCode = sqlite3_step(qMainNotification)) == SQLITE_ROW)
+ {
+ tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t>(sqlite3_column_int(qMainNotification, 0));
+ tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e>(sqlite3_column_int(qMainNotification, 1));
+ tempNotificationConfiguration.parameter= static_cast<int16_t>(sqlite3_column_int(qMainNotification, 2));
+ temp.listMainNotificationConfigurations.push_back(tempNotificationConfiguration);
+ }
+ MY_SQLITE_FINALIZE(qMainNotification)
+ }
+
+
+ cb(temp);
+ temp.listConnectionFormats.clear();
+ temp.listMainSoundProperties.clear();
+ temp.listSoundProperties.clear();
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getListSources SQLITE error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+
+ MY_SQLITE_FINALIZE(query)
+
+ return (E_OK);
+}
+
+am_Error_e CAmDatabaseHandlerSQLite::enumerateSinks(std::function<void(const am_Sink_s & element)> cb) const
+{
+ sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qNotificationConfiguration= NULL, *qMAinSoundProperty = NULL, *qMainNotificationConfiguration= NULL;
+ int eCode = 0;
+ am_Sink_s temp;
+ am_CustomConnectionFormat_t tempConnectionFormat;
+ am_SoundProperty_s tempSoundProperty;
+ am_MainSoundProperty_s tempMainSoundProperty;
+ am_NotificationConfiguration_s tempNotificationConfiguration;
+ am_NotificationConfiguration_s tempMainNotificationConfiguration;
+ std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0";
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.domainID = sqlite3_column_int(query, 1);
+ temp.sinkClassID = sqlite3_column_int(query, 2);
+ temp.volume = sqlite3_column_int(query, 3);
+ temp.visible = sqlite3_column_int(query, 4);
+ temp.available.availability = (am_Availability_e) sqlite3_column_int(query, 5);
+ temp.available.availabilityReason = (am_CustomAvailabilityReason_t) sqlite3_column_int(query, 6);
+ temp.muteState = (am_MuteState_e) sqlite3_column_int(query, 7);
+ temp.mainVolume = sqlite3_column_int(query, 8);
+ temp.sinkID = sqlite3_column_int(query, 9);
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(temp.sinkID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL)
+ while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qConnectionFormat, 0);
+ temp.listConnectionFormats.push_back(tempConnectionFormat);
+ }
+
+ MY_SQLITE_FINALIZE(qConnectionFormat)
+
+ //read out sound properties
+ std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(temp.sinkID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL)
+ while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
+ {
+ tempSoundProperty.type = (am_CustomSoundPropertyType_t) sqlite3_column_int(qSoundProperty, 0);
+ tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
+ temp.listSoundProperties.push_back(tempSoundProperty);
+ }
+
+ MY_SQLITE_FINALIZE(qSoundProperty)
+
+ //read out notifications
+ std::string commandNotificationConfiguration = "SELECT type, status, parameter FROM SinkNotificationConfiguration" + i2s(temp.sinkID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandNotificationConfiguration.c_str(), -1, &qNotificationConfiguration, NULL)
+ while ((eCode = sqlite3_step(qNotificationConfiguration)) == SQLITE_ROW)
+ {
+ tempNotificationConfiguration.type = static_cast<am_CustomNotificationType_t> (sqlite3_column_int(qNotificationConfiguration, 0));
+ tempNotificationConfiguration.status = static_cast<am_NotificationStatus_e> (sqlite3_column_int(qNotificationConfiguration, 1));
+ tempNotificationConfiguration.parameter = static_cast<int16_t> (sqlite3_column_int(qNotificationConfiguration, 2));
+ temp.listNotificationConfigurations.push_back(tempNotificationConfiguration);
+ }
+
+ MY_SQLITE_FINALIZE(qNotificationConfiguration)
+
+ //read out MainSoundProperties if sink is visible
+ if(temp.visible)
+ {
+ std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(temp.sinkID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL)
+ while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
+ {
+ tempMainSoundProperty.type = (am_CustomMainSoundPropertyType_t) sqlite3_column_int(qMAinSoundProperty, 0);
+ tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
+ temp.listMainSoundProperties.push_back(tempMainSoundProperty);
+ }
+
+ MY_SQLITE_FINALIZE(qMAinSoundProperty)
+
+ //and mainNotificationConfigurations
+ std::string commandMainNotificationConfiguration = "SELECT type, status, parameter FROM SinkMainNotificationConfiguration" + i2s(temp.sinkID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandMainNotificationConfiguration.c_str(), -1, &qMainNotificationConfiguration, NULL)
+ while ((eCode = sqlite3_step(qMainNotificationConfiguration)) == SQLITE_ROW)
+ {
+ tempMainNotificationConfiguration.type = static_cast <am_CustomNotificationType_t> (sqlite3_column_int(qMainNotificationConfiguration, 0));
+ tempMainNotificationConfiguration.status = static_cast <am_NotificationStatus_e> (sqlite3_column_int(qMainNotificationConfiguration, 1));
+ tempMainNotificationConfiguration.parameter = static_cast <uint16_t>(sqlite3_column_int(qMainNotificationConfiguration, 2));
+ temp.listMainNotificationConfigurations.push_back(tempMainNotificationConfiguration);
+ }
+
+ MY_SQLITE_FINALIZE(qMainNotificationConfiguration)
+ }
+
+ cb(temp);
+ temp.listConnectionFormats.clear();
+ temp.listMainSoundProperties.clear();
+ temp.listSoundProperties.clear();
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getListSinks SQLITE error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+
+ MY_SQLITE_FINALIZE(query)
+ return (E_OK);
+}
+
+am_Error_e CAmDatabaseHandlerSQLite::enumerateGateways(std::function<void(const am_Gateway_s & element)> cb) const
+{
+ sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
+ int eCode = 0;
+ am_Gateway_s temp;
+ am_CustomConnectionFormat_t tempConnectionFormat;
+
+ std::string command = "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE);
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.sinkID = sqlite3_column_int(query, 1);
+ temp.sourceID = sqlite3_column_int(query, 2);
+ temp.domainSinkID = sqlite3_column_int(query, 3);
+ temp.domainSourceID = sqlite3_column_int(query, 4);
+ temp.controlDomainID = sqlite3_column_int(query, 5);
+ temp.gatewayID = sqlite3_column_int(query, 6);
+
+ //convertionMatrix:
+ ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
+ iter = mListConnectionFormat.find(temp.gatewayID);
+ if (iter == mListConnectionFormat.end())
+ {
+ logError("DatabaseHandler::getListGateways database error with convertionFormat");
+
+ return (E_DATABASE_ERROR);
+ }
+ temp.convertionMatrix = iter->second;
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM GatewaySourceFormat" + i2s(temp.gatewayID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL)
+ while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSourceConnectionFormat, 0);
+ temp.listSourceFormats.push_back(tempConnectionFormat);
+ }
+
+ MY_SQLITE_FINALIZE(qSourceConnectionFormat)
+
+ //read out sound properties
+ commandConnectionFormat = "SELECT soundFormat FROM GatewaySinkFormat" + i2s(temp.gatewayID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL)
+ while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSinkConnectionFormat, 0);
+ temp.listSinkFormats.push_back(tempConnectionFormat);
+ }
+
+ MY_SQLITE_FINALIZE(qSinkConnectionFormat)
+
+ cb(temp);
+ temp.listSinkFormats.clear();
+ temp.listSourceFormats.clear();
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getListGateways SQLITE error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+
+ MY_SQLITE_FINALIZE(query)
+
+ return (E_OK);
+}
+
+am_Error_e CAmDatabaseHandlerSQLite::enumerateConverters(std::function<void(const am_Converter_s & element)> cb) const
+{
+ sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
+ int eCode = 0;
+ am_Converter_s temp;
+ am_CustomConnectionFormat_t tempConnectionFormat;
+
+ std::string command = "SELECT name, sinkID, sourceID, domainID, converterID FROM " + std::string(CONVERTER_TABLE);
+ MY_SQLITE_PREPARE_V2(mpDatabase, command.c_str(), -1, &query, NULL)
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.sinkID = sqlite3_column_int(query, 1);
+ temp.sourceID = sqlite3_column_int(query, 2);
+ temp.domainID = sqlite3_column_int(query, 3);
+ temp.converterID = sqlite3_column_int(query, 4);
+
+ //convertionMatrix:
+ ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
+ iter = mListConnectionFormat.find(temp.converterID);
+ if (iter == mListConnectionFormat.end())
+ {
+ logError("DatabaseHandler::getListConverters database error with convertionFormat");
+
+ return (E_DATABASE_ERROR);
+ }
+ temp.convertionMatrix = iter->second;
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM ConverterSourceFormat" + i2s(temp.converterID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL)
+ while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSourceConnectionFormat, 0);
+ temp.listSourceFormats.push_back(tempConnectionFormat);
+ }
+
+ MY_SQLITE_FINALIZE(qSourceConnectionFormat)
+
+ //read out sound properties
+ commandConnectionFormat = "SELECT soundFormat FROM ConverterSinkFormat" + i2s(temp.converterID);
+ MY_SQLITE_PREPARE_V2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL)
+ while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_CustomConnectionFormat_t) sqlite3_column_int(qSinkConnectionFormat, 0);
+ temp.listSinkFormats.push_back(tempConnectionFormat);
+ }
+
+ MY_SQLITE_FINALIZE(qSinkConnectionFormat)
+
+ cb(temp);
+ temp.listSinkFormats.clear();
+ temp.listSourceFormats.clear();
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getListConverters SQLITE error code:", eCode);
+ MY_SQLITE_FINALIZE(query)
+ return (E_DATABASE_ERROR);
+ }
+
+ MY_SQLITE_FINALIZE(query)
+
+ return (E_OK);
+}
+
}
diff --git a/AudioManagerDaemon/src/CAmDatabaseObserver.cpp b/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
index 506ec01..57a76cc 100644
--- a/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
@@ -111,6 +111,12 @@ void CAmDatabaseObserver::newGateway(const am_Gateway_s& gateway)
//todo: implement something
}
+void CAmDatabaseObserver::newConverter(const am_Converter_s& coverter)
+{
+ (void) coverter;
+ //todo: implement something
+}
+
void CAmDatabaseObserver::newCrossfader(const am_Crossfader_s& crossfader)
{
mRoutingSender->addCrossfaderLookup(crossfader);
@@ -143,6 +149,12 @@ void CAmDatabaseObserver::removeGateway(const am_gatewayID_t gatewayID)
//todo: implement something?
}
+void CAmDatabaseObserver::removeConverter(const am_converterID_t converterID)
+{
+ (void) converterID;
+ //todo: implement something?
+}
+
void CAmDatabaseObserver::removeCrossfader(const am_crossfaderID_t crossfaderID)
{
mRoutingSender->removeCrossfaderLookup(crossfaderID);
diff --git a/AudioManagerDaemon/src/CAmRouter.cpp b/AudioManagerDaemon/src/CAmRouter.cpp
index d574e45..6ab0a07 100644
--- a/AudioManagerDaemon/src/CAmRouter.cpp
+++ b/AudioManagerDaemon/src/CAmRouter.cpp
@@ -13,30 +13,83 @@
*
*
* \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ * \author Aleksandar Donchev, Aleksander.Donchev@partner.bmw.de BMW 2013,2014
*
* \file CAmRouter.cpp
* For further information see http://www.genivi.org/.
*
*/
-#include "CAmRouter.h"
#include <cassert>
#include <algorithm>
#include <vector>
#include <iterator>
+#include "CAmRouter.h"
#include "IAmDatabaseHandler.h"
#include "CAmControlSender.h"
+#include "shared/CAmDltWrapper.h"
+
+
namespace am {
+
+void getSourceSinkPossibleConnectionFormats(std::vector<CAmNode<am_RoutingNodeData_s>*>::iterator iteratorSource,
+ std::vector<CAmNode<am_RoutingNodeData_s>*>::iterator iteratorSink,
+ std::vector<am_CustomConnectionFormat_t> & outConnectionFormats)
+{
+ CAmNode<am_RoutingNodeData_s> * nodeSink = *iteratorSink;
+ assert(nodeSink->getData().type==am_RoutingNodeData_s::am_NodeDataType_e::SINK);
+
+ CAmNode<am_RoutingNodeData_s> * nodeSource = *iteratorSource;
+ assert(nodeSource->getData().type==am_RoutingNodeData_s::am_NodeDataType_e::SOURCE);
+
+ am_Source_s *source = nodeSource->getData().data.source;
+ am_Sink_s *sink = nodeSink->getData().data.sink;
+ CAmRouter::listPossibleConnectionFormats(source->listConnectionFormats, sink->listConnectionFormats, outConnectionFormats);
+}
+
+template <class X> void getMergeConnectionFormats(const X * element,
+ const am_CustomConnectionFormat_t connectionFormat,
+ const std::vector<am_CustomConnectionFormat_t> & listConnectionFormats,
+ std::vector<am_CustomConnectionFormat_t> & outListMergeConnectionFormats)
+{
+ std::vector<am_CustomConnectionFormat_t> listRestrictedConnectionFormats;
+ CAmRouter::getRestrictedOutputFormats(element->convertionMatrix,
+ element->listSourceFormats,
+ element->listSinkFormats,
+ connectionFormat,
+ listRestrictedConnectionFormats);
+ std::sort(listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end()); //todo: this might be not needed if we use strictly sorted input
+ std::insert_iterator<std::vector<am_CustomConnectionFormat_t> > inserter(outListMergeConnectionFormats, outListMergeConnectionFormats.begin());
+ set_intersection(listConnectionFormats.begin(), listConnectionFormats.end(), listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end(), inserter);
+}
+
+
CAmRouter::CAmRouter(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSender) :
mpDatabaseHandler(iDatabaseHandler), //
- mpControlSender(iSender)
+ mpControlSender(iSender),
+ mOnlyFreeConversionNodes(false),
+ mRoutingGraph(),
+ mNodeListSources(),
+ mNodeListSinks(),
+ mNodeListGateways(),
+ mNodeListConverters(),
+ mNodeListSourceStatus(),
+ mNodeListSinkStatus(),
+ mNodeListConverterStatus(),
+ mNodeListGatewayStatus(),
+ mpRootSource(0),
+ mpRootSink(0)
{
assert(mpDatabaseHandler);
assert(mpControlSender);
}
+CAmRouter::~CAmRouter()
+{
+}
+
/**
* returns the best route between a source and a sink
* @param onlyfree if true only free gateways are used
@@ -48,213 +101,67 @@ CAmRouter::CAmRouter(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSe
am_Error_e CAmRouter::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
{
returnList.clear();
- //first find out in which domains the source and sink are
- am_domainID_t sourceDomainID;
- am_domainID_t sinkDomainID;
- if (mpDatabaseHandler->getDomainOfSource(sourceID, sourceDomainID) != E_OK)
- return (E_NON_EXISTENT);
- if (mpDatabaseHandler->getDomainOfSink(sinkID, sinkDomainID) != E_OK)
- return (E_NON_EXISTENT);
-
- if (sourceDomainID == sinkDomainID) //shortcut if the domains are the same...
- {
- //first get the list of possible connection formats
- std::vector<am_CustomConnectionFormat_t> listFormats, listPriorityConnectionFormats;
- listPossibleConnectionFormats(sourceID, sinkID, listFormats);
-
- //dummy route
- am_Route_s route;
- route.sinkID = sinkID;
- route.sourceID = sourceID;
- route.route.clear();
-
- //get the prio of the Controller:
- mpControlSender->getConnectionFormatChoice(sourceID, sinkID, route, listFormats, listPriorityConnectionFormats);
-
- //no possible connection, so no route ! But we report OK since there is no fault ...
- if (listPriorityConnectionFormats.empty())
- return (E_OK);
-
- //return the first item as route:
- am_RoutingElement_s routingElement;
- routingElement.sourceID = sourceID;
- routingElement.sinkID = sinkID;
- routingElement.connectionFormat = listPriorityConnectionFormats[0];
- routingElement.domainID = sourceDomainID;
-
- //Now get a route:
- am_Route_s actualRoute;
- actualRoute.route.push_back(routingElement);
- actualRoute.sourceID = sourceID;
- actualRoute.sinkID = sinkID;
-
- //push it to the return list - we are done here ...
- returnList.push_back(actualRoute);
- return (E_OK);
-
- }
- CAmRoutingTree routingtree(sourceDomainID); //Build up a Tree from the Source_Domain to every other domain.
- std::vector<CAmRoutingTreeItem*> flattree; //This list is the flat tree
- std::vector<CAmRoutingTreeItem*> matchtree;
- std::vector<am_gatewayID_t> listGatewayID; //holds all gateway ids of the route
- am_RoutingElement_s routingElement;
- am_Route_s actualRoute; //holds the actual Route
- am_sourceID_t lastSource = 0;
-
- mpDatabaseHandler->getRoutingTree(onlyfree, routingtree, flattree); //Build up the tree out of the database as
-
- //we go through the returned flattree and look for our sink, after that flattree holds only treeItems that match
- std::vector<CAmRoutingTreeItem*>::iterator iterator = flattree.begin();
- for (; iterator != flattree.end(); ++iterator)
- {
- if ((*iterator)->returnDomainID() == sinkDomainID)
- {
- matchtree.push_back(*iterator);
- }
- }
-
- //No we need to trace back the routes for each entry in matchtree
- iterator = matchtree.begin();
- for (; iterator != matchtree.end(); ++iterator)
- {
- std::vector<am_RoutingElement_s> actualRoutingElement; //intermediate list of current routing pairs
- //getting the route for the actual item
- routingtree.getRoute(*iterator, listGatewayID); //This gives only the Gateway IDs we need more
-
- //go throught the gatewayids and get more information
- std::vector<am_gatewayID_t>::iterator gatewayIterator = listGatewayID.begin();
- for (; gatewayIterator != listGatewayID.end(); ++gatewayIterator)
- {
- am_Gateway_s gatewayData;
- if (mpDatabaseHandler->getGatewayInfoDB(*gatewayIterator, gatewayData) != E_OK)
- return (E_UNKNOWN);
-
- //at the beginning of the route, we connect first the source to the first gateway
- if (gatewayIterator == listGatewayID.begin())
- {
- routingElement.sourceID = sourceID;
- routingElement.domainID = sourceDomainID;
- }
- else
- {
- routingElement.sourceID = lastSource;
- routingElement.domainID = gatewayData.domainSinkID;
- }
- routingElement.sinkID = gatewayData.sinkID;
- actualRoutingElement.push_back(routingElement);
- lastSource = gatewayData.sourceID;
- }
- //at the end of the route, connect to the sink !
- routingElement.sourceID = lastSource;
- routingElement.sinkID = sinkID;
- routingElement.domainID = sinkDomainID;
- actualRoutingElement.push_back(routingElement);
-
- //So now we got the route, what is missing are the connectionFormats...
-
- //Step through the routes and try to use always the best connectionFormat
- std::vector<am_RoutingElement_s>::iterator routingInterator = actualRoutingElement.begin();
- gatewayIterator = listGatewayID.begin();
- if (findBestWay(sinkID, sourceID, actualRoutingElement, routingInterator, gatewayIterator) != E_OK)
- {
- continue;
- }
-
- //add the route to the list of routes...
- actualRoute.sourceID = sourceID;
- actualRoute.sinkID = sinkID;
- actualRoute.route = actualRoutingElement;
- returnList.push_back(actualRoute);
- }
- return (E_OK);
+ am_Source_s source;
+ am_Sink_s sink;
+ mpDatabaseHandler->getSourceInfoDB(sourceID, source);
+ mpDatabaseHandler->getSinkInfoDB(sinkID, sink);
+ return getRoute(onlyfree, source, sink, returnList);
}
-void CAmRouter::listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_CustomConnectionFormat_t>& listFormats) const
+bool CAmRouter::getAllowedFormatsFromConvMatrix( const std::vector<bool> & convertionMatrix,
+ const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
+ const std::vector<am_CustomConnectionFormat_t> & listSinkFormats,
+ std::vector<am_CustomConnectionFormat_t> & sourceFormats,
+ std::vector<am_CustomConnectionFormat_t> & sinkFormats)
{
- std::vector<am_CustomConnectionFormat_t> listSourceFormats;
- std::vector<am_CustomConnectionFormat_t> listSinkFormats;
- mpDatabaseHandler->getListSinkConnectionFormats(sinkID, listSinkFormats);
- mpDatabaseHandler->getListSourceConnectionFormats(sourceID, listSourceFormats);
- std::sort(listSinkFormats.begin(), listSinkFormats.end()); //todo: this might be not needed if we use strictly sorted input
- std::sort(listSourceFormats.begin(), listSourceFormats.end()); //todo: this might be not needed if we use strictly sorted input
- std::insert_iterator<std::vector<am_CustomConnectionFormat_t> > inserter(listFormats, listFormats.begin());
- set_intersection(listSourceFormats.begin(), listSourceFormats.end(), listSinkFormats.begin(), listSinkFormats.end(), inserter);
+ const size_t sizeSourceFormats = listSourceFormats.size();
+ const size_t sizeSinkFormats = listSinkFormats.size();
+ const size_t sizeConvertionMatrix = convertionMatrix.size();
+
+ if(sizeSourceFormats==0||sizeSinkFormats==0||sizeConvertionMatrix==0||sizeConvertionMatrix!=sizeSinkFormats*sizeSourceFormats)
+ {
+ return false;
+ }
+
+ std::vector<bool>::const_iterator iterator = convertionMatrix.begin();
+ for (; iterator != convertionMatrix.end(); ++iterator)
+ {
+ if( true == *iterator )
+ {
+ const size_t index = iterator-convertionMatrix.begin();
+ size_t idx = index%sizeSourceFormats;
+ sourceFormats.push_back(listSourceFormats.at(idx));
+ idx = index/sizeSourceFormats;
+ sinkFormats.push_back(listSinkFormats.at(idx));
+ }
+ }
+ return sourceFormats.size()>0;
}
-am_Error_e CAmRouter::findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, std::vector<am_RoutingElement_s> & listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator)
+void CAmRouter::listPossibleConnectionFormats(std::vector<am_CustomConnectionFormat_t> & inListSourceFormats,
+ std::vector<am_CustomConnectionFormat_t> & inListSinkFormats,
+ std::vector<am_CustomConnectionFormat_t> & outListFormats)
{
- am_Error_e returnError = E_NOT_POSSIBLE;
- std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
- std::vector<am_CustomConnectionFormat_t> listMergeConnectionFormats;
- std::vector<am_CustomConnectionFormat_t> listPriorityConnectionFormats;
- std::vector<am_RoutingElement_s>::iterator nextIterator = routeIterator + 1;
- //get best connection format
- listPossibleConnectionFormats(routeIterator->sourceID, routeIterator->sinkID, listConnectionFormats);
-
- //if we have not just started, we need to take care about the gateways...
- if (routeIterator != listRoute.begin())
- {
- //since we have to deal with Gateways, there are restrictions what connectionFormat we can take. So we need to take the subset of connections that are restricted:
- std::vector<am_CustomConnectionFormat_t> listRestrictedConnectionFormats;
- std::insert_iterator<std::vector<am_CustomConnectionFormat_t> > inserter(listMergeConnectionFormats, listMergeConnectionFormats.begin());
- std::vector<am_RoutingElement_s>::iterator tempIterator(routeIterator);
- tempIterator--;
- listRestrictedOutputFormatsGateways(*gatewayIterator, (tempIterator)->connectionFormat, listRestrictedConnectionFormats);
- std::sort(listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end()); //todo: this might be not needed if we use strictly sorted input
- set_intersection(listConnectionFormats.begin(), listConnectionFormats.end(), listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end(), inserter);
- gatewayIterator++;
- }
- else
- {
- listMergeConnectionFormats = listConnectionFormats;
- }
-
- am_Route_s route;
- route.sinkID = sinkID;
- route.sourceID = sourceID;
- route.route = listRoute;
-
- //let the controller decide:
- mpControlSender->getConnectionFormatChoice(routeIterator->sourceID, routeIterator->sinkID, route, listMergeConnectionFormats, listPriorityConnectionFormats);
-
- //we have the list sorted after prios - now we try one after the other with the next part of the route
- std::vector<am_CustomConnectionFormat_t>::iterator connectionFormatIterator = listPriorityConnectionFormats.begin();
-
- //here we need to check if we are at the end and stop
- if (nextIterator == listRoute.end())
- {
- if (!listPriorityConnectionFormats.empty())
- {
- routeIterator->connectionFormat = listPriorityConnectionFormats.front();
- return (E_OK);
- }
- else
- return (E_NOT_POSSIBLE);
- }
-
- for (; connectionFormatIterator != listPriorityConnectionFormats.end(); ++connectionFormatIterator)
- {
- routeIterator->connectionFormat = *connectionFormatIterator;
- if ((returnError = findBestWay(sinkID, sourceID, listRoute, nextIterator, gatewayIterator)) == E_OK)
- {
- break;
- }
- }
-
- return (returnError);
+ std::sort(inListSourceFormats.begin(), inListSourceFormats.end());
+ std::sort(inListSinkFormats.begin(), inListSinkFormats.end());
+ std::insert_iterator<std::vector<am_CustomConnectionFormat_t> > inserter(outListFormats, outListFormats.begin());
+ set_intersection(inListSourceFormats.begin(), inListSourceFormats.end(), inListSinkFormats.begin(), inListSinkFormats.end(), inserter);
}
-void CAmRouter::listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_CustomConnectionFormat_t sinkConnectionFormat, std::vector<am_CustomConnectionFormat_t> & listFormats) const
+
+bool CAmRouter::getRestrictedOutputFormats(const std::vector<bool> & convertionMatrix,
+ const std::vector<am_CustomConnectionFormat_t> & listSourceFormats,
+ const std::vector<am_CustomConnectionFormat_t> & listSinkFormats,
+ const am_CustomConnectionFormat_t connectionFormat,
+ std::vector<am_CustomConnectionFormat_t> & listFormats)
{
listFormats.clear();
- am_Gateway_s gatewayData;
- mpDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData);
- std::vector<am_CustomConnectionFormat_t>::const_iterator rowSinkIterator = gatewayData.listSinkFormats.begin();
- std::vector<bool>::const_iterator matrixIterator = gatewayData.convertionMatrix.begin();
+ std::vector<am_CustomConnectionFormat_t>::const_iterator rowSinkIterator = listSinkFormats.begin();
+ std::vector<bool>::const_iterator matrixIterator = convertionMatrix.begin();
//find the row number of the sink
- rowSinkIterator = find(gatewayData.listSinkFormats.begin(), gatewayData.listSinkFormats.end(), sinkConnectionFormat);
- int rowNumberSink = rowSinkIterator - gatewayData.listSinkFormats.begin();
+ rowSinkIterator = find(listSinkFormats.begin(), listSinkFormats.end(), connectionFormat);
+ int rowNumberSink = rowSinkIterator - listSinkFormats.begin();
//go through the convertionMatrix and find out if the conversion is possible, if yes, add connectionFormat ...
std::advance(matrixIterator, rowNumberSink);
@@ -264,96 +171,817 @@ void CAmRouter::listRestrictedOutputFormatsGateways(const am_gatewayID_t gateway
{
if (*matrixIterator)
{
- listFormats.push_back(gatewayData.listSourceFormats.at((matrixIterator - gatewayData.convertionMatrix.begin()) / gatewayData.listSinkFormats.size()));
+ listFormats.push_back(listSourceFormats.at((matrixIterator - convertionMatrix.begin()) / listSinkFormats.size()));
}
- std::advance(matrixIterator, gatewayData.listSinkFormats.size());
- } while (gatewayData.convertionMatrix.end() - matrixIterator > 0);
+ std::advance(matrixIterator, listSinkFormats.size());
+ } while (convertionMatrix.end() - matrixIterator > 0);
+
+ return listFormats.size();
}
-CAmRouter::~CAmRouter()
+#ifdef EXTENDED_ROUTING_GRAPH
+void appendNodes(CAmGraph<am_RoutingNodeData_s, uint16_t> & routingGraph,
+ const std::vector<am_CustomConnectionFormat_t> & listConnectionFormats,
+ am_RoutingNodeData_s & nodeData,
+ std::vector<CAmNode<am_RoutingNodeData_s>*> & nodeList)
{
+ std::for_each(listConnectionFormats.begin(), listConnectionFormats.end(), [&](const am_CustomConnectionFormat_t cf){
+ nodeData.inConnectionFormat = cf;
+ nodeList.push_back(&routingGraph.addNode(nodeData));
+ });
}
-CAmRoutingTreeItem::CAmRoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, CAmRoutingTreeItem *parent) :
- mDomainID(domainID), //
- mGatewayID(gatewayID), //
- mpParentItem(parent)
+void appendNodes(CAmGraph<am_RoutingNodeData_s, uint16_t> & routingGraph,
+ const std::vector<am_CustomConnectionFormat_t> & sourceConnectionFormats,
+ const std::vector<am_CustomConnectionFormat_t> & sinkConnectionFormats,
+ const std::vector<bool> & convertionMatrix,
+ am_RoutingNodeData_s & nodeData,
+ std::vector<CAmNode<am_RoutingNodeData_s>*> & nodeList)
{
- assert(mDomainID!=0);
+
+ std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats;
+ if(CAmRouter::getAllowedFormatsFromConvMatrix(convertionMatrix, sourceConnectionFormats, sinkConnectionFormats, sourceFormats, sinkFormats))
+ {
+ for(size_t i = 0; i < sourceFormats.size(); i++)
+ {
+ nodeData.inConnectionFormat = sinkFormats[i];
+ nodeData.outConnectionFormat = sourceFormats[i];
+ nodeList.push_back(&routingGraph.addNode(nodeData));
+ }
+ }
}
+#endif
-void CAmRoutingTreeItem::appendChild(CAmRoutingTreeItem *newChild)
+am_Error_e CAmRouter::getRoute(const bool onlyfree, const am_Source_s & aSource, const am_Sink_s & aSink, std::vector<am_Route_s> & listRoutes)
{
- assert(newChild);
- mListChildItems.push_back(newChild);
+ clear();
+ mOnlyFreeConversionNodes = onlyfree;
+
+ // We need to copy the sinks, sources, converters, gateways, because we don't know what store is being used (SQLite or Map).
+ //todo: Don't make copy for map storage.
+ std::deque<am_Source_s> listSources;
+ std::deque<am_Sink_s> listSinks;
+ std::deque<am_Gateway_s> listGateways;
+ std::deque<am_Converter_s> listConverters;
+
+ am_Error_e error = E_OK;
+
+ am_RoutingNodeData_s nodeDataSrc;
+ nodeDataSrc.type = NodeDataType::SOURCE;
+ mpDatabaseHandler->enumerateSources([&](const am_Source_s & obj){
+ listSources.push_back(obj);
+ nodeDataSrc.data.source = &listSources.back();
+ mNodeListSourceStatus[obj.sourceID]=false;
+#ifdef EXTENDED_ROUTING_GRAPH
+ appendNodes(mRoutingGraph, obj.listConnectionFormats, nodeDataSrc, mNodeListSources);
+#else
+ mNodeListSources.push_back(&mRoutingGraph.addNode(nodeDataSrc));
+#endif
+ });
+ am_RoutingNodeData_s nodeDataSink;
+ nodeDataSink.type = NodeDataType::SINK;
+ mpDatabaseHandler->enumerateSinks([&](const am_Sink_s & obj){
+ listSinks.push_back(obj);
+ nodeDataSink.data.sink = &listSinks.back();
+ mNodeListSinkStatus[obj.sinkID]=false;
+#ifdef EXTENDED_ROUTING_GRAPH
+ appendNodes(mRoutingGraph, obj.listConnectionFormats, nodeDataSink, mNodeListSinks);
+#else
+ mNodeListSinks.push_back(&mRoutingGraph.addNode(nodeDataSink));
+#endif
+ });
+ am_RoutingNodeData_s nodeDataGateway;
+ nodeDataGateway.type = NodeDataType::GATEWAY;
+ mpDatabaseHandler->enumerateGateways([&](const am_Gateway_s & obj){
+ listGateways.push_back(obj);
+ nodeDataGateway.data.gateway = &listGateways.back();
+ mNodeListGatewayStatus[obj.gatewayID]=false;
+#ifdef EXTENDED_ROUTING_GRAPH
+ appendNodes(mRoutingGraph, obj.listSourceFormats, obj.listSinkFormats, obj.convertionMatrix, nodeDataGateway, mNodeListGateways);
+#else
+ mNodeListGateways.push_back(&mRoutingGraph.addNode(nodeDataGateway));
+#endif
+ });
+ am_RoutingNodeData_s nodeDataConverter;
+ nodeDataConverter.type = NodeDataType::CONVERTER;
+ mpDatabaseHandler->enumerateConverters([&](const am_Converter_s & obj){
+ listConverters.push_back(obj);
+ nodeDataConverter.data.converter = &listConverters.back();
+ mNodeListConverterStatus[obj.converterID]=false;
+#ifdef EXTENDED_ROUTING_GRAPH
+ appendNodes(mRoutingGraph, obj.listSourceFormats, obj.listSinkFormats, obj.convertionMatrix, nodeDataConverter, mNodeListConverters);
+#else
+ mNodeListConverters.push_back(&mRoutingGraph.addNode(nodeDataConverter));
+#endif
+ });
+
+ buildGraph(aSource, aSink);
+
+#ifdef EXTENDED_ROUTING_GRAPH
+ std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> pathNodes;
+ getShortestPath(listRoutes, pathNodes);
+#else
+ std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> pathNodes;
+ error = getAllPaths(listRoutes, pathNodes);
+#endif
+ return error;
}
-void CAmRoutingTreeItem::returnChildItems(std::vector<CAmRoutingTreeItem*> listChildItems)
+void CAmRouter::buildGraph( const am_Source_s & aSource, const am_Sink_s & aSink)
{
- listChildItems = mListChildItems;
+ //build up a topological sorted graph
+#ifdef EXTENDED_ROUTING_GRAPH
+ mpRootSource = (am_Source_s*)&aSource;
+ mpRootSink = (am_Sink_s*)&aSink;
+ for(auto it1=aSource.listConnectionFormats.begin(); it1!=aSource.listConnectionFormats.end(); it1++)
+ {
+ am::CAmNode<am::am_RoutingNodeData_s>* pRootNodeSource = sourceNodeWithID(aSource.sourceID, *it1);
+ for(auto it2=aSink.listConnectionFormats.begin(); it2!=aSink.listConnectionFormats.end(); it2++)
+ {
+ am::CAmNode<am::am_RoutingNodeData_s>* pRootNodeSink = sinkNodeWithID(aSink.sinkID, *it2);
+ if(pRootNodeSource && pRootNodeSink)
+ {
+ if(aSource.domainID==aSink.domainID)
+ routeInSameDomain(*pRootNodeSource, *pRootNodeSink);
+ else
+ routeInAnotherDomain(*pRootNodeSource, *pRootNodeSink);
+ }
+ }
+ }
+#else
+ mpRootSource = sourceNodeWithID(aSource.sourceID);
+ mpRootSink = sinkNodeWithID(aSink.sinkID);
+
+ assert(mpRootSource);
+ assert(mpRootSink);
+
+ if(aSource.domainID==aSink.domainID)
+ {
+ routeInSameDomain(*mpRootSource, *mpRootSink);
+ }
+ else
+ {
+ routeInAnotherDomain(*mpRootSource, *mpRootSink);
+ }
+#endif
+#ifdef TRACE_GRAPH
+ mRoutingGraph.trace([&](const CAmNode<am_RoutingNodeData_s> & node, const std::vector<CAmVertex<am_RoutingNodeData_s,uint16_t>*> & list) {
+ std::cout << "Node " << node.getIndex() << " :";
+ ((CAmNode<am_RoutingNodeData_s> &)node).getData().trace();
+ std::cout << "-->";
+ std::for_each(list.begin(), list.end(), [&](const CAmVertex<am_RoutingNodeData_s,uint16_t>* refVertex){
+ am::CAmNode<am::am_RoutingNodeData_s>* data = refVertex->getNode();
+ std::cout << "Node " << data->getIndex() << " :";
+ data->getData().trace();
+ });
+ std::cout << std::endl;
+ });
+#endif
}
+#ifdef EXTENDED_ROUTING_GRAPH
-am_domainID_t CAmRoutingTreeItem::returnDomainID() const
+CAmNode<am_RoutingNodeData_s>* CAmRouter::sinkNodeWithID(const am_sinkID_t sinkID, const am_CustomConnectionFormat_t connectionFormat)
{
- return (mDomainID);
+ auto iter = std::find_if(mNodeListSinks.begin(), mNodeListSinks.end(), [sinkID, connectionFormat](CAmNode<am_RoutingNodeData_s>* node){
+ return node->getData().data.sink->sinkID==sinkID && node->getData().inConnectionFormat==connectionFormat;
+ });
+ if(iter!=mNodeListSinks.end())
+ return *iter;
+ return NULL;
}
-am_gatewayID_t CAmRoutingTreeItem::returnGatewayID() const
+CAmNode<am_RoutingNodeData_s>* CAmRouter::sourceNodeWithID(const am_sourceID_t sourceID, const am_CustomConnectionFormat_t connectionFormat)
+{
+ auto iter = std::find_if(mNodeListSources.begin(), mNodeListSources.end(), [sourceID, connectionFormat](CAmNode<am_RoutingNodeData_s>* node){
+ return node->getData().data.source->sourceID==sourceID && node->getData().inConnectionFormat==connectionFormat;
+ });
+ if(iter!=mNodeListSources.end())
+ return *iter;
+ return NULL;
+}
+#else
+CAmNode<am_RoutingNodeData_s>* CAmRouter::sinkNodeWithID(const am_sinkID_t sinkID)
{
- return (mGatewayID);
+ auto iter = std::find_if(mNodeListSinks.begin(), mNodeListSinks.end(), [sinkID](CAmNode<am_RoutingNodeData_s>* node){
+ return node->getData().data.sink->sinkID==sinkID;
+ });
+ if(iter!=mNodeListSinks.end())
+ return *iter;
+ return NULL;
}
-CAmRoutingTreeItem* CAmRoutingTreeItem::returnParent() const
+CAmNode<am_RoutingNodeData_s>* CAmRouter::sourceNodeWithID(const am_sourceID_t sourceID)
{
- return (mpParentItem);
+ auto iter = std::find_if(mNodeListSources.begin(), mNodeListSources.end(), [sourceID](CAmNode<am_RoutingNodeData_s>* node){
+ return node->getData().data.source->sourceID==sourceID;
+ });
+ if(iter!=mNodeListSources.end())
+ return *iter;
+ return NULL;
}
+#endif
-CAmRoutingTreeItem::~CAmRoutingTreeItem()
+void CAmRouter::connectNodes(const CAmNode<am_RoutingNodeData_s> & node1,
+ const CAmNode<am_RoutingNodeData_s> & node2,
+ const am_CustomConnectionFormat_t vertexData,
+ const int16_t weight)
{
+ if( !mRoutingGraph.isAnyVertex(node1, node2) )
+ mRoutingGraph.connectNodes(node1, node2, vertexData, weight);
}
-CAmRoutingTree::CAmRoutingTree(const am_domainID_t rootDomainID) :
- mRootItem(CAmRoutingTreeItem(rootDomainID))
+bool CAmRouter::routeInSameDomain(CAmNode<am_RoutingNodeData_s> & aSource, CAmNode<am_RoutingNodeData_s> & aSink)
{
- assert(rootDomainID!=0);
+ am_RoutingNodeData_s & sourceData = aSource.getData();
+ am_RoutingNodeData_s & sinkData = aSink.getData();
+ am_Source_s * source = sourceData.data.source;
+ //If exists connection return
+ if( mRoutingGraph.isAnyVertex(aSource, aSink))
+ return true;
+ if( mNodeListSourceStatus[source->sourceID] )
+ return false;
+ bool result = false;
+ mNodeListSourceStatus[source->sourceID]=true;
+#ifdef EXTENDED_ROUTING_GRAPH
+ if(sourceData.inConnectionFormat!=sinkData.inConnectionFormat) // it is not possible to connect them directly
+ {
+#else
+ am_Sink_s * sink = sinkData.data.sink;
+ std::vector<am_CustomConnectionFormat_t> listFormats;
+ CAmRouter::listPossibleConnectionFormats(source->listConnectionFormats, sink->listConnectionFormats, listFormats);
+ if(listFormats.size()==0) // it is not possible to connect them directly
+ {
+#endif
+ bool availableConverter = false;
+ for(auto iter = mNodeListConverters.begin(); iter!=mNodeListConverters.end(); iter++)
+ {
+ CAmNode<am_RoutingNodeData_s>* converterNode = *iter;
+ am_RoutingNodeData_s & converterNodeData = converterNode->getData();
+ am_Converter_s * converter = converterNodeData.data.converter;
+ //Get only converters with end point in current source domain
+ if( !mNodeListConverterStatus[converter->converterID] && converter->domainID==source->domainID && (!mOnlyFreeConversionNodes || !isComponentConnected(*converter)))
+ {
+ //Get the sink connected to the converter...
+ mNodeListConverterStatus[converter->converterID]=true;
+#ifdef EXTENDED_ROUTING_GRAPH
+ CAmNode<am_RoutingNodeData_s> *converterSinkNode = this->sinkNodeWithID(converter->sinkID, converterNodeData.inConnectionFormat);
+#else
+ CAmNode<am_RoutingNodeData_s> *converterSinkNode = this->sinkNodeWithID(converter->sinkID);
+#endif
+ if(converterSinkNode)
+ {
+ am_RoutingNodeData_s & converterSinkData = converterSinkNode->getData();
+ //Check whether the hidden sink formats match the source formats...
+#ifdef EXTENDED_ROUTING_GRAPH
+ if(sourceData.inConnectionFormat==converterSinkData.inConnectionFormat)
+ {
+ CAmNode<am_RoutingNodeData_s> *converterSourceNode = this->sourceNodeWithID(converter->sourceID, converterNodeData.outConnectionFormat);
+ if(converterSourceNode)
+ {
+ am_RoutingNodeData_s & converterSourceData = converterSourceNode->getData();
+ if(converterSourceData.inConnectionFormat==converterSinkData.outConnectionFormat)
+ {
+ availableConverter=true;
+ // Connection source->conv_sink->converter->conv_source
+ this->connectNodes(aSource, *converterSinkNode, converterNodeData.inConnectionFormat, 1);
+ this->connectNodes(*converterSinkNode, *converterNode, converterNodeData.inConnectionFormat, 1);
+ this->connectNodes(*converterNode, *converterSourceNode, converterNodeData.outConnectionFormat, 1);
+ result|=this->routeInSameDomain(*converterSourceNode, aSink);
+ }
+ }
+ }
+ else
+ {
+ //the converter is not suitable, lets try to find paths through another domains
+ bool alternResult = this->routeInAnotherDomain(aSource, *converterSinkNode);
+ if(alternResult)
+ {
+ CAmNode<am_RoutingNodeData_s> *converterSourceNode = this->sourceNodeWithID(converter->sourceID, converterNodeData.outConnectionFormat);
+ if(converterSourceNode)
+ {
+ am_RoutingNodeData_s & converterSourceData = converterSourceNode->getData();
+ if(converterSourceData.inConnectionFormat==converterSinkData.outConnectionFormat)
+ {
+ // Connection source->conv_sink->converter->conv_source
+ this->connectNodes(*converterSinkNode, *converterNode, converterNodeData.inConnectionFormat, 1);
+ this->connectNodes(*converterNode, *converterSourceNode, converterNodeData.outConnectionFormat, 1);
+ result|=this->routeInSameDomain(*converterSourceNode, aSink);
+ }
+ }
+ }
+ }
+#else
+ am_Sink_s * nextSink = converterSinkData.data.sink;
+ std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats, intersection;
+ //Check whether the hidden sink formats match the source formats...
+ CAmRouter::listPossibleConnectionFormats(source->listConnectionFormats, nextSink->listConnectionFormats, intersection);
+ if(intersection.size()>0)//OK match source -> conv_sink
+ {
+ //Are there convertible formats or not
+ if(CAmRouter::getAllowedFormatsFromConvMatrix(converter->convertionMatrix, converter->listSourceFormats, converter->listSinkFormats, sourceFormats, sinkFormats))
+ {
+ availableConverter=true;
+ CAmNode<am_RoutingNodeData_s> *nextSourceNode = this->sourceNodeWithID(converter->sourceID);
+ assert(nextSourceNode);
+ //Connections source->hidden_sink->converter->hidden_source
+ this->connectNodes(aSource, *converterSinkNode, CF_UNKNOWN, 1);
+ this->connectNodes(*converterSinkNode, *converterNode, CF_UNKNOWN, 1);
+ this->connectNodes(*converterNode, *nextSourceNode, CF_UNKNOWN, 1);
+ //Go ahead with hidden_source and sink
+ result|=this->routeInSameDomain(*nextSourceNode, aSink);
+ }
+ }
+ else
+ {
+ //the converter is not suitable, lets try to find paths through another domains
+ bool alternResult = this->routeInAnotherDomain(aSource, *converterSinkNode);
+ if(alternResult)
+ {
+ if(CAmRouter::getAllowedFormatsFromConvMatrix(converter->convertionMatrix, converter->listSourceFormats, converter->listSinkFormats, sourceFormats, sinkFormats))
+ {
+ CAmNode<am_RoutingNodeData_s> *nextSourceNode = this->sourceNodeWithID(converter->sourceID);
+ assert(nextSourceNode);
+ //Connections source->hidden_sink->converter->hidden_source
+ this->connectNodes(*converterSinkNode, *converterNode, CF_UNKNOWN, 1);
+ this->connectNodes(*converterNode, *nextSourceNode, CF_UNKNOWN, 1);
+ //Go ahead with hidden_source and sink
+ result|=this->routeInSameDomain(*nextSourceNode, aSink);
+ }
+ }
+ }
+#endif
+ }
+ mNodeListConverterStatus[converter->converterID]=false;
+ }
+ }
+ if(!availableConverter)
+ {
+ mNodeListSourceStatus[source->sourceID]=false;
+ result|=this->routeInAnotherDomain(aSource, aSink);
+ }
+ }
+ else
+ {
+ //success only if the source can be connected with the sink
+#ifdef EXTENDED_ROUTING_GRAPH
+ this->connectNodes(aSource, aSink, sourceData.inConnectionFormat, 1);
+#else
+ this->connectNodes(aSource, aSink, CF_UNKNOWN, 1);
+#endif
+ result=true;
+ }
+ mNodeListSourceStatus[source->sourceID]=false;
+ return result;
}
-CAmRoutingTreeItem *CAmRoutingTree::insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, CAmRoutingTreeItem *parent)
+bool CAmRouter::routeInAnotherDomain(CAmNode<am_RoutingNodeData_s> & aSource, CAmNode<am_RoutingNodeData_s> & aSink)
{
- CAmRoutingTreeItem *newTree = new CAmRoutingTreeItem(domainID, gatewayID, parent);
- parent->appendChild(newTree);
- mListChild.push_back(newTree);
- return (newTree);
+ am_RoutingNodeData_s & sourceData = aSource.getData();
+ am_RoutingNodeData_s & sinkData = aSink.getData();
+ am_Source_s * source = sourceData.data.source;
+ am_Sink_s * sink = sinkData.data.sink;
+
+ if(mRoutingGraph.isAnyVertex(aSource, aSink))
+ return true;
+ if( mNodeListSourceStatus[source->sourceID] )
+ return false;
+ mNodeListSourceStatus[source->sourceID]=true;
+#ifndef EXTENDED_ROUTING_GRAPH
+ std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats, intersection;
+#endif
+ bool result = false;
+ for(auto iter = mNodeListGateways.begin(); iter!=mNodeListGateways.end(); iter++)
+ {
+ CAmNode<am_RoutingNodeData_s>* gatewayNode = *iter;
+ am_RoutingNodeData_s & gatewayNodeData = gatewayNode->getData();
+ am_Gateway_s * gateway = gatewayNodeData.data.gateway;
+ //Get only gateways with end point in current source domain
+ if(
+ !mNodeListGatewayStatus[gateway->gatewayID] &&
+ gateway->domainSinkID==source->domainID &&
+ (!mOnlyFreeConversionNodes || !isComponentConnected(*gateway)) )
+ {
+ //Get the sink connected to the gateway...
+ mNodeListGatewayStatus[gateway->gatewayID]=true;
+#ifdef EXTENDED_ROUTING_GRAPH
+ CAmNode<am_RoutingNodeData_s> *gatewaySinkNode = this->sinkNodeWithID(gateway->sinkID, gatewayNodeData.inConnectionFormat);
+#else
+ CAmNode<am_RoutingNodeData_s> *gatewaySinkNode = this->sinkNodeWithID(gateway->sinkID);
+#endif
+
+ if(gatewaySinkNode)
+ {
+ am_RoutingNodeData_s & gatewaySinkData = gatewaySinkNode->getData();
+ //Check whether the hidden sink formats match the source formats...
+
+#ifdef EXTENDED_ROUTING_GRAPH
+ if(sourceData.inConnectionFormat==gatewaySinkData.inConnectionFormat)
+ {
+ //Check if the gateway is able to convert any formats...
+ CAmNode<am_RoutingNodeData_s> *gatewaySourceNode = this->sourceNodeWithID(gateway->sourceID, gatewayNodeData.outConnectionFormat);
+ if(gatewaySourceNode)
+ {
+ am_RoutingNodeData_s & gatewaySourceData = gatewaySourceNode->getData();
+ if(gatewaySourceData.inConnectionFormat==gatewayNodeData.outConnectionFormat)
+ {
+ am_Source_s * gatewaySource = gatewaySourceData.data.source;
+ //Connections source->hidden_sink->gateway->hidden_source
+ this->connectNodes(aSource, *gatewaySinkNode, gatewayNodeData.inConnectionFormat, 1);
+ this->connectNodes(*gatewaySinkNode, *gatewayNode, gatewayNodeData.inConnectionFormat, 1);
+ this->connectNodes(*gatewayNode, *gatewaySourceNode, gatewayNodeData.outConnectionFormat, 1);
+ //Go ahead with hidden_source and sink
+ if(gatewaySource->domainID==sink->domainID)
+ result|=this->routeInSameDomain(*gatewaySourceNode, aSink);
+ else
+ result|=this->routeInAnotherDomain(*gatewaySourceNode, aSink);
+ }
+ }
+ }
+ else
+ {
+ //the gateway is not suitable, lets try to find paths within this domains
+ bool alternResult = this->routeInSameDomain(aSource, *gatewaySinkNode);
+ if(alternResult)
+ {
+ CAmNode<am_RoutingNodeData_s> *gatewaySourceNode = this->sourceNodeWithID(gateway->sourceID, gatewayNodeData.outConnectionFormat);
+ if(gatewaySourceNode)
+ {
+ am_RoutingNodeData_s & gatewaySourceData = gatewaySourceNode->getData();
+ if(gatewaySourceData.inConnectionFormat==gatewayNodeData.outConnectionFormat)
+ {
+ am_Source_s * gatewaySource = gatewaySourceData.data.source;
+ //Connections source->hidden_sink->gateway->hidden_source
+ this->connectNodes(aSource, *gatewaySinkNode, gatewayNodeData.inConnectionFormat, 1);
+ this->connectNodes(*gatewaySinkNode, *gatewayNode, gatewayNodeData.inConnectionFormat, 1);
+ this->connectNodes(*gatewayNode, *gatewaySourceNode, gatewayNodeData.outConnectionFormat, 1);
+ //Go ahead with hidden_source and sink
+ if(gatewaySource->domainID==sink->domainID)
+ result|=this->routeInSameDomain(*gatewaySourceNode, aSink);
+ else
+ result|=this->routeInAnotherDomain(*gatewaySourceNode, aSink);
+ }
+ }
+ }
+ }
+#else
+ am_Sink_s * nextSink = gatewaySinkData.data.sink;
+ std::vector<am_CustomConnectionFormat_t> sourceFormats, sinkFormats, intersection;
+ CAmRouter::listPossibleConnectionFormats(source->listConnectionFormats, nextSink->listConnectionFormats, intersection);
+ if(intersection.size()>0)//OK match source -> conv_sink
+ {
+ //Check if the gateway is able to convert any formats...
+ if(CAmRouter::getAllowedFormatsFromConvMatrix(gateway->convertionMatrix, gateway->listSourceFormats, gateway->listSinkFormats, sourceFormats, sinkFormats))
+ {
+ CAmNode<am_RoutingNodeData_s> *nextSourceNode = this->sourceNodeWithID(gateway->sourceID);
+ assert(nextSourceNode);
+ am_Source_s * nextSource = nextSourceNode->getData().data.source;
+ //Connections source->hidden_sink->gateway->hidden_source
+ this->connectNodes(aSource, *gatewaySinkNode, CF_UNKNOWN, 1);
+ this->connectNodes(*gatewaySinkNode, *gatewayNode, CF_UNKNOWN, 1);
+ this->connectNodes(*gatewayNode, *nextSourceNode, CF_UNKNOWN, 1);
+ //Go ahead with hidden_source and sink
+ if(nextSource->domainID==sink->domainID)
+ result|=this->routeInSameDomain(*nextSourceNode, aSink);
+ else
+ result|=this->routeInAnotherDomain(*nextSourceNode, aSink);
+ }
+ }
+ else
+ {
+ //the gateway is not suitable, lets try to find paths within this domains
+ mNodeListSourceStatus[source->sourceID]=false;
+ bool alternResult = this->routeInSameDomain(aSource, *gatewaySinkNode);
+ if(alternResult)
+ {
+ if(CAmRouter::getAllowedFormatsFromConvMatrix(gateway->convertionMatrix, gateway->listSourceFormats, gateway->listSinkFormats, sourceFormats, sinkFormats))
+ {
+ CAmNode<am_RoutingNodeData_s> *nextSourceNode = this->sourceNodeWithID(gateway->sourceID);
+ assert(nextSourceNode);
+ am_Source_s * nextSource = nextSourceNode->getData().data.source;
+ //Connections source->hidden_sink->gateway->hidden_source
+ this->connectNodes(*gatewaySinkNode, *gatewayNode, CF_UNKNOWN, 1);
+ this->connectNodes(*gatewayNode, *nextSourceNode, CF_UNKNOWN, 1);
+ //Go ahead with hidden_source and sink
+ if(nextSource->domainID==sink->domainID)
+ result|=this->routeInSameDomain(*nextSourceNode, aSink);
+ else
+ result|=this->routeInAnotherDomain(*nextSourceNode, aSink);
+ }
+ }
+ }
+#endif
+ }
+ mNodeListGatewayStatus[gateway->gatewayID]=false;
+ }
+ }
+ mNodeListSourceStatus[source->sourceID]=false;
+ return result;
}
-void CAmRoutingTree::getRoute(CAmRoutingTreeItem *targetItem, std::vector<am_gatewayID_t>& listGateways)
+#ifdef EXTENDED_ROUTING_GRAPH
+void CAmRouter::getShortestPath(const am_Source_s & aSource,
+ const am_Sink_s & aSink,
+ std::vector<am_Route_s> & resultPath,
+ std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultNodesPath)
{
- listGateways.clear();
- CAmRoutingTreeItem *parentItem = targetItem;
- while (parentItem != &mRootItem)
- {
- listGateways.push_back(parentItem->returnGatewayID());
- parentItem = parentItem->returnParent();
- }
- std::reverse(listGateways.begin(), listGateways.end());
+ std::vector<CAmNode<am_RoutingNodeData_s>*> listTargets;
+ std::vector<CAmNode<am_RoutingNodeData_s>*> * pathNodes;
+ am_Route_s *path;
+ am_RoutingElement_s * element;
+ std::function<void(const am_GraphPathPosition_e, CAmNode<am_RoutingNodeData_s> &)> cb = [&](const am_GraphPathPosition_e pos, CAmNode<am_RoutingNodeData_s> & object)
+ {
+ if(pos==GRAPH_PATH_START)
+ {
+ resultNodesPath.emplace_back();
+ pathNodes=&resultNodesPath.back();
+ resultPath.emplace_back();
+ path= &resultPath.back();
+ path->sinkID = aSink.sinkID;
+ path->sourceID = aSource.sourceID;
+ }
+ pathNodes->insert(pathNodes->begin(), (CAmNode<am_RoutingNodeData_s>*)&object);
+
+ am_RoutingNodeData_s & routingData = object.getData();
+
+ if(routingData.type==am_RoutingNodeData_s::am_NodeDataType_e::SINK)
+ {
+ auto iter = path->route.emplace(path->route.begin());
+ element = &(*iter);
+
+ element->domainID = routingData.data.sink->domainID;
+ element->sinkID = routingData.data.sink->sinkID;
+ element->connectionFormat = routingData.inConnectionFormat;
+
+ }
+ else if(routingData.type==am_RoutingNodeData_s::am_NodeDataType_e::SOURCE)
+ {
+ element->domainID = routingData.data.source->domainID;
+ element->sourceID = routingData.data.source->sourceID;
+ element->connectionFormat = routingData.inConnectionFormat;
+ }
+ };
+
+
+ for(auto it2=aSink.listConnectionFormats.begin(); it2!=aSink.listConnectionFormats.end(); it2++)
+ {
+ am::CAmNode<am::am_RoutingNodeData_s>* pRootNodeSink = sinkNodeWithID(aSink.sinkID, *it2);
+ if(pRootNodeSink)
+ listTargets.push_back(pRootNodeSink);
+ }
+ if(listTargets.size())
+ {
+ for(auto it1=aSource.listConnectionFormats.begin(); it1!=aSource.listConnectionFormats.end(); it1++)
+ {
+ am::CAmNode<am::am_RoutingNodeData_s>* pRootNodeSource = sourceNodeWithID(aSource.sourceID, *it1);
+ if(pRootNodeSource)
+ {
+ mRoutingGraph.getShortestPath(*pRootNodeSource, listTargets, cb);
+ }
+ }
+ }
+}
+
+void CAmRouter::getShortestPath(std::vector<am_Route_s> & routes, std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & nodes)
+{
+ getShortestPath(*mpRootSource, *mpRootSink, routes, nodes);
}
-am_domainID_t CAmRoutingTree::returnRootDomainID() const
+void CAmRouter::getShortestPath(const am_Source_s & aSource, const am_Sink_s & aSink,
+ std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultPath)
{
- return (mRootItem.returnDomainID());
+ std::vector<CAmNode<am_RoutingNodeData_s>*> listTargets;
+ for(auto it2=aSink.listConnectionFormats.begin(); it2!=aSink.listConnectionFormats.end(); it2++)
+ {
+ am::CAmNode<am::am_RoutingNodeData_s>* pRootNodeSink = sinkNodeWithID(aSink.sinkID, *it2);
+ if(pRootNodeSink)
+ listTargets.push_back(pRootNodeSink);
+ }
+ if(listTargets.size())
+ {
+ for(auto it1=aSource.listConnectionFormats.begin(); it1!=aSource.listConnectionFormats.end(); it1++)
+ {
+ am::CAmNode<am::am_RoutingNodeData_s>* pRootNodeSource = sourceNodeWithID(aSource.sourceID, *it1);
+ if(pRootNodeSource)
+ {
+ mRoutingGraph.getShortestPath(*pRootNodeSource, listTargets, resultPath);
+ }
+ }
+ }
}
+#else
-CAmRoutingTreeItem *CAmRoutingTree::returnRootItem()
+am_Error_e CAmRouter::determineConnectionFormatsForPath(am_Route_s & routeObjects, std::vector<CAmNode<am_RoutingNodeData_s>*> & nodes)
{
- return (&mRootItem);
+ std::vector<am_RoutingElement_s>::iterator routingElementIterator = routeObjects.route.begin();
+ std::vector<CAmNode<am_RoutingNodeData_s>*>::iterator nodeIterator = nodes.begin();
+ if( routingElementIterator!= routeObjects.route.end() && nodeIterator!=nodes.end() )
+ return doConnectionFormatsForPath(routeObjects, nodes, routingElementIterator, nodeIterator);
+ return E_OK;
}
-CAmRoutingTree::~CAmRoutingTree()
+am_Error_e CAmRouter::doConnectionFormatsForPath(am_Route_s & routeObjects,
+ std::vector<CAmNode<am_RoutingNodeData_s>*> & nodes,
+ std::vector<am_RoutingElement_s>::iterator routingElementIterator,
+ std::vector<CAmNode<am_RoutingNodeData_s>*>::iterator nodeIterator)
{
- std::vector<CAmRoutingTreeItem*>::iterator it = mListChild.begin();
- for (; it != mListChild.end(); ++it)
+ am_Error_e returnError = E_NOT_POSSIBLE;
+ std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
+ std::vector<am_CustomConnectionFormat_t> listMergeConnectionFormats;
+
+ std::vector<CAmNode<am_RoutingNodeData_s>*>::iterator currentNodeIterator = nodeIterator;
+ std::vector<am_RoutingElement_s>::iterator currentRoutingElementIterator = routingElementIterator;
+
+ if (currentRoutingElementIterator!=routeObjects.route.begin())
{
- delete *it;
+ std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
+ std::vector<am_RoutingElement_s>::iterator tempIterator = (currentRoutingElementIterator-1);
+ CAmNode<am_RoutingNodeData_s> * currentNode = *currentNodeIterator;
+ getSourceSinkPossibleConnectionFormats(currentNodeIterator+1, currentNodeIterator+2, listConnectionFormats);
+
+ if(currentNode->getData().type==am_RoutingNodeData_s::am_NodeDataType_e::GATEWAY)
+ {
+ am_Gateway_s *gateway = currentNode->getData().data.gateway;
+ getMergeConnectionFormats(gateway, tempIterator->connectionFormat, listConnectionFormats, listMergeConnectionFormats);
+ }
+ else if(currentNode->getData().type==am_RoutingNodeData_s::am_NodeDataType_e::CONVERTER)
+ {
+ am_Converter_s *converter = currentNode->getData().data.converter;
+ getMergeConnectionFormats(converter, tempIterator->connectionFormat, listConnectionFormats, listMergeConnectionFormats);
+ }
+ currentNodeIterator+=3;
}
+ else
+ {
+ CAmNode<am_RoutingNodeData_s> * currentNode = *currentNodeIterator;
+ assert(currentNode->getData().type==am_RoutingNodeData_s::am_NodeDataType_e::SOURCE);
+
+ currentNodeIterator++;
+ assert(currentNodeIterator!=nodes.end());
+
+ CAmNode<am_RoutingNodeData_s> * nodeSink = *currentNodeIterator;
+ assert(nodeSink->getData().type==am_RoutingNodeData_s::am_NodeDataType_e::SINK);
+
+ am_Source_s *source = currentNode->getData().data.source;
+ am_Sink_s *sink = nodeSink->getData().data.sink;
+ CAmRouter::listPossibleConnectionFormats(source->listConnectionFormats, sink->listConnectionFormats, listMergeConnectionFormats);
+ currentNodeIterator+=1; //now we are on the next converter/gateway
+ }
+
+ //let the controller decide:
+ std::vector<am_CustomConnectionFormat_t> listPriorityConnectionFormats;
+ mpControlSender->getConnectionFormatChoice(currentRoutingElementIterator->sourceID, currentRoutingElementIterator->sinkID, routeObjects,
+ listMergeConnectionFormats, listPriorityConnectionFormats);
+
+ //we have the list sorted after priors - now we try one after the other with the next part of the route
+ std::vector<am_CustomConnectionFormat_t>::iterator connectionFormatIterator = listPriorityConnectionFormats.begin();
+ //here we need to check if we are at the end and stop
+ std::vector<am_RoutingElement_s>::iterator nextIterator = currentRoutingElementIterator + 1;//next pair source and sink
+ if (nextIterator == routeObjects.route.end())
+ {
+ if (!listPriorityConnectionFormats.empty())
+ {
+ currentRoutingElementIterator->connectionFormat = listPriorityConnectionFormats.front();
+ return (E_OK);
+ }
+ else
+ return (E_NOT_POSSIBLE);
+ }
+
+ for (; connectionFormatIterator != listPriorityConnectionFormats.end(); ++connectionFormatIterator)
+ {
+ currentRoutingElementIterator->connectionFormat = *connectionFormatIterator;
+ if ((returnError = doConnectionFormatsForPath(routeObjects, nodes, nextIterator, currentNodeIterator)) == E_OK)
+ {
+ break;
+ }
+ }
+ return (returnError);
+}
+
+void CAmRouter::getShortestPath(const CAmNode<am_RoutingNodeData_s> & source,
+ const CAmNode<am_RoutingNodeData_s> & destination,
+ std::vector<CAmNode<am_RoutingNodeData_s>*> & resultPath)
+{
+ mRoutingGraph.getShortestPath(source, destination, resultPath);
+}
+
+void CAmRouter::getShortestPath(std::vector<CAmNode<am_RoutingNodeData_s>*> & resultPath)
+{
+ getShortestPath(*mpRootSource, *mpRootSink, resultPath);
}
+
+void CAmRouter::getShortestPath(CAmNode<am_RoutingNodeData_s> & aSource, CAmNode<am_RoutingNodeData_s> & aSink,
+ am_Route_s & resultPath, std::vector<CAmNode<am_RoutingNodeData_s>*> & resultNodesPath)
+{
+ am_RoutingElement_s * element;
+ am_RoutingNodeData_s & sinkNodeData = aSink.getData();
+ am_RoutingNodeData_s & sourceNodeData = aSource.getData();
+ resultPath.sinkID = sinkNodeData.data.sink->sinkID;
+ resultPath.sourceID = sourceNodeData.data.source->sourceID;
+
+ std::function<void(const am_GraphPathPosition_e, CAmNode<am_RoutingNodeData_s> &)> cb = [&](const am_GraphPathPosition_e, CAmNode<am_RoutingNodeData_s> & object)
+ {
+ resultNodesPath.insert(resultNodesPath.begin(), (CAmNode<am_RoutingNodeData_s>*)&object);
+ am_RoutingNodeData_s & routingData = object.getData();
+ if(routingData.type==am_RoutingNodeData_s::am_NodeDataType_e::SINK)
+ {
+ auto iter = resultPath.route.emplace(resultPath.route.begin());
+ element = &(*iter);
+ element->domainID = routingData.data.sink->domainID;
+ element->sinkID = routingData.data.sink->sinkID;
+ element->connectionFormat = CF_UNKNOWN;
+ }
+ else if(routingData.type==am_RoutingNodeData_s::am_NodeDataType_e::SOURCE)
+ {
+ element->domainID = routingData.data.source->domainID;
+ element->sourceID = routingData.data.source->sourceID;
+ element->connectionFormat = CF_UNKNOWN;
+ }
+ };
+ mRoutingGraph.getShortestPath(aSource, aSink, cb);
+}
+
+void CAmRouter::getShortestPath(am_Route_s & resultPath, std::vector<CAmNode<am_RoutingNodeData_s>*> & resultNodesPath)
+{
+ getShortestPath(*mpRootSource, *mpRootSink, resultPath, resultNodesPath);
+}
+
+am_Error_e CAmRouter::getAllPaths(CAmNode<am_RoutingNodeData_s> & aSource, CAmNode<am_RoutingNodeData_s> & aSink,
+ std::vector<am_Route_s> & resultPath, std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultNodesPath)
+{
+ uint8_t errorsCount = 0, successCount = 0;
+ mRoutingGraph.getAllPaths(aSource, aSink, [&](const std::vector<CAmNode<am_RoutingNodeData_s>*> & path) {
+ resultNodesPath.push_back(path);
+ resultPath.emplace_back();
+ am_Route_s & nextRoute = resultPath.back();
+ nextRoute.sinkID = aSink.getData().data.sink->sinkID;
+ nextRoute.sourceID = aSource.getData().data.source->sourceID;
+ am_RoutingElement_s * element;
+ for(auto it = path.begin(); it!=path.end(); it++)
+ {
+ am_RoutingNodeData_s & routingData = (*it)->getData();
+ if(routingData.type==am_RoutingNodeData_s::am_NodeDataType_e::SOURCE)
+ {
+ auto iter = nextRoute.route.emplace(nextRoute.route.end());
+ element = &(*iter);
+ element->domainID = routingData.data.source->domainID;
+ element->sourceID = routingData.data.source->sourceID;
+ element->connectionFormat = CF_UNKNOWN;
+ }
+ else if(routingData.type==am_RoutingNodeData_s::am_NodeDataType_e::SINK)
+ {
+ element->domainID = routingData.data.sink->domainID;
+ element->sinkID = routingData.data.sink->sinkID;
+ element->connectionFormat = CF_UNKNOWN;
+ }
+ }
+ am_Error_e err = determineConnectionFormatsForPath(nextRoute, (std::vector<CAmNode<am_RoutingNodeData_s>*> &)path);
+ if(err!=E_OK)
+ {
+ errorsCount++;
+ auto last = resultPath.end()-1;
+ resultPath.erase(last);
+#ifdef TRACE_GRAPH
+ std::cout<<"Error by determining connection formats for path from source:"<<nextRoute.sourceID<<" to sink:"<<nextRoute.sinkID<<"\n";
+#endif
+ }
+ else
+ {
+#ifdef TRACE_GRAPH
+ std::cout<<"Successfully determined connection formats for path from source:"<<nextRoute.sourceID<<" to sink:"<<nextRoute.sinkID<<"\n";
+#endif
+ successCount++;
+ }
+ });
+ if(successCount)
+ return E_OK;
+ if(errorsCount)
+ return E_NOT_POSSIBLE;
+ return E_OK;
+}
+
+am_Error_e CAmRouter::getAllPaths(std::vector<am_Route_s> & resultPath, std::vector<std::vector<CAmNode<am_RoutingNodeData_s>*>> & resultNodesPath)
+{
+ return getAllPaths(*mpRootSource, *mpRootSink, resultPath, resultNodesPath);
+}
+
+#endif
+
+void CAmRouter::clear()
+{
+ mNodeListSourceStatus.clear();
+ mNodeListSinkStatus.clear();
+ mNodeListConverterStatus.clear();
+ mNodeListGatewayStatus.clear();
+
+ mRoutingGraph.clear();
+ mNodeListSources.clear();
+ mNodeListSinks.clear();
+ mNodeListGateways.clear();
+ mNodeListConverters.clear();
+ mpRootSource=NULL;
+ mpRootSink=NULL;
+}
+
+
}
diff --git a/AudioManagerDaemon/src/CAmRoutingReceiver.cpp b/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
index eaa38e1..67bc911 100644
--- a/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
@@ -238,11 +238,21 @@ am_Error_e CAmRoutingReceiver::registerGateway(const am_Gateway_s & gatewayData,
return (mpControlSender->hookSystemRegisterGateway(gatewayData, gatewayID));
}
+am_Error_e CAmRoutingReceiver::registerConverter(const am_Converter_s& converterData, am_converterID_t& converterID)
+{
+ return (mpControlSender->hookSystemRegisterConverter(converterData, converterID));
+}
+
am_Error_e CAmRoutingReceiver::deregisterGateway(const am_gatewayID_t gatewayID)
{
return (mpControlSender->hookSystemDeregisterGateway(gatewayID));
}
+am_Error_e CAmRoutingReceiver::deregisterConverter(const am_converterID_t converterID)
+{
+ return (mpControlSender->hookSystemDeregisterConverter(converterID));
+}
+
am_Error_e CAmRoutingReceiver::peekSink(const std::string& name, am_sinkID_t & sinkID)
{
return (mpDatabaseHandler->peekSink(name, sinkID));
@@ -418,6 +428,11 @@ am_Error_e CAmRoutingReceiver::updateGateway(const am_gatewayID_t gatewayID, con
return (mpControlSender->hookSystemUpdateGateway(gatewayID,listSourceFormats,listSinkFormats,convertionMatrix));
}
+am_Error_e CAmRoutingReceiver::updateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix)
+{
+ return (mpControlSender->hookSystemUpdateConverter(converterID,listSourceFormats,listSinkFormats,convertionMatrix));
+}
+
am_Error_e CAmRoutingReceiver::updateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
{
return (mpControlSender->hookSystemUpdateSink(sinkID,sinkClassID,listSoundProperties,listConnectionFormats,listMainSoundProperties));
diff --git a/AudioManagerDaemon/src/CAmRoutingSender.cpp b/AudioManagerDaemon/src/CAmRoutingSender.cpp
index 1606761..cd9c3d7 100644
--- a/AudioManagerDaemon/src/CAmRoutingSender.cpp
+++ b/AudioManagerDaemon/src/CAmRoutingSender.cpp
@@ -525,7 +525,11 @@ am_Error_e CAmRoutingSender::removeCrossfaderLookup(const am_crossfaderID_t cros
am_Error_e CAmRoutingSender::removeHandle(const am_Handle_s& handle)
{
if (mlistActiveHandles.erase(handle))
+ {
+ logInfo(__PRETTY_FUNCTION__,handle.handle,handle.handleType);
return (E_OK);
+ }
+ logError(__PRETTY_FUNCTION__,"Could not remove handle",handle.handle);
return (E_UNKNOWN);
}
@@ -556,6 +560,7 @@ am_Handle_s CAmRoutingSender::createHandle(const am_handleData_c& handleData, co
mlistActiveHandles.insert(std::make_pair(handle, handleData));
if ((mlistActiveHandles.size()%100) == 0)
logInfo("CAmRoutingSender::createHandle warning: too many open handles, number of handles: ", mlistActiveHandles.size());
+ logInfo(__PRETTY_FUNCTION__,handle.handle, handle.handleType);
return (handle);
}
@@ -570,9 +575,18 @@ CAmRoutingSender::am_handleData_c CAmRoutingSender::returnHandleData(const am_Ha
HandlesMap::const_iterator it = mlistActiveHandles.begin();
it = mlistActiveHandles.find(handle);
if (it!=mlistActiveHandles.end())
- return (it->second);
+ {
+ const am_handleData_c & result = it->second;
+ logInfo(__PRETTY_FUNCTION__, handle.handle, handle.handleType,
+ "connectionID", result.connectionID,
+ "sinkID", result.sinkID,
+ "sourceID",result.sourceID,
+ "sourceState", result.sourceState);
+ return result;
+ }
am_handleData_c handleData;
handleData.sinkID=0;
+ logError(__PRETTY_FUNCTION__,"could not find handle data for handle",handle.handle,handle.handleType);
return (handleData);
}
diff --git a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp
index 1881955..7f0d87d 100644
--- a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp
+++ b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp
@@ -1485,8 +1485,6 @@ TEST_F(CAmDatabaseHandlerTest,getListSinksOfDomain)
TEST_F(CAmDatabaseHandlerTest,getListGatewaysOfDomain)
{
-
-
am_Gateway_s gateway, gateway2;
am_gatewayID_t gatewayID;
am_domainID_t domainID;
@@ -1532,6 +1530,51 @@ TEST_F(CAmDatabaseHandlerTest,getListGatewaysOfDomain)
ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()) && !gatewayList.empty());
}
+TEST_F(CAmDatabaseHandlerTest,getListConvertersOfDomain)
+{
+ am_Converter_s gateway, gateway2;
+ am_converterID_t gatewayID;
+ am_domainID_t domainID;
+ am_Domain_s domain;
+ std::vector<am_converterID_t> gatewayList, gatewayCheckList;
+ pCF.createConverter(gateway);
+ gateway.converterID = 1;
+ gateway.name = "testGateway";
+ gateway.sourceID = 1;
+ gateway.sinkID = 1;
+ gateway.domainID = 1;
+ pCF.createConverter(gateway2);
+ gateway2.converterID = 2;
+ gateway2.name = "testGateway2";
+ gateway2.sourceID = 1;
+ gateway2.sinkID = 1;
+ gateway2.domainID = 1;
+ pCF.createDomain(domain);
+ gatewayCheckList.push_back(gateway.converterID);
+ gatewayCheckList.push_back(gateway2.converterID);
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ pCF.createSource(source);
+ sink.sinkID = 1;
+ source.sourceID = 1;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListConvertersOfDomain(2,gatewayList))
+ << "ERROR: database error";ASSERT_TRUE(gatewayList.empty());
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListConvertersOfDomain(1,gatewayList))
+ << "ERROR: database error";
+ ASSERT_TRUE(!gatewayList.empty());
+ ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()));
+}
+
TEST_F(CAmDatabaseHandlerTest,removeDomain)
{
am_Domain_s domain;
@@ -1574,6 +1617,31 @@ TEST_F(CAmDatabaseHandlerTest,removeGateway)
ASSERT_TRUE(listGateways.empty());
}
+TEST_F(CAmDatabaseHandlerTest,removeConverter)
+{
+ am_Converter_s gateway;
+ am_converterID_t gatewayID;
+ std::vector<am_Converter_s> listGateways;
+ pCF.createConverter(gateway);
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ pCF.createSource(source);
+ sink.sinkID = 1;
+ source.sourceID = 2;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.removeConverterDB(gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListConverters(listGateways))
+ << "ERROR: database error";
+ ASSERT_TRUE(listGateways.empty());
+}
+
TEST_F(CAmDatabaseHandlerTest,removeSink)
{
am_Sink_s sink;
@@ -1641,10 +1709,14 @@ TEST_F(CAmDatabaseHandlerTest,removeNonexistentGateway)
<< "ERROR: database error";
}
-TEST_F(CAmDatabaseHandlerTest,registerGatewayCorrect)
+TEST_F(CAmDatabaseHandlerTest,removeNonexistentConverter)
{
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeConverterDB(12))
+ << "ERROR: database error";
+}
-
+TEST_F(CAmDatabaseHandlerTest,registerGatewayCorrect)
+{
//initialize gateway
std::vector<am_Gateway_s> returnList;
am_Gateway_s gateway, gateway1, gateway2;
@@ -1705,10 +1777,70 @@ TEST_F(CAmDatabaseHandlerTest,registerGatewayCorrect)
ASSERT_EQ(true, equal);
}
-TEST_F(CAmDatabaseHandlerTest,getGatewayInfo)
+TEST_F(CAmDatabaseHandlerTest,registerConverterCorrect)
{
+ //initialize gateway
+ std::vector<am_Converter_s> returnList;
+ am_Converter_s gateway, gateway1, gateway2;
+ am_converterID_t converterID = 0, converterID1 = 0, converterID2 = 0;
+
+ pCF.createConverter(gateway);
+ pCF.createConverter(gateway1);
+ gateway1.converterID = 20;
+ pCF.createConverter(gateway2);
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ pCF.createSource(source);
+ sink.sinkID = 1;
+ source.sourceID = 2;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,converterID))
+ << "ERROR: database error";
+ ASSERT_EQ(100,converterID)
+ << "ERROR: domainID zero";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway1,converterID1))
+ << "ERROR: database error";
+ ASSERT_EQ(gateway1.converterID,converterID1)
+ << "ERROR: domainID zero";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,converterID2))
+ << "ERROR: database error";
+ ASSERT_EQ(101,converterID2)
+ << "ERROR: domainID zero";
+ //now check if we read out the correct values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConverters(returnList));
+ bool equal = true;
+ std::vector<am_Converter_s>::iterator listIterator = returnList.begin();
+
+ for (; listIterator < returnList.end(); ++listIterator)
+ {
+ if (listIterator->converterID == converterID)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway);
+ }
+
+ if (listIterator->converterID == converterID1)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway1);
+ }
+
+ if (listIterator->converterID == converterID2)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway2);
+ }
+ }
+
+ ASSERT_EQ(true, equal);
+}
+
+TEST_F(CAmDatabaseHandlerTest,getGatewayInfo)
+{
//initialize gateway
std::vector<am_Gateway_s> returnList;
am_Gateway_s gateway, gateway1, gateway2;
@@ -1774,6 +1906,73 @@ TEST_F(CAmDatabaseHandlerTest,getGatewayInfo)
}
+TEST_F(CAmDatabaseHandlerTest,getConverterInfo)
+{
+ //initialize gateway
+ std::vector<am_Converter_s> returnList;
+ am_Converter_s gateway, gateway1, gateway2;
+ am_converterID_t converterID = 0, converterID1 = 0, converterID2 = 0;
+
+ pCF.createConverter(gateway);
+ pCF.createConverter(gateway1);
+ gateway1.converterID = 20;
+ pCF.createConverter(gateway2);
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ pCF.createSource(source);
+ sink.sinkID = 1;
+ source.sourceID = 2;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,converterID))
+ << "ERROR: database error";
+ ASSERT_EQ(100,converterID)
+ << "ERROR: domainID zero";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway1,converterID1))
+ << "ERROR: database error";
+ ASSERT_EQ(gateway1.converterID,converterID1)
+ << "ERROR: domainID zero";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,converterID2))
+ << "ERROR: database error";
+ ASSERT_EQ(101,converterID2)
+ << "ERROR: domainID zero";
+
+ //now check if we read out the correct values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConverters(returnList));
+ bool equal = true;
+ std::vector<am_Converter_s>::iterator listIterator = returnList.begin();
+
+ for (; listIterator < returnList.end(); ++listIterator)
+ {
+ if (listIterator->converterID == converterID)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway);
+ }
+
+ if (listIterator->converterID == converterID1)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway1);
+ }
+
+ if (listIterator->converterID == converterID2)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway2);
+ }
+ }
+
+ ASSERT_EQ(true, equal);
+
+ am_Converter_s gatewayInfo;
+ ASSERT_EQ(E_OK, pDatabaseHandler.getConverterInfoDB(20,gatewayInfo));
+ ASSERT_TRUE(pCF.compareConverter1(gateway1,gatewayInfo));
+
+}
+
TEST_F(CAmDatabaseHandlerTest,enterSinkThatAlreadyExistFail)
{
//fill the connection database
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp b/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
index 29dc8ce..13de48b 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
+++ b/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
@@ -1547,6 +1547,58 @@ TEST_F(CAmMapHandlerTest,getListGatewaysOfDomain)
ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()) && !gatewayList.empty());
}
+TEST_F(CAmMapHandlerTest,getListConvertersOfDomain)
+{
+ am_Converter_s converter, converter2;
+ am_converterID_t converterID1, converterID2;
+ am_domainID_t domainID;
+ am_Domain_s domain;
+ std::vector<am_converterID_t> converterList, converterCheckList;
+
+ pCF.createDomain(domain);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+
+ pCF.createConverter(converter);
+ converter.converterID = 1;
+ converter.name = "testGateway";
+ converter.sourceID = 1;
+ converter.sinkID = 1;
+ converter.domainID = domainID;
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(converter,converterID1))
+ << "ERROR: database error";
+ ASSERT_EQ(true, converterID1==1);
+
+ pCF.createConverter(converter2);
+ converter2.converterID = 2;
+ converter2.name = "testGateway2";
+ converter2.domainID = 4;
+ converter2.sourceID = 1;
+ converter2.sinkID = 1;
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(converter2,converterID2))
+ << "ERROR: database error";
+ ASSERT_EQ(true, converterID2==2);
+ converterCheckList.push_back(converterID1);
+
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ sink.sinkID = sinkID;
+
+ pCF.createSource(source);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ source.sourceID = sourceID;
+
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListConvertersOfDomain(4,converterList))
+ << "ERROR: database error";
+ ASSERT_TRUE(converterList.empty());
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListConvertersOfDomain(domainID,converterList))
+ << "ERROR: database error";
+ ASSERT_TRUE(std::equal(converterList.begin(),converterList.end(),converterCheckList.begin()) && !converterList.empty());
+}
+
TEST_F(CAmMapHandlerTest,removeDomain)
{
am_Domain_s domain;
@@ -1564,8 +1616,6 @@ TEST_F(CAmMapHandlerTest,removeDomain)
TEST_F(CAmMapHandlerTest,removeGateway)
{
-
-
am_Gateway_s gateway;
am_gatewayID_t gatewayID;
std::vector<am_Gateway_s> listGateways;
@@ -1589,6 +1639,31 @@ TEST_F(CAmMapHandlerTest,removeGateway)
ASSERT_TRUE(listGateways.empty());
}
+TEST_F(CAmMapHandlerTest,removeConverter)
+{
+ am_Converter_s converter;
+ am_converterID_t converterID;
+ std::vector<am_Converter_s> listConverters;
+ pCF.createConverter(converter);
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ pCF.createSource(source);
+ sink.sinkID = 1;
+ source.sourceID = 2;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(converter,converterID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.removeConverterDB(converterID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListConverters(listConverters))
+ << "ERROR: database error";
+ ASSERT_TRUE(listConverters.empty());
+}
+
TEST_F(CAmMapHandlerTest,removeSink)
{
am_Sink_s sink;
@@ -1656,10 +1731,14 @@ TEST_F(CAmMapHandlerTest,removeNonexistentGateway)
<< "ERROR: database error";
}
-TEST_F(CAmMapHandlerTest,registerGatewayCorrect)
+TEST_F(CAmMapHandlerTest,removeNonexistentConverter)
{
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeConverterDB(12))
+ << "ERROR: database error";
+}
-
+TEST_F(CAmMapHandlerTest,registerGatewayCorrect)
+{
//initialize gateway
std::vector<am_Gateway_s> returnList;
am_Gateway_s gateway, gateway1, gateway2;
@@ -1720,6 +1799,68 @@ TEST_F(CAmMapHandlerTest,registerGatewayCorrect)
ASSERT_EQ(true, equal);
}
+TEST_F(CAmMapHandlerTest,registerConverterCorrect)
+{
+ //initialize gateway
+ std::vector<am_Converter_s> returnList;
+ am_Converter_s gateway, gateway1, gateway2;
+ am_converterID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
+
+ pCF.createConverter(gateway);
+ pCF.createConverter(gateway1);
+ gateway1.converterID = 20;
+ pCF.createConverter(gateway2);
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ pCF.createSource(source);
+ sink.sinkID = 1;
+ source.sourceID = 2;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(100,gatewayID)
+ << "ERROR: domainID zero";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway1,gatewayID1))
+ << "ERROR: database error";
+ ASSERT_EQ(gateway1.converterID,gatewayID1)
+ << "ERROR: domainID zero";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,gatewayID2))
+ << "ERROR: database error";
+ ASSERT_EQ(101,gatewayID2)
+ << "ERROR: domainID zero";
+
+ //now check if we read out the correct values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConverters(returnList));
+ bool equal = true;
+ std::vector<am_Converter_s>::iterator listIterator = returnList.begin();
+
+ for (; listIterator < returnList.end(); ++listIterator)
+ {
+ if (listIterator->converterID == gatewayID)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway);
+ }
+
+ if (listIterator->converterID == gatewayID1)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway1);
+ }
+
+ if (listIterator->converterID == gatewayID2)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway2);
+ }
+ }
+
+ ASSERT_EQ(true, equal);
+}
+
TEST_F(CAmMapHandlerTest,getGatewayInfo)
{
@@ -1789,6 +1930,73 @@ TEST_F(CAmMapHandlerTest,getGatewayInfo)
}
+TEST_F(CAmMapHandlerTest,getConverterInfo)
+{
+ //initialize gateway
+ std::vector<am_Converter_s> returnList;
+ am_Converter_s gateway, gateway1, gateway2;
+ am_converterID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
+
+ pCF.createConverter(gateway);
+ pCF.createConverter(gateway1);
+ gateway1.converterID = 20;
+ pCF.createConverter(gateway2);
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ pCF.createSource(source);
+ sink.sinkID = 1;
+ source.sourceID = 2;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(100,gatewayID)
+ << "ERROR: domainID zero";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway1,gatewayID1))
+ << "ERROR: database error";
+ ASSERT_EQ(gateway1.converterID,gatewayID1)
+ << "ERROR: domainID zero";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,gatewayID2))
+ << "ERROR: database error";
+ ASSERT_EQ(101,gatewayID2)
+ << "ERROR: domainID zero";
+
+ //now check if we read out the correct values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConverters(returnList));
+ bool equal = true;
+ std::vector<am_Converter_s>::iterator listIterator = returnList.begin();
+
+ for (; listIterator < returnList.end(); ++listIterator)
+ {
+ if (listIterator->converterID == gatewayID)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway);
+ }
+
+ if (listIterator->converterID == gatewayID1)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway1);
+ }
+
+ if (listIterator->converterID == gatewayID2)
+ {
+ equal = equal && pCF.compareConverter(listIterator, gateway2);
+ }
+ }
+
+ ASSERT_EQ(true, equal);
+
+ am_Converter_s gatewayInfo;
+ ASSERT_EQ(E_OK, pDatabaseHandler.getConverterInfoDB(20,gatewayInfo));
+ ASSERT_TRUE(pCF.compareConverter1(gateway1,gatewayInfo));
+
+}
+
TEST_F(CAmMapHandlerTest,enterSinkThatAlreadyExistFail)
{
//fill the connection database
@@ -2665,6 +2873,41 @@ TEST_F(CAmMapHandlerObserverCallbacksTest, enter_removeGateway)
ASSERT_EQ(E_OK,pDatabaseHandler.removeGatewayDB(gatewayID2))<< "ERROR: database error";
}
+TEST_F(CAmMapHandlerObserverCallbacksTest, enter_removeConverter)
+{
+ //initialize gateway
+ std::vector<am_Converter_s> returnList;
+ am_Converter_s gateway, gateway1, gateway2;
+ am_converterID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
+ pCF.createConverter(gateway);
+ pCF.createConverter(gateway1);
+ gateway1.converterID = 20;
+ pCF.createConverter(gateway2);
+ am_Sink_s sink;
+ am_Source_s source;
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ pCF.createSink(sink);
+ pCF.createSource(source);
+ sink.sinkID = 1;
+ source.sourceID = 2;
+ EXPECT_CALL(*MockDatabaseObserver::getMockObserverObject(), newSink(_)).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ EXPECT_CALL(*MockDatabaseObserver::getMockObserverObject(), newSource(_)).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ EXPECT_CALL(*MockDatabaseObserver::getMockObserverObject(), newConverter(Field(&am_Converter_s::converterID, 100))).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway,gatewayID))<< "ERROR: database error";
+ ASSERT_EQ(100,gatewayID)<< "ERROR: domainID zero";
+ EXPECT_CALL(*MockDatabaseObserver::getMockObserverObject(), newConverter(Field(&am_Converter_s::converterID, 20))).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway1,gatewayID1))<< "ERROR: database error";
+ ASSERT_EQ(gateway1.converterID,gatewayID1)<< "ERROR: domainID zero";
+ EXPECT_CALL(*MockDatabaseObserver::getMockObserverObject(), newConverter(Field(&am_Converter_s::converterID, 101))).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConverterDB(gateway2,gatewayID2))<< "ERROR: database error";
+ ASSERT_EQ(101,gatewayID2)<< "ERROR: domainID zero";
+ EXPECT_CALL(*MockDatabaseObserver::getMockObserverObject(), removeConverter(gatewayID2)).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.removeConverterDB(gatewayID2))<< "ERROR: database error";
+}
+
TEST_F(CAmMapHandlerObserverCallbacksTest, enter_removeCrossfader)
{
am_Crossfader_s crossfader;
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp b/AudioManagerDaemon/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp
index 87942c5..fecf214 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp
+++ b/AudioManagerDaemon/test/AmMapHandlerTest/CAmTestDatabaseObserver.cpp
@@ -46,6 +46,8 @@ void CAmDatabaseObserver::newDomain(const am_Domain_s& domain)
{ MockDatabaseObserver::getMockObserverObject()->newDomain(domain); }
void CAmDatabaseObserver::newGateway(const am_Gateway_s& gateway)
{ MockDatabaseObserver::getMockObserverObject()->newGateway(gateway); }
+void CAmDatabaseObserver::newConverter(const am_Converter_s& coverter)
+{ MockDatabaseObserver::getMockObserverObject()->newConverter(coverter); }
void CAmDatabaseObserver::newCrossfader(const am_Crossfader_s& crossfader)
{ MockDatabaseObserver::getMockObserverObject()->newCrossfader(crossfader); }
void CAmDatabaseObserver::newMainConnection(const am_MainConnectionType_s& mainConnection)
@@ -60,6 +62,8 @@ void CAmDatabaseObserver::removeDomain(const am_domainID_t domainID)
{ MockDatabaseObserver::getMockObserverObject()->removeDomain(domainID); }
void CAmDatabaseObserver::removeGateway(const am_gatewayID_t gatewayID)
{ MockDatabaseObserver::getMockObserverObject()->removeGateway(gatewayID); }
+void CAmDatabaseObserver::removeConverter(const am_converterID_t converterID)
+{ MockDatabaseObserver::getMockObserverObject()->removeConverter(converterID); }
void CAmDatabaseObserver::removeCrossfader(const am_crossfaderID_t crossfaderID)
{ MockDatabaseObserver::getMockObserverObject()->removeCrossfader(crossfaderID); }
void CAmDatabaseObserver::mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/MockDatabaseObserver.h b/AudioManagerDaemon/test/AmMapHandlerTest/MockDatabaseObserver.h
index 52f2599..34de3cd 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/MockDatabaseObserver.h
+++ b/AudioManagerDaemon/test/AmMapHandlerTest/MockDatabaseObserver.h
@@ -47,6 +47,7 @@ public:
virtual void newSource(const am_Source_s& source) = 0;
virtual void newDomain(const am_Domain_s& domain) = 0;
virtual void newGateway(const am_Gateway_s& gateway) = 0;
+ virtual void newConverter(const am_Converter_s& coverter) = 0;
virtual void newCrossfader(const am_Crossfader_s& crossfader) = 0;
virtual void newMainConnection(const am_MainConnectionType_s& mainConnection) = 0;
virtual void removedMainConnection(const am_mainConnectionID_t mainConnection) = 0;
@@ -54,6 +55,7 @@ public:
virtual void removedSource(const am_sourceID_t sourceID, const bool visible) = 0;
virtual void removeDomain(const am_domainID_t domainID) = 0;
virtual void removeGateway(const am_gatewayID_t gatewayID) = 0;
+ virtual void removeConverter(const am_converterID_t converterID) = 0;
virtual void removeCrossfader(const am_crossfaderID_t crossfaderID) = 0;
virtual void mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) = 0;
virtual void mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty) = 0;
@@ -79,6 +81,7 @@ class MockDatabaseObserver : public IAmDatabaseObserver{
MOCK_METHOD1(newSource, void(const am_Source_s& source));
MOCK_METHOD1(newDomain, void(const am_Domain_s& domain));
MOCK_METHOD1(newGateway, void(const am_Gateway_s& gateway));
+ MOCK_METHOD1(newConverter, void(const am_Converter_s& converter));
MOCK_METHOD1(newCrossfader, void(const am_Crossfader_s& crossfader));
MOCK_METHOD1(newMainConnection, void(const am_MainConnectionType_s & mainConnection));
MOCK_METHOD1(removedMainConnection, void(const am_mainConnectionID_t mainConnection));
@@ -86,6 +89,7 @@ class MockDatabaseObserver : public IAmDatabaseObserver{
MOCK_METHOD2(removedSource, void(const am_sourceID_t sourceID, const bool visible));
MOCK_METHOD1(removeDomain, void(const am_domainID_t domainID));
MOCK_METHOD1(removeGateway, void(const am_gatewayID_t gatewayID));
+ MOCK_METHOD1(removeConverter, void(const am_converterID_t converterID));
MOCK_METHOD1(removeCrossfader, void(const am_crossfaderID_t crossfaderID));
MOCK_METHOD2(mainConnectionStateChanged, void(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState));
MOCK_METHOD2(mainSinkSoundPropertyChanged, void(const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty));
diff --git a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp b/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
index 2ea9639..a6680e5 100644
--- a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
+++ b/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
@@ -12,7 +12,7 @@
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*
- * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
+ * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013, 2014
*
* For further information see http://www.genivi.org/.
*
@@ -22,6 +22,7 @@
#include <string.h>
#include "shared/CAmDltWrapper.h"
+
using namespace am;
using namespace testing;
@@ -65,6 +66,85 @@ ACTION(returnConnectionFormat){
arg4=arg3;
}
+void CAmRouterMapTest::enterDomainDB(const std::string & domainName, am_domainID_t & domainID)
+{
+ am_Domain_s domain1;
+ domain1.domainID = 0;
+ domain1.name = domainName;
+ domain1.busname = "domain1bus";
+ domain1.state = DS_CONTROLLED;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID));
+}
+
+void CAmRouterMapTest::enterSourceDB(const std::string & sourceName, const am_domainID_t domainID, const std::vector<am_CustomConnectionFormat_t> & connectionFormats, am_sourceID_t & sourceID)
+{
+ am_Source_s source;
+ source.domainID = domainID;
+ source.name = sourceName;
+ source.sourceState = SS_ON;
+ source.sourceID = 0;
+ source.sourceClassID = 5;
+ source.listConnectionFormats = connectionFormats;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+}
+
+void CAmRouterMapTest::enterSinkDB(const std::string & sinkName, const am_domainID_t domainID, const std::vector<am_CustomConnectionFormat_t> & connectionFormats, am_sinkID_t & sinkID)
+{
+ am_Sink_s sink;
+ sink.domainID = domainID;
+ sink.name = sinkName;
+ sink.sinkID = 0;
+ sink.sinkClassID = 5;
+ sink.muteState = MS_MUTED;
+ sink.listConnectionFormats = connectionFormats;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+}
+
+void CAmRouterMapTest::enterGatewayDB(const std::string & gwName,
+ const am_domainID_t domainSourceID,
+ const am_domainID_t domainSinkID,
+ const std::vector<am_CustomConnectionFormat_t> & sourceConnectionFormats,
+ const std::vector<am_CustomConnectionFormat_t> & sinkConnectionFormats,
+ const std::vector<bool> & matrix,
+ const am_sourceID_t & sourceID,
+ const am_sinkID_t & sinkID,
+ am_gatewayID_t & gatewayID)
+{
+ am_Gateway_s gateway;
+ gateway.controlDomainID = domainSourceID;
+ gateway.gatewayID = 0;
+ gateway.sinkID = sinkID;
+ gateway.sourceID = sourceID;
+ gateway.domainSourceID = domainSourceID;
+ gateway.domainSinkID = domainSinkID;
+ gateway.listSinkFormats = sinkConnectionFormats;
+ gateway.listSourceFormats = sourceConnectionFormats;
+ gateway.convertionMatrix = matrix;
+ gateway.name = gwName;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
+}
+
+void CAmRouterMapTest::enterConverterDB(const std::string & gwName,
+ const am_domainID_t domainID,
+ const std::vector<am_CustomConnectionFormat_t> & sourceConnectionFormats,
+ const std::vector<am_CustomConnectionFormat_t> & sinkConnectionFormats,
+ const std::vector<bool> & matrix,
+ const am_sourceID_t & sourceID,
+ const am_sinkID_t & sinkID,
+ am_converterID_t & converterID)
+{
+ am_Converter_s converter;
+ converter.converterID = 0;
+ converter.sinkID = sinkID;
+ converter.sourceID = sourceID;
+ converter.domainID = domainID;
+ converter.listSinkFormats = sinkConnectionFormats;
+ converter.listSourceFormats = sourceConnectionFormats;
+ converter.convertionMatrix = matrix;
+ converter.name = gwName;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterConverterDB(converter,converterID));
+}
+
//test that checks just sinks and source in a domain but connectionformats do not match
TEST_F(CAmRouterMapTest,simpleRoute2withDomainNoMatchFormats)
{
@@ -121,9 +201,13 @@ TEST_F(CAmRouterMapTest,simpleRoute2withDomainNoMatchFormats)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(true,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
-
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(true, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
}
//test that checks just sinks and source in a domain
@@ -182,17 +266,19 @@ TEST_F(CAmRouterMapTest,simpleRoute2withDomain)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(true,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
-
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(true, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
//test that checks just 2 domains, one sink one source with only one connection format each
TEST_F(CAmRouterMapTest,simpleRoute2DomainsOnlyFree)
{
-
-
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -290,17 +376,20 @@ TEST_F(CAmRouterMapTest,simpleRoute2DomainsOnlyFree)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+
ASSERT_EQ(E_OK, pRouter.getRoute(true,sourceID,sinkID,listRoutes));
ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
-
}
+
//test that checks just 2 domains, one sink one source with only one connection format each
TEST_F(CAmRouterMapTest,simpleRoute2DomainsOnlyFreeNotFree)
{
-
-
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -412,18 +501,23 @@ TEST_F(CAmRouterMapTest,simpleRoute2DomainsOnlyFreeNotFree)
ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,id1));
ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection1,id2));
- ASSERT_EQ(E_OK, pRouter.getRoute(true,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
-
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(true, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
+
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
//test that checks just 2 domains, with gateway for each direction (possible circular route)
TEST_F(CAmRouterMapTest,simpleRoute2DomainsCircularGWOnlyFree)
{
-
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -549,15 +643,19 @@ TEST_F(CAmRouterMapTest,simpleRoute2DomainsCircularGWOnlyFree)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(true,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(true, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
//test that checks 3 domains, one sink one source, longer lists of connectionformats.
TEST_F(CAmRouterMapTest,simpleRoute3DomainsListConnectionFormats_2)
{
-
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -709,9 +807,13 @@ TEST_F(CAmRouterMapTest,simpleRoute3DomainsListConnectionFormats_2)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
//test that checks 3 domains, one sink one source, longer lists of connectionformats.
@@ -863,9 +965,13 @@ TEST_F(CAmRouterMapTest,simpleRoute3DomainsListConnectionFormats_1)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
@@ -1012,9 +1118,13 @@ TEST_F(CAmRouterMapTest,simpleRoute3DomainsListConnectionFormats)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
@@ -1246,23 +1356,27 @@ TEST_F(CAmRouterMapTest,simpleRoute4Domains2Routes)
compareRoute1.sinkID = sinkID;
compareRoute1.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(2), listRoutes.size());
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(2), listRoutes.size());
bool containsRoute1 = std::find_if(listRoutes.begin(), listRoutes.end(), [&](const am_Route_s & ref) {
- return pCF.compareRoute(compareRoute, ref);
- })!=listRoutes.end();
- bool containsRoute2 = std::find_if(listRoutes.begin(), listRoutes.end(), [&](const am_Route_s & ref) {
- return pCF.compareRoute(compareRoute1, ref);
- })!=listRoutes.end();
- ASSERT_TRUE(containsRoute1);
+ return pCF.compareRoute(compareRoute, ref);
+ })!=listRoutes.end();
+ bool containsRoute2 = std::find_if(listRoutes.begin(), listRoutes.end(), [&](const am_Route_s & ref) {
+ return pCF.compareRoute(compareRoute1, ref);
+ })!=listRoutes.end();
+
+ ASSERT_TRUE(containsRoute1);
ASSERT_TRUE(containsRoute2);
}
//test that checks 3 domains, one sink one source but the connectionformat of third domains do not fit.
TEST_F(CAmRouterMapTest,simpleRoute3DomainsNoConnection)
{
-
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -1400,14 +1514,17 @@ TEST_F(CAmRouterMapTest,simpleRoute3DomainsNoConnection)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
}
//test that checks just 2 domains, one sink one source with only one connection format each
TEST_F(CAmRouterMapTest,simpleRoute2Domains)
{
-
-
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -1505,17 +1622,18 @@ TEST_F(CAmRouterMapTest,simpleRoute2Domains)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
-
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
//test that checks just 2 domains, one sink one source but the connectionformat of source
TEST_F(CAmRouterMapTest,simpleRoute2DomainsNoMatchConnectionFormats)
{
-
-
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -1591,31 +1709,14 @@ TEST_F(CAmRouterMapTest,simpleRoute2DomainsNoMatchConnectionFormats)
ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
std::vector<am_Route_s> listRoutes;
- std::vector<am_RoutingElement_s> listRoutingElements;
- am_RoutingElement_s hopp1;
- am_RoutingElement_s hopp2;
-
- hopp1.sinkID = gwSinkID;
- hopp1.sourceID = sourceID;
- hopp1.domainID = domainID1;
- hopp1.connectionFormat = source.listConnectionFormats[0];
-
- hopp2.sinkID = sinkID;
- hopp2.sourceID = gwSourceID;
- hopp2.domainID = domainID2;
- hopp2.connectionFormat = sink.listConnectionFormats[0];
-
- listRoutingElements.push_back(hopp1);
- listRoutingElements.push_back(hopp2);
- am_Route_s compareRoute;
- compareRoute.route = listRoutingElements;
- compareRoute.sinkID = sinkID;
- compareRoute.sourceID = sourceID;
-
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
-}
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
+ }
//test that checks 3 domains, one sink one source.
TEST_F(CAmRouterMapTest,simpleRoute3Domains)
@@ -1757,9 +1858,14 @@ TEST_F(CAmRouterMapTest,simpleRoute3Domains)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
//test that checks 4 domains, one sink and one source.
@@ -1942,10 +2048,860 @@ TEST_F(CAmRouterMapTest,simpleRoute4Domains)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
- ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- size_t size(1);
- ASSERT_EQ(size, listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ am::am_Source_s sourceDb;
+ am::am_Sink_s sinkDb;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sinkDb);
+ pDatabaseHandler.getSourceInfoDB(sourceID, sourceDb);
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, sourceDb, sinkDb, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+}
+
+TEST_F(CAmRouterMapTest,getAllowedFormatsFromConvMatrix)
+{
+ std::vector<bool> convertionMatrix;
+ convertionMatrix.push_back(1);
+ convertionMatrix.push_back(0);
+ convertionMatrix.push_back(0);
+ convertionMatrix.push_back(1);
+ convertionMatrix.push_back(1);
+ convertionMatrix.push_back(0);
+
+ std::vector<am_CustomConnectionFormat_t> listSourceFormats;
+ listSourceFormats.push_back(CF_GENIVI_ANALOG);
+ listSourceFormats.push_back(CF_GENIVI_STEREO);
+
+ std::vector<am_CustomConnectionFormat_t> listSinkFormats;
+ listSinkFormats.push_back(CF_GENIVI_MONO);
+ listSinkFormats.push_back(CF_GENIVI_AUTO);
+ listSinkFormats.push_back(CF_GENIVI_STEREO);
+
+ std::vector<am_CustomConnectionFormat_t> sourceFormats;
+ std::vector<am_CustomConnectionFormat_t> sinkFormats;
+
+ ASSERT_TRUE(CAmRouter::getAllowedFormatsFromConvMatrix(convertionMatrix, listSourceFormats, listSinkFormats, sourceFormats, sinkFormats));
+
+ ASSERT_TRUE(sourceFormats.size()==3);
+ ASSERT_TRUE(sinkFormats.size()==3);
+ ASSERT_TRUE(sourceFormats.at(0)==CF_GENIVI_ANALOG);
+ ASSERT_TRUE(sourceFormats.at(1)==CF_GENIVI_STEREO);
+ ASSERT_TRUE(sourceFormats.at(2)==CF_GENIVI_ANALOG);
+ ASSERT_TRUE(sinkFormats.at(0)==CF_GENIVI_MONO);
+ ASSERT_TRUE(sinkFormats.at(1)==CF_GENIVI_AUTO);
+ ASSERT_TRUE(sinkFormats.at(2)==CF_GENIVI_STEREO);
+
+ sinkFormats.clear();
+ sourceFormats.clear();
+ convertionMatrix.clear();
+ listSinkFormats.clear();
+ listSourceFormats.clear();
+
+ convertionMatrix.push_back(1);
+ listSinkFormats.push_back(CF_GENIVI_STEREO);
+ listSourceFormats.push_back(CF_GENIVI_STEREO);
+
+ ASSERT_TRUE(CAmRouter::getAllowedFormatsFromConvMatrix(convertionMatrix, listSourceFormats, listSinkFormats, sourceFormats, sinkFormats));
+
+ sinkFormats.clear();
+ sourceFormats.clear();
+ convertionMatrix.clear();
+ listSinkFormats.clear();
+ listSourceFormats.clear();
+
+ convertionMatrix.push_back(1);
+ convertionMatrix.push_back(0);
+ listSourceFormats.push_back(CF_GENIVI_STEREO);
+ listSinkFormats.push_back(CF_GENIVI_STEREO);
+
+ ASSERT_FALSE(CAmRouter::getAllowedFormatsFromConvMatrix(convertionMatrix, listSourceFormats, listSinkFormats, sourceFormats, sinkFormats));
+
+ sinkFormats.clear();
+ sourceFormats.clear();
+ convertionMatrix.clear();
+ listSinkFormats.clear();
+ listSourceFormats.clear();
+
+ convertionMatrix.push_back(1);
+ listSinkFormats.push_back(CF_GENIVI_STEREO);
+
+ ASSERT_FALSE(CAmRouter::getAllowedFormatsFromConvMatrix(convertionMatrix, listSourceFormats, listSinkFormats, sourceFormats, sinkFormats));
+}
+
+TEST_F(CAmRouterMapTest,route1Domain1Source1Sink)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ am_domainID_t domainID1;
+ enterDomainDB("domain1", domainID1);
+
+ am_sourceID_t sourceID;
+ std::vector<am_CustomConnectionFormat_t> cf1;
+ cf1.push_back(CF_GENIVI_STEREO);
+ cf1.push_back(CF_GENIVI_ANALOG);
+ enterSourceDB("source1", domainID1, cf1, sourceID);
+
+ am_sinkID_t sinkID;
+ std::vector<am_CustomConnectionFormat_t> cf2;
+ cf2.push_back(CF_GENIVI_ANALOG);
+ cf2.push_back(CF_GENIVI_MONO);
+ enterSinkDB("sink1", domainID1, cf2, sinkID);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+
+ pDatabaseHandler.getSinkInfoDB(sinkID, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements;
+ am_RoutingElement_s hopp1;
+
+ hopp1.sourceID = sourceID;
+ hopp1.sinkID = sinkID;
+ hopp1.domainID = domainID1;
+ hopp1.connectionFormat = cf2[0];
+
+ listRoutingElements.push_back(hopp1);
+
+ am_Route_s compareRoute;
+ compareRoute.route = listRoutingElements;
+ compareRoute.sinkID = sinkID;
+ compareRoute.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+}
+
+TEST_F(CAmRouterMapTest,route1Domain1Source1Converter1Sink)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ am_domainID_t domainID1;
+ enterDomainDB("domain1", domainID1);
+
+ am_sourceID_t sourceID;
+ std::vector<am_CustomConnectionFormat_t> cf1;
+ cf1.push_back(CF_GENIVI_STEREO);
+ cf1.push_back(CF_GENIVI_AUTO);
+ enterSourceDB("source1", domainID1, cf1, sourceID);
+
+ am_sinkID_t sinkID1, sinkID2;
+ std::vector<am_CustomConnectionFormat_t> cf2;
+ cf2.push_back(CF_GENIVI_MONO);
+ cf2.push_back(CF_GENIVI_ANALOG);
+ enterSinkDB("sink1", domainID1, cf2, sinkID1);
+ enterSinkDB("sink2", domainID1, cf2, sinkID2);
+
+ am_sourceID_t gwSourceID;
+ std::vector<am_CustomConnectionFormat_t> cf3;
+ cf3.push_back(CF_GENIVI_MONO);
+ cf3.push_back(CF_GENIVI_ANALOG);
+ enterSourceDB("gwSource1", domainID1, cf3, gwSourceID);
+
+ am_sinkID_t gwSinkID;
+ std::vector<am_CustomConnectionFormat_t> cf4;
+ cf4.push_back(CF_GENIVI_STEREO);
+ cf4.push_back(CF_GENIVI_ANALOG);
+ enterSinkDB("gwSink1", domainID1, cf4, gwSinkID);
+
+ am_converterID_t converterID;
+ std::vector<bool> matrix;
+ matrix.resize(4, false);
+ matrix[0]=(true);
+ matrix[1]=(true);
+ enterConverterDB("converter", domainID1, cf3, cf4, matrix, gwSourceID, gwSinkID, converterID);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+
+ pDatabaseHandler.getSinkInfoDB(sinkID1, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements;
+ am_RoutingElement_s hopp1;
+ am_RoutingElement_s hopp2;
+
+ hopp1.sourceID = sourceID;
+ hopp1.sinkID = gwSinkID;
+ hopp1.domainID = domainID1;
+ hopp1.connectionFormat = CF_GENIVI_STEREO;
+
+ hopp2.sourceID = gwSourceID;
+ hopp2.sinkID = sinkID1;
+ hopp2.domainID = domainID1;
+ hopp2.connectionFormat = CF_GENIVI_MONO;
+
+ listRoutingElements.push_back(hopp1);
+ listRoutingElements.push_back(hopp2);
+
+ am_Route_s compareRoute;
+ compareRoute.route = listRoutingElements;
+ compareRoute.sinkID = sinkID1;
+ compareRoute.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+}
+
+TEST_F(CAmRouterMapTest,route1Domain1Source3Converters1Sink)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ am_domainID_t domainID1;
+ enterDomainDB("domain1", domainID1);
+
+ std::vector<am_CustomConnectionFormat_t> cf1;
+ cf1.push_back(CF_GENIVI_STEREO);
+ std::vector<am_CustomConnectionFormat_t> cf2;
+ cf2.push_back(CF_GENIVI_MONO);
+ std::vector<am_CustomConnectionFormat_t> cf3;
+ cf3.push_back(CF_GENIVI_AUTO);
+
+ am_sourceID_t sourceID;
+ enterSourceDB("source1", domainID1, cf1, sourceID);
+
+ am_sinkID_t sinkID;
+ enterSinkDB("sink1", domainID1, cf3, sinkID);
+
+ am_sourceID_t gwSourceID;
+ enterSourceDB("gwSource1", domainID1, cf2, gwSourceID);
+ am_sinkID_t gwSinkID;
+ enterSinkDB("gwSink1", domainID1, cf1, gwSinkID);
+ am_converterID_t converterID;
+ std::vector<bool> matrix;
+ matrix.push_back(true);
+ enterConverterDB("converter1", domainID1, cf2, cf1, matrix, gwSourceID, gwSinkID, converterID);
+
+ am_sourceID_t gwSourceID1;
+ enterSourceDB("gwSource2", domainID1, cf2, gwSourceID1);
+ am_sinkID_t gwSinkID1;
+ enterSinkDB("gwSink2", domainID1, cf1, gwSinkID1);
+ am_converterID_t converterID1;
+ enterConverterDB("converter2", domainID1, cf2, cf1, matrix, gwSourceID1, gwSinkID1, converterID1);
+
+ am_sourceID_t gwSourceID2;
+ enterSourceDB("gwSource3", domainID1, cf3, gwSourceID2);
+ am_sinkID_t gwSinkID2;
+ enterSinkDB("gwSink3", domainID1, cf2, gwSinkID2);
+ am_converterID_t converterID2;
+ enterConverterDB("converter3", domainID1, cf3, cf2, matrix, gwSourceID2, gwSinkID2, converterID2);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+ pDatabaseHandler.getSinkInfoDB(sinkID, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements1;
+ std::vector<am_RoutingElement_s> listRoutingElements2;
+ am_RoutingElement_s hopp11;
+ am_RoutingElement_s hopp12;
+ am_RoutingElement_s hopp13;
+ am_RoutingElement_s hopp21;
+ am_RoutingElement_s hopp22;
+
+ hopp11.sourceID = sourceID;
+ hopp11.sinkID = gwSinkID;
+ hopp11.domainID = domainID1;
+ hopp11.connectionFormat = CF_GENIVI_STEREO;
+
+ hopp12.sourceID = gwSourceID;
+ hopp12.sinkID = gwSinkID2;
+ hopp12.domainID = domainID1;
+ hopp12.connectionFormat = CF_GENIVI_MONO;
+
+ hopp21.sourceID = sourceID;
+ hopp21.sinkID = gwSinkID1;
+ hopp21.domainID = domainID1;
+ hopp21.connectionFormat = CF_GENIVI_STEREO;
+
+ hopp22.sourceID = gwSourceID1;
+ hopp22.sinkID = gwSinkID2;
+ hopp22.domainID = domainID1;
+ hopp22.connectionFormat = CF_GENIVI_MONO;
+
+ hopp13.sourceID = gwSourceID2;
+ hopp13.sinkID = sinkID;
+ hopp13.domainID = domainID1;
+ hopp13.connectionFormat = CF_GENIVI_AUTO;
+
+ listRoutingElements1.push_back(hopp11);
+ listRoutingElements1.push_back(hopp12);
+ listRoutingElements1.push_back(hopp13);
+
+ listRoutingElements2.push_back(hopp21);
+ listRoutingElements2.push_back(hopp22);
+ listRoutingElements2.push_back(hopp13);
+
+ am_Route_s compareRoute1;
+ compareRoute1.route = listRoutingElements1;
+ compareRoute1.sinkID = sinkID;
+ compareRoute1.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+ ASSERT_EQ(static_cast<uint>(2), listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
+
+ am_Route_s compareRoute2;
+ compareRoute2.route = listRoutingElements2;
+ compareRoute2.sinkID = sinkID;
+ compareRoute2.sourceID = sourceID;
+ ASSERT_TRUE(pCF.compareRoute(compareRoute2,listRoutes[1]));
+}
+
+TEST_F(CAmRouterMapTest,route2Domains1Source1Sink)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ am_domainID_t domainID1, domainID2;
+ enterDomainDB("domain1", domainID1);
+ enterDomainDB("domain2", domainID2);
+
+ am_sourceID_t sourceID;
+ std::vector<am_CustomConnectionFormat_t> cf1;
+ cf1.push_back(CF_GENIVI_STEREO);
+ enterSourceDB("source1", domainID1, cf1, sourceID);
+
+ am_sinkID_t sinkID;
+ std::vector<am_CustomConnectionFormat_t> cf2;
+ cf2.push_back(CF_GENIVI_ANALOG);
+ enterSinkDB("sink1", domainID2, cf2, sinkID);
+
+ am_sourceID_t gwSourceID;
+ std::vector<am_CustomConnectionFormat_t> cf3;
+ cf3.push_back(CF_GENIVI_ANALOG);
+ enterSourceDB("gwSource1", domainID2, cf3, gwSourceID);
+
+ am_sinkID_t gwSinkID;
+ std::vector<am_CustomConnectionFormat_t> cf4;
+ cf4.push_back(CF_GENIVI_STEREO);
+ enterSinkDB("gwSink1", domainID1, cf4, gwSinkID);
+
+ am_gatewayID_t gatewayID;
+ std::vector<bool> matrix;
+ matrix.push_back(true);
+ enterGatewayDB("gateway", domainID2, domainID1, cf3, cf4, matrix, gwSourceID, gwSinkID, gatewayID);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+
+ pDatabaseHandler.getSinkInfoDB(sinkID, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+ std::vector<am_Route_s> listRoutes;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+
+ am_Route_s compareRoute1;
+ compareRoute1.sinkID = sinkID;
+ compareRoute1.sourceID = sourceID;
+ compareRoute1.route.push_back({sourceID, gwSinkID, domainID1, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({gwSourceID, sinkID, domainID2, CF_GENIVI_ANALOG});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
+}
+
+TEST_F(CAmRouterMapTest,route3Domains1Source1Sink)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ am_domainID_t domainID1, domainID2, domainID3;
+ enterDomainDB("domain1", domainID1);
+ enterDomainDB("domain2", domainID2);
+ enterDomainDB("domain3", domainID3);
+
+ std::vector<am_CustomConnectionFormat_t> cfStereo;
+ cfStereo.push_back(CF_GENIVI_STEREO);
+ std::vector<am_CustomConnectionFormat_t> cfAnalog;
+ cfAnalog.push_back(CF_GENIVI_ANALOG);
+ std::vector<am_CustomConnectionFormat_t> cfMono;
+ cfMono.push_back(CF_GENIVI_MONO);
+
+ am_sourceID_t sourceID;
+ enterSourceDB("source1", domainID1, cfStereo, sourceID);
+
+ am_sinkID_t gwSinkID1;
+ enterSinkDB("gwSink1", domainID1, cfStereo, gwSinkID1);
+
+ am_sourceID_t gwSourceID1;
+ enterSourceDB("gwSource1", domainID2, cfMono, gwSourceID1);
+
+ std::vector<bool> matrix;
+ matrix.push_back(true);
+
+ am_gatewayID_t gatewayID;
+ enterGatewayDB("gateway", domainID2, domainID1, cfMono, cfStereo, matrix, gwSourceID1, gwSinkID1, gatewayID);
+
+ am_sourceID_t gwSourceID2;
+ enterSourceDB("gwSource2", domainID3, cfStereo, gwSourceID2);
+
+ am_sinkID_t gwSinkID2;
+ enterSinkDB("gwSink2", domainID2, cfMono, gwSinkID2);
+
+ am_sinkID_t sinkID;
+ enterSinkDB("sink1", domainID3, cfStereo, sinkID);
+
+ am_gatewayID_t gatewayID1;
+ enterGatewayDB("gateway", domainID3, domainID2, cfStereo, cfMono, matrix, gwSourceID2, gwSinkID2, gatewayID1);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+
+ pDatabaseHandler.getSinkInfoDB(sinkID, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+ std::vector<am_Route_s> listRoutes;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+
+ am_Route_s compareRoute1;
+ compareRoute1.sinkID = sinkID;
+ compareRoute1.sourceID = sourceID;
+ compareRoute1.route.push_back({sourceID, gwSinkID1, domainID1, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({gwSourceID1, gwSinkID2, domainID2, CF_GENIVI_MONO});
+ compareRoute1.route.push_back({gwSourceID2, sinkID, domainID3, CF_GENIVI_STEREO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
+}
+
+TEST_F(CAmRouterMapTest,route3Domains1Source3Gateways3Convertres1Sink)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ am_domainID_t domainID1, domainID2, domainID3;
+ enterDomainDB("domain1", domainID1);
+ enterDomainDB("domain2", domainID2);
+ enterDomainDB("domain3", domainID3);
+
+ std::vector<am_CustomConnectionFormat_t> cfStereo;
+ cfStereo.push_back(CF_GENIVI_STEREO);
+ std::vector<am_CustomConnectionFormat_t> cfAnalog;
+ cfAnalog.push_back(CF_GENIVI_ANALOG);
+ std::vector<am_CustomConnectionFormat_t> cfMono;
+ cfMono.push_back(CF_GENIVI_MONO);
+ std::vector<am_CustomConnectionFormat_t> cfAuto;
+ cfAuto.push_back(CF_GENIVI_AUTO);
+
+ am_sourceID_t sourceID;
+ enterSourceDB("source1", domainID1, cfStereo, sourceID);
+
+ am_sinkID_t gwSinkID1;
+ enterSinkDB("gwSink1", domainID1, cfStereo, gwSinkID1);
+
+ am_sourceID_t gwSourceID1;
+ enterSourceDB("gwSource1", domainID2, cfMono, gwSourceID1);
+ std::vector<bool> matrix;
+ matrix.push_back(true);
+ am_gatewayID_t gatewayID;
+ enterGatewayDB("gateway1", domainID2, domainID1, cfMono, cfStereo, matrix, gwSourceID1, gwSinkID1, gatewayID);
+
+
+ am_sourceID_t gwSourceID21;
+ enterSourceDB("gwSource21", domainID3, cfAuto, gwSourceID21);
+ am_sinkID_t gwSinkID21;
+ enterSinkDB("gwSink21", domainID1, cfMono, gwSinkID21);
+ am_gatewayID_t gatewayID21;
+ enterGatewayDB("gateway21", domainID3, domainID2, cfAuto, cfMono, matrix, gwSourceID21, gwSinkID21, gatewayID21);
+
+ am_sourceID_t gwSourceID22;
+ enterSourceDB("gwSource22", domainID3, cfAuto, gwSourceID22);
+ am_sinkID_t gwSinkID22;
+ enterSinkDB("gwSink22", domainID2, cfMono, gwSinkID22);
+ am_gatewayID_t gatewayID22;
+ enterGatewayDB("gateway22", domainID3, domainID2, cfAuto, cfMono, matrix, gwSourceID22, gwSinkID22, gatewayID22);
+
+ am_sourceID_t gwSourceID3;
+ enterSourceDB("gwSource3", domainID3, cfAnalog, gwSourceID3);
+ am_sinkID_t gwSinkID3;
+ enterSinkDB("gwSink3", domainID3, cfAuto, gwSinkID3);
+ am_converterID_t converterID1;
+ enterConverterDB("converter1", domainID3, cfAnalog, cfAuto, matrix, gwSourceID3, gwSinkID3, converterID1);
+
+ am_sourceID_t gwSourceID4;
+ enterSourceDB("gwSource4", domainID3, cfStereo, gwSourceID4);
+ am_sinkID_t gwSinkID4;
+ enterSinkDB("gwSink4", domainID3, cfAnalog, gwSinkID4);
+ am_converterID_t converterID2;
+ enterConverterDB("converter2", domainID3, cfStereo, cfAnalog, matrix, gwSourceID4, gwSinkID4, converterID2);
+
+ am_sourceID_t gwSourceID5;
+ enterSourceDB("gwSource5", domainID3, cfStereo, gwSourceID5);
+ am_sinkID_t gwSinkID5;
+ enterSinkDB("gwSink5", domainID3, cfAnalog, gwSinkID5);
+ am_converterID_t converterID3;
+ enterConverterDB("converter3", domainID3, cfStereo, cfAnalog, matrix, gwSourceID5, gwSinkID5, converterID3);
+
+ am_sinkID_t sinkID;
+ enterSinkDB("sink1", domainID3, cfStereo, sinkID);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+
+ pDatabaseHandler.getSinkInfoDB(sinkID, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+ std::vector<am_Route_s> listRoutes;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+ ASSERT_EQ(static_cast<uint>(4), listRoutes.size());
+
+ am_Route_s compareRoute1;
+ compareRoute1.sinkID = sinkID;
+ compareRoute1.sourceID = sourceID;
+ compareRoute1.route.push_back({sourceID, gwSinkID1, domainID1, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({gwSourceID1, gwSinkID21, domainID1, CF_GENIVI_MONO});
+ compareRoute1.route.push_back({gwSourceID21, gwSinkID3, domainID3, CF_GENIVI_AUTO});
+ compareRoute1.route.push_back({gwSourceID3, gwSinkID4, domainID3, CF_GENIVI_ANALOG});
+ compareRoute1.route.push_back({gwSourceID4, sinkID, domainID3, CF_GENIVI_STEREO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
+
+ am_Route_s compareRoute2;
+ compareRoute2.sinkID = sinkID;
+ compareRoute2.sourceID = sourceID;
+ compareRoute2.route.push_back({sourceID, gwSinkID1, domainID1, CF_GENIVI_STEREO});
+ compareRoute2.route.push_back({gwSourceID1, gwSinkID21, domainID1, CF_GENIVI_MONO});
+ compareRoute2.route.push_back({gwSourceID21, gwSinkID3, domainID3, CF_GENIVI_AUTO});
+ compareRoute2.route.push_back({gwSourceID3, gwSinkID5, domainID3, CF_GENIVI_ANALOG});
+ compareRoute2.route.push_back({gwSourceID5, sinkID, domainID3, CF_GENIVI_STEREO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute2,listRoutes[1]));
+
+
+ am_Route_s compareRoute3;
+ compareRoute3.sinkID = sinkID;
+ compareRoute3.sourceID = sourceID;
+ compareRoute3.route.push_back({sourceID, gwSinkID1, domainID1, CF_GENIVI_STEREO});
+ compareRoute3.route.push_back({gwSourceID1, gwSinkID22, domainID2, CF_GENIVI_MONO});
+ compareRoute3.route.push_back({gwSourceID22, gwSinkID3, domainID3, CF_GENIVI_AUTO});
+ compareRoute3.route.push_back({gwSourceID3, gwSinkID4, domainID3, CF_GENIVI_ANALOG});
+ compareRoute3.route.push_back({gwSourceID4, sinkID, domainID3, CF_GENIVI_STEREO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute3,listRoutes[2]));
+
+ am_Route_s compareRoute4;
+ compareRoute4.sinkID = sinkID;
+ compareRoute4.sourceID = sourceID;
+ compareRoute4.route.push_back({sourceID, gwSinkID1, domainID1, CF_GENIVI_STEREO});
+ compareRoute4.route.push_back({gwSourceID1, gwSinkID22, domainID2, CF_GENIVI_MONO});
+ compareRoute4.route.push_back({gwSourceID22, gwSinkID3, domainID3, CF_GENIVI_AUTO});
+ compareRoute4.route.push_back({gwSourceID3, gwSinkID5, domainID3, CF_GENIVI_ANALOG});
+ compareRoute4.route.push_back({gwSourceID5, sinkID, domainID3, CF_GENIVI_STEREO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute4,listRoutes[3]));
+}
+
+TEST_F(CAmRouterMapTest,routeSource1Sink2PathThroughConv1Gate1)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ std::vector<bool> matrix;
+ matrix.push_back(true);
+ am_domainID_t domainID1, domainID2;
+ enterDomainDB("domain1", domainID1);
+ enterDomainDB("domain2", domainID2);
+
+ std::vector<am_CustomConnectionFormat_t> cfStereo;
+ cfStereo.push_back(CF_GENIVI_STEREO);
+ std::vector<am_CustomConnectionFormat_t> cfAnalog;
+ cfAnalog.push_back(CF_GENIVI_ANALOG);
+ std::vector<am_CustomConnectionFormat_t> cfMono;
+ cfMono.push_back(CF_GENIVI_MONO);
+ std::vector<am_CustomConnectionFormat_t> cfAuto;
+ cfAuto.push_back(CF_GENIVI_AUTO);
+
+ am_sourceID_t sourceID;
+ enterSourceDB("source1", domainID1, cfStereo, sourceID);
+
+ am_sinkID_t gwSinkID1;
+ enterSinkDB("gwSink1", domainID1, cfMono, gwSinkID1);
+
+ am_sinkID_t coSinkID21;
+ enterSinkDB("coSink21", domainID1, cfStereo, coSinkID21);
+
+ am_sourceID_t coSourceID21;
+ enterSourceDB("coSource21", domainID1, cfMono, coSourceID21);
+
+ am_converterID_t converterID1;
+ enterConverterDB("converter1", domainID1, cfMono, cfStereo, matrix, coSourceID21, coSinkID21, converterID1);
+
+ am_sourceID_t gwSourceID1;
+ enterSourceDB("gwSource21", domainID2, cfAuto, gwSourceID1);
+
+ am_gatewayID_t gatewayID;
+ enterGatewayDB("gateway1", domainID2, domainID1, cfAuto, cfMono, matrix, gwSourceID1, gwSinkID1, gatewayID);
+
+ am_sinkID_t sinkID1;
+ enterSinkDB("sink1", domainID2, cfAuto, sinkID1);
+
+ am_sinkID_t sinkID2;
+ enterSinkDB("sink2", domainID1, cfAuto, sinkID2);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink1;
+ pDatabaseHandler.getSinkInfoDB(sinkID1, sink1);
+ am::am_Sink_s sink2;
+ pDatabaseHandler.getSinkInfoDB(sinkID2, sink2);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+ std::vector<am_Route_s> listRoutes;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink1, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+
+ am_Route_s compareRoute1;
+ compareRoute1.sinkID = sinkID1;
+ compareRoute1.sourceID = sourceID;
+ compareRoute1.route.push_back({sourceID, coSinkID21, domainID1, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({coSourceID21, gwSinkID1, domainID1, CF_GENIVI_MONO});
+ compareRoute1.route.push_back({gwSourceID1, sinkID1, domainID2, CF_GENIVI_AUTO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
+
+ listRoutes.clear();
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink2, listRoutes));
+ ASSERT_EQ(static_cast<uint>(0), listRoutes.size());
+}
+
+TEST_F(CAmRouterMapTest, routeSource1Sink1PathThroughDomain2)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ std::vector<bool> matrix;
+ matrix.push_back(true);
+ am_domainID_t domainID1, domainID2;
+ enterDomainDB("domain1", domainID1);
+ enterDomainDB("domain2", domainID2);
+
+ std::vector<am_CustomConnectionFormat_t> cfStereo;
+ cfStereo.push_back(CF_GENIVI_STEREO);
+ std::vector<am_CustomConnectionFormat_t> cfAnalog;
+ cfAnalog.push_back(CF_GENIVI_ANALOG);
+ std::vector<am_CustomConnectionFormat_t> cfMono;
+ cfMono.push_back(CF_GENIVI_MONO);
+ std::vector<am_CustomConnectionFormat_t> cfAuto;
+ cfAuto.push_back(CF_GENIVI_AUTO);
+
+ am_sourceID_t sourceID;
+ enterSourceDB("source1", domainID1, cfStereo, sourceID);
+
+ am_sinkID_t gwSinkID11;
+ enterSinkDB("gwSink11", domainID1, cfStereo, gwSinkID11);
+ am_sourceID_t gwSourceID11;
+ enterSourceDB("gwSource11", domainID2, cfAnalog, gwSourceID11);
+ am_converterID_t gatewayID1;
+ enterGatewayDB("gateway1", domainID2, domainID1, cfAnalog, cfStereo, matrix, gwSourceID11, gwSinkID11, gatewayID1);
+
+ am_sinkID_t gwSinkID21;
+ enterSinkDB("gwSink21", domainID2, cfAnalog, gwSinkID21);
+ am_sourceID_t gwSourceID12;
+ enterSourceDB("gwSource12", domainID1, cfAuto, gwSourceID12);
+ am_gatewayID_t gatewayID2;
+ enterGatewayDB("gateway2", domainID1, domainID2, cfAuto, cfAnalog, matrix, gwSourceID12, gwSinkID21, gatewayID2);
+
+ am_sinkID_t sinkID;
+ enterSinkDB("sink1", domainID1, cfAuto, sinkID);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+
+ pDatabaseHandler.getSinkInfoDB(sinkID, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+ std::vector<am_Route_s> listRoutes;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+
+ am_Route_s compareRoute1;
+ compareRoute1.sinkID = sinkID;
+ compareRoute1.sourceID = sourceID;
+ compareRoute1.route.push_back({sourceID, gwSinkID11, domainID1, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({gwSourceID11, gwSinkID21, domainID2, CF_GENIVI_ANALOG});
+ compareRoute1.route.push_back({gwSourceID12, sinkID, domainID1, CF_GENIVI_AUTO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
+}
+
+TEST_F(CAmRouterMapTest, routeSource1Sink1PathThroughGate1Conv2Gate2)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ std::vector<bool> matrix;
+ matrix.push_back(true);
+ am_domainID_t domainID1, domainID2;
+ enterDomainDB("domain1", domainID1);
+ enterDomainDB("domain2", domainID2);
+
+ std::vector<am_CustomConnectionFormat_t> cfStereo;
+ cfStereo.push_back(CF_GENIVI_STEREO);
+ std::vector<am_CustomConnectionFormat_t> cfAnalog;
+ cfAnalog.push_back(CF_GENIVI_ANALOG);
+ std::vector<am_CustomConnectionFormat_t> cfMono;
+ cfMono.push_back(CF_GENIVI_MONO);
+ std::vector<am_CustomConnectionFormat_t> cfAuto;
+ cfAuto.push_back(CF_GENIVI_AUTO);
+
+ am_sourceID_t sourceID;
+ enterSourceDB("source1", domainID1, cfStereo, sourceID);
+
+ am_sinkID_t gwSinkID11;
+ enterSinkDB("gwSink11", domainID1, cfStereo, gwSinkID11);
+
+ am_sourceID_t gwSourceID21;
+ enterSourceDB("gwSource21", domainID2, cfAnalog, gwSourceID21);
+
+ am_converterID_t gatewayID1;
+ enterGatewayDB("gateway1", domainID2, domainID1, cfAnalog, cfStereo, matrix, gwSourceID21, gwSinkID11, gatewayID1);
+
+ am_sinkID_t gwSinkID21;
+ enterSinkDB("gwSink21", domainID2, cfStereo, gwSinkID21);
+
+ am_sourceID_t gwSourceID12;
+ enterSourceDB("gwSource12", domainID1, cfAuto, gwSourceID12);
+
+ am_sinkID_t coSinkID21;
+ enterSinkDB("coSink21", domainID2, cfAnalog, coSinkID21);
+
+ am_sourceID_t coSourceID21;
+ enterSourceDB("coSource21", domainID2, cfStereo, coSourceID21);
+
+ am_converterID_t converterID2;
+ enterConverterDB("converter2", domainID2, cfStereo, cfAnalog, matrix, coSourceID21, coSinkID21, converterID2);
+
+
+ am_gatewayID_t gatewayID2;
+ enterGatewayDB("gateway2", domainID1, domainID2, cfAuto, cfStereo, matrix, gwSourceID12, gwSinkID21, gatewayID2);
+
+ am_sinkID_t sinkID;
+ enterSinkDB("sink1", domainID1, cfAuto, sinkID);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+
+ pDatabaseHandler.getSinkInfoDB(sinkID, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+ std::vector<am_Route_s> listRoutes;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+ ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
+
+ am_Route_s compareRoute1;
+ compareRoute1.sinkID = sinkID;
+ compareRoute1.sourceID = sourceID;
+ compareRoute1.route.push_back({sourceID, gwSinkID11, domainID1, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({gwSourceID21, coSinkID21, domainID2, CF_GENIVI_ANALOG});
+ compareRoute1.route.push_back({coSourceID21, gwSinkID21, domainID2, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({gwSourceID12, sinkID, domainID1, CF_GENIVI_AUTO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
+}
+
+TEST_F(CAmRouterMapTest, routeSource1Sink1PathThroughConv1Gate1Conv2Gate2)
+{
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ std::vector<bool> matrix;
+ matrix.push_back(true);
+ am_domainID_t domainID1, domainID2;
+ enterDomainDB("domain1", domainID1);
+ enterDomainDB("domain2", domainID2);
+
+ std::vector<am_CustomConnectionFormat_t> cfStereo;
+ cfStereo.push_back(CF_GENIVI_STEREO);
+ std::vector<am_CustomConnectionFormat_t> cfAnalog;
+ cfAnalog.push_back(CF_GENIVI_ANALOG);
+ std::vector<am_CustomConnectionFormat_t> cfMono;
+ cfMono.push_back(CF_GENIVI_MONO);
+ std::vector<am_CustomConnectionFormat_t> cfAuto;
+ cfAuto.push_back(CF_GENIVI_AUTO);
+ std::vector<am_CustomConnectionFormat_t> cfFuture1;
+ cfFuture1.push_back(5);
+ std::vector<am_CustomConnectionFormat_t> cfFuture2;
+ cfFuture2.push_back(6);
+
+ am_sourceID_t sourceID;
+ enterSourceDB("source1", domainID1, cfStereo, sourceID);
+
+ am_sinkID_t coSinkID11;
+ enterSinkDB("coSink11", domainID1, cfStereo, coSinkID11);
+ am_sourceID_t coSourceID11;
+ enterSourceDB("coSource11", domainID1, cfFuture1, coSourceID11);
+ am_converterID_t converterID11;
+ enterConverterDB("converter11", domainID1, cfFuture1, cfStereo, matrix, coSourceID11, coSinkID11, converterID11);
+
+ am_sinkID_t coSinkID12;
+ enterSinkDB("coSink12", domainID1, cfStereo, coSinkID12);
+ am_sourceID_t coSourceID12;
+ enterSourceDB("coSource12", domainID1, cfFuture2, coSourceID12);
+ am_converterID_t converterID12;
+ enterConverterDB("converter12", domainID1, cfFuture2, cfStereo, matrix, coSourceID12, coSinkID12, converterID12);
+
+ am_sinkID_t coSinkID13;
+ enterSinkDB("coSink13", domainID1, cfFuture2, coSinkID13);
+ am_sourceID_t coSourceID13;
+ enterSourceDB("coSource13", domainID1, cfFuture1, coSourceID13);
+ am_converterID_t converterID13;
+ enterConverterDB("converter13", domainID1, cfFuture1, cfFuture2, matrix, coSourceID13, coSinkID13, converterID13);
+
+ am_sinkID_t gwSinkID11;
+ enterSinkDB("gwSink11", domainID1, cfFuture1, gwSinkID11);
+ am_sourceID_t gwSourceID21;
+ enterSourceDB("gwSource21", domainID2, cfAnalog, gwSourceID21);
+ am_converterID_t gatewayID1;
+ enterGatewayDB("gateway1", domainID2, domainID1, cfAnalog, cfFuture1, matrix, gwSourceID21, gwSinkID11, gatewayID1);
+
+ am_sinkID_t gwSinkID21;
+ enterSinkDB("gwSink21", domainID2, cfStereo, gwSinkID21);
+
+ am_sourceID_t gwSourceID12;
+ enterSourceDB("gwSource12", domainID1, cfAuto, gwSourceID12);
+
+ am_sinkID_t coSinkID21;
+ enterSinkDB("coSink21", domainID2, cfAnalog, coSinkID21);
+
+ am_sourceID_t coSourceID21;
+ enterSourceDB("coSource21", domainID2, cfStereo, coSourceID21);
+
+ am_converterID_t converterID2;
+ enterConverterDB("converter2", domainID2, cfStereo, cfAnalog, matrix, coSourceID21, coSinkID21, converterID2);
+
+
+ am_gatewayID_t gatewayID2;
+ enterGatewayDB("gateway2", domainID1, domainID2, cfAuto, cfStereo, matrix, gwSourceID12, gwSinkID21, gatewayID2);
+
+ am_sinkID_t sinkID;
+ enterSinkDB("sink1", domainID1, cfAuto, sinkID);
+
+ am::am_Source_s source;
+ am::am_Sink_s sink;
+
+ pDatabaseHandler.getSinkInfoDB(sinkID, sink);
+ pDatabaseHandler.getSourceInfoDB(sourceID, source);
+
+ std::vector<am_Route_s> listRoutes;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false, source, sink, listRoutes));
+
+ ASSERT_EQ(static_cast<uint>(2), listRoutes.size());
+
+ am_Route_s compareRoute1;
+ compareRoute1.sinkID = sinkID;
+ compareRoute1.sourceID = sourceID;
+ compareRoute1.route.push_back({sourceID, coSinkID11, domainID1, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({coSourceID11, gwSinkID11, domainID1, 5});
+ compareRoute1.route.push_back({gwSourceID21, coSinkID21, domainID2, CF_GENIVI_ANALOG});
+ compareRoute1.route.push_back({coSourceID21, gwSinkID21, domainID2, CF_GENIVI_STEREO});
+ compareRoute1.route.push_back({gwSourceID12, sinkID, domainID1, CF_GENIVI_AUTO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
+
+ am_Route_s compareRoute2;
+ compareRoute2.sinkID = sinkID;
+ compareRoute2.sourceID = sourceID;
+ compareRoute2.route.push_back({sourceID, coSinkID12, domainID1, CF_GENIVI_STEREO});
+ compareRoute2.route.push_back({coSourceID12, coSinkID13, domainID1, 6});
+ compareRoute2.route.push_back({coSourceID13, gwSinkID21, domainID1, 5});
+ compareRoute2.route.push_back({gwSourceID21, coSinkID21, domainID2, CF_GENIVI_ANALOG});
+ compareRoute2.route.push_back({gwSourceID12, sinkID, domainID1, CF_GENIVI_AUTO});
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[0]));
}
int main(int argc, char **argv)
diff --git a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.h b/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.h
index ead077c..19bccfe 100644
--- a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.h
+++ b/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.h
@@ -12,7 +12,7 @@
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*
-* \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013
+* \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013, 2014
*
* For further information see http://www.genivi.org/.
*
@@ -72,6 +72,28 @@ public:
void TearDown();
void createMainConnectionSetup();
+
+ void enterDomainDB(const std::string & domainName, am_domainID_t & domainID);
+ void enterSourceDB(const std::string & sourceName, const am_domainID_t domainID, const std::vector<am_CustomConnectionFormat_t> & connectionFormats, am_sourceID_t & sourceID);
+ void enterSinkDB(const std::string & sinkName, const am_domainID_t domainID, const std::vector<am_CustomConnectionFormat_t> & connectionFormats, am_sinkID_t & sinkID);
+ void enterGatewayDB(const std::string & gwName,
+ const am_domainID_t domainSourceID,
+ const am_domainID_t domainSinkID,
+ const std::vector<am_CustomConnectionFormat_t> & sourceConnectionFormats,
+ const std::vector<am_CustomConnectionFormat_t> & sinkConnectionFormats,
+ const std::vector<bool> & matrix,
+ const am_sourceID_t & sourceID,
+ const am_sinkID_t & sinkID,
+ am_gatewayID_t & gatewayID);
+ void enterConverterDB(const std::string & gwName,
+ const am_domainID_t domainID,
+ const std::vector<am_CustomConnectionFormat_t> & sourceConnectionFormats,
+ const std::vector<am_CustomConnectionFormat_t> & sinkConnectionFormats,
+ const std::vector<bool> & matrix,
+ const am_sourceID_t & sourceID,
+ const am_sinkID_t & sinkID,
+ am_converterID_t & converterID);
+
};
}
diff --git a/AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt b/AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt
index 2b16eda..2209f40 100644
--- a/AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt
+++ b/AudioManagerDaemon/test/AmRouterMapTest/CMakeLists.txt
@@ -55,7 +55,7 @@ file(GLOB ROUTINGMAP_SRCS_CXX
"../../src/CAmCommandReceiver.cpp"
"../../src/CAmRoutingReceiver.cpp"
"../../src/CAmDbusWrapper.cpp"
- "../CAmCommonFunctions.cpp"
+ "../CAmCommonFunctions.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp b/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp
index 2f29e33..f6f523f 100644
--- a/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp
+++ b/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp
@@ -92,6 +92,7 @@ TEST_F(CAmRouterTest,simpleRoute2withDomainNoMatchFormats)
source.listConnectionFormats.push_back(CF_GENIVI_MONO);
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ source.sourceID=sourceID;
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -104,6 +105,7 @@ TEST_F(CAmRouterTest,simpleRoute2withDomainNoMatchFormats)
sink.listConnectionFormats.push_back(CF_GENIVI_ANALOG);
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ sink.sinkID=sinkID;
std::vector<am_Route_s> listRoutes;
std::vector<am_RoutingElement_s> listRoutingElements;
@@ -191,8 +193,6 @@ TEST_F(CAmRouterTest,simpleRoute2withDomain)
//test that checks just 2 domains, one sink one source with only one connection format each
TEST_F(CAmRouterTest,simpleRoute2DomainsOnlyFree)
{
-
-
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -290,6 +290,9 @@ TEST_F(CAmRouterTest,simpleRoute2DomainsOnlyFree)
compareRoute.sinkID = sinkID;
compareRoute.sourceID = sourceID;
+ std::vector<am_Connection_s> listConnections;
+ pDatabaseHandler.getListConnections(listConnections);
+ ASSERT_EQ(0, listConnections.size());
ASSERT_EQ(E_OK, pRouter.getRoute(true,sourceID,sinkID,listRoutes));
ASSERT_EQ(static_cast<uint>(1), listRoutes.size());
ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
diff --git a/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt
index d619b02..b9aa9c5 100644
--- a/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt
+++ b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt
@@ -57,7 +57,7 @@ file(GLOB ROUTING_INTERFACE_SRCS_CXX
"../../src/CAmRoutingReceiver.cpp"
"../../src/CAmCommandReceiver.cpp"
"../../src/CAmDbusWrapper.cpp"
- "*.cpp"
+ "*.cpp"
)
IF(WITH_NSM)
diff --git a/AudioManagerDaemon/test/CAmCommonFunctions.cpp b/AudioManagerDaemon/test/CAmCommonFunctions.cpp
index 47b09e6..e615520 100644
--- a/AudioManagerDaemon/test/CAmCommonFunctions.cpp
+++ b/AudioManagerDaemon/test/CAmCommonFunctions.cpp
@@ -157,11 +157,21 @@ bool CAmCommonFunctions::compareGateway(std::vector<am_Gateway_s>::iterator list
return (listIterator->name.compare(gatewayData.name) == 0) && (listIterator->sinkID == gatewayData.sinkID) && (listIterator->sourceID == gatewayData.sourceID) && (listIterator->controlDomainID == gatewayData.controlDomainID) && (listIterator->domainSinkID == gatewayData.domainSinkID) && (listIterator->domainSourceID == gatewayData.domainSourceID) && std::equal(listIterator->convertionMatrix.begin(), listIterator->convertionMatrix.end(), gatewayData.convertionMatrix.begin()) && std::equal(listIterator->listSourceFormats.begin(), listIterator->listSourceFormats.end(), gatewayData.listSourceFormats.begin()) && std::equal(listIterator->listSinkFormats.begin(), listIterator->listSinkFormats.end(), gatewayData.listSinkFormats.begin());
}
+bool CAmCommonFunctions::compareConverter(std::vector<am_Converter_s>::iterator listIterator, const am_Converter_s& gatewayData)
+{
+ return (listIterator->name.compare(gatewayData.name) == 0) && (listIterator->sinkID == gatewayData.sinkID) && (listIterator->sourceID == gatewayData.sourceID) && (listIterator->domainID == gatewayData.domainID) && std::equal(listIterator->convertionMatrix.begin(), listIterator->convertionMatrix.end(), gatewayData.convertionMatrix.begin()) && std::equal(listIterator->listSourceFormats.begin(), listIterator->listSourceFormats.end(), gatewayData.listSourceFormats.begin()) && std::equal(listIterator->listSinkFormats.begin(), listIterator->listSinkFormats.end(), gatewayData.listSinkFormats.begin());
+}
+
bool CAmCommonFunctions::compareGateway1(const am_Gateway_s gateway1, const am_Gateway_s gatewayData)
{
return (gateway1.name.compare(gatewayData.name) == 0) && (gateway1.sinkID == gatewayData.sinkID) && (gateway1.sourceID == gatewayData.sourceID) && (gateway1.controlDomainID == gatewayData.controlDomainID) && (gateway1.domainSinkID == gatewayData.domainSinkID) && (gateway1.domainSourceID == gatewayData.domainSourceID) && std::equal(gateway1.convertionMatrix.begin(), gateway1.convertionMatrix.end(), gatewayData.convertionMatrix.begin()) && std::equal(gateway1.listSourceFormats.begin(), gateway1.listSourceFormats.end(), gatewayData.listSourceFormats.begin()) && std::equal(gateway1.listSinkFormats.begin(), gateway1.listSinkFormats.end(), gatewayData.listSinkFormats.begin());
}
+bool CAmCommonFunctions::compareConverter1(const am_Converter_s gateway1, const am_Converter_s gatewayData)
+{
+ return (gateway1.name.compare(gatewayData.name) == 0) && (gateway1.sinkID == gatewayData.sinkID) && (gateway1.sourceID == gatewayData.sourceID) && (gateway1.domainID == gatewayData.domainID) && std::equal(gateway1.convertionMatrix.begin(), gateway1.convertionMatrix.end(), gatewayData.convertionMatrix.begin()) && std::equal(gateway1.listSourceFormats.begin(), gateway1.listSourceFormats.end(), gatewayData.listSourceFormats.begin()) && std::equal(gateway1.listSinkFormats.begin(), gateway1.listSinkFormats.end(), gatewayData.listSinkFormats.begin());
+}
+
bool CAmCommonFunctions::compareSinkMainSink(std::vector<am_SinkType_s>::iterator listIterator, const std::vector<am_Sink_s>& sinkList)
{
std::vector<am_Sink_s>::const_iterator sinkListIterator = sinkList.begin();
@@ -304,6 +314,19 @@ void CAmCommonFunctions::createGateway(am_Gateway_s & gateway)
}
+void CAmCommonFunctions::createConverter(am_Converter_s & converter) const
+{
+ converter.name = "AnyConverter";
+ converter.sinkID = 1;
+ converter.sourceID = 2;
+ converter.domainID = 1;
+ converter.convertionMatrix = getStandardConvertionMatrix();
+ converter.listSourceFormats = getStandardConnectionFormatList();
+ converter.listSinkFormats = getStandardConnectionFormatList();
+ converter.converterID = 0;
+
+}
+
void CAmCommonFunctions::createConnection(am_Connection_s & connection) const
{
connection.connectionID = 0;
diff --git a/AudioManagerDaemon/test/CAmCommonFunctions.h b/AudioManagerDaemon/test/CAmCommonFunctions.h
index 345d178..ba152c3 100644
--- a/AudioManagerDaemon/test/CAmCommonFunctions.h
+++ b/AudioManagerDaemon/test/CAmCommonFunctions.h
@@ -39,6 +39,8 @@ public:
bool compareSink(std::vector<am_Sink_s>::iterator listIterator, const am_Sink_s& sinkData);
bool compareGateway(std::vector<am_Gateway_s>::iterator listIterator, const am_Gateway_s& gatewayData);
bool compareGateway1(const am_Gateway_s gateway1, const am_Gateway_s gatewayData);
+ bool compareConverter(std::vector<am_Converter_s>::iterator listIterator, const am_Converter_s& gatewayData);
+ bool compareConverter1(const am_Converter_s gateway1, const am_Converter_s gatewayData);
bool compareSinkMainSink(std::vector<am_SinkType_s>::iterator listIterator, const std::vector<am_Sink_s>& sinkList);
bool compareSinkMainSource(std::vector<am_SourceType_s>::iterator listIterator, const std::vector<am_Source_s>& sourceList);
bool compareRoute(am_Route_s a, am_Route_s b);
@@ -47,6 +49,7 @@ public:
void createDomain(am_Domain_s& domain) const;
void createGateway(am_Gateway_s& gateway);
void createConnection(am_Connection_s& connection) const;
+ void createConverter(am_Converter_s & converter) const;
void connectionList2RoutingList(std::vector<am_RoutingElement_s>& routingList, const std::vector<am_Connection_s>& connectionList);
struct sortBySinkID
diff --git a/AudioManagerDaemon/test/MockIAmControlSend.h b/AudioManagerDaemon/test/MockIAmControlSend.h
index 5d9b528..dc9bdc0 100644
--- a/AudioManagerDaemon/test/MockIAmControlSend.h
+++ b/AudioManagerDaemon/test/MockIAmControlSend.h
@@ -71,6 +71,10 @@ class MockIAmControlSend : public IAmControlSend {
am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
MOCK_METHOD1(hookSystemDeregisterGateway,
am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD2(hookSystemRegisterConverter,
+ am_Error_e(const am_Converter_s& converterData, am_converterID_t& converterID));
+ MOCK_METHOD1(hookSystemDeregisterConverter,
+ am_Error_e(const am_converterID_t converterID));
MOCK_METHOD2(hookSystemRegisterCrossfader,
am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
MOCK_METHOD1(hookSystemDeregisterCrossfader,
@@ -129,6 +133,8 @@ class MockIAmControlSend : public IAmControlSend {
am_Error_e(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));
MOCK_METHOD4(hookSystemUpdateGateway,
am_Error_e(const am_gatewayID_t gatewayID, const std::vector<am_CustomAvailabilityReason_t>& listSourceConnectionFormats, const std::vector<am_CustomAvailabilityReason_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix));
+ MOCK_METHOD4(hookSystemUpdateConverter,
+ am_Error_e(const am_converterID_t converterID, const std::vector<am_CustomAvailabilityReason_t>& listSourceConnectionFormats, const std::vector<am_CustomAvailabilityReason_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix));
MOCK_METHOD3(cbAckSetVolumes,
void(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error));
MOCK_METHOD2(cbAckSetSinkNotificationConfiguration,
diff --git a/PluginControlInterface/include/CAmControlSenderBase.h b/PluginControlInterface/include/CAmControlSenderBase.h
index df2f9c9..a2d2cec 100644
--- a/PluginControlInterface/include/CAmControlSenderBase.h
+++ b/PluginControlInterface/include/CAmControlSenderBase.h
@@ -47,6 +47,8 @@ public:
am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID);
am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID);
am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e hookSystemRegisterConverter(const am_Converter_s& converterData, am_converterID_t& converterID);
+ am_Error_e hookSystemDeregisterConverter(const am_converterID_t converterID);
am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID);
am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID);
@@ -78,6 +80,7 @@ public:
am_Error_e hookSystemUpdateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
am_Error_e hookSystemUpdateSource(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) ;
am_Error_e hookSystemUpdateGateway(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) ;
+ am_Error_e hookSystemUpdateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix);
void cbAckSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error) ;
void cbAckSetSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) ;
void cbAckSetSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) ;
diff --git a/PluginControlInterface/src/CAmControlSenderBase.cpp b/PluginControlInterface/src/CAmControlSenderBase.cpp
index 7007bfe..9d5aa8b 100644
--- a/PluginControlInterface/src/CAmControlSenderBase.cpp
+++ b/PluginControlInterface/src/CAmControlSenderBase.cpp
@@ -360,12 +360,23 @@ am_Error_e CAmControlSenderBase::hookSystemRegisterGateway(const am_Gateway_s &
return mControlReceiveInterface->enterGatewayDB(gatewayData, gatewayID);
}
+am_Error_e CAmControlSenderBase::hookSystemRegisterConverter(const am_Converter_s & converterData, am_converterID_t & converterID)
+{
+//this application does not do anything with it -> but some product might want to take influence here
+ return mControlReceiveInterface->enterConverterDB(converterData, converterID);
+}
+
am_Error_e CAmControlSenderBase::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->removeGatewayDB(gatewayID);
}
+am_Error_e CAmControlSenderBase::hookSystemDeregisterConverter(const am_converterID_t converterID)
+{
+ return mControlReceiveInterface->removeConverterDB(converterID);
+}
+
am_Error_e CAmControlSenderBase::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
//this application does not do anything with it -> but some product might want to take influence here
@@ -841,6 +852,15 @@ am_Error_e CAmControlSenderBase::hookSystemUpdateGateway(const am_gatewayID_t ga
return (E_NOT_USED);
}
+am_Error_e CAmControlSenderBase::hookSystemUpdateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix)
+{
+ (void) converterID;
+ (void) listSourceConnectionFormats;
+ (void) listSinkConnectionFormats;
+ (void) convertionMatrix;
+ return (E_NOT_USED);
+}
+
void CAmControlSenderBase::cbAckSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error)
{
(void) handle;
diff --git a/PluginControlInterface/test/MockIAmControlReceive.h b/PluginControlInterface/test/MockIAmControlReceive.h
index eb116b1..2e9a8df 100644
--- a/PluginControlInterface/test/MockIAmControlReceive.h
+++ b/PluginControlInterface/test/MockIAmControlReceive.h
@@ -25,192 +25,204 @@ namespace am {
class MockIAmControlReceive : public IAmControlReceive {
public:
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
- MOCK_METHOD4(getRoute,
- am_Error_e(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList));
- MOCK_METHOD5(connect,
- am_Error_e(am_Handle_s& handle, am_connectionID_t& connectionID, const am_CustomAvailabilityReason_t format, const am_sourceID_t sourceID, const am_sinkID_t sinkID));
- MOCK_METHOD2(disconnect,
- am_Error_e(am_Handle_s& handle, const am_connectionID_t connectionID));
- MOCK_METHOD5(crossfade,
- am_Error_e(am_Handle_s& handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_CustomRampType_t rampType, const am_time_t rampTime));
- MOCK_METHOD1(abortAction,
- am_Error_e(const am_Handle_s handle));
- MOCK_METHOD3(setSourceState,
- am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state));
- MOCK_METHOD5(setSinkVolume,
- am_Error_e(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time));
- MOCK_METHOD5(setSourceVolume,
- am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t rampType, const am_time_t time));
- MOCK_METHOD3(setSinkSoundProperties,
- am_Error_e(am_Handle_s& handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& soundProperty));
- MOCK_METHOD3(setSinkSoundProperty,
- am_Error_e(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty));
- MOCK_METHOD3(setSourceSoundProperties,
- am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& soundProperty));
- MOCK_METHOD3(setSourceSoundProperty,
- am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty));
- MOCK_METHOD2(setDomainState,
- am_Error_e(const am_domainID_t domainID, const am_DomainState_e domainState));
- MOCK_METHOD2(enterDomainDB,
- am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
- MOCK_METHOD2(enterMainConnectionDB,
- am_Error_e(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID));
- MOCK_METHOD2(enterSinkDB,
- am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
- MOCK_METHOD2(enterCrossfaderDB,
- am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
- MOCK_METHOD2(enterGatewayDB,
- am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
- MOCK_METHOD2(enterSourceDB,
- am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
- MOCK_METHOD2(enterSinkClassDB,
- am_Error_e(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID));
- MOCK_METHOD2(enterSourceClassDB,
- am_Error_e(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass));
- MOCK_METHOD1(changeSinkClassInfoDB,
- am_Error_e(const am_SinkClass_s& sinkClass));
- MOCK_METHOD1(changeSourceClassInfoDB,
- am_Error_e(const am_SourceClass_s& sourceClass));
- MOCK_METHOD1(enterSystemPropertiesListDB,
- am_Error_e(const std::vector<am_SystemProperty_s>& listSystemProperties));
- MOCK_METHOD2(changeMainConnectionRouteDB,
- am_Error_e(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID));
- MOCK_METHOD2(changeMainConnectionStateDB,
- am_Error_e(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState));
- MOCK_METHOD2(changeSinkMainVolumeDB,
- am_Error_e(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID));
- MOCK_METHOD2(changeSinkAvailabilityDB,
- am_Error_e(const am_Availability_s& availability, const am_sinkID_t sinkID));
- MOCK_METHOD2(changDomainStateDB,
- am_Error_e(const am_DomainState_e domainState, const am_domainID_t domainID));
- MOCK_METHOD2(changeSinkMuteStateDB,
- am_Error_e(const am_MuteState_e muteState, const am_sinkID_t sinkID));
- MOCK_METHOD2(changeMainSinkSoundPropertyDB,
- am_Error_e(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID));
- MOCK_METHOD2(changeMainSourceSoundPropertyDB,
- am_Error_e(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID));
- MOCK_METHOD2(changeSourceAvailabilityDB,
- am_Error_e(const am_Availability_s& availability, const am_sourceID_t sourceID));
- MOCK_METHOD1(changeSystemPropertyDB,
- am_Error_e(const am_SystemProperty_s& property));
- MOCK_METHOD1(removeMainConnectionDB,
- am_Error_e(const am_mainConnectionID_t mainConnectionID));
- MOCK_METHOD1(removeSinkDB,
- am_Error_e(const am_sinkID_t sinkID));
- MOCK_METHOD1(removeSourceDB,
- am_Error_e(const am_sourceID_t sourceID));
- MOCK_METHOD1(removeGatewayDB,
- am_Error_e(const am_gatewayID_t gatewayID));
- MOCK_METHOD1(removeCrossfaderDB,
- am_Error_e(const am_crossfaderID_t crossfaderID));
- MOCK_METHOD1(removeDomainDB,
- am_Error_e(const am_domainID_t domainID));
- MOCK_METHOD1(removeSinkClassDB,
- am_Error_e(const am_sinkClass_t sinkClassID));
- MOCK_METHOD1(removeSourceClassDB,
- am_Error_e(const am_sourceClass_t sourceClassID));
- MOCK_CONST_METHOD2(getSourceClassInfoDB,
- am_Error_e(const am_sourceID_t sourceID, am_SourceClass_s& classInfo));
- MOCK_CONST_METHOD2(getSinkClassInfoDB,
- am_Error_e(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass));
- MOCK_CONST_METHOD2(getSinkInfoDB,
- am_Error_e(const am_sinkID_t sinkID, am_Sink_s& sinkData));
- MOCK_CONST_METHOD2(getSourceInfoDB,
- am_Error_e(const am_sourceID_t sourceID, am_Source_s& sourceData));
- MOCK_CONST_METHOD2(getGatewayInfoDB,
- am_Error_e(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData));
- MOCK_CONST_METHOD2(getCrossfaderInfoDB,
- am_Error_e(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData));
- MOCK_CONST_METHOD2(getMainConnectionInfoDB,
- am_Error_e(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData));
- MOCK_CONST_METHOD2(getListSinksOfDomain,
- am_Error_e(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID));
- MOCK_CONST_METHOD2(getListSourcesOfDomain,
- am_Error_e(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID));
- MOCK_CONST_METHOD2(getListCrossfadersOfDomain,
- am_Error_e(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listCrossfadersID));
- MOCK_CONST_METHOD2(getListGatewaysOfDomain,
- am_Error_e(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID));
- MOCK_CONST_METHOD1(getListMainConnections,
- am_Error_e(std::vector<am_MainConnection_s>& listMainConnections));
- MOCK_CONST_METHOD1(getListDomains,
- am_Error_e(std::vector<am_Domain_s>& listDomains));
- MOCK_CONST_METHOD1(getListConnections,
- am_Error_e(std::vector<am_Connection_s>& listConnections));
- MOCK_CONST_METHOD1(getListSinks,
- am_Error_e(std::vector<am_Sink_s>& listSinks));
- MOCK_CONST_METHOD1(getListSources,
- am_Error_e(std::vector<am_Source_s>& listSources));
- MOCK_CONST_METHOD1(getListSourceClasses,
- am_Error_e(std::vector<am_SourceClass_s>& listSourceClasses));
- MOCK_CONST_METHOD1(getListHandles,
- am_Error_e(std::vector<am_Handle_s>& listHandles));
- MOCK_CONST_METHOD1(getListCrossfaders,
- am_Error_e(std::vector<am_Crossfader_s>& listCrossfaders));
- MOCK_CONST_METHOD1(getListGateways,
- am_Error_e(std::vector<am_Gateway_s>& listGateways));
- MOCK_CONST_METHOD1(getListSinkClasses,
- am_Error_e(std::vector<am_SinkClass_s>& listSinkClasses));
- MOCK_CONST_METHOD1(getListSystemProperties,
- am_Error_e(std::vector<am_SystemProperty_s>& listSystemProperties));
- MOCK_METHOD0(setCommandReady,
- void());
- MOCK_METHOD0(setCommandRundown,
- void());
- MOCK_METHOD0(setRoutingReady,
- void());
- MOCK_METHOD0(setRoutingRundown,
- void());
- MOCK_METHOD1(confirmControllerReady,
- void(const am_Error_e error));
- MOCK_METHOD1(confirmControllerRundown,
- void(const am_Error_e error));
- MOCK_METHOD1(getSocketHandler,
- am_Error_e(CAmSocketHandler*& socketHandler));
- MOCK_METHOD5(changeSourceDB,
- am_Error_e(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));
- MOCK_METHOD5(changeSinkDB,
- am_Error_e(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));
- MOCK_METHOD4(changeGatewayDB,
- am_Error_e(const am_gatewayID_t gatewayID, const std::vector<am_CustomAvailabilityReason_t>& listSourceConnectionFormats, const std::vector<am_CustomAvailabilityReason_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix));
- MOCK_METHOD2(setVolumes,
- am_Error_e(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes));
- MOCK_METHOD3(setSinkNotificationConfiguration,
- am_Error_e(am_Handle_s& handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration));
- MOCK_METHOD3(setSourceNotificationConfiguration,
- am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration));
- MOCK_METHOD2(sendMainSinkNotificationPayload,
- void(const am_sinkID_t sinkID, const am_NotificationPayload_s& notificationPayload));
- MOCK_METHOD2(sendMainSourceNotificationPayload,
- void(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload));
- MOCK_METHOD2(changeMainSinkNotificationConfigurationDB,
- am_Error_e(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration));
- MOCK_METHOD2(changeMainSourceNotificationConfigurationDB,
- am_Error_e(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration));
- MOCK_METHOD1(getRestartReasonPropertyNSM,
- am_Error_e(NsmRestartReason_e& restartReason));
- MOCK_METHOD1(getShutdownReasonPropertyNSM,
- am_Error_e(NsmShutdownReason_e& ShutdownReason));
- MOCK_METHOD1(getRunningReasonPropertyNSM,
- am_Error_e(NsmRunningReason_e& nsmRunningReason));
- MOCK_METHOD1(getNodeStateNSM,
- NsmErrorStatus_e(NsmNodeState_e& nsmNodeState));
- MOCK_METHOD3(getSessionStateNSM,
- NsmErrorStatus_e(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState));
- MOCK_METHOD1(getApplicationModeNSM,
- NsmErrorStatus_e(NsmApplicationMode_e& applicationMode));
- MOCK_METHOD2(registerShutdownClientNSM,
- NsmErrorStatus_e(const uint32_t shutdownMode, const uint32_t timeoutMs));
- MOCK_METHOD1(unRegisterShutdownClientNSM,
- NsmErrorStatus_e(const uint32_t shutdownMode));
- MOCK_METHOD1(getInterfaceVersionNSM,
- am_Error_e(uint32_t& version));
- MOCK_METHOD2(sendLifecycleRequestCompleteNSM,
- NsmErrorStatus_e(const uint32_t RequestId, const NsmErrorStatus_e status));
-
+ MOCK_CONST_METHOD1(getInterfaceVersion,
+ void(std::string& version));
+ MOCK_METHOD4(getRoute,
+ am_Error_e(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList));
+ MOCK_METHOD5(connect,
+ am_Error_e(am_Handle_s& handle, am_connectionID_t& connectionID, const am_CustomConnectionFormat_t format, const am_sourceID_t sourceID, const am_sinkID_t sinkID));
+ MOCK_METHOD2(disconnect,
+ am_Error_e(am_Handle_s& handle, const am_connectionID_t connectionID));
+ MOCK_METHOD5(crossfade,
+ am_Error_e(am_Handle_s& handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_CustomRampType_t rampType, const am_time_t rampTime));
+ MOCK_METHOD1(abortAction,
+ am_Error_e(const am_Handle_s handle));
+ MOCK_METHOD3(setSourceState,
+ am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state));
+ MOCK_METHOD5(setSinkVolume,
+ am_Error_e(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time));
+ MOCK_METHOD5(setSourceVolume,
+ am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t rampType, const am_time_t time));
+ MOCK_METHOD3(setSinkSoundProperties,
+ am_Error_e(am_Handle_s& handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& soundProperty));
+ MOCK_METHOD3(setSinkSoundProperty,
+ am_Error_e(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty));
+ MOCK_METHOD3(setSourceSoundProperties,
+ am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& soundProperty));
+ MOCK_METHOD3(setSourceSoundProperty,
+ am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty));
+ MOCK_METHOD2(setDomainState,
+ am_Error_e(const am_domainID_t domainID, const am_DomainState_e domainState));
+ MOCK_METHOD2(enterDomainDB,
+ am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
+ MOCK_METHOD2(enterMainConnectionDB,
+ am_Error_e(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID));
+ MOCK_METHOD2(enterSinkDB,
+ am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
+ MOCK_METHOD2(enterCrossfaderDB,
+ am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
+ MOCK_METHOD2(enterGatewayDB,
+ am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
+ MOCK_METHOD2(enterConverterDB,
+ am_Error_e(const am_Converter_s& converterData, am_converterID_t& converterID));
+ MOCK_METHOD2(enterSourceDB,
+ am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
+ MOCK_METHOD2(enterSinkClassDB,
+ am_Error_e(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID));
+ MOCK_METHOD2(enterSourceClassDB,
+ am_Error_e(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass));
+ MOCK_METHOD1(changeSinkClassInfoDB,
+ am_Error_e(const am_SinkClass_s& sinkClass));
+ MOCK_METHOD1(changeSourceClassInfoDB,
+ am_Error_e(const am_SourceClass_s& sourceClass));
+ MOCK_METHOD1(enterSystemPropertiesListDB,
+ am_Error_e(const std::vector<am_SystemProperty_s>& listSystemProperties));
+ MOCK_METHOD2(changeMainConnectionRouteDB,
+ am_Error_e(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID));
+ MOCK_METHOD2(changeMainConnectionStateDB,
+ am_Error_e(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState));
+ MOCK_METHOD2(changeSinkMainVolumeDB,
+ am_Error_e(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID));
+ MOCK_METHOD2(changeSinkAvailabilityDB,
+ am_Error_e(const am_Availability_s& availability, const am_sinkID_t sinkID));
+ MOCK_METHOD2(changDomainStateDB,
+ am_Error_e(const am_DomainState_e domainState, const am_domainID_t domainID));
+ MOCK_METHOD2(changeSinkMuteStateDB,
+ am_Error_e(const am_MuteState_e muteState, const am_sinkID_t sinkID));
+ MOCK_METHOD2(changeMainSinkSoundPropertyDB,
+ am_Error_e(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID));
+ MOCK_METHOD2(changeMainSourceSoundPropertyDB,
+ am_Error_e(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID));
+ MOCK_METHOD2(changeSourceAvailabilityDB,
+ am_Error_e(const am_Availability_s& availability, const am_sourceID_t sourceID));
+ MOCK_METHOD1(changeSystemPropertyDB,
+ am_Error_e(const am_SystemProperty_s& property));
+ MOCK_METHOD1(removeMainConnectionDB,
+ am_Error_e(const am_mainConnectionID_t mainConnectionID));
+ MOCK_METHOD1(removeSinkDB,
+ am_Error_e(const am_sinkID_t sinkID));
+ MOCK_METHOD1(removeSourceDB,
+ am_Error_e(const am_sourceID_t sourceID));
+ MOCK_METHOD1(removeGatewayDB,
+ am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD1(removeConverterDB,
+ am_Error_e(const am_converterID_t converterID));
+ MOCK_METHOD1(removeCrossfaderDB,
+ am_Error_e(const am_crossfaderID_t crossfaderID));
+ MOCK_METHOD1(removeDomainDB,
+ am_Error_e(const am_domainID_t domainID));
+ MOCK_METHOD1(removeSinkClassDB,
+ am_Error_e(const am_sinkClass_t sinkClassID));
+ MOCK_METHOD1(removeSourceClassDB,
+ am_Error_e(const am_sourceClass_t sourceClassID));
+ MOCK_CONST_METHOD2(getSourceClassInfoDB,
+ am_Error_e(const am_sourceID_t sourceID, am_SourceClass_s& classInfo));
+ MOCK_CONST_METHOD2(getSinkClassInfoDB,
+ am_Error_e(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass));
+ MOCK_CONST_METHOD2(getSinkInfoDB,
+ am_Error_e(const am_sinkID_t sinkID, am_Sink_s& sinkData));
+ MOCK_CONST_METHOD2(getSourceInfoDB,
+ am_Error_e(const am_sourceID_t sourceID, am_Source_s& sourceData));
+ MOCK_CONST_METHOD2(getConverterInfoDB,
+ am_Error_e(const am_converterID_t converterID, am_Converter_s& converterData));
+ MOCK_CONST_METHOD2(getGatewayInfoDB,
+ am_Error_e(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData));
+ MOCK_CONST_METHOD2(getCrossfaderInfoDB,
+ am_Error_e(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData));
+ MOCK_CONST_METHOD2(getMainConnectionInfoDB,
+ am_Error_e(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData));
+ MOCK_CONST_METHOD2(getListSinksOfDomain,
+ am_Error_e(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID));
+ MOCK_CONST_METHOD2(getListSourcesOfDomain,
+ am_Error_e(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID));
+ MOCK_CONST_METHOD2(getListCrossfadersOfDomain,
+ am_Error_e(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listCrossfadersID));
+ MOCK_CONST_METHOD2(getListConvertersOfDomain,
+ am_Error_e(const am_domainID_t domainID, std::vector<am_converterID_t>& listConverterID));
+ MOCK_CONST_METHOD2(getListGatewaysOfDomain,
+ am_Error_e(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID));
+ MOCK_CONST_METHOD1(getListMainConnections,
+ am_Error_e(std::vector<am_MainConnection_s>& listMainConnections));
+ MOCK_CONST_METHOD1(getListDomains,
+ am_Error_e(std::vector<am_Domain_s>& listDomains));
+ MOCK_CONST_METHOD1(getListConnections,
+ am_Error_e(std::vector<am_Connection_s>& listConnections));
+ MOCK_CONST_METHOD1(getListSinks,
+ am_Error_e(std::vector<am_Sink_s>& listSinks));
+ MOCK_CONST_METHOD1(getListSources,
+ am_Error_e(std::vector<am_Source_s>& listSources));
+ MOCK_CONST_METHOD1(getListSourceClasses,
+ am_Error_e(std::vector<am_SourceClass_s>& listSourceClasses));
+ MOCK_CONST_METHOD1(getListHandles,
+ am_Error_e(std::vector<am_Handle_s>& listHandles));
+ MOCK_CONST_METHOD1(getListCrossfaders,
+ am_Error_e(std::vector<am_Crossfader_s>& listCrossfaders));
+ MOCK_CONST_METHOD1(getListConverters,
+ am_Error_e(std::vector<am_Converter_s>& listConverters));
+ MOCK_CONST_METHOD1(getListGateways,
+ am_Error_e(std::vector<am_Gateway_s>& listGateways));
+ MOCK_CONST_METHOD1(getListSinkClasses,
+ am_Error_e(std::vector<am_SinkClass_s>& listSinkClasses));
+ MOCK_CONST_METHOD1(getListSystemProperties,
+ am_Error_e(std::vector<am_SystemProperty_s>& listSystemProperties));
+ MOCK_METHOD0(setCommandReady,
+ void());
+ MOCK_METHOD0(setCommandRundown,
+ void());
+ MOCK_METHOD0(setRoutingReady,
+ void());
+ MOCK_METHOD0(setRoutingRundown,
+ void());
+ MOCK_METHOD1(confirmControllerReady,
+ void(const am_Error_e error));
+ MOCK_METHOD1(confirmControllerRundown,
+ void(const am_Error_e error));
+ MOCK_METHOD1(getSocketHandler,
+ am_Error_e(CAmSocketHandler*& socketHandler));
+ MOCK_METHOD5(changeSourceDB,
+ am_Error_e(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties));
+ MOCK_METHOD5(changeSinkDB,
+ am_Error_e(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties));
+ MOCK_METHOD4(changeConverterDB,
+ am_Error_e(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix));
+ MOCK_METHOD4(changeGatewayDB,
+ am_Error_e(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix));
+ MOCK_METHOD2(setVolumes,
+ am_Error_e(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes));
+ MOCK_METHOD3(setSinkNotificationConfiguration,
+ am_Error_e(am_Handle_s& handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration));
+ MOCK_METHOD3(setSourceNotificationConfiguration,
+ am_Error_e(am_Handle_s& handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration));
+ MOCK_METHOD2(sendMainSinkNotificationPayload,
+ void(const am_sinkID_t sinkID, const am_NotificationPayload_s& notificationPayload));
+ MOCK_METHOD2(sendMainSourceNotificationPayload,
+ void(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload));
+ MOCK_METHOD2(changeMainSinkNotificationConfigurationDB,
+ am_Error_e(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration));
+ MOCK_METHOD2(changeMainSourceNotificationConfigurationDB,
+ am_Error_e(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration));
+ MOCK_METHOD1(getRestartReasonPropertyNSM,
+ am_Error_e(NsmRestartReason_e& restartReason));
+ MOCK_METHOD1(getShutdownReasonPropertyNSM,
+ am_Error_e(NsmShutdownReason_e& ShutdownReason));
+ MOCK_METHOD1(getRunningReasonPropertyNSM,
+ am_Error_e(NsmRunningReason_e& nsmRunningReason));
+ MOCK_METHOD1(getNodeStateNSM,
+ NsmErrorStatus_e(NsmNodeState_e& nsmNodeState));
+ MOCK_METHOD3(getSessionStateNSM,
+ NsmErrorStatus_e(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState));
+ MOCK_METHOD1(getApplicationModeNSM,
+ NsmErrorStatus_e(NsmApplicationMode_e& applicationMode));
+ MOCK_METHOD2(registerShutdownClientNSM,
+ NsmErrorStatus_e(const uint32_t shutdownMode, const uint32_t timeoutMs));
+ MOCK_METHOD1(unRegisterShutdownClientNSM,
+ NsmErrorStatus_e(const uint32_t shutdownMode));
+ MOCK_METHOD1(getInterfaceVersionNSM,
+ am_Error_e(uint32_t& version));
+ MOCK_METHOD2(sendLifecycleRequestCompleteNSM,
+ NsmErrorStatus_e(const uint32_t RequestId, const NsmErrorStatus_e status));
};
+
} // namespace am
#endif
diff --git a/PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h b/PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h
index 02ecd25..4d5849c 100644
--- a/PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h
+++ b/PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h
@@ -23,102 +23,107 @@
namespace am {
class MockIAmRoutingReceive : public IAmRoutingReceive {
- public:
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
- MOCK_METHOD3(ackConnect,
- void(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error));
- MOCK_METHOD3(ackDisconnect,
- void(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error));
- MOCK_METHOD3(ackSetSinkVolumeChange,
- void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
- MOCK_METHOD3(ackSetSourceVolumeChange,
- void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
- MOCK_METHOD2(ackSetSourceState,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSetSinkSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSetSinkSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSetSourceSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSetSourceSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD3(ackCrossFading,
- void(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error));
- MOCK_METHOD3(ackSourceVolumeTick,
- void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
- MOCK_METHOD3(ackSinkVolumeTick,
- void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
- MOCK_METHOD2(peekDomain,
- am_Error_e(const std::string& name, am_domainID_t& domainID));
- MOCK_METHOD2(registerDomain,
- am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
- MOCK_METHOD1(deregisterDomain,
- am_Error_e(const am_domainID_t domainID));
- MOCK_METHOD2(registerGateway,
- am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
- MOCK_METHOD1(deregisterGateway,
- am_Error_e(const am_gatewayID_t gatewayID));
- MOCK_METHOD2(peekSink,
- am_Error_e(const std::string& name, am_sinkID_t& sinkID));
- MOCK_METHOD2(registerSink,
- am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
- MOCK_METHOD1(deregisterSink,
- am_Error_e(const am_sinkID_t sinkID));
- MOCK_METHOD2(peekSource,
- am_Error_e(const std::string& name, am_sourceID_t& sourceID));
- MOCK_METHOD2(registerSource,
- am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
- MOCK_METHOD1(deregisterSource,
- am_Error_e(const am_sourceID_t sourceID));
- MOCK_METHOD2(registerCrossfader,
- am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
- MOCK_METHOD1(deregisterCrossfader,
- am_Error_e(const am_crossfaderID_t crossfaderID));
- MOCK_METHOD2(peekSourceClassID,
- am_Error_e(const std::string& name, am_sourceClass_t& sourceClassID));
- MOCK_METHOD2(peekSinkClassID,
- am_Error_e(const std::string& name, am_sinkClass_t& sinkClassID));
- MOCK_METHOD2(hookInterruptStatusChange,
- void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
- MOCK_METHOD1(hookDomainRegistrationComplete,
- void(const am_domainID_t domainID));
- MOCK_METHOD2(hookSinkAvailablityStatusChange,
- void(const am_sinkID_t sinkID, const am_Availability_s& availability));
- MOCK_METHOD2(hookSourceAvailablityStatusChange,
- void(const am_sourceID_t sourceID, const am_Availability_s& availability));
- MOCK_METHOD2(hookDomainStateChange,
- void(const am_domainID_t domainID, const am_DomainState_e domainState));
- MOCK_METHOD2(hookTimingInformationChanged,
- void(const am_connectionID_t connectionID, const am_timeSync_t delay));
- MOCK_METHOD1(sendChangedData,
- void(const std::vector<am_EarlyData_s>& earlyData));
- MOCK_CONST_METHOD1(getDBusConnectionWrapper,
- am_Error_e(CAmDbusWrapper*& dbusConnectionWrapper));
- MOCK_CONST_METHOD1(getSocketHandler,
- am_Error_e(CAmSocketHandler*& socketHandler));
- MOCK_METHOD2(confirmRoutingReady,
- void(const uint16_t handle, const am_Error_e error));
- MOCK_METHOD2(confirmRoutingRundown,
- void(const uint16_t handle, const am_Error_e error));
- MOCK_METHOD4(updateGateway,
- am_Error_e(const am_gatewayID_t gatewayID, const std::vector<am_CustomAvailabilityReason_t>& listSourceFormats, const std::vector<am_CustomAvailabilityReason_t>& listSinkFormats, const std::vector<bool>& convertionMatrix));
- MOCK_METHOD5(updateSink,
- am_Error_e(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));
- MOCK_METHOD5(updateSource,
- am_Error_e(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));
- MOCK_METHOD3(ackSetVolumes,
- void(const am_Handle_s handle, const std::vector<am_Volumes_s>& listvolumes, const am_Error_e error));
- MOCK_METHOD2(ackSinkNotificationConfiguration,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSourceNotificationConfiguration,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(hookSinkNotificationDataChange,
- void(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload));
- MOCK_METHOD2(hookSourceNotificationDataChange,
- void(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload));
-
+public:
+ MOCK_CONST_METHOD1(getInterfaceVersion,
+ void(std::string& version));
+ MOCK_METHOD3(ackConnect,
+ void(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error));
+ MOCK_METHOD3(ackDisconnect,
+ void(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error));
+ MOCK_METHOD3(ackSetSinkVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
+ MOCK_METHOD3(ackSetSourceVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
+ MOCK_METHOD2(ackSetSourceState,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSetSinkSoundProperties,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSetSinkSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSetSourceSoundProperties,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSetSourceSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD3(ackCrossFading,
+ void(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error));
+ MOCK_METHOD3(ackSourceVolumeTick,
+ void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
+ MOCK_METHOD3(ackSinkVolumeTick,
+ void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
+ MOCK_METHOD2(peekDomain,
+ am_Error_e(const std::string& name, am_domainID_t& domainID));
+ MOCK_METHOD2(registerDomain,
+ am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
+ MOCK_METHOD1(deregisterDomain,
+ am_Error_e(const am_domainID_t domainID));
+ MOCK_METHOD2(registerGateway,
+ am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
+ MOCK_METHOD2(registerConverter,
+ am_Error_e(const am_Converter_s& converterData, am_converterID_t& converterID));
+ MOCK_METHOD1(deregisterGateway,
+ am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD1(deregisterConverter,
+ am_Error_e(const am_converterID_t converterID));
+ MOCK_METHOD2(peekSink,
+ am_Error_e(const std::string& name, am_sinkID_t& sinkID));
+ MOCK_METHOD2(registerSink,
+ am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
+ MOCK_METHOD1(deregisterSink,
+ am_Error_e(const am_sinkID_t sinkID));
+ MOCK_METHOD2(peekSource,
+ am_Error_e(const std::string& name, am_sourceID_t& sourceID));
+ MOCK_METHOD2(registerSource,
+ am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
+ MOCK_METHOD1(deregisterSource,
+ am_Error_e(const am_sourceID_t sourceID));
+ MOCK_METHOD2(registerCrossfader,
+ am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
+ MOCK_METHOD1(deregisterCrossfader,
+ am_Error_e(const am_crossfaderID_t crossfaderID));
+ MOCK_METHOD2(peekSourceClassID,
+ am_Error_e(const std::string& name, am_sourceClass_t& sourceClassID));
+ MOCK_METHOD2(peekSinkClassID,
+ am_Error_e(const std::string& name, am_sinkClass_t& sinkClassID));
+ MOCK_METHOD2(hookInterruptStatusChange,
+ void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
+ MOCK_METHOD1(hookDomainRegistrationComplete,
+ void(const am_domainID_t domainID));
+ MOCK_METHOD2(hookSinkAvailablityStatusChange,
+ void(const am_sinkID_t sinkID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookSourceAvailablityStatusChange,
+ void(const am_sourceID_t sourceID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookDomainStateChange,
+ void(const am_domainID_t domainID, const am_DomainState_e domainState));
+ MOCK_METHOD2(hookTimingInformationChanged,
+ void(const am_connectionID_t connectionID, const am_timeSync_t delay));
+ MOCK_METHOD1(sendChangedData,
+ void(const std::vector<am_EarlyData_s>& earlyData));
+ MOCK_CONST_METHOD1(getDBusConnectionWrapper,
+ am_Error_e(CAmDbusWrapper*& dbusConnectionWrapper));
+ MOCK_CONST_METHOD1(getSocketHandler,
+ am_Error_e(CAmSocketHandler*& socketHandler));
+ MOCK_METHOD2(confirmRoutingReady,
+ void(const uint16_t handle, const am_Error_e error));
+ MOCK_METHOD2(confirmRoutingRundown,
+ void(const uint16_t handle, const am_Error_e error));
+ MOCK_METHOD4(updateGateway,
+ am_Error_e(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix));
+ MOCK_METHOD4(updateConverter,
+ am_Error_e(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix));
+ MOCK_METHOD5(updateSink,
+ am_Error_e(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties));
+ MOCK_METHOD5(updateSource,
+ am_Error_e(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties));
+ MOCK_METHOD3(ackSetVolumes,
+ void(const am_Handle_s handle, const std::vector<am_Volumes_s>& listvolumes, const am_Error_e error));
+ MOCK_METHOD2(ackSinkNotificationConfiguration,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSourceNotificationConfiguration,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(hookSinkNotificationDataChange,
+ void(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload));
+ MOCK_METHOD2(hookSourceNotificationDataChange,
+ void(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload));
};
} // namespace am
diff --git a/PluginRoutingInterfaceCAPI/fidl/RoutingInterface.fidl b/PluginRoutingInterfaceCAPI/fidl/RoutingInterface.fidl
index 9ff485a..c0a3759 100755
--- a/PluginRoutingInterfaceCAPI/fidl/RoutingInterface.fidl
+++ b/PluginRoutingInterfaceCAPI/fidl/RoutingInterface.fidl
@@ -454,6 +454,25 @@ A client should notify himself to this attribute in order to know the current st
am_gatewayID_t gatewayID
am_Error_e ^error
}
+ }
+
+ <**
+ @description : registers a converter. (at)return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on error
+ **>
+ method registerConverter {
+ in {
+
+ <**
+ @description : In a fixed setup, the gatewayID must be below 100. In a dynamic setup, the gatewayID shall be 0. listSourceFormats and listSinkFormats are empty at registration time. Values are taken over when sources and sinks are registered.
+
+
+ **>
+ am_Converter_s converterData
+ }
+ out {
+ am_converterID_t converterID
+ am_Error_e ^error
+ }
}
<**
@@ -472,6 +491,22 @@ A client should notify himself to this attribute in order to know the current st
am_Error_e ^error
}
}
+
+ <**
+ @description : deregisters a converter. Also removes all sinks and sources of the controlling domain.
+ **>
+ method deregisterConverter {
+ in {
+
+ <**
+ @description : domainID of the control domain
+ **>
+ am_converterID_t converterID
+ }
+ out {
+ am_Error_e ^error
+ }
+ }
<**
@description : This function returns the ID to the given sinkName. If already a sink is registered with this name, it will return the corresponding ID, if not it will reserve an ID but not register the sink. The other parameters of the sink will be overwritten when the sink is registered.
@@ -715,9 +750,29 @@ Is used by the Controller to know when all expected domains are finally register
am_Error_e ^error
}
}
-
- <**
- @description : updates data of an gateway. (at)return E_OK on success, E_NON_EXISTENT if the sinkID is not valid.
+
+ <**
+ @description : updates data of an converter. (at)return E_OK on success, E_NON_EXISTENT if the converterID is not valid.
+ **>
+ method updateConverter {
+ in {
+
+ <**
+ @description : This is the new converter data that has been updated. Please note that changing source and sink IDs,
+
+ **>
+ am_converterID_t converterID
+ am_ConnectionFormat_L listSourceFormats
+ am_ConnectionFormat_L listSinkFormats
+ am_Convertion_L convertionMatrix
+ }
+ out {
+ am_Error_e ^error
+ }
+ }
+
+ <**
+ @description : updates data of an sink. (at)return E_OK on success, E_NON_EXISTENT if the sinkID is not valid.
**>
method updateSink {
in {
diff --git a/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCommon.h b/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCommon.h
index 92f4190..352ed63 100644
--- a/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCommon.h
+++ b/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCommon.h
@@ -36,6 +36,7 @@ extern void CAmConvertCAPI2AM(const org::genivi::am::am_SoundProperty_s &, am::a
extern void CAmConvertCAPI2AM(const org::genivi::am::am_MainSoundProperty_s &, am::am_MainSoundProperty_s & );
extern void CAmConvertCAPI2AM(const org::genivi::am::am_NotificationConfiguration_s & , am::am_NotificationConfiguration_s & );
extern void CAmConvertCAPI2AM(const org::genivi::am::am_Gateway_s & , am::am_Gateway_s & );
+extern void CAmConvertCAPI2AM(const org::genivi::am::am_Converter_s & , am::am_Converter_s & );
extern void CAmConvertCAPI2AM(const org::genivi::am::am_Crossfader_s & , am::am_Crossfader_s & );
extern void CAmConvertCAPI2AM(const org::genivi::am::am_EarlyData_s & , am::am_EarlyData_s & );
extern void CAmConvertCAPI2AM(const org::genivi::am::am_EarlyData_u &, am::am_EarlyData_u & );
diff --git a/PluginRoutingInterfaceCAPI/include/CAmRoutingService.h b/PluginRoutingInterfaceCAPI/include/CAmRoutingService.h
index 066d2d1..503cd1f 100644
--- a/PluginRoutingInterfaceCAPI/include/CAmRoutingService.h
+++ b/PluginRoutingInterfaceCAPI/include/CAmRoutingService.h
@@ -81,8 +81,12 @@ public:
void registerGateway(org::genivi::am::am_Gateway_s gatewayData, org::genivi::am::am_gatewayID_t& gatewayID, org::genivi::am::am_Error_e& error);
+ void registerConverter(org::genivi::am::am_Converter_s aData, org::genivi::am::am_converterID_t& converterID, org::genivi::am::am_Error_e& error);
+
void deregisterGateway(org::genivi::am::am_gatewayID_t gatewayID, org::genivi::am::am_Error_e& returnError);
+ void deregisterConverter(org::genivi::am::am_converterID_t converterID, org::genivi::am::am_Error_e& returnError);
+
void peekSink(std::string name, org::genivi::am::am_sinkID_t& sinkID, org::genivi::am::am_Error_e& error);
void registerSink(org::genivi::am::am_Sink_s sinkData, org::genivi::am::am_sinkID_t& sinkID, org::genivi::am::am_Error_e& error);
@@ -119,6 +123,8 @@ public:
void updateGateway(org::genivi::am::am_gatewayID_t gatewayID, org::genivi::am::am_ConnectionFormat_L listSourceFormats, org::genivi::am::am_ConnectionFormat_L listSinkFormats, org::genivi::am::am_Convertion_L convertionMatrix, org::genivi::am::am_Error_e& error);
+ void updateConverter(org::genivi::am::am_converterID_t converterID, org::genivi::am::am_ConnectionFormat_L listSourceFormats, org::genivi::am::am_ConnectionFormat_L listSinkFormats, org::genivi::am::am_Convertion_L convertionMatrix, org::genivi::am::am_Error_e& error);
+
void updateSink(org::genivi::am::am_sinkID_t sinkID, org::genivi::am::am_sinkClass_t sinkClassID, org::genivi::am::am_SoundProperty_L listSoundProperties, org::genivi::am::am_ConnectionFormat_L listConnectionFormats, org::genivi::am::am_MainSoundProperty_L listMainSoundProperties, org::genivi::am::am_Error_e& error);
void updateSource(org::genivi::am::am_sourceID_t sourceID, org::genivi::am::am_sourceClass_t sourceClassID, org::genivi::am::am_SoundProperty_L listSoundProperties, org::genivi::am::am_ConnectionFormat_L listConnectionFormats, org::genivi::am::am_MainSoundProperty_L listMainSoundProperties, org::genivi::am::am_Error_e& error);
diff --git a/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp b/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp
index 68d360d..be1bdfc 100644
--- a/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp
+++ b/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp
@@ -183,6 +183,18 @@ void CAmConvertCAPI2AM(const org::genivi::am::am_Gateway_s & source, am::am_Gate
destination.convertionMatrix = source.convertionMatrix;
}
+void CAmConvertCAPI2AM(const org::genivi::am::am_Converter_s & source, am::am_Converter_s & destination)
+{
+ destination.sinkID = source.sinkID;
+ destination.converterID = source.converterID;
+ destination.name = source.name;
+ destination.sourceID = source.sourceID;
+ destination.domainID = source.domainID;
+ CAmConvertCAPIVector2AM(source.listSourceFormats, destination.listSourceFormats);
+ CAmConvertCAPIVector2AM(source.listSinkFormats, destination.listSinkFormats);
+ destination.convertionMatrix = source.convertionMatrix;
+}
+
void CAmConvertCAPI2AM(const org::genivi::am::am_EarlyData_u & source, am::am_EarlyData_u & destination)
{
if(source.isType<org::genivi::am::am_volume_t>())
diff --git a/PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp b/PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp
index 61e113f..2ee2f44 100644
--- a/PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp
+++ b/PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp
@@ -184,10 +184,21 @@ void CAmRoutingService::registerGateway(org::genivi::am::am_Gateway_s gatewayDat
error = static_cast<org::genivi::am::am_Error_e>(mpIAmRoutingReceive->registerGateway(converted, gatewayID));
}
+void CAmRoutingService::registerConverter(org::genivi::am::am_Converter_s aData, org::genivi::am::am_converterID_t& converterID, org::genivi::am::am_Error_e& error) {
+ assert(mpIAmRoutingReceive);
+ am_Converter_s converted;
+ CAmConvertCAPI2AM(aData, converted);
+ error = static_cast<org::genivi::am::am_Error_e>(mpIAmRoutingReceive->registerConverter(converted, converterID));
+}
+
void CAmRoutingService::deregisterGateway(org::genivi::am::am_gatewayID_t gatewayID, org::genivi::am::am_Error_e& returnError) {
returnError = static_cast<org::genivi::am::am_Error_e>(mpIAmRoutingReceive->deregisterGateway(gatewayID));
}
+void CAmRoutingService::deregisterConverter(org::genivi::am::am_converterID_t converterID, org::genivi::am::am_Error_e& returnError) {
+ returnError = static_cast<org::genivi::am::am_Error_e>(mpIAmRoutingReceive->deregisterConverter(converterID));
+}
+
void CAmRoutingService::peekSink(std::string name, org::genivi::am::am_sinkID_t& sinkID, org::genivi::am::am_Error_e& error) {
assert(mpIAmRoutingReceive);
error = static_cast<org::genivi::am::am_Error_e>(mpIAmRoutingReceive->peekSink(name, sinkID));
@@ -315,6 +326,18 @@ void CAmRoutingService::updateGateway(org::genivi::am::am_gatewayID_t gatewayID,
error = (org::genivi::am::am_Error_e)mpIAmRoutingReceive->updateGateway(gatewayID, destinationSourceConnectionFormats, destinationSinkConnectionFormats, convertionMatrix);
}
+void CAmRoutingService::updateConverter(org::genivi::am::am_converterID_t converterID, org::genivi::am::am_ConnectionFormat_L listSourceFormats, org::genivi::am::am_ConnectionFormat_L listSinkFormats, org::genivi::am::am_Convertion_L convertionMatrix, org::genivi::am::am_Error_e& error) {
+
+ assert(mpIAmRoutingReceive);
+ std::vector<am_CustomConnectionFormat_t> destinationSourceConnectionFormats;
+ CAmConvertCAPIVector2AM(listSourceFormats, destinationSourceConnectionFormats);
+
+ std::vector<am_CustomConnectionFormat_t> destinationSinkConnectionFormats;
+ CAmConvertCAPIVector2AM(listSinkFormats, destinationSinkConnectionFormats);
+
+ error = (org::genivi::am::am_Error_e)mpIAmRoutingReceive->updateConverter(converterID, destinationSourceConnectionFormats, destinationSinkConnectionFormats, convertionMatrix);
+}
+
void CAmRoutingService::updateSink(org::genivi::am::am_sinkID_t sinkID, org::genivi::am::am_sinkClass_t sinkClassID, org::genivi::am::am_SoundProperty_L listSoundProperties, org::genivi::am::am_ConnectionFormat_L listConnectionFormats, org::genivi::am::am_MainSoundProperty_L listMainSoundProperties, org::genivi::am::am_Error_e& error) {
assert(mpIAmRoutingReceive);
std::vector<am_SoundProperty_s> dstListSoundProperties;
diff --git a/PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp b/PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp
index 83fa6e9..7999c73 100644
--- a/PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp
+++ b/PluginRoutingInterfaceCAPI/test/CAmRoutingInterfaceCAPITests.cpp
@@ -719,6 +719,69 @@ TEST_F(CAmRoutingInterfaceCAPITests, deregisterGateway)
EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
}
+MATCHER_P(IsConverterDataEqualTo, value, "") {
+ auto lh = arg;
+ return lh.converterID == value.converterID &&
+ lh.name == value.name &&
+ lh.sinkID == value.sinkID &&
+ lh.sourceID == value.sourceID &&
+ lh.domainID == value.domainID &&
+ lh.listSourceFormats == value.listSourceFormats &&
+ lh.listSinkFormats == value.listSinkFormats &&
+ lh.convertionMatrix == value.convertionMatrix;
+}
+
+TEST_F(CAmRoutingInterfaceCAPITests, registerConverter)
+{
+ ASSERT_TRUE(env->mIsServiceAvailable);
+ if(env->mIsServiceAvailable)
+ {
+ CallStatus callStatus = CallStatus::NOT_AVAILABLE;
+ org::genivi::am::am_Error_e error = org::genivi::am::am_Error_e::E_UNKNOWN;
+
+ org::genivi::am::am_ConnectionFormat_L listSourceFormats;
+ listSourceFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_ANALOG));
+ listSourceFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_AUTO));
+ org::genivi::am::am_ConnectionFormat_L listSinkFormats;
+ listSinkFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_AUTO));
+ listSinkFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_ANALOG));
+ org::genivi::am::am_Convertion_L convertionMatrix;
+ convertionMatrix.push_back(1);
+ convertionMatrix.push_back(0);
+
+ org::genivi::am::am_converterID_t converterID = 0;
+ org::genivi::am::am_Converter_s gateway(converterID, "name", 103, 104, 105, listSourceFormats, listSinkFormats, convertionMatrix);
+ am_Converter_s amGateway;
+ CAmConvertCAPI2AM(gateway, amGateway);
+
+ ON_CALL(*env->mpRoutingReceive, registerConverter(_, _)).WillByDefault(Return(E_OK));
+ EXPECT_CALL(*env->mpRoutingReceive, registerConverter(IsConverterDataEqualTo(amGateway), _)).WillOnce(DoAll(actionRegisterGateway(), Return(E_OK)));
+ env->mProxy->registerConverter(gateway, callStatus, converterID, error);
+ ASSERT_EQ( converterID, TEST_ID_1 );
+ ASSERT_EQ( error, org::genivi::am::am_Error_e::E_OK );
+ ASSERT_EQ( callStatus, CallStatus::SUCCESS );
+ }
+ EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
+}
+
+TEST_F(CAmRoutingInterfaceCAPITests, deregisterConverter)
+{
+ ASSERT_TRUE(env->mIsServiceAvailable);
+ if(env->mIsServiceAvailable)
+ {
+ CallStatus callStatus = CallStatus::NOT_AVAILABLE;
+ org::genivi::am::am_Error_e error = org::genivi::am::am_Error_e::E_UNKNOWN;
+ org::genivi::am::am_converterID_t converterID = TEST_ID_1;
+
+ ON_CALL(*env->mpRoutingReceive, deregisterConverter(_)).WillByDefault(Return(E_OK));
+ EXPECT_CALL(*env->mpRoutingReceive, deregisterConverter(converterID)).WillOnce(Return(E_OK));
+ env->mProxy->deregisterConverter(converterID, callStatus, error);
+ ASSERT_EQ( error, org::genivi::am::am_Error_e::E_OK );
+ ASSERT_EQ( callStatus, CallStatus::SUCCESS );
+ }
+ EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
+}
+
ACTION(actionPeek){
arg1=TEST_ID_1;
}
@@ -1281,6 +1344,48 @@ TEST_F(CAmRoutingInterfaceCAPITests, updateGateway)
EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
}
+TEST_F(CAmRoutingInterfaceCAPITests, updateConverter)
+{
+ ASSERT_TRUE(env->mIsServiceAvailable);
+ if(env->mIsServiceAvailable)
+ {
+ CallStatus callStatus = CallStatus::NOT_AVAILABLE;
+ am_Error_e error = E_OK;
+ org::genivi::am::am_converterID_t testID = TEST_ID_1;
+
+ org::genivi::am::am_ConnectionFormat_L listSourceFormats;
+ listSourceFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_ANALOG));
+ listSourceFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_AUTO));
+
+ org::genivi::am::am_ConnectionFormat_L listSinkFormats;
+ listSinkFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_AUTO));
+ listSinkFormats.push_back(static_cast<org::genivi::am::am_CustomConnectionFormat_t>(CF_GENIVI_ANALOG));
+
+ org::genivi::am::am_Convertion_L convertionMatrix;
+ convertionMatrix.push_back(1);
+ convertionMatrix.push_back(0);
+
+ std::vector<am_CustomConnectionFormat_t> am_listSourceFormats;
+ am_listSourceFormats.push_back(CF_GENIVI_ANALOG);
+ am_listSourceFormats.push_back(CF_GENIVI_AUTO);
+
+ std::vector<am_CustomConnectionFormat_t> am_listSinkFormats;
+ am_listSinkFormats.push_back(CF_GENIVI_AUTO);
+ am_listSinkFormats.push_back(CF_GENIVI_ANALOG);
+
+ std::vector<bool> am_convertionMatrix;
+ am_convertionMatrix.push_back(1);
+ am_convertionMatrix.push_back(0);
+ ON_CALL(*env->mpRoutingReceive, updateConverter(_, _, _, _)).WillByDefault(Return(E_OK));
+ EXPECT_CALL(*env->mpRoutingReceive, updateConverter(testID, am_listSourceFormats, am_listSinkFormats, am_convertionMatrix)).Times(1);
+
+ org::genivi::am::am_Error_e CAPIError;
+ env->mProxy->updateConverter(testID, listSourceFormats, listSinkFormats, convertionMatrix, callStatus,CAPIError);
+ ASSERT_EQ( callStatus, CallStatus::SUCCESS );
+ }
+ EXPECT_TRUE(Mock::VerifyAndClearExpectations(env->mpRoutingReceive));
+}
+
MATCHER_P(IsSoundPropertiesArrayEqualTo, value, "") {
auto lh = arg;
diff --git a/PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h b/PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h
index c2736d6..1443219 100644
--- a/PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h
+++ b/PluginRoutingInterfaceCAPI/test/MockIAmRoutingReceive.h
@@ -60,8 +60,12 @@ class MockIAmRoutingReceive : public IAmRoutingReceive {
am_Error_e(const am_domainID_t domainID));
MOCK_METHOD2(registerGateway,
am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
+ MOCK_METHOD2(registerConverter,
+ am_Error_e(const am_Converter_s& converterData, am_converterID_t& converterID));
MOCK_METHOD1(deregisterGateway,
am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD1(deregisterConverter,
+ am_Error_e(const am_converterID_t converterID));
MOCK_METHOD2(peekSink,
am_Error_e(const std::string& name, am_sinkID_t& sinkID));
MOCK_METHOD2(registerSink,
@@ -106,6 +110,8 @@ class MockIAmRoutingReceive : public IAmRoutingReceive {
void(const uint16_t handle, const am_Error_e error));
MOCK_METHOD4(updateGateway,
am_Error_e(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix));
+ MOCK_METHOD4(updateConverter,
+ am_Error_e(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix));
MOCK_METHOD5(updateSink,
am_Error_e(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties));
MOCK_METHOD5(updateSource,
diff --git a/PluginRoutingInterfaceDbus/include/CAmDbusMessageHandler.h b/PluginRoutingInterfaceDbus/include/CAmDbusMessageHandler.h
index 2ba8e81..fb3160e 100644
--- a/PluginRoutingInterfaceDbus/include/CAmDbusMessageHandler.h
+++ b/PluginRoutingInterfaceDbus/include/CAmDbusMessageHandler.h
@@ -95,6 +95,7 @@ public:
am_Source_s getSourceData();
am_Sink_s getSinkData();
am_Gateway_s getGatewayData();
+ am_Converter_s getConverterData();
am_Crossfader_s getCrossfaderData();
am_SoundProperty_s getSoundProperty();
am_MainSoundProperty_s getMainSoundProperty();
diff --git a/PluginRoutingInterfaceDbus/include/IAmRoutingReceiverShadow.h b/PluginRoutingInterfaceDbus/include/IAmRoutingReceiverShadow.h
index 4a1d781..b39b674 100644
--- a/PluginRoutingInterfaceDbus/include/IAmRoutingReceiverShadow.h
+++ b/PluginRoutingInterfaceDbus/include/IAmRoutingReceiverShadow.h
@@ -54,9 +54,11 @@ public:
void registerSource(DBusConnection *conn, DBusMessage *msg);
void registerSink(DBusConnection *conn, DBusMessage *msg);
void registerGateway(DBusConnection *conn, DBusMessage *msg);
+ void registerConverter(DBusConnection *conn, DBusMessage *msg);
void peekDomain(DBusConnection *conn, DBusMessage *msg);
void deregisterDomain(DBusConnection *conn, DBusMessage *msg);
void deregisterGateway(DBusConnection *conn, DBusMessage *msg);
+ void deregisterConverter(DBusConnection *conn, DBusMessage *msg);
void peekSink(DBusConnection *conn, DBusMessage *msg);
void deregisterSink(DBusConnection *conn, DBusMessage *msg);
void peekSource(DBusConnection *conn, DBusMessage *msg);
@@ -75,6 +77,7 @@ public:
void confirmRoutingReady(DBusConnection *conn, DBusMessage *msg);
void confirmRoutingRundown(DBusConnection *conn, DBusMessage *msg);
void updateGateway(DBusConnection *conn, DBusMessage *msg);
+ void updateConverter(DBusConnection *conn, DBusMessage *msg);
void updateSink(DBusConnection *conn, DBusMessage *msg);
void updateSource(DBusConnection *conn, DBusMessage *msg);
void ackSetVolumes(DBusConnection *conn, DBusMessage *msg);
diff --git a/PluginRoutingInterfaceDbus/include/RoutingReceiver.xml b/PluginRoutingInterfaceDbus/include/RoutingReceiver.xml
index 34c90a6..8e15bb1 100644
--- a/PluginRoutingInterfaceDbus/include/RoutingReceiver.xml
+++ b/PluginRoutingInterfaceDbus/include/RoutingReceiver.xml
@@ -85,10 +85,19 @@
<arg name="gatewayID" type="q" direction="out" />
<arg name="error" type="q" direction="out" />
</method>
+ <method name="registerConverter">
+ <arg name="converterData" type="(qsqqqaiaiab)" direction="in" /> <!-- am_converterID_t converterID; std::string name; am_sinkID_t sinkID; am_sourceID_t sourceID; am_domainID_t domainID; std::vector<am_CustomAvailabilityReason_t> listSourceFormats; std::vector<am_CustomAvailabilityReason_t> listSinkFormats; std::vector<bool> convertionMatrix; -->
+ <arg name="converterID" type="q" direction="out" />
+ <arg name="error" type="q" direction="out" />
+ </method>
<method name="deregisterGateway">
<arg name="gatewayID" type="q" direction="in" />
<arg name="error" type="q" direction="out" />
</method>
+ <method name="deregisterConverter">
+ <arg name="converterID" type="q" direction="in" />
+ <arg name="error" type="q" direction="out" />
+ </method>
<method name="peekSink">
<arg name="name" type="s" direction="in" />
<arg name="sinkID" type="q" direction="out" />
@@ -175,6 +184,12 @@
<arg name="listSinkFormats" type="a(q)" direction="in" />
<arg name="conversionMatrix" type="a(b)" direction="in" />
</method>
+ <method name="updateConverter">
+ <arg name="converterID" type="q" direction="in" />
+ <arg name="listSourceFormats" type="a(q)" direction="in" />
+ <arg name="listSinkFormats" type="a(q)" direction="in" />
+ <arg name="conversionMatrix" type="a(b)" direction="in" />
+ </method>
<method name="updateSink">
<arg name="sinkID" type="q" direction="in" />
<arg name="sinkClassID" type="q" direction="in" />
diff --git a/PluginRoutingInterfaceDbus/src/CAmDbusMessageHandler.cpp b/PluginRoutingInterfaceDbus/src/CAmDbusMessageHandler.cpp
index e85012c..0426c10 100644
--- a/PluginRoutingInterfaceDbus/src/CAmDbusMessageHandler.cpp
+++ b/PluginRoutingInterfaceDbus/src/CAmDbusMessageHandler.cpp
@@ -574,6 +574,51 @@ am_Gateway_s CAmRoutingDbusMessageHandler::getGatewayData()
return (gatewayData);
}
+am_Converter_s CAmRoutingDbusMessageHandler::getConverterData()
+{
+ am_Converter_s gatewayData;
+ DBusMessageIter gatewayDataIter, arrayIter;
+ am_CustomAvailabilityReason_t connectionFormat;
+ bool convertion;
+ if (DBUS_TYPE_STRUCT != dbus_message_iter_get_arg_type(&mDBusMessageIter))
+ {
+ log(&routingDbus, DLT_LOG_ERROR, "CAmRoutingDbusMessageHandler::getDomainData DBUS handler argument is no struct!");
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBus argument is no struct";
+ }
+ else
+ {
+ dbus_message_iter_recurse(&mDBusMessageIter, &gatewayDataIter);
+ gatewayData.converterID = static_cast<am_gatewayID_t>(getUInt(gatewayDataIter, true));
+ gatewayData.name = getString(gatewayDataIter, true);
+ gatewayData.sinkID = static_cast<am_sinkID_t>(getUInt(gatewayDataIter, true));
+ gatewayData.sourceID = static_cast<am_sourceID_t>(getUInt(gatewayDataIter, true));
+ gatewayData.domainID = static_cast<am_domainID_t>(getUInt(gatewayDataIter, true));
+ dbus_message_iter_recurse(&gatewayDataIter, &arrayIter);
+ do
+ {
+ connectionFormat = static_cast<am_CustomAvailabilityReason_t>(getInt32(arrayIter, false));
+ gatewayData.listSourceFormats.push_back(connectionFormat);
+ } while (dbus_message_iter_next(&arrayIter));
+ dbus_message_iter_next(&gatewayDataIter);
+ dbus_message_iter_recurse(&gatewayDataIter, &arrayIter);
+ do
+ {
+ connectionFormat = static_cast<am_CustomAvailabilityReason_t>(getInt32(arrayIter, false));
+ gatewayData.listSinkFormats.push_back(connectionFormat);
+ } while (dbus_message_iter_next(&arrayIter));
+ dbus_message_iter_next(&gatewayDataIter);
+ dbus_message_iter_recurse(&gatewayDataIter, &arrayIter);
+ do
+ {
+ convertion = getBool(arrayIter, false);
+ gatewayData.convertionMatrix.push_back(convertion);
+ } while (dbus_message_iter_next(&arrayIter));
+ dbus_message_iter_next(&mDBusMessageIter);
+ }
+ return (gatewayData);
+}
+
am_Crossfader_s CAmRoutingDbusMessageHandler::getCrossfaderData()
{
am_Crossfader_s crossfaderData;
diff --git a/PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp b/PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp
index 7287df7..c2924ba 100644
--- a/PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp
+++ b/PluginRoutingInterfaceDbus/src/IAmRoutingReceiverShadow.cpp
@@ -142,6 +142,24 @@ void IAmRoutingReceiverShadowDbus::registerGateway(DBusConnection* conn, DBusMes
}
}
+void IAmRoutingReceiverShadowDbus::registerConverter(DBusConnection* conn, DBusMessage* msg)
+{
+ (void) ((conn));
+ assert(mRoutingReceiveInterface != NULL);
+ mDBUSMessageHandler.initReceive(msg);
+ am_Converter_s gatewayData(mDBUSMessageHandler.getConverterData());
+ am_Error_e returnCode = mRoutingReceiveInterface->registerConverter(gatewayData, gatewayData.converterID);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append(gatewayData.converterID);
+ mDBUSMessageHandler.append(returnCode);
+ mDBUSMessageHandler.sendMessage();
+ if (returnCode != E_OK)
+ {
+ log(&routingDbus, DLT_LOG_INFO, "error registering gateway");
+ return;
+ }
+}
+
void IAmRoutingReceiverShadowDbus::hookDomainRegistrationComplete(DBusConnection* conn, DBusMessage* msg)
{
(void) ((conn));
@@ -406,6 +424,19 @@ void IAmRoutingReceiverShadowDbus::deregisterGateway(DBusConnection* conn, DBusM
mDBUSMessageHandler.sendMessage();
}
+void IAmRoutingReceiverShadowDbus::deregisterConverter(DBusConnection* conn, DBusMessage* msg)
+{
+ (void) ((conn));
+ assert(mRoutingReceiveInterface != NULL);
+ mDBUSMessageHandler.initReceive(msg);
+ am_converterID_t converterID = mDBUSMessageHandler.getUInt();
+ log(&routingDbus, DLT_LOG_INFO, "IAmRoutingReceiverShadow::deregisterGateway called, id", converterID);
+ am_Error_e returnCode = mRoutingReceiveInterface->deregisterConverter(converterID);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append(returnCode);
+ mDBUSMessageHandler.sendMessage();
+}
+
void IAmRoutingReceiverShadowDbus::peekSink(DBusConnection* conn, DBusMessage* msg)
{
(void) ((conn));
@@ -758,6 +789,27 @@ void IAmRoutingReceiverShadowDbus::updateGateway(DBusConnection* conn, DBusMessa
}
}
+void IAmRoutingReceiverShadowDbus::updateConverter(DBusConnection* conn, DBusMessage* msg)
+{
+ (void) ((conn));
+ assert(mRoutingReceiveInterface != NULL);
+ mDBUSMessageHandler.initReceive(msg);
+ am_converterID_t converterID(mDBUSMessageHandler.getInt());
+ std::vector<am_CustomAvailabilityReason_t> listSourceConnectionFormats(mDBUSMessageHandler.getListconnectionFormats());
+ std::vector<am_CustomAvailabilityReason_t> listSinkConnectionFormats(mDBUSMessageHandler.getListconnectionFormats());
+ std::vector<bool> convertionMatrix(mDBUSMessageHandler.getListBool());
+
+ am_Error_e returnCode = mRoutingReceiveInterface->updateConverter(converterID,listSourceConnectionFormats,listSinkConnectionFormats,convertionMatrix);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append(returnCode);
+ mDBUSMessageHandler.sendMessage();
+ if (returnCode != E_OK)
+ {
+ log(&routingDbus, DLT_LOG_INFO, "error updateGateway");
+ return;
+ }
+}
+
void IAmRoutingReceiverShadowDbus::updateSink(DBusConnection* conn, DBusMessage* msg)
{
(void) ((conn));
diff --git a/include/audiomanagertypes.h b/include/audiomanagertypes.h
index b5bedd9..e10a464 100755
--- a/include/audiomanagertypes.h
+++ b/include/audiomanagertypes.h
@@ -1,1376 +1,1464 @@
-/**
- * Copyright (C) 2012 - 2014, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
- *
- * \file
- * For further information see http://projects.genivi.org/audio-manager
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
- * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
- */
-#if !defined(EA_4FF89D4E_BF3C_465a_85C9_1DC47E4FA742__INCLUDED_)
-#define EA_4FF89D4E_BF3C_465a_85C9_1DC47E4FA742__INCLUDED_
-
-#include <stdint.h>
-#include <string>
-#include <vector>
-
-namespace am {
-
-/**
- * a domain ID
- */
-typedef uint16_t am_domainID_t;
-
-/**
- * a crossfader ID
- */
-typedef uint16_t am_crossfaderID_t;
-
-/**
- * a connection ID
- */
-typedef uint16_t am_connectionID_t;
-
-/**
- * a source ID
- */
-typedef uint16_t am_sourceID_t;
-
-/**
- * a sink ID
- */
-typedef uint16_t am_sinkID_t;
-
-/**
- * a gateway ID
- */
-typedef uint16_t am_gatewayID_t;
-
-/**
- * a mainConnection ID
- */
-typedef uint16_t am_mainConnectionID_t;
-
-/**
- * speed
- */
-typedef uint16_t am_speed_t;
-
-/**
- * The unit is 0.1 db steps,The smallest value -3000 (=AM_MUTE). The minimum and
- * maximum can be limited by actual project.
- */
-typedef int16_t am_volume_t;
-static const am_volume_t AM_MUTE = -3000;
-
-/**
- * This is the volume presented on the command interface. It is in the duty of the
- * Controller to change the volumes given here into meaningful values on the
- * routing interface.
- * The range of this type is customer specific.
- */
-typedef int16_t am_mainVolume_t;
-
-typedef uint16_t am_sourceClass_t;
-
-typedef uint16_t am_sinkClass_t;
-
-/**
- * time in ms!
- */
-typedef uint16_t am_time_t;
-
-/**
- * offset time that is introduced in milli seconds.
- */
-typedef int16_t am_timeSync_t;
-
-/**
- * This type gives the information about reason for reason for Source/Sink change
- */
-typedef uint16_t am_CustomAvailabilityReason_t;
-static const am_CustomAvailabilityReason_t AR_UNKNOWN = 0;
-/** new media was entered */
-static const am_CustomAvailabilityReason_t AR_GENIVI_NEWMEDIA = 1;
-/** same media was entered */
-static const am_CustomAvailabilityReason_t AR_GENIVI_SAMEMEDIA = 2;
-/** there is no media or media is removed */
-static const am_CustomAvailabilityReason_t AR_GENIVI_NOMEDIA = 3;
-/** there was a temperature event */
-static const am_CustomAvailabilityReason_t AR_GENIVI_TEMPERATURE = 4;
-/** there was a voltage event */
-static const am_CustomAvailabilityReason_t AR_GENIVI_VOLTAGE = 5;
-/** fatal errors on reading or accessing media */
-static const am_CustomAvailabilityReason_t AR_GENIVI_ERRORMEDIA = 6;
-
-/**
- * This is a custom specific identifier of property. It can be used to
- * differentiate between interrupt source/sink, main source/sink, etc.
- */
-typedef uint16_t am_CustomClassProperty_t;
-static const am_CustomClassProperty_t CP_UNKNOWN = 0;
-static const am_CustomClassProperty_t CP_GENIVI_SOURCE_TYPE = 1;
-static const am_CustomClassProperty_t CP_GENIVI_SINK_TYPE = 2;
-
-/**
- * This type classifies the format in which data is exchanged within a connection.
- * The type itself is project specific although there are some standard formats
- * defined.
- */
-typedef uint16_t am_CustomConnectionFormat_t;
-static const am_CustomConnectionFormat_t CF_UNKNOWN = 0;
-static const am_CustomConnectionFormat_t CF_GENIVI_MONO = 1;
-static const am_CustomConnectionFormat_t CF_GENIVI_STEREO = 2;
-static const am_CustomConnectionFormat_t CF_GENIVI_ANALOG = 3;
-static const am_CustomConnectionFormat_t CF_GENIVI_AUTO = 4;
-
-/**
- * Here are all SoundProperties that can be set via the CommandInterface.
- * This type is product specific and can be changed or extended.
- */
-typedef uint16_t am_CustomMainSoundPropertyType_t;
-static const am_CustomMainSoundPropertyType_t MSP_UNKNOWN = 0;
-static const am_CustomMainSoundPropertyType_t MSP_GENIVI_TREBLE = 1;
-static const am_CustomMainSoundPropertyType_t MSP_GENIVI_MID = 2;
-static const am_CustomMainSoundPropertyType_t MSP_GENIVI_BASS = 3;
-
-/**
- * The notification types are project specific.
- */
-typedef uint16_t am_CustomNotificationType_t;
-static const am_CustomNotificationType_t NT_UNKNOWN = 0;
-
-/**
- * The given ramp types here are just examples. For products, different ramp types
- * can be defined here. It is in the responsibility of the product to make sure
- * that the routing plugins are aware of the ramp types used.
- */
-typedef uint16_t am_CustomRampType_t;
-static const am_CustomRampType_t RAMP_UNKNOWN = 0;
-/** sets directly the value without a ramp */
-static const am_CustomRampType_t RAMP_GENIVI_DIRECT = 1;
-/** Sets the volume as fast as possible */
-static const am_CustomRampType_t RAMP_GENIVI_NO_PLOP = 2;
-/** inverted exponential update, high gradient at the start - soft end */
-static const am_CustomRampType_t RAMP_GENIVI_EXP_INV = 3;
-/** continues update of volume */
-static const am_CustomRampType_t RAMP_GENIVI_LINEAR = 4;
-/** exponential update, soft start - high gradient at the end */
-static const am_CustomRampType_t RAMP_GENIVI_EXP = 5;
-
-/**
- * Within genivi only the some example properties are defined.
- * For products these should be changed or extended.
- */
-typedef uint16_t am_CustomSoundPropertyType_t;
-static const am_CustomSoundPropertyType_t SP_UNKNOWN = 0;
-static const am_CustomSoundPropertyType_t SP_GENIVI_TREBLE = 1;
-static const am_CustomSoundPropertyType_t SP_GENIVI_MID = 2;
-static const am_CustomSoundPropertyType_t SP_GENIVI_BASS = 3;
-
-/**
- * Describes the different system properties which are project specific.
- */
-typedef uint16_t am_CustomSystemPropertyType_t;
-static const am_CustomSystemPropertyType_t SYP_UNKNOWN = 0;
-
-/**
- * describes the active sink of a crossfader.
- */
-enum am_HotSink_e
-{
- /**
- * default
- */
- HS_UNKNOWN = 0,
- /**
- * sinkA is active
- */
- HS_SINKA = 1,
- /**
- * sinkB is active
- */
- HS_SINKB = 2,
- /**
- * the crossfader is in the transition state
- */
- HS_INTERMEDIATE = 3,
- HS_MAX
-};
-
-/**
- * with the help of this enum, sinks and sources can report their availability
- * state
- */
-enum am_Availability_e
-{
- /**
- * default
- */
- A_UNKNOWN = 0,
- /**
- * The source / sink is available
- */
- A_AVAILABLE = 1,
- /**
- * the source / sink is not available
- */
- A_UNAVAILABLE = 2,
- A_MAX
-};
-
-/**
- * represents the connection state
- */
-enum am_ConnectionState_e
-{
- CS_UNKNOWN = 0,
- /**
- * This means the connection is just building up
- */
- CS_CONNECTING = 1,
- /**
- * the connection is ready to be used
- */
- CS_CONNECTED = 2,
- /**
- * the connection is in the course to be knocked down
- */
- CS_DISCONNECTING = 3,
- /**
- * only relevant for connectionStatechanged. Is send after the connection was
- * removed
- */
- CS_DISCONNECTED = 4,
- /**
- * this means the connection is still build up but unused at the moment
- */
- CS_SUSPENDED = 5,
- CS_MAX
-};
-
-enum am_DomainState_e
-{
- /**
- * default
- */
- DS_UNKNOWN = 0,
- /**
- * the domain is controlled by the daemon
- */
- DS_CONTROLLED = 1,
- /**
- * the domain is independent starting up
- */
- DS_INDEPENDENT_STARTUP = 1,
- /**
- * the domain is independent running down
- */
- DS_INDEPENDENT_RUNDOWN = 2,
- DS_MAX
-};
-
-/**
- * This enum characterizes the data of the EarlyData_t
- */
-enum am_EarlyDataType_e
-{
- /**
- * default
- */
- ES_UNKNOWN = 0,
- /**
- * the source volume
- */
- ED_SOURCE_VOLUME = 1,
- /**
- * the sink volume
- */
- ED_SINK_VOLUME = 2,
- /**
- * a source property
- */
- ED_SOURCE_PROPERTY = 3,
- /**
- * a sink property
- */
- ED_SINK_PROPERTY = 4,
- /**
- * The interrupt state
- */
- ED_INTERRUPT_STATE = 5,
- ED_MAX
-};
-
-/**
- * the errors of the audiomanager. All possible errors are in here. This enum is
- * used widely as return parameter.
- */
-enum am_Error_e
-{
- /**
- * no error - positive reply
- */
- E_OK = 0,
- /**
- * default
- */
- E_UNKNOWN = 1,
- /**
- * value out of range
- */
- E_OUT_OF_RANGE = 2,
- /**
- * not used
- */
- E_NOT_USED = 3,
- /**
- * a database error occurred
- */
- E_DATABASE_ERROR = 4,
- /**
- * the desired object already exists
- */
- E_ALREADY_EXISTS = 5,
- /**
- * there is no change
- */
- E_NO_CHANGE = 6,
- /**
- * the desired action is not possible
- */
- E_NOT_POSSIBLE = 7,
- /**
- * the desired object is non existent
- */
- E_NON_EXISTENT = 8,
- /**
- * the asynchronous action was aborted
- */
- E_ABORTED = 9,
- /**
- * This error is returned in case a connect is issued with a connectionFormat that
- * cannot be selected for the connection. This could be either due to the
- * capabilities of a source or a sink or gateway compatibilities for example
- */
- E_WRONG_FORMAT = 10,
- E_MAX
-};
-
-enum am_MuteState_e
-{
- /**
- * default
- */
- MS_UNKNOWN = 0,
- /**
- * the source / sink is muted
- */
- MS_MUTED = 1,
- /**
- * the source / sink is unmuted
- */
- MS_UNMUTED = 2,
- MS_MAX
-};
-
-/**
- * The source state reflects the state of the source
- */
-enum am_SourceState_e
-{
- SS_UNKNNOWN = 0,
- /**
- * The source can be activly heared
- */
- SS_ON = 1,
- /**
- * The source cannot be heared
- */
- SS_OFF = 2,
- /**
- * The source is paused. Meaning it cannot be heared but should be prepared to
- * play again soon.
- */
- SS_PAUSED = 3,
- SS_MAX
-};
-
-/**
- * This enumeration is used to define the type of the action that is correlated to
- * a handle.
- */
-enum am_Handle_e
-{
- H_UNKNOWN = 0,
- H_CONNECT = 1,
- H_DISCONNECT = 2,
- H_SETSOURCESTATE = 3,
- H_SETSINKVOLUME = 4,
- H_SETSOURCEVOLUME = 5,
- H_SETSINKSOUNDPROPERTY = 6,
- H_SETSOURCESOUNDPROPERTY = 7,
- H_SETSINKSOUNDPROPERTIES = 8,
- H_SETSOURCESOUNDPROPERTIES = 9,
- H_CROSSFADE = 10,
- H_SETVOLUMES = 11,
- H_SETSINKNOTIFICATION = 12,
- H_SETSOURCENOTIFICATION = 13,
- H_MAX
-};
-
-enum am_InterruptState_e
-{
- /**
- * default
- */
- IS_UNKNOWN = 0,
- /**
- * the interrupt state is off - no interrupt
- */
- IS_OFF = 1,
- /**
- * the interrupt state is interrupted - the interrupt is active
- */
- IS_INTERRUPTED = 2,
- IS_MAX
-};
-
-/**
- * This datatype determines if a sourceID or a sinkID is used in the union
- * following
- */
-enum am_VolumeType_e
-{
- VT_UNKNOWN = 0,
- /**
- * the following type is a sink
- */
- VT_SINK = 1,
- /**
- * the following type is a source
- */
- VT_SOURCE = 2,
- VT_MAX
-};
-
-enum am_NotificationStatus_e
-{
- NS_UNKNOWN = 0,
- /**
- * No notification, the function is turned off
- */
- NS_OFF = 1,
- /**
- * Periodic notifications are sent out. The period in ms is given by
- * am_NotificationParameter
- */
- NS_PERIODIC = 2,
- /**
- * The notification is sent out when the minimum given by am_NotificationParameter
- * is reached.
- */
- NS_MINIMUM = 3,
- /**
- * The notification is sent out when the maximum given by am_NotificationParameter
- * is reached.
- */
- NS_MAXIMUM = 4,
- /**
- * The notification is sent out when a change happened. The Resolution of the
- * change is defined by am_NotificationParameter.
- */
- NS_CHANGE = 5,
- NS_MAX
-};
-
-/**
- * this describes the availability of a sink or a source together with the latest
- * change
- */
-struct am_Availability_s
-{
-
-public:
- /**
- * the current availability state
- */
- am_Availability_e availability;
- /**
- * the reason for the last change. This can be used to trigger events that deal
- * with state changes.
- */
- am_CustomAvailabilityReason_t availabilityReason;
-
-};
-
-/**
- * describes class properties
- */
-struct am_ClassProperty_s
-{
-
-public:
- /**
- * the property as enum
- */
- am_CustomClassProperty_t classProperty;
- /**
- * the value of the property
- */
- int16_t value;
-
-};
-
-/**
- * This struct describes the attribiutes of a crossfader.
- */
-struct am_Crossfader_s
-{
-
-public:
- /**
- * This is the ID of the crossfader, it is unique in the system. There are 2 ways,
- * ID can be created: either it is assigned during the registration process (in a
- * dynamic context, uniqueness will be ensured by the AudioManager daemon), or it
- * is a fixed (the project has to ensure the uniqueness of the ID).
- */
- am_crossfaderID_t crossfaderID;
- /**
- * The name of the crossfader. Must be unique in the whole system.
- */
- std::string name;
- /**
- * The sinkID of the SinkA. Sinks shall be registered before registering the
- * crossfader.
- */
- am_sinkID_t sinkID_A;
- /**
- * The sinkID of the SinkB. Sinks shall be registered before registering the
- * crossfader.
- */
- am_sinkID_t sinkID_B;
- /**
- * The sourceID of the crossfader source. The source shall be registered before
- * the crossfader.
- */
- am_sourceID_t sourceID;
- /**
- * This enum can have 3 states:
- *
- * HS_SINKA sinkA is the current hot one, sinkB is not audible
- * HS_SINKB sinkB is the current hot one, sinkB is not audible
- * HS_INTERMEDIATE the fader is stuck in between a cross-fading action. This
- * could be due to an abort or an error. Before using the crossfader, it must be
- * set to either HS_SINKA or HS_SINKB.
- */
- am_HotSink_e hotSink;
-
-};
-
-/**
- * This struct describes the attributes of a gateway.
- */
-struct am_Gateway_s
-{
-
-public:
- /**
- * This is the ID of the gateway, it is unique in the system. There are 2 ways, ID
- * can be created: either it is assigned during the registration process (in a
- * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
- * is a fixed (the project has to ensure the uniqueness of the ID).
- */
- am_gatewayID_t gatewayID;
- /**
- * The name of the gateway. Must be unique in the whole system.
- */
- std::string name;
- /**
- * The sinkID of the gateway sink-end. The sink is a full blown sink with
- * connectionFormats, sinkClassIDs etc... It makes sense to register the sinks of
- * a gateway as non-visible. Care needs to be taken that the connectionsFormats
- * match with the ones in the conversionMatrix. If the sink is located in the
- * controllingDomain, the ID needs to be retrieved by registering the sink before
- * registering the gateway. In case the sink is in a different domain, the ID
- * needs to be retrieved via peeking.
- */
- am_sinkID_t sinkID;
- /**
- * The sourceID of the gateway sink-end. The sink is a full blown source with
- * connectionFormats, sinkClassIDs etc... It makes sense to register the sources
- * of a gateway as non-visible. Care needs to be taken that the connectionsFormats
- * match with the ones in the conversionMatrix. If the source is located in the
- * controllingDomain, the ID needs to be retrieved by registering the source
- * before registering the gateway. In case the source is in a different domain,
- * the ID needs to be retrieved via peeking.
- */
- am_sourceID_t sourceID;
- /**
- * The ID of the sink. If the domain is the same like the controlling domain, the
- * ID is known due to registration. If the domain is different, the ID needs to be
- * retrieved via peeking.
- */
- am_domainID_t domainSinkID;
- /**
- * The ID of the source. If the domain is the same like the controlling domain,
- * the ID is known due to registration. If the domain is different, the ID needs
- * to be retrieved via peeking.
- */
- am_domainID_t domainSourceID;
- /**
- * This is the ID of the domain that registers the gateway.
- */
- am_domainID_t controlDomainID;
- /**
- * This is the list of available formats on the source side of the gateway. It is
- * not defined during the gateway registration but copied from the source
- * registration.
- */
- std::vector<am_CustomConnectionFormat_t> listSourceFormats;
- /**
- * This is the list of available formats on the sink side of the gateway. It is
- * not defined during the gateway registration but copied from the sink
- * registration.
- */
- std::vector<am_CustomConnectionFormat_t> listSinkFormats;
- /**
- * This is matrix holding information about the conversion capability of the
- * gateway, it's length is defined by the length(listSinkFormats) x
- * length(listSourceFormats).
- * If a SinkFormat can be converted into a SourceFormat, the vector will hold a 1,
- * if no conversion is possible, a 0.
- * The data is stored row orientated, where the rows are related to the
- * sinksFormats and the columns to the sourceFormats. The first value will hold
- * the conversion information from the first sourceFormat to the first sinkFormat
- * for example and the seventh value the information about the 3rd sinkFormat to
- * the 1st sourceFormat in case we would have 3 sourceFormats.
- *
- * This matrix
- * 110 011 000 111 001
- *
- * reads as this:
- * Source
- * ** 1 2 3
- * *********************
- * S 1* 1 1 0
- * i 2* 0 1 1
- * n 3* 0 0 0
- * k 4* 1 1 1
- * 5* 0 0 1
- */
- std::vector<bool> convertionMatrix;
-
-};
-
-/**
- * This represents one "hopp" in a route
- */
-struct am_RoutingElement_s
-{
-
-public:
- /**
- * the source ID
- */
- am_sourceID_t sourceID;
- /**
- * the sinkID
- */
- am_sinkID_t sinkID;
- /**
- * the domainID the routeElement is in
- */
- am_domainID_t domainID;
- /**
- * the connectionformat that is used for the route
- */
- am_CustomConnectionFormat_t connectionFormat;
-
-};
-
-/**
- * a list of routing elements that lead from source to sink
- */
-struct am_Route_s
-{
-
-public:
- /**
- * the sourceID where the route starts
- */
- am_sourceID_t sourceID;
- /**
- * the sinkID where the route ends
- */
- am_sinkID_t sinkID;
- /**
- * the actual route as list of routing elements
- */
- std::vector<am_RoutingElement_s> route;
-
-};
-
-/**
- * struct describing the sound property
- */
-struct am_SoundProperty_s
-{
-
-public:
- /**
- * the type of the property - a project specific enum
- */
- am_CustomSoundPropertyType_t type;
- /**
- * the actual value of the property
- */
- int16_t value;
-
-};
-
-/**
- * struct describing system properties
- */
-struct am_SystemProperty_s
-{
-
-public:
- /**
- * the type that is set
- */
- am_CustomSystemPropertyType_t type;
- /**
- * the value
- */
- int16_t value;
-
-};
-
-/**
- * struct describing sinkclasses
- */
-struct am_SinkClass_s
-{
-
-public:
- /**
- * the ID of the sinkClass
- */
- am_sinkClass_t sinkClassID;
- /**
- * the name of the sinkClass - must be unique in the system
- */
- std::string name;
- /**
- * the list of the class properties. These are pairs of a project specific enum
- * describing the type of the value and an integer holding the real value.
- */
- std::vector<am_ClassProperty_s> listClassProperties;
-
-};
-
-/**
- * struct describing source classes
- */
-struct am_SourceClass_s
-{
-
-public:
- /**
- * the source ID
- */
- am_sourceClass_t sourceClassID;
- /**
- * the name of the sourceClass - must be unique in the system
- */
- std::string name;
- /**
- * the list of the class properties. These are pairs of a project specific enum
- * describing the type of the value and an integer holding the real value.
- */
- std::vector<am_ClassProperty_s> listClassProperties;
-
-};
-
-/**
- * this type holds all information of sources relevant to the HMI
- */
-struct am_SourceType_s
-{
-
-public:
- /**
- * This is the ID of the source, it is unique in the system. There are 2 ways, ID
- * can be created: either it is assigned during the registration process (in a
- * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
- * is a fixed (the project has to ensure the uniqueness of the ID).
- */
- am_sourceID_t sourceID;
- /**
- * The name of the source. Must be unique in the whole system.
- */
- std::string name;
- /**
- * the availability of the source
- */
- am_Availability_s availability;
- /**
- * the sourceClassID, indicates the class the source is in. This information can
- * be used by the Controller to implement different behaviour for different
- * classes.
- */
- am_sourceClass_t sourceClassID;
-
-};
-
-/**
- * this type holds all information of sinks relevant to the HMI
- */
-struct am_SinkType_s
-{
-
-public:
- /**
- * This is the ID of the sink, it is unique in the system. There are 2 ways, ID
- * can be created: either it is assigned during the registration process (in a
- * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
- * is a fixed (the project has to ensure the uniqueness of the ID).
- */
- am_sinkID_t sinkID;
- /**
- * The name of the sink. Must be unique in the whole system.
- */
- std::string name;
- /**
- * This attribute reflects the availability of the sink. There are several reasons
- * why a sink could be not available for the moment: for example the shutdown of a
- * sink because of overtemperature or over- & undervoltage. The availability
- * consists of two pieces of information:
- *
- * Availablility: the status itself, can be A_AVAILABLE, A_UNAVAILABLE or
- * A_UNKNOWN
- * AvailabilityReason: this informs about the last reason for a change in
- * availability. The reasons itself are product specific.
- */
- am_Availability_s availability;
- /**
- * This is the representation of the Volume for the commandInterface. It is used
- * by the HMI to set the volume of a sink, the AudioManagerController has to
- * transform this into real source and sink volumes.
- */
- am_mainVolume_t volume;
- am_MuteState_e muteState;
- /**
- * The sinkClassID references to a sinkClass. With the help of classification,
- * rules can be setup to define the system behaviour.
- */
- am_sinkClass_t sinkClassID;
-
-};
-
-/**
- * a handle is used for asynchronous operations and is uniquely assigned for each
- * of this operations
- */
-struct am_Handle_s
-{
-
-public:
- /**
- * the handletype
- */
- am_Handle_e handleType:6;
- /**
- * the handle as value
- */
- uint16_t handle:10;
-
-};
-
-/**
- * struct describung mainsound property
- */
-struct am_MainSoundProperty_s
-{
-
-public:
- /**
- * the type of the property
- */
- am_CustomMainSoundPropertyType_t type;
- /**
- * the actual value
- */
- int16_t value;
-
-};
-
-/**
- * this type holds all information of connections relevant to the HMI
- */
-struct am_MainConnectionType_s
-{
-
-public:
- /**
- * the ID of the mainconnection
- */
- am_mainConnectionID_t mainConnectionID;
- /**
- * the sourceID where the connection starts
- */
- am_sourceID_t sourceID;
- /**
- * the sinkID where the connection ends
- */
- am_sinkID_t sinkID;
- /**
- * the delay of the mainconnection
- */
- am_timeSync_t delay;
- /**
- * the current connection state
- */
- am_ConnectionState_e connectionState;
-
-};
-
-/**
- * struct that holds attribiutes of a mainconnection
- */
-struct am_MainConnection_s
-{
-
-public:
- /**
- * the assigned ID
- */
- am_mainConnectionID_t mainConnectionID;
- /**
- * the current connection state
- */
- am_ConnectionState_e connectionState;
- /**
- * the sinkID
- */
- am_sinkID_t sinkID;
- /**
- * the sourceID
- */
- am_sourceID_t sourceID;
- /**
- * the delay of the connection
- */
- am_timeSync_t delay;
- /**
- * the list of sub connection IDs the mainconnection consists of
- */
- std::vector<am_connectionID_t> listConnectionID;
-
-};
-
-/**
- * This struct holds the payload of a notification.
- */
-struct am_NotificationPayload_s
-{
-
-public:
- /**
- * This defines the notification type
- */
- am_CustomNotificationType_t type;
- /**
- * This is finally the value of the notification. It's meaning depends on the
- * notificationType
- */
- int16_t value;
-
-};
-
-/**
- * This struct holds information about the configuration for notifications
- */
-struct am_NotificationConfiguration_s
-{
-
-public:
- /**
- * The notification type of the notification
- */
- am_CustomNotificationType_t type;
- /**
- * The Notification status. This can be periodic, min/max value based or even off
- * for example
- */
- am_NotificationStatus_e status;
- /**
- * This gives additional information to the notification status.
- * Relation between notification status and the value:
- * NS_PERIODIC - the period in ms
- * NS_MINIMUM - the minimum value that triggers the notification
- * NS_MAXIMUM - the maximum value that triggers the notifcation
- * NS_CHANGE - the resolution of the change value
- */
- int16_t parameter;
-
-};
-
-/**
- * This struct describes the attribiutes of a sink
- */
-struct am_Sink_s
-{
-
-public:
- /**
- * This is the ID of the sink, it is unique in the system. There are 2 ways, ID
- * can be created: either it is assigned during the registration process (in a
- * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
- * is a fixed (the project has to ensure the uniqueness of the ID).
- */
- am_sinkID_t sinkID;
- /**
- * The name of the sink. Must be unique in the whole system.
- */
- std::string name;
- /**
- * The domainID is the domain the sink belongs to. A sink can only be in one
- * domain.
- */
- am_domainID_t domainID;
- /**
- * The sinkClassID references to a sinkClass. With the help of classification,
- * rules can be setup to define the system behaviour.
- */
- am_sinkClass_t sinkClassID;
- /**
- * This is the volume of the sink. It is set by the AudioManagerController.
- */
- am_volume_t volume;
- /**
- * This Boolean flag indicates whether a sink is visible to the commandInterface
- * or not. If the User must have the possibility to choose the source in the HMI,
- * it must be visible. But there are also good reasons for invisible sinks, for
- * example if the sink is part of a crossfader or gateway. HMI relevant changes in
- * visible sinks will be automatically reported by the daemon to the
- * commandInterface.
- */
- bool visible;
- /**
- * This attribute reflects the availability of the sink. There are several reasons
- * why a sink could be not available for the moment: for example the shutdown of a
- * sink because of overtemperature or over- & undervoltage. The availability
- * consists of two pieces of information:
- *
- * Availablility: the status itself, can be A_AVAILABLE, A_UNAVAILABLE or
- * A_UNKNOWN
- * AvailabilityReason: this informs about the last reason for a change in
- * availability. The reasons itself are product specific.
- */
- am_Availability_s available;
- /**
- * This attribute reflects the muteState of the sink. The information is not the
- * "real" state of the sink, but the HMI representation for he commandInterface
- * controlled by the AudioManagerController.
- */
- am_MuteState_e muteState;
- /**
- * This is the representation of the Volume for the commandInterface. It is used
- * by the HMI to set the volume of a sink, the AudioManagerController has to
- * transform this into real source and sink volumes.
- */
- am_mainVolume_t mainVolume;
- /**
- * This is the list of soundProperties, that the sink is capable of. The
- * soundProperties itself are project specific. For sinks, a possible
- * soundProperty could be for example settings.
- */
- std::vector<am_SoundProperty_s> listSoundProperties;
- /**
- * This list holds information about the formats that the Source is capable of
- * supporting when delivering audio.
- */
- std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
- /**
- * This is the list of the available mainSoundProperties. The principle is the
- * same than with soundProperties, but they are only visible to the
- * CommandInterface.
- */
- std::vector<am_MainSoundProperty_s> listMainSoundProperties;
- /**
- * This is the list of the MainNotificationConfigurations. These notifications
- * work on the level of command interface.
- */
- std::vector<am_NotificationConfiguration_s> listMainNotificationConfigurations;
- /**
- * This is the list of the NotificationConfigurations. These notifications work on
- * the level of RoutingPlugins.
- */
- std::vector<am_NotificationConfiguration_s> listNotificationConfigurations;
-
-};
-
-/**
- * This struct describes the attribiutes of a source
- */
-struct am_Source_s
-{
-
-public:
- /**
- * This is the ID of the source, it is unique in the system. There are 2 ways, ID
- * can be created: either it is assigned during the registration process (in a
- * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
- * is a fixed (the project has to ensure the uniqueness of the ID).
- */
- am_sourceID_t sourceID;
- /**
- * The domainID is the domain the source belongs to. A source can only be in one
- * domain.
- */
- am_domainID_t domainID;
- /**
- * The name of the source. Must be unique in the whole system.
- */
- std::string name;
- /**
- * the sourceClassID, indicates the class the source is in. This information can
- * be used by the Controller to implement different behaviour for different
- * classes.
- */
- am_sourceClass_t sourceClassID;
- /**
- * The source state is an indication towards the source if it is actively heard or
- * not. The source can use this information to implement features like automatic
- * spin down of CD's in case the CD is not the active source or AF following of a
- * tuner that is not actively heard. The source state is set by the
- * AudioManagerController.There are 3 possible states:
- *
- * SS_ON: the source is active
- * SS_OFF: the source is off
- * SS_PAUSED: the source is paused and not active.
- */
- am_SourceState_e sourceState;
- /**
- * This is the volume of the source. It is set by the AudioManagerController. It
- * is used to adopt different audiolevels in a system and mixing of sources (e.g.
- * navigation hints & music).
- */
- am_volume_t volume;
- /**
- * This Boolean flag indicates whether a source is visible to the commandInterface
- * or not. If the User must have the possibility to choose the source in the HMI,
- * it must be visible. But there are also good reasons for invisible sources, for
- * example if the source is part of a crossfader or gateway. HMI relevant changes
- * in visible sources will be automatically reported by the daemon to the
- * commandInterface.
- */
- bool visible;
- /**
- * This attribute reflects the availability of the source. There are several
- * reasons why a source could be not available for the moment. For example a CD
- * player which has no CD entered in the slot can be unavailable, or a USB player
- * with no or unreadable stick attached. Other scenarios involve the shutdown of a
- * source because of overtemperature or over- & undervoltage. The availability
- * consists of two informations:
- *
- * Availablility: the status itself, can be A_AVAILABLE, A_UNAVAILABLE or
- * A_UNKNOWN
- * AvailabilityReason: this informs about the last reason for a change in
- * availability. The reasons itself are product specific.
- */
- am_Availability_s available;
- /**
- * Some special sources can have special behaviors, the are so called "Low Level
- * Interrupts". Here the current status is documented. The information can be used
- * by the AudioManagerController to react to the changes by for example lowering
- * the volume of the mainSources. The two states are
- *
- * IS_OFF: the interrupt is not active at the moment
- * IS_INTERRUPTED: the interrupt is playing at the moment.
- */
- am_InterruptState_e interruptState;
- /**
- * This is the list of soundProperties, that the source is capable of. The
- * soundProperties itself are project specific. For sources, a possible
- * soundProperty could be navigation volume offset, for example.
- */
- std::vector<am_SoundProperty_s> listSoundProperties;
- /**
- * This list holds information about the formats that the Source is capable of
- * supporting when delivering audio.
- */
- std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
- /**
- * This is the list of the available mainSoundProperties. The principle is the
- * same than with soundProperties, but they are only visible to the
- * CommandInterface.
- */
- std::vector<am_MainSoundProperty_s> listMainSoundProperties;
- /**
- * The list of MainNotificationConfigurations. These notifications work on the
- * level of CommandInterface.
- */
- std::vector<am_NotificationConfiguration_s> listMainNotificationConfigurations;
- /**
- * The list of MainNotificationConfigurations. These notifications work on the
- * level of RoutingInterface.
- */
- std::vector<am_NotificationConfiguration_s> listNotificationConfigurations;
-
-};
-
-/**
- * This struct describes the attribiutes of a domain
- */
-struct am_Domain_s
-{
-
-public:
- /**
- * the domain ID
- */
- am_domainID_t domainID;
- /**
- * the name of the domain
- */
- std::string name;
- /**
- * the busname. This is equal to a plugin name and is used to dispatch messages to
- * the elements of a plugin
- */
- std::string busname;
- /**
- * the name of the node
- */
- std::string nodename;
- /**
- * indicated if the domain is independent at startup or not
- */
- bool early;
- /**
- * indicates if the domain registration is complete or not
- */
- bool complete;
- /**
- * the current domain state
- */
- am_DomainState_e state;
-
-};
-
-/**
- * a connection
- */
-struct am_Connection_s
-{
-
-public:
- /**
- * the assigned ID
- */
- am_connectionID_t connectionID;
- /**
- * the source the audio flows from
- */
- am_sourceID_t sourceID;
- /**
- * the sink the audio flows to
- */
- am_sinkID_t sinkID;
- /**
- * the delay of the conneciton
- */
- am_timeSync_t delay;
- /**
- * the used connectionformat
- */
- am_CustomConnectionFormat_t connectionFormat;
-
-};
-
-/**
- * data type depends of am_EarlyDataType_e:
- * volume_t in case of ED_SOURCE_VOLUME, ED_SINK_VOLUME
- * soundProperty_t in case of ED_SOURCE_PROPERTY, ED_SINK_PROPERTY
- */
-union am_EarlyData_u
-{
-
-public:
- am_volume_t volume;
- am_SoundProperty_s soundProperty;
- am_InterruptState_e interruptState;
-
-};
-
-/**
- * data type depends of am_EarlyDataType_e:
- * sourceID in case of ED_SOURCE_VOLUME, ED_SOURCE_PROPERTY
- * sinkID in case of ED_SINK_VOLUME, ED_SINK_PROPERTY
- */
-union am_DataType_u
-{
-
-public:
- am_sinkID_t sink;
- am_sourceID_t source;
-
-};
-
-struct am_EarlyData_s
-{
-
-public:
- am_EarlyDataType_e type;
- am_DataType_u sinksource;
- am_EarlyData_u data;
-
-};
-
-/**
- * This types describe a mixed description for source and sinks volumes.
- */
-struct am_Volumes_s
-{
-
-public:
- /**
- * describes the type of the volume: source or sink.
- */
- am_VolumeType_e volumeType;
- /**
- * either sourceID or sinkID
- */
- am_DataType_u volumeID;
- /**
- * The volume
- */
- am_volume_t volume;
- /**
- * the ramp that shall be driven
- */
- am_CustomRampType_t ramp;
- /**
- * the time for the ramp
- */
- am_time_t time;
-
-};
-}
-#endif // !defined(EA_4FF89D4E_BF3C_465a_85C9_1DC47E4FA742__INCLUDED_)
+/**
+ * Copyright (C) 2012 - 2014, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
+ *
+ * \file
+ * For further information see http://projects.genivi.org/audio-manager
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
+ * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
+ */
+#if !defined(EA_71AFF0F7_316D_4cb5_9225_9B8C7D938A15__INCLUDED_)
+#define EA_71AFF0F7_316D_4cb5_9225_9B8C7D938A15__INCLUDED_
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+namespace am {
+
+/**
+ * a domain ID
+ */
+typedef uint16_t am_domainID_t;
+
+/**
+ * a crossfader ID
+ */
+typedef uint16_t am_crossfaderID_t;
+
+/**
+ * a connection ID
+ */
+typedef uint16_t am_connectionID_t;
+
+/**
+ * a source ID
+ */
+typedef uint16_t am_sourceID_t;
+
+/**
+ * a sink ID
+ */
+typedef uint16_t am_sinkID_t;
+
+/**
+ * a converter ID
+ */
+typedef uint16_t am_converterID_t;
+
+/**
+ * a gateway ID
+ */
+typedef uint16_t am_gatewayID_t;
+
+/**
+ * a mainConnection ID
+ */
+typedef uint16_t am_mainConnectionID_t;
+
+/**
+ * speed
+ */
+typedef uint16_t am_speed_t;
+
+/**
+ * The unit is 0.1 db steps,The smallest value -3000 (=AM_MUTE). The minimum and
+ * maximum can be limited by actual project.
+ */
+typedef int16_t am_volume_t;
+static const am_volume_t AM_MUTE = -3000;
+
+/**
+ * This is the volume presented on the command interface. It is in the duty of the
+ * Controller to change the volumes given here into meaningful values on the
+ * routing interface.
+ * The range of this type is customer specific.
+ */
+typedef int16_t am_mainVolume_t;
+
+typedef uint16_t am_sourceClass_t;
+
+typedef uint16_t am_sinkClass_t;
+
+/**
+ * time in ms!
+ */
+typedef uint16_t am_time_t;
+
+/**
+ * offset time that is introduced in milli seconds.
+ */
+typedef int16_t am_timeSync_t;
+
+/**
+ * This type gives the information about reason for reason for Source/Sink change
+ */
+typedef uint16_t am_CustomAvailabilityReason_t;
+static const am_CustomAvailabilityReason_t AR_UNKNOWN = 0;
+/** new media was entered */
+static const am_CustomAvailabilityReason_t AR_GENIVI_NEWMEDIA = 1;
+/** same media was entered */
+static const am_CustomAvailabilityReason_t AR_GENIVI_SAMEMEDIA = 2;
+/** there is no media or media is removed */
+static const am_CustomAvailabilityReason_t AR_GENIVI_NOMEDIA = 3;
+/** there was a temperature event */
+static const am_CustomAvailabilityReason_t AR_GENIVI_TEMPERATURE = 4;
+/** there was a voltage event */
+static const am_CustomAvailabilityReason_t AR_GENIVI_VOLTAGE = 5;
+/** fatal errors on reading or accessing media */
+static const am_CustomAvailabilityReason_t AR_GENIVI_ERRORMEDIA = 6;
+
+/**
+ * This is a custom specific identifier of property. It can be used to
+ * differentiate between interrupt source/sink, main source/sink, etc.
+ */
+typedef uint16_t am_CustomClassProperty_t;
+static const am_CustomClassProperty_t CP_UNKNOWN = 0;
+static const am_CustomClassProperty_t CP_GENIVI_SOURCE_TYPE = 1;
+static const am_CustomClassProperty_t CP_GENIVI_SINK_TYPE = 2;
+
+/**
+ * This type classifies the format in which data is exchanged within a connection.
+ * The type itself is project specific although there are some standard formats
+ * defined.
+ */
+typedef uint16_t am_CustomConnectionFormat_t;
+static const am_CustomConnectionFormat_t CF_UNKNOWN = 0;
+static const am_CustomConnectionFormat_t CF_GENIVI_MONO = 1;
+static const am_CustomConnectionFormat_t CF_GENIVI_STEREO = 2;
+static const am_CustomConnectionFormat_t CF_GENIVI_ANALOG = 3;
+static const am_CustomConnectionFormat_t CF_GENIVI_AUTO = 4;
+
+/**
+ * Here are all SoundProperties that can be set via the CommandInterface.
+ * This type is product specific and can be changed or extended.
+ */
+typedef uint16_t am_CustomMainSoundPropertyType_t;
+static const am_CustomMainSoundPropertyType_t MSP_UNKNOWN = 0;
+static const am_CustomMainSoundPropertyType_t MSP_GENIVI_TREBLE = 1;
+static const am_CustomMainSoundPropertyType_t MSP_GENIVI_MID = 2;
+static const am_CustomMainSoundPropertyType_t MSP_GENIVI_BASS = 3;
+
+/**
+ * The notification types are project specific.
+ */
+typedef uint16_t am_CustomNotificationType_t;
+static const am_CustomNotificationType_t NT_UNKNOWN = 0;
+
+/**
+ * The given ramp types here are just examples. For products, different ramp types
+ * can be defined here. It is in the responsibility of the product to make sure
+ * that the routing plugins are aware of the ramp types used.
+ */
+typedef uint16_t am_CustomRampType_t;
+static const am_CustomRampType_t RAMP_UNKNOWN = 0;
+/** sets directly the value without a ramp */
+static const am_CustomRampType_t RAMP_GENIVI_DIRECT = 1;
+/** Sets the volume as fast as possible */
+static const am_CustomRampType_t RAMP_GENIVI_NO_PLOP = 2;
+/** inverted exponential update, high gradient at the start - soft end */
+static const am_CustomRampType_t RAMP_GENIVI_EXP_INV = 3;
+/** continues update of volume */
+static const am_CustomRampType_t RAMP_GENIVI_LINEAR = 4;
+/** exponential update, soft start - high gradient at the end */
+static const am_CustomRampType_t RAMP_GENIVI_EXP = 5;
+
+/**
+ * Within genivi only the some example properties are defined.
+ * For products these should be changed or extended.
+ */
+typedef uint16_t am_CustomSoundPropertyType_t;
+static const am_CustomSoundPropertyType_t SP_UNKNOWN = 0;
+static const am_CustomSoundPropertyType_t SP_GENIVI_TREBLE = 1;
+static const am_CustomSoundPropertyType_t SP_GENIVI_MID = 2;
+static const am_CustomSoundPropertyType_t SP_GENIVI_BASS = 3;
+
+/**
+ * Describes the different system properties which are project specific.
+ */
+typedef uint16_t am_CustomSystemPropertyType_t;
+static const am_CustomSystemPropertyType_t SYP_UNKNOWN = 0;
+
+/**
+ * describes the active sink of a crossfader.
+ */
+enum am_HotSink_e
+{
+ /**
+ * default
+ */
+ HS_UNKNOWN = 0,
+ /**
+ * sinkA is active
+ */
+ HS_SINKA = 1,
+ /**
+ * sinkB is active
+ */
+ HS_SINKB = 2,
+ /**
+ * the crossfader is in the transition state
+ */
+ HS_INTERMEDIATE = 3,
+ HS_MAX
+};
+
+/**
+ * with the help of this enum, sinks and sources can report their availability
+ * state
+ */
+enum am_Availability_e
+{
+ /**
+ * default
+ */
+ A_UNKNOWN = 0,
+ /**
+ * The source / sink is available
+ */
+ A_AVAILABLE = 1,
+ /**
+ * the source / sink is not available
+ */
+ A_UNAVAILABLE = 2,
+ A_MAX
+};
+
+/**
+ * represents the connection state
+ */
+enum am_ConnectionState_e
+{
+ CS_UNKNOWN = 0,
+ /**
+ * This means the connection is just building up
+ */
+ CS_CONNECTING = 1,
+ /**
+ * the connection is ready to be used
+ */
+ CS_CONNECTED = 2,
+ /**
+ * the connection is in the course to be knocked down
+ */
+ CS_DISCONNECTING = 3,
+ /**
+ * only relevant for connectionStatechanged. Is send after the connection was
+ * removed
+ */
+ CS_DISCONNECTED = 4,
+ /**
+ * this means the connection is still build up but unused at the moment
+ */
+ CS_SUSPENDED = 5,
+ CS_MAX
+};
+
+enum am_DomainState_e
+{
+ /**
+ * default
+ */
+ DS_UNKNOWN = 0,
+ /**
+ * the domain is controlled by the daemon
+ */
+ DS_CONTROLLED = 1,
+ /**
+ * the domain is independent starting up
+ */
+ DS_INDEPENDENT_STARTUP = 1,
+ /**
+ * the domain is independent running down
+ */
+ DS_INDEPENDENT_RUNDOWN = 2,
+ DS_MAX
+};
+
+/**
+ * This enum characterizes the data of the EarlyData_t
+ */
+enum am_EarlyDataType_e
+{
+ /**
+ * default
+ */
+ ES_UNKNOWN = 0,
+ /**
+ * the source volume
+ */
+ ED_SOURCE_VOLUME = 1,
+ /**
+ * the sink volume
+ */
+ ED_SINK_VOLUME = 2,
+ /**
+ * a source property
+ */
+ ED_SOURCE_PROPERTY = 3,
+ /**
+ * a sink property
+ */
+ ED_SINK_PROPERTY = 4,
+ /**
+ * The interrupt state
+ */
+ ED_INTERRUPT_STATE = 5,
+ ED_MAX
+};
+
+/**
+ * the errors of the audiomanager. All possible errors are in here. This enum is
+ * used widely as return parameter.
+ */
+enum am_Error_e
+{
+ /**
+ * no error - positive reply
+ */
+ E_OK = 0,
+ /**
+ * default
+ */
+ E_UNKNOWN = 1,
+ /**
+ * value out of range
+ */
+ E_OUT_OF_RANGE = 2,
+ /**
+ * not used
+ */
+ E_NOT_USED = 3,
+ /**
+ * a database error occurred
+ */
+ E_DATABASE_ERROR = 4,
+ /**
+ * the desired object already exists
+ */
+ E_ALREADY_EXISTS = 5,
+ /**
+ * there is no change
+ */
+ E_NO_CHANGE = 6,
+ /**
+ * the desired action is not possible
+ */
+ E_NOT_POSSIBLE = 7,
+ /**
+ * the desired object is non existent
+ */
+ E_NON_EXISTENT = 8,
+ /**
+ * the asynchronous action was aborted
+ */
+ E_ABORTED = 9,
+ /**
+ * This error is returned in case a connect is issued with a connectionFormat that
+ * cannot be selected for the connection. This could be either due to the
+ * capabilities of a source or a sink or gateway compatibilities for example
+ */
+ E_WRONG_FORMAT = 10,
+ E_MAX
+};
+
+enum am_MuteState_e
+{
+ /**
+ * default
+ */
+ MS_UNKNOWN = 0,
+ /**
+ * the source / sink is muted
+ */
+ MS_MUTED = 1,
+ /**
+ * the source / sink is unmuted
+ */
+ MS_UNMUTED = 2,
+ MS_MAX
+};
+
+/**
+ * The source state reflects the state of the source
+ */
+enum am_SourceState_e
+{
+ SS_UNKNNOWN = 0,
+ /**
+ * The source can be activly heared
+ */
+ SS_ON = 1,
+ /**
+ * The source cannot be heared
+ */
+ SS_OFF = 2,
+ /**
+ * The source is paused. Meaning it cannot be heared but should be prepared to
+ * play again soon.
+ */
+ SS_PAUSED = 3,
+ SS_MAX
+};
+
+/**
+ * This enumeration is used to define the type of the action that is correlated to
+ * a handle.
+ */
+enum am_Handle_e
+{
+ H_UNKNOWN = 0,
+ H_CONNECT = 1,
+ H_DISCONNECT = 2,
+ H_SETSOURCESTATE = 3,
+ H_SETSINKVOLUME = 4,
+ H_SETSOURCEVOLUME = 5,
+ H_SETSINKSOUNDPROPERTY = 6,
+ H_SETSOURCESOUNDPROPERTY = 7,
+ H_SETSINKSOUNDPROPERTIES = 8,
+ H_SETSOURCESOUNDPROPERTIES = 9,
+ H_CROSSFADE = 10,
+ H_SETVOLUMES = 11,
+ H_SETSINKNOTIFICATION = 12,
+ H_SETSOURCENOTIFICATION = 13,
+ H_MAX
+};
+
+enum am_InterruptState_e
+{
+ /**
+ * default
+ */
+ IS_UNKNOWN = 0,
+ /**
+ * the interrupt state is off - no interrupt
+ */
+ IS_OFF = 1,
+ /**
+ * the interrupt state is interrupted - the interrupt is active
+ */
+ IS_INTERRUPTED = 2,
+ IS_MAX
+};
+
+/**
+ * This datatype determines if a sourceID or a sinkID is used in the union
+ * following
+ */
+enum am_VolumeType_e
+{
+ VT_UNKNOWN = 0,
+ /**
+ * the following type is a sink
+ */
+ VT_SINK = 1,
+ /**
+ * the following type is a source
+ */
+ VT_SOURCE = 2,
+ VT_MAX
+};
+
+enum am_NotificationStatus_e
+{
+ NS_UNKNOWN = 0,
+ /**
+ * No notification, the function is turned off
+ */
+ NS_OFF = 1,
+ /**
+ * Periodic notifications are sent out. The period in ms is given by
+ * am_NotificationParameter
+ */
+ NS_PERIODIC = 2,
+ /**
+ * The notification is sent out when the minimum given by am_NotificationParameter
+ * is reached.
+ */
+ NS_MINIMUM = 3,
+ /**
+ * The notification is sent out when the maximum given by am_NotificationParameter
+ * is reached.
+ */
+ NS_MAXIMUM = 4,
+ /**
+ * The notification is sent out when a change happened. The Resolution of the
+ * change is defined by am_NotificationParameter.
+ */
+ NS_CHANGE = 5,
+ NS_MAX
+};
+
+/**
+ * this describes the availability of a sink or a source together with the latest
+ * change
+ */
+struct am_Availability_s
+{
+
+public:
+ /**
+ * the current availability state
+ */
+ am_Availability_e availability;
+ /**
+ * the reason for the last change. This can be used to trigger events that deal
+ * with state changes.
+ */
+ am_CustomAvailabilityReason_t availabilityReason;
+
+};
+
+/**
+ * describes class properties
+ */
+struct am_ClassProperty_s
+{
+
+public:
+ /**
+ * the property as enum
+ */
+ am_CustomClassProperty_t classProperty;
+ /**
+ * the value of the property
+ */
+ int16_t value;
+
+};
+
+/**
+ * This struct describes the attribiutes of a crossfader.
+ */
+struct am_Crossfader_s
+{
+
+public:
+ /**
+ * This is the ID of the crossfader, it is unique in the system. There are 2 ways,
+ * ID can be created: either it is assigned during the registration process (in a
+ * dynamic context, uniqueness will be ensured by the AudioManager daemon), or it
+ * is a fixed (the project has to ensure the uniqueness of the ID).
+ */
+ am_crossfaderID_t crossfaderID;
+ /**
+ * The name of the crossfader. Must be unique in the whole system.
+ */
+ std::string name;
+ /**
+ * The sinkID of the SinkA. Sinks shall be registered before registering the
+ * crossfader.
+ */
+ am_sinkID_t sinkID_A;
+ /**
+ * The sinkID of the SinkB. Sinks shall be registered before registering the
+ * crossfader.
+ */
+ am_sinkID_t sinkID_B;
+ /**
+ * The sourceID of the crossfader source. The source shall be registered before
+ * the crossfader.
+ */
+ am_sourceID_t sourceID;
+ /**
+ * This enum can have 3 states:
+ *
+ * HS_SINKA sinkA is the current hot one, sinkB is not audible
+ * HS_SINKB sinkB is the current hot one, sinkB is not audible
+ * HS_INTERMEDIATE the fader is stuck in between a cross-fading action. This
+ * could be due to an abort or an error. Before using the crossfader, it must be
+ * set to either HS_SINKA or HS_SINKB.
+ */
+ am_HotSink_e hotSink;
+
+};
+
+/**
+ * This struct describes the attributes of a converter.
+ */
+struct am_Converter_s
+{
+
+public:
+ /**
+ * This is the ID of the converter, it is unique in the system. There are 2 ways,
+ * ID can be created: either it is assigned during the registration process (in a
+ * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
+ * is a fixed (the project has to ensure the uniqueness of the ID).
+ */
+ am_converterID_t converterID;
+ /**
+ * The name of the converter. Must be unique in the whole system.
+ */
+ std::string name;
+ /**
+ * The sinkID of the convertersink-end. The sink is a full blown sink with
+ * connectionFormats, sinkClassIDs etc... It makes sense to register the sinks of
+ * a gateway as non-visible. Care needs to be taken that the connectionsFormats
+ * match with the ones in the conversionMatrix. If the sink is located in the
+ * controllingDomain, the ID needs to be retrieved by registering the sink before
+ * registering the gateway. In case the sink is in a different domain, the ID
+ * needs to be retrieved via peeking.
+ */
+ am_sinkID_t sinkID;
+ /**
+ * The sourceID of the converter sink-end. The sink is a full blown source with
+ * connectionFormats, sinkClassIDs etc... It makes sense to register the sources
+ * of a gateway as non-visible. Care needs to be taken that the connectionsFormats
+ * match with the ones in the conversionMatrix. If the source is located in the
+ * controllingDomain, the ID needs to be retrieved by registering the source
+ * before registering the gateway. In case the source is in a different domain,
+ * the ID needs to be retrieved via peeking.
+ */
+ am_sourceID_t sourceID;
+ /**
+ * This is the ID of the domain that registers the converter.
+ */
+ am_domainID_t domainID;
+ /**
+ * This is the list of available formats on the source side of the converter. It
+ * is not defined during the gateway registration but copied from the source
+ * registration.
+ */
+ std::vector<am_CustomConnectionFormat_t> listSourceFormats;
+ /**
+ * This is the list of available formats on the sink side of the gateway. It is
+ * not defined during the converter registration but copied from the sink
+ * registration.
+ */
+ std::vector<am_CustomConnectionFormat_t> listSinkFormats;
+ /**
+ * This is matrix holding information about the conversion capability of the
+ * converter, it's length is defined by the length(listSinkFormats) x
+ * length(listSourceFormats).
+ * If a SinkFormat can be converted into a SourceFormat, the vector will hold a 1,
+ * if no conversion is possible, a 0.
+ * The data is stored row orientated, where the rows are related to the
+ * sinksFormats and the columns to the sourceFormats. The first value will hold
+ * the conversion information from the first sourceFormat to the first sinkFormat
+ * for example and the seventh value the information about the 3rd sinkFormat to
+ * the 1st sourceFormat in case we would have 3 sourceFormats.
+ *
+ * This matrix
+ * 110 011 000 111 001
+ *
+ * reads as this:
+ * Source
+ * ** 1 2 3
+ * *********************
+ * S 1* 1 1 0
+ * i 2* 0 1 1
+ * n 3* 0 0 0
+ * k 4* 1 1 1
+ * 5* 0 0 1
+ */
+ std::vector<bool> convertionMatrix;
+
+};
+
+/**
+ * This struct describes the attributes of a gateway.
+ */
+struct am_Gateway_s
+{
+
+public:
+ /**
+ * This is the ID of the gateway, it is unique in the system. There are 2 ways, ID
+ * can be created: either it is assigned during the registration process (in a
+ * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
+ * is a fixed (the project has to ensure the uniqueness of the ID).
+ */
+ am_gatewayID_t gatewayID;
+ /**
+ * The name of the gateway. Must be unique in the whole system.
+ */
+ std::string name;
+ /**
+ * The sinkID of the gateway sink-end. The sink is a full blown sink with
+ * connectionFormats, sinkClassIDs etc... It makes sense to register the sinks of
+ * a gateway as non-visible. Care needs to be taken that the connectionsFormats
+ * match with the ones in the conversionMatrix. If the sink is located in the
+ * controllingDomain, the ID needs to be retrieved by registering the sink before
+ * registering the gateway. In case the sink is in a different domain, the ID
+ * needs to be retrieved via peeking.
+ */
+ am_sinkID_t sinkID;
+ /**
+ * The sourceID of the gateway sink-end. The sink is a full blown source with
+ * connectionFormats, sinkClassIDs etc... It makes sense to register the sources
+ * of a gateway as non-visible. Care needs to be taken that the connectionsFormats
+ * match with the ones in the conversionMatrix. If the source is located in the
+ * controllingDomain, the ID needs to be retrieved by registering the source
+ * before registering the gateway. In case the source is in a different domain,
+ * the ID needs to be retrieved via peeking.
+ */
+ am_sourceID_t sourceID;
+ /**
+ * The ID of the sink. If the domain is the same like the controlling domain, the
+ * ID is known due to registration. If the domain is different, the ID needs to be
+ * retrieved via peeking.
+ */
+ am_domainID_t domainSinkID;
+ /**
+ * The ID of the source. If the domain is the same like the controlling domain,
+ * the ID is known due to registration. If the domain is different, the ID needs
+ * to be retrieved via peeking.
+ */
+ am_domainID_t domainSourceID;
+ /**
+ * This is the ID of the domain that registers the gateway.
+ */
+ am_domainID_t controlDomainID;
+ /**
+ * This is the list of available formats on the source side of the gateway. It is
+ * not defined during the gateway registration but copied from the source
+ * registration.
+ */
+ std::vector<am_CustomConnectionFormat_t> listSourceFormats;
+ /**
+ * This is the list of available formats on the sink side of the gateway. It is
+ * not defined during the gateway registration but copied from the sink
+ * registration.
+ */
+ std::vector<am_CustomConnectionFormat_t> listSinkFormats;
+ /**
+ * This is matrix holding information about the conversion capability of the
+ * gateway, it's length is defined by the length(listSinkFormats) x
+ * length(listSourceFormats).
+ * If a SinkFormat can be converted into a SourceFormat, the vector will hold a 1,
+ * if no conversion is possible, a 0.
+ * The data is stored row orientated, where the rows are related to the
+ * sinksFormats and the columns to the sourceFormats. The first value will hold
+ * the conversion information from the first sourceFormat to the first sinkFormat
+ * for example and the seventh value the information about the 3rd sinkFormat to
+ * the 1st sourceFormat in case we would have 3 sourceFormats.
+ *
+ * This matrix
+ * 110 011 000 111 001
+ *
+ * reads as this:
+ * Source
+ * ** 1 2 3
+ * *********************
+ * S 1* 1 1 0
+ * i 2* 0 1 1
+ * n 3* 0 0 0
+ * k 4* 1 1 1
+ * 5* 0 0 1
+ */
+ std::vector<bool> convertionMatrix;
+
+};
+
+/**
+ * This represents one "hopp" in a route
+ */
+struct am_RoutingElement_s
+{
+
+public:
+ /**
+ * the source ID
+ */
+ am_sourceID_t sourceID;
+ /**
+ * the sinkID
+ */
+ am_sinkID_t sinkID;
+ /**
+ * the domainID the routeElement is in
+ */
+ am_domainID_t domainID;
+ /**
+ * the connectionformat that is used for the route
+ */
+ am_CustomConnectionFormat_t connectionFormat;
+
+};
+
+/**
+ * a list of routing elements that lead from source to sink
+ */
+struct am_Route_s
+{
+
+public:
+ /**
+ * the sourceID where the route starts
+ */
+ am_sourceID_t sourceID;
+ /**
+ * the sinkID where the route ends
+ */
+ am_sinkID_t sinkID;
+ /**
+ * the actual route as list of routing elements
+ */
+ std::vector<am_RoutingElement_s> route;
+
+};
+
+/**
+ * struct describing the sound property
+ */
+struct am_SoundProperty_s
+{
+
+public:
+ /**
+ * the type of the property - a project specific enum
+ */
+ am_CustomSoundPropertyType_t type;
+ /**
+ * the actual value of the property
+ */
+ int16_t value;
+
+};
+
+/**
+ * struct describing system properties
+ */
+struct am_SystemProperty_s
+{
+
+public:
+ /**
+ * the type that is set
+ */
+ am_CustomSystemPropertyType_t type;
+ /**
+ * the value
+ */
+ int16_t value;
+
+};
+
+/**
+ * struct describing sinkclasses
+ */
+struct am_SinkClass_s
+{
+
+public:
+ /**
+ * the ID of the sinkClass
+ */
+ am_sinkClass_t sinkClassID;
+ /**
+ * the name of the sinkClass - must be unique in the system
+ */
+ std::string name;
+ /**
+ * the list of the class properties. These are pairs of a project specific enum
+ * describing the type of the value and an integer holding the real value.
+ */
+ std::vector<am_ClassProperty_s> listClassProperties;
+
+};
+
+/**
+ * struct describing source classes
+ */
+struct am_SourceClass_s
+{
+
+public:
+ /**
+ * the source ID
+ */
+ am_sourceClass_t sourceClassID;
+ /**
+ * the name of the sourceClass - must be unique in the system
+ */
+ std::string name;
+ /**
+ * the list of the class properties. These are pairs of a project specific enum
+ * describing the type of the value and an integer holding the real value.
+ */
+ std::vector<am_ClassProperty_s> listClassProperties;
+
+};
+
+/**
+ * this type holds all information of sources relevant to the HMI
+ */
+struct am_SourceType_s
+{
+
+public:
+ /**
+ * This is the ID of the source, it is unique in the system. There are 2 ways, ID
+ * can be created: either it is assigned during the registration process (in a
+ * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
+ * is a fixed (the project has to ensure the uniqueness of the ID).
+ */
+ am_sourceID_t sourceID;
+ /**
+ * The name of the source. Must be unique in the whole system.
+ */
+ std::string name;
+ /**
+ * the availability of the source
+ */
+ am_Availability_s availability;
+ /**
+ * the sourceClassID, indicates the class the source is in. This information can
+ * be used by the Controller to implement different behaviour for different
+ * classes.
+ */
+ am_sourceClass_t sourceClassID;
+
+};
+
+/**
+ * this type holds all information of sinks relevant to the HMI
+ */
+struct am_SinkType_s
+{
+
+public:
+ /**
+ * This is the ID of the sink, it is unique in the system. There are 2 ways, ID
+ * can be created: either it is assigned during the registration process (in a
+ * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
+ * is a fixed (the project has to ensure the uniqueness of the ID).
+ */
+ am_sinkID_t sinkID;
+ /**
+ * The name of the sink. Must be unique in the whole system.
+ */
+ std::string name;
+ /**
+ * This attribute reflects the availability of the sink. There are several reasons
+ * why a sink could be not available for the moment: for example the shutdown of a
+ * sink because of overtemperature or over- & undervoltage. The availability
+ * consists of two pieces of information:
+ *
+ * Availablility: the status itself, can be A_AVAILABLE, A_UNAVAILABLE or
+ * A_UNKNOWN
+ * AvailabilityReason: this informs about the last reason for a change in
+ * availability. The reasons itself are product specific.
+ */
+ am_Availability_s availability;
+ /**
+ * This is the representation of the Volume for the commandInterface. It is used
+ * by the HMI to set the volume of a sink, the AudioManagerController has to
+ * transform this into real source and sink volumes.
+ */
+ am_mainVolume_t volume;
+ am_MuteState_e muteState;
+ /**
+ * The sinkClassID references to a sinkClass. With the help of classification,
+ * rules can be setup to define the system behaviour.
+ */
+ am_sinkClass_t sinkClassID;
+
+};
+
+/**
+ * a handle is used for asynchronous operations and is uniquely assigned for each
+ * of this operations
+ */
+struct am_Handle_s
+{
+
+public:
+ /**
+ * the handletype
+ */
+ am_Handle_e handleType:6;
+ /**
+ * the handle as value
+ */
+ uint16_t handle:10;
+
+};
+
+/**
+ * struct describung mainsound property
+ */
+struct am_MainSoundProperty_s
+{
+
+public:
+ /**
+ * the type of the property
+ */
+ am_CustomMainSoundPropertyType_t type;
+ /**
+ * the actual value
+ */
+ int16_t value;
+
+};
+
+/**
+ * this type holds all information of connections relevant to the HMI
+ */
+struct am_MainConnectionType_s
+{
+
+public:
+ /**
+ * the ID of the mainconnection
+ */
+ am_mainConnectionID_t mainConnectionID;
+ /**
+ * the sourceID where the connection starts
+ */
+ am_sourceID_t sourceID;
+ /**
+ * the sinkID where the connection ends
+ */
+ am_sinkID_t sinkID;
+ /**
+ * the delay of the mainconnection
+ */
+ am_timeSync_t delay;
+ /**
+ * the current connection state
+ */
+ am_ConnectionState_e connectionState;
+
+};
+
+/**
+ * struct that holds attribiutes of a mainconnection
+ */
+struct am_MainConnection_s
+{
+
+public:
+ /**
+ * the assigned ID
+ */
+ am_mainConnectionID_t mainConnectionID;
+ /**
+ * the current connection state
+ */
+ am_ConnectionState_e connectionState;
+ /**
+ * the sinkID
+ */
+ am_sinkID_t sinkID;
+ /**
+ * the sourceID
+ */
+ am_sourceID_t sourceID;
+ /**
+ * the delay of the connection
+ */
+ am_timeSync_t delay;
+ /**
+ * the list of sub connection IDs the mainconnection consists of
+ */
+ std::vector<am_connectionID_t> listConnectionID;
+
+};
+
+/**
+ * This struct holds the payload of a notification.
+ */
+struct am_NotificationPayload_s
+{
+
+public:
+ /**
+ * This defines the notification type
+ */
+ am_CustomNotificationType_t type;
+ /**
+ * This is finally the value of the notification. It's meaning depends on the
+ * notificationType
+ */
+ int16_t value;
+
+};
+
+/**
+ * This struct holds information about the configuration for notifications
+ */
+struct am_NotificationConfiguration_s
+{
+
+public:
+ /**
+ * The notification type of the notification
+ */
+ am_CustomNotificationType_t type;
+ /**
+ * The Notification status. This can be periodic, min/max value based or even off
+ * for example
+ */
+ am_NotificationStatus_e status;
+ /**
+ * This gives additional information to the notification status.
+ * Relation between notification status and the value:
+ * NS_PERIODIC - the period in ms
+ * NS_MINIMUM - the minimum value that triggers the notification
+ * NS_MAXIMUM - the maximum value that triggers the notifcation
+ * NS_CHANGE - the resolution of the change value
+ */
+ int16_t parameter;
+
+};
+
+/**
+ * This struct describes the attribiutes of a sink
+ */
+struct am_Sink_s
+{
+
+public:
+ /**
+ * This is the ID of the sink, it is unique in the system. There are 2 ways, ID
+ * can be created: either it is assigned during the registration process (in a
+ * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
+ * is a fixed (the project has to ensure the uniqueness of the ID).
+ */
+ am_sinkID_t sinkID;
+ /**
+ * The name of the sink. Must be unique in the whole system.
+ */
+ std::string name;
+ /**
+ * The domainID is the domain the sink belongs to. A sink can only be in one
+ * domain.
+ */
+ am_domainID_t domainID;
+ /**
+ * The sinkClassID references to a sinkClass. With the help of classification,
+ * rules can be setup to define the system behaviour.
+ */
+ am_sinkClass_t sinkClassID;
+ /**
+ * This is the volume of the sink. It is set by the AudioManagerController.
+ */
+ am_volume_t volume;
+ /**
+ * This Boolean flag indicates whether a sink is visible to the commandInterface
+ * or not. If the User must have the possibility to choose the source in the HMI,
+ * it must be visible. But there are also good reasons for invisible sinks, for
+ * example if the sink is part of a crossfader or gateway. HMI relevant changes in
+ * visible sinks will be automatically reported by the daemon to the
+ * commandInterface.
+ */
+ bool visible;
+ /**
+ * This attribute reflects the availability of the sink. There are several reasons
+ * why a sink could be not available for the moment: for example the shutdown of a
+ * sink because of overtemperature or over- & undervoltage. The availability
+ * consists of two pieces of information:
+ *
+ * Availablility: the status itself, can be A_AVAILABLE, A_UNAVAILABLE or
+ * A_UNKNOWN
+ * AvailabilityReason: this informs about the last reason for a change in
+ * availability. The reasons itself are product specific.
+ */
+ am_Availability_s available;
+ /**
+ * This attribute reflects the muteState of the sink. The information is not the
+ * "real" state of the sink, but the HMI representation for he commandInterface
+ * controlled by the AudioManagerController.
+ */
+ am_MuteState_e muteState;
+ /**
+ * This is the representation of the Volume for the commandInterface. It is used
+ * by the HMI to set the volume of a sink, the AudioManagerController has to
+ * transform this into real source and sink volumes.
+ */
+ am_mainVolume_t mainVolume;
+ /**
+ * This is the list of soundProperties, that the sink is capable of. The
+ * soundProperties itself are project specific. For sinks, a possible
+ * soundProperty could be for example settings.
+ */
+ std::vector<am_SoundProperty_s> listSoundProperties;
+ /**
+ * This list holds information about the formats that the Source is capable of
+ * supporting when delivering audio.
+ */
+ std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
+ /**
+ * This is the list of the available mainSoundProperties. The principle is the
+ * same than with soundProperties, but they are only visible to the
+ * CommandInterface.
+ */
+ std::vector<am_MainSoundProperty_s> listMainSoundProperties;
+ /**
+ * This is the list of the MainNotificationConfigurations. These notifications
+ * work on the level of command interface.
+ */
+ std::vector<am_NotificationConfiguration_s> listMainNotificationConfigurations;
+ /**
+ * This is the list of the NotificationConfigurations. These notifications work on
+ * the level of RoutingPlugins.
+ */
+ std::vector<am_NotificationConfiguration_s> listNotificationConfigurations;
+
+};
+
+/**
+ * This struct describes the attribiutes of a source
+ */
+struct am_Source_s
+{
+
+public:
+ /**
+ * This is the ID of the source, it is unique in the system. There are 2 ways, ID
+ * can be created: either it is assigned during the registration process (in a
+ * dynamic context, uniqueness will be ensured by the AudioManagerDaemon), or it
+ * is a fixed (the project has to ensure the uniqueness of the ID).
+ */
+ am_sourceID_t sourceID;
+ /**
+ * The domainID is the domain the source belongs to. A source can only be in one
+ * domain.
+ */
+ am_domainID_t domainID;
+ /**
+ * The name of the source. Must be unique in the whole system.
+ */
+ std::string name;
+ /**
+ * the sourceClassID, indicates the class the source is in. This information can
+ * be used by the Controller to implement different behaviour for different
+ * classes.
+ */
+ am_sourceClass_t sourceClassID;
+ /**
+ * The source state is an indication towards the source if it is actively heard or
+ * not. The source can use this information to implement features like automatic
+ * spin down of CD's in case the CD is not the active source or AF following of a
+ * tuner that is not actively heard. The source state is set by the
+ * AudioManagerController.There are 3 possible states:
+ *
+ * SS_ON: the source is active
+ * SS_OFF: the source is off
+ * SS_PAUSED: the source is paused and not active.
+ */
+ am_SourceState_e sourceState;
+ /**
+ * This is the volume of the source. It is set by the AudioManagerController. It
+ * is used to adopt different audiolevels in a system and mixing of sources (e.g.
+ * navigation hints & music).
+ */
+ am_volume_t volume;
+ /**
+ * This Boolean flag indicates whether a source is visible to the commandInterface
+ * or not. If the User must have the possibility to choose the source in the HMI,
+ * it must be visible. But there are also good reasons for invisible sources, for
+ * example if the source is part of a crossfader or gateway. HMI relevant changes
+ * in visible sources will be automatically reported by the daemon to the
+ * commandInterface.
+ */
+ bool visible;
+ /**
+ * This attribute reflects the availability of the source. There are several
+ * reasons why a source could be not available for the moment. For example a CD
+ * player which has no CD entered in the slot can be unavailable, or a USB player
+ * with no or unreadable stick attached. Other scenarios involve the shutdown of a
+ * source because of overtemperature or over- & undervoltage. The availability
+ * consists of two informations:
+ *
+ * Availablility: the status itself, can be A_AVAILABLE, A_UNAVAILABLE or
+ * A_UNKNOWN
+ * AvailabilityReason: this informs about the last reason for a change in
+ * availability. The reasons itself are product specific.
+ */
+ am_Availability_s available;
+ /**
+ * Some special sources can have special behaviors, the are so called "Low Level
+ * Interrupts". Here the current status is documented. The information can be used
+ * by the AudioManagerController to react to the changes by for example lowering
+ * the volume of the mainSources. The two states are
+ *
+ * IS_OFF: the interrupt is not active at the moment
+ * IS_INTERRUPTED: the interrupt is playing at the moment.
+ */
+ am_InterruptState_e interruptState;
+ /**
+ * This is the list of soundProperties, that the source is capable of. The
+ * soundProperties itself are project specific. For sources, a possible
+ * soundProperty could be navigation volume offset, for example.
+ */
+ std::vector<am_SoundProperty_s> listSoundProperties;
+ /**
+ * This list holds information about the formats that the Source is capable of
+ * supporting when delivering audio.
+ */
+ std::vector<am_CustomConnectionFormat_t> listConnectionFormats;
+ /**
+ * This is the list of the available mainSoundProperties. The principle is the
+ * same than with soundProperties, but they are only visible to the
+ * CommandInterface.
+ */
+ std::vector<am_MainSoundProperty_s> listMainSoundProperties;
+ /**
+ * The list of MainNotificationConfigurations. These notifications work on the
+ * level of CommandInterface.
+ */
+ std::vector<am_NotificationConfiguration_s> listMainNotificationConfigurations;
+ /**
+ * The list of MainNotificationConfigurations. These notifications work on the
+ * level of RoutingInterface.
+ */
+ std::vector<am_NotificationConfiguration_s> listNotificationConfigurations;
+
+};
+
+/**
+ * This struct describes the attribiutes of a domain
+ */
+struct am_Domain_s
+{
+
+public:
+ /**
+ * the domain ID
+ */
+ am_domainID_t domainID;
+ /**
+ * the name of the domain
+ */
+ std::string name;
+ /**
+ * the busname. This is equal to a plugin name and is used to dispatch messages to
+ * the elements of a plugin
+ */
+ std::string busname;
+ /**
+ * the name of the node
+ */
+ std::string nodename;
+ /**
+ * indicated if the domain is independent at startup or not
+ */
+ bool early;
+ /**
+ * indicates if the domain registration is complete or not
+ */
+ bool complete;
+ /**
+ * the current domain state
+ */
+ am_DomainState_e state;
+
+};
+
+/**
+ * a connection
+ */
+struct am_Connection_s
+{
+
+public:
+ /**
+ * the assigned ID
+ */
+ am_connectionID_t connectionID;
+ /**
+ * the source the audio flows from
+ */
+ am_sourceID_t sourceID;
+ /**
+ * the sink the audio flows to
+ */
+ am_sinkID_t sinkID;
+ /**
+ * the delay of the conneciton
+ */
+ am_timeSync_t delay;
+ /**
+ * the used connectionformat
+ */
+ am_CustomConnectionFormat_t connectionFormat;
+
+};
+
+/**
+ * data type depends of am_EarlyDataType_e:
+ * volume_t in case of ED_SOURCE_VOLUME, ED_SINK_VOLUME
+ * soundProperty_t in case of ED_SOURCE_PROPERTY, ED_SINK_PROPERTY
+ */
+union am_EarlyData_u
+{
+
+public:
+ am_volume_t volume;
+ am_SoundProperty_s soundProperty;
+ am_InterruptState_e interruptState;
+
+};
+
+/**
+ * data type depends of am_EarlyDataType_e:
+ * sourceID in case of ED_SOURCE_VOLUME, ED_SOURCE_PROPERTY
+ * sinkID in case of ED_SINK_VOLUME, ED_SINK_PROPERTY
+ */
+union am_DataType_u
+{
+
+public:
+ am_sinkID_t sink;
+ am_sourceID_t source;
+
+};
+
+struct am_EarlyData_s
+{
+
+public:
+ am_EarlyDataType_e type;
+ am_DataType_u sinksource;
+ am_EarlyData_u data;
+
+};
+
+/**
+ * This types describe a mixed description for source and sinks volumes.
+ */
+struct am_Volumes_s
+{
+
+public:
+ /**
+ * describes the type of the volume: source or sink.
+ */
+ am_VolumeType_e volumeType;
+ /**
+ * either sourceID or sinkID
+ */
+ am_DataType_u volumeID;
+ /**
+ * The volume
+ */
+ am_volume_t volume;
+ /**
+ * the ramp that shall be driven
+ */
+ am_CustomRampType_t ramp;
+ /**
+ * the time for the ramp
+ */
+ am_time_t time;
+
+};
+}
+#endif // !defined(EA_71AFF0F7_316D_4cb5_9225_9B8C7D938A15__INCLUDED_)
diff --git a/include/command/IAmCommandReceive.h b/include/command/IAmCommandReceive.h
index 4adb073..83ab577 100755
--- a/include/command/IAmCommandReceive.h
+++ b/include/command/IAmCommandReceive.h
@@ -1,220 +1,220 @@
-/**
- * Copyright (C) 2012 - 2014, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
- *
- * \file
- * For further information see http://projects.genivi.org/audio-manager
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
- * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
- */
-#if !defined(EA_833F8CB5_893B_4670_B004_4A31D1707950__INCLUDED_)
-#define EA_833F8CB5_893B_4670_B004_4A31D1707950__INCLUDED_
-
-#include <vector>
-#include <string>
-#include "audiomanagertypes.h"
-namespace am {
-class CAmDbusWrapper;
-class CAmSocketHandler;
-}
-
-
-#include "audiomanagertypes.h"
-
-#define CommandReceiveVersion "3.0"
-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.
- * There are two rules that have to be kept in mind when implementing against this
- * interface:\n
- * \warning
- * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
- * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
- * CALL THAT EXPECTS A RETURN VALUE.\n
- * \details
- * Violation these rules may lead to unexpected behavior! Nevertheless you can
- * implement thread safe by using the deferred-call pattern described on the wiki
- * which also helps to implement calls that are forbidden.\n
- * For more information, please check CAmSerializer
- */
-class IAmCommandReceive
-{
-
-public:
- IAmCommandReceive() {
-
- }
-
- virtual ~IAmCommandReceive() {
-
- }
-
- /**
- * This function returns the version of the interface.
- */
- virtual void getInterfaceVersion(std::string& version) const =0;
- /**
- * connects a source to sink
- * @return E_OK on success, E_NOT_POSSIBLE on failure, E_ALREADY_EXISTS if the
- * connection does already exists
- */
- virtual am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) =0;
- /**
- * disconnects a mainConnection
- * @return E_OK on successes, E_NON_EXISTENT if the connection does not exist,
- * E_NOT_POSSIBLE on error.
- */
- virtual am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID) =0;
- /**
- * sets the volume for a sink
- * @return E_OK on success, E_UNKOWN on error, E_OUT_OF_RANGE in case the value is
- * out of range
- */
- virtual am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume) =0;
- /**
- * This function is used to increment or decrement the current volume for a sink.
- * @return E_OK on success, E_UNKNOWN on error and E_OUT_OF_RANGE if the value is
- * not in the given volume range.
- */
- virtual am_Error_e volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep) =0;
- /**
- * sets the mute state of a sink
- * @return E_OK on success, E_UNKNOWN on error. If the mute state is already the
- * desired one, the Daemon will return E_OK.
- */
- virtual am_Error_e setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
- /**
- * This method is used to set sound properties, e.g. Equalizer Values. Since the
- * capabilities of the system can differ, the exact key value pairs can be
- * extended in each product
- * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in
- * case of an error
- */
- virtual am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) =0;
- /**
- * This method is used to set sound properties, e.g. Equalizer Values. Since the
- * capabilities of the system can differ, the exact key value pairs can be
- * extended in each product
- * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in
- * case of an error
- */
- virtual am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) =0;
- /**
- * is used to set a specific system property.
- * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in
- * case of an error
- */
- virtual am_Error_e setSystemProperty(const am_SystemProperty_s& property) =0;
- /**
- * returns the actual list of MainConnections
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const =0;
- /**
- * returns the actual list of Sinks
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const =0;
- /**
- * returns the actual list of Sources
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const =0;
- /**
- * This is used to retrieve all source sound properties related to a source.
- * Returns a vector of the sound properties and values as pair
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const =0;
- /**
- * This is used to retrieve all source sound properties related to a source.
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const =0;
- /**
- * This is used to retrieve SourceClass Information of all source classes
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const =0;
- /**
- * This is used to retrieve SinkClass Information of all sink classes
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const =0;
- /**
- * Retrieves a complete list of all systemProperties.
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const =0;
- /**
- * returns the delay in ms that the audiopath for the given mainConnection has
- * @return E_OK on success, E_NOT_POSSIBLE if timing information is not yet
- * retrieved, E_DATABASE_ERROR on read error on the database
- */
- virtual am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const =0;
- /**
- * this function is used to retrieve a pointer to the dBusConnectionWrapper
- * @return E_OK if pointer is valid, E_UKNOWN if AudioManager was compiled without
- * DBus Support
- */
- virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
- /**
- * This function returns the pointer to the socketHandler. This can be used to
- * integrate socket-based activites like communication with the mainloop of the
- * AudioManager.
- * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled
- * without socketHandler support,
- */
- virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
- /**
- * asynchronous confirmation of setCommandReady.
- */
- virtual void confirmCommandReady(const uint16_t handle, const am_Error_e error) =0;
- /**
- * asynchronous confirmation of setCommandRundown
- */
- virtual void confirmCommandRundown(const uint16_t handle, const am_Error_e error) =0;
- /**
- * Retrieves the list of MainNotifications for a sink. Does not return the
- * possible ones.
- */
- virtual am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const =0;
- /**
- * Retrieves the list of MainNotifications for a source. Does not return the
- * possible ones.
- */
- virtual am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const =0;
- /**
- * sets a MainNotificationConfiuration. This can be used to turn on an off
- * notifications an to change the mode of the configuration.
- * @return E_OK on success, E_NON_EXISTENT if sinkID does not exists,
- * E_DATABASE_ERROR on error
- */
- virtual am_Error_e setMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
- /**
- * sets a MainNotificationConfiuration. This can be used to turn on an off
- * notifications an to change the mode of the configuration.
- * @return E_OK on success, E_NON_EXISTENT if sourceID does not exists,
- * E_DATABASE_ERROR on error
- */
- virtual am_Error_e setMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
-
-};
-}
-#endif // !defined(EA_833F8CB5_893B_4670_B004_4A31D1707950__INCLUDED_)
+/**
+ * Copyright (C) 2012 - 2014, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
+ *
+ * \file
+ * For further information see http://projects.genivi.org/audio-manager
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
+ * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
+ */
+#if !defined(EA_F12AFDAB_E710_43e4_8DC1_1035427769BE__INCLUDED_)
+#define EA_F12AFDAB_E710_43e4_8DC1_1035427769BE__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+namespace am {
+class CAmDbusWrapper;
+class CAmSocketHandler;
+}
+
+
+#include "audiomanagertypes.h"
+
+#define CommandReceiveVersion "3.0"
+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.
+ * There are two rules that have to be kept in mind when implementing against this
+ * interface:\n
+ * \warning
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
+ * CALL THAT EXPECTS A RETURN VALUE.\n
+ * \details
+ * Violation these rules may lead to unexpected behavior! Nevertheless you can
+ * implement thread safe by using the deferred-call pattern described on the wiki
+ * which also helps to implement calls that are forbidden.\n
+ * For more information, please check CAmSerializer
+ */
+class IAmCommandReceive
+{
+
+public:
+ IAmCommandReceive() {
+
+ }
+
+ virtual ~IAmCommandReceive() {
+
+ }
+
+ /**
+ * This function returns the version of the interface.
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * connects a source to sink
+ * @return E_OK on success, E_NOT_POSSIBLE on failure, E_ALREADY_EXISTS if the
+ * connection does already exists
+ */
+ virtual am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) =0;
+ /**
+ * disconnects a mainConnection
+ * @return E_OK on successes, E_NON_EXISTENT if the connection does not exist,
+ * E_NOT_POSSIBLE on error.
+ */
+ virtual am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID) =0;
+ /**
+ * sets the volume for a sink
+ * @return E_OK on success, E_UNKOWN on error, E_OUT_OF_RANGE in case the value is
+ * out of range
+ */
+ virtual am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume) =0;
+ /**
+ * This function is used to increment or decrement the current volume for a sink.
+ * @return E_OK on success, E_UNKNOWN on error and E_OUT_OF_RANGE if the value is
+ * not in the given volume range.
+ */
+ virtual am_Error_e volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep) =0;
+ /**
+ * sets the mute state of a sink
+ * @return E_OK on success, E_UNKNOWN on error. If the mute state is already the
+ * desired one, the Daemon will return E_OK.
+ */
+ virtual am_Error_e setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
+ /**
+ * This method is used to set sound properties, e.g. Equalizer Values. Since the
+ * capabilities of the system can differ, the exact key value pairs can be
+ * extended in each product
+ * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in
+ * case of an error
+ */
+ virtual am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) =0;
+ /**
+ * This method is used to set sound properties, e.g. Equalizer Values. Since the
+ * capabilities of the system can differ, the exact key value pairs can be
+ * extended in each product
+ * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in
+ * case of an error
+ */
+ virtual am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) =0;
+ /**
+ * is used to set a specific system property.
+ * @return E_OK on success, E_OUT_OF_RANGE if value exceeds range, E_UNKNOWN in
+ * case of an error
+ */
+ virtual am_Error_e setSystemProperty(const am_SystemProperty_s& property) =0;
+ /**
+ * returns the actual list of MainConnections
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const =0;
+ /**
+ * returns the actual list of Sinks
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const =0;
+ /**
+ * returns the actual list of Sources
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const =0;
+ /**
+ * This is used to retrieve all source sound properties related to a source.
+ * Returns a vector of the sound properties and values as pair
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const =0;
+ /**
+ * This is used to retrieve all source sound properties related to a source.
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const =0;
+ /**
+ * This is used to retrieve SourceClass Information of all source classes
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const =0;
+ /**
+ * This is used to retrieve SinkClass Information of all sink classes
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const =0;
+ /**
+ * Retrieves a complete list of all systemProperties.
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const =0;
+ /**
+ * returns the delay in ms that the audiopath for the given mainConnection has
+ * @return E_OK on success, E_NOT_POSSIBLE if timing information is not yet
+ * retrieved, E_DATABASE_ERROR on read error on the database
+ */
+ virtual am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const =0;
+ /**
+ * this function is used to retrieve a pointer to the dBusConnectionWrapper
+ * @return E_OK if pointer is valid, E_UKNOWN if AudioManager was compiled without
+ * DBus Support
+ */
+ virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
+ /**
+ * This function returns the pointer to the socketHandler. This can be used to
+ * integrate socket-based activites like communication with the mainloop of the
+ * AudioManager.
+ * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled
+ * without socketHandler support,
+ */
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
+ /**
+ * asynchronous confirmation of setCommandReady.
+ */
+ virtual void confirmCommandReady(const uint16_t handle, const am_Error_e error) =0;
+ /**
+ * asynchronous confirmation of setCommandRundown
+ */
+ virtual void confirmCommandRundown(const uint16_t handle, const am_Error_e error) =0;
+ /**
+ * Retrieves the list of MainNotifications for a sink. Does not return the
+ * possible ones.
+ */
+ virtual am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const =0;
+ /**
+ * Retrieves the list of MainNotifications for a source. Does not return the
+ * possible ones.
+ */
+ virtual am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const =0;
+ /**
+ * sets a MainNotificationConfiuration. This can be used to turn on an off
+ * notifications an to change the mode of the configuration.
+ * @return E_OK on success, E_NON_EXISTENT if sinkID does not exists,
+ * E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e setMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
+ /**
+ * sets a MainNotificationConfiuration. This can be used to turn on an off
+ * notifications an to change the mode of the configuration.
+ * @return E_OK on success, E_NON_EXISTENT if sourceID does not exists,
+ * E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e setMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
+
+};
+}
+#endif // !defined(EA_F12AFDAB_E710_43e4_8DC1_1035427769BE__INCLUDED_)
diff --git a/include/command/IAmCommandSend.h b/include/command/IAmCommandSend.h
index a69b0df..1751290 100755
--- a/include/command/IAmCommandSend.h
+++ b/include/command/IAmCommandSend.h
@@ -1,194 +1,195 @@
-/**
- * Copyright (C) 2012 - 2014, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
- *
- * \file
- * For further information see http://projects.genivi.org/audio-manager
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
- * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
- */
-#if !defined(EA_B654431C_A920_4376_9B2F_3FF803354EAD__INCLUDED_)
-#define EA_B654431C_A920_4376_9B2F_3FF803354EAD__INCLUDED_
-
-#include <vector>
-#include <string>
-#include "audiomanagertypes.h"
-namespace am {
-class IAmCommandReceive;
-}
-
-#include "IAmCommandReceive.h"
-#include "audiomanagertypes.h"
-
-#define CommandSendVersion "3.0"
-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.
- * There are two rules that have to be kept in mind when implementing against this
- * interface:\n
- * \warning
- * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
- * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
- * CALL THAT EXPECTS A RETURN VALUE.\n
- * \details
- * Violation these rules may lead to unexpected behavior! Nevertheless you can
- * implement thread safe by using the deferred-call pattern described on the wiki
- * which also helps to implement calls that are forbidden.\n
- * For more information, please check CAmSerializer
- */
-class IAmCommandSend
-{
-
-public:
- IAmCommandSend() {
-
- }
-
- virtual ~IAmCommandSend() {
-
- }
-
- /**
- * returns the interface version as string.
- */
- virtual void getInterfaceVersion(std::string& version) const =0;
- /**
- * This command starts the interface, the plugin itself. This is not meant to
- * start communication with the HMI itself. It is a good idea to implement here
- * everything that sets up the basic communication like DbusCommunication etc...
- * Be aware of side effects with systemd and socketbased communication!
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e startupInterface(IAmCommandReceive* commandreceiveinterface) =0;
- /**
- * This function will indirectly be called by the Controller and is used to start
- * the Communication. Before this command, all communication will be ignored by
- * the AudioManager.
- * After the Plugin is ready, it will asynchronously answer with
- * condfirmCommandReady, the handle that is handed over must be returned.
- */
- virtual void setCommandReady(const uint16_t handle) =0;
- /**
- * This function will indirectly be called by the Controller and is used to stop
- * the Communication. After this command, all communication will be ignored by the
- * AudioManager. The plugin has to be prepared that either the power will be
- * switched off or the Interface is started again with setCommandReady
- * After the Plugin is ready to rundown, it will asynchronously answer with
- * condfirmCommandRundown, the handle that is handed over must be returned.
- */
- virtual void setCommandRundown(const uint16_t handle) =0;
- /**
- * Callback that is called when the number of connections change
- */
- virtual void cbNewMainConnection(const am_MainConnectionType_s& mainConnection) =0;
- /**
- * Callback that is called when the number of connections change
- */
- virtual void cbRemovedMainConnection(const am_mainConnectionID_t mainConnection) =0;
- /**
- * Callback that is called when the number of sinks change
- */
- virtual void cbNewSink(const am_SinkType_s& sink) =0;
- /**
- * Callback that is called when the number of sinks change
- */
- virtual void cbRemovedSink(const am_sinkID_t sinkID) =0;
- /**
- * Callback that is called when the number of sources change
- */
- virtual void cbNewSource(const am_SourceType_s& source) =0;
- /**
- * Callback that is called when the number of sources change
- */
- virtual void cbRemovedSource(const am_sourceID_t source) =0;
- /**
- * this callback is fired if the number of sink classes changed
- */
- virtual void cbNumberOfSinkClassesChanged() =0;
- /**
- * this callback is fired if the number of source classes changed
- */
- virtual void cbNumberOfSourceClassesChanged() =0;
- /**
- * This callback is called when the ConnectionState of a connection changed.
- */
- virtual void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) =0;
- /**
- * this callback indicates that a sinkSoundProperty has changed.
- */
- virtual void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) =0;
- /**
- * this callback indicates that a sourceSoundProperty has changed.
- */
- virtual void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) =0;
- /**
- * this callback is called when the availability of a sink has changed
- */
- virtual void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
- /**
- * this callback is called when the availability of source has changed.
- */
- virtual void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
- /**
- * this callback indicates a volume change on the indicated sink
- */
- virtual void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume) =0;
- /**
- * this callback indicates a mute state change on a sink.
- */
- virtual void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
- /**
- * is fired if a systemProperty changed
- */
- virtual void cbSystemPropertyChanged(const am_SystemProperty_s& systemProperty) =0;
- /**
- * This callback is fired if the timinginformation for a mainConnectionID changed
- */
- virtual void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) =0;
- /**
- * This callback is called when a sink is updated.
- */
- virtual void cbSinkUpdated(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
- /**
- * This callback is called when a source is updated.
- */
- virtual void cbSourceUpdated(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
- /**
- * This callback is called when a notificated value of a sink changes.
- */
- virtual void cbSinkNotification(const am_sinkID_t sinkID, const am_NotificationPayload_s& notification) =0;
- /**
- * This callback is called when a notifcated value of a source changes.
- */
- virtual void cbSourceNotification(const am_sourceID_t sourceID, const am_NotificationPayload_s& notification) =0;
- /**
- * This callback is triggered when a mainNotificationConfiguration is changed.
- */
- virtual void cbMainSinkNotificationConfigurationChanged(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
- /**
- * This callback is triggered when a mainNotificationConfiguration is changed.
- */
- virtual void cbMainSourceNotificationConfigurationChanged(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
-
-};
-}
-#endif // !defined(EA_B654431C_A920_4376_9B2F_3FF803354EAD__INCLUDED_)
+/**
+ * Copyright (C) 2012 - 2014, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
+ *
+ * \file
+ * For further information see http://projects.genivi.org/audio-manager
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
+ * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
+ */
+#if !defined(EA_42416EED_29C4_4b4c_A98B_010EF2513C35__INCLUDED_)
+#define EA_42416EED_29C4_4b4c_A98B_010EF2513C35__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+
+namespace am {
+class IAmCommandReceive;
+}
+
+#include "IAmCommandReceive.h"
+#include "audiomanagertypes.h"
+
+#define CommandSendVersion "3.0"
+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.
+ * There are two rules that have to be kept in mind when implementing against this
+ * interface:\n
+ * \warning
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
+ * CALL THAT EXPECTS A RETURN VALUE.\n
+ * \details
+ * Violation these rules may lead to unexpected behavior! Nevertheless you can
+ * implement thread safe by using the deferred-call pattern described on the wiki
+ * which also helps to implement calls that are forbidden.\n
+ * For more information, please check CAmSerializer
+ */
+class IAmCommandSend
+{
+
+public:
+ IAmCommandSend() {
+
+ }
+
+ virtual ~IAmCommandSend() {
+
+ }
+
+ /**
+ * returns the interface version as string.
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * This command starts the interface, the plugin itself. This is not meant to
+ * start communication with the HMI itself. It is a good idea to implement here
+ * everything that sets up the basic communication like DbusCommunication etc...
+ * Be aware of side effects with systemd and socketbased communication!
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e startupInterface(IAmCommandReceive* commandreceiveinterface) =0;
+ /**
+ * This function will indirectly be called by the Controller and is used to start
+ * the Communication. Before this command, all communication will be ignored by
+ * the AudioManager.
+ * After the Plugin is ready, it will asynchronously answer with
+ * condfirmCommandReady, the handle that is handed over must be returned.
+ */
+ virtual void setCommandReady(const uint16_t handle) =0;
+ /**
+ * This function will indirectly be called by the Controller and is used to stop
+ * the Communication. After this command, all communication will be ignored by the
+ * AudioManager. The plugin has to be prepared that either the power will be
+ * switched off or the Interface is started again with setCommandReady
+ * After the Plugin is ready to rundown, it will asynchronously answer with
+ * condfirmCommandRundown, the handle that is handed over must be returned.
+ */
+ virtual void setCommandRundown(const uint16_t handle) =0;
+ /**
+ * Callback that is called when the number of connections change
+ */
+ virtual void cbNewMainConnection(const am_MainConnectionType_s& mainConnection) =0;
+ /**
+ * Callback that is called when the number of connections change
+ */
+ virtual void cbRemovedMainConnection(const am_mainConnectionID_t mainConnection) =0;
+ /**
+ * Callback that is called when the number of sinks change
+ */
+ virtual void cbNewSink(const am_SinkType_s& sink) =0;
+ /**
+ * Callback that is called when the number of sinks change
+ */
+ virtual void cbRemovedSink(const am_sinkID_t sinkID) =0;
+ /**
+ * Callback that is called when the number of sources change
+ */
+ virtual void cbNewSource(const am_SourceType_s& source) =0;
+ /**
+ * Callback that is called when the number of sources change
+ */
+ virtual void cbRemovedSource(const am_sourceID_t source) =0;
+ /**
+ * this callback is fired if the number of sink classes changed
+ */
+ virtual void cbNumberOfSinkClassesChanged() =0;
+ /**
+ * this callback is fired if the number of source classes changed
+ */
+ virtual void cbNumberOfSourceClassesChanged() =0;
+ /**
+ * This callback is called when the ConnectionState of a connection changed.
+ */
+ virtual void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) =0;
+ /**
+ * this callback indicates that a sinkSoundProperty has changed.
+ */
+ virtual void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) =0;
+ /**
+ * this callback indicates that a sourceSoundProperty has changed.
+ */
+ virtual void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) =0;
+ /**
+ * this callback is called when the availability of a sink has changed
+ */
+ virtual void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
+ /**
+ * this callback is called when the availability of source has changed.
+ */
+ virtual void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
+ /**
+ * this callback indicates a volume change on the indicated sink
+ */
+ virtual void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume) =0;
+ /**
+ * this callback indicates a mute state change on a sink.
+ */
+ virtual void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
+ /**
+ * is fired if a systemProperty changed
+ */
+ virtual void cbSystemPropertyChanged(const am_SystemProperty_s& systemProperty) =0;
+ /**
+ * This callback is fired if the timinginformation for a mainConnectionID changed
+ */
+ virtual void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) =0;
+ /**
+ * This callback is called when a sink is updated.
+ */
+ virtual void cbSinkUpdated(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
+ /**
+ * This callback is called when a source is updated.
+ */
+ virtual void cbSourceUpdated(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
+ /**
+ * This callback is called when a notificated value of a sink changes.
+ */
+ virtual void cbSinkNotification(const am_sinkID_t sinkID, const am_NotificationPayload_s& notification) =0;
+ /**
+ * This callback is called when a notifcated value of a source changes.
+ */
+ virtual void cbSourceNotification(const am_sourceID_t sourceID, const am_NotificationPayload_s& notification) =0;
+ /**
+ * This callback is triggered when a mainNotificationConfiguration is changed.
+ */
+ virtual void cbMainSinkNotificationConfigurationChanged(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
+ /**
+ * This callback is triggered when a mainNotificationConfiguration is changed.
+ */
+ virtual void cbMainSourceNotificationConfigurationChanged(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
+
+};
+}
+#endif // !defined(EA_42416EED_29C4_4b4c_A98B_010EF2513C35__INCLUDED_)
diff --git a/include/control/IAmControlReceive.h b/include/control/IAmControlReceive.h
index 92281b9..79c0981 100755
--- a/include/control/IAmControlReceive.h
+++ b/include/control/IAmControlReceive.h
@@ -1,620 +1,658 @@
-/**
- * Copyright (C) 2012 - 2014, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
- *
- * \file
- * For further information see http://projects.genivi.org/audio-manager
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
- * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
- */
-#if !defined(EA_D35033D8_8C54_4c3b_B0E4_9C98516FDF3C__INCLUDED_)
-#define EA_D35033D8_8C54_4c3b_B0E4_9C98516FDF3C__INCLUDED_
-
-#include <vector>
-#include <string>
-#include "audiomanagertypes.h"
-namespace am {
-class CAmSocketHandler;
-}
-
-#include "audiomanagertypes.h"
-#include "NodeStateManager.h"
-
-#define ControlReceiveVersion "3.0"
-namespace am {
-
-/**
- * This interface gives access to all important functions of the audiomanager that
- * are used by the AudioManagerController to control the system.
- * There are two rules that have to be kept in mind when implementing against this
- * interface:\n
- * \warning
- * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
- * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
- * CALL THAT EXPECTS A RETURN VALUE.\n
- * \details
- * Violation these rules may lead to unexpected behavior! Nevertheless you can
- * implement thread safe by using the deferred-call pattern described on the wiki
- * which also helps to implement calls that are forbidden.\n
- * For more information, please check CAmSerializer
- */
-class IAmControlReceive
-{
-
-public:
- IAmControlReceive() {
-
- }
-
- virtual ~IAmControlReceive() {
-
- }
-
- /**
- * This function returns the version of the interface
- */
- virtual void getInterfaceVersion(std::string& version) const =0;
- /**
- * calculates a route from source to sink.
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList) =0;
- /**
- * With this function, elementary connects can be triggered by the controller.
- * @return E_OK on success, E_UNKNOWN on error, E_WRONG_FORMAT of
- * connectionFormats do not match, E_NO_CHANGE if the desired connection is
- * already build up
- */
- virtual am_Error_e connect(am_Handle_s& handle, am_connectionID_t& connectionID, const am_CustomConnectionFormat_t format, const am_sourceID_t sourceID, const am_sinkID_t sinkID) =0;
- /**
- * is used to disconnect a connection
- * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if connection was
- * not found, E_NO_CHANGE if no change is neccessary
- */
- virtual am_Error_e disconnect(am_Handle_s& handle, const am_connectionID_t connectionID) =0;
- /**
- * triggers a cross fade.
- * @return E_OK on success, E_UNKNOWN on error E_NO_CHANGE if no change is
- * neccessary
- */
- virtual am_Error_e crossfade(am_Handle_s& handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_CustomRampType_t rampType, const am_time_t rampTime) =0;
- /**
- * with this method, all actions that have a handle assigned can be stopped.
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e abortAction(const am_Handle_s handle) =0;
- /**
- * this method sets a source state for a source. This function will trigger the
- * callback cbAckSetSourceState
- * @return E_OK on success, E_NO_CHANGE if the desired value is already correct,
- * E_UNKNOWN on error, E_NO_CHANGE if no change is neccessary
- */
- virtual am_Error_e setSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state) =0;
- /**
- * with this function, setting of sinks volumes is done. The behavior of the
- * volume set is depended on the given ramp and time information.
- * This function is not only used to ramp volume, but also to mute and direct set
- * the level. Exact behavior is depended on the selected mute ramps.
- * @return E_OK on success, E_NO_CHANGE if the volume is already on the desired
- * value, E_OUT_OF_RANGE is the volume is out of range, E_UNKNOWN on every other
- * error.
- */
- virtual am_Error_e setSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time) =0;
- /**
- * with this function, setting of source volumes is done. The behavior of the
- * volume set is depended on the given ramp and time information.
- * This function is not only used to ramp volume, but also to mute and direct set
- * the level. Exact behavior is depended on the selected mute ramps.
- * @return E_OK on success, E_NO_CHANGE if the volume is already on the desired
- * value, E_OUT_OF_RANGE is the volume is out of range, E_UNKNOWN on every other
- * error.
- */
- virtual am_Error_e setSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t rampType, const am_time_t time) =0;
- /**
- * is used to set several sinkSoundProperties at a time
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out
- * of range, E_NO_CHANGE if no change is neccessary
- */
- virtual am_Error_e setSinkSoundProperties(am_Handle_s& handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& soundProperty) =0;
- /**
- * is used to set sinkSoundProperties
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out
- * of range, E_NO_CHANGE if no change is neccessary
- */
- virtual am_Error_e setSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) =0;
- /**
- * is used to set several SourceSoundProperties at a time
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out
- * of range. E_NO_CHANGE if no change is neccessary
- */
- virtual am_Error_e setSourceSoundProperties(am_Handle_s& handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& soundProperty) =0;
- /**
- * is used to set sourceSoundProperties
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out
- * of range. E_NO_CHANGE if no change is neccessary
- */
- virtual am_Error_e setSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) =0;
- /**
- * sets the domain state of a domain
- * @return E_OK on success, E_UNKNOWN on error, E_NO_CHANGE if no change is
- * neccessary
- */
- virtual am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
- /**
- * enters a domain in the database, creates and ID
- * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
- * database, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
- /**
- * enters a mainconnection in the database, creates and ID
- * @return E_OK on success, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID) =0;
- /**
- * enters a sink in the database.
- * The sinkID in am_Sink_s shall be 0 in case of a dynamic added source A sinkID
- * greater than 100 will be assigned. If a specific sinkID with a value <100 is
- * given, the given value will be used. This is for a static setup where the ID's
- * are predefined.
- * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
- * database, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
- /**
- * enters a crossfader in the database.
- * The crossfaderID in am_Crossfader_s shall be 0 in case of a dynamic added
- * source A crossfaderID greater than 100 will be assigned. If a specific
- * crossfaderID with a value <100 is given, the given value will be used. This is
- * for a static setup where the ID's are predefined.
- * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
- * database, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
- /**
- * enters a gateway in the database.
- * The gatewayID in am_Gateway_s shall be 0 in case of a dynamic added source A
- * gatewayID greater than 100 will be assigned. If a specific gatewayID with a
- * value <100 is given, the given value will be used. This is for a static setup
- * where the ID's are predefined.
- * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
- * database, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
- /**
- * enters a source in the database.
- * The sourceID in am_Source_s shall be 0 in case of a dynamic added source A
- * sourceID greater than 100 will be assigned. If a specific sourceID with a value
- * <100 is given, the given value will be used. This is for a static setup where
- * the ID's are predefined.
- * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
- * database, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
- /**
- * Enters a sourceClass into the database.
- * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
- * database, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID) =0;
- /**
- * Enters a sourceClass into the database.
- * The sourceClassID in am_sourceClass_s shall be 0 in case of a dynamic added
- * source A sourceClassID greater than 100 will be assigned. If a specific
- * sourceClassID with a value <100 is given, the given value will be used. This is
- * for a static setup where the ID's are predefined.
- * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
- * database, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass) =0;
- /**
- * changes class information of a sinkclass.
- * The properties will overwrite the values of the sinkClassID given in the
- * sinkClass.
- * It is the duty of the controller to check if the property is valid. If it does
- * not exist, the daemon will not return an error.
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if
- * sinkClassID was not found.
- */
- virtual am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass) =0;
- /**
- * changes class information of a sourceClass.
- * The properties will overwrite the values of the sourceClassID given in the
- * sourceClass.
- * It is the duty of the controller to check if the property is valid. If it does
- * not exist, the daemon will not return an error.
- * @return E_OK on success, E_DATABASE_ERROR on error and E_NON_EXISTENT if the
- * ClassID does not exist.
- */
- virtual am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass) =0;
- /**
- * This function is used to enter the system Properties into the database.
- * All entries in the database will be erased before entering the new List. It
- * should only be called once at system startup.
- * @return E_OK on success, E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties) =0;
- /**
- * changes the mainConnectionState of MainConnection
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if
- * mainconnection
- */
- 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
- */
- virtual am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState) =0;
- /**
- * changes the sink volume of a sink
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
- * not found
- */
- virtual am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID) =0;
- /**
- * changes the availablility of a sink
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
- * not found
- */
- virtual am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID) =0;
- /**
- * changes the domainstate of a domain
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
- * was not found
- */
- virtual am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID) =0;
- /**
- * changes the mute state of a sink
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
- * not found
- */
- virtual am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID) =0;
- /**
- * changes the mainsinksoundproperty of a sink
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
- * not found
- */
- virtual am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) =0;
- /**
- * changes the mainsourcesoundproperty of a sink
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source
- * was not found
- */
- virtual am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) =0;
- /**
- * changes the availablility of a source
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source
- * was not found
- */
- virtual am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID) =0;
- /**
- * changes a systemProperty
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if property
- * was not found
- */
- virtual am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property) =0;
- /**
- * removes a mainconnection from the DB
- * @return E_OK on success, E_NON_EXISTENT if main connection was not found,
- * E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID) =0;
- /**
- * removes a sink from the DB
- * @return E_OK on success, E_NON_EXISTENT if sink was not found, E_DATABASE_ERROR
- * if the database had an error
- */
- virtual am_Error_e removeSinkDB(const am_sinkID_t sinkID) =0;
- /**
- * removes a source from the DB
- * @return E_OK on success, E_NON_EXISTENT if source was not found,
- * E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e removeSourceDB(const am_sourceID_t sourceID) =0;
- /**
- * removes a gateway from the DB
- * @return E_OK on success, E_NON_EXISTENT if gateway was not found,
- * E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID) =0;
- /**
- * removes a crossfader from the DB
- * @return E_OK on success, E_NON_EXISTENT if crossfader was not found,
- * E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID) =0;
- /**
- * removes a domain from the DB
- * @return E_OK on success, E_NON_EXISTENT if domain was not found,
- * E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e removeDomainDB(const am_domainID_t domainID) =0;
- /**
- * removes a domain from the DB
- * @return E_OK on success, E_NON_EXISTENT if domain was not found,
- * E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID) =0;
- /**
- * removes a domain from the DB
- * @return E_OK on success, E_NON_EXISTENT if domain was not found,
- * E_DATABASE_ERROR if the database had an error
- */
- virtual am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID) =0;
- /**
- * returns the ClassInformation of a source
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source
- * was not found
- */
- virtual am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const =0;
- /**
- * returns the ClassInformation of a sink
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
- * not found
- */
- 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
- */
- 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
- */
- 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
- */
- virtual am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) 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
- */
- 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
- */
- 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
- */
- virtual am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const =0;
- /**
- * returns all source of a domain
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
- * was not found
- */
- virtual am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const =0;
- /**
- * returns all crossfaders of a domain
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
- * was not found
- */
- virtual am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listCrossfadersID) const =0;
- /**
- * returns all gateways of a domain
- * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
- * was not found
- */
- virtual am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const =0;
- /**
- * returns a complete list of all MainConnections
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const =0;
- /**
- * returns a complete list of all domains
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const =0;
- /**
- * returns a complete list of all Connections
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const =0;
- /**
- * returns a list of all sinks
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const =0;
- /**
- * returns a list of all sources
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListSources(std::vector<am_Source_s>& listSources) const =0;
- /**
- * returns a list of all source classes
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const =0;
- /**
- * returns a list of all handles
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListHandles(std::vector<am_Handle_s>& listHandles) const =0;
- /**
- * returns a list of all crossfaders
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const =0;
- /**
- * returns a list of gateways
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const =0;
- /**
- * returns a list of all sink classes
- * @return E_OK on success, E_DATABASE_ERROR on error
- */
- virtual am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const =0;
- /**
- * returns the list of SystemProperties
- */
- virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const =0;
- /**
- * sets the command interface to ready. Will send setCommandReady to each of the
- * plugins. The corresponding answer is confirmCommandReady.
- */
- virtual void setCommandReady() =0;
- /**
- * sets the command interface into the rundown state. Will send setCommandRundown
- * to each of the plugins. The corresponding answer is confirmCommandRundown.
- */
- virtual void setCommandRundown() =0;
- /**
- * sets the routinginterface to ready. Will send the command setRoutingReady to
- * each of the plugins. The related answer is confirmRoutingReady.
- */
- virtual void setRoutingReady() =0;
- /**
- * sets the routinginterface to the rundown state. Will send the command
- * setRoutingRundown to each of the plugins. The related answer is
- * confirmRoutingRundown.
- */
- virtual void setRoutingRundown() =0;
- /**
- * acknowledges the setControllerReady call.
- */
- virtual void confirmControllerReady(const am_Error_e error) =0;
- /**
- * Acknowledges the setControllerRundown call.
- */
- virtual void confirmControllerRundown(const am_Error_e error) =0;
- /**
- * This function returns the pointer to the socketHandler. This can be used to
- * integrate socket-based activites like communication with the mainloop of the
- * AudioManager.
- * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled
- * without socketHandler support,
- */
- virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) =0;
- /**
- * Change the data of the source.
- */
- virtual 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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
- /**
- * Change the data of the sink.
- */
- virtual 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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
- /**
- * changes Gateway Data
- */
- virtual am_Error_e changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) =0;
- /**
- * with this function, setting of multiple volumes at a time is done. The behavior
- * of the volume set is depended on the given ramp and time information.
- * This function is not only used to ramp volume, but also to mute and direct set
- * the level. Exact behavior is depended on the selected mute ramps.
- * @return E_OK on success, E_NO_CHANGE if the volume is already on the desired
- * value, E_OUT_OF_RANGE is the volume is out of range, E_UNKNOWN on every other
- * error.
- */
- virtual am_Error_e setVolumes(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes) =0;
- /**
- * set a sink notification configuration
- */
- virtual am_Error_e setSinkNotificationConfiguration(am_Handle_s& handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
- /**
- * set a source notification configuration
- */
- virtual am_Error_e setSourceNotificationConfiguration(am_Handle_s& handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
- /**
- * Sends out the main notificiation of a sink
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual void sendMainSinkNotificationPayload(const am_sinkID_t sinkID, const am_NotificationPayload_s& notificationPayload) =0;
- /**
- * Sends out the main notificiation of a source
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual void sendMainSourceNotificationPayload(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload) =0;
- /**
- * change the mainNotificationConfiguration of a sink
- * @return E_OK when successful, E_DATABASE on error
- */
- virtual am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
- /**
- * change the mainNotificationConfiguration of a source
- * @return E_OK when successful, E_DATABASE on error
- */
- virtual am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
- /**
- * Retrieves the Restart Reason Property
- * @return E_OK on success E_UNKNOWN if property could not be retrieved.
- */
- virtual am_Error_e getRestartReasonPropertyNSM(NsmRestartReason_e& restartReason) =0;
- /**
- * Retrieves the shutdown reason property
- * @return E_OK on success E_UNKNOWN if property could not be retrieved.
- */
- virtual am_Error_e getShutdownReasonPropertyNSM(NsmShutdownReason_e& ShutdownReason) =0;
- /**
- * Retrieves the running reason
- * @return E_OK on success E_UNKNOWN if property could not be retrieved.
- */
- virtual am_Error_e getRunningReasonPropertyNSM(NsmRunningReason_e& nsmRunningReason) =0;
- /**
- * @return NsmErrorStatus_Ok in case of success
- */
- virtual NsmErrorStatus_e getNodeStateNSM(NsmNodeState_e& nsmNodeState) =0;
- /**
- * Retrieves the current session state
- * @return NsmErrorStatus_Ok on success E_UNKNOWN if property could not be
- * retrieved.
- */
- virtual NsmErrorStatus_e getSessionStateNSM(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState) =0;
- /**
- * Retrieves the current applicationmode
- * @return NsmErrorStatus_Ok on success E_UNKNOWN if property could not be
- * retrieved.
- */
- virtual NsmErrorStatus_e getApplicationModeNSM(NsmApplicationMode_e& applicationMode) =0;
- /**
- * Registers the AudioManager as shutdown client
- * @return NsmErrorStatus_Ok on success
- * The interface for the client will be provided by the AudioManagerDeamon,
- * therefore is no need to mention it here.
- */
- virtual NsmErrorStatus_e registerShutdownClientNSM(const uint32_t shutdownMode, const uint32_t timeoutMs) =0;
- /**
- * unregisters the AudioManager as shutdown client
- * @return NsmErrorStatus_Ok on success
- */
- virtual NsmErrorStatus_e unRegisterShutdownClientNSM(const uint32_t shutdownMode) =0;
- /**
- * @return E_OK on success, E_UNKOWN if interface could not be reached
- */
- virtual am_Error_e getInterfaceVersionNSM(uint32_t& version) =0;
- /**
- * Sends out the lifecyclerequest complete to the NSM
- * @return NsmErrorStatus_Ok in case of success
- */
- virtual NsmErrorStatus_e sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status) =0;
-
-};
-}
-#endif // !defined(EA_D35033D8_8C54_4c3b_B0E4_9C98516FDF3C__INCLUDED_)
+/**
+ * Copyright (C) 2012 - 2014, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
+ *
+ * \file
+ * For further information see http://projects.genivi.org/audio-manager
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
+ * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
+ */
+#if !defined(EA_770423FB_365F_4c4b_824E_276D1AE06003__INCLUDED_)
+#define EA_770423FB_365F_4c4b_824E_276D1AE06003__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+namespace am {
+class CAmSocketHandler;
+}
+
+
+#include "audiomanagertypes.h"
+#include "NodeStateManager.h"
+
+#define ControlReceiveVersion "3.0"
+namespace am {
+
+/**
+ * This interface gives access to all important functions of the audiomanager that
+ * are used by the AudioManagerController to control the system.
+ * There are two rules that have to be kept in mind when implementing against this
+ * interface:\n
+ * \warning
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
+ * CALL THAT EXPECTS A RETURN VALUE.\n
+ * \details
+ * Violation these rules may lead to unexpected behavior! Nevertheless you can
+ * implement thread safe by using the deferred-call pattern described on the wiki
+ * which also helps to implement calls that are forbidden.\n
+ * For more information, please check CAmSerializer
+ */
+class IAmControlReceive
+{
+
+public:
+ IAmControlReceive() {
+
+ }
+
+ virtual ~IAmControlReceive() {
+
+ }
+
+ /**
+ * This function returns the version of the interface
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * calculates a route from source to sink.
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList) =0;
+ /**
+ * With this function, elementary connects can be triggered by the controller.
+ * @return E_OK on success, E_UNKNOWN on error, E_WRONG_FORMAT of
+ * connectionFormats do not match, E_NO_CHANGE if the desired connection is
+ * already build up
+ */
+ virtual am_Error_e connect(am_Handle_s& handle, am_connectionID_t& connectionID, const am_CustomConnectionFormat_t format, const am_sourceID_t sourceID, const am_sinkID_t sinkID) =0;
+ /**
+ * is used to disconnect a connection
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if connection was
+ * not found, E_NO_CHANGE if no change is neccessary
+ */
+ virtual am_Error_e disconnect(am_Handle_s& handle, const am_connectionID_t connectionID) =0;
+ /**
+ * triggers a cross fade.
+ * @return E_OK on success, E_UNKNOWN on error E_NO_CHANGE if no change is
+ * neccessary
+ */
+ virtual am_Error_e crossfade(am_Handle_s& handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_CustomRampType_t rampType, const am_time_t rampTime) =0;
+ /**
+ * with this method, all actions that have a handle assigned can be stopped.
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e abortAction(const am_Handle_s handle) =0;
+ /**
+ * this method sets a source state for a source. This function will trigger the
+ * callback cbAckSetSourceState
+ * @return E_OK on success, E_NO_CHANGE if the desired value is already correct,
+ * E_UNKNOWN on error, E_NO_CHANGE if no change is neccessary
+ */
+ virtual am_Error_e setSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state) =0;
+ /**
+ * with this function, setting of sinks volumes is done. The behavior of the
+ * volume set is depended on the given ramp and time information.
+ * This function is not only used to ramp volume, but also to mute and direct set
+ * the level. Exact behavior is depended on the selected mute ramps.
+ * @return E_OK on success, E_NO_CHANGE if the volume is already on the desired
+ * value, E_OUT_OF_RANGE is the volume is out of range, E_UNKNOWN on every other
+ * error.
+ */
+ virtual am_Error_e setSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time) =0;
+ /**
+ * with this function, setting of source volumes is done. The behavior of the
+ * volume set is depended on the given ramp and time information.
+ * This function is not only used to ramp volume, but also to mute and direct set
+ * the level. Exact behavior is depended on the selected mute ramps.
+ * @return E_OK on success, E_NO_CHANGE if the volume is already on the desired
+ * value, E_OUT_OF_RANGE is the volume is out of range, E_UNKNOWN on every other
+ * error.
+ */
+ virtual am_Error_e setSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t rampType, const am_time_t time) =0;
+ /**
+ * is used to set several sinkSoundProperties at a time
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out
+ * of range, E_NO_CHANGE if no change is neccessary
+ */
+ virtual am_Error_e setSinkSoundProperties(am_Handle_s& handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& soundProperty) =0;
+ /**
+ * is used to set sinkSoundProperties
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out
+ * of range, E_NO_CHANGE if no change is neccessary
+ */
+ virtual am_Error_e setSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) =0;
+ /**
+ * is used to set several SourceSoundProperties at a time
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out
+ * of range. E_NO_CHANGE if no change is neccessary
+ */
+ virtual am_Error_e setSourceSoundProperties(am_Handle_s& handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& soundProperty) =0;
+ /**
+ * is used to set sourceSoundProperties
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if property is out
+ * of range. E_NO_CHANGE if no change is neccessary
+ */
+ virtual am_Error_e setSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) =0;
+ /**
+ * sets the domain state of a domain
+ * @return E_OK on success, E_UNKNOWN on error, E_NO_CHANGE if no change is
+ * neccessary
+ */
+ virtual am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
+ /**
+ * enters a domain in the database, creates and ID
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
+ * database, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
+ /**
+ * enters a mainconnection in the database, creates and ID
+ * @return E_OK on success, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID) =0;
+ /**
+ * enters a sink in the database.
+ * The sinkID in am_Sink_s shall be 0 in case of a dynamic added source A sinkID
+ * greater than 100 will be assigned. If a specific sinkID with a value <100 is
+ * given, the given value will be used. This is for a static setup where the ID's
+ * are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
+ * database, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
+ /**
+ * enters a crossfader in the database.
+ * The crossfaderID in am_Crossfader_s shall be 0 in case of a dynamic added
+ * source A crossfaderID greater than 100 will be assigned. If a specific
+ * crossfaderID with a value <100 is given, the given value will be used. This is
+ * for a static setup where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
+ * database, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
+ /**
+ * enters a gateway in the database.
+ * The gatewayID in am_Gateway_s shall be 0 in case of a dynamic added source A
+ * gatewayID greater than 100 will be assigned. If a specific gatewayID with a
+ * value <100 is given, the given value will be used. This is for a static setup
+ * where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
+ * database, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
+ /**
+ * enters a converter in the database.
+ * The converterID in am_Converter_s shall be 0 in case of a dynamic added source
+ * A converterID greater than 100 will be assigned. If a specific gatewayID with a
+ * value <100 is given, the given value will be used. This is for a static setup
+ * where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
+ * database, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterConverterDB(const am_Converter_s& converterData, am_converterID_t& converterID) =0;
+ /**
+ * enters a source in the database.
+ * The sourceID in am_Source_s shall be 0 in case of a dynamic added source A
+ * sourceID greater than 100 will be assigned. If a specific sourceID with a value
+ * <100 is given, the given value will be used. This is for a static setup where
+ * the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
+ * database, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
+ /**
+ * Enters a sourceClass into the database.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
+ * database, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID) =0;
+ /**
+ * Enters a sourceClass into the database.
+ * The sourceClassID in am_sourceClass_s shall be 0 in case of a dynamic added
+ * source A sourceClassID greater than 100 will be assigned. If a specific
+ * sourceClassID with a value <100 is given, the given value will be used. This is
+ * for a static setup where the ID's are predefined.
+ * @return E_OK on success, E_ALREADY_EXISTENT if the ID or name is already in the
+ * database, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass) =0;
+ /**
+ * changes class information of a sinkclass.
+ * The properties will overwrite the values of the sinkClassID given in the
+ * sinkClass.
+ * It is the duty of the controller to check if the property is valid. If it does
+ * not exist, the daemon will not return an error.
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if
+ * sinkClassID was not found.
+ */
+ virtual am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass) =0;
+ /**
+ * changes class information of a sourceClass.
+ * The properties will overwrite the values of the sourceClassID given in the
+ * sourceClass.
+ * It is the duty of the controller to check if the property is valid. If it does
+ * not exist, the daemon will not return an error.
+ * @return E_OK on success, E_DATABASE_ERROR on error and E_NON_EXISTENT if the
+ * ClassID does not exist.
+ */
+ virtual am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass) =0;
+ /**
+ * This function is used to enter the system Properties into the database.
+ * All entries in the database will be erased before entering the new List. It
+ * should only be called once at system startup.
+ * @return E_OK on success, E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties) =0;
+ /**
+ * changes the mainConnectionState of MainConnection
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if
+ * mainconnection
+ */
+ 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
+ */
+ virtual am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState) =0;
+ /**
+ * changes the sink volume of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
+ * not found
+ */
+ virtual am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID) =0;
+ /**
+ * changes the availablility of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
+ * not found
+ */
+ virtual am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID) =0;
+ /**
+ * changes the domainstate of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
+ * was not found
+ */
+ virtual am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID) =0;
+ /**
+ * changes the mute state of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
+ * not found
+ */
+ virtual am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID) =0;
+ /**
+ * changes the mainsinksoundproperty of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
+ * not found
+ */
+ virtual am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) =0;
+ /**
+ * changes the mainsourcesoundproperty of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source
+ * was not found
+ */
+ virtual am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) =0;
+ /**
+ * changes the availablility of a source
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source
+ * was not found
+ */
+ virtual am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID) =0;
+ /**
+ * changes a systemProperty
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if property
+ * was not found
+ */
+ virtual am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property) =0;
+ /**
+ * removes a mainconnection from the DB
+ * @return E_OK on success, E_NON_EXISTENT if main connection was not found,
+ * E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID) =0;
+ /**
+ * removes a sink from the DB
+ * @return E_OK on success, E_NON_EXISTENT if sink was not found, E_DATABASE_ERROR
+ * if the database had an error
+ */
+ virtual am_Error_e removeSinkDB(const am_sinkID_t sinkID) =0;
+ /**
+ * removes a source from the DB
+ * @return E_OK on success, E_NON_EXISTENT if source was not found,
+ * E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e removeSourceDB(const am_sourceID_t sourceID) =0;
+ /**
+ * removes a gateway from the DB
+ * @return E_OK on success, E_NON_EXISTENT if gateway was not found,
+ * E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID) =0;
+ /**
+ * removes a converter from the DB
+ * @return E_OK on success, E_NON_EXISTENT if gateway was not found,
+ * E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e removeConverterDB(const am_converterID_t converterID) =0;
+ /**
+ * removes a crossfader from the DB
+ * @return E_OK on success, E_NON_EXISTENT if crossfader was not found,
+ * E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID) =0;
+ /**
+ * removes a domain from the DB
+ * @return E_OK on success, E_NON_EXISTENT if domain was not found,
+ * E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e removeDomainDB(const am_domainID_t domainID) =0;
+ /**
+ * removes a domain from the DB
+ * @return E_OK on success, E_NON_EXISTENT if domain was not found,
+ * E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID) =0;
+ /**
+ * removes a domain from the DB
+ * @return E_OK on success, E_NON_EXISTENT if domain was not found,
+ * E_DATABASE_ERROR if the database had an error
+ */
+ virtual am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID) =0;
+ /**
+ * returns the ClassInformation of a source
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if source
+ * was not found
+ */
+ virtual am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const =0;
+ /**
+ * returns the ClassInformation of a sink
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if sink was
+ * not found
+ */
+ 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
+ */
+ 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
+ */
+ virtual am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const =0;
+ /**
+ * return source and sink of a converter
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if gateway
+ * was not found
+ */
+ virtual am_Error_e getConverterInfoDB(const am_converterID_t converterID, am_Converter_s& converterData) 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
+ */
+ virtual am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) 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
+ */
+ 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
+ */
+ 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
+ */
+ virtual am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const =0;
+ /**
+ * returns all source of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
+ * was not found
+ */
+ virtual am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const =0;
+ /**
+ * returns all crossfaders of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
+ * was not found
+ */
+ virtual am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listCrossfadersID) const =0;
+ /**
+ * returns all converters of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
+ * was not found
+ */
+ virtual am_Error_e getListConvertersOfDomain(const am_domainID_t domainID, std::vector<am_converterID_t>& listConverterID) const =0;
+ /**
+ * returns all gateways of a domain
+ * @return E_OK on success, E_DATABASE_ERROR on error, E_NON_EXISTENT if domain
+ * was not found
+ */
+ virtual am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const =0;
+ /**
+ * returns a complete list of all MainConnections
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const =0;
+ /**
+ * returns a complete list of all domains
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const =0;
+ /**
+ * returns a complete list of all Connections
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const =0;
+ /**
+ * returns a list of all sinks
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const =0;
+ /**
+ * returns a list of all sources
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListSources(std::vector<am_Source_s>& listSources) const =0;
+ /**
+ * returns a list of all source classes
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const =0;
+ /**
+ * returns a list of all handles
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListHandles(std::vector<am_Handle_s>& listHandles) const =0;
+ /**
+ * returns a list of all crossfaders
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const =0;
+ /**
+ * returns a list of converters
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListConverters(std::vector<am_Converter_s>& listConverters) const =0;
+ /**
+ * returns a list of gateways
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const =0;
+ /**
+ * returns a list of all sink classes
+ * @return E_OK on success, E_DATABASE_ERROR on error
+ */
+ virtual am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const =0;
+ /**
+ * returns the list of SystemProperties
+ */
+ virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const =0;
+ /**
+ * sets the command interface to ready. Will send setCommandReady to each of the
+ * plugins. The corresponding answer is confirmCommandReady.
+ */
+ virtual void setCommandReady() =0;
+ /**
+ * sets the command interface into the rundown state. Will send setCommandRundown
+ * to each of the plugins. The corresponding answer is confirmCommandRundown.
+ */
+ virtual void setCommandRundown() =0;
+ /**
+ * sets the routinginterface to ready. Will send the command setRoutingReady to
+ * each of the plugins. The related answer is confirmRoutingReady.
+ */
+ virtual void setRoutingReady() =0;
+ /**
+ * sets the routinginterface to the rundown state. Will send the command
+ * setRoutingRundown to each of the plugins. The related answer is
+ * confirmRoutingRundown.
+ */
+ virtual void setRoutingRundown() =0;
+ /**
+ * acknowledges the setControllerReady call.
+ */
+ virtual void confirmControllerReady(const am_Error_e error) =0;
+ /**
+ * Acknowledges the setControllerRundown call.
+ */
+ virtual void confirmControllerRundown(const am_Error_e error) =0;
+ /**
+ * This function returns the pointer to the socketHandler. This can be used to
+ * integrate socket-based activites like communication with the mainloop of the
+ * AudioManager.
+ * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled
+ * without socketHandler support,
+ */
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) =0;
+ /**
+ * Change the data of the source.
+ */
+ virtual 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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
+ /**
+ * Change the data of the sink.
+ */
+ virtual 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_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
+ /**
+ * changes converter Data
+ */
+ virtual 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) =0;
+ /**
+ * changes Gateway Data
+ */
+ virtual am_Error_e changeGatewayDB(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) =0;
+ /**
+ * with this function, setting of multiple volumes at a time is done. The behavior
+ * of the volume set is depended on the given ramp and time information.
+ * This function is not only used to ramp volume, but also to mute and direct set
+ * the level. Exact behavior is depended on the selected mute ramps.
+ * @return E_OK on success, E_NO_CHANGE if the volume is already on the desired
+ * value, E_OUT_OF_RANGE is the volume is out of range, E_UNKNOWN on every other
+ * error.
+ */
+ virtual am_Error_e setVolumes(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes) =0;
+ /**
+ * set a sink notification configuration
+ */
+ virtual am_Error_e setSinkNotificationConfiguration(am_Handle_s& handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
+ /**
+ * set a source notification configuration
+ */
+ virtual am_Error_e setSourceNotificationConfiguration(am_Handle_s& handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
+ /**
+ * Sends out the main notificiation of a sink
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual void sendMainSinkNotificationPayload(const am_sinkID_t sinkID, const am_NotificationPayload_s& notificationPayload) =0;
+ /**
+ * Sends out the main notificiation of a source
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual void sendMainSourceNotificationPayload(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload) =0;
+ /**
+ * change the mainNotificationConfiguration of a sink
+ * @return E_OK when successful, E_DATABASE on error
+ */
+ virtual am_Error_e changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
+ /**
+ * change the mainNotificationConfiguration of a source
+ * @return E_OK when successful, E_DATABASE on error
+ */
+ virtual am_Error_e changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) =0;
+ /**
+ * Retrieves the Restart Reason Property
+ * @return E_OK on success E_UNKNOWN if property could not be retrieved.
+ */
+ virtual am_Error_e getRestartReasonPropertyNSM(NsmRestartReason_e& restartReason) =0;
+ /**
+ * Retrieves the shutdown reason property
+ * @return E_OK on success E_UNKNOWN if property could not be retrieved.
+ */
+ virtual am_Error_e getShutdownReasonPropertyNSM(NsmShutdownReason_e& ShutdownReason) =0;
+ /**
+ * Retrieves the running reason
+ * @return E_OK on success E_UNKNOWN if property could not be retrieved.
+ */
+ virtual am_Error_e getRunningReasonPropertyNSM(NsmRunningReason_e& nsmRunningReason) =0;
+ /**
+ * @return NsmErrorStatus_Ok in case of success
+ */
+ virtual NsmErrorStatus_e getNodeStateNSM(NsmNodeState_e& nsmNodeState) =0;
+ /**
+ * Retrieves the current session state
+ * @return NsmErrorStatus_Ok on success E_UNKNOWN if property could not be
+ * retrieved.
+ */
+ virtual NsmErrorStatus_e getSessionStateNSM(const std::string& sessionName, const NsmSeat_e seatID, NsmSessionState_e& sessionState) =0;
+ /**
+ * Retrieves the current applicationmode
+ * @return NsmErrorStatus_Ok on success E_UNKNOWN if property could not be
+ * retrieved.
+ */
+ virtual NsmErrorStatus_e getApplicationModeNSM(NsmApplicationMode_e& applicationMode) =0;
+ /**
+ * Registers the AudioManager as shutdown client
+ * @return NsmErrorStatus_Ok on success
+ * The interface for the client will be provided by the AudioManagerDeamon,
+ * therefore is no need to mention it here.
+ */
+ virtual NsmErrorStatus_e registerShutdownClientNSM(const uint32_t shutdownMode, const uint32_t timeoutMs) =0;
+ /**
+ * unregisters the AudioManager as shutdown client
+ * @return NsmErrorStatus_Ok on success
+ */
+ virtual NsmErrorStatus_e unRegisterShutdownClientNSM(const uint32_t shutdownMode) =0;
+ /**
+ * @return E_OK on success, E_UNKOWN if interface could not be reached
+ */
+ virtual am_Error_e getInterfaceVersionNSM(uint32_t& version) =0;
+ /**
+ * Sends out the lifecyclerequest complete to the NSM
+ * @return NsmErrorStatus_Ok in case of success
+ */
+ virtual NsmErrorStatus_e sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status) =0;
+
+};
+}
+#endif // !defined(EA_770423FB_365F_4c4b_824E_276D1AE06003__INCLUDED_)
diff --git a/include/control/IAmControlSend.h b/include/control/IAmControlSend.h
index 092ca43..f547a81 100755
--- a/include/control/IAmControlSend.h
+++ b/include/control/IAmControlSend.h
@@ -1,358 +1,374 @@
-/**
- * Copyright (C) 2012 - 2014, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
- *
- * \file
- * For further information see http://projects.genivi.org/audio-manager
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
- * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
- */
-#if !defined(EA_EC5ACE73_7EE6_4535_B8AA_54B1C4AC7007__INCLUDED_)
-#define EA_EC5ACE73_7EE6_4535_B8AA_54B1C4AC7007__INCLUDED_
-
-#include <vector>
-#include <string>
-#include "audiomanagertypes.h"
-namespace am {
-class IAmControlReceive;
-}
-
-#include "IAmControlReceive.h"
-#include "audiomanagertypes.h"
-#include "NodeStateManager.h"
-
-#define ControlSendVersion "3.0"
-namespace am {
-
-/**
- * This interface is presented by the AudioManager controller.
- * 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.
- * There are two rules that have to be kept in mind when implementing against this
- * interface:\n
- * \warning
- * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
- * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
- * CALL THAT EXPECTS A RETURN VALUE.\n
- * \details
- * Violation these rules may lead to unexpected behavior! Nevertheless you can
- * implement thread safe by using the deferred-call pattern described on the wiki
- * which also helps to implement calls that are forbidden.\n
- * For more information, please check CAmSerializer
- */
-class IAmControlSend
-{
-
-public:
- IAmControlSend() {
-
- }
-
- virtual ~IAmControlSend() {
-
- }
-
- /**
- * This function returns the version of the interface
- * returns E_OK, E_UNKOWN if version is unknown.
- */
- virtual void getInterfaceVersion(std::string& version) const =0;
- /**
- * Starts up the controller.
- */
- virtual am_Error_e startupController(IAmControlReceive* controlreceiveinterface) =0;
- /**
- * this message is used tell the controller that it should get ready. This message
- * must be acknowledged via confirmControllerReady.
- */
- virtual void setControllerReady() =0;
- /**
- * This message tells the controller that he should prepare everything for the
- * power to be switched off. This message must be acknowledged via
- * confirmControllerRundown.
- * The method will give the signal as integer that was responsible for calling the
- * setControllerRundown.
- * This function is called from the signal handler, either direct (when the
- * program is killed) or from within the mainloop (if the program is terminated).
- */
- virtual void setControllerRundown(const int16_t signal) =0;
- /**
- * is called when a connection request comes in via the command interface
- * @return E_OK on success, E_NOT_POSSIBLE on error, E_ALREADY_EXISTENT if already
- * exists
- */
- virtual am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) =0;
- /**
- * is called when a disconnection request comes in via the command interface
- * @return E_OK on success, E_NOT_POSSIBLE on error, E_NON_EXISTENT if connection
- * does not exists
- */
- virtual am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID) =0;
- /**
- * sets a user MainSinkSoundProperty
- * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
- */
- virtual am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) =0;
- /**
- * sets a user MainSourceSoundProperty
- * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
- */
- virtual am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) =0;
- /**
- * sets a user SystemProperty
- * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
- */
- virtual am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property) =0;
- /**
- * sets a user volume
- * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
- */
- virtual am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume) =0;
- /**
- * sets a user volume as increment
- * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
- */
- virtual am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment) =0;
- /**
- * sets the mute state of a sink
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
- /**
- * is called when a routing adaptor registers its domain
- * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
- * exists
- */
- virtual am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
- /**
- * is called when a routing adaptor wants to derigister a domain
- * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
- */
- virtual am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID) =0;
- /**
- * is called when a domain registered all the elements
- */
- virtual void hookSystemDomainRegistrationComplete(const am_domainID_t domainID) =0;
- /**
- * is called when a routing adaptor registers a sink
- * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
- * exists
- */
- virtual am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
- /**
- * is called when a routing adaptor deregisters a sink
- * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
- */
- virtual am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID) =0;
- /**
- * is called when a routing adaptor registers a source
- * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
- * exists
- */
- virtual am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
- /**
- * is called when a routing adaptor deregisters a source
- * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
- */
- virtual am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID) =0;
- /**
- * is called when a routing adaptor registers a gateway
- * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
- * exists
- */
- virtual am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
- /**
- * is called when a routing adaptor deregisters a gateway
- * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
- */
- virtual am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID) =0;
- /**
- * is called when a routing adaptor registers a crossfader
- * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
- * exists
- */
- virtual am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
- /**
- * is called when a routing adaptor deregisters a crossfader
- * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
- */
- virtual am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID) =0;
- /**
- * volumeticks. therse are used to indicate volumechanges during a ramp
- */
- virtual void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) =0;
- /**
- * volumeticks. therse are used to indicate volumechanges during a ramp
- */
- virtual void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) =0;
- /**
- * is called when an low level interrupt changed its state
- */
- virtual void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) =0;
- /**
- * id called when a sink changed its availability
- */
- virtual void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
- /**
- * id called when a source changed its availability
- */
- virtual void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
- /**
- * id called when domainstate was changed
- */
- virtual void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state) =0;
- /**
- * when early data was received
- */
- virtual void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data) =0;
- /**
- * this hook provides information about speed changes.
- * The quantization and sampling rate of the speed can be adjusted at compile time
- * of the AudioManagerDaemon.
- */
- virtual void hookSystemSpeedChange(const am_speed_t speed) =0;
- /**
- * this hook is fired whenever the timing information of a mainconnection has
- * changed.
- */
- virtual void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) =0;
- /**
- * ack for connect
- */
- virtual void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID) =0;
- /**
- * ack for disconnect
- */
- virtual void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) =0;
- /**
- * ack for crossfading
- */
- virtual void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error) =0;
- /**
- * ack for sink volume changes
- */
- virtual void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
- /**
- * ack for source volume changes
- */
- virtual void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error) =0;
- /**
- * ack for setting of source states
- */
- virtual void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * ack for setting of sourcesoundproperties
- */
- virtual void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * ack for setting of sourcesoundproperties
- */
- virtual void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * ack for setting of sinksoundproperties
- */
- virtual void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * ack for setting of sinksoundproperties
- */
- virtual void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * This function is used by the routing algorithm to retrieve a priorized list of
- * connectionFormats from the Controller.
- * @return E_OK in case of successfull priorisation.
- */
- virtual am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_CustomConnectionFormat_t> listPossibleConnectionFormats, std::vector<am_CustomConnectionFormat_t>& listPrioConnectionFormats) =0;
- /**
- * confirms the setCommandReady call
- */
- virtual void confirmCommandReady(const am_Error_e error) =0;
- /**
- * confirms the setRoutingReady call
- */
- virtual void confirmRoutingReady(const am_Error_e error) =0;
- /**
- * confirms the setCommandRundown call
- */
- virtual void confirmCommandRundown(const am_Error_e error) =0;
- /**
- * confirms the setRoutingRundown command
- */
- virtual void confirmRoutingRundown(const am_Error_e error) =0;
- /**
- * update form the SinkData
- */
- virtual am_Error_e hookSystemUpdateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
- /**
- * update from the source Data
- */
- virtual am_Error_e hookSystemUpdateSource(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
- /**
- * updates the Gateway Data
- */
- virtual am_Error_e hookSystemUpdateGateway(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) =0;
- /**
- * ack for mulitple volume changes
- */
- virtual void cbAckSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error) =0;
- /**
- * The acknowledge of the sink notification configuration
- */
- virtual void cbAckSetSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * The acknowledge of the source notification configuration
- */
- virtual void cbAckSetSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * new sinkNotification data is there!
- */
- virtual void hookSinkNotificationDataChanged(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload) =0;
- /**
- * new sourceNotification data is there!
- */
- virtual void hookSourceNotificationDataChanged(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) =0;
- /**
- * sets a user MainSinkNotificationConfiguration
- * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
- */
- virtual am_Error_e hookUserSetMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
- /**
- * sets a user MainSourceNotificationConfiguration
- * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
- */
- virtual am_Error_e hookUserSetMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
- /**
- * This hook is connected to the NodeState signal of the NodeStateManager
- */
- virtual void hookSystemNodeStateChanged(const NsmNodeState_e NodeStateId) =0;
- /**
- * This hook is connected to the NodeApplicationMode signal of the NodeStateManager
- */
- virtual void hookSystemNodeApplicationModeChanged(const NsmApplicationMode_e ApplicationModeId) =0;
- /**
- * the sessionstate change was send by the NSM
- */
- virtual void hookSystemSessionStateChanged(const std::string& sessionName, const NsmSeat_e seatID, const NsmSessionState_e sessionStateID) =0;
- /**
- * A lifecycle request comes in from the NSM and must be processed.
- * @return NsmErrorStatus_Ok if successful
- * The controller has to respond to this message with LifecycleRequestComplete.
- */
- virtual NsmErrorStatus_e hookSystemLifecycleRequest(const uint32_t Request, const uint32_t RequestId) =0;
-
-};
-}
-#endif // !defined(EA_EC5ACE73_7EE6_4535_B8AA_54B1C4AC7007__INCLUDED_)
+/**
+ * Copyright (C) 2012 - 2014, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
+ *
+ * \file
+ * For further information see http://projects.genivi.org/audio-manager
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
+ * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
+ */
+#if !defined(EA_0ABDDE72_16AD_4b27_A4DA_434305082DD5__INCLUDED_)
+#define EA_0ABDDE72_16AD_4b27_A4DA_434305082DD5__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+
+namespace am {
+class IAmControlReceive;
+}
+
+#include "IAmControlReceive.h"
+#include "audiomanagertypes.h"
+#include "NodeStateManager.h"
+
+#define ControlSendVersion "3.0"
+namespace am {
+
+/**
+ * This interface is presented by the AudioManager controller.
+ * 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.
+ * There are two rules that have to be kept in mind when implementing against this
+ * interface:\n
+ * \warning
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
+ * CALL THAT EXPECTS A RETURN VALUE.\n
+ * \details
+ * Violation these rules may lead to unexpected behavior! Nevertheless you can
+ * implement thread safe by using the deferred-call pattern described on the wiki
+ * which also helps to implement calls that are forbidden.\n
+ * For more information, please check CAmSerializer
+ */
+class IAmControlSend
+{
+
+public:
+ IAmControlSend() {
+
+ }
+
+ virtual ~IAmControlSend() {
+
+ }
+
+ /**
+ * This function returns the version of the interface
+ * returns E_OK, E_UNKOWN if version is unknown.
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * Starts up the controller.
+ */
+ virtual am_Error_e startupController(IAmControlReceive* controlreceiveinterface) =0;
+ /**
+ * this message is used tell the controller that it should get ready. This message
+ * must be acknowledged via confirmControllerReady.
+ */
+ virtual void setControllerReady() =0;
+ /**
+ * This message tells the controller that he should prepare everything for the
+ * power to be switched off. This message must be acknowledged via
+ * confirmControllerRundown.
+ * The method will give the signal as integer that was responsible for calling the
+ * setControllerRundown.
+ * This function is called from the signal handler, either direct (when the
+ * program is killed) or from within the mainloop (if the program is terminated).
+ */
+ virtual void setControllerRundown(const int16_t signal) =0;
+ /**
+ * is called when a connection request comes in via the command interface
+ * @return E_OK on success, E_NOT_POSSIBLE on error, E_ALREADY_EXISTENT if already
+ * exists
+ */
+ virtual am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) =0;
+ /**
+ * is called when a disconnection request comes in via the command interface
+ * @return E_OK on success, E_NOT_POSSIBLE on error, E_NON_EXISTENT if connection
+ * does not exists
+ */
+ virtual am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID) =0;
+ /**
+ * sets a user MainSinkSoundProperty
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ */
+ virtual am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) =0;
+ /**
+ * sets a user MainSourceSoundProperty
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ */
+ virtual am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) =0;
+ /**
+ * sets a user SystemProperty
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ */
+ virtual am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property) =0;
+ /**
+ * sets a user volume
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ */
+ virtual am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume) =0;
+ /**
+ * sets a user volume as increment
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ */
+ virtual am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment) =0;
+ /**
+ * sets the mute state of a sink
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) =0;
+ /**
+ * is called when a routing adaptor registers its domain
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
+ * exists
+ */
+ virtual am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
+ /**
+ * is called when a routing adaptor wants to derigister a domain
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ */
+ virtual am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID) =0;
+ /**
+ * is called when a domain registered all the elements
+ */
+ virtual void hookSystemDomainRegistrationComplete(const am_domainID_t domainID) =0;
+ /**
+ * is called when a routing adaptor registers a sink
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
+ * exists
+ */
+ virtual am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
+ /**
+ * is called when a routing adaptor deregisters a sink
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ */
+ virtual am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID) =0;
+ /**
+ * is called when a routing adaptor registers a source
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
+ * exists
+ */
+ virtual am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
+ /**
+ * is called when a routing adaptor deregisters a source
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ */
+ virtual am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID) =0;
+ /**
+ * is called when a routing adaptor registers a converter
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
+ * exists
+ */
+ virtual am_Error_e hookSystemRegisterConverter(const am_Converter_s& converterData, am_converterID_t& converterID) =0;
+ /**
+ * is called when a routing adaptor registers a gateway
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
+ * exists
+ */
+ virtual am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
+ /**
+ * is called when a routing adaptor deregisters a converter
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ */
+ virtual am_Error_e hookSystemDeregisterConverter(const am_converterID_t converterID) =0;
+ /**
+ * is called when a routing adaptor deregisters a gateway
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ */
+ virtual am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID) =0;
+ /**
+ * is called when a routing adaptor registers a crossfader
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXISTENT if already
+ * exists
+ */
+ virtual am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
+ /**
+ * is called when a routing adaptor deregisters a crossfader
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if not found
+ */
+ virtual am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID) =0;
+ /**
+ * volumeticks. therse are used to indicate volumechanges during a ramp
+ */
+ virtual void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) =0;
+ /**
+ * volumeticks. therse are used to indicate volumechanges during a ramp
+ */
+ virtual void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) =0;
+ /**
+ * is called when an low level interrupt changed its state
+ */
+ virtual void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) =0;
+ /**
+ * id called when a sink changed its availability
+ */
+ virtual void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
+ /**
+ * id called when a source changed its availability
+ */
+ virtual void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
+ /**
+ * id called when domainstate was changed
+ */
+ virtual void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state) =0;
+ /**
+ * when early data was received
+ */
+ virtual void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data) =0;
+ /**
+ * this hook provides information about speed changes.
+ * The quantization and sampling rate of the speed can be adjusted at compile time
+ * of the AudioManagerDaemon.
+ */
+ virtual void hookSystemSpeedChange(const am_speed_t speed) =0;
+ /**
+ * this hook is fired whenever the timing information of a mainconnection has
+ * changed.
+ */
+ virtual void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) =0;
+ /**
+ * ack for connect
+ */
+ virtual void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID) =0;
+ /**
+ * ack for disconnect
+ */
+ virtual void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) =0;
+ /**
+ * ack for crossfading
+ */
+ virtual void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error) =0;
+ /**
+ * ack for sink volume changes
+ */
+ virtual void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
+ /**
+ * ack for source volume changes
+ */
+ virtual void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error) =0;
+ /**
+ * ack for setting of source states
+ */
+ virtual void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * ack for setting of sourcesoundproperties
+ */
+ virtual void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * ack for setting of sourcesoundproperties
+ */
+ virtual void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * ack for setting of sinksoundproperties
+ */
+ virtual void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * ack for setting of sinksoundproperties
+ */
+ virtual void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * This function is used by the routing algorithm to retrieve a priorized list of
+ * connectionFormats from the Controller.
+ * @return E_OK in case of successfull priorisation.
+ */
+ virtual am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_CustomConnectionFormat_t> listPossibleConnectionFormats, std::vector<am_CustomConnectionFormat_t>& listPrioConnectionFormats) =0;
+ /**
+ * confirms the setCommandReady call
+ */
+ virtual void confirmCommandReady(const am_Error_e error) =0;
+ /**
+ * confirms the setRoutingReady call
+ */
+ virtual void confirmRoutingReady(const am_Error_e error) =0;
+ /**
+ * confirms the setCommandRundown call
+ */
+ virtual void confirmCommandRundown(const am_Error_e error) =0;
+ /**
+ * confirms the setRoutingRundown command
+ */
+ virtual void confirmRoutingRundown(const am_Error_e error) =0;
+ /**
+ * update form the SinkData
+ */
+ virtual am_Error_e hookSystemUpdateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
+ /**
+ * update from the source Data
+ */
+ virtual am_Error_e hookSystemUpdateSource(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
+ /**
+ * updates the Converter Data
+ */
+ virtual am_Error_e hookSystemUpdateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) =0;
+ /**
+ * updates the Gateway Data
+ */
+ virtual am_Error_e hookSystemUpdateGateway(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceConnectionFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkConnectionFormats, const std::vector<bool>& convertionMatrix) =0;
+ /**
+ * ack for mulitple volume changes
+ */
+ virtual void cbAckSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes, const am_Error_e error) =0;
+ /**
+ * The acknowledge of the sink notification configuration
+ */
+ virtual void cbAckSetSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * The acknowledge of the source notification configuration
+ */
+ virtual void cbAckSetSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * new sinkNotification data is there!
+ */
+ virtual void hookSinkNotificationDataChanged(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload) =0;
+ /**
+ * new sourceNotification data is there!
+ */
+ virtual void hookSourceNotificationDataChanged(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) =0;
+ /**
+ * sets a user MainSinkNotificationConfiguration
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ */
+ virtual am_Error_e hookUserSetMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
+ /**
+ * sets a user MainSourceNotificationConfiguration
+ * @return E_OK on success, E_OUT_OF_RANGE if out of range, E_UNKNOWN on error
+ */
+ virtual am_Error_e hookUserSetMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
+ /**
+ * This hook is connected to the NodeState signal of the NodeStateManager
+ */
+ virtual void hookSystemNodeStateChanged(const NsmNodeState_e NodeStateId) =0;
+ /**
+ * This hook is connected to the NodeApplicationMode signal of the NodeStateManager
+ */
+ virtual void hookSystemNodeApplicationModeChanged(const NsmApplicationMode_e ApplicationModeId) =0;
+ /**
+ * the sessionstate change was send by the NSM
+ */
+ virtual void hookSystemSessionStateChanged(const std::string& sessionName, const NsmSeat_e seatID, const NsmSessionState_e sessionStateID) =0;
+ /**
+ * A lifecycle request comes in from the NSM and must be processed.
+ * @return NsmErrorStatus_Ok if successful
+ * The controller has to respond to this message with LifecycleRequestComplete.
+ */
+ virtual NsmErrorStatus_e hookSystemLifecycleRequest(const uint32_t Request, const uint32_t RequestId) =0;
+
+};
+}
+#endif // !defined(EA_0ABDDE72_16AD_4b27_A4DA_434305082DD5__INCLUDED_)
diff --git a/include/routing/IAmRoutingReceive.h b/include/routing/IAmRoutingReceive.h
index 796c28f..de9e55b 100755
--- a/include/routing/IAmRoutingReceive.h
+++ b/include/routing/IAmRoutingReceive.h
@@ -1,314 +1,331 @@
-/**
- * Copyright (C) 2012 - 2014, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
- *
- * \file
- * For further information see http://projects.genivi.org/audio-manager
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
- * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
- */
-#if !defined(EA_C540B86A_9F4A_4ae5_A68A_8A0FD52A7149__INCLUDED_)
-#define EA_C540B86A_9F4A_4ae5_A68A_8A0FD52A7149__INCLUDED_
-
-#include <vector>
-#include <string>
-#include "audiomanagertypes.h"
-namespace am {
-class CAmDbusWrapper;
-class CAmSocketHandler;
-}
-
-
-#include "audiomanagertypes.h"
-
-#define RoutingReceiveVersion "3.0"
-namespace am {
-
-/**
- * Routing Receive sendInterface description. This class implements everything
- * from RoutingAdapter -> Audiomanager
- * There are two rules that have to be kept in mind when implementing against this
- * interface:\n
- * \warning
- * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
- * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
- * CALL THAT EXPECTS A RETURN VALUE.\n
- * \details
- * Violation these rules may lead to unexpected behavior! Nevertheless you can
- * implement thread safe by using the deferred-call pattern described on the wiki
- * which also helps to implement calls that are forbidden.\n
- * For more information, please check CAmSerializer
- */
-class IAmRoutingReceive
-{
-
-public:
- IAmRoutingReceive() {
-
- }
-
- virtual ~IAmRoutingReceive() {
-
- }
-
- /**
- * This function returns the version of the interface
- */
- virtual void getInterfaceVersion(std::string& version) const =0;
- /**
- * acknowledges a asyncConnect
- */
- virtual void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) =0;
- /**
- * acknowledges a asyncDisconnect
- */
- virtual void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) =0;
- /**
- * acknowledges a asyncsetSinkVolume
- */
- virtual void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
- /**
- * acknowledges a asyncsetSourceVolume
- */
- virtual void ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
- /**
- * acknowlegde for asyncSetSourceState
- */
- virtual void ackSetSourceState(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * acknowledges asyncSetSinkSoundProperties
- */
- virtual void ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * acknowledges asyncSetSinkSoundProperty
- */
- virtual void ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * acknowledges asyncSetSourceSoundProperties
- */
- virtual void ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * acknowledges asyncSetSourceSoundProperty
- */
- virtual void ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * acknowledges asyncCrossFade
- */
- virtual void ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error) =0;
- /**
- * acknowledges a volume tick. This can be used to display volumechanges during
- * ramps
- */
- virtual void ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) =0;
- /**
- * acknowledges a volume tick. This can be used to display volumechanges during
- * ramps
- */
- virtual void ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) =0;
- /**
- * This function returns the ID to the given domainName. If already a domain is
- * registered with this name, it will return the corresponding ID, if not it will
- * reserve an ID but not register the domain. The other parameters of the domain
- * will be overwritten when the domain is registered.
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID) =0;
- /**
- * registers a domain
- * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on
- * error
- */
- virtual am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
- /**
- * deregisters a domain. All sources, sinks, gateways and crossfaders from that
- * domain will be removed as well.
- * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
- */
- virtual am_Error_e deregisterDomain(const am_domainID_t domainID) =0;
- /**
- * registers a gateway. @return E_OK on succes, E_ALREADY_EXISTENT if already
- * registered E_UNKOWN on error
- */
- virtual am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
- /**
- * deregisters a gateway. Also removes all sinks and sources of the controlling
- * domain.
- * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
- */
- virtual am_Error_e deregisterGateway(const am_gatewayID_t gatewayID) =0;
- /**
- * This function returns the ID to the given sinkName. If already a sink is
- * registered with this name, it will return the corresponding ID, if not it will
- * reserve an ID but not register the sink. The other parameters of the sink will
- * be overwritten when the sink is registered.
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID) =0;
- /**
- * Registers a sink. If the sink is part of a gateway, the listconnectionFormats
- * is copied to the gatewayInformation
- * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on
- * error
- */
- virtual am_Error_e registerSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
- /**
- * deregisters a sink.
- * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
- */
- virtual am_Error_e deregisterSink(const am_sinkID_t sinkID) =0;
- /**
- * This function returns the ID to the given sourceName. If already a source is
- * registered with this name, it will return the corresponding ID, if not it will
- * reserve an ID but not register the source. The other parameters of the source
- * will be overwritten when the source is registered.
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID) =0;
- /**
- * registers a source. If the source is part of a gateway, the
- * listconnectionFormats is copied to the gatewayInformation
- * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXIST if either name or
- * sourceID already exists
- */
- virtual am_Error_e registerSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
- /**
- * deregisters a source
- * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
- */
- virtual am_Error_e deregisterSource(const am_sourceID_t sourceID) =0;
- /**
- * this function registers a crossfader.
- * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on
- * error
- */
- virtual am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
- /**
- * this function deregisters a crossfader. removes all sources and sinks assiated
- * as well.
- * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
- */
- 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
- */
- 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
- */
- virtual am_Error_e peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID) =0;
- /**
- * is called when a low level interrupt changes it status.
- */
- virtual void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) =0;
- /**
- * This hook is called when all elements from a domain are registered.
- * Is used by the Controller to know when all expected domains are finally
- * registered
- */
- virtual void hookDomainRegistrationComplete(const am_domainID_t domainID) =0;
- /**
- * is called when a sink changes its availability
- */
- virtual void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
- /**
- * is called when a source changes its availability
- */
- virtual void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
- /**
- * is called when a domain changes its status. This used for early domains only
- */
- virtual void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
- /**
- * is called when the timinginformation (delay) changed for a connection.
- */
- 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.
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual void sendChangedData(const std::vector<am_EarlyData_s>& earlyData) =0;
- /**
- * this function is used to retrieve a pointer to the dBusConnectionWrapper
- * @return E_OK if pointer is valid, E_UKNOWN if AudioManager was compiled without
- * DBus Support
- */
- virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
- /**
- * This function returns the pointer to the socketHandler. This can be used to
- * integrate socket-based activites like communication with the mainloop of the
- * AudioManager.
- * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled
- * without socketHandler support,
- */
- virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
- /**
- * confirms the setRoutingReady Command
- */
- virtual void confirmRoutingReady(const uint16_t handle, const am_Error_e error) =0;
- /**
- * confirms the setRoutingRundown Command
- */
- virtual void confirmRoutingRundown(const uint16_t handle, const am_Error_e error) =0;
- /**
- * updates data of an gateway. @return E_OK on success, E_NON_EXISTENT if the
- * gatewayID is not valid.
- */
- virtual am_Error_e updateGateway(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix) =0;
- /**
- * updates data of an gateway. @return E_OK on success, E_NON_EXISTENT if the
- * sinkID is not valid.
- */
- virtual am_Error_e updateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
- /**
- * updates data of an source. @return E_OK on success, E_NON_EXISTENT if the
- * sourceID in the struct is not valid.
- * Please note that only the following data out of am_Source_s have effect when
- * they are changed:
- * sourceClassID,
- * listSoundProperties,
- * listConnectionFormats,
- * listMainSoundProperties
- */
- virtual am_Error_e updateSource(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
- /**
- * acknowledges a asyncSetSinkVolumes
- */
- virtual void ackSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listvolumes, const am_Error_e error) =0;
- /**
- * The acknowledge of the SinkNotificationConfiguration
- */
- virtual void ackSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * The acknowledge of the SourceNotificationConfiguration
- */
- virtual void ackSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
- /**
- * is called whenever a notified value needs to be send
- */
- virtual void hookSinkNotificationDataChange(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload) =0;
- /**
- * is called whenever a notified value needs to be send
- */
- virtual void hookSourceNotificationDataChange(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) =0;
-
-};
-}
-#endif // !defined(EA_C540B86A_9F4A_4ae5_A68A_8A0FD52A7149__INCLUDED_)
+/**
+ * Copyright (C) 2012 - 2014, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
+ *
+ * \file
+ * For further information see http://projects.genivi.org/audio-manager
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
+ * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
+ */
+#if !defined(EA_CFDD6028_596E_4fde_8D52_BED642D0842D__INCLUDED_)
+#define EA_CFDD6028_596E_4fde_8D52_BED642D0842D__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+
+namespace am {
+class CAmDbusWrapper;
+class CAmSocketHandler;
+}
+
+
+#include "audiomanagertypes.h"
+
+#define RoutingReceiveVersion "3.0"
+namespace am {
+
+/**
+ * Routing Receive sendInterface description. This class implements everything
+ * from RoutingAdapter -> Audiomanager
+ * There are two rules that have to be kept in mind when implementing against this
+ * interface:\n
+ * \warning
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
+ * CALL THAT EXPECTS A RETURN VALUE.\n
+ * \details
+ * Violation these rules may lead to unexpected behavior! Nevertheless you can
+ * implement thread safe by using the deferred-call pattern described on the wiki
+ * which also helps to implement calls that are forbidden.\n
+ * For more information, please check CAmSerializer
+ */
+class IAmRoutingReceive
+{
+
+public:
+ IAmRoutingReceive() {
+
+ }
+
+ virtual ~IAmRoutingReceive() {
+
+ }
+
+ /**
+ * This function returns the version of the interface
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * acknowledges a asyncConnect
+ */
+ virtual void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) =0;
+ /**
+ * acknowledges a asyncDisconnect
+ */
+ virtual void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) =0;
+ /**
+ * acknowledges a asyncsetSinkVolume
+ */
+ virtual void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
+ /**
+ * acknowledges a asyncsetSourceVolume
+ */
+ virtual void ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) =0;
+ /**
+ * acknowlegde for asyncSetSourceState
+ */
+ virtual void ackSetSourceState(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncSetSinkSoundProperties
+ */
+ virtual void ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncSetSinkSoundProperty
+ */
+ virtual void ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncSetSourceSoundProperties
+ */
+ virtual void ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncSetSourceSoundProperty
+ */
+ virtual void ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * acknowledges asyncCrossFade
+ */
+ virtual void ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error) =0;
+ /**
+ * acknowledges a volume tick. This can be used to display volumechanges during
+ * ramps
+ */
+ virtual void ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) =0;
+ /**
+ * acknowledges a volume tick. This can be used to display volumechanges during
+ * ramps
+ */
+ virtual void ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) =0;
+ /**
+ * This function returns the ID to the given domainName. If already a domain is
+ * registered with this name, it will return the corresponding ID, if not it will
+ * reserve an ID but not register the domain. The other parameters of the domain
+ * will be overwritten when the domain is registered.
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID) =0;
+ /**
+ * registers a domain
+ * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on
+ * error
+ */
+ virtual am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID) =0;
+ /**
+ * deregisters a domain. All sources, sinks, gateways and crossfaders from that
+ * domain will be removed as well.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ */
+ virtual am_Error_e deregisterDomain(const am_domainID_t domainID) =0;
+ /**
+ * registers a converter. @return E_OK on succes, E_ALREADY_EXISTENT if already
+ * registered E_UNKOWN on error
+ */
+ virtual am_Error_e registerConverter(const am_Converter_s& converterData, am_converterID_t& converterID) =0;
+ /**
+ * registers a gateway. @return E_OK on succes, E_ALREADY_EXISTENT if already
+ * registered E_UNKOWN on error
+ */
+ virtual am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) =0;
+ /**
+ * deregisters a converter. Also removes all sinks and sources of the controlling
+ * domain.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ */
+ virtual am_Error_e deregisterConverter(const am_converterID_t converterID) =0;
+ /**
+ * deregisters a gateway. Also removes all sinks and sources of the controlling
+ * domain.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ */
+ virtual am_Error_e deregisterGateway(const am_gatewayID_t gatewayID) =0;
+ /**
+ * This function returns the ID to the given sinkName. If already a sink is
+ * registered with this name, it will return the corresponding ID, if not it will
+ * reserve an ID but not register the sink. The other parameters of the sink will
+ * be overwritten when the sink is registered.
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID) =0;
+ /**
+ * Registers a sink. If the sink is part of a gateway, the listconnectionFormats
+ * is copied to the gatewayInformation
+ * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on
+ * error
+ */
+ virtual am_Error_e registerSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) =0;
+ /**
+ * deregisters a sink.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ */
+ virtual am_Error_e deregisterSink(const am_sinkID_t sinkID) =0;
+ /**
+ * This function returns the ID to the given sourceName. If already a source is
+ * registered with this name, it will return the corresponding ID, if not it will
+ * reserve an ID but not register the source. The other parameters of the source
+ * will be overwritten when the source is registered.
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID) =0;
+ /**
+ * registers a source. If the source is part of a gateway, the
+ * listconnectionFormats is copied to the gatewayInformation
+ * @return E_OK on success, E_UNKNOWN on error, E_ALREADY_EXIST if either name or
+ * sourceID already exists
+ */
+ virtual am_Error_e registerSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) =0;
+ /**
+ * deregisters a source
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ */
+ virtual am_Error_e deregisterSource(const am_sourceID_t sourceID) =0;
+ /**
+ * this function registers a crossfader.
+ * @return E_OK on succes, E_ALREADY_EXISTENT if already registered E_UNKOWN on
+ * error
+ */
+ virtual am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) =0;
+ /**
+ * this function deregisters a crossfader. removes all sources and sinks assiated
+ * as well.
+ * @return E_OK on succes, E_NON_EXISTENT if not found E_UNKOWN on error
+ */
+ 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
+ */
+ 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
+ */
+ virtual am_Error_e peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID) =0;
+ /**
+ * is called when a low level interrupt changes it status.
+ */
+ virtual void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) =0;
+ /**
+ * This hook is called when all elements from a domain are registered.
+ * Is used by the Controller to know when all expected domains are finally
+ * registered
+ */
+ virtual void hookDomainRegistrationComplete(const am_domainID_t domainID) =0;
+ /**
+ * is called when a sink changes its availability
+ */
+ virtual void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability) =0;
+ /**
+ * is called when a source changes its availability
+ */
+ virtual void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability) =0;
+ /**
+ * is called when a domain changes its status. This used for early domains only
+ */
+ virtual void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
+ /**
+ * is called when the timinginformation (delay) changed for a connection.
+ */
+ 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.
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual void sendChangedData(const std::vector<am_EarlyData_s>& earlyData) =0;
+ /**
+ * this function is used to retrieve a pointer to the dBusConnectionWrapper
+ * @return E_OK if pointer is valid, E_UKNOWN if AudioManager was compiled without
+ * DBus Support
+ */
+ virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
+ /**
+ * This function returns the pointer to the socketHandler. This can be used to
+ * integrate socket-based activites like communication with the mainloop of the
+ * AudioManager.
+ * returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled
+ * without socketHandler support,
+ */
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
+ /**
+ * confirms the setRoutingReady Command
+ */
+ virtual void confirmRoutingReady(const uint16_t handle, const am_Error_e error) =0;
+ /**
+ * confirms the setRoutingRundown Command
+ */
+ virtual void confirmRoutingRundown(const uint16_t handle, const am_Error_e error) =0;
+ /**
+ * updates data of an converter. @return E_OK on success, E_NON_EXISTENT if the
+ * gatewayID is not valid.
+ */
+ virtual am_Error_e updateConverter(const am_converterID_t converterID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix) =0;
+ /**
+ * updates data of an gateway. @return E_OK on success, E_NON_EXISTENT if the
+ * gatewayID is not valid.
+ */
+ virtual am_Error_e updateGateway(const am_gatewayID_t gatewayID, const std::vector<am_CustomConnectionFormat_t>& listSourceFormats, const std::vector<am_CustomConnectionFormat_t>& listSinkFormats, const std::vector<bool>& convertionMatrix) =0;
+ /**
+ * updates data of an gateway. @return E_OK on success, E_NON_EXISTENT if the
+ * sinkID is not valid.
+ */
+ virtual am_Error_e updateSink(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
+ /**
+ * updates data of an source. @return E_OK on success, E_NON_EXISTENT if the
+ * sourceID in the struct is not valid.
+ * Please note that only the following data out of am_Source_s have effect when
+ * they are changed:
+ * sourceClassID,
+ * listSoundProperties,
+ * listConnectionFormats,
+ * listMainSoundProperties
+ */
+ virtual am_Error_e updateSource(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomConnectionFormat_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties) =0;
+ /**
+ * acknowledges a asyncSetSinkVolumes
+ */
+ virtual void ackSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listvolumes, const am_Error_e error) =0;
+ /**
+ * The acknowledge of the SinkNotificationConfiguration
+ */
+ virtual void ackSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * The acknowledge of the SourceNotificationConfiguration
+ */
+ virtual void ackSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) =0;
+ /**
+ * is called whenever a notified value needs to be send
+ */
+ virtual void hookSinkNotificationDataChange(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload) =0;
+ /**
+ * is called whenever a notified value needs to be send
+ */
+ virtual void hookSourceNotificationDataChange(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) =0;
+
+};
+}
+#endif // !defined(EA_CFDD6028_596E_4fde_8D52_BED642D0842D__INCLUDED_)
diff --git a/include/routing/IAmRoutingSend.h b/include/routing/IAmRoutingSend.h
index d9aeb3c..c9b3d01 100755
--- a/include/routing/IAmRoutingSend.h
+++ b/include/routing/IAmRoutingSend.h
@@ -1,184 +1,185 @@
-/**
- * Copyright (C) 2012 - 2014, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
- *
- * \file
- * For further information see http://projects.genivi.org/audio-manager
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
- * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
- */
-#if !defined(EA_75F8849C_0F4B_4641_B0B9_01DE137E6938__INCLUDED_)
-#define EA_75F8849C_0F4B_4641_B0B9_01DE137E6938__INCLUDED_
-
-#include <vector>
-#include <string>
-#include "audiomanagertypes.h"
-namespace am {
-class IAmRoutingReceive;
-}
-
-#include "audiomanagertypes.h"
-#include "IAmRoutingReceive.h"
-
-#define RoutingSendVersion "3.0"
-namespace am {
-
-/**
- * This class implements everything from Audiomanager -> RoutingAdapter
- * There are two rules that have to be kept in mind when implementing against this
- * interface:\n
- * \warning
- * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
- * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
- * CALL THAT EXPECTS A RETURN VALUE.\n
- * \details
- * Violation these rules may lead to unexpected behavior! Nevertheless you can
- * implement thread safe by using the deferred-call pattern described on the wiki
- * which also helps to implement calls that are forbidden.\n
- * For more information, please check CAmSerializer
- */
-class IAmRoutingSend
-{
-
-public:
- IAmRoutingSend() {
-
- }
-
- virtual ~IAmRoutingSend() {
-
- }
-
- /**
- * This function returns the version of the interface
- */
- virtual void getInterfaceVersion(std::string& version) const =0;
- /**
- * starts up the interface. In the implementations, here is the best place for
- * init routines.
- */
- virtual am_Error_e startupInterface(IAmRoutingReceive* routingreceiveinterface) =0;
- /**
- * indicates that the routing now ready to be used. Should be used as trigger to
- * register all sinks, sources, etc...
- */
- virtual void setRoutingReady(const uint16_t handle) =0;
- /**
- * indicates that the routing plugins need to be prepared to switch the power off
- * or be ready again.
- */
- virtual void setRoutingRundown(const uint16_t handle) =0;
- /**
- * aborts an asynchronous action.
- * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if handle was not
- * found
- */
- virtual am_Error_e asyncAbort(const am_Handle_s handle) =0;
- /**
- * connects a source to a sink
- * @return E_OK on success, E_UNKNOWN on error, E_WRONG_FORMAT in case
- * am_ConnectionFormat_e does not match
- */
- virtual am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_CustomConnectionFormat_t connectionFormat) =0;
- /**
- * disconnect a connection with given connectionID
- * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if connection was
- * not found
- */
- virtual am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID) =0;
- /**
- * this method is used to set the volume of a sink. This function is used to drive
- * ramps, to mute or unmute or directly set the value. The difference is made
- * through the ramptype.
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if new volume is
- * out of range
- */
- virtual am_Error_e asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time) =0;
- /**
- * sets the volume of a source. This method is used to set the volume of a sink.
- * This function is used to drive ramps, to mute or unmute or directly set the
- * value. The difference is made through the ramptype.
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if volume is out of
- * range.
- * triggers the acknowledge ackSourceVolumeChange
- */
- virtual am_Error_e asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time) =0;
- /**
- * This function is used to set the source state of a particular source.
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) =0;
- /**
- * this function sets the sinksoundproperty.
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery
- * value is out of range
- */
- virtual am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties) =0;
- /**
- * this function sets the sinksoundproperty.
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery
- * value is out of range
- */
- virtual am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) =0;
- /**
- * this function sets the sourcesoundproperty.
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery
- * value is out of range
- */
- virtual am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties) =0;
- /**
- * this function sets the sourcesoundproperty.
- * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery
- * value is out of range
- */
- virtual am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) =0;
- /**
- * this function triggers crossfading.
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_CustomRampType_t rampType, const am_time_t time) =0;
- /**
- * this function is used for early and late audio functions to set the domain
- * state
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
- /**
- * this method is used to retrieve the busname during startup of the plugin. Needs
- * to be implemented
- * @return E_OK on success, E_UNKNOWN on error
- */
- virtual am_Error_e returnBusName(std::string& BusName) const =0;
- /**
- * This command sets multiple source or and sink volumes within a domain at a time.
- * It can be used to synchronize volume setting events.
- * @return E_OK on success, E_UNKNOWN on error.
- */
- virtual am_Error_e asyncSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes) =0;
- /**
- * sets the notification configuration of a sink.
- * @return E_OK on success, E_UNKNOWN on error.
- */
- virtual am_Error_e asyncSetSinkNotificationConfiguration(const am_Handle_s handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
- /**
- * sets the notification configuration of a source.
- * @return E_OK on success, E_UNKNOWN on error.
- */
- virtual am_Error_e asyncSetSourceNotificationConfiguration(const am_Handle_s handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
-
-};
-}
-#endif // !defined(EA_75F8849C_0F4B_4641_B0B9_01DE137E6938__INCLUDED_)
+/**
+ * Copyright (C) 2012 - 2014, BMW AG
+ *
+ * This file is part of GENIVI Project AudioManager.
+ *
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ *
+ * \author Christian Linke, christian.linke@bmw.de BMW 2011 - 2014
+ *
+ * \file
+ * For further information see http://projects.genivi.org/audio-manager
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL.
+ * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN.
+ */
+#if !defined(EA_F78CD115_BEE9_4caa_9112_1C297F24E2EB__INCLUDED_)
+#define EA_F78CD115_BEE9_4caa_9112_1C297F24E2EB__INCLUDED_
+
+#include <vector>
+#include <string>
+#include "audiomanagertypes.h"
+
+namespace am {
+class IAmRoutingReceive;
+}
+
+#include "IAmRoutingReceive.h"
+#include "audiomanagertypes.h"
+
+#define RoutingSendVersion "3.0"
+namespace am {
+
+/**
+ * This class implements everything from Audiomanager -> RoutingAdapter
+ * There are two rules that have to be kept in mind when implementing against this
+ * interface:\n
+ * \warning
+ * 1. CALLS TO THIS INTERFACE ARE NOT THREAD SAFE !!!! \n
+ * 2. YOU MAY NOT CALL THE CALLING INTERFACE DURING AN SYNCHRONOUS OR ASYNCHRONOUS
+ * CALL THAT EXPECTS A RETURN VALUE.\n
+ * \details
+ * Violation these rules may lead to unexpected behavior! Nevertheless you can
+ * implement thread safe by using the deferred-call pattern described on the wiki
+ * which also helps to implement calls that are forbidden.\n
+ * For more information, please check CAmSerializer
+ */
+class IAmRoutingSend
+{
+
+public:
+ IAmRoutingSend() {
+
+ }
+
+ virtual ~IAmRoutingSend() {
+
+ }
+
+ /**
+ * This function returns the version of the interface
+ */
+ virtual void getInterfaceVersion(std::string& version) const =0;
+ /**
+ * starts up the interface. In the implementations, here is the best place for
+ * init routines.
+ */
+ virtual am_Error_e startupInterface(IAmRoutingReceive* routingreceiveinterface) =0;
+ /**
+ * indicates that the routing now ready to be used. Should be used as trigger to
+ * register all sinks, sources, etc...
+ */
+ virtual void setRoutingReady(const uint16_t handle) =0;
+ /**
+ * indicates that the routing plugins need to be prepared to switch the power off
+ * or be ready again.
+ */
+ virtual void setRoutingRundown(const uint16_t handle) =0;
+ /**
+ * aborts an asynchronous action.
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if handle was not
+ * found
+ */
+ virtual am_Error_e asyncAbort(const am_Handle_s handle) =0;
+ /**
+ * connects a source to a sink
+ * @return E_OK on success, E_UNKNOWN on error, E_WRONG_FORMAT in case
+ * am_ConnectionFormat_e does not match
+ */
+ virtual am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_CustomConnectionFormat_t connectionFormat) =0;
+ /**
+ * disconnect a connection with given connectionID
+ * @return E_OK on success, E_UNKNOWN on error, E_NON_EXISTENT if connection was
+ * not found
+ */
+ virtual am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID) =0;
+ /**
+ * this method is used to set the volume of a sink. This function is used to drive
+ * ramps, to mute or unmute or directly set the value. The difference is made
+ * through the ramptype.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if new volume is
+ * out of range
+ */
+ virtual am_Error_e asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time) =0;
+ /**
+ * sets the volume of a source. This method is used to set the volume of a sink.
+ * This function is used to drive ramps, to mute or unmute or directly set the
+ * value. The difference is made through the ramptype.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE if volume is out of
+ * range.
+ * triggers the acknowledge ackSourceVolumeChange
+ */
+ virtual am_Error_e asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time) =0;
+ /**
+ * This function is used to set the source state of a particular source.
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) =0;
+ /**
+ * this function sets the sinksoundproperty.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery
+ * value is out of range
+ */
+ virtual am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties) =0;
+ /**
+ * this function sets the sinksoundproperty.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery
+ * value is out of range
+ */
+ virtual am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) =0;
+ /**
+ * this function sets the sourcesoundproperty.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery
+ * value is out of range
+ */
+ virtual am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties) =0;
+ /**
+ * this function sets the sourcesoundproperty.
+ * @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery
+ * value is out of range
+ */
+ virtual am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) =0;
+ /**
+ * this function triggers crossfading.
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_CustomRampType_t rampType, const am_time_t time) =0;
+ /**
+ * this function is used for early and late audio functions to set the domain
+ * state
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) =0;
+ /**
+ * this method is used to retrieve the busname during startup of the plugin. Needs
+ * to be implemented
+ * @return E_OK on success, E_UNKNOWN on error
+ */
+ virtual am_Error_e returnBusName(std::string& BusName) const =0;
+ /**
+ * This command sets multiple source or and sink volumes within a domain at a time.
+ * It can be used to synchronize volume setting events.
+ * @return E_OK on success, E_UNKNOWN on error.
+ */
+ virtual am_Error_e asyncSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes) =0;
+ /**
+ * sets the notification configuration of a sink.
+ * @return E_OK on success, E_UNKNOWN on error.
+ */
+ virtual am_Error_e asyncSetSinkNotificationConfiguration(const am_Handle_s handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
+ /**
+ * sets the notification configuration of a source.
+ * @return E_OK on success, E_UNKNOWN on error.
+ */
+ virtual am_Error_e asyncSetSourceNotificationConfiguration(const am_Handle_s handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) =0;
+
+};
+}
+#endif // !defined(EA_F78CD115_BEE9_4caa_9112_1C297F24E2EB__INCLUDED_)