summaryrefslogtreecommitdiff
path: root/AudioManagerCore/include
diff options
context:
space:
mode:
Diffstat (limited to 'AudioManagerCore/include')
-rw-r--r--AudioManagerCore/include/CAmCommandReceiver.h66
-rw-r--r--AudioManagerCore/include/CAmCommandSender.h52
-rw-r--r--AudioManagerCore/include/CAmControlReceiver.h168
-rw-r--r--AudioManagerCore/include/CAmControlSender.h157
-rw-r--r--AudioManagerCore/include/CAmDatabaseHandlerMap.h710
-rw-r--r--AudioManagerCore/include/CAmGraph.h1329
-rw-r--r--AudioManagerCore/include/CAmLog.h126
-rw-r--r--AudioManagerCore/include/CAmRouter.h633
-rw-r--r--AudioManagerCore/include/CAmRoutingReceiver.h84
-rw-r--r--AudioManagerCore/include/CAmRoutingSender.h525
-rw-r--r--AudioManagerCore/include/IAmDatabaseHandler.h237
11 files changed, 2117 insertions, 1970 deletions
diff --git a/AudioManagerCore/include/CAmCommandReceiver.h b/AudioManagerCore/include/CAmCommandReceiver.h
index 0f30d81..9080b25 100644
--- a/AudioManagerCore/include/CAmCommandReceiver.h
+++ b/AudioManagerCore/include/CAmCommandReceiver.h
@@ -37,39 +37,39 @@ class CAmSocketHandler;
/**
* This class realizes the command Interface
*/
-class CAmCommandReceiver: public IAmCommandReceive
+class CAmCommandReceiver : public IAmCommandReceive
{
public:
- CAmCommandReceiver(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler);
- CAmCommandReceiver(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler, CAmDbusWrapper* iDBusWrapper);
+ CAmCommandReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler);
+ CAmCommandReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper);
~CAmCommandReceiver();
- am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID);
+ am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t &mainConnectionID);
am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID);
am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume);
am_Error_e volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep);
am_Error_e setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState);
- am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
- am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
- am_Error_e setSystemProperty(const am_SystemProperty_s& property);
- am_Error_e getVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) const;
- am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const;
- am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const;
- am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const;
- am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const;
- am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const;
- am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
- am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
- am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
- am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const;
- am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const;
- am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const;
+ am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s &soundProperty, const am_sinkID_t sinkID);
+ am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s &soundProperty, const am_sourceID_t sourceID);
+ am_Error_e setSystemProperty(const am_SystemProperty_s &property);
+ am_Error_e getVolume(const am_sinkID_t sinkID, am_mainVolume_t &mainVolume) const;
+ am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s> &listConnections) const;
+ am_Error_e getListMainSinks(std::vector<am_SinkType_s> &listMainSinks) const;
+ am_Error_e getListMainSources(std::vector<am_SourceType_s> &listMainSources) const;
+ am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> &listSoundProperties) const;
+ am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> &listSourceProperties) const;
+ am_Error_e getListSourceClasses(std::vector<am_SourceClass_s> &listSourceClasses) const;
+ am_Error_e getListSinkClasses(std::vector<am_SinkClass_s> &listSinkClasses) const;
+ am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s> &listSystemProperties) const;
+ am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t &delay) const;
+ am_Error_e getDBusConnectionWrapper(CAmDbusWrapper * &dbusConnectionWrapper) const;
+ am_Error_e getSocketHandler(CAmSocketHandler * &socketHandler) const;
void confirmCommandReady(const uint16_t handle, const am_Error_e error);
void confirmCommandRundown(const uint16_t handle, const am_Error_e error);
- void getInterfaceVersion(std::string& version) const;
- am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const ;
- am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) const ;
- am_Error_e setMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
- am_Error_e setMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
+ void getInterfaceVersion(std::string &version) const;
+ am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s> &listMainNotificationConfigurations) const;
+ am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s> &listMainNotificationConfigurations) const;
+ am_Error_e setMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s &mainNotificationConfiguration);
+ am_Error_e setMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s &mainNotificationConfiguration);
uint16_t getStartupHandle(); //!< returns a startup handle
uint16_t getRundownHandle(); //!< returns a rundown handle
@@ -78,18 +78,18 @@ public:
void waitOnRundown(bool rundown); //!< tells the ComandReceiver to start waiting for all handles to be confirmed
private:
- IAmDatabaseHandler* mDatabaseHandler; //!< pointer to the databasehandler
- CAmControlSender* mControlSender; //!< pointer to the control sender
- CAmDbusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper
- CAmSocketHandler* mSocketHandler; //!< pointer to the SocketHandler
+ IAmDatabaseHandler *mDatabaseHandler; //!< pointer to the databasehandler
+ CAmControlSender *mControlSender; //!< pointer to the control sender
+ CAmDbusWrapper *mDBusWrapper; //!< pointer to the dbuswrapper
+ CAmSocketHandler *mSocketHandler; //!< pointer to the SocketHandler
- uint16_t handleCount; //!< counts all handles
+ uint16_t handleCount; //!< counts all handles
std::vector<uint16_t> mListStartupHandles; //!< list of handles that wait for a confirm
std::vector<uint16_t> mListRundownHandles; //!< list of handles that wait for a confirm
- bool mWaitStartup; //!< if true confirmation will be sent if list of handles = 0
- bool mWaitRundown; //!< if true confirmation will be sent if list of handles = 0
- am_Error_e mLastErrorStartup;
- am_Error_e mLastErrorRundown;
+ bool mWaitStartup; //!< if true confirmation will be sent if list of handles = 0
+ bool mWaitRundown; //!< if true confirmation will be sent if list of handles = 0
+ am_Error_e mLastErrorStartup;
+ am_Error_e mLastErrorRundown;
};
}
diff --git a/AudioManagerCore/include/CAmCommandSender.h b/AudioManagerCore/include/CAmCommandSender.h
index c9f8fb6..5646282 100644
--- a/AudioManagerCore/include/CAmCommandSender.h
+++ b/AudioManagerCore/include/CAmCommandSender.h
@@ -25,7 +25,7 @@
#define COMMANDSENDER_H_
#ifdef UNIT_TEST
-#include "../test/IAmCommandBackdoor.h" //we need this for the unit test
+# include "../test/IAmCommandBackdoor.h" // we need this for the unit test
#endif
#include "IAmCommand.h"
@@ -38,17 +38,16 @@ namespace am
class CAmCommandReceiver;
class CAmCommandSender;
-
/**
* This class is used to send data to the CommandInterface.
* All loaded plugins will be called when a callback is invoked.
*/
-class CAmCommandSender: public CAmDatabaseHandlerMap::AmDatabaseObserverCallbacks
+class CAmCommandSender : public CAmDatabaseHandlerMap::AmDatabaseObserverCallbacks
{
public:
- CAmCommandSender(const std::vector<std::string>& listOfPluginDirectories, CAmSocketHandler *iSocketHandler);
+ CAmCommandSender(const std::vector<std::string> &listOfPluginDirectories, CAmSocketHandler *iSocketHandler);
~CAmCommandSender();
- am_Error_e startupInterfaces(CAmCommandReceiver* iCommandReceiver);
+ am_Error_e startupInterfaces(CAmCommandReceiver *iCommandReceiver);
void setCommandReady();
void setCommandRundown();
void cbNewMainConnection(const am_MainConnectionType_s mainConnection);
@@ -60,38 +59,37 @@ public:
void cbNumberOfSinkClassesChanged();
void cbNumberOfSourceClassesChanged();
void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState);
- void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty);
- void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty);
- void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability);
- void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s &soundProperty);
+ void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s &soundProperty);
+ void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s &availability);
+ void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s &availability);
void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume);
void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
- void cbSystemPropertyChanged(const am_SystemProperty_s& systemProperty);
+ void cbSystemPropertyChanged(const am_SystemProperty_s &systemProperty);
void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
- void getInterfaceVersion(std::string& version) const;
- am_Error_e getListPlugins(std::vector<std::string>& interfaces) const;
- void cbSinkUpdated(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
- void cbSourceUpdated(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
- void cbSinkNotification(const am_sinkID_t sinkID, const am_NotificationPayload_s& notification);
- void cbSourceNotification(const am_sourceID_t sourceID, const am_NotificationPayload_s& notification);
- void cbSinkMainNotificationConfigurationChanged(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration);
- void cbSourceMainNotificationConfigurationChanged(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration);
+ void getInterfaceVersion(std::string &version) const;
+ am_Error_e getListPlugins(std::vector<std::string> &interfaces) const;
+ void cbSinkUpdated(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s> &listMainSoundProperties);
+ void cbSourceUpdated(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s> &listMainSoundProperties);
+ void cbSinkNotification(const am_sinkID_t sinkID, const am_NotificationPayload_s &notification);
+ void cbSourceNotification(const am_sourceID_t sourceID, const am_NotificationPayload_s &notification);
+ void cbSinkMainNotificationConfigurationChanged(const am_sinkID_t sinkID, const am_NotificationConfiguration_s &mainNotificationConfiguration);
+ void cbSourceMainNotificationConfigurationChanged(const am_sourceID_t sourceID, const am_NotificationConfiguration_s &mainNotificationConfiguration);
#ifdef UNIT_TEST
- friend class IAmCommandBackdoor; //this is to get access to the loaded plugins and be able to exchange the interfaces
+ friend class IAmCommandBackdoor; // this is to get access to the loaded plugins and be able to exchange the interfaces
#endif
private:
- void loadPlugins(const std::vector<std::string>& listOfPluginDirectories);
+ void loadPlugins(const std::vector<std::string> &listOfPluginDirectories);
void unloadLibraries(void); //!< unload the shared libraries
- std::vector<IAmCommandSend*> mListInterfaces; //!< list of all interfaces
- std::vector<void*> mListLibraryHandles; //!< list of all library handles. This information is used to unload the plugins correctly.
- std::vector<std::string> mListLibraryNames; //!< list of all library names. This information is used for getListPlugins.
-
- CAmCommandReceiver *mCommandReceiver;
- V2::CAmSerializer mSerializer;
-};
+ std::vector<IAmCommandSend *> mListInterfaces; //!< list of all interfaces
+ std::vector<void *> mListLibraryHandles; //!< list of all library handles. This information is used to unload the plugins correctly.
+ std::vector<std::string> mListLibraryNames; //!< list of all library names. This information is used for getListPlugins.
+ CAmCommandReceiver *mCommandReceiver;
+ V2::CAmSerializer mSerializer;
+};
}
diff --git a/AudioManagerCore/include/CAmControlReceiver.h b/AudioManagerCore/include/CAmControlReceiver.h
index 897ac5e..36c4d14 100644
--- a/AudioManagerCore/include/CAmControlReceiver.h
+++ b/AudioManagerCore/include/CAmControlReceiver.h
@@ -39,46 +39,46 @@ class CAmNodeStateCommunicator;
/**
* This class is used to receive all commands from the control interface
*/
-class CAmControlReceiver: public IAmControlReceive
+class CAmControlReceiver : public IAmControlReceive
{
public:
- CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter);
+ CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter *iRouter);
~CAmControlReceiver();
- 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 connect(am_Handle_s& handle, am_connectionID_t& connectionID, const am_CustomConnectionFormat_t format, const am_sourceID_t sourceID, const am_sinkID_t sinkID);
- am_Error_e disconnect(am_Handle_s& handle, const am_connectionID_t connectionID);
- 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);
+ 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 connect(am_Handle_s &handle, am_connectionID_t &connectionID, const am_CustomConnectionFormat_t format, const am_sourceID_t sourceID, const am_sinkID_t sinkID);
+ am_Error_e disconnect(am_Handle_s &handle, const am_connectionID_t connectionID);
+ 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);
am_Error_e abortAction(const am_Handle_s handle);
- am_Error_e setSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state);
- 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);
- 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);
- am_Error_e setSinkSoundProperties(am_Handle_s& handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& soundProperty);
- am_Error_e setSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty);
- am_Error_e setSourceSoundProperties(am_Handle_s& handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& soundProperty);
- am_Error_e setSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty);
+ am_Error_e setSourceState(am_Handle_s &handle, const am_sourceID_t sourceID, const am_SourceState_e state);
+ 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);
+ 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);
+ am_Error_e setSinkSoundProperties(am_Handle_s &handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> &soundProperty);
+ am_Error_e setSinkSoundProperty(am_Handle_s &handle, const am_sinkID_t sinkID, const am_SoundProperty_s &soundProperty);
+ am_Error_e setSourceSoundProperties(am_Handle_s &handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> &soundProperty);
+ am_Error_e setSourceSoundProperty(am_Handle_s &handle, const am_sourceID_t sourceID, const am_SoundProperty_s &soundProperty);
am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState);
- am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID);
- am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID);
- 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);
- am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass);
- am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass);
- am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties);
- am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID);
+ am_Error_e enterDomainDB(const am_Domain_s &domainData, am_domainID_t &domainID);
+ am_Error_e enterMainConnectionDB(const am_MainConnection_s &mainConnectionData, am_mainConnectionID_t &connectionID);
+ 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);
+ am_Error_e changeSinkClassInfoDB(const am_SinkClass_s &sinkClass);
+ am_Error_e changeSourceClassInfoDB(const am_SourceClass_s &sourceClass);
+ am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s> &listSystemProperties);
+ am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t> &listConnectionID);
am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState);
am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID);
- am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID);
+ am_Error_e changeSinkAvailabilityDB(const am_Availability_s &availability, const am_sinkID_t sinkID);
am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID);
am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID);
- am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
- am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
- am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID);
- am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property);
+ am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sinkID_t sinkID);
+ am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sourceID_t sourceID);
+ am_Error_e changeSourceAvailabilityDB(const am_Availability_s &availability, const am_sourceID_t sourceID);
+ am_Error_e changeSystemPropertyDB(const am_SystemProperty_s &property);
am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID);
am_Error_e removeSinkDB(const am_sinkID_t sinkID);
am_Error_e removeSourceDB(const am_sourceID_t sourceID);
@@ -88,68 +88,68 @@ public:
am_Error_e removeDomainDB(const am_domainID_t domainID);
am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID);
- am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const;
- am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const;
- am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s& sinkData) const;
- am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s& sourceData) const;
- am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const;
- am_Error_e 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;
- am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const;
- am_Error_e getListSources(std::vector<am_Source_s>& listSources) const;
- am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
- 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;
+ am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s &classInfo) const;
+ am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s &sinkClass) const;
+ am_Error_e getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s &sinkData) const;
+ am_Error_e getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s &sourceData) const;
+ am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s &gatewayData) const;
+ am_Error_e 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;
+ am_Error_e getListSinks(std::vector<am_Sink_s> &listSinks) const;
+ am_Error_e getListSources(std::vector<am_Source_s> &listSources) const;
+ am_Error_e getListSourceClasses(std::vector<am_SourceClass_s> &listSourceClasses) const;
+ 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();
void setCommandRundown();
void setRoutingReady();
void setRoutingRundown();
void confirmControllerReady(const am_Error_e error);
void confirmControllerRundown(const am_Error_e error);
- am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler);
- void getInterfaceVersion(std::string& version) const;
- am_Error_e changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_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) ;
- void sendMainSinkNotificationPayload(const am_sinkID_t sinkID, const am_NotificationPayload_s& notificationPayload) ;
- void sendMainSourceNotificationPayload(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload) ;
- 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 getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundproperties) const;
- am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSoundproperties) const;
- am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s>& listSoundproperties) const;
- am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s>& listSoundproperties) const;
- am_Error_e getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e resyncConnectionState(const am_domainID_t domainID, std::vector<am_Connection_s>& listOfExistingConnections);
+ am_Error_e getSocketHandler(CAmSocketHandler * &socketHandler);
+ void getInterfaceVersion(std::string &version) const;
+ am_Error_e changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s> &listSoundProperties, const std::vector<am_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);
+ void sendMainSinkNotificationPayload(const am_sinkID_t sinkID, const am_NotificationPayload_s &notificationPayload);
+ void sendMainSourceNotificationPayload(const am_sourceID_t sourceID, const am_NotificationPayload_s &notificationPayload);
+ 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 getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> &listSoundproperties) const;
+ am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> &listSoundproperties) const;
+ am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s> &listSoundproperties) const;
+ am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s> &listSoundproperties) const;
+ am_Error_e getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t &value) const;
+ am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t &value) const;
+ am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t &value) const;
+ am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t &value) const;
+ am_Error_e resyncConnectionState(const am_domainID_t domainID, std::vector<am_Connection_s> &listOfExistingConnections);
am_Error_e removeHandle(const am_Handle_s handle);
private:
- IAmDatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler
- CAmRoutingSender* mRoutingSender; //!< pointer to the routing send interface.
- CAmCommandSender* mCommandSender; //!< pointer to the command send interface
- CAmSocketHandler* mSocketHandler; //!< pointer to the socketHandler
- CAmRouter* mRouter; //!< pointer to the Router
- CAmNodeStateCommunicator* mNodeStateCommunicator;
+ IAmDatabaseHandler *mDatabaseHandler; //!< pointer tto the databasehandler
+ CAmRoutingSender *mRoutingSender; //!< pointer to the routing send interface.
+ CAmCommandSender *mCommandSender; //!< pointer to the command send interface
+ CAmSocketHandler *mSocketHandler; //!< pointer to the socketHandler
+ CAmRouter *mRouter; //!< pointer to the Router
+ CAmNodeStateCommunicator *mNodeStateCommunicator;
};
}
diff --git a/AudioManagerCore/include/CAmControlSender.h b/AudioManagerCore/include/CAmControlSender.h
index 2c31cf9..6d6a562 100644
--- a/AudioManagerCore/include/CAmControlSender.h
+++ b/AudioManagerCore/include/CAmControlSender.h
@@ -25,7 +25,7 @@
#define CONTROLSENDER_H_
#ifdef UNIT_TEST
-#include "../test/IAmControlBackdoor.h"
+# include "../test/IAmControlBackdoor.h"
#endif
#include "IAmControl.h"
@@ -41,95 +41,96 @@ namespace am
class CAmControlSender
{
public:
- CAmControlSender(std::string controlPluginFile,CAmSocketHandler* sockethandler);
+ CAmControlSender(std::string controlPluginFile, CAmSocketHandler *sockethandler);
CAmControlSender();
~CAmControlSender();
- am_Error_e startupController(IAmControlReceive* controlreceiveinterface) ;
- void setControllerReady() ;
- void setControllerRundown(const int16_t signal) ;
- am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) ;
- am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID) ;
- am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) ;
- am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) ;
- am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property) ;
- am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume) ;
- am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment) ;
- am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
- am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID) ;
- am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID) ;
- void hookSystemDomainRegistrationComplete(const am_domainID_t domainID) ;
- am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) ;
- am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID) ;
- 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) ;
- void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) ;
- void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) ;
- void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
- void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
- void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state) ;
- void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data) ;
- void hookSystemSpeedChange(const am_speed_t speed) ;
- void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) ;
- void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID) ;
- void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) ;
- void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error) ;
- void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ;
- void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error) ;
- void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error) ;
- void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) ;
- void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) ;
- void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) ;
- void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) ;
- 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) ;
- void confirmCommandReady(const am_Error_e error) ;
- void confirmRoutingReady(const am_Error_e error) ;
- void confirmCommandRundown(const am_Error_e error) ;
- void confirmRoutingRundown(const am_Error_e error) ;
- void getInterfaceVersion(std::string& version) const ;
- 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) ;
- void hookSinkNotificationDataChanged(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload) ;
- void hookSourceNotificationDataChanged(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) ;
- am_Error_e hookUserSetMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) ;
- am_Error_e hookUserSetMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) ;
+ am_Error_e startupController(IAmControlReceive *controlreceiveinterface);
+ void setControllerReady();
+ void setControllerRundown(const int16_t signal);
+ am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t &mainConnectionID);
+ am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID);
+ am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s &soundProperty);
+ am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s &soundProperty);
+ am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s &property);
+ am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume);
+ am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment);
+ am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState);
+ am_Error_e hookSystemRegisterDomain(const am_Domain_s &domainData, am_domainID_t &domainID);
+ am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID);
+ void hookSystemDomainRegistrationComplete(const am_domainID_t domainID);
+ am_Error_e hookSystemRegisterSink(const am_Sink_s &sinkData, am_sinkID_t &sinkID);
+ am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID);
+ 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);
+ void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume);
+ void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState);
+ void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s &availability);
+ void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s &availability);
+ void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state);
+ void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> &data);
+ void hookSystemSpeedChange(const am_speed_t speed);
+ void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
+ void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID);
+ void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID);
+ void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error);
+ void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
+ void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error);
+ void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error);
+ void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error);
+ void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error);
+ void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error);
+ void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error);
+ 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);
+ void confirmCommandReady(const am_Error_e error);
+ void confirmRoutingReady(const am_Error_e error);
+ void confirmCommandRundown(const am_Error_e error);
+ void confirmRoutingRundown(const am_Error_e error);
+ void getInterfaceVersion(std::string &version) const;
+ 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);
+ void hookSinkNotificationDataChanged(const am_sinkID_t sinkID, const am_NotificationPayload_s &payload);
+ void hookSourceNotificationDataChanged(const am_sourceID_t sourceID, const am_NotificationPayload_s &payload);
+ am_Error_e hookUserSetMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s &notificationConfiguration);
+ am_Error_e hookUserSetMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s &notificationConfiguration);
void hookSystemSingleTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t time);
- void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
- bool checkerCallback(const sh_pollHandle_t handle, void* userData);
- bool dispatcherCallback(const sh_pollHandle_t handle, void* userData);
+ void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void *userData);
+ bool checkerCallback(const sh_pollHandle_t handle, void *userData);
+ bool dispatcherCallback(const sh_pollHandle_t handle, void *userData);
void setControllerRundownSafe(int16_t signal)
{
int16_t p(signal);
ssize_t result(-1);
- result = write(mPipe[1], &p, sizeof(p));
- }
+ result = write(mPipe[1], &p, sizeof(p));
+ }
- TAmShPollFired<CAmControlSender> receiverCallbackT;
- TAmShPollCheck<CAmControlSender> checkerCallbackT;
+ TAmShPollFired<CAmControlSender> receiverCallbackT;
+ TAmShPollCheck<CAmControlSender> checkerCallbackT;
TAmShPollDispatch<CAmControlSender> dispatcherCallbackT;
-
- //we need this here to call the rundown from the signal handler. In case everything screwed up
+ // we need this here to call the rundown from the signal handler. In case everything screwed up
static void CallsetControllerRundown(int16_t signal)
{
if (mInstance)
+ {
mInstance->setControllerRundown(signal);
+ }
}
- //this static callback is used from the signal handler. It is used when a normal rundown is assumed and the mainloop is used to call rundown.
+ // this static callback is used from the signal handler. It is used when a normal rundown is assumed and the mainloop is used to call rundown.
static void CallsetControllerRundownSafe(int16_t signal)
{
if (mInstance)
@@ -142,12 +143,12 @@ public:
friend class IAmControlBackdoor;
#endif
private:
- int mPipe[2];
- void* mlibHandle; //!< pointer to the loaded control plugin interface
- IAmControlSend* mController; //!< pointer to the ControlSend interface
- static CAmControlSender* mInstance;
- int16_t mSignal;
- std::string mControlPluginFile;
+ int mPipe[2];
+ void *mlibHandle; //!< pointer to the loaded control plugin interface
+ IAmControlSend *mController; //!< pointer to the ControlSend interface
+ static CAmControlSender *mInstance;
+ int16_t mSignal;
+ std::string mControlPluginFile;
};
}
diff --git a/AudioManagerCore/include/CAmDatabaseHandlerMap.h b/AudioManagerCore/include/CAmDatabaseHandlerMap.h
index 2a3a9ec..93ee1be 100644
--- a/AudioManagerCore/include/CAmDatabaseHandlerMap.h
+++ b/AudioManagerCore/include/CAmDatabaseHandlerMap.h
@@ -14,7 +14,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
*
* \file CAmDatabaseHandlerMap.h
* For further information see http://www.genivi.org/.
@@ -37,114 +37,114 @@
namespace am
{
#ifndef AM_MAP_CAPACITY
- #define AM_MAP_CAPACITY 0
+# define AM_MAP_CAPACITY 0
#endif
#ifndef AM_MAX_CONNECTIONS
- #define AM_MAX_CONNECTIONS 0x1000
+# define AM_MAX_CONNECTIONS 0x1000
#endif
#ifndef AM_MAX_MAIN_CONNECTIONS
- #define AM_MAX_MAIN_CONNECTIONS SHRT_MAX
+# define AM_MAX_MAIN_CONNECTIONS SHRT_MAX
#endif
-
-
-//todo: check the enum values before entering & changing in the database.
-//todo: change asserts for dynamic boundary checks into failure answers.#
-//todo: check autoincrement boundary and set to 16bit limits
-//todo: If the sink is part of a gateway, the listconnectionFormats is copied to the gatewayInformation. Check this statement for sinks & sources
-//todo: exchange last_insert_row id to be more safe
-//todo: create test to ensure uniqueness of names throughout the database
-//todo: enforce the uniqueness of names
+// todo: check the enum values before entering & changing in the database.
+// todo: change asserts for dynamic boundary checks into failure answers.#
+// todo: check autoincrement boundary and set to 16bit limits
+// todo: If the sink is part of a gateway, the listconnectionFormats is copied to the gatewayInformation. Check this statement for sinks & sources
+// todo: exchange last_insert_row id to be more safe
+// todo: create test to ensure uniqueness of names throughout the database
+// todo: enforce the uniqueness of names
/**
* This class handles and abstracts the database
*/
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 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
+ bool mFirstStaticCrossfader; //!< bool for dynamic range handling
public:
- CAmDatabaseHandlerMap();
+ CAmDatabaseHandlerMap();
virtual ~CAmDatabaseHandlerMap();
/**
- * Database observer.
- */
- struct AmDatabaseObserverCallbacks: public IAmDatabaseObserver
+ * Database observer.
+ */
+ struct AmDatabaseObserverCallbacks : public IAmDatabaseObserver
{
protected:
- std::function<void()> dboNumberOfSinkClassesChanged;
- std::function<void()> dboNumberOfSourceClassesChanged;
- std::function<void(const am_Sink_s&)> dboNewSink;
- std::function<void(const am_Source_s&)> dboNewSource;
- std::function<void(const am_Domain_s& )> dboNewDomain;
- std::function<void (const am_Gateway_s& )> dboNewGateway;
- std::function<void (const am_Converter_s& )> dboNewConverter;
- std::function<void (const am_Crossfader_s& )> dboNewCrossfader;
- std::function<void (const am_MainConnectionType_s& )> dboNewMainConnection;
- std::function<void (const am_mainConnectionID_t )> dboRemovedMainConnection;
- std::function<void (const am_sinkID_t , const bool )> dboRemovedSink;
- std::function<void (const am_sourceID_t , const bool )> dboRemovedSource;
- std::function<void (const am_domainID_t )> dboRemoveDomain;
- std::function<void (const am_gatewayID_t )> dboRemoveGateway;
- std::function<void (const am_converterID_t )> dboRemoveConverter;
- std::function<void (const am_crossfaderID_t )> dboRemoveCrossfader;
- std::function<void (const am_mainConnectionID_t , const am_ConnectionState_e )> dboMainConnectionStateChanged;
- std::function<void (const am_sinkID_t , const am_MainSoundProperty_s& )> dboMainSinkSoundPropertyChanged;
- std::function<void (const am_sourceID_t , const am_MainSoundProperty_s& )> dboMainSourceSoundPropertyChanged;
- std::function<void (const am_sinkID_t , const am_Availability_s& )> dboSinkAvailabilityChanged;
- std::function<void (const am_sourceID_t , const am_Availability_s& )> dboSourceAvailabilityChanged;
- std::function<void (const am_sinkID_t , const am_mainVolume_t )> dboVolumeChanged;
- std::function<void (const am_sinkID_t , const am_MuteState_e )> dboSinkMuteStateChanged;
- std::function<void (const am_SystemProperty_s& )>dboSystemPropertyChanged;
- std::function<void (const am_mainConnectionID_t , const am_timeSync_t )>dboTimingInformationChanged;
- std::function<void (const am_sinkID_t , const am_sinkClass_t , const std::vector<am_MainSoundProperty_s>& , const bool )>dboSinkUpdated;
- std::function<void (const am_sourceID_t , const am_sourceClass_t , const std::vector<am_MainSoundProperty_s>& , const bool )>dboSourceUpdated;
- std::function<void (const am_sinkID_t , const am_NotificationConfiguration_s )> dboSinkMainNotificationConfigurationChanged;
- std::function<void (const am_sourceID_t , const am_NotificationConfiguration_s )> dboSourceMainNotificationConfigurationChanged;
+ std::function<void()> dboNumberOfSinkClassesChanged;
+ std::function<void()> dboNumberOfSourceClassesChanged;
+ std::function<void(const am_Sink_s &)> dboNewSink;
+ std::function<void(const am_Source_s &)> dboNewSource;
+ std::function<void(const am_Domain_s &)> dboNewDomain;
+ std::function<void(const am_Gateway_s &)> dboNewGateway;
+ std::function<void(const am_Converter_s &)> dboNewConverter;
+ std::function<void(const am_Crossfader_s &)> dboNewCrossfader;
+ std::function<void(const am_MainConnectionType_s &)> dboNewMainConnection;
+ std::function<void(const am_mainConnectionID_t)> dboRemovedMainConnection;
+ std::function<void(const am_sinkID_t, const bool)> dboRemovedSink;
+ std::function<void(const am_sourceID_t, const bool)> dboRemovedSource;
+ std::function<void(const am_domainID_t)> dboRemoveDomain;
+ std::function<void(const am_gatewayID_t)> dboRemoveGateway;
+ std::function<void(const am_converterID_t)> dboRemoveConverter;
+ std::function<void(const am_crossfaderID_t)> dboRemoveCrossfader;
+ std::function<void(const am_mainConnectionID_t, const am_ConnectionState_e)> dboMainConnectionStateChanged;
+ std::function<void(const am_sinkID_t, const am_MainSoundProperty_s &)> dboMainSinkSoundPropertyChanged;
+ std::function<void(const am_sourceID_t, const am_MainSoundProperty_s &)> dboMainSourceSoundPropertyChanged;
+ std::function<void(const am_sinkID_t, const am_Availability_s &)> dboSinkAvailabilityChanged;
+ std::function<void(const am_sourceID_t, const am_Availability_s &)> dboSourceAvailabilityChanged;
+ std::function<void(const am_sinkID_t, const am_mainVolume_t)> dboVolumeChanged;
+ std::function<void(const am_sinkID_t, const am_MuteState_e)> dboSinkMuteStateChanged;
+ std::function<void(const am_SystemProperty_s &)>dboSystemPropertyChanged;
+ std::function<void(const am_mainConnectionID_t, const am_timeSync_t)>dboTimingInformationChanged;
+ std::function<void(const am_sinkID_t, const am_sinkClass_t, const std::vector<am_MainSoundProperty_s> &, const bool)>dboSinkUpdated;
+ std::function<void(const am_sourceID_t, const am_sourceClass_t, const std::vector<am_MainSoundProperty_s> &, const bool)>dboSourceUpdated;
+ std::function<void(const am_sinkID_t, const am_NotificationConfiguration_s)> dboSinkMainNotificationConfigurationChanged;
+ std::function<void(const am_sourceID_t, const am_NotificationConfiguration_s)> dboSourceMainNotificationConfigurationChanged;
public:
- friend class CAmDatabaseHandlerMap;
- AmDatabaseObserverCallbacks():IAmDatabaseObserver(), mpDatabaseHandler(nullptr) {}
- virtual ~AmDatabaseObserverCallbacks(){ if(mpDatabaseHandler) mpDatabaseHandler->unregisterObserver(this);}
+ friend class CAmDatabaseHandlerMap;
+ AmDatabaseObserverCallbacks()
+ : IAmDatabaseObserver()
+ , mpDatabaseHandler(nullptr) {}
+ virtual ~AmDatabaseObserverCallbacks(){ if (mpDatabaseHandler) {mpDatabaseHandler->unregisterObserver(this);}}
protected:
- CAmDatabaseHandlerMap *mpDatabaseHandler;
+ CAmDatabaseHandlerMap *mpDatabaseHandler;
};
- am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID);
- am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID);
- 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);
- am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass);
- am_Error_e enterSystemProperties(const std::vector<am_SystemProperty_s>& listSystemProperties);
- am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID);
+ am_Error_e enterDomainDB(const am_Domain_s &domainData, am_domainID_t &domainID);
+ am_Error_e enterMainConnectionDB(const am_MainConnection_s &mainConnectionData, am_mainConnectionID_t &connectionID);
+ 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);
+ am_Error_e enterSourceClassDB(am_sourceClass_t &sourceClassID, const am_SourceClass_s &sourceClass);
+ am_Error_e enterSystemProperties(const std::vector<am_SystemProperty_s> &listSystemProperties);
+ am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t> &listConnectionID);
am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState);
am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID);
- am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID);
+ am_Error_e changeSinkAvailabilityDB(const am_Availability_s &availability, const am_sinkID_t sinkID);
am_Error_e changeDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID);
am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID);
- am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
- am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
- am_Error_e changeSourceSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID);
- am_Error_e changeSinkSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID);
- am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID);
- am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property);
- am_Error_e changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID);
- am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass);
- am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass);
+ am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sinkID_t sinkID);
+ am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sourceID_t sourceID);
+ am_Error_e changeSourceSoundPropertyDB(const am_SoundProperty_s &soundProperty, const am_sourceID_t sourceID);
+ am_Error_e changeSinkSoundPropertyDB(const am_SoundProperty_s &soundProperty, const am_sinkID_t sinkID);
+ am_Error_e changeSourceAvailabilityDB(const am_Availability_s &availability, const am_sourceID_t sourceID);
+ am_Error_e changeSystemPropertyDB(const am_SystemProperty_s &property);
+ am_Error_e changeDelayMainConnection(const am_timeSync_t &delay, const am_mainConnectionID_t &connectionID);
+ am_Error_e changeSinkClassInfoDB(const am_SinkClass_s &sinkClass);
+ am_Error_e changeSourceClassInfoDB(const am_SourceClass_s &sourceClass);
am_Error_e changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay);
am_Error_e changeConnectionFinal(const am_connectionID_t connectionID);
am_Error_e changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState);
@@ -162,80 +162,80 @@ public:
am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID);
am_Error_e removeConnection(const am_connectionID_t connectionID);
- 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;
- am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const;
- am_Error_e getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) const;
- am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t& volume) const;
- am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t& volume) const;
- am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const;
- am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s>& listSoundproperties) const;
- am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s>& listSoundproperties) const;
- am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const;
- am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const;
- am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listGatewaysID) const;
- 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;
- am_Error_e getListConnectionsReserved(std::vector<am_Connection_s>& listConnections) const;
- am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const;
- am_Error_e getListSources(std::vector<am_Source_s>& lisSources) const;
- 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;
- am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const;
- am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const;
- am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const;
- am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
- 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 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 getDomainOfCrossfader(const am_converterID_t crossfader, 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 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);
- am_Error_e peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID);
- am_Error_e peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID);
- am_Error_e changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomAvailabilityReason_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
- am_Error_e changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s>& listSoundProperties, const std::vector<am_CustomAvailabilityReason_t>& listConnectionFormats, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
- am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations);
- am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations);
+ 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;
+ am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s &mainConnectionData) const;
+ am_Error_e getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t &mainVolume) const;
+ am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t &volume) const;
+ am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t &volume) const;
+ am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t &value) const;
+ am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t &value) const;
+ am_Error_e getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t &value) const;
+ am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t &value) const;
+ am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s> &listSoundproperties) const;
+ am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s> &listSoundproperties) const;
+ am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> &listSinkID) const;
+ am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> &listSourceID) const;
+ am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> &listGatewaysID) const;
+ 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;
+ am_Error_e getListConnectionsReserved(std::vector<am_Connection_s> &listConnections) const;
+ am_Error_e getListSinks(std::vector<am_Sink_s> &listSinks) const;
+ am_Error_e getListSources(std::vector<am_Source_s> &lisSources) const;
+ 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;
+ am_Error_e getListMainSources(std::vector<am_SourceType_s> &listMainSources) const;
+ am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> &listSoundProperties) const;
+ am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> &listSourceProperties) const;
+ am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s> &listSystemProperties) const;
+ 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 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 getDomainOfCrossfader(const am_converterID_t crossfader, 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 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);
+ am_Error_e peekSinkClassID(const std::string &name, am_sinkClass_t &sinkClassID);
+ am_Error_e peekSourceClassID(const std::string &name, am_sourceClass_t &sourceClassID);
+ am_Error_e changeSourceDB(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_SoundProperty_s> &listSoundProperties, const std::vector<am_CustomAvailabilityReason_t> &listConnectionFormats, const std::vector<am_MainSoundProperty_s> &listMainSoundProperties);
+ am_Error_e changeSinkDB(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_SoundProperty_s> &listSoundProperties, const std::vector<am_CustomAvailabilityReason_t> &listConnectionFormats, const std::vector<am_MainSoundProperty_s> &listMainSoundProperties);
+ am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s> &listMainNotificationConfigurations);
+ am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s> &listMainNotificationConfigurations);
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);
+ 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 existConnection(const am_Connection_s & connection) 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;
- bool existSourceNameOrID(const am_sourceID_t sourceID, const std::string& name) const;
- bool existSourceName(const std::string& name) const;
+ bool existSourceNameOrID(const am_sourceID_t sourceID, const std::string &name) const;
+ bool existSourceName(const std::string &name) const;
bool existSink(const am_sinkID_t sinkID) const;
- bool existSinkNameOrID(const am_sinkID_t sinkID, const std::string& name) const;
- bool existSinkName(const std::string& name) const;
+ bool existSinkNameOrID(const am_sinkID_t sinkID, const std::string &name) const;
+ 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;
@@ -243,70 +243,71 @@ public:
bool existSourceClass(const am_sourceClass_t sourceClassID) const;
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;
-
- bool registerObserver(IAmDatabaseObserver * iObserver);
- bool unregisterObserver(IAmDatabaseObserver * iObserver);
+ 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;
+
+ bool registerObserver(IAmDatabaseObserver *iObserver);
+ bool unregisterObserver(IAmDatabaseObserver *iObserver);
unsigned countObservers();
/**
* The following structures extend the base structures with the field 'reserved'.
*/
-#define AM_SUBCLASS(TYPE, SUBCLASS, CLASS, MEMBER, ASSIGN) \
- typedef struct SUBCLASS : public CLASS \
- { \
- MEMBER \
- bool reserved; \
- SUBCLASS() : CLASS(), reserved(false) {} \
- SUBCLASS & operator=(const SUBCLASS &anObject) \
- { \
- if (this != &anObject) \
- { \
- CLASS::operator=(anObject); \
- reserved = anObject.reserved; \
- ASSIGN \
- } \
- return *this; \
- } \
- SUBCLASS & operator=(const CLASS & anObject) \
- { \
- if (this != &anObject) { \
- CLASS::operator=(anObject);} \
- return *this; \
- } \
- void getDescription(std::string & outString) const; \
- } TYPE \
+#define AM_SUBCLASS(TYPE, SUBCLASS, CLASS, MEMBER, ASSIGN) \
+ typedef struct SUBCLASS : public CLASS \
+ { \
+ MEMBER \
+ bool reserved; \
+ SUBCLASS() : CLASS(), reserved(false) {} \
+ SUBCLASS &operator=(const SUBCLASS &anObject) \
+ { \
+ if (this != &anObject) \
+ { \
+ CLASS::operator=(anObject); \
+ reserved = anObject.reserved; \
+ ASSIGN \
+ } \
+ return *this; \
+ } \
+ SUBCLASS &operator=(const CLASS &anObject) \
+ { \
+ if (this != &anObject) { \
+ CLASS::operator=(anObject);} \
+ return *this; \
+ } \
+ void getDescription(std::string &outString) const; \
+ } TYPE \
#define AM_SUBLCASS_ADD_MAP_TYPE(TYPE, NAME) std::unordered_map<TYPE, int16_t> NAME;
-#define AM_SUBLCASS_ADD_ASSIGNMENT(NAME) NAME = anObject.NAME;
+#define AM_SUBLCASS_ADD_ASSIGNMENT(NAME) NAME = anObject.NAME;
private:
AM_SUBCLASS(AmDomain, am_Domain_Database_s, am_Domain_s, , );
- AM_SUBCLASS(AmSink, am_Sink_Database_s, am_Sink_s, \
- void getSinkType(am_SinkType_s & sinkType) const; \
- AM_SUBLCASS_ADD_MAP_TYPE(am_CustomSoundPropertyType_t, cacheSoundProperties) \
- AM_SUBLCASS_ADD_MAP_TYPE(am_CustomMainSoundPropertyType_t, cacheMainSoundProperties), \
- AM_SUBLCASS_ADD_ASSIGNMENT(cacheSoundProperties) \
- AM_SUBLCASS_ADD_ASSIGNMENT(cacheMainSoundProperties) );
+ AM_SUBCLASS(AmSink, am_Sink_Database_s, am_Sink_s, \
+ void getSinkType(am_SinkType_s & sinkType) const; \
+ AM_SUBLCASS_ADD_MAP_TYPE(am_CustomSoundPropertyType_t, cacheSoundProperties) \
+ AM_SUBLCASS_ADD_MAP_TYPE(am_CustomMainSoundPropertyType_t, cacheMainSoundProperties), \
+ AM_SUBLCASS_ADD_ASSIGNMENT(cacheSoundProperties) \
+ AM_SUBLCASS_ADD_ASSIGNMENT(cacheMainSoundProperties));
AM_SUBCLASS(AmSource, am_Source_Database_s, am_Source_s,
- void getSourceType(am_SourceType_s & sourceType) const; \
- AM_SUBLCASS_ADD_MAP_TYPE(am_CustomSoundPropertyType_t, cacheSoundProperties) \
- AM_SUBLCASS_ADD_MAP_TYPE(am_CustomMainSoundPropertyType_t, cacheMainSoundProperties), \
- AM_SUBLCASS_ADD_ASSIGNMENT(cacheSoundProperties) \
- AM_SUBLCASS_ADD_ASSIGNMENT(cacheMainSoundProperties) );
+ void getSourceType(am_SourceType_s & sourceType) const; \
+ AM_SUBLCASS_ADD_MAP_TYPE(am_CustomSoundPropertyType_t, cacheSoundProperties) \
+ AM_SUBLCASS_ADD_MAP_TYPE(am_CustomMainSoundPropertyType_t, cacheMainSoundProperties), \
+ AM_SUBLCASS_ADD_ASSIGNMENT(cacheSoundProperties) \
+ AM_SUBLCASS_ADD_ASSIGNMENT(cacheMainSoundProperties));
AM_SUBCLASS(AmConnection, am_Connection_Database_s, am_Connection_s, , );
AM_SUBCLASS(AmMainConnection, am_MainConnection_Database_s, am_MainConnection_s,
- void getMainConnectionType(am_MainConnectionType_s & connectionType) const;, );
+ void getMainConnectionType(am_MainConnectionType_s & connectionType) const;
+ , );
AM_SUBCLASS(AmSourceClass, am_SourceClass_Database_s, am_SourceClass_s, , );
@@ -318,18 +319,17 @@ private:
AM_SUBCLASS(AmCrossfader, am_Crossfader_Database_s, am_Crossfader_s, , );
-
- typedef std::unordered_map<am_domainID_t, AmDomain> AmMapDomain;
- typedef std::unordered_map<am_sourceClass_t, AmSourceClass> AmMapSourceClass;
- typedef std::unordered_map<am_sinkClass_t, AmSinkClass> AmMapSinkClass;
- typedef std::unordered_map<am_sinkID_t, AmSink> AmMapSink;
- typedef std::unordered_map<am_sourceID_t, AmSource> AmMapSource;
- typedef std::unordered_map<am_gatewayID_t, AmGateway> AmMapGateway;
- typedef std::unordered_map<am_converterID_t, AmConverter> AmMapConverter;
- typedef std::unordered_map<am_crossfaderID_t, AmCrossfader> AmMapCrossfader;
- typedef std::unordered_map<am_connectionID_t, AmConnection> AmMapConnection;
- typedef std::unordered_map<am_mainConnectionID_t, AmMainConnection> AmMapMainConnection;
- typedef std::vector<am_SystemProperty_s> AmVectorSystemProperties;
+ typedef std::unordered_map<am_domainID_t, AmDomain> AmMapDomain;
+ typedef std::unordered_map<am_sourceClass_t, AmSourceClass> AmMapSourceClass;
+ typedef std::unordered_map<am_sinkClass_t, AmSinkClass> AmMapSinkClass;
+ typedef std::unordered_map<am_sinkID_t, AmSink> AmMapSink;
+ typedef std::unordered_map<am_sourceID_t, AmSource> AmMapSource;
+ typedef std::unordered_map<am_gatewayID_t, AmGateway> AmMapGateway;
+ typedef std::unordered_map<am_converterID_t, AmConverter> AmMapConverter;
+ typedef std::unordered_map<am_crossfaderID_t, AmCrossfader> AmMapCrossfader;
+ typedef std::unordered_map<am_connectionID_t, AmConnection> AmMapConnection;
+ typedef std::unordered_map<am_mainConnectionID_t, AmMainConnection> AmMapMainConnection;
+ typedef std::vector<am_SystemProperty_s> AmVectorSystemProperties;
/**
* The following structure groups the map objects needed for the implementation.
* Every map object is coupled with an identifier, which hold the current value.
@@ -343,159 +343,191 @@ private:
* The structure encapsulates the id boundary and the current id value.
* It defines a range within the id can vary.
*/
- struct AmIdentifier
- {
- int16_t mMin; //!< min possible value
- int16_t mMax; //!< max possible value
- int16_t mCurrentValue; //!< current value
-
- AmIdentifier():mMin(DYNAMIC_ID_BOUNDARY), mMax(SHRT_MAX), mCurrentValue(mMin){};
- AmIdentifier(const int16_t & min, const int16_t & max):mMin(min), mMax(max), mCurrentValue(mMin){assert(min<max);};
- };
-
- AmIdentifier mCurrentDomainID; //!< domain ID
- AmIdentifier mCurrentSourceClassesID; //!< source classes ID
- AmIdentifier mCurrentSinkClassesID; //!< sink classes ID
- AmIdentifier mCurrentSinkID; //!< sink ID
- AmIdentifier mCurrentSourceID; //!< source ID
- AmIdentifier mCurrentGatewayID; //!< gateway ID
- AmIdentifier mCurrentConverterID; //!< converter ID
- AmIdentifier mCurrentCrossfaderID; //!< crossfader ID
- AmIdentifier mCurrentConnectionID; //!< connection ID
- AmIdentifier mCurrentMainConnectionID; //!< mainconnection ID
-
- AmVectorSystemProperties mSystemProperties; //!< vector with system properties
- AmMapDomain mDomainMap; //!< map for domain structures
- AmMapSourceClass mSourceClassesMap; //!< map for source classes structures
- AmMapSinkClass mSinkClassesMap; //!< map for sink classes structures
- AmMapSink mSinkMap; //!< map for sink structures
- AmMapSource mSourceMap; //!< map for source structures
- AmMapGateway mGatewayMap; //!< map for gateway structures
- AmMapConverter mConverterMap; //!< map for converter structures
- AmMapCrossfader mCrossfaderMap; //!< map for crossfader structures
- AmMapConnection mConnectionMap; //!< map for connection structures
- AmMapMainConnection mMainConnectionMap; //!< map for main connection structures
-
- AmMappedData(): //For Domain, MainConnections, Connections we don't have static IDs.
- mCurrentDomainID(DYNAMIC_ID_BOUNDARY, SHRT_MAX),
- mCurrentSourceClassesID(DYNAMIC_ID_BOUNDARY, SHRT_MAX),
- mCurrentSinkClassesID(DYNAMIC_ID_BOUNDARY, SHRT_MAX),
- 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(), mConverterMap(), mCrossfaderMap(), mConnectionMap(), mMainConnectionMap()
- {};
- /**
- * \brief Increases a given map ID.
- *
- * A common method implementing the logic for static and dynamic IDs except main connection ID.
- *
- * @param resultID Pointer to an output variable.
- * @param elementID Pointer to ID, which will be manipulated.
- * @param desiredStaticID Not 0 for static IDs and 0 for dynamic IDs.
- * Usually the static IDs are in interval [1 , DYNAMIC_ID_BOUNDARY-1]. Default is 0.
- * @return TRUE on successfully changed ID.
- */
- bool increaseID(int16_t & resultID, AmIdentifier & elementID, int16_t const desiredStaticID);
- /**
- * \brief Increases the main connection ID.
- *
- * @param resultID Pointer to an output variable.
- * @return TRUE on successfully changed ID.
- */
- bool increaseMainConnectionID(int16_t & resultID);
-
- /**
- * \brief Increases the connection ID.
- *
- * @param resultID Pointer to an output variable.
- * @return TRUE on successfully changed ID.
- */
- bool increaseConnectionID(int16_t & resultID);
-
- template <class TPrintObject> static void print (const TPrintObject & t, std::ostream & output)
+ struct AmIdentifier
+ {
+ int16_t mMin; //!< min possible value
+ int16_t mMax; //!< max possible value
+ int16_t mCurrentValue; //!< current value
+
+ AmIdentifier()
+ : mMin(DYNAMIC_ID_BOUNDARY)
+ , mMax(SHRT_MAX)
+ , mCurrentValue(mMin){}
+ AmIdentifier(const int16_t &min, const int16_t &max)
+ : mMin(min)
+ , mMax(max)
+ , mCurrentValue(mMin){assert(min < max);}
+ };
+
+ AmIdentifier mCurrentDomainID; //!< domain ID
+ AmIdentifier mCurrentSourceClassesID; //!< source classes ID
+ AmIdentifier mCurrentSinkClassesID; //!< sink classes ID
+ AmIdentifier mCurrentSinkID; //!< sink ID
+ AmIdentifier mCurrentSourceID; //!< source ID
+ AmIdentifier mCurrentGatewayID; //!< gateway ID
+ AmIdentifier mCurrentConverterID; //!< converter ID
+ AmIdentifier mCurrentCrossfaderID; //!< crossfader ID
+ AmIdentifier mCurrentConnectionID; //!< connection ID
+ AmIdentifier mCurrentMainConnectionID; //!< mainconnection ID
+
+ AmVectorSystemProperties mSystemProperties; //!< vector with system properties
+ AmMapDomain mDomainMap; //!< map for domain structures
+ AmMapSourceClass mSourceClassesMap; //!< map for source classes structures
+ AmMapSinkClass mSinkClassesMap; //!< map for sink classes structures
+ AmMapSink mSinkMap; //!< map for sink structures
+ AmMapSource mSourceMap; //!< map for source structures
+ AmMapGateway mGatewayMap; //!< map for gateway structures
+ AmMapConverter mConverterMap; //!< map for converter structures
+ AmMapCrossfader mCrossfaderMap; //!< map for crossfader structures
+ AmMapConnection mConnectionMap; //!< map for connection structures
+ AmMapMainConnection mMainConnectionMap; //!< map for main connection structures
+
+ AmMappedData() : // For Domain, MainConnections, Connections we don't have static IDs.
+ mCurrentDomainID(DYNAMIC_ID_BOUNDARY, SHRT_MAX)
+ , mCurrentSourceClassesID(DYNAMIC_ID_BOUNDARY, SHRT_MAX)
+ , mCurrentSinkClassesID(DYNAMIC_ID_BOUNDARY, SHRT_MAX)
+ , 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()
+ , mConverterMap()
+ , mCrossfaderMap()
+ , mConnectionMap()
+ , mMainConnectionMap()
+ {}
+ /**
+ * \brief Increases a given map ID.
+ *
+ * A common method implementing the logic for static and dynamic IDs except main connection ID.
+ *
+ * @param resultID Pointer to an output variable.
+ * @param elementID Pointer to ID, which will be manipulated.
+ * @param desiredStaticID Not 0 for static IDs and 0 for dynamic IDs.
+ * Usually the static IDs are in interval [1 , DYNAMIC_ID_BOUNDARY-1]. Default is 0.
+ * @return TRUE on successfully changed ID.
+ */
+ bool increaseID(int16_t &resultID, AmIdentifier &elementID, int16_t const desiredStaticID);
+
+ /**
+ * \brief Increases the main connection ID.
+ *
+ * @param resultID Pointer to an output variable.
+ * @return TRUE on successfully changed ID.
+ */
+ bool increaseMainConnectionID(int16_t &resultID);
+
+ /**
+ * \brief Increases the connection ID.
+ *
+ * @param resultID Pointer to an output variable.
+ * @return TRUE on successfully changed ID.
+ */
+ bool increaseConnectionID(int16_t &resultID);
+
+ template <class TPrintObject>
+ static void print(const TPrintObject &t, std::ostream &output)
{
- std::string description;
- t.getDescription( description );
- output << description;
+ std::string description;
+ t.getDescription(description);
+ output << description;
}
- template <typename TPrintMapKey,class TPrintMapObject> static void printMap (const std::unordered_map<TPrintMapKey, TPrintMapObject> & t, std::ostream & output)
+
+ template <typename TPrintMapKey, class TPrintMapObject>
+ static void printMap(const std::unordered_map<TPrintMapKey, TPrintMapObject> &t, std::ostream &output)
{
- typename std::unordered_map<TPrintMapKey, TPrintMapObject>::const_iterator iter = t.begin();
- for(; iter!=t.end(); iter++)
- AmMappedData::print(iter->second, output);
+ typename std::unordered_map<TPrintMapKey, TPrintMapObject>::const_iterator iter = t.begin();
+ for (; iter != t.end(); iter++)
+ {
+ AmMappedData::print(iter->second, output);
+ }
}
+
private:
- template <typename TMapKey,class TMapObject> bool getNextConnectionID(int16_t & resultID, AmIdentifier & connID,
- const std::unordered_map<TMapKey, TMapObject> & map);
+ template <typename TMapKey, class TMapObject>
+ bool getNextConnectionID(int16_t &resultID, AmIdentifier &connID,
+ const std::unordered_map<TMapKey, TMapObject> &map);
+
};
/*
* Helper methods.
*/
am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const; //!< calculates a new main connection delay
- int16_t calculateDelayForRoute(const std::vector<am_connectionID_t>& listConnectionID);
- 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
+ int16_t calculateDelayForRoute(const std::vector<am_connectionID_t> &listConnectionID);
+ 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();
+ }
+
+ void filterDuplicateNotificationConfigurationTypes(std::vector<am_NotificationConfiguration_s> &list)
{
- 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();
+ std::vector<am_NotificationConfiguration_s> oldList(list);
+ list.clear();
+ std::for_each(oldList.begin(), oldList.end(), [&](am_NotificationConfiguration_s &provided) {
+ std::vector<am_NotificationConfiguration_s>::iterator found =
+ std::find_if(list.begin(), list.end(), [&](am_NotificationConfiguration_s &stored) {
+ if (provided.type == stored.type)
+ {
+ stored = provided;
+ return true;
+ }
+
+ return false;
+ });
+ if (found == list.end())
+ {
+ list.push_back(provided);
+ }
+ });
}
- void filterDuplicateNotificationConfigurationTypes(std::vector<am_NotificationConfiguration_s> & list)
- {
- std::vector<am_NotificationConfiguration_s> oldList(list);
- list.clear();
- std::for_each(oldList.begin(), oldList.end(), [&](am_NotificationConfiguration_s & provided) {
- std::vector<am_NotificationConfiguration_s>::iterator found =
- std::find_if(list.begin(), list.end(), [&](am_NotificationConfiguration_s & stored) {
- if (provided.type == stored.type) {
- stored = provided;
- return true;
- }
- return false;
- } );
- if (found == list.end())
- list.push_back(provided);
- } );
- }
ListConnectionFormat mListConnectionFormat; //!< list of connection formats
- AmMappedData mMappedData; //!< Internal structure encapsulating all the maps used in this class
- std::vector<AmDatabaseObserverCallbacks*> mDatabaseObservers;
+ AmMappedData mMappedData; //!< Internal structure encapsulating all the maps used in this class
+ std::vector<AmDatabaseObserverCallbacks *> mDatabaseObservers;
#ifdef UNIT_TEST
- public:
- void setConnectionIDRange(const int16_t & min, const int16_t & max)
- {
- mMappedData.mCurrentConnectionID.mMin = min;
- mMappedData.mCurrentConnectionID.mMax = max;
- }
- void setMainConnectionIDRange(const int16_t & min, const int16_t & max)
- {
- mMappedData.mCurrentMainConnectionID.mMin = min;
- mMappedData.mCurrentMainConnectionID.mMax = max;
- }
- void setSinkIDRange(const int16_t & min, const int16_t & max)
- {
- mMappedData.mCurrentSinkID.mMin = min;
- mMappedData.mCurrentSinkID.mMax = max;
- }
-#endif
+public:
+ void setConnectionIDRange(const int16_t &min, const int16_t &max)
+ {
+ mMappedData.mCurrentConnectionID.mMin = min;
+ mMappedData.mCurrentConnectionID.mMax = max;
+ }
+
+ void setMainConnectionIDRange(const int16_t &min, const int16_t &max)
+ {
+ mMappedData.mCurrentMainConnectionID.mMin = min;
+ mMappedData.mCurrentMainConnectionID.mMax = max;
+ }
+
+ void setSinkIDRange(const int16_t &min, const int16_t &max)
+ {
+ mMappedData.mCurrentSinkID.mMin = min;
+ mMappedData.mCurrentSinkID.mMax = max;
+ }
+#endif // ifdef UNIT_TEST
};
}
diff --git a/AudioManagerCore/include/CAmGraph.h b/AudioManagerCore/include/CAmGraph.h
index 45043f7..9d9f082 100644
--- a/AudioManagerCore/include/CAmGraph.h
+++ b/AudioManagerCore/include/CAmGraph.h
@@ -37,643 +37,704 @@
#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; }
- const NodeData & getData() const { 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
-
- struct IterateThroughAllNodesDelegate
- {
- CAmNode<T> * source;
- CAmNode<T> * destination;
- CAmNodeReferenceList visited;
- std::function<bool(const CAmNode<T> * )> shouldVisitNode;
- std::function<void(const CAmNode<T> *)> willVisitNode;
- std::function<void(const CAmNode<T> *)> didVisitNode;
- std::function<void(const CAmNodeReferenceList & path)> didFindPath;
- };
-
- struct VisitNodeDelegate
- {
- CAmNode<T> * source;
- CAmNode<T> * destination;
- std::function<void(const am_GraphPathPosition_e, CAmNode<T> &)> visitedNode;
- };
-
- /**
- * 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 findShortestPathsFromNode(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);
- }
-
- /**
- * Iterate through the nodes and generate all paths to given node.
- *
- * @param dst end node.
- * @param visited vector with current path.
- * @param delegate enumeration delegate.
- */
- void findAllPaths(IterateThroughAllNodesDelegate & delegate)
- {
- CAmListVertices * nodes = mPointersAdjList[delegate.visited.back()->getIndex()];
- CAmListVerticesItrConst vItr(nodes->begin());
-
- CAmVertex<T,V> * pNextVertex;
- CAmNode<T> * pNextNode;
- for (; vItr != nodes->end(); ++vItr)
- {
- pNextVertex = (CAmVertex<T,V> *)&(*vItr);
- pNextNode = pNextVertex->getNode();
- if(
- pNextNode->getStatus()!=GES_NOT_VISITED ||
- !delegate.shouldVisitNode(pNextNode)
- )
- continue;
- if (pNextNode==delegate.destination)
- {
- delegate.willVisitNode(pNextNode);
- pNextNode->setStatus(GES_IN_PROGRESS);
- delegate.visited.push_back(pNextNode);
- //notify observer
- delegate.didFindPath(delegate.visited);
- //remove last node from the list
- auto last = delegate.visited.end()-1;
- delegate.visited.erase(last);
- pNextNode->setStatus(GES_NOT_VISITED);
- delegate.didVisitNode(pNextNode);
- break;
- }
- }
- vItr = nodes->begin();
- //bfs like loop
- for (; vItr != nodes->end(); ++vItr)
- {
- pNextVertex = (CAmVertex<T,V> *)&(*vItr);
- pNextNode = pNextVertex->getNode();
-
- if(pNextNode->getStatus()!=GES_NOT_VISITED ||
- pNextNode==delegate.destination ||
- !delegate.shouldVisitNode(pNextNode)
- )
- continue;
- delegate.willVisitNode(pNextNode);
- pNextNode->setStatus(GES_IN_PROGRESS);
- delegate.visited.push_back(pNextNode);
- findAllPaths(delegate);
- //remove last node from the list
- auto last = delegate.visited.end()-1;
- delegate.visited.erase(last);
- pNextNode->setStatus(GES_NOT_VISITED);
- delegate.didVisitNode(pNextNode);
- }
- }
-
- 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;
- }
-
- const CAmVertexReferenceList & getVertexList() const
- {
- return mPointersAdjList;
- }
-
- /**
- * 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;
+/**
+ * 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; }
+ const NodeData &getData() const { 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
+
+ struct IterateThroughAllNodesDelegate
+ {
+ CAmNode<T> *source;
+ CAmNode<T> *destination;
+ CAmNodeReferenceList visited;
+ std::function<bool(const CAmNode<T> *)> shouldVisitNode;
+ std::function<void(const CAmNode<T> *)> willVisitNode;
+ std::function<void(const CAmNode<T> *)> didVisitNode;
+ std::function<void(const CAmNodeReferenceList &path)> didFindPath;
+ };
+
+ struct VisitNodeDelegate
+ {
+ CAmNode<T> *source;
+ CAmNode<T> *destination;
+ std::function<void(const am_GraphPathPosition_e, CAmNode<T> &)> visitedNode;
+ };
+
+ /**
+ * 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 findShortestPathsFromNode(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);
+ }
+ }
+
+ /**
+ * Iterate through the nodes and generate all paths to given node.
+ *
+ * @param dst end node.
+ * @param visited vector with current path.
+ * @param delegate enumeration delegate.
+ */
+ void findAllPaths(IterateThroughAllNodesDelegate &delegate)
+ {
+ CAmListVertices *nodes = mPointersAdjList[delegate.visited.back()->getIndex()];
+ CAmListVerticesItrConst vItr(nodes->begin());
+
+ CAmVertex<T, V> *pNextVertex;
+ CAmNode<T> *pNextNode;
+ for (; vItr != nodes->end(); ++vItr)
+ {
+ pNextVertex = (CAmVertex<T, V> *) & (*vItr);
+ pNextNode = pNextVertex->getNode();
+ if (
+ pNextNode->getStatus() != GES_NOT_VISITED ||
+ !delegate.shouldVisitNode(pNextNode)
+ )
+ {
+ continue;
+ }
+
+ if (pNextNode == delegate.destination)
+ {
+ delegate.willVisitNode(pNextNode);
+ pNextNode->setStatus(GES_IN_PROGRESS);
+ delegate.visited.push_back(pNextNode);
+ // notify observer
+ delegate.didFindPath(delegate.visited);
+ // remove last node from the list
+ auto last = delegate.visited.end() - 1;
+ delegate.visited.erase(last);
+ pNextNode->setStatus(GES_NOT_VISITED);
+ delegate.didVisitNode(pNextNode);
+ break;
+ }
+ }
+
+ vItr = nodes->begin();
+ // bfs like loop
+ for (; vItr != nodes->end(); ++vItr)
+ {
+ pNextVertex = (CAmVertex<T, V> *) & (*vItr);
+ pNextNode = pNextVertex->getNode();
+
+ if (pNextNode->getStatus() != GES_NOT_VISITED ||
+ pNextNode == delegate.destination ||
+ !delegate.shouldVisitNode(pNextNode)
+ )
+ {
+ continue;
+ }
+
+ delegate.willVisitNode(pNextNode);
+ pNextNode->setStatus(GES_IN_PROGRESS);
+ delegate.visited.push_back(pNextNode);
+ findAllPaths(delegate);
+ // remove last node from the list
+ auto last = delegate.visited.end() - 1;
+ delegate.visited.erase(last);
+ pNextNode->setStatus(GES_NOT_VISITED);
+ delegate.didVisitNode(pNextNode);
+ }
+ }
+
+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;
+ }
+
+ const CAmVertexReferenceList &getVertexList() const
+ {
+ return mPointersAdjList;
+ }
+
+ /**
+ * 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 = this->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);
});
- 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 = this->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;
- findShortestPathsFromNode(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;
- findShortestPathsFromNode(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;
- findShortestPathsFromNode(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;
- findShortestPathsFromNode(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 cbShouldVisitNode ask the delegate if we should proceed with the current node.
- * @param cbWillVisitNode tell the delegate the current node will be visited.
- * @param cbDidVisitNode tell the delegate the current node was visited.
- * @param cbDidFindPath return the path to the delegate.
- */
- void getAllPaths(CAmNode<T> & src,
- CAmNode<T> & dst,
- std::function<bool(const CAmNode<T> * )> cbShouldVisitNode,
- std::function<void(const CAmNode<T> *)> cbWillVisitNode,
- std::function<void(const CAmNode<T> *)> cbDidVisitNode,
- std::function<void(const CAmNodeReferenceList & path)> cbDidFindPath)
- {
- IterateThroughAllNodesDelegate delegate;
- delegate.source = &src;
- delegate.destination = &dst;
- delegate.shouldVisitNode = cbShouldVisitNode;
- delegate.willVisitNode = cbWillVisitNode;
- delegate.didVisitNode = cbDidVisitNode;
- delegate.didFindPath = cbDidFindPath;
- delegate.visited.push_back((CAmNode<T>*)&src);
- ((CAmNode<T>*)&src)->setStatus(GES_VISITED);
- findAllPaths(delegate);
- ((CAmNode<T>*)&src)->setStatus(GES_NOT_VISITED);
- }
- };
+ 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;
+ findShortestPathsFromNode(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;
+ findShortestPathsFromNode(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;
+ findShortestPathsFromNode(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;
+ findShortestPathsFromNode(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 cbShouldVisitNode ask the delegate if we should proceed with the current node.
+ * @param cbWillVisitNode tell the delegate the current node will be visited.
+ * @param cbDidVisitNode tell the delegate the current node was visited.
+ * @param cbDidFindPath return the path to the delegate.
+ */
+ void getAllPaths(CAmNode<T> &src,
+ CAmNode<T> &dst,
+ std::function<bool(const CAmNode<T> *)> cbShouldVisitNode,
+ std::function<void(const CAmNode<T> *)> cbWillVisitNode,
+ std::function<void(const CAmNode<T> *)> cbDidVisitNode,
+ std::function<void(const CAmNodeReferenceList &path)> cbDidFindPath)
+ {
+ IterateThroughAllNodesDelegate delegate;
+ delegate.source = &src;
+ delegate.destination = &dst;
+ delegate.shouldVisitNode = cbShouldVisitNode;
+ delegate.willVisitNode = cbWillVisitNode;
+ delegate.didVisitNode = cbDidVisitNode;
+ delegate.didFindPath = cbDidFindPath;
+ delegate.visited.push_back((CAmNode<T> *) & src);
+ ((CAmNode<T> *) & src)->setStatus(GES_VISITED);
+ findAllPaths(delegate);
+ ((CAmNode<T> *) & src)->setStatus(GES_NOT_VISITED);
+ }
+
+};
}
-#endif
+#endif // ifndef GRAPH_H
diff --git a/AudioManagerCore/include/CAmLog.h b/AudioManagerCore/include/CAmLog.h
index cf7a3a6..5659961 100644
--- a/AudioManagerCore/include/CAmLog.h
+++ b/AudioManagerCore/include/CAmLog.h
@@ -14,7 +14,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
*
* \file CAmLog.h
* For further information see http://www.genivi.org/.
@@ -40,11 +40,11 @@
* Example: CAmLogger << "Text"; //to print out through the singleton object directly to the console
*/
-#define DEFAULT_LOG_FOLDER "/tmp/"
+#define DEFAULT_LOG_FOLDER "/tmp/"
#define DEFAULT_LOGFILE_PREFIX "am_dump_"
-#define DEFAULT_LOGFILE_EXT ".log"
+#define DEFAULT_LOGFILE_EXT ".log"
-#define DEL( aPointer ) delete aPointer, aPointer = NULL
+#define DEL(aPointer) delete aPointer, aPointer = NULL
/* */
typedef enum { eCAmLogNone = 0, eCAmLogStdout = 1, eCAmLogFile = 2 } eCAmLogType;
@@ -52,78 +52,86 @@ typedef enum { eCAmLogNone = 0, eCAmLogStdout = 1, eCAmLogFile = 2 } eCAmLogType
class CAmLog
{
private:
- /**
- * Private classes which usually own (wrap) a stream object. They are responsible for creating and deleting it.
- */
- class CAmLogger
- {
- protected:
- std::ostream* mOutputStream;
- public:
- CAmLogger ():mOutputStream(NULL) {};
- virtual ~CAmLogger () { };
- virtual void log(const std::string& _s)
- {
- (*mOutputStream) << _s;
- mOutputStream->flush();
- }
- template <class T>
- CAmLogger & operator << (const T & t)
- {
- (*mOutputStream) << t;
- return (*this);
- }
- };
-
- class CAmFileLogger : public CAmLogger
- {
- std::string mFilename;
- public:
- static void generateLogFilename(std::string &result);
- explicit CAmFileLogger(const std::string& _s) : CAmLogger()
- {
- mFilename = _s;
- mOutputStream = new std::ofstream(mFilename.c_str());
- }
- ~CAmFileLogger();
- };
-
- class CAmStdOutLogger : public CAmLogger
- {
- public:
- CAmStdOutLogger()
- {
- mOutputStream = &std::cout;
- }
- };
+ /**
+ * Private classes which usually own (wrap) a stream object. They are responsible for creating and deleting it.
+ */
+ class CAmLogger
+ {
+ protected:
+ std::ostream *mOutputStream;
+ public:
+ CAmLogger ()
+ : mOutputStream(NULL) {}
+ virtual ~CAmLogger () { }
+ virtual void log(const std::string &_s)
+ {
+ (*mOutputStream) << _s;
+ mOutputStream->flush();
+ }
+
+ template <class T>
+ CAmLogger &operator <<(const T &t)
+ {
+ (*mOutputStream) << t;
+ return (*this);
+ }
+
+ };
+
+ class CAmFileLogger : public CAmLogger
+ {
+ std::string mFilename;
+ public:
+ static void generateLogFilename(std::string &result);
+
+ explicit CAmFileLogger(const std::string &_s)
+ : CAmLogger()
+ {
+ mFilename = _s;
+ mOutputStream = new std::ofstream(mFilename.c_str());
+ }
+
+ ~CAmFileLogger();
+ };
+
+ class CAmStdOutLogger : public CAmLogger
+ {
+ public:
+ CAmStdOutLogger()
+ {
+ mOutputStream = &std::cout;
+ }
+
+ };
private:
- eCAmLogType mLogType;
- CAmLogger* mLogger;
+ eCAmLogType mLogType;
+ CAmLogger *mLogger;
protected:
void releaseLogger();
- void instantiateLogger( const eCAmLogType type);
+ void instantiateLogger(const eCAmLogType type);
+
public:
- CAmLog(const eCAmLogType type );
+ CAmLog(const eCAmLogType type);
CAmLog();
~CAmLog();
static CAmLog *getDefaultLog();
- void setLogType( const eCAmLogType type);
+ void setLogType(const eCAmLogType type);
eCAmLogType getLogType() const;
template <class T>
- CAmLog & operator << (const T & t)
+ CAmLog &operator <<(const T &t)
{
- assert(mLogger!=NULL);
- (*mLogger) << t;
- return (*this);
+ assert(mLogger != NULL);
+ (*mLogger) << t;
+ return (*this);
}
- };
-#define CAmLogger (*CAmLog::getDefaultLog())
+};
+#define CAmLogger (*CAmLog::getDefaultLog())
#endif /* CAMLOG_H_ */
diff --git a/AudioManagerCore/include/CAmRouter.h b/AudioManagerCore/include/CAmRouter.h
index f62141a..bb889c3 100644
--- a/AudioManagerCore/include/CAmRouter.h
+++ b/AudioManagerCore/include/CAmRouter.h
@@ -36,343 +36,372 @@
namespace am
{
- /**
- * Optimal path search is implemented with graph which contains nodes - sinks, sources, gateways, converters.
- * The nodes 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.
- *
- */
+/**
+ * Optimal path search is implemented with graph which contains nodes - sinks, sources, gateways, converters.
+ * The nodes 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.
+ *
+ */
- /**
- * Trace on/off.
- */
+/**
+ * Trace on/off.
+ */
#undef TRACE_GRAPH
- /**
- * Max paths count returned to the controller
- */
+/**
+ * Max paths count returned to the controller
+ */
#ifndef MAX_ROUTING_PATHS
-#define MAX_ROUTING_PATHS 5
+# define MAX_ROUTING_PATHS 5
#endif
- /**
- * How many times the routing algorithm should look back into domains.
- *
- * 0 - no cycles are allowed
- * 1 - default is one cycle
- * ...
- * UINT_MAX - set this define to UINT_MAX in order to allow cycles.
- *
- */
+/**
+ * How many times the routing algorithm should look back into domains.
+ *
+ * 0 - no cycles are allowed
+ * 1 - default is one cycle
+ * ...
+ * UINT_MAX - set this define to UINT_MAX in order to allow cycles.
+ *
+ */
#ifndef MAX_ALLOWED_DOMAIN_CYCLES
-#define MAX_ALLOWED_DOMAIN_CYCLES 1
+# define MAX_ALLOWED_DOMAIN_CYCLES 1
#endif
- class CAmRouter;
+class CAmRouter;
- /**
- * A structure used as user data in the graph nodes.
- */
- struct am_RoutingNodeData_s
+/**
+ * A structure used as user data in the graph nodes.
+ */
+struct am_RoutingNodeData_s
+{
+ typedef enum : int
+ { SINK, SOURCE, GATEWAY, CONVERTER } am_NodeDataType_e;
+ am_NodeDataType_e type; //!< data type:sink, source, gateway or converter
+ union
{
- typedef enum:int
- { SINK, SOURCE, GATEWAY, CONVERTER
- } am_NodeDataType_e;
- am_NodeDataType_e type; //!< data type:sink, source, gateway or converter
- 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)
- {
- }
+ 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)
+ {
+ }
- bool operator==(const am_RoutingNodeData_s & anotherObject) const
+ bool operator==(const am_RoutingNodeData_s &anotherObject) const
+ {
+ bool result = false;
+ if (type == anotherObject.type)
{
- bool result = false;
- if (type == anotherObject.type)
+ result = true;
+ if (type == SINK)
{
- result = true;
- 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);
+ result &= (data.sink->sinkID == anotherObject.data.sink->sinkID);
}
- return result;
- }
- ;
-
-#ifdef TRACE_GRAPH
-#define COUT_NODE(HEAD, NAME, ID) \
- std::cout << HEAD << "(" << std::setfill('0') << std::setw(4) << ID << " " << NAME << ")"
-
- void trace() const
- {
- if(type==SINK)
- COUT_NODE("SI", data.sink->name, data.sink->sinkID );
- else if(type==SOURCE)
- COUT_NODE("SO", data.source->name, data.source->sourceID );
- else if(type==GATEWAY)
- COUT_NODE("GA", data.gateway->name, data.gateway->gatewayID );
- else if(type==CONVERTER)
- COUT_NODE("CO", data.converter->name, data.converter->converterID );
- };
-#endif
-
- am_domainID_t domainID() const
- {
- if (type == SINK)
- return data.sink->domainID;
else if (type == SOURCE)
- return data.source->domainID;
+ {
+ result &= (data.source->sourceID == anotherObject.data.source->sourceID);
+ }
else if (type == GATEWAY)
- return data.gateway->controlDomainID;
+ {
+ result &= (data.gateway->gatewayID == anotherObject.data.gateway->gatewayID);
+ }
else if (type == CONVERTER)
- return data.converter->domainID;
- return 0;
+ {
+ result &= (data.converter->converterID == anotherObject.data.converter->converterID);
+ }
}
- ;
- };
- typedef am_RoutingNodeData_s::am_NodeDataType_e CAmNodeDataType;
- typedef CAmNode<am_RoutingNodeData_s> CAmRoutingNode;
- typedef CAmGraph<am_RoutingNodeData_s, uint16_t> CAmRoutingGraph;
- typedef CAmVertex<am_RoutingNodeData_s, uint16_t> CAmRoutingVertex;
- typedef std::list<CAmRoutingVertex> CAmRoutingListVertices;
- typedef std::vector<CAmRoutingListVertices*> CAmRoutingVertexReferenceList;
+ return result;
+ }
- class CAmControlSender;
+#ifdef TRACE_GRAPH
+# define COUT_NODE(HEAD, NAME, ID) \
+ std::cout << HEAD << "(" << std::setfill('0') << std::setw(4) << ID << " " << NAME << ")"
- /**
- * Implements autorouting algorithm for connecting sinks and sources via different audio domains.
- */
- class CAmRouter: public CAmDatabaseHandlerMap::AmDatabaseObserverCallbacks
+ void trace() const
{
- IAmDatabaseHandler* mpDatabaseHandler; //!< pointer to database handler
- CAmControlSender* mpControlSender; //!< pointer the controlsender - is used to retrieve information for the optimal route
- bool mUpdateGraphNodesAction; //!< Flag which marks whether the graph should be rebuild
- unsigned mMaxAllowedCycles; //!< max allowed cycles, default is 1
- unsigned mMaxPathCount; //!< max paths count returned to the controller, default is 5
- CAmRoutingGraph mRoutingGraph; //!< graph object
- std::map<am_domainID_t, std::vector<CAmRoutingNode*>> mNodeListSources; //!< map with pointers to nodes with sources, used for quick access
- std::map<am_domainID_t, std::vector<CAmRoutingNode*>> mNodeListSinks; //!< map with pointers to nodes with sinks, used for quick access
- std::map<am_domainID_t, std::vector<CAmRoutingNode*>> mNodeListGateways; //!< map with pointers to nodes with gateways, used for quick access
- std::map<am_domainID_t, std::vector<CAmRoutingNode*>> mNodeListConverters; //!< map with pointers to nodes with converters, used for quick access
-
- /**
- * Check whether given converter or gateway has been connected.
- *
- * @param comp converter or gateway .
- */
- template<class Component> bool isComponentConnected(const Component & comp)
+ if (type == SINK)
{
- return mpDatabaseHandler->isComponentConnected(comp);
+ COUT_NODE("SI", data.sink->name, data.sink->sinkID);
}
-
- /**
- * Connect all converters to its sink and sources if possible.
- *
- */
- void constructConverterConnections();
-
- /**
- * Connect all gateways to its sink and sources if possible.
- *
- */
- void constructGatewayConnections();
-
- /**
- * Connect all sources to the sinks if possible.
- *
- */
- void constructSourceSinkConnections();
-
- /**
- * Construct list with all vertices
- */
- void getVerticesForNode(const CAmRoutingNode & node, CAmRoutingListVertices & list);
-
- /**
- * Construct list with all vertices from given source.
- */
- void getVerticesForSource(const CAmRoutingNode & node, CAmRoutingListVertices & list);
-
- /**
- * Construct list with all vertices from given sink.
- */
- void getVerticesForSink(const CAmRoutingNode & node, CAmRoutingListVertices & list);
-
- /**
- * Construct list with all vertices from given converter.
- */
- void getVerticesForConverter(const CAmRoutingNode & node, CAmRoutingListVertices & list);
-
- /**
- * Construct list with all vertices from given gateway.
- */
- void getVerticesForGateway(const CAmRoutingNode & node, CAmRoutingListVertices & list);
-
- /**
- * Connection format permutations.
- *
- * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
- */
- am_Error_e determineConnectionFormatsForPath(am_Route_s & routeObjects, std::vector<CAmRoutingNode*> & nodes, std::vector<am_Route_s> & result);
- am_Error_e doConnectionFormatsForPath(am_Route_s & routeObjects, std::vector<CAmRoutingNode*> & route,
- std::vector<am_RoutingElement_s>::iterator routingElementIterator, std::vector<CAmRoutingNode*>::iterator routeIterator,
- std::vector<am_Route_s> & result);
- am_Error_e cfPermutationsForPath(am_Route_s shortestRoute, std::vector<CAmRoutingNode*> resultNodesPath, std::vector<am_Route_s>& resultPath);
-
- /**
- * Helper method.
- */
- static int insertPostion(const std::vector<CAmRoutingNode*>& path, const std::vector<std::vector<CAmRoutingNode*> >& nodes);
-
- public:
- CAmRouter(IAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSender);
- ~CAmRouter();
-
- unsigned getMaxAllowedCycles()
+ else if (type == SOURCE)
+ {
+ COUT_NODE("SO", data.source->name, data.source->sourceID);
+ }
+ else if (type == GATEWAY)
{
- return mMaxAllowedCycles;
+ COUT_NODE("GA", data.gateway->name, data.gateway->gatewayID);
}
- void setMaxAllowedCycles(unsigned count)
+ else if (type == CONVERTER)
{
- mMaxAllowedCycles = count;
+ COUT_NODE("CO", data.converter->name, data.converter->converterID);
}
+ }
+#endif // ifdef TRACE_GRAPH
- unsigned getMaxPathCount()
+ am_domainID_t domainID() const
+ {
+ if (type == SINK)
{
- return mMaxPathCount;
+ return data.sink->domainID;
}
- void setMaxPathCount(unsigned count)
+ else if (type == SOURCE)
{
- mMaxPathCount = count;
+ return data.source->domainID;
}
-
- bool getUpdateGraphNodesAction()
+ else if (type == GATEWAY)
+ {
+ return data.gateway->controlDomainID;
+ }
+ else if (type == CONVERTER)
{
- return mUpdateGraphNodesAction;
+ return data.converter->domainID;
}
- /**
- * Find first mMaxPathCount paths between given source and sink. This method will call the method load() if the parameter mUpdateGraphNodesAction is set which will rebuild the graph.
- *
- * @param onlyfree only disconnected elements should be included or not.
- * @param sourceID start point.
- * @param sinkID end point.
- * @param returnList list with all possible paths
- * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
- */
- 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 & source, const am_Sink_s & sink, std::vector<am_Route_s> & listRoutes);
-
- /**
- * Find first mMaxPathCount paths between given source and sink after the nodes have been loaded. This method doesn't call load().
- *
- * @param onlyfree only disconnected elements should be included or not.
- * @param sourceID start point.
- * @param sinkID end point.
- * @param returnList list with all possible paths
- * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
- */
- am_Error_e getRouteFromLoadedNodes(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList);
- am_Error_e getRouteFromLoadedNodes(const bool onlyfree, const am_Source_s & aSource, const am_Sink_s & aSink, std::vector<am_Route_s> & listRoutes);
-
- /**
- * Find first mMaxPathCount paths between given source and sink. This method doesn't call load().
- *
- * @param onlyfree only disconnected elements should be included or not.
- * @param cycles allowed domain cycles.
- * @param maxPathCount max count of returned paths.
- * @param source start point.
- * @param sink end point.
- * @param returnList list with all possible paths.
- * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
- */
- am_Error_e getFirstNShortestPaths(const bool onlyfree, const unsigned cycles, const unsigned maxPathCount, CAmRoutingNode & source,
- CAmRoutingNode & sink, std::vector<am_Route_s> & resultPath);
-
- /**
- * Find the shortest path between given source and sink. This method doesn't call load().
- * It goes through all possible paths and returns the shortest of them.
- *
- * @param source start point.
- * @param sink end point.
- * @param returnList list with the connection format permutations of the shortest path.
- * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
- */
- am_Error_e getShortestPath(CAmRoutingNode & source, CAmRoutingNode & sink, std::vector<am_Route_s> & resultPath);
-
- 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 void listPossibleConnectionFormats(std::vector<am_CustomConnectionFormat_t> & inListSourceFormats,
- std::vector<am_CustomConnectionFormat_t> & inListSinkFormats, std::vector<am_CustomConnectionFormat_t> & outListFormats);
- 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);
- static am_Error_e getSourceSinkPossibleConnectionFormats(std::vector<CAmRoutingNode*>::iterator iteratorSource,
- std::vector<CAmRoutingNode*>::iterator iteratorSink, std::vector<am_CustomConnectionFormat_t> & outConnectionFormats);
-
- static bool shouldGoInDomain(const std::vector<am_domainID_t> & visitedDomains, const am_domainID_t nodeDomainID, const unsigned maxCyclesNumber);
- bool shouldGoInDomain(const std::vector<am_domainID_t> & visitedDomains, const am_domainID_t nodeDomainID);
- /**
- * Returns a sink node with given sinkID.
- *
- * @param sinkID sink id.
- * @return pointer to node or NULL.
- */
- CAmRoutingNode* sinkNodeWithID(const am_sinkID_t sinkID);
- CAmRoutingNode* sinkNodeWithID(const am_sinkID_t sinkID, const am_domainID_t domainID);
-
- /**
- * Returns a source node with given sourceID.
- *
- * @param sourceID source id.
- * @return pointer to node or NULL.
- */
- CAmRoutingNode* sourceNodeWithID(const am_sourceID_t sourceID);
- CAmRoutingNode* sourceNodeWithID(const am_sourceID_t sourceID, const am_domainID_t domainID);
-
- /**
- * Returns a converter node for given sinkID.
- *
- * @param sinkID sink id.
- * @param domainID domain id.
- * @return pointer to node or NULL.
- */
- CAmRoutingNode* converterNodeWithSinkID(const am_sinkID_t sinkID, const am_domainID_t domainID);
-
- /**
- * Returns a gateway node for given sinkID.
- *
- * @param sinkID sink id.
- * @return pointer to node or NULL.
- */
- CAmRoutingNode* gatewayNodeWithSinkID(const am_sinkID_t sinkID);
-
- void load();
- void clear();
-
- /**
- * DEPRECATED!
- */
- public:
- am_Error_e getAllPaths(CAmRoutingNode & aSource, CAmRoutingNode & aSink, std::vector<am_Route_s> & resultPath,
- std::vector<std::vector<CAmRoutingNode*>> & resultNodesPath, const bool includeCycles = false,
- const bool onlyFree = false)
- __attribute__((deprecated("You should use am_Error_e getFirstNShortestPaths(const bool onlyFree, CAmRoutingNode &, CAmRoutingNode &, std::vector<am_Route_s> &) instead!")));
- };
+ return 0;
+ }
+
+};
+
+typedef am_RoutingNodeData_s::am_NodeDataType_e CAmNodeDataType;
+typedef CAmNode<am_RoutingNodeData_s> CAmRoutingNode;
+typedef CAmGraph<am_RoutingNodeData_s, uint16_t> CAmRoutingGraph;
+typedef CAmVertex<am_RoutingNodeData_s, uint16_t> CAmRoutingVertex;
+typedef std::list<CAmRoutingVertex> CAmRoutingListVertices;
+typedef std::vector<CAmRoutingListVertices *> CAmRoutingVertexReferenceList;
+
+class CAmControlSender;
+
+/**
+ * Implements autorouting algorithm for connecting sinks and sources via different audio domains.
+ */
+class CAmRouter : public CAmDatabaseHandlerMap::AmDatabaseObserverCallbacks
+{
+ IAmDatabaseHandler *mpDatabaseHandler; //!< pointer to database handler
+ CAmControlSender *mpControlSender; //!< pointer the controlsender - is used to retrieve information for the optimal route
+ bool mUpdateGraphNodesAction; //!< Flag which marks whether the graph should be rebuild
+ unsigned mMaxAllowedCycles; //!< max allowed cycles, default is 1
+ unsigned mMaxPathCount; //!< max paths count returned to the controller, default is 5
+ CAmRoutingGraph mRoutingGraph; //!< graph object
+ std::map<am_domainID_t, std::vector<CAmRoutingNode *> > mNodeListSources; //!< map with pointers to nodes with sources, used for quick access
+ std::map<am_domainID_t, std::vector<CAmRoutingNode *> > mNodeListSinks; //!< map with pointers to nodes with sinks, used for quick access
+ std::map<am_domainID_t, std::vector<CAmRoutingNode *> > mNodeListGateways; //!< map with pointers to nodes with gateways, used for quick access
+ std::map<am_domainID_t, std::vector<CAmRoutingNode *> > mNodeListConverters; //!< map with pointers to nodes with converters, used for quick access
+
+ /**
+ * Check whether given converter or gateway has been connected.
+ *
+ * @param comp converter or gateway .
+ */
+ template<class Component>
+ bool isComponentConnected(const Component &comp)
+ {
+ return mpDatabaseHandler->isComponentConnected(comp);
+ }
+
+ /**
+ * Connect all converters to its sink and sources if possible.
+ *
+ */
+ void constructConverterConnections();
+
+ /**
+ * Connect all gateways to its sink and sources if possible.
+ *
+ */
+ void constructGatewayConnections();
+
+ /**
+ * Connect all sources to the sinks if possible.
+ *
+ */
+ void constructSourceSinkConnections();
+
+ /**
+ * Construct list with all vertices
+ */
+ void getVerticesForNode(const CAmRoutingNode &node, CAmRoutingListVertices &list);
+
+ /**
+ * Construct list with all vertices from given source.
+ */
+ void getVerticesForSource(const CAmRoutingNode &node, CAmRoutingListVertices &list);
+
+ /**
+ * Construct list with all vertices from given sink.
+ */
+ void getVerticesForSink(const CAmRoutingNode &node, CAmRoutingListVertices &list);
+
+ /**
+ * Construct list with all vertices from given converter.
+ */
+ void getVerticesForConverter(const CAmRoutingNode &node, CAmRoutingListVertices &list);
+
+ /**
+ * Construct list with all vertices from given gateway.
+ */
+ void getVerticesForGateway(const CAmRoutingNode &node, CAmRoutingListVertices &list);
+
+ /**
+ * Connection format permutations.
+ *
+ * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
+ */
+ am_Error_e determineConnectionFormatsForPath(am_Route_s &routeObjects, std::vector<CAmRoutingNode *> &nodes, std::vector<am_Route_s> &result);
+ am_Error_e doConnectionFormatsForPath(am_Route_s &routeObjects, std::vector<CAmRoutingNode *> &route,
+ std::vector<am_RoutingElement_s>::iterator routingElementIterator, std::vector<CAmRoutingNode *>::iterator routeIterator,
+ std::vector<am_Route_s> &result);
+ am_Error_e cfPermutationsForPath(am_Route_s shortestRoute, std::vector<CAmRoutingNode *> resultNodesPath, std::vector<am_Route_s> &resultPath);
+
+ /**
+ * Helper method.
+ */
+ static int insertPostion(const std::vector<CAmRoutingNode *> &path, const std::vector<std::vector<CAmRoutingNode *> > &nodes);
+
+public:
+ CAmRouter(IAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iSender);
+ ~CAmRouter();
+
+ unsigned getMaxAllowedCycles()
+ {
+ return mMaxAllowedCycles;
+ }
+
+ void setMaxAllowedCycles(unsigned count)
+ {
+ mMaxAllowedCycles = count;
+ }
+
+ unsigned getMaxPathCount()
+ {
+ return mMaxPathCount;
+ }
+
+ void setMaxPathCount(unsigned count)
+ {
+ mMaxPathCount = count;
+ }
+
+ bool getUpdateGraphNodesAction()
+ {
+ return mUpdateGraphNodesAction;
+ }
+
+ /**
+ * Find first mMaxPathCount paths between given source and sink. This method will call the method load() if the parameter mUpdateGraphNodesAction is set which will rebuild the graph.
+ *
+ * @param onlyfree only disconnected elements should be included or not.
+ * @param sourceID start point.
+ * @param sinkID end point.
+ * @param returnList list with all possible paths
+ * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
+ */
+ 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 &source, const am_Sink_s &sink, std::vector<am_Route_s> &listRoutes);
+
+ /**
+ * Find first mMaxPathCount paths between given source and sink after the nodes have been loaded. This method doesn't call load().
+ *
+ * @param onlyfree only disconnected elements should be included or not.
+ * @param sourceID start point.
+ * @param sinkID end point.
+ * @param returnList list with all possible paths
+ * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
+ */
+ am_Error_e getRouteFromLoadedNodes(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> &returnList);
+ am_Error_e getRouteFromLoadedNodes(const bool onlyfree, const am_Source_s &aSource, const am_Sink_s &aSink, std::vector<am_Route_s> &listRoutes);
+
+ /**
+ * Find first mMaxPathCount paths between given source and sink. This method doesn't call load().
+ *
+ * @param onlyfree only disconnected elements should be included or not.
+ * @param cycles allowed domain cycles.
+ * @param maxPathCount max count of returned paths.
+ * @param source start point.
+ * @param sink end point.
+ * @param returnList list with all possible paths.
+ * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
+ */
+ am_Error_e getFirstNShortestPaths(const bool onlyfree, const unsigned cycles, const unsigned maxPathCount, CAmRoutingNode &source,
+ CAmRoutingNode &sink, std::vector<am_Route_s> &resultPath);
+
+ /**
+ * Find the shortest path between given source and sink. This method doesn't call load().
+ * It goes through all possible paths and returns the shortest of them.
+ *
+ * @param source start point.
+ * @param sink end point.
+ * @param returnList list with the connection format permutations of the shortest path.
+ * @return E_OK on success(1 or more paths), E_NOT_POSSIBLE if the CF couldn't be matached or E_UNKNOWN in any other error case.
+ */
+ am_Error_e getShortestPath(CAmRoutingNode &source, CAmRoutingNode &sink, std::vector<am_Route_s> &resultPath);
+
+ 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 void listPossibleConnectionFormats(std::vector<am_CustomConnectionFormat_t> &inListSourceFormats,
+ std::vector<am_CustomConnectionFormat_t> &inListSinkFormats, std::vector<am_CustomConnectionFormat_t> &outListFormats);
+ 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);
+ static am_Error_e getSourceSinkPossibleConnectionFormats(std::vector<CAmRoutingNode *>::iterator iteratorSource,
+ std::vector<CAmRoutingNode *>::iterator iteratorSink, std::vector<am_CustomConnectionFormat_t> &outConnectionFormats);
+
+ static bool shouldGoInDomain(const std::vector<am_domainID_t> &visitedDomains, const am_domainID_t nodeDomainID, const unsigned maxCyclesNumber);
+ bool shouldGoInDomain(const std::vector<am_domainID_t> &visitedDomains, const am_domainID_t nodeDomainID);
+
+ /**
+ * Returns a sink node with given sinkID.
+ *
+ * @param sinkID sink id.
+ * @return pointer to node or NULL.
+ */
+ CAmRoutingNode *sinkNodeWithID(const am_sinkID_t sinkID);
+ CAmRoutingNode *sinkNodeWithID(const am_sinkID_t sinkID, const am_domainID_t domainID);
+
+ /**
+ * Returns a source node with given sourceID.
+ *
+ * @param sourceID source id.
+ * @return pointer to node or NULL.
+ */
+ CAmRoutingNode *sourceNodeWithID(const am_sourceID_t sourceID);
+ CAmRoutingNode *sourceNodeWithID(const am_sourceID_t sourceID, const am_domainID_t domainID);
+
+ /**
+ * Returns a converter node for given sinkID.
+ *
+ * @param sinkID sink id.
+ * @param domainID domain id.
+ * @return pointer to node or NULL.
+ */
+ CAmRoutingNode *converterNodeWithSinkID(const am_sinkID_t sinkID, const am_domainID_t domainID);
+
+ /**
+ * Returns a gateway node for given sinkID.
+ *
+ * @param sinkID sink id.
+ * @return pointer to node or NULL.
+ */
+ CAmRoutingNode *gatewayNodeWithSinkID(const am_sinkID_t sinkID);
+
+ void load();
+ void clear();
+
+ /**
+ * DEPRECATED!
+ */
+public:
+ am_Error_e getAllPaths(CAmRoutingNode &aSource, CAmRoutingNode &aSink, std::vector<am_Route_s> &resultPath,
+ std::vector<std::vector<CAmRoutingNode *> > &resultNodesPath, const bool includeCycles = false,
+ const bool onlyFree = false)
+ __attribute__((deprecated("You should use am_Error_e getFirstNShortestPaths(const bool onlyFree, CAmRoutingNode &, CAmRoutingNode &, std::vector<am_Route_s> &) instead!")));
+
+};
+
} /* namespace am */
#endif /* ROUTER_H_ */
-
diff --git a/AudioManagerCore/include/CAmRoutingReceiver.h b/AudioManagerCore/include/CAmRoutingReceiver.h
index e8f464f..42f3e89 100644
--- a/AudioManagerCore/include/CAmRoutingReceiver.h
+++ b/AudioManagerCore/include/CAmRoutingReceiver.h
@@ -38,7 +38,7 @@ class CAmControlSender;
/**
* Implements the Receiving side of the RoutingPlugins.
*/
-class CAmRoutingReceiver: public IAmRoutingReceive
+class CAmRoutingReceiver : public IAmRoutingReceive
{
public:
CAmRoutingReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler);
@@ -56,47 +56,47 @@ public:
void ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error);
void ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume);
void ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume);
- am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
- am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID);
+ am_Error_e peekDomain(const std::string &name, am_domainID_t &domainID);
+ 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 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 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);
- am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
- am_Error_e registerSource(const am_Source_s& sourceData, am_sourceID_t& sourceID);
+ am_Error_e peekSource(const std::string &name, am_sourceID_t &sourceID);
+ am_Error_e registerSource(const am_Source_s &sourceData, am_sourceID_t &sourceID);
am_Error_e deregisterSource(const am_sourceID_t sourceID);
- am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
+ am_Error_e registerCrossfader(const am_Crossfader_s &crossfaderData, am_crossfaderID_t &crossfaderID);
am_Error_e deregisterCrossfader(const am_crossfaderID_t crossfaderID);
- am_Error_e peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID);
- am_Error_e peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID);
+ am_Error_e peekSourceClassID(const std::string &name, am_sourceClass_t &sourceClassID);
+ am_Error_e peekSinkClassID(const std::string &name, am_sinkClass_t &sinkClassID);
void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState);
void hookDomainRegistrationComplete(const am_domainID_t domainID);
- void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability);
- void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s &availability);
+ void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s &availability);
void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState);
void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay);
- void sendChangedData(const std::vector<am_EarlyData_s>& earlyData);
- am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const;
- am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const;
- void getInterfaceVersion(std::string& version) const;
+ void sendChangedData(const std::vector<am_EarlyData_s> &earlyData);
+ am_Error_e getDBusConnectionWrapper(CAmDbusWrapper * &dbusConnectionWrapper) const;
+ am_Error_e getSocketHandler(CAmSocketHandler * &socketHandler) const;
+ void getInterfaceVersion(std::string &version) const;
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) ;
- void ackSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) ;
- void ackSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error) ;
- void hookSinkNotificationDataChange(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload) ;
- void hookSourceNotificationDataChange(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload) ;
- am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const;
- am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t& domainID) const;
- am_Error_e getDomainOfCrossfader(const am_crossfaderID_t crossfader, am_domainID_t& domainID) const;
+ 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);
+ void ackSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error);
+ void ackSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error);
+ void hookSinkNotificationDataChange(const am_sinkID_t sinkID, const am_NotificationPayload_s &payload);
+ void hookSourceNotificationDataChange(const am_sourceID_t sourceID, const am_NotificationPayload_s &payload);
+ am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t &domainID) const;
+ am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t &domainID) const;
+ am_Error_e getDomainOfCrossfader(const am_crossfaderID_t crossfader, am_domainID_t &domainID) const;
uint16_t getStartupHandle(); //!< returns a startup handle
uint16_t getRundownHandle(); //!< returns a rundown handle
@@ -105,23 +105,23 @@ public:
void waitOnRundown(bool rundown); //!< tells the RoutingReceiver to start waiting for all handles to be confirmed
private:
-
- void handleCallback(const am_Handle_s handle, const am_Error_e error);
- IAmDatabaseHandler *mpDatabaseHandler; //!< pointer to the databaseHandler
- CAmRoutingSender *mpRoutingSender; //!< pointer to the routingSender
- CAmControlSender *mpControlSender; //!< pointer to the controlSender
- CAmSocketHandler *mpSocketHandler; //!< pointer to sockethandler
- CAmDbusWrapper *mpDBusWrapper; //!< pointer to dbuswrapper
+ void handleCallback(const am_Handle_s handle, const am_Error_e error);
+
+ IAmDatabaseHandler *mpDatabaseHandler; //!< pointer to the databaseHandler
+ CAmRoutingSender *mpRoutingSender; //!< pointer to the routingSender
+ CAmControlSender *mpControlSender; //!< pointer to the controlSender
+ CAmSocketHandler *mpSocketHandler; //!< pointer to sockethandler
+ CAmDbusWrapper *mpDBusWrapper; //!< pointer to dbuswrapper
std::vector<uint16_t> mListStartupHandles; //!< list of handles that wait for a confirm
std::vector<uint16_t> mListRundownHandles; //!< list of handles that wait for a confirm
- uint16_t handleCount; //!< counts all handles
- bool mWaitStartup; //!< if true confirmation will be sent if list of handles = 0
- bool mWaitRundown; //!< if true confirmation will be sent if list of handles = 0
+ uint16_t handleCount; //!< counts all handles
+ bool mWaitStartup; //!< if true confirmation will be sent if list of handles = 0
+ bool mWaitRundown; //!< if true confirmation will be sent if list of handles = 0
- am_Error_e mLastStartupError;
- am_Error_e mLastRundownError;
+ am_Error_e mLastStartupError;
+ am_Error_e mLastRundownError;
};
diff --git a/AudioManagerCore/include/CAmRoutingSender.h b/AudioManagerCore/include/CAmRoutingSender.h
index e14dd6d..39b5c23 100644
--- a/AudioManagerCore/include/CAmRoutingSender.h
+++ b/AudioManagerCore/include/CAmRoutingSender.h
@@ -28,8 +28,8 @@
#include <map>
#include <memory>
-#ifdef UNIT_TEST //this is needed to test RoutingSender
-#include "../test/IAmRoutingBackdoor.h"
+#ifdef UNIT_TEST // this is needed to test RoutingSender
+# include "../test/IAmRoutingBackdoor.h"
#endif
#include "CAmDatabaseHandlerMap.h"
@@ -42,292 +42,309 @@ class CAmRoutingReceiver;
/**
* Implements the RoutingSendInterface. Loads all plugins and dispatches calls to the plugins
*/
-class CAmRoutingSender: public CAmDatabaseHandlerMap::AmDatabaseObserverCallbacks
+class CAmRoutingSender : public CAmDatabaseHandlerMap::AmDatabaseObserverCallbacks
{
public:
- CAmRoutingSender(const std::vector<std::string>& listOfPluginDirectories, IAmDatabaseHandler* databaseHandler);
+ CAmRoutingSender(const std::vector<std::string> &listOfPluginDirectories, IAmDatabaseHandler *databaseHandler);
~CAmRoutingSender();
- am_Error_e removeHandle(const am_Handle_s& handle);
- am_Error_e addDomainLookup(const am_Domain_s& domainData);
- am_Error_e addSourceLookup(const am_Source_s& sourceData);
- am_Error_e addSinkLookup(const am_Sink_s& sinkData);
- am_Error_e addCrossfaderLookup(const am_Crossfader_s& crossfaderData);
+ am_Error_e removeHandle(const am_Handle_s &handle);
+ am_Error_e addDomainLookup(const am_Domain_s &domainData);
+ am_Error_e addSourceLookup(const am_Source_s &sourceData);
+ am_Error_e addSinkLookup(const am_Sink_s &sinkData);
+ am_Error_e addCrossfaderLookup(const am_Crossfader_s &crossfaderData);
am_Error_e removeDomainLookup(const am_domainID_t domainID);
am_Error_e removeSourceLookup(const am_sourceID_t sourceID);
am_Error_e removeSinkLookup(const am_sinkID_t sinkID);
am_Error_e removeCrossfaderLookup(const am_crossfaderID_t crossfaderID);
am_Error_e removeConnectionLookup(const am_connectionID_t connectionID);
- am_Error_e startupInterfaces(CAmRoutingReceiver* iRoutingReceiver);
+ am_Error_e startupInterfaces(CAmRoutingReceiver *iRoutingReceiver);
void setRoutingReady();
void setRoutingRundown();
- am_Error_e asyncAbort(const am_Handle_s& handle);
- am_Error_e asyncConnect(am_Handle_s& handle, am_connectionID_t& connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_CustomConnectionFormat_t connectionFormat);
- am_Error_e asyncDisconnect(am_Handle_s& handle, const am_connectionID_t connectionID);
- am_Error_e asyncSetSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time);
- am_Error_e asyncSetSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time);
- am_Error_e asyncSetSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state);
- am_Error_e asyncSetSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty);
- am_Error_e asyncSetSourceSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID);
- am_Error_e asyncSetSinkSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sinkID_t sinkID);
- am_Error_e asyncSetSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty);
- am_Error_e asyncCrossFade(am_Handle_s& handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_CustomRampType_t rampType, const am_time_t time);
+ am_Error_e asyncAbort(const am_Handle_s &handle);
+ am_Error_e asyncConnect(am_Handle_s &handle, am_connectionID_t &connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_CustomConnectionFormat_t connectionFormat);
+ am_Error_e asyncDisconnect(am_Handle_s &handle, const am_connectionID_t connectionID);
+ am_Error_e asyncSetSinkVolume(am_Handle_s &handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time);
+ am_Error_e asyncSetSourceVolume(am_Handle_s &handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_CustomRampType_t ramp, const am_time_t time);
+ am_Error_e asyncSetSourceState(am_Handle_s &handle, const am_sourceID_t sourceID, const am_SourceState_e state);
+ am_Error_e asyncSetSinkSoundProperty(am_Handle_s &handle, const am_sinkID_t sinkID, const am_SoundProperty_s &soundProperty);
+ am_Error_e asyncSetSourceSoundProperties(am_Handle_s &handle, const std::vector<am_SoundProperty_s> &listSoundProperties, const am_sourceID_t sourceID);
+ am_Error_e asyncSetSinkSoundProperties(am_Handle_s &handle, const std::vector<am_SoundProperty_s> &listSoundProperties, const am_sinkID_t sinkID);
+ am_Error_e asyncSetSourceSoundProperty(am_Handle_s &handle, const am_sourceID_t sourceID, const am_SoundProperty_s &soundProperty);
+ am_Error_e asyncCrossFade(am_Handle_s &handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_CustomRampType_t rampType, const am_time_t time);
am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState);
- am_Error_e getListHandles(std::vector<am_Handle_s> & listHandles) const;
- am_Error_e getListPlugins(std::vector<std::string>& interfaces) const;
- void getInterfaceVersion(std::string& version) const;
- am_Error_e asyncSetVolumes(am_Handle_s& handle, const std::vector<am_Volumes_s>& listVolumes);
- am_Error_e asyncSetSinkNotificationConfiguration(am_Handle_s& handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration);
- am_Error_e asyncSetSourceNotificationConfiguration(am_Handle_s& handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration);
- am_Error_e resyncConnectionState(const am_domainID_t domainID, std::vector<am_Connection_s>& listOfExistingConnections);
+ am_Error_e getListHandles(std::vector<am_Handle_s> &listHandles) const;
+ am_Error_e getListPlugins(std::vector<std::string> &interfaces) const;
+ void getInterfaceVersion(std::string &version) const;
+ am_Error_e asyncSetVolumes(am_Handle_s &handle, const std::vector<am_Volumes_s> &listVolumes);
+ am_Error_e asyncSetSinkNotificationConfiguration(am_Handle_s &handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s &notificationConfiguration);
+ am_Error_e asyncSetSourceNotificationConfiguration(am_Handle_s &handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s &notificationConfiguration);
+ am_Error_e resyncConnectionState(const am_domainID_t domainID, std::vector<am_Connection_s> &listOfExistingConnections);
struct InterfaceNamePairs //!< is used to pair interfaces with busnames
{
- IAmRoutingSend* routingInterface; //!< pointer to the routingInterface
- std::string busName; //!< the busname
+ IAmRoutingSend *routingInterface; //!< pointer to the routingInterface
+ std::string busName; //!< the busname
};
-
+
class handleDataBase
{
- public:
- handleDataBase(IAmRoutingSend* interface, IAmDatabaseHandler* databaseHandler) : mInterface(interface), mpDatabaseHandler(databaseHandler) {}
- virtual ~handleDataBase() {}
- virtual am_Error_e writeDataToDatabase()=0; //!< function to write the handle data to the database
- IAmRoutingSend* returnInterface() {return mInterface;}
- private:
- IAmRoutingSend* mInterface;
- protected:
- IAmDatabaseHandler* mpDatabaseHandler;
- };
-
- class handleVolumeBase : public handleDataBase
- {
- public:
- handleVolumeBase(IAmRoutingSend* interface, IAmDatabaseHandler* databaseHandler,am_volume_t volume) :
- handleDataBase(interface,databaseHandler)
- ,mVolume(volume) {}
- virtual ~handleVolumeBase(){}
- am_volume_t returnVolume() { return mVolume; }
- private:
- am_volume_t mVolume;
- };
-
- class handleSinkSoundProperty : public handleDataBase
- {
- public:
- handleSinkSoundProperty(IAmRoutingSend* interface,const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mSinkID(sinkID)
- ,mSoundProperty(soundProperty) {}
- ~handleSinkSoundProperty() {}
- am_Error_e writeDataToDatabase();
- private:
- am_sinkID_t mSinkID;
- am_SoundProperty_s mSoundProperty;
- };
-
- class handleSinkSoundProperties : public handleDataBase
- {
- public:
- handleSinkSoundProperties(IAmRoutingSend* interface,const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mSinkID(sinkID)
- ,mlistSoundProperties(listSoundProperties) {}
- ~handleSinkSoundProperties() {}
- am_Error_e writeDataToDatabase();
- private:
- am_sinkID_t mSinkID;
- std::vector<am_SoundProperty_s> mlistSoundProperties;
- };
-
- class handleSourceSoundProperty : public handleDataBase
- {
- public:
- handleSourceSoundProperty(IAmRoutingSend* interface,const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mSourceID(sourceID)
- ,mSoundProperty(soundProperty) {}
- ~handleSourceSoundProperty() {}
- am_Error_e writeDataToDatabase();
- private:
- am_sourceID_t mSourceID;
- am_SoundProperty_s mSoundProperty;
- };
-
- class handleSourceSoundProperties : public handleDataBase
- {
- public:
- handleSourceSoundProperties(IAmRoutingSend* interface,const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mSourceID(sourceID)
- ,mlistSoundProperties(listSoundProperties) {}
- ~handleSourceSoundProperties(){}
- am_Error_e writeDataToDatabase();
- private:
- am_sourceID_t mSourceID;
- std::vector<am_SoundProperty_s> mlistSoundProperties;
- };
-
- class handleSourceState : public handleDataBase
- {
- public:
- handleSourceState(IAmRoutingSend* interface,const am_sourceID_t sourceID, const am_SourceState_e& state, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mSourceID(sourceID)
- ,mSourceState(state) {}
- ~handleSourceState() {}
- am_Error_e writeDataToDatabase();
- private:
- am_sourceID_t mSourceID;
- am_SourceState_e mSourceState;
- };
-
- class handleSourceVolume : public handleVolumeBase
- {
- public:
- handleSourceVolume(IAmRoutingSend* interface, const am_sourceID_t sourceID, IAmDatabaseHandler* databaseHandler,const am_volume_t& volume) :
- handleVolumeBase(interface,databaseHandler,volume)
- ,mSourceID(sourceID) {}
- ~handleSourceVolume() {}
- am_Error_e writeDataToDatabase();
- private:
- am_sourceID_t mSourceID;
- };
-
- class handleSinkVolume : public handleVolumeBase
- {
- public:
- handleSinkVolume(IAmRoutingSend* interface, const am_sinkID_t sinkID, IAmDatabaseHandler* databaseHandler,const am_volume_t& volume) :
- handleVolumeBase(interface,databaseHandler,volume)
- ,mSinkID(sinkID) {}
- ~handleSinkVolume() {}
- am_Error_e writeDataToDatabase();
- private:
- am_sinkID_t mSinkID;
- };
-
- class handleCrossFader : public handleDataBase
- {
- public:
- handleCrossFader(IAmRoutingSend* interface, const am_crossfaderID_t crossfaderID, const am_HotSink_e& hotSink, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mCrossfaderID(crossfaderID)
- ,mHotSink(hotSink) {}
- ~handleCrossFader() {}
- am_Error_e writeDataToDatabase();
- private:
- am_crossfaderID_t mCrossfaderID;
- am_HotSink_e mHotSink;
- };
-
- class handleConnect : public handleDataBase
- {
- public:
- handleConnect(IAmRoutingSend* interface, const am_connectionID_t connectionID, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mConnectionID(connectionID)
- ,mConnectionPending(true) {}
- ~handleConnect();
- am_Error_e writeDataToDatabase();
- private:
- am_connectionID_t mConnectionID;
- bool mConnectionPending;
- };
-
- class handleDisconnect : public handleDataBase
- {
- public:
- handleDisconnect(IAmRoutingSend* interface, const am_connectionID_t connectionID, IAmDatabaseHandler* databaseHandler,CAmRoutingSender* routingSender) :
- handleDataBase(interface,databaseHandler)
- ,mConnectionID(connectionID)
- ,mRoutingSender(routingSender){}
- ~handleDisconnect();
- am_Error_e writeDataToDatabase();
- private:
- am_connectionID_t mConnectionID;
- CAmRoutingSender* mRoutingSender;
- };
-
- class handleSetVolumes : public handleDataBase
- {
- public:
- handleSetVolumes(IAmRoutingSend* interface, const std::vector<am_Volumes_s> listVolumes, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mlistVolumes(listVolumes) {}
- ~handleSetVolumes() {}
- am_Error_e writeDataToDatabase();
- private:
- std::vector<am_Volumes_s> mlistVolumes;
- };
-
- class handleSetSinkNotificationConfiguration : public handleDataBase
- {
- public:
- handleSetSinkNotificationConfiguration(IAmRoutingSend* interface, const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mSinkID(sinkID)
- ,mNotificationConfiguration(notificationConfiguration){}
- ~handleSetSinkNotificationConfiguration() {}
- am_Error_e writeDataToDatabase();
- private:
- am_sinkID_t mSinkID;
- am_NotificationConfiguration_s mNotificationConfiguration;
- };
-
- class handleSetSourceNotificationConfiguration : public handleDataBase
- {
- public:
- handleSetSourceNotificationConfiguration(IAmRoutingSend* interface, const am_sourceID_t sourceID, const am_NotificationConfiguration_s notificationConfiguration, IAmDatabaseHandler* databaseHandler) :
- handleDataBase(interface,databaseHandler)
- ,mSourceID(sourceID)
- ,mNotificationConfiguration(notificationConfiguration) {}
- ~handleSetSourceNotificationConfiguration() {}
- am_Error_e writeDataToDatabase();
- private:
- am_sourceID_t mSourceID;
- am_NotificationConfiguration_s mNotificationConfiguration;
- };
-
+ public:
+ handleDataBase(IAmRoutingSend *interface, IAmDatabaseHandler *databaseHandler)
+ : mInterface(interface)
+ , mpDatabaseHandler(databaseHandler) {}
+ virtual ~handleDataBase() {}
+ virtual am_Error_e writeDataToDatabase() = 0; //!< function to write the handle data to the database
+
+ IAmRoutingSend *returnInterface() {return mInterface;}
+ private:
+ IAmRoutingSend *mInterface;
+ protected:
+ IAmDatabaseHandler *mpDatabaseHandler;
+ };
+
+ class handleVolumeBase : public handleDataBase
+ {
+ public:
+ handleVolumeBase(IAmRoutingSend *interface, IAmDatabaseHandler *databaseHandler, am_volume_t volume)
+ : handleDataBase(interface, databaseHandler)
+ , mVolume(volume) {}
+ virtual ~handleVolumeBase(){}
+ am_volume_t returnVolume() { return mVolume; }
+ private:
+ am_volume_t mVolume;
+ };
+
+ class handleSinkSoundProperty : public handleDataBase
+ {
+ public:
+ handleSinkSoundProperty(IAmRoutingSend *interface, const am_sinkID_t sinkID, const am_SoundProperty_s &soundProperty, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mSinkID(sinkID)
+ , mSoundProperty(soundProperty) {}
+ ~handleSinkSoundProperty() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sinkID_t mSinkID;
+ am_SoundProperty_s mSoundProperty;
+ };
+
+ class handleSinkSoundProperties : public handleDataBase
+ {
+ public:
+ handleSinkSoundProperties(IAmRoutingSend *interface, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> &listSoundProperties, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mSinkID(sinkID)
+ , mlistSoundProperties(listSoundProperties) {}
+ ~handleSinkSoundProperties() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sinkID_t mSinkID;
+ std::vector<am_SoundProperty_s> mlistSoundProperties;
+ };
+
+ class handleSourceSoundProperty : public handleDataBase
+ {
+ public:
+ handleSourceSoundProperty(IAmRoutingSend *interface, const am_sourceID_t sourceID, const am_SoundProperty_s &soundProperty, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mSourceID(sourceID)
+ , mSoundProperty(soundProperty) {}
+ ~handleSourceSoundProperty() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sourceID_t mSourceID;
+ am_SoundProperty_s mSoundProperty;
+ };
+
+ class handleSourceSoundProperties : public handleDataBase
+ {
+ public:
+ handleSourceSoundProperties(IAmRoutingSend *interface, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> &listSoundProperties, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mSourceID(sourceID)
+ , mlistSoundProperties(listSoundProperties) {}
+ ~handleSourceSoundProperties(){}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sourceID_t mSourceID;
+ std::vector<am_SoundProperty_s> mlistSoundProperties;
+ };
+
+ class handleSourceState : public handleDataBase
+ {
+ public:
+ handleSourceState(IAmRoutingSend *interface, const am_sourceID_t sourceID, const am_SourceState_e &state, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mSourceID(sourceID)
+ , mSourceState(state) {}
+ ~handleSourceState() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sourceID_t mSourceID;
+ am_SourceState_e mSourceState;
+ };
+
+ class handleSourceVolume : public handleVolumeBase
+ {
+ public:
+ handleSourceVolume(IAmRoutingSend *interface, const am_sourceID_t sourceID, IAmDatabaseHandler *databaseHandler, const am_volume_t &volume)
+ : handleVolumeBase(interface, databaseHandler, volume)
+ , mSourceID(sourceID) {}
+ ~handleSourceVolume() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sourceID_t mSourceID;
+ };
+
+ class handleSinkVolume : public handleVolumeBase
+ {
+ public:
+ handleSinkVolume(IAmRoutingSend *interface, const am_sinkID_t sinkID, IAmDatabaseHandler *databaseHandler, const am_volume_t &volume)
+ : handleVolumeBase(interface, databaseHandler, volume)
+ , mSinkID(sinkID) {}
+ ~handleSinkVolume() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sinkID_t mSinkID;
+ };
+
+ class handleCrossFader : public handleDataBase
+ {
+ public:
+ handleCrossFader(IAmRoutingSend *interface, const am_crossfaderID_t crossfaderID, const am_HotSink_e &hotSink, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mCrossfaderID(crossfaderID)
+ , mHotSink(hotSink) {}
+ ~handleCrossFader() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_crossfaderID_t mCrossfaderID;
+ am_HotSink_e mHotSink;
+ };
+
+ class handleConnect : public handleDataBase
+ {
+ public:
+ handleConnect(IAmRoutingSend *interface, const am_connectionID_t connectionID, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mConnectionID(connectionID)
+ , mConnectionPending(true) {}
+ ~handleConnect();
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_connectionID_t mConnectionID;
+ bool mConnectionPending;
+ };
+
+ class handleDisconnect : public handleDataBase
+ {
+ public:
+ handleDisconnect(IAmRoutingSend *interface, const am_connectionID_t connectionID, IAmDatabaseHandler *databaseHandler, CAmRoutingSender *routingSender)
+ : handleDataBase(interface, databaseHandler)
+ , mConnectionID(connectionID)
+ , mRoutingSender(routingSender){}
+ ~handleDisconnect();
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_connectionID_t mConnectionID;
+ CAmRoutingSender *mRoutingSender;
+ };
+
+ class handleSetVolumes : public handleDataBase
+ {
+ public:
+ handleSetVolumes(IAmRoutingSend *interface, const std::vector<am_Volumes_s> listVolumes, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mlistVolumes(listVolumes) {}
+ ~handleSetVolumes() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ std::vector<am_Volumes_s> mlistVolumes;
+ };
+
+ class handleSetSinkNotificationConfiguration : public handleDataBase
+ {
+ public:
+ handleSetSinkNotificationConfiguration(IAmRoutingSend *interface, const am_sinkID_t sinkID, const am_NotificationConfiguration_s notificationConfiguration, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mSinkID(sinkID)
+ , mNotificationConfiguration(notificationConfiguration){}
+ ~handleSetSinkNotificationConfiguration() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sinkID_t mSinkID;
+ am_NotificationConfiguration_s mNotificationConfiguration;
+ };
+
+ class handleSetSourceNotificationConfiguration : public handleDataBase
+ {
+ public:
+ handleSetSourceNotificationConfiguration(IAmRoutingSend *interface, const am_sourceID_t sourceID, const am_NotificationConfiguration_s notificationConfiguration, IAmDatabaseHandler *databaseHandler)
+ : handleDataBase(interface, databaseHandler)
+ , mSourceID(sourceID)
+ , mNotificationConfiguration(notificationConfiguration) {}
+ ~handleSetSourceNotificationConfiguration() {}
+ am_Error_e writeDataToDatabase();
+
+ private:
+ am_sourceID_t mSourceID;
+ am_NotificationConfiguration_s mNotificationConfiguration;
+ };
+
am_Error_e writeToDatabaseAndRemove(const am_Handle_s handle); //!< write data to Database and remove handle
void checkVolume(const am_Handle_s handle, const am_volume_t volume);
bool handleExists(const am_Handle_s handle); //!< returns true if the handle exists
-#ifdef UNIT_TEST //this is needed to test RoutingSender
+#ifdef UNIT_TEST // this is needed to test RoutingSender
friend class IAmRoutingBackdoor;
#endif
private:
struct comparator //!< is needed to sort the handles in the map
{
- bool operator()(const am_Handle_s& a, const am_Handle_s& b) const
+ bool operator()(const am_Handle_s &a, const am_Handle_s &b) const
{
- return (a.handle<b.handle || (a.handle==b.handle && a.handleType<b.handleType));
+ return (a.handle < b.handle || (a.handle == b.handle && a.handleType < b.handleType));
}
+
};
- void loadPlugins(const std::vector<std::string>& listOfPluginDirectories);
+ void loadPlugins(const std::vector<std::string> &listOfPluginDirectories);
am_Handle_s createHandle(std::shared_ptr<handleDataBase> handleData, const am_Handle_e type); //!< creates a handle
- void unloadLibraries(void); //!< unloads all loaded plugins
-
- typedef std::map<am_domainID_t, IAmRoutingSend*> DomainInterfaceMap; //!< maps domains to interfaces
- typedef std::map<am_sinkID_t, IAmRoutingSend*> SinkInterfaceMap; //!< maps sinks to interfaces
- typedef std::map<am_sourceID_t, IAmRoutingSend*> SourceInterfaceMap; //!< maps sources to interfaces
- typedef std::map<am_crossfaderID_t, IAmRoutingSend*> CrossfaderInterfaceMap; //!< maps crossfaders to interfaces
- typedef std::map<am_connectionID_t, IAmRoutingSend*> ConnectionInterfaceMap; //!< maps connections to interfaces
- typedef std::map<am_Handle_s, std::shared_ptr<handleDataBase>, comparator> HandlesMap; //!< maps handleData to handles
-
- int16_t mHandleCount; //!< is used to create handles
- HandlesMap mlistActiveHandles; //!< list of all currently "running" handles.
- std::vector<void*> mListLibraryHandles; //!< list of all loaded pluginInterfaces
- std::vector<InterfaceNamePairs> mListInterfaces; //!< list of busname/interface relation
- CrossfaderInterfaceMap mMapCrossfaderInterface; //!< map of crossfaders to interface
- ConnectionInterfaceMap mMapConnectionInterface; //!< map of connection to interfaces
- DomainInterfaceMap mMapDomainInterface; //!< map of domains to interfaces
- SinkInterfaceMap mMapSinkInterface; //!< map of sinks to interfaces
- SourceInterfaceMap mMapSourceInterface; //!< map of sources to interfaces
- CAmRoutingReceiver *mpRoutingReceiver; //!< pointer to routing receiver
- IAmDatabaseHandler* mpDatabaseHandler; //!< pointer to the databaseHandler
+ void unloadLibraries(void); //!< unloads all loaded plugins
+
+ typedef std::map<am_domainID_t, IAmRoutingSend *> DomainInterfaceMap; //!< maps domains to interfaces
+ typedef std::map<am_sinkID_t, IAmRoutingSend *> SinkInterfaceMap; //!< maps sinks to interfaces
+ typedef std::map<am_sourceID_t, IAmRoutingSend *> SourceInterfaceMap; //!< maps sources to interfaces
+ typedef std::map<am_crossfaderID_t, IAmRoutingSend *> CrossfaderInterfaceMap; //!< maps crossfaders to interfaces
+ typedef std::map<am_connectionID_t, IAmRoutingSend *> ConnectionInterfaceMap; //!< maps connections to interfaces
+ typedef std::map<am_Handle_s, std::shared_ptr<handleDataBase>, comparator> HandlesMap; //!< maps handleData to handles
+
+ int16_t mHandleCount; //!< is used to create handles
+ HandlesMap mlistActiveHandles; //!< list of all currently "running" handles.
+ std::vector<void *> mListLibraryHandles; //!< list of all loaded pluginInterfaces
+ std::vector<InterfaceNamePairs> mListInterfaces; //!< list of busname/interface relation
+ CrossfaderInterfaceMap mMapCrossfaderInterface; //!< map of crossfaders to interface
+ ConnectionInterfaceMap mMapConnectionInterface; //!< map of connection to interfaces
+ DomainInterfaceMap mMapDomainInterface; //!< map of domains to interfaces
+ SinkInterfaceMap mMapSinkInterface; //!< map of sinks to interfaces
+ SourceInterfaceMap mMapSourceInterface; //!< map of sources to interfaces
+ CAmRoutingReceiver *mpRoutingReceiver; //!< pointer to routing receiver
+ IAmDatabaseHandler *mpDatabaseHandler; //!< pointer to the databaseHandler
};
}
diff --git a/AudioManagerCore/include/IAmDatabaseHandler.h b/AudioManagerCore/include/IAmDatabaseHandler.h
index f4fe8a1..5272d4f 100644
--- a/AudioManagerCore/include/IAmDatabaseHandler.h
+++ b/AudioManagerCore/include/IAmDatabaseHandler.h
@@ -14,7 +14,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
*
* \file IAmDatabaseHandler.h
* For further information see http://www.genivi.org/.
@@ -38,13 +38,13 @@
namespace am
{
-//todo: check the enum values before entering & changing in the database.
-//todo: change asserts for dynamic boundary checks into failure answers.#
-//todo: check autoincrement boundary and set to 16bit limits
-//todo: If the sink is part of a gateway, the listconnectionFormats is copied to the gatewayInformation. Check this statement for sinks & sources
-//todo: exchange last_insert_row id to be more safe
-//todo: create test to ensure uniqueness of names throughout the database
-//todo: enforce the uniqueness of names
+// todo: check the enum values before entering & changing in the database.
+// todo: change asserts for dynamic boundary checks into failure answers.#
+// todo: check autoincrement boundary and set to 16bit limits
+// todo: If the sink is part of a gateway, the listconnectionFormats is copied to the gatewayInformation. Check this statement for sinks & sources
+// todo: exchange last_insert_row id to be more safe
+// todo: create test to ensure uniqueness of names throughout the database
+// todo: enforce the uniqueness of names
typedef std::map<am_gatewayID_t, std::vector<bool> > ListConnectionFormat; //!< type for list of connection formats
@@ -59,34 +59,34 @@ public:
virtual ~IAmDatabaseHandler (){}
/**
- * The following interface methods must be implemented by the subclass.
- */
- virtual am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID) = 0;
- virtual am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID) = 0;
- 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;
- virtual am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass) = 0;
- virtual am_Error_e enterSystemProperties(const std::vector<am_SystemProperty_s>& listSystemProperties) = 0;
- virtual am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID) = 0;
+ * The following interface methods must be implemented by the subclass.
+ */
+ virtual am_Error_e enterDomainDB(const am_Domain_s &domainData, am_domainID_t &domainID) = 0;
+ virtual am_Error_e enterMainConnectionDB(const am_MainConnection_s &mainConnectionData, am_mainConnectionID_t &connectionID) = 0;
+ 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;
+ virtual am_Error_e enterSourceClassDB(am_sourceClass_t &sourceClassID, const am_SourceClass_s &sourceClass) = 0;
+ virtual am_Error_e enterSystemProperties(const std::vector<am_SystemProperty_s> &listSystemProperties) = 0;
+ virtual am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t> &listConnectionID) = 0;
virtual am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState) = 0;
virtual am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID) = 0;
- virtual am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID) = 0;
+ virtual am_Error_e changeSinkAvailabilityDB(const am_Availability_s &availability, const am_sinkID_t sinkID) = 0;
virtual am_Error_e changeDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID) = 0;
virtual am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID) = 0;
- virtual am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) = 0;
- virtual am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) = 0;
- virtual am_Error_e changeSourceSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID) = 0;
- virtual am_Error_e changeSinkSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID) = 0;
- virtual am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID) = 0;
- virtual am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property) = 0;
- virtual am_Error_e changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID) = 0;
- virtual am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass) = 0;
- virtual am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass) = 0;
+ virtual am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sinkID_t sinkID) = 0;
+ virtual am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s &soundProperty, const am_sourceID_t sourceID) = 0;
+ virtual am_Error_e changeSourceSoundPropertyDB(const am_SoundProperty_s &soundProperty, const am_sourceID_t sourceID) = 0;
+ virtual am_Error_e changeSinkSoundPropertyDB(const am_SoundProperty_s &soundProperty, const am_sinkID_t sinkID) = 0;
+ virtual am_Error_e changeSourceAvailabilityDB(const am_Availability_s &availability, const am_sourceID_t sourceID) = 0;
+ virtual am_Error_e changeSystemPropertyDB(const am_SystemProperty_s &property) = 0;
+ virtual am_Error_e changeDelayMainConnection(const am_timeSync_t &delay, const am_mainConnectionID_t &connectionID) = 0;
+ virtual am_Error_e changeSinkClassInfoDB(const am_SinkClass_s &sinkClass) = 0;
+ virtual am_Error_e changeSourceClassInfoDB(const am_SourceClass_s &sourceClass) = 0;
virtual am_Error_e changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay) = 0;
virtual am_Error_e changeConnectionFinal(const am_connectionID_t connectionID) = 0;
virtual am_Error_e changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState) = 0;
@@ -104,107 +104,108 @@ public:
virtual am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID) = 0;
virtual am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID) = 0;
virtual am_Error_e removeConnection(const am_connectionID_t connectionID) = 0;
- 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;
- virtual am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s& mainConnectionData) const = 0;
- virtual am_Error_e getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) const = 0;
- virtual am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t& volume) const = 0;
- virtual am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t& volume) const = 0;
- virtual am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const = 0;
- virtual am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const = 0;
- virtual am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s>& listSoundproperties) const =0;
- virtual am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s>& listSoundproperties) const =0;
- virtual am_Error_e getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const = 0;
- virtual am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const = 0;
- virtual am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const = 0;
- 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;
- virtual am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const = 0;
- virtual am_Error_e getListSources(std::vector<am_Source_s>& lisSources) const = 0;
- 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;
- virtual am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const = 0;
- virtual am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const = 0;
- virtual am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const = 0;
- virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const = 0;
- virtual am_Error_e getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_CustomConnectionFormat_t> & listConnectionFormats) const = 0;
- virtual am_Error_e getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_CustomConnectionFormat_t> & listConnectionFormats) const = 0;
- virtual am_Error_e getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const = 0;
- virtual am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const = 0;
- virtual am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t& domainID) const = 0;
- virtual am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const = 0;
- virtual am_Error_e getDomainOfCrossfader(const am_crossfaderID_t crossfader, 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 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;
- virtual am_Error_e peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID) = 0;
- virtual am_Error_e peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID) = 0;
- 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;
- 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;
- virtual am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) = 0;
- virtual am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations) = 0;
+ 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;
+ virtual am_Error_e getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s &mainConnectionData) const = 0;
+ virtual am_Error_e getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t &mainVolume) const = 0;
+ virtual am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t &volume) const = 0;
+ virtual am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t &volume) const = 0;
+ virtual am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t &value) const = 0;
+ virtual am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t &value) const = 0;
+ virtual am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s> &listSoundproperties) const = 0;
+ virtual am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s> &listSoundproperties) const = 0;
+ virtual am_Error_e getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t &value) const = 0;
+ virtual am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t &value) const = 0;
+ virtual am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> &listSinkID) const = 0;
+ 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;
+ virtual am_Error_e getListSinks(std::vector<am_Sink_s> &listSinks) const = 0;
+ virtual am_Error_e getListSources(std::vector<am_Source_s> &lisSources) const = 0;
+ 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;
+ virtual am_Error_e getListMainSources(std::vector<am_SourceType_s> &listMainSources) const = 0;
+ virtual am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> &listSoundProperties) const = 0;
+ virtual am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> &listSourceProperties) const = 0;
+ virtual am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s> &listSystemProperties) const = 0;
+ virtual am_Error_e getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_CustomConnectionFormat_t> &listConnectionFormats) const = 0;
+ virtual am_Error_e getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_CustomConnectionFormat_t> &listConnectionFormats) const = 0;
+ virtual am_Error_e getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> &listConnectionFormat) const = 0;
+ virtual am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t &delay) const = 0;
+ virtual am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t &domainID) const = 0;
+ virtual am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t &domainID) const = 0;
+ virtual am_Error_e getDomainOfCrossfader(const am_crossfaderID_t crossfader, 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 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;
+ virtual am_Error_e peekSinkClassID(const std::string &name, am_sinkClass_t &sinkClassID) = 0;
+ virtual am_Error_e peekSourceClassID(const std::string &name, am_sourceClass_t &sourceClassID) = 0;
+ 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;
+ 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;
+ virtual am_Error_e getListMainSinkNotificationConfigurations(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s> &listMainNotificationConfigurations) = 0;
+ virtual am_Error_e getListMainSourceNotificationConfigurations(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s> &listMainNotificationConfigurations) = 0;
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 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 existConnection(const am_Connection_s & connection) 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;
- virtual bool existSourceNameOrID(const am_sourceID_t sourceID, const std::string& name) const = 0;
- virtual bool existSourceName(const std::string& name) const = 0;
+ virtual bool existSourceNameOrID(const am_sourceID_t sourceID, const std::string &name) const = 0;
+ virtual bool existSourceName(const std::string &name) const = 0;
virtual bool existSink(const am_sinkID_t sinkID) const = 0;
- virtual bool existSinkNameOrID(const am_sinkID_t sinkID, const std::string& name) const = 0;
- virtual bool existSinkName(const std::string& name) const = 0;
- virtual bool existDomain(const am_domainID_t domainID) const = 0;
- virtual bool existGateway(const am_gatewayID_t gatewayID) const = 0;
- virtual bool existSinkClass(const am_sinkClass_t sinkClassID) const = 0;
- virtual bool existSourceClass(const am_sourceClass_t sourceClassID) const = 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 bool existSinkNameOrID(const am_sinkID_t sinkID, const std::string &name) const = 0;
+ virtual bool existSinkName(const std::string &name) const = 0;
+ virtual bool existDomain(const am_domainID_t domainID) const = 0;
+ virtual bool existGateway(const am_gatewayID_t gatewayID) const = 0;
+ virtual bool existSinkClass(const am_sinkClass_t sinkClassID) const = 0;
+ virtual bool existSourceClass(const am_sourceClass_t sourceClassID) const = 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 ;
+ 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;
+
/**
- * Database observer protocol
- */
+ * Database observer protocol
+ */
class IAmDatabaseObserver
{
public:
- IAmDatabaseObserver() {}
- virtual ~IAmDatabaseObserver(){}
+ IAmDatabaseObserver() {}
+ virtual ~IAmDatabaseObserver(){}
};
- virtual bool registerObserver(IAmDatabaseObserver * iObserver) = 0;
- virtual bool unregisterObserver(IAmDatabaseObserver * iObserver) = 0;
- virtual unsigned countObservers() = 0;
-};
+ virtual bool registerObserver(IAmDatabaseObserver *iObserver) = 0;
+ virtual bool unregisterObserver(IAmDatabaseObserver *iObserver) = 0;
+ virtual unsigned countObservers() = 0;
+};
}