summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/include
diff options
context:
space:
mode:
authorChristian Mueller <christian@lmuc329619u.(none)>2011-12-08 18:43:48 +0100
committerChristian Mueller <christian@lmuc329619u.(none)>2011-12-08 18:43:48 +0100
commit5773404eb801e27179b7c3c7803a990145d6e94a (patch)
tree4bb9db13fbfb3f72479fd7e6ce342768f299d073 /AudioManagerDaemon/include
parent9826492b0066d47cfa9ba68d6efe737cc3c317a3 (diff)
downloadaudiomanager-5773404eb801e27179b7c3c7803a990145d6e94a.tar.gz
total rework
no more QT
Diffstat (limited to 'AudioManagerDaemon/include')
-rw-r--r--AudioManagerDaemon/include/CommandReceiver.h46
-rw-r--r--AudioManagerDaemon/include/CommandSender.h42
-rw-r--r--AudioManagerDaemon/include/ControlLoader.h24
-rw-r--r--AudioManagerDaemon/include/ControlReceiver.h86
-rw-r--r--AudioManagerDaemon/include/DatabaseHandler.h154
-rw-r--r--AudioManagerDaemon/include/RoutingReceiver.h53
-rw-r--r--AudioManagerDaemon/include/RoutingSender.h101
-rw-r--r--AudioManagerDaemon/include/pluginTemplate.h96
8 files changed, 602 insertions, 0 deletions
diff --git a/AudioManagerDaemon/include/CommandReceiver.h b/AudioManagerDaemon/include/CommandReceiver.h
new file mode 100644
index 0000000..3f4138a
--- /dev/null
+++ b/AudioManagerDaemon/include/CommandReceiver.h
@@ -0,0 +1,46 @@
+/*
+ * CommandReceiver.h
+ *
+ * Created on: Oct 24, 2011
+ * Author: christian
+ */
+
+#ifndef COMMANDRECEIVER_H_
+#define COMMANDRECEIVER_H_
+
+
+#include <command/CommandReceiveInterface.h>
+#include "DatabaseHandler.h"
+#include "DBusWrapper.h"
+
+using namespace am;
+
+class CommandReceiver: public CommandReceiveInterface {
+public:
+ CommandReceiver(DatabaseHandler* iDatabaseHandler, DBusWrapper* iDBusWrapper);
+ virtual ~CommandReceiver();
+ 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 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(DBusWrapper*& dbusConnectionWrapper) const ;
+
+private:
+ DatabaseHandler* mDatabaseHandler;
+ DBusWrapper* mDBusWrapper;
+};
+
+#endif /* COMMANDRECEIVER_H_ */
diff --git a/AudioManagerDaemon/include/CommandSender.h b/AudioManagerDaemon/include/CommandSender.h
new file mode 100644
index 0000000..8e604c6
--- /dev/null
+++ b/AudioManagerDaemon/include/CommandSender.h
@@ -0,0 +1,42 @@
+/*
+ * CommandSender.h
+ *
+ * Created on: Oct 26, 2011
+ * Author: christian
+ */
+
+#ifndef COMMANDSENDER_H_
+#define COMMANDSENDER_H_
+
+#include "pluginTemplate.h"
+#include "command/CommandSendInterface.h"
+
+using namespace am;
+
+class CommandSender {
+public:
+ CommandSender();
+ virtual ~CommandSender();
+ am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface) ;
+ am_Error_e stopInterface() ;
+ void cbCommunicationReady() ;
+ void cbCommunicationRundown() ;
+ void cbNumberOfMainConnectionsChanged() ;
+ void cbNumberOfSinksChanged() ;
+ void cbNumberOfSourcesChanged() ;
+ 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 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 cbTimingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time) ;
+private:
+ std::vector<CommandSendInterface*> mListInterfaces;
+};
+
+#endif /* COMMANDSENDER_H_ */
diff --git a/AudioManagerDaemon/include/ControlLoader.h b/AudioManagerDaemon/include/ControlLoader.h
new file mode 100644
index 0000000..09ffacf
--- /dev/null
+++ b/AudioManagerDaemon/include/ControlLoader.h
@@ -0,0 +1,24 @@
+/*
+ * ControlLoader.h
+ *
+ * Created on: Oct 25, 2011
+ * Author: christian
+ */
+
+#ifndef CONTROLLOADER_H_
+#define CONTROLLOADER_H_
+
+#include "control/ControlSendInterface.h"
+
+using namespace am;
+
+class ControlLoader {
+public:
+ ControlLoader();
+ virtual ~ControlLoader();
+ ControlSendInterface* returnControl();
+private:
+ ControlSendInterface* mControler;
+};
+
+#endif /* CONTROLLOADER_H_ */
diff --git a/AudioManagerDaemon/include/ControlReceiver.h b/AudioManagerDaemon/include/ControlReceiver.h
new file mode 100644
index 0000000..722bde1
--- /dev/null
+++ b/AudioManagerDaemon/include/ControlReceiver.h
@@ -0,0 +1,86 @@
+/*
+ * ContronlReceiver.h
+ *
+ * Created on: Oct 24, 2011
+ * Author: christian
+ */
+
+#ifndef CONTRONLRECEIVER_H_
+#define CONTRONLRECEIVER_H_
+
+#include <control/ControlReceiveInterface.h>
+#include "DatabaseHandler.h"
+
+using namespace am;
+
+class ControlReceiver: public ControlReceiveInterface {
+public:
+ ControlReceiver(DatabaseHandler* iDatabaseHandler);
+ virtual ~ControlReceiver();
+ 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_ConnectionFormat_e 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_RampType_e rampType, const am_time_t rampTime) ;
+ 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_RampType_e 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_RampType_e rampType, const am_time_t time) ;
+ am_Error_e setSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const 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 abortAction(const am_Handle_s handle) ;
+ 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 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 enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties) ;
+ am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s& route) ;
+ am_Error_e 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 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 changeSinkClassInfoDB(const am_SinkClass_s& classInfo) ;
+ am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& classInfo) ;
+ 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) ;
+ am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID) ;
+ am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID) ;
+ am_Error_e removeDomainDB(const am_domainID_t domainID) ;
+ am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID) ;
+ 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 getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const ;
+ am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const ;
+ am_Error_e 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 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>& lisSources) 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 getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const ;
+ am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const ;
+ void setRoutingReady() ;
+ void setCommandReady() ;
+
+private:
+ DatabaseHandler* mDatabaseHandler;
+};
+
+#endif /* CONTRONLRECEIVER_H_ */
diff --git a/AudioManagerDaemon/include/DatabaseHandler.h b/AudioManagerDaemon/include/DatabaseHandler.h
new file mode 100644
index 0000000..6b2c2be
--- /dev/null
+++ b/AudioManagerDaemon/include/DatabaseHandler.h
@@ -0,0 +1,154 @@
+/*
+ * DatabaseHandler.h
+ *
+ * Created on: Oct 24, 2011
+ * Author: christian
+ */
+
+#ifndef DATABASEHANDLER_H_
+#define DATABASEHANDLER_H_
+
+#include "audiomanagertypes.h"
+#include <map>
+#include <string>
+#include <vector>
+#include <sqlite3.h>
+
+using namespace am;
+
+#define DYNAMIC_ID_BOUNDARY 100
+
+//todo: we do not have to create MainSoundProperty tables if visible = false.
+//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
+
+class DatabaseHandler {
+public:
+ DatabaseHandler();
+ virtual ~DatabaseHandler();
+ 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 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 am_Route_s& route) ;
+ 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 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 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 removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID) ;
+ am_Error_e removeSinkDB(const am_sinkID_t sinkID) ;
+ am_Error_e removeSourceDB(const am_sourceID_t sourceID) ;
+ am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID) ;
+ am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID) ;
+ 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 getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const ;
+ am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const ;
+ am_Error_e 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 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>& 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 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 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;
+
+
+ /**
+ * checks for a certain mainConnection
+ * @param mainConnectionID to be checked for
+ * @return true if it exists
+ */
+ bool existMainConnection(const am_mainConnectionID_t mainConnectionID) const;
+
+ /**
+ * checks for a certain Source
+ * @param sourceID to be checked for
+ * @return true if it exists
+ */
+ bool existSource(const am_sourceID_t sourceID) const;
+
+ /**
+ * checks for a certain Sink
+ * @param sinkID to be checked for
+ * @return true if it exists
+ */
+ bool existSink(const am_sinkID_t sinkID) const;
+
+ /**
+ * checks for a certain domain
+ * @param domainID to be checked for
+ * @return true if it exists
+ */
+ bool existDomain(const am_domainID_t domainID) const;
+
+ /**
+ * checks for certain gateway
+ * @param gatewayID to be checked for
+ * @return true if it exists
+ */
+ bool existGateway(const am_gatewayID_t gatewayID) const;
+
+ /**
+ * checks for certain SinkClass
+ * @param sinkClassID
+ * @return true if it exists
+ */
+ bool existSinkClass(const am_sinkClass_t sinkClassID) const;
+
+ /**
+ * checks for certain sourceClass
+ * @param sourceClassID
+ * @return true if it exists
+ */
+ bool existSourceClass(const am_sourceClass_t sourceClassID) const;
+
+private:
+ bool sqQuery(const std::string& query);
+ bool openDatabase();
+ void createTables();
+ sqlite3 *mDatabase; //!< pointer to database
+ std::string mPath;
+ bool mFirstStaticSink;
+ bool mFirstStaticSource;
+ bool mFirstStaticGateway;
+ bool mFirstStaticSinkClass;
+ bool mFirstStaticSourceClass;
+ typedef std::map<am_gatewayID_t,std::vector<bool> > ListConnectionFormat;
+ ListConnectionFormat mListConnectionFormat;
+};
+
+#endif /* DATABASEHANDLER_H_ */
diff --git a/AudioManagerDaemon/include/RoutingReceiver.h b/AudioManagerDaemon/include/RoutingReceiver.h
new file mode 100644
index 0000000..903786a
--- /dev/null
+++ b/AudioManagerDaemon/include/RoutingReceiver.h
@@ -0,0 +1,53 @@
+/*
+ * RoutingReceiver.h
+ *
+ * Created on: Oct 24, 2011
+ * Author: christian
+ */
+
+#ifndef ROUTINGRECEIVER_H_
+#define ROUTINGRECEIVER_H_
+
+#include "routing/RoutingReceiveInterface.h"
+
+using namespace am;
+
+class RoutingReceiver : public RoutingReceiveInterface {
+public:
+ RoutingReceiver();
+ virtual ~RoutingReceiver();
+ void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) ;
+ void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) ;
+ void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ;
+ void ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ;
+ void ackSetSourceState(const am_Handle_s handle, const am_Error_e error) ;
+ void ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) ;
+ void ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) ;
+ 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 deregisterDomain(const am_domainID_t domainID) ;
+ am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
+ am_Error_e deregisterGateway(const am_gatewayID_t gatewayID) ;
+ 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 deregisterSource(const am_sourceID_t sourceID) ;
+ am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
+ am_Error_e deregisterCrossfader(const am_crossfaderID_t crossfaderID) ;
+ 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 hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState) ;
+ void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay) ;
+ am_Error_e sendChangedData(const std::vector<am_EarlyData_s>& earlyData) ;
+ am_Error_e getDBusConnectionWrapper(DBusWrapper* dbusConnectionWrapper) const ;
+ am_Error_e registerDbusNode(const std::string& nodeName) ;
+};
+
+#endif /* ROUTINGRECEIVER_H_ */
diff --git a/AudioManagerDaemon/include/RoutingSender.h b/AudioManagerDaemon/include/RoutingSender.h
new file mode 100644
index 0000000..2aac7be
--- /dev/null
+++ b/AudioManagerDaemon/include/RoutingSender.h
@@ -0,0 +1,101 @@
+/*
+ * RoutingSender.h
+ *
+ * Created on: Oct 26, 2011
+ * Author: christian
+ */
+
+#ifndef ROUTINGSENDER_H_
+#define ROUTINGSENDER_H_
+
+#include "pluginTemplate.h"
+#include "routing/RoutingSendInterface.h"
+#include <map>
+
+using namespace am;
+
+class RoutingSender {
+public:
+ RoutingSender();
+ virtual ~RoutingSender();
+ /**
+ * @author Christian
+ * this adds the domain to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a domain is registered.
+ */
+ am_Error_e addDomainLookup(const am_Domain_s& domainData);
+ /**
+ * @author Christian
+ * this adds the Source to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Source is registered.
+ */
+ am_Error_e addSourceLookup(const am_Source_s& sourceData);
+ /**
+ * @author Christian
+ * this adds the Sink to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Sink is registered.
+ */
+ am_Error_e addSinkLookup(const am_Sink_s& sinkData);
+ /**
+ * @author Christian
+ * this adds the Crossfader to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Crossfader is registered.
+ */
+ am_Error_e addCrossfaderLookup(const am_Crossfader_s& crossfaderData);
+ /**
+ * @author Christian
+ * this removes the Domain to the lookup table of the Router. This must be done everytime a domain is deregistered.
+ */
+ am_Error_e removeDomainLookup(const am_domainID_t domainID);
+ /**
+ * @author Christian
+ * this removes the Source to the lookup table of the Router. This must be done everytime a source is deregistered.
+ */
+ am_Error_e removeSourceLookup(const am_sourceID_t sourceID);
+ /**
+ * @author Christian
+ * this removes the Sink to the lookup table of the Router. This must be done everytime a sink is deregistered.
+ */
+ am_Error_e removeSinkLookup(const am_sinkID_t sinkID);
+ /**
+ * @author Christian
+ * this removes the Crossfader to the lookup table of the Router. This must be done everytime a crossfader is deregistered.
+ */
+ am_Error_e removeCrossfaderLookup(const am_crossfaderID_t crossfaderID);
+ void startupRoutingInterface(RoutingReceiveInterface* routingreceiveinterface) ;
+ void routingInterfacesReady() ;
+ void routingInterfacesRundown() ;
+ am_Error_e asyncAbort(const am_Handle_s handle) ;
+ am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat) ;
+ am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID) ;
+ am_Error_e asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) ;
+ am_Error_e asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) ;
+ am_Error_e asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) ;
+ am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) ;
+ am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) ;
+ am_Error_e asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time) ;
+ am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) ;
+ am_Error_e returnBusName(std::string& BusName) const ;
+private:
+
+ struct InterfaceNamePairs
+ {
+ RoutingSendInterface* routingInterface;
+ std::string busName;
+ };
+
+ typedef std::map<am_domainID_t, RoutingSendInterface*> DomainInterfaceMap;
+ typedef std::map<am_sinkID_t, RoutingSendInterface*> SinkInterfaceMap;
+ typedef std::map<am_sourceID_t, RoutingSendInterface*> SourceInterfaceMap;
+ typedef std::map<am_crossfaderID_t, RoutingSendInterface*> CrossfaderInterfaceMap;
+ typedef std::map<am_connectionID_t, RoutingSendInterface*> ConnectionInterfaceMap;
+
+ std::vector<InterfaceNamePairs> mListInterfaces;
+ DomainInterfaceMap mMapDomainInterface;
+ SinkInterfaceMap mMapSinkInterface;
+ SourceInterfaceMap mMapSourceInterface;
+ CrossfaderInterfaceMap mMapCrossfaderInterface;
+ ConnectionInterfaceMap mMapConnectionInterface;
+};
+
+#endif /* ROUTINGSENDER_H_ */
diff --git a/AudioManagerDaemon/include/pluginTemplate.h b/AudioManagerDaemon/include/pluginTemplate.h
new file mode 100644
index 0000000..1f6a06b
--- /dev/null
+++ b/AudioManagerDaemon/include/pluginTemplate.h
@@ -0,0 +1,96 @@
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file pluginTemplate.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
+
+#ifndef PLUGINTEMPLATE_H_
+#define PLUGINTEMPLATE_H_
+
+#include <iostream>
+#include <stdio.h>
+#include <dirent.h>
+#include <dlfcn.h>
+#include <libgen.h>
+#include <unistd.h>
+#include <string>
+#include <dlt/dlt.h>
+
+DLT_IMPORT_CONTEXT(AudioManager);
+
+/**
+ * This template tries to load a library and cast ot to a class
+ * @param libname the full path to the library to be loaded
+ * @return returns the pointer to the class to be loaded
+ */
+template<class T>T* getCreateFunction(std::string libname) {
+
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Trying to load libray with name: "),DLT_STRING(libname.c_str()));
+
+ // cut off directories
+ char* fileWithPath = const_cast<char*>(libname.c_str());
+ std::string libFileName = basename(fileWithPath);
+
+ // cut off "lib" in front and cut off .so end"
+ std::string createFunctionName = libFileName.substr(3, libFileName.length() - 6) + "Factory";
+
+ // open library
+ void *libraryHandle;
+ dlerror(); // Clear any existing error
+ libraryHandle = dlopen(libname.c_str(), RTLD_NOW /*LAZY*/);
+ const char* dlopen_error = dlerror();
+ if (!libraryHandle || dlopen_error)
+ {
+ DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("dlopen failed"),DLT_STRING(dlopen_error));
+ return 0;
+ }
+
+ // get entry point from shared lib
+ dlerror(); // Clear any existing error
+
+ union
+ {
+ void* voidPointer;
+ T* typedPointer;
+ } functionPointer;
+
+ // Note: direct cast is not allowed by ISO C++. e.g.
+ // T* createFunction = reinterpret_cast<T*>(dlsym(libraryHandle, createFunctionName.c_str()));
+ // compiler warning: "forbids casting between pointer-to-function and pointer-to-object"
+
+ functionPointer.voidPointer = dlsym(libraryHandle, createFunctionName.c_str());
+ T* createFunction = functionPointer.typedPointer;
+
+ const char* dlsym_error = dlerror();
+ if (!createFunction || dlsym_error)
+ {
+ DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Failed to load shared lib entry point"),DLT_STRING(dlsym_error));
+ }
+ else
+ {
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("loaded successfully plugin"),DLT_STRING(createFunctionName.c_str()));
+ }
+ return createFunction;
+}
+
+
+#endif /* PLUGINTEMPLATE_H_ */