summaryrefslogtreecommitdiff
path: root/AudioManagerCore/include
diff options
context:
space:
mode:
authorChristian Linke <Christian.Linke@bmw.de>2016-06-17 02:58:38 -0700
committerChristian Linke <Christian.Linke@bmw.de>2016-06-17 02:59:34 -0700
commit8f5563bd07f6d71b8358c9e9e84ea6551b60a734 (patch)
tree7c570a66fa6964a8f8ac2ff139ef385c165f6e92 /AudioManagerCore/include
parent7918c698441c216e461f9995b16540ee5a8f1756 (diff)
downloadaudiomanager-8f5563bd07f6d71b8358c9e9e84ea6551b60a734.tar.gz
cleanup routing interface to add clean abort and resend possibilities7.5
Signed-off-by: Christian Linke <Christian.Linke@bmw.de>
Diffstat (limited to 'AudioManagerCore/include')
-rw-r--r--AudioManagerCore/include/CAmControlReceiver.h1
-rw-r--r--AudioManagerCore/include/CAmDatabaseHandlerMap.h1
-rw-r--r--AudioManagerCore/include/CAmRoutingReceiver.h3
-rw-r--r--AudioManagerCore/include/CAmRoutingSender.h235
4 files changed, 208 insertions, 32 deletions
diff --git a/AudioManagerCore/include/CAmControlReceiver.h b/AudioManagerCore/include/CAmControlReceiver.h
index 3f39189..897ac5e 100644
--- a/AudioManagerCore/include/CAmControlReceiver.h
+++ b/AudioManagerCore/include/CAmControlReceiver.h
@@ -141,6 +141,7 @@ public:
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
diff --git a/AudioManagerCore/include/CAmDatabaseHandlerMap.h b/AudioManagerCore/include/CAmDatabaseHandlerMap.h
index 49e77f6..5de220e 100644
--- a/AudioManagerCore/include/CAmDatabaseHandlerMap.h
+++ b/AudioManagerCore/include/CAmDatabaseHandlerMap.h
@@ -141,6 +141,7 @@ public:
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;
diff --git a/AudioManagerCore/include/CAmRoutingReceiver.h b/AudioManagerCore/include/CAmRoutingReceiver.h
index 82626c6..e8f464f 100644
--- a/AudioManagerCore/include/CAmRoutingReceiver.h
+++ b/AudioManagerCore/include/CAmRoutingReceiver.h
@@ -105,6 +105,9 @@ 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
diff --git a/AudioManagerCore/include/CAmRoutingSender.h b/AudioManagerCore/include/CAmRoutingSender.h
index 4a23428..4069920 100644
--- a/AudioManagerCore/include/CAmRoutingSender.h
+++ b/AudioManagerCore/include/CAmRoutingSender.h
@@ -26,6 +26,7 @@
#include "IAmRouting.h"
#include <map>
+#include <memory>
#ifdef UNIT_TEST //this is needed to test RoutingSender
#include "../test/IAmRoutingBackdoor.h"
@@ -35,6 +36,7 @@ namespace am
{
class CAmRoutingReceiver;
+class IAmDatabaseHandler;
/**
* Implements the RoutingSendInterface. Loads all plugins and dispatches calls to the plugins
@@ -84,34 +86,205 @@ public:
IAmRoutingSend* routingInterface; //!< pointer to the routingInterface
std::string busName; //!< the busname
};
-
- class am_handleData_c //!< is used to store data related to handles
+
+ class handleDataBase
{
- public:
- union
- {
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- am_crossfaderID_t crossfaderID;
- am_connectionID_t connectionID;
- am_DataType_u volumeID;
- };
-
- union
- {
- am_SoundProperty_s soundPropery;
- am_SourceState_e sourceState;
- am_volume_t volume;
- am_HotSink_e hotSink;
- std::vector<am_SoundProperty_s>* soundProperties;
- std::vector<am_Volumes_s>* listVolumes;
- am_NotificationConfiguration_s* notificationConfiguration;
- };
-
- };
-
- am_Error_e returnHandleData(const am_Handle_s handle,CAmRoutingSender::am_handleData_c& handleData) const; //!< returns the handle data associated with a handle
- am_Error_e returnHandleDataAndRemove(const am_Handle_s handle,CAmRoutingSender::am_handleData_c& handleData); //!< returns the handle data associated with a handle and removes the handle
+ public:
+ handleDataBase(IAmRoutingSend* interface) : mInterface(interface) {}
+ virtual ~handleDataBase() {}
+ virtual am_Error_e writeDataToDatabase(IAmDatabaseHandler* database)=0; //!< function to write the handle data to the database
+ IAmRoutingSend* returnInterface() {return mInterface;}
+ private:
+ IAmRoutingSend* mInterface;
+ };
+
+ class handleVolumeBase : public handleDataBase
+ {
+ public:
+ handleVolumeBase(IAmRoutingSend* interface,am_volume_t volume) :
+ handleDataBase(interface)
+ ,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) :
+ handleDataBase(interface)
+ ,mSinkID(sinkID)
+ ,mSoundProperty(soundProperty) {}
+ ~handleSinkSoundProperty() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ 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) :
+ handleDataBase(interface)
+ ,mSinkID(sinkID)
+ ,mlistSoundProperties(listSoundProperties) {}
+ ~handleSinkSoundProperties() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ 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) :
+ handleDataBase(interface)
+ ,mSourceID(sourceID)
+ ,mSoundProperty(soundProperty) {}
+ ~handleSourceSoundProperty() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ 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) :
+ handleDataBase(interface)
+ ,mSourceID(sourceID)
+ ,mlistSoundProperties(listSoundProperties) {}
+ ~handleSourceSoundProperties(){}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ 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) :
+ handleDataBase(interface)
+ ,mSourceID(sourceID)
+ ,mSourceState(state) {}
+ ~handleSourceState() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ private:
+ am_sourceID_t mSourceID;
+ am_SourceState_e mSourceState;
+ };
+
+ class handleSourceVolume : public handleVolumeBase
+ {
+ public:
+ handleSourceVolume(IAmRoutingSend* interface, const am_sourceID_t sourceID, const am_volume_t& volume) :
+ handleVolumeBase(interface,volume)
+ ,mSourceID(sourceID) {}
+ ~handleSourceVolume() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ private:
+ am_sourceID_t mSourceID;
+ };
+
+ class handleSinkVolume : public handleVolumeBase
+ {
+ public:
+ handleSinkVolume(IAmRoutingSend* interface, const am_sinkID_t sinkID, const am_volume_t& volume) :
+ handleVolumeBase(interface,volume)
+ ,mSinkID(sinkID) {}
+ ~handleSinkVolume() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ private:
+ am_sinkID_t mSinkID;
+ };
+
+ class handleCrossFader : public handleDataBase
+ {
+ public:
+ handleCrossFader(IAmRoutingSend* interface, const am_crossfaderID_t crossfaderID, const am_HotSink_e& hotSink) :
+ handleDataBase(interface)
+ ,mCrossfaderID(crossfaderID)
+ ,mHotSink(hotSink) {}
+ ~handleCrossFader() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ private:
+ am_crossfaderID_t mCrossfaderID;
+ am_HotSink_e mHotSink;
+ };
+
+ class handleConnect : public handleDataBase
+ {
+ public:
+ handleConnect(IAmRoutingSend* interface, const am_connectionID_t connectionID) :
+ handleDataBase(interface)
+ ,mConnectionID(connectionID) {}
+ ~handleConnect() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ private:
+ am_connectionID_t mConnectionID;
+ };
+
+ class handleDisconnect : public handleDataBase
+ {
+ public:
+ handleDisconnect(IAmRoutingSend* interface, const am_connectionID_t connectionID) :
+ handleDataBase(interface)
+ ,mConnectionID(connectionID) {}
+ ~handleDisconnect() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ private:
+ am_connectionID_t mConnectionID;
+ };
+
+ class handleSetVolumes : public handleDataBase
+ {
+ public:
+ handleSetVolumes(IAmRoutingSend* interface, const std::vector<am_Volumes_s> listVolumes) :
+ handleDataBase(interface)
+ ,mlistVolumes(listVolumes) {}
+ ~handleSetVolumes() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ 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) :
+ handleDataBase(interface)
+ ,mSinkID(sinkID)
+ ,mNotificationConfiguration(notificationConfiguration){}
+ ~handleSetSinkNotificationConfiguration() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ 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) :
+ handleDataBase(interface)
+ ,mSourceID(sourceID)
+ ,mNotificationConfiguration(notificationConfiguration) {}
+ ~handleSetSourceNotificationConfiguration() {}
+ am_Error_e writeDataToDatabase(IAmDatabaseHandler* database);
+ private:
+ am_sourceID_t mSourceID;
+ am_NotificationConfiguration_s mNotificationConfiguration;
+ };
+
+ am_Error_e writeToDatabaseAndRemove(IAmDatabaseHandler* databasehandler,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
friend class IAmRoutingBackdoor;
@@ -126,7 +299,7 @@ private:
}
};
- am_Handle_s createHandle(const am_handleData_c& handleData, const am_Handle_e type); //!< creates a handle
+ 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
@@ -134,19 +307,17 @@ private:
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<uint16_t, IAmRoutingSend*> HandleInterfaceMap; //!< maps handles to interfaces
- typedef std::map<am_Handle_s, am_handleData_c, comparator> HandlesMap; //!< maps handleData to handles
+ 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
- ConnectionInterfaceMap mMapConnectionInterface; //!< map of connection to interfaces
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
- HandleInterfaceMap mMapHandleInterface; //!< map of handles to interfaces
CAmRoutingReceiver *mpRoutingReceiver; //!< pointer to routing receiver
};