summaryrefslogtreecommitdiff
path: root/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp')
-rw-r--r--PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp473
1 files changed, 67 insertions, 406 deletions
diff --git a/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp b/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
index c11201e..5c93f60 100644
--- a/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
+++ b/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
@@ -36,16 +36,10 @@
using namespace am;
-pthread_mutex_t RoutingReceiverAsyncShadow::mMutex = PTHREAD_MUTEX_INITIALIZER;
-
-RoutingReceiverAsyncShadow::RoutingReceiverAsyncShadow():
-asyncMsgReceive(this, &RoutingReceiverAsyncShadow::asyncMsgReceiver), //
- asyncDispatch(this, &RoutingReceiverAsyncShadow::asyncDispatcher), //
- asyncCheck(this, &RoutingReceiverAsyncShadow::asyncChecker), //
- mSocketHandler(), //
- mRoutingReceiveInterface(), //
-mHandle (), //
-mPipe()
+RoutingReceiverAsyncShadow::RoutingReceiverAsyncShadow(RoutingReceiveInterface* iReceiveInterface, SocketHandler* iSocketHandler) :
+ mSocketHandler(iSocketHandler), //
+ mRoutingReceiveInterface(iReceiveInterface), //
+ mSerializer(iSocketHandler)
{
}
@@ -56,472 +50,139 @@ RoutingReceiverAsyncShadow::~RoutingReceiverAsyncShadow()
void RoutingReceiverAsyncShadow::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_connect_s temp;
- temp.handle = handle;
- temp.connectionID = connectionID;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKCONNECT;
- msg.parameters.connect = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackConnect write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_connectionID_t, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackConnect, handle, connectionID, error);
}
void RoutingReceiverAsyncShadow::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_connect_s temp;
- temp.handle = handle;
- temp.connectionID = connectionID;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKDISCONNECT;
- msg.parameters.connect = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackDisconnect write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_connectionID_t, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackDisconnect, handle, connectionID, error);
}
void RoutingReceiverAsyncShadow::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_volume_s temp;
- temp.handle = handle;
- temp.volume = volume;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSINKVOLUMECHANGE;
- msg.parameters.volume = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSinkVolumeChange write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_volume_t, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSinkVolumeChange, handle, volume, error);
}
void RoutingReceiverAsyncShadow::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_volume_s temp;
- temp.handle = handle;
- temp.volume = volume;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCEVOLUMECHANGE;
- msg.parameters.volume = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSourceVolumeChange write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_volume_t, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSourceVolumeChange, handle, volume, error);
}
void RoutingReceiverAsyncShadow::ackSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCESTATE;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSourceState write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSourceState, handle, error);
}
void RoutingReceiverAsyncShadow::ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSINKSOUNDPROPERTY;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSinkSoundProperty write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSinkSoundProperty, handle, error);
}
void RoutingReceiverAsyncShadow::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCESOUNDPROPERTY;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSourceSoundProperty write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSourceSoundProperty, handle, error);
}
void RoutingReceiverAsyncShadow::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_crossfading_s temp;
- temp.handle = handle;
- temp.hotSink = hotSink;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKCROSSFADING;
- msg.parameters.crossfading = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackCrossFading write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_HotSink_e, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackCrossFading, handle, hotSink, error);
}
void RoutingReceiverAsyncShadow::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sourceVolumeTick_s temp;
- temp.sourceID = sourceID;
- temp.handle = handle;
- temp.volume = volume;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSOURCEVOLUMETICK;
- msg.parameters.sourceVolumeTick = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSourceVolumeTick write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_sourceID_t, const am_volume_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSourceVolumeTick, handle, sourceID, volume);
}
void RoutingReceiverAsyncShadow::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sinkVolumeTick_s temp;
- temp.sinkID = sinkID;
- temp.handle = handle;
- temp.volume = volume;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSINKVOLUMETICK;
- msg.parameters.sinkVolumeTick = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSinkVolumeTick write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_sinkID_t, const am_volume_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSinkVolumeTick, handle, sinkID, volume);
}
void RoutingReceiverAsyncShadow::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_interruptStatusChange_s temp;
- temp.sourceID = sourceID;
- temp.interruptState = interruptState;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKINTERRUPTSTATUSCHANGE;
- msg.parameters.interruptStatusChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookInterruptStatusChange write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_sinkID_t, const am_InterruptState_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookInterruptStatusChange, sourceID, interruptState);
}
void RoutingReceiverAsyncShadow::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sinkAvailability_s temp;
- temp.sinkID = sinkID;
- temp.availability = availability;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKSINKAVAILABLITYSTATUSCHANGE;
- msg.parameters.sinkAvailability = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookSinkAvailablityStatusChange write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_sinkID_t, const am_Availability_s&>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookSinkAvailablityStatusChange, sinkID, availability);
}
void RoutingReceiverAsyncShadow::hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sourceAvailability_s temp;
- temp.sourceID = sourceID;
- temp.availability = availability;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE;
- msg.parameters.sourceAvailability = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookSourceAvailablityStatusChange write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_sourceID_t, const am_Availability_s&>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookSourceAvailablityStatusChange, sourceID, availability);
}
void RoutingReceiverAsyncShadow::hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_hookDomainStateChange_s temp;
- temp.domainID = domainID;
- temp.state = domainState;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKDOMAINSTATECHANGE;
- msg.parameters.domainStateChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookDomainStateChange write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_domainID_t, const am_DomainState_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookDomainStateChange, domainID, domainState);
}
void RoutingReceiverAsyncShadow::hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_timingInfoChanged_s temp;
- temp.connectionID = connectionID;
- temp.delay = delay;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKTIMINGINFORMATIONCHANGED;
- msg.parameters.timingInfoChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookTimingInformationChanged write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_connectionID_t, const am_timeSync_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookTimingInformationChanged, connectionID, delay);
}
-void RoutingReceiverAsyncShadow::asyncMsgReceiver(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
+am_Error_e RoutingReceiverAsyncShadow::registerDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- (void) handle;
- (void) userData;
- //it is no really important what to read here, we will read the queue later...
- char buffer[10];
- if (read(pollfd.fd, buffer, 10) == -1)
- {
- logError("RoutingReceiverAsyncShadow::asyncMsgReceiver could not read!");
- }
+ am_Error_e error (E_UNKNOWN);
+ am_Domain_s domainDataCopy(domainData);
+ mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Domain_s&,am_domainID_t&, am_Domain_s, am_domainID_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::registerDomain, error, domainDataCopy, domainID);
+ return (error);
}
-bool RoutingReceiverAsyncShadow::asyncDispatcher(const sh_pollHandle_t handle, void *userData)
+am_Error_e am::RoutingReceiverAsyncShadow::registerGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- (void) handle;
- (void) userData;
- msg_s msg;
-
- //ok, let's receive, first lock
- pthread_mutex_lock(&mMutex);
- msg = mQueue.front();
- mQueue.pop();
- pthread_mutex_unlock(&mMutex);
+ am_Error_e error (E_UNKNOWN);
+ am_Gateway_s gatewayDataCopy(gatewayData);
+ mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Gateway_s&, am_gatewayID_t&, am_Gateway_s, am_gatewayID_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::registerGateway, error, gatewayDataCopy, gatewayID);
+ return (error);
+}
- //check for the message:
- switch (msg.msgID)
- {
- case MSG_ACKCONNECT:
- mRoutingReceiveInterface->ackConnect(msg.parameters.connect.handle, msg.parameters.connect.connectionID, msg.parameters.connect.error);
- break;
- case MSG_ACKDISCONNECT:
- mRoutingReceiveInterface->ackDisconnect(msg.parameters.connect.handle, msg.parameters.connect.connectionID, msg.parameters.connect.error);
- break;
- case MSG_ACKSETSINKVOLUMECHANGE:
- mRoutingReceiveInterface->ackSetSinkVolumeChange(msg.parameters.volume.handle, msg.parameters.volume.volume, msg.parameters.volume.error);
- break;
- case MSG_ACKSETSOURCEVOLUMECHANGE:
- mRoutingReceiveInterface->ackSetSourceVolumeChange(msg.parameters.volume.handle, msg.parameters.volume.volume, msg.parameters.volume.error);
- break;
- case MSG_ACKSETSOURCESTATE:
- mRoutingReceiveInterface->ackSetSourceState(msg.parameters.handle.handle, msg.parameters.handle.error);
- break;
- case MSG_ACKSETSINKSOUNDPROPERTY:
- mRoutingReceiveInterface->ackSetSinkSoundProperty(msg.parameters.handle.handle, msg.parameters.handle.error);
- break;
- case MSG_ACKSETSOURCESOUNDPROPERTY:
- mRoutingReceiveInterface->ackSetSourceSoundProperty(msg.parameters.handle.handle, msg.parameters.handle.error);
- break;
- case MSG_ACKCROSSFADING:
- mRoutingReceiveInterface->ackCrossFading(msg.parameters.crossfading.handle, msg.parameters.crossfading.hotSink, msg.parameters.crossfading.error);
- break;
- case MSG_ACKSOURCEVOLUMETICK:
- mRoutingReceiveInterface->ackSourceVolumeTick(msg.parameters.sourceVolumeTick.handle, msg.parameters.sourceVolumeTick.sourceID, msg.parameters.sourceVolumeTick.volume);
- break;
- case MSG_ACKSINKVOLUMETICK:
- mRoutingReceiveInterface->ackSinkVolumeTick(msg.parameters.sinkVolumeTick.handle, msg.parameters.sinkVolumeTick.sinkID, msg.parameters.sinkVolumeTick.volume);
- break;
- case MSG_HOOKINTERRUPTSTATUSCHANGE:
- mRoutingReceiveInterface->hookInterruptStatusChange(msg.parameters.interruptStatusChange.sourceID, msg.parameters.interruptStatusChange.interruptState);
- break;
- case MSG_HOOKSINKAVAILABLITYSTATUSCHANGE:
- mRoutingReceiveInterface->hookSinkAvailablityStatusChange(msg.parameters.sinkAvailability.sinkID, msg.parameters.sinkAvailability.availability);
- break;
- case MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE:
- mRoutingReceiveInterface->hookSourceAvailablityStatusChange(msg.parameters.sourceAvailability.sourceID, msg.parameters.sourceAvailability.availability);
- break;
- case MSG_HOOKDOMAINSTATECHANGE:
- mRoutingReceiveInterface->hookDomainStateChange(msg.parameters.domainStateChange.domainID, msg.parameters.domainStateChange.state);
- break;
- case MSG_HOOKTIMINGINFORMATIONCHANGED:
- mRoutingReceiveInterface->hookTimingInformationChanged(msg.parameters.timingInfoChange.connectionID, msg.parameters.timingInfoChange.delay);
- break;
- default:
- logError("RoutingReceiverAsyncShadow::asyncDispatcher unknown message was received:", msg.msgID);
- break;
- }
+am_Error_e am::RoutingReceiverAsyncShadow::registerSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+{
+ am_Error_e error (E_UNKNOWN);
+ am_Sink_s sinkDataCopy(sinkData);
+ mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Sink_s&, am_sinkID_t&, am_Sink_s, am_sinkID_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::registerSink, error, sinkDataCopy, sinkID);
+ return (error);
+}
- bool retVal = false;
- pthread_mutex_lock(&mMutex);
- if (mQueue.size() > 0)
- retVal = true;
- pthread_mutex_unlock(&mMutex);
+am_Error_e am::RoutingReceiverAsyncShadow::deregisterSink(const am_sinkID_t sinkID)
+{
+ am_Error_e error;
+ am_sinkID_t s(sinkID); //no const values allowed in syncCalls due to reference !
+ mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, am_sinkID_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::deregisterSink, error, s);
+ return (error);
+}
- return (retVal);
+am_Error_e am::RoutingReceiverAsyncShadow::registerSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+{
+ am_Error_e error (E_UNKNOWN);
+ am_Source_s sourceDataCopy(sourceData);
+ mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Source_s&, am_sourceID_t&, am_Source_s, am_sourceID_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::registerSource, error, sourceDataCopy, sourceID);
+ return (error);
}
-bool RoutingReceiverAsyncShadow::asyncChecker(const sh_pollHandle_t handle, void *userData)
+am_Error_e am::RoutingReceiverAsyncShadow::deregisterSource(const am_sourceID_t sourceID)
{
- (void) handle;
- (void) userData;
- bool returnVal = false;
- pthread_mutex_lock(&mMutex);
- if (mQueue.size() > 0)
- returnVal = true;
- pthread_mutex_unlock(&mMutex);
- return (returnVal);
+ am_Error_e error;
+ am_sourceID_t s(sourceID); //no const values allowed in syncCalls due to reference !
+ mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, am_sinkID_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::deregisterSource, error, s);
+ return (error);
}
-am_Error_e RoutingReceiverAsyncShadow::setRoutingInterface(RoutingReceiveInterface *receiveInterface)
+am_Error_e am::RoutingReceiverAsyncShadow::registerCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- assert(receiveInterface!=0);
- mRoutingReceiveInterface = receiveInterface;
- mRoutingReceiveInterface->getSocketHandler(mSocketHandler);
- if (pipe(mPipe) == -1)
- {
- logError("RoutingReceiverAsyncShadow::setRoutingInterface could not create pipe!:");
- return (E_UNKNOWN);
- }
+ am_Error_e error (E_UNKNOWN);
+ am_Crossfader_s crossfaderDataCopy(crossfaderData);
+ mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Crossfader_s&, am_crossfaderID_t&, am_Crossfader_s, am_crossfaderID_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::registerCrossfader, error, crossfaderDataCopy, crossfaderID);
+ return (error);
+}
- short event = 0;
- event |= POLLIN;
- mSocketHandler->addFDPoll(mPipe[0], event, NULL, &asyncMsgReceive, &asyncCheck, &asyncDispatch, NULL, mHandle);
- return (E_OK);
+void am::RoutingReceiverAsyncShadow::confirmRoutingReady(uint16_t starupHandle)
+{
+ mSerializer.asyncCall<RoutingReceiveInterface,uint16_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::confirmRoutingReady,starupHandle);
}
+
+
+