summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/include
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-02-23 17:25:23 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-02-23 17:25:23 +0100
commitbec7e4f38620d7855c0e5c0d4cea933dcf2827f3 (patch)
tree3b7b196f88f5b7cba4c885bcc39623b35e53e55f /AudioManagerDaemon/include
parent26b122e62777dddff469fa53058ab26fe212d4cf (diff)
downloadaudiomanager-bec7e4f38620d7855c0e5c0d4cea933dcf2827f3.tar.gz
* [ GAM-4 ] Change Database Obsever notification implementation working, test are not ready yet. This implies that the Sockethandler is mandatory so I removed the cmake options.
Diffstat (limited to 'AudioManagerDaemon/include')
-rw-r--r--AudioManagerDaemon/include/CommandReceiver.h1
-rw-r--r--AudioManagerDaemon/include/CommandSender.h21
-rw-r--r--AudioManagerDaemon/include/ControlReceiver.h1
-rw-r--r--AudioManagerDaemon/include/DatabaseObserver.h111
-rw-r--r--AudioManagerDaemon/include/RoutingReceiver.h1
5 files changed, 121 insertions, 14 deletions
diff --git a/AudioManagerDaemon/include/CommandReceiver.h b/AudioManagerDaemon/include/CommandReceiver.h
index 1d00216..c7154f1 100644
--- a/AudioManagerDaemon/include/CommandReceiver.h
+++ b/AudioManagerDaemon/include/CommandReceiver.h
@@ -42,7 +42,6 @@ class SocketHandler;
class CommandReceiver: public CommandReceiveInterface
{
public:
- CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, DBusWrapper* iDBusWrapper);
CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, SocketHandler* iSocketHandler);
CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, SocketHandler* iSocketHandler, DBusWrapper* iDBusWrapper);
virtual ~CommandReceiver();
diff --git a/AudioManagerDaemon/include/CommandSender.h b/AudioManagerDaemon/include/CommandSender.h
index 37b99d7..1a17134 100644
--- a/AudioManagerDaemon/include/CommandSender.h
+++ b/AudioManagerDaemon/include/CommandSender.h
@@ -45,22 +45,25 @@ public:
virtual ~CommandSender();
am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface);
am_Error_e stopInterface();
- void cbCommunicationReady();
- void cbCommunicationRundown();
- void cbNumberOfMainConnectionsChanged();
- void cbNumberOfSinksChanged();
- void cbNumberOfSourcesChanged();
+ am_Error_e cbCommunicationReady();
+ am_Error_e cbCommunicationRundown();
+ void cbNewMainConnection(const am_MainConnectionType_s mainConnection);
+ void cbRemovedMainConnection(const am_MainConnectionType_s mainConnection);
+ void cbNewSink(const am_SinkType_s sink);
+ void cbRemovedSink(const am_SinkType_s sink);
+ void cbNewSource(const am_SourceType_s source);
+ void cbRemovedSource(const am_SourceType_s source);
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 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);
+ void cbSystemPropertyChanged(const am_SystemProperty_s& systemProperty);
+ void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
uint16_t getInterfaceVersion() const;
am_Error_e getListPlugins(std::vector<std::string>& interfaces) const;
#ifdef UNIT_TEST
diff --git a/AudioManagerDaemon/include/ControlReceiver.h b/AudioManagerDaemon/include/ControlReceiver.h
index 9aec23f..c67e0d9 100644
--- a/AudioManagerDaemon/include/ControlReceiver.h
+++ b/AudioManagerDaemon/include/ControlReceiver.h
@@ -44,7 +44,6 @@ class ControlReceiver: public ControlReceiveInterface
{
public:
ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler, Router* iRouter);
- ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, Router* iRouter);
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);
diff --git a/AudioManagerDaemon/include/DatabaseObserver.h b/AudioManagerDaemon/include/DatabaseObserver.h
index 3ccdc0d..75fed77 100644
--- a/AudioManagerDaemon/include/DatabaseObserver.h
+++ b/AudioManagerDaemon/include/DatabaseObserver.h
@@ -26,6 +26,8 @@
#define DATABASEOBSERVER_H_
#include <audiomanagertypes.h>
+#include <SocketHandler.h>
+#include <queue>
namespace am
{
@@ -33,14 +35,16 @@ namespace am
class TelnetServer;
class CommandSender;
class RoutingSender;
+
/**
* This class observes the Database and notifies other classes about important events, mainly the CommandSender.
*/
+
class DatabaseObserver
{
public:
- DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender);
- DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, TelnetServer *iTelnetServer);
+ DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, SocketHandler *iSocketHandler);
+ DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, SocketHandler *iSocketHandler, TelnetServer *iTelnetServer);
virtual ~DatabaseObserver();
void numberOfMainConnectionsChanged();
void numberOfSinkClassesChanged();
@@ -64,10 +68,113 @@ public:
void sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
void systemPropertyChanged(const am_SystemProperty_s& SystemProperty);
void timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time);
+
+ void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+ bool dispatcherCallback(const sh_pollHandle_t handle, void* userData);
+ bool checkerCallback(const sh_pollHandle_t handle, void* userData);
+
+ shPollFired_T<DatabaseObserver> receiverCallbackT;
+ shPollDispatch_T<DatabaseObserver> dispatcherCallbackT;
+ shPollCheck_T<DatabaseObserver> checkerCallbackT;
+
private:
+
+ enum do_msgID_e
+ {
+ MDO_cbNumberOfSinksChanged, //
+ MDO_cbNumberOfSourcesChanged, //
+ MDO_cbNumberOfMainConnectionsChanged, //
+ MDO_cbNumberOfSinkClassesChanged, //
+ MDO_cbNumberOfSourceClassesChanged, //
+ MDO_cbMainConnectionStateChanged, //
+ MDO_cbMainSinkSoundPropertyChanged, //
+ MDO_cbMainSourceSoundPropertyChanged, //
+ MDO_cbSinkAvailabilityChanged, //
+ MDO_cbSourceAvailabilityChanged, //
+ MDO_cbVolumeChanged, //
+ MDO_cbSinkMuteStateChanged, //
+ MDO_cbSystemPropertyChanged, //
+ MDO_cbTimingInformationChanged
+ };
+
+ struct do_connectionStateChanged_s
+ {
+ am_mainConnectionID_t connectionID;
+ am_ConnectionState_e connectionState;
+ };
+
+ struct do_mainSinkSoundPropertyChanged_s
+ {
+ am_sinkID_t sinkID;
+ am_MainSoundProperty_s SoundProperty;
+ };
+
+ struct do_mainSourceSoundPropertyChanged_s
+ {
+ am_sourceID_t sourceID;
+ am_MainSoundProperty_s SoundProperty;
+ };
+
+ struct do_sinkAvailabilityChanged_s
+ {
+ am_sinkID_t sinkID;
+ am_Availability_s availability;
+ };
+
+ struct do_sourceAvailabilityChanged_s
+ {
+ am_sourceID_t sourceID;
+ am_Availability_s availability;
+ };
+
+ struct do_volumeChanged_s
+ {
+ am_sinkID_t sinkID;
+ am_mainVolume_t volume;
+ };
+
+ struct do_sinkMuteStateChanged_s
+ {
+ am_sinkID_t sinkID;
+ am_MuteState_e muteState;
+ };
+
+ struct do_timingInformationChanged_s
+ {
+ am_mainConnectionID_t mainConnection;
+ am_timeSync_t time;
+ };
+
+ union do_parameter_u
+ {
+ do_connectionStateChanged_s connectionStateChanged;
+ do_mainSinkSoundPropertyChanged_s mainSinkSoundPropertyChanged;
+ do_mainSourceSoundPropertyChanged_s mainSourceSoundPropertyChanged;
+ do_sinkAvailabilityChanged_s sinkAvailabilityChanged;
+ do_sourceAvailabilityChanged_s sourceAvailabilityChanged;
+ do_volumeChanged_s volumeChanged;
+ do_sinkMuteStateChanged_s sinkMuteStateChanged;
+ do_timingInformationChanged_s timingInformationChanged;
+ am_SystemProperty_s systemProperty;
+ };
+
+ struct do_msg_s
+ {
+ do_msgID_e msgID;
+ do_parameter_u parameters;
+ };
+
+ void pipeCommand(const do_msg_s& message);
+
+ void commonConstructor(); //!< this is called from both constructors
CommandSender *mCommandSender; //!< pointer to the comandSender
RoutingSender* mRoutingSender; //!< pointer to the routingSender
TelnetServer* mTelnetServer; //!< pointer to the telnetserver
+ SocketHandler* mSocketHandler; //!< pointer to the sockethandler
+
+ int mPipe[2];
+ sh_pollHandle_t mHandle;
+ std::queue<do_msg_s> mQueue;
};
}
diff --git a/AudioManagerDaemon/include/RoutingReceiver.h b/AudioManagerDaemon/include/RoutingReceiver.h
index d3675a8..08af182 100644
--- a/AudioManagerDaemon/include/RoutingReceiver.h
+++ b/AudioManagerDaemon/include/RoutingReceiver.h
@@ -44,7 +44,6 @@ class RoutingReceiver: public RoutingReceiveInterface
{
public:
RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler);
- RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, DBusWrapper *iDBusWrapper);
RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper);
virtual ~RoutingReceiver();
void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);