summaryrefslogtreecommitdiff
path: root/PluginRoutingInterfaceAsync/include
diff options
context:
space:
mode:
Diffstat (limited to 'PluginRoutingInterfaceAsync/include')
-rw-r--r--PluginRoutingInterfaceAsync/include/CAmRoutingSenderAsync.h (renamed from PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h)120
-rw-r--r--PluginRoutingInterfaceAsync/include/IAmRoutingReceiverShadow.h (renamed from PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h)17
2 files changed, 68 insertions, 69 deletions
diff --git a/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h b/PluginRoutingInterfaceAsync/include/CAmRoutingSenderAsync.h
index 96e1b5c..377b7c5 100644
--- a/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h
+++ b/PluginRoutingInterfaceAsync/include/CAmRoutingSenderAsync.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger DbusPlugin
*
- * \file RoutingSender.h
+ * \file CAmRoutingSender.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,28 +26,26 @@
#ifndef ROUTINGSENDER_H_
#define ROUTINGSENDER_H_
-#include <routing/RoutingSendInterface.h>
-#include "RoutingReceiverAsyncShadow.h"
+#include "routing/IAmRoutingSend.h"
+#include "IAmRoutingReceiverShadow.h"
#include <semaphore.h>
#include <memory.h>
namespace am
{
-class WorkerThreadPool;
+class CAmWorkerThreadPool;
/**
* Base class for workers implements everything that is needed to implement a workerthread
* inherit from this class when adding new workers
*/
-class Worker
+class CAmWorker
{
public:
- Worker(WorkerThreadPool* pool);
- virtual ~Worker()
- {
- }
- ;
+ CAmWorker(CAmWorkerThreadPool* pool);
+ virtual ~CAmWorker()
+ {};
/**
* needs to be overwritten, this function is called when the worker should start to work
*/
@@ -72,7 +70,7 @@ public:
* @param cancel
*/
void setCancelSempaphore(sem_t* cancel);
- WorkerThreadPool* pPool;
+ CAmWorkerThreadPool* pPool;
private:
sem_t* mCancelSem; //<! semaphore for cancellation
};
@@ -80,22 +78,22 @@ private:
/**
* This class handles the threadpool
*/
-class WorkerThreadPool
+class CAmWorkerThreadPool
{
public:
/**
* creates the pool. Give the max number of threads as argument
* @param numThreads max number of threads
*/
- WorkerThreadPool(int numThreads);
- virtual ~WorkerThreadPool();
+ CAmWorkerThreadPool(int numThreads);
+ virtual ~CAmWorkerThreadPool();
/**
* assigns a thread to a worker class and starts working.
* @param worker
* @return the actual assigned workerID or -1 in case no thread is free
*/
- int16_t startWork(Worker* worker);
+ int16_t startWork(CAmWorker* worker);
/**
* cancels a thread
* @param workerID thread to be canceled
@@ -110,7 +108,7 @@ public:
void finishedWork(pthread_t threadID);
private:
- static void* WorkerThread(void* data);
+ static void* CAmWorkerThread(void* data);
int mNumThreads;
struct threadInfo_s
{
@@ -119,18 +117,18 @@ private:
bool busy;
sem_t block;
sem_t cancel;
- Worker *worker;
+ CAmWorker *worker;
};
std::vector<threadInfo_s> mListWorkers; //<! list of all workers
static pthread_mutex_t mBlockingMutex; //<! mutex to block the acces of the list
};
-class AsyncRoutingSender: public RoutingSendInterface
+class CAmRoutingSenderAsync: public IAmRoutingSend
{
public:
- AsyncRoutingSender();
- virtual ~AsyncRoutingSender();
- am_Error_e startupInterface(RoutingReceiveInterface* routingreceiveinterface) ;
+ CAmRoutingSenderAsync();
+ virtual ~CAmRoutingSenderAsync();
+ am_Error_e startupInterface(IAmRoutingReceive* routingreceiveinterface) ;
void setRoutingReady(const uint16_t handle) ;
void setRoutingRundown(const uint16_t handle) ;
am_Error_e asyncAbort(const am_Handle_s handle) ;
@@ -227,16 +225,16 @@ private:
std::vector<am_Sink_s> createSinkTable();
std::vector<am_Source_s> createSourceTable();
std::vector<am_Gateway_s> createGatewayTable();
- RoutingReceiverAsyncShadow* mShadow;
- RoutingReceiveInterface* mReceiveInterface;
- SocketHandler *mSocketHandler;
+ IAmRoutingReceiverShadow* mShadow;
+ IAmRoutingReceive* mReceiveInterface;
+ CAmSocketHandler *mSocketHandler;
std::vector<am_Domain_s> mDomains;
std::vector<am_Sink_s> mSinks;
std::vector<am_Source_s> mSources;
std::vector<am_Gateway_s> mGateways;
std::map<uint16_t, int16_t> mMapHandleWorker;
std::map<am_connectionID_t, am_RoutingElement_s> mMapConnectionIDRoute;
- WorkerThreadPool mPool;
+ CAmWorkerThreadPool mPool;
pthread_t mInterruptThread;
static pthread_mutex_t mMapConnectionMutex;
static pthread_mutex_t mMapHandleWorkerMutex;
@@ -248,15 +246,15 @@ private:
/**
* worker to for connection
*/
-class asycConnectWorker: public Worker
+class asycConnectWorker: public CAmWorker
{
public:
- asycConnectWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, 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);
+ asycConnectWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, 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);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_connectionID_t mConnectionID;
am_sourceID_t mSourceID;
@@ -267,15 +265,15 @@ private:
/**
* worker for disconnecting
*/
-class asycDisConnectWorker: public Worker
+class asycDisConnectWorker: public CAmWorker
{
public:
- asycDisConnectWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID);
+ asycDisConnectWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_connectionID_t mConnectionID;
am_ConnectionFormat_e mConnectionFormat;
@@ -289,15 +287,15 @@ private:
#include <sys/signalfd.h>
#include <signal.h>
-class asyncSetSinkVolumeWorker: public Worker
+class asyncSetSinkVolumeWorker: public CAmWorker
{
public:
- asyncSetSinkVolumeWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_volume_t currentVolume, 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);
+ asyncSetSinkVolumeWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_volume_t currentVolume, 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);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_volume_t mCurrentVolume;
am_Handle_s mHandle;
am_sinkID_t mSinkID;
@@ -306,15 +304,15 @@ private:
am_time_t mTime;
};
-class asyncSetSourceVolumeWorker: public Worker
+class asyncSetSourceVolumeWorker: public CAmWorker
{
public:
- asyncSetSourceVolumeWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_volume_t currentVolume, 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);
+ asyncSetSourceVolumeWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_volume_t currentVolume, 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);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_volume_t mCurrentVolume;
am_Handle_s mHandle;
am_sourceID_t mSourceID;
@@ -323,70 +321,70 @@ private:
am_time_t mTime;
};
-class asyncSetSourceStateWorker: public Worker
+class asyncSetSourceStateWorker: public CAmWorker
{
public:
- asyncSetSourceStateWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state);
+ asyncSetSourceStateWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_sourceID_t mSourceID;
am_SourceState_e mSourcestate;
};
-class asyncSetSinkSoundPropertyWorker: public Worker
+class asyncSetSinkSoundPropertyWorker: public CAmWorker
{
public:
- asyncSetSinkSoundPropertyWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID);
+ asyncSetSinkSoundPropertyWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_sinkID_t mSinkID;
am_SoundProperty_s mSoundProperty;
};
-class asyncSetSourceSoundPropertyWorker: public Worker
+class asyncSetSourceSoundPropertyWorker: public CAmWorker
{
public:
- asyncSetSourceSoundPropertyWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID);
+ asyncSetSourceSoundPropertyWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_sourceID_t mSourceID;
am_SoundProperty_s mSoundProperty;
};
-class asyncDomainStateChangeWorker: public Worker
+class asyncDomainStateChangeWorker: public CAmWorker
{
public:
- asyncDomainStateChangeWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_domainID_t domainID, const am_DomainState_e domainState);
+ asyncDomainStateChangeWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_domainID_t domainID, const am_DomainState_e domainState);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_domainID_t mDomainID;
am_DomainState_e mDomainState;
};
-class syncRegisterWorker: public Worker
+class syncRegisterWorker: public CAmWorker
{
public:
- syncRegisterWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const std::vector<am_Domain_s> domains, const std::vector<am_Sink_s> sinks, const std::vector<am_Source_s> sources, const uint16_t handle);
+ syncRegisterWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const std::vector<am_Domain_s> domains, const std::vector<am_Sink_s> sinks, const std::vector<am_Source_s> sources, const uint16_t handle);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
std::vector<am_Domain_s> mListDomains;
std::vector<am_Sink_s> mListSinks;
std::vector<am_Source_s> mListSources;
diff --git a/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h b/PluginRoutingInterfaceAsync/include/IAmRoutingReceiverShadow.h
index bf5a5ed..af4685c 100644
--- a/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h
+++ b/PluginRoutingInterfaceAsync/include/IAmRoutingReceiverShadow.h
@@ -25,11 +25,11 @@
#ifndef ROUTINGRECEIVERASYNCSHADOW_H_
#define ROUTINGRECEIVERASYNCSHADOW_H_
-#include <routing/RoutingReceiveInterface.h>
-#include <SocketHandler.h>
+#include "routing/IAmRoutingReceive.h"
#include <pthread.h>
#include <queue>
-#include "CAmSerializer.h"
+#include "shared/CAmSerializer.h"
+#include "shared/CAmSocketHandler.h"
namespace am
{
@@ -38,11 +38,11 @@ namespace am
* Threadsafe shadow of the RoutingReceiverInterface
* Register and deregister Functions are sychronous so they do not show up here...
*/
-class RoutingReceiverAsyncShadow
+class IAmRoutingReceiverShadow
{
public:
- RoutingReceiverAsyncShadow(RoutingReceiveInterface* iReceiveInterface,SocketHandler* iSocketHandler);
- virtual ~RoutingReceiverAsyncShadow();
+ IAmRoutingReceiverShadow(IAmRoutingReceive* iReceiveInterface,CAmSocketHandler* iSocketHandler);
+ virtual ~IAmRoutingReceiverShadow();
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);
@@ -66,11 +66,12 @@ public:
am_Error_e deregisterSource(const am_sourceID_t sourceID) ;
am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
void confirmRoutingReady(uint16_t starupHandle);
+ void confirmRoutingRundown(uint16_t rundownHandle);
private:
- SocketHandler *mSocketHandler;
- RoutingReceiveInterface *mRoutingReceiveInterface;
+ CAmSocketHandler *mSocketHandler;
+ IAmRoutingReceive *mRoutingReceiveInterface;
CAmSerializer mSerializer;
};