From db8583483517265e9d6b0fdb3add2cad2cdbcca9 Mon Sep 17 00:00:00 2001 From: Christian Linke Date: Mon, 9 Sep 2013 18:40:19 +0200 Subject: * some naming adoptions & review for GENIVI Signed-off-by: Christian Linke --- PluginRoutingInterfaceCAPI/src/CAmLookupData.cpp | 274 ++++++++++++--------- .../src/CAmRoutingSenderCAPI.cpp | 43 ++-- .../src/CAmRoutingSenderCommon.cpp | 134 +++++----- .../src/CAmRoutingService.cpp | 264 +++++++++----------- 4 files changed, 362 insertions(+), 353 deletions(-) (limited to 'PluginRoutingInterfaceCAPI/src') diff --git a/PluginRoutingInterfaceCAPI/src/CAmLookupData.cpp b/PluginRoutingInterfaceCAPI/src/CAmLookupData.cpp index 6788618..1b99177 100644 --- a/PluginRoutingInterfaceCAPI/src/CAmLookupData.cpp +++ b/PluginRoutingInterfaceCAPI/src/CAmLookupData.cpp @@ -29,7 +29,7 @@ const char * CAmLookupData::BUS_NAME = "CAPIRoutingPlugin"; * rs_lookupData_s */ -rs_lookupData_s::rs_lookupData_s(const std::shared_ptr > & aProxy):mSenderProxy(aProxy) +rs_lookupData_s::rs_lookupData_s(const std::shared_ptr > & aProxy):mSenderProxy(aProxy) { logInfo(__PRETTY_FUNCTION__); mSubscription = mSenderProxy->getProxyStatusEvent().subscribe(std::bind(&rs_lookupData_s::onServiceStatusEvent,this,std::placeholders::_1)); @@ -41,7 +41,7 @@ rs_lookupData_s::~rs_lookupData_s() mSenderProxy.reset(); } -std::shared_ptr> & rs_lookupData_s::getProxy() +std::shared_ptr> & rs_lookupData_s::getProxy() { return mSenderProxy; } @@ -51,124 +51,138 @@ bool rs_lookupData_s::isConnected() return mIsConnected; } -am_Error_e rs_lookupData_s::asyncAbort(const uint16_t handle, RoutingSenderProxyBase::AsyncAbortAsyncCallback callback) +am_Error_e rs_lookupData_s::asyncAbort(const am_Handle_s handle, org::genivi::am::RoutingControlProxyBase::AsyncAbortAsyncCallback callback) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - mSenderProxy->asyncAbortAsync(static_cast(handle), callback); + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncAbortAsync(myHandle, callback); return (E_OK); } return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncConnect(const uint16_t handle, +am_Error_e rs_lookupData_s::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, - RoutingSenderProxyBase::AsyncConnectAsyncCallback callback) + org::genivi::am::RoutingControlProxyBase::AsyncConnectAsyncCallback callback) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - mSenderProxy->asyncConnectAsync(static_cast(handle), - static_cast(connectionID), - static_cast(sourceID), - static_cast(sinkID), - static_cast(connectionFormat), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncConnectAsync(myHandle, + static_cast(connectionID), + static_cast(sourceID), + static_cast(sinkID), + static_cast(connectionFormat), callback); return (E_OK); } return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncDisconnect(const uint16_t handle, +am_Error_e rs_lookupData_s::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, - RoutingSenderProxyBase::AsyncDisconnectAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncDisconnectAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - mSenderProxy->asyncDisconnectAsync(static_cast(handle), - static_cast(connectionID), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncDisconnectAsync(myHandle, + static_cast(connectionID), cb); return (E_OK); } return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSinkVolume( const uint16_t handle, +am_Error_e rs_lookupData_s::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, - RoutingSenderProxyBase::AsyncSetSinkVolumeAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkVolumeAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - mSenderProxy->asyncSetSinkVolumeAsync(static_cast(handle), - static_cast(sinkID), - static_cast(volume), - static_cast(ramp), - static_cast(time), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSinkVolumeAsync(myHandle, + static_cast(sinkID), + static_cast(volume), + static_cast(ramp), + static_cast(time), cb); return (E_OK); } return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSourceVolume(const uint16_t handle, +am_Error_e rs_lookupData_s::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, - RoutingSenderProxyBase::AsyncSetSourceVolumeAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSourceVolumeAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - mSenderProxy->asyncSetSourceVolumeAsync(static_cast(handle), - static_cast(sourceID), - static_cast(volume), - static_cast(ramp), - static_cast(time), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSourceVolumeAsync(myHandle, + static_cast(sourceID), + static_cast(volume), + static_cast(ramp), + static_cast(time), cb); return (E_OK); } return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSourceState( const uint16_t handle, +am_Error_e rs_lookupData_s::asyncSetSourceState( const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state, - RoutingSenderProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - mSenderProxy->asyncSetSourceStateAsync(static_cast(handle), - static_cast(sourceID), - static_cast(state), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSourceStateAsync(myHandle, + static_cast(sourceID), + static_cast(state), cb); return (E_OK); } return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSinkSoundProperties( const uint16_t handle, +am_Error_e rs_lookupData_s::asyncSetSinkSoundProperties( const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector& listSoundProperties, - RoutingSenderProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - am_gen::am_SoundProperty_L lsp; + org::genivi::am::am_SoundProperty_L lsp; CAmConvertAMVector2CAPI(listSoundProperties, lsp); - mSenderProxy->asyncSetSinkSoundPropertiesAsync(static_cast(handle), - static_cast(sinkID), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSinkSoundPropertiesAsync(myHandle, + static_cast(sinkID), lsp, cb); return (E_OK); @@ -176,18 +190,20 @@ am_Error_e rs_lookupData_s::asyncSetSinkSoundProperties( const uint16_t handle, return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSinkSoundProperty( const uint16_t handle, +am_Error_e rs_lookupData_s::asyncSetSinkSoundProperty( const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty, - RoutingSenderProxyBase::AsyncSetSinkSoundPropertyAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkSoundPropertyAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - am_gen::am_SoundProperty_s converted; + org::genivi::am::am_SoundProperty_s converted; CAmConvertAM2CAPI(soundProperty, converted); - mSenderProxy->asyncSetSinkSoundPropertyAsync(static_cast(handle), - static_cast(sinkID), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSinkSoundPropertyAsync(myHandle, + static_cast(sinkID), converted, cb); return (E_OK); @@ -195,18 +211,20 @@ am_Error_e rs_lookupData_s::asyncSetSinkSoundProperty( const uint16_t handle, return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSourceSoundProperties(const uint16_t handle, +am_Error_e rs_lookupData_s::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector& listSoundProperties, - RoutingSenderProxyBase::AsyncSetSourceSoundPropertiesAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSourceSoundPropertiesAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - am_gen::am_SoundProperty_L lsp; + org::genivi::am::am_SoundProperty_L lsp; CAmConvertAMVector2CAPI(listSoundProperties, lsp); - mSenderProxy->asyncSetSourceSoundPropertiesAsync(static_cast(handle), - static_cast(sourceID), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSourceSoundPropertiesAsync(myHandle, + static_cast(sourceID), lsp, cb); return (E_OK); @@ -214,18 +232,20 @@ am_Error_e rs_lookupData_s::asyncSetSourceSoundProperties(const uint16_t handle, return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSourceSoundProperty(const uint16_t handle, +am_Error_e rs_lookupData_s::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty, - RoutingSenderProxyBase::AsyncSetSourceSoundPropertyAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSourceSoundPropertyAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - am_gen::am_SoundProperty_s converted; + org::genivi::am::am_SoundProperty_s converted; CAmConvertAM2CAPI(soundProperty, converted); - mSenderProxy->asyncSetSourceSoundPropertyAsync( static_cast(handle), - static_cast(sourceID), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSourceSoundPropertyAsync( myHandle, + static_cast(sourceID), converted, cb); return (E_OK); @@ -234,50 +254,54 @@ am_Error_e rs_lookupData_s::asyncSetSourceSoundProperty(const uint16_t handle, } -am_Error_e rs_lookupData_s::asyncCrossFade(const uint16_t handle, +am_Error_e rs_lookupData_s::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, - RoutingSenderProxyBase::AsyncCrossFadeAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncCrossFadeAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - mSenderProxy->asyncCrossFadeAsync(static_cast(handle), - static_cast(crossfaderID), - static_cast(hotSink), - static_cast(rampType), - static_cast(time), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncCrossFadeAsync(myHandle, + static_cast(crossfaderID), + static_cast(hotSink), + static_cast(rampType), + static_cast(time), cb); return (E_OK); } return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState, RoutingSenderProxyBase::SetDomainStateAsyncCallback cb) +am_Error_e rs_lookupData_s::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState, org::genivi::am::RoutingControlProxyBase::SetDomainStateAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - mSenderProxy->setDomainStateAsync(static_cast(domainID), - static_cast(domainState), + mSenderProxy->setDomainStateAsync(static_cast(domainID), + static_cast(domainState), cb); return (E_OK); } return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetVolumes(const uint16_t handle, +am_Error_e rs_lookupData_s::asyncSetVolumes(const am_Handle_s handle, const std::vector& volumes , - RoutingSenderProxyBase::AsyncSetVolumesAsyncCallback cb ) + org::genivi::am::RoutingControlProxyBase::AsyncSetVolumesAsyncCallback cb ) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - am_gen::am_Volumes_l list; + org::genivi::am::am_Volumes_L list; CAmConvertAMVector2CAPI(volumes, list); - mSenderProxy->asyncSetVolumesAsync(static_cast(handle), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetVolumesAsync(myHandle, list, cb); return (E_OK); @@ -285,18 +309,20 @@ am_Error_e rs_lookupData_s::asyncSetVolumes(const uint16_t handle, return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSinkNotificationConfiguration(const uint16_t handle, +am_Error_e rs_lookupData_s::asyncSetSinkNotificationConfiguration(const am_Handle_s handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration, - RoutingSenderProxyBase::AsyncSetSinkNotificationConfigurationAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkNotificationConfigurationAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - am_gen::am_NotificationConfiguration_s converted; + org::genivi::am::am_NotificationConfiguration_s converted; CAmConvertAM2CAPI(notificationConfiguration, converted); - mSenderProxy->asyncSetSinkNotificationConfigurationAsync(static_cast(handle), - static_cast(sinkID), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSinkNotificationConfigurationAsync(myHandle, + static_cast(sinkID), converted, cb); return (E_OK); @@ -304,18 +330,20 @@ am_Error_e rs_lookupData_s::asyncSetSinkNotificationConfiguration(const uint16_t return (E_UNKNOWN); } -am_Error_e rs_lookupData_s::asyncSetSourceNotificationConfiguration(const uint16_t handle, +am_Error_e rs_lookupData_s::asyncSetSourceNotificationConfiguration(const am_Handle_s handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration, - RoutingSenderProxyBase::AsyncSetSourceNotificationConfigurationAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSourceNotificationConfigurationAsyncCallback cb) { logInfo(__PRETTY_FUNCTION__, " [ isConnected : ", isConnected(), " ]"); if(isConnected()) { - am_gen::am_NotificationConfiguration_s converted; + org::genivi::am::am_NotificationConfiguration_s converted; CAmConvertAM2CAPI(notificationConfiguration, converted); - mSenderProxy->asyncSetSourceNotificationConfigurationAsync( static_cast(handle), - static_cast(sourceID), + org::genivi::am::am_Handle_s myHandle; + CAmConvertAM2CAPI(handle,myHandle); + mSenderProxy->asyncSetSourceNotificationConfigurationAsync( myHandle, + static_cast(sourceID), converted, cb); return (E_OK); @@ -344,16 +372,16 @@ CAmLookupData::~CAmLookupData() { } void CAmLookupData::addDomainLookup(am_domainID_t & domainID, - std::shared_ptr> & aProxy) + std::shared_ptr> & aProxy) { logInfo(__PRETTY_FUNCTION__, " [ domainID : ", domainID, " ]"); RSLookupDataPtr lookupData = std::make_shared(aProxy); mMapDomains.insert(std::make_pair(domainID, lookupData)); } -void CAmLookupData::removeHandle(uint16_t handle) +void CAmLookupData::removeHandle(am_Handle_s handle) { - mMapHandles.erase(handle); + mMapHandles.erase(handle.handle); } void CAmLookupData::addSourceLookup(am_sourceID_t sourceID, am_domainID_t domainID) @@ -450,164 +478,164 @@ template const CAmLookupData::RSLookupDataPtr CAmLookupData::ge return NULL; } -am_Error_e CAmLookupData::asyncAbort(const uint16_t handle, RoutingSenderProxyBase::AsyncAbortAsyncCallback callback) +am_Error_e CAmLookupData::asyncAbort(const am_Handle_s handle, org::genivi::am::RoutingControlProxyBase::AsyncAbortAsyncCallback callback) { - RSLookupDataPtr result = getValueForKey(handle, mMapHandles); + RSLookupDataPtr result = getValueForKey(handle.handle, mMapHandles); if(result) return result->asyncAbort(handle, callback); return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncConnect(const uint16_t handle, +am_Error_e CAmLookupData::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, - RoutingSenderProxyBase::AsyncConnectAsyncCallback callback) + org::genivi::am::RoutingControlProxyBase::AsyncConnectAsyncCallback callback) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sourceID, mMapSources); if(result) { mMapConnections.insert(std::make_pair(connectionID, result)); - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncConnect(handle, connectionID, sourceID, sinkID, connectionFormat, callback); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncDisconnect(const uint16_t handle, +am_Error_e CAmLookupData::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, - RoutingSenderProxyBase::AsyncDisconnectAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncDisconnectAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(connectionID, mMapConnections); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncDisconnect(handle, connectionID, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSinkVolume( const uint16_t handle, +am_Error_e CAmLookupData::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, - RoutingSenderProxyBase::AsyncSetSinkVolumeAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkVolumeAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sinkID, mMapSinks); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSinkVolume(handle, sinkID, volume, ramp, time, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSourceVolume(const uint16_t handle, +am_Error_e CAmLookupData::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, - RoutingSenderProxyBase::AsyncSetSourceVolumeAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSourceVolumeAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sourceID, mMapSources); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSourceVolume(handle, sourceID, volume, ramp, time, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSourceState(const uint16_t handle, +am_Error_e CAmLookupData::asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state, - RoutingSenderProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sourceID, mMapSources); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSourceState(handle, sourceID, state, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSinkSoundProperties( const uint16_t handle, +am_Error_e CAmLookupData::asyncSetSinkSoundProperties( const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector& listSoundProperties, - RoutingSenderProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sinkID, mMapSinks); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSinkSoundProperties(handle, sinkID, listSoundProperties, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSinkSoundProperty( const uint16_t handle, +am_Error_e CAmLookupData::asyncSetSinkSoundProperty( const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty, - RoutingSenderProxyBase::AsyncSetSinkSoundPropertyAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkSoundPropertyAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sinkID, mMapSinks); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSinkSoundProperty(handle, sinkID, soundProperty, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSourceSoundProperties(const uint16_t handle, +am_Error_e CAmLookupData::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector& listSoundProperties, - RoutingSenderProxyBase::AsyncSetSourceSoundPropertiesAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSourceSoundPropertiesAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sourceID, mMapSources); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSourceSoundProperties(handle, sourceID, listSoundProperties, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSourceSoundProperty(const uint16_t handle, +am_Error_e CAmLookupData::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty, - RoutingSenderProxyBase::AsyncSetSourceSoundPropertyAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSourceSoundPropertyAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sourceID, mMapSources); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSourceSoundProperty(handle, sourceID, soundProperty, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncCrossFade(const uint16_t handle, +am_Error_e CAmLookupData::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, - RoutingSenderProxyBase::AsyncCrossFadeAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncCrossFadeAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(crossfaderID, mMapCrossfaders); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncCrossFade(handle, crossfaderID, hotSink, rampType, time, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState, RoutingSenderProxyBase::SetDomainStateAsyncCallback cb) +am_Error_e CAmLookupData::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState, org::genivi::am::RoutingControlProxyBase::SetDomainStateAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(domainID, mMapDomains); if(result) @@ -616,9 +644,9 @@ am_Error_e CAmLookupData::setDomainState(const am_domainID_t domainID, const am_ } -am_Error_e CAmLookupData::asyncSetVolumes(const uint16_t handle, +am_Error_e CAmLookupData::asyncSetVolumes(const am_Handle_s handle, const std::vector& volumes , - RoutingSenderProxyBase::AsyncSetVolumesAsyncCallback cb ) + org::genivi::am::RoutingControlProxyBase::AsyncSetVolumesAsyncCallback cb ) { if(volumes.size()) @@ -631,36 +659,36 @@ am_Error_e CAmLookupData::asyncSetVolumes(const uint16_t handle, result = CAmLookupData::getValueForKey(volumeItem.volumeID.source, mMapSources); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetVolumes(handle, volumes, cb); } } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSinkNotificationConfiguration(const uint16_t handle, +am_Error_e CAmLookupData::asyncSetSinkNotificationConfiguration(const am_Handle_s handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration, - RoutingSenderProxyBase::AsyncSetSinkNotificationConfigurationAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSinkNotificationConfigurationAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sinkID, mMapSinks); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSinkNotificationConfiguration(handle, sinkID, notificationConfiguration, cb); } return (E_UNKNOWN); } -am_Error_e CAmLookupData::asyncSetSourceNotificationConfiguration(const uint16_t handle, +am_Error_e CAmLookupData::asyncSetSourceNotificationConfiguration(const am_Handle_s handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration, - RoutingSenderProxyBase::AsyncSetSourceNotificationConfigurationAsyncCallback cb) + org::genivi::am::RoutingControlProxyBase::AsyncSetSourceNotificationConfigurationAsyncCallback cb) { RSLookupDataPtr result = CAmLookupData::getValueForKey(sourceID, mMapSources); if(result) { - mMapHandles.insert(std::make_pair(+handle, result)); + mMapHandles.insert(std::make_pair(+handle.handle, result)); return result->asyncSetSourceNotificationConfiguration(handle, sourceID, notificationConfiguration, cb); } return (E_UNKNOWN); diff --git a/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCAPI.cpp b/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCAPI.cpp index 55d2792..533b01e 100644 --- a/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCAPI.cpp +++ b/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCAPI.cpp @@ -44,7 +44,6 @@ const char * CAmRoutingSenderCAPI::ROUTING_INTERFACE_SERVICE = "local:org.genivi CAmRoutingSenderCAPI::CAmRoutingSenderCAPI() : mIsServiceStarted(false), - mReady(false), mLookupData(), mpCAmCAPIWrapper(NULL), // mpIAmRoutingReceive(NULL), @@ -55,7 +54,6 @@ CAmRoutingSenderCAPI::CAmRoutingSenderCAPI() : CAmRoutingSenderCAPI::CAmRoutingSenderCAPI(CAmCommonAPIWrapper *aWrapper) : mIsServiceStarted(false), - mReady(false), mLookupData(), mpCAmCAPIWrapper(aWrapper), // mpIAmRoutingReceive(NULL), @@ -79,6 +77,7 @@ am_Error_e CAmRoutingSenderCAPI::startService(IAmRoutingReceive* pIAmRoutingRece { assert(pIAmRoutingReceive); mService = std::make_shared(pIAmRoutingReceive, &mLookupData, mpCAmCAPIWrapper); + mService->setRoutingReadyAttribute(org::genivi::am::am_RoutingReady_e::RR_UNKNOWN); //Registers the service if( false == mpCAmCAPIWrapper->registerStub(mService, CAmRoutingSenderCAPI::ROUTING_INTERFACE_SERVICE) ) { @@ -121,26 +120,22 @@ void CAmRoutingSenderCAPI::setRoutingReady(const uint16_t handle) { assert(mpIAmRoutingReceive); log(&ctxCommandCAPI, DLT_LOG_INFO, "sending routingReady signal"); - mReady = true; mpIAmRoutingReceive->confirmRoutingReady(handle,E_OK); - mService->fireSetRoutingReadyEvent(); - mService->gotReady(mLookupData.numberOfDomains(),handle); + mService->setRoutingReadyAttribute(org::genivi::am::am_RoutingReady_e::RR_READY); } void CAmRoutingSenderCAPI::setRoutingRundown(const uint16_t handle) { log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__); assert(mpIAmRoutingReceive); - mReady = false; - mpIAmRoutingReceive->confirmRoutingRundown(handle,E_OK); - mService->fireSetRoutingRundownEvent(); + mService->setRoutingReadyAttribute(org::genivi::am::am_RoutingReady_e::RR_RUNDOWN); mService->gotRundown(mLookupData.numberOfDomains(),handle); } am_Error_e CAmRoutingSenderCAPI::asyncAbort(const am_Handle_s handle) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncAbort called"); - return mLookupData.asyncAbort(handle.handle,[&](const CommonAPI::CallStatus& callStatus, const am_gen::am_Error_e& error){ + return mLookupData.asyncAbort(handle,[&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -148,7 +143,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncAbort(const am_Handle_s handle) am_Error_e CAmRoutingSenderCAPI::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) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncConnect called"); - return mLookupData.asyncConnect(handle.handle,connectionID, sourceID, sinkID, connectionFormat, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncConnect(handle,connectionID, sourceID, sinkID, connectionFormat, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -156,7 +151,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncConnect(const am_Handle_s handle, const am am_Error_e CAmRoutingSenderCAPI::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncDisconnect called"); - return mLookupData.asyncDisconnect(handle.handle,connectionID, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncDisconnect(handle,connectionID, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -164,7 +159,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncDisconnect(const am_Handle_s handle, const am_Error_e CAmRoutingSenderCAPI::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) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSinkVolume called"); - return mLookupData.asyncSetSinkVolume(handle.handle,sinkID, volume, ramp, time, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSinkVolume(handle,sinkID, volume, ramp, time, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -172,7 +167,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncSetSinkVolume(const am_Handle_s handle, co am_Error_e CAmRoutingSenderCAPI::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) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSourceVolume called"); - return mLookupData.asyncSetSourceVolume(handle.handle,sourceID, volume, ramp, time, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSourceVolume(handle,sourceID, volume, ramp, time, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -180,7 +175,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncSetSourceVolume(const am_Handle_s handle, am_Error_e CAmRoutingSenderCAPI::asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSourceState called"); - return mLookupData.asyncSetSourceState(handle.handle,sourceID, state,[&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSourceState(handle,sourceID, state,[&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -188,7 +183,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncSetSourceState(const am_Handle_s handle, c am_Error_e CAmRoutingSenderCAPI::asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector& listSoundProperties) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSinkSoundProperties called"); - return mLookupData.asyncSetSinkSoundProperties(handle.handle,sinkID, listSoundProperties, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSinkSoundProperties(handle,sinkID, listSoundProperties, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -196,7 +191,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncSetSinkSoundProperties(const am_Handle_s h am_Error_e CAmRoutingSenderCAPI::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSinkSoundProperty called"); - return mLookupData.asyncSetSinkSoundProperty(handle.handle, sinkID, soundProperty, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSinkSoundProperty(handle, sinkID, soundProperty, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -204,7 +199,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncSetSinkSoundProperty(const am_Handle_s han am_Error_e CAmRoutingSenderCAPI::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector& listSoundProperties) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSourceSoundProperties called"); - return mLookupData.asyncSetSourceSoundProperties(handle.handle, sourceID, listSoundProperties, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSourceSoundProperties(handle, sourceID, listSoundProperties, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -212,14 +207,14 @@ am_Error_e CAmRoutingSenderCAPI::asyncSetSourceSoundProperties(const am_Handle_s am_Error_e CAmRoutingSenderCAPI::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSourceSoundProperty called"); - return mLookupData.asyncSetSourceSoundProperty(handle.handle, sourceID, soundProperty, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSourceSoundProperty(handle, sourceID, soundProperty, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } am_Error_e CAmRoutingSenderCAPI::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) { - return mLookupData.asyncCrossFade(handle.handle, crossfaderID, hotSink, rampType, time, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncCrossFade(handle, crossfaderID, hotSink, rampType, time, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -227,8 +222,8 @@ am_Error_e CAmRoutingSenderCAPI::asyncCrossFade(const am_Handle_s handle, const am_Error_e CAmRoutingSenderCAPI::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::setDomainState called"); - return mLookupData.setDomainState(domainID, domainState, [&](const CommonAPI::CallStatus& callStatus, const am_gen::am_Error_e& error){ - log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); + return mLookupData.setDomainState(domainID, domainState, [&](const CommonAPI::CallStatus& callStatus, org::genivi::am::am_Error_e error){ + log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus),"Error",static_cast(error)); }); } @@ -241,7 +236,7 @@ am_Error_e CAmRoutingSenderCAPI::returnBusName(std::string& BusName) const am_Error_e CAmRoutingSenderCAPI::asyncSetVolumes(const am_Handle_s handle, const std::vector& volumes) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetVolumes called"); - return mLookupData.asyncSetVolumes(handle.handle, volumes, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetVolumes(handle, volumes, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -249,7 +244,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncSetVolumes(const am_Handle_s handle, const am_Error_e CAmRoutingSenderCAPI::asyncSetSinkNotificationConfiguration(const am_Handle_s handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& nc) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSinkNotificationConfiguration called"); - return mLookupData.asyncSetSinkNotificationConfiguration(handle.handle, sinkID, nc, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSinkNotificationConfiguration(handle, sinkID, nc, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } @@ -257,7 +252,7 @@ am_Error_e CAmRoutingSenderCAPI::asyncSetSinkNotificationConfiguration(const am_ am_Error_e CAmRoutingSenderCAPI::asyncSetSourceNotificationConfiguration(const am_Handle_s handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& nc) { log(&ctxCommandCAPI, DLT_LOG_INFO, "CAmRoutingSenderDbus::asyncSetSourceNotificationConfiguration called"); - return mLookupData.asyncSetSourceNotificationConfiguration(handle.handle, sourceID, nc, [&](const CommonAPI::CallStatus& callStatus){ + return mLookupData.asyncSetSourceNotificationConfiguration(handle, sourceID, nc, [&](const CommonAPI::CallStatus& callStatus){ log(&ctxCommandCAPI, DLT_LOG_INFO, __PRETTY_FUNCTION__, "Response with call status:", static_cast(callStatus)); }); } diff --git a/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp b/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp index c9f5876..e90c75a 100644 --- a/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp +++ b/PluginRoutingInterfaceCAPI/src/CAmRoutingSenderCommon.cpp @@ -22,7 +22,7 @@ * Utility functions */ -void CAmConvertCAPI2AM(const am_gen::am_Domain_s & source, am::am_Domain_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_Domain_s & source, am::am_Domain_s & destination) { destination.domainID = source.domainID; destination.name = source.name; @@ -33,40 +33,40 @@ void CAmConvertCAPI2AM(const am_gen::am_Domain_s & source, am::am_Domain_s & des destination.state = static_cast(source.state); } -void CAmConvertCAPI2AM(const am_gen::am_SoundProperty_s & source, am::am_SoundProperty_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_SoundProperty_s & source, am::am_SoundProperty_s & destination) { destination.type = static_cast(source.type); destination.value = source.value; } -void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) +void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) { am::am_SoundProperty_s soundProp; destination.clear(); - for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); iter++) + for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); ++iter) { CAmConvertCAPI2AM(*iter, soundProp); destination.push_back(soundProp); } } -void CAmConvertCAPI2AM(const am_gen::am_MainSoundProperty_s & source, am::am_MainSoundProperty_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_MainSoundProperty_s & source, am::am_MainSoundProperty_s & destination) { destination.type = static_cast(source.type); destination.value = source.value; } -void CAmConvertCAPI2AM(const am_gen::notificationPayload_s & source, am::am_NotificationPayload_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_NotificationPayload_s & source, am::am_NotificationPayload_s & destination) { destination.type = static_cast(source.type); - destination.value = source.payload; + destination.value = source.value; } -void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) +void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) { destination.clear(); - for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); iter++) + for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); ++iter) { am::am_Volumes_s volume; CAmConvertCAPI2AM(*iter, volume); @@ -74,45 +74,45 @@ void CAmConvertCAPIVector2AM(const std::vector & source, s } } -void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) +void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) { am::am_MainSoundProperty_s soundProp; destination.clear(); - for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); iter++) + for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); ++iter) { CAmConvertCAPI2AM(*iter, soundProp); destination.push_back(soundProp); } } -void CAmConvertCAPI2AM(const am_gen::am_NotificationConfiguration_s & source, am::am_NotificationConfiguration_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_NotificationConfiguration_s & source, am::am_NotificationConfiguration_s & destination) { destination.type = static_cast(source.type); destination.status = static_cast(source.status); destination.parameter = source.parameter; } -void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) +void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) { am::am_NotificationConfiguration_s soundProp; destination.clear(); - for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); iter++) + for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); ++iter) { CAmConvertCAPI2AM(*iter, soundProp); destination.push_back(soundProp); } } -void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) +void CAmConvertCAPIVector2AM(const std::vector & source, std::vector & destination) { destination.clear(); - for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); iter++) + for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); ++iter) destination.push_back(static_cast(*iter)); } -void CAmConvertCAPI2AM(const am_gen::sourceData_s & source, am::am_Source_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_Source_s & source, am::am_Source_s & destination) { destination.sourceID = source.sourceID; destination.domainID = source.domainID; @@ -130,7 +130,7 @@ void CAmConvertCAPI2AM(const am_gen::sourceData_s & source, am::am_Source_s & de CAmConvertCAPIVector2AM(source.listMainNotificationConfigurations, destination.listMainNotificationConfigurations); } -void CAmConvertCAPI2AM(const am_gen::sinkData_s & source, am::am_Sink_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_Sink_s & source, am::am_Sink_s & destination) { destination.sinkID = source.sinkID; destination.domainID = source.domainID; @@ -148,7 +148,7 @@ void CAmConvertCAPI2AM(const am_gen::sinkData_s & source, am::am_Sink_s & destin CAmConvertCAPIVector2AM(source.listMainNotificationConfigurations, destination.listMainNotificationConfigurations); } -void CAmConvertCAPI2AM(const am_gen::am_Volumes_s & source, am::am_Volumes_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_Volumes_s & source, am::am_Volumes_s & destination) { CAmConvertCAPI2AM(source.volumeID, destination.volumeID); destination.volume = source.volume; @@ -158,7 +158,7 @@ void CAmConvertCAPI2AM(const am_gen::am_Volumes_s & source, am::am_Volumes_s & d } -void CAmConvertCAPI2AM(const am_gen::crossfaderData_s & source, am::am_Crossfader_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_Crossfader_s & source, am::am_Crossfader_s & destination) { destination.crossfaderID = source.crossfaderID; destination.sinkID_A = source.sinkID_A; @@ -169,7 +169,7 @@ void CAmConvertCAPI2AM(const am_gen::crossfaderData_s & source, am::am_Crossfade } -void CAmConvertCAPI2AM(const am_gen::am_Gateway_s & source, am::am_Gateway_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_Gateway_s & source, am::am_Gateway_s & destination) { destination.sinkID = source.sinkID; destination.gatewayID = source.gatewayID; @@ -183,37 +183,37 @@ void CAmConvertCAPI2AM(const am_gen::am_Gateway_s & source, am::am_Gateway_s & d destination.convertionMatrix = source.convertionMatrix; } -void CAmConvertCAPI2AM(const am_gen::am_EarlyData_u & source, am::am_EarlyData_u & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_EarlyData_u & source, am::am_EarlyData_u & destination) { - if(source.isType()) + if(source.isType()) { - am_volume_t value = static_cast(source.get()); + am_volume_t value = static_cast(source.get()); destination.volume = value; } - else if(source.isType()) + else if(source.isType()) { - am_gen::am_SoundProperty_s value = source.get(); + org::genivi::am::am_SoundProperty_s value = source.get(); am_SoundProperty_s converted; CAmConvertCAPI2AM(value, converted); destination.soundProperty = converted; } } -void CAmConvertCAPI2AM(const am_gen::am_DataType_u & source, am::am_DataType_u & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_DataType_u & source, am::am_DataType_u & destination) { - if(source.isType()) + if(source.isType()) { - am_sinkID_t value = static_cast(source.get()); + am_sinkID_t value = static_cast(source.get()); destination.sink = value; } - else if(source.isType()) + else if(source.isType()) { - am_sourceID_t value = static_cast(source.get()); + am_sourceID_t value = static_cast(source.get()); destination.source = value; } } -void CAmConvertCAPI2AM(const am_gen::am_EarlyData_s & source, am::am_EarlyData_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_EarlyData_s & source, am::am_EarlyData_s & destination) { CAmConvertCAPI2AM(source.data, destination.data); CAmConvertCAPI2AM(source.sinksource, destination.sinksource); @@ -221,60 +221,84 @@ void CAmConvertCAPI2AM(const am_gen::am_EarlyData_s & source, am::am_EarlyData_s } -void CAmConvertCAPI2AM(const am_gen::am_Availability_s & source, am_Availability_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_Availability_s & source, am_Availability_s & destination) { destination.availability = static_cast(source.availability); destination.availabilityReason = static_cast(source.availabilityReason); } -void CAmConvertAM2CAPI(const am_Availability_s & source, am_gen::am_Availability_s & destination) +void CAmConvertCAPI2AM(const org::genivi::am::am_Handle_s& source, am_Handle_s& destination) +{ + destination.handle = static_cast(source.handle); + destination.handleType = static_cast(source.handleType); +} + +void CAmConvertAM2CAPI(const am_Availability_s & source, org::genivi::am::am_Availability_s & destination) { - destination.availability = static_cast(source.availability); - destination.availabilityReason = static_cast(source.availabilityReason); + destination.availability = static_cast(source.availability); + destination.availabilityReason = static_cast(source.availabilityReason); } -void CAmConvertAM2CAPI(const am::am_SoundProperty_s & source, am_gen::am_SoundProperty_s & destination) +void CAmConvertAM2CAPI(const am::am_SoundProperty_s & source, org::genivi::am::am_SoundProperty_s & destination) { - destination.type = static_cast(source.type); + destination.type = static_cast(source.type); destination.value = source.value; } -void CAmConvertAM2CAPI(const am::am_NotificationConfiguration_s & source, am_gen::am_NotificationConfiguration_s & destination) +extern void CAmConvertAM2CAPI(const am::am_Handle_s& source, + org::genivi::am::am_Handle_s& destination) +{ + destination.handle = static_cast(source.handle); + destination.handleType = static_cast(source.handleType); +} + + +void CAmConvertAM2CAPI(const am::am_NotificationConfiguration_s & source, org::genivi::am::am_NotificationConfiguration_s & destination) { - destination.type = static_cast(source.type); - destination.status = static_cast(source.status); + destination.type = static_cast(source.type); + destination.status = static_cast(source.status); destination.parameter = source.parameter; } -void CAmConvertAM2CAPI(const am::am_Volumes_s & source, am_gen::am_Volumes_s & destination) +void CAmConvertAM2CAPI(const am::am_Volumes_s & source, org::genivi::am::am_Volumes_s & destination) { if(source.volumeType == VT_SINK) - destination.volumeID = am_gen::am_DataType_u(static_cast(source.volumeID.sink)); + destination.volumeID = org::genivi::am::am_DataType_u(static_cast(source.volumeID.sink)); else if(source.volumeType == VT_SOURCE) - destination.volumeID = am_gen::am_DataType_u(static_cast(source.volumeID.source)); - destination.volumeType = static_cast(source.volumeType); - destination.volume = static_cast(source.volume); - destination.ramp = static_cast(source.ramp); - destination.time = static_cast(source.time); + destination.volumeID = org::genivi::am::am_DataType_u(static_cast(source.volumeID.source)); + destination.volumeType = static_cast(source.volumeType); + destination.volume = static_cast(source.volume); + destination.ramp = static_cast(source.ramp); + destination.time = static_cast(source.time); } - -void CAmConvertAMVector2CAPI(const std::vector & source, std::vector & destination) +void CAmConvertAMVector2CAPI(const std::vector & source, org::genivi::am::am_Volumes_L & destination) { destination.clear(); - for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); iter++) + for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); ++iter) { - am_gen::am_Volumes_s volume; + org::genivi::am::am_Volumes_s volume; CAmConvertAM2CAPI(*iter, volume); destination.push_back(volume); } } -void CAmConvertAMVector2CAPI(const std::vector & source, std::vector & destination) +void CAmConvertCAPIVector2AM(const org::genivi::am::am_EarlyData_L& source,std::vector& destination) +{ + destination.clear(); + for (org::genivi::am::am_EarlyData_L::const_iterator iter = source.begin(); iter!=source.end(); ++iter) + { + am_EarlyData_s earlyData; + CAmConvertCAPI2AM(*iter,earlyData); + destination.push_back(earlyData); + } +} + +void CAmConvertAMVector2CAPI(const std::vector & source, std::vector & destination) { - am_gen::am_SoundProperty_s soundProp; + org::genivi::am::am_SoundProperty_s soundProp; destination.clear(); - for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); iter++) + for(std::vector::const_iterator iter = source.begin(); iter!=source.end(); ++iter) { CAmConvertAM2CAPI(*iter, soundProp); destination.push_back(soundProp); diff --git a/PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp b/PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp index c50cfed..4b2f369 100644 --- a/PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp +++ b/PluginRoutingInterfaceCAPI/src/CAmRoutingService.cpp @@ -39,131 +39,118 @@ CAmRoutingService::~CAmRoutingService() { // TODO Auto-generated destructor stub } -void CAmRoutingService::ackConnect(uint16_t handle, am_gen::am_connectionID_t connectionID, uint16_t error) { +void CAmRoutingService::ackConnect(org::genivi::am::am_Handle_s handle, org::genivi::am::am_connectionID_t connectionID, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_CONNECT; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackConnect(handle_s, static_cast(connectionID), static_cast(error)); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackDisconnect(uint16_t handle, am_gen::am_connectionID_t connectionID, uint16_t error) { +void CAmRoutingService::ackDisconnect(org::genivi::am::am_Handle_s handle , org::genivi::am::am_connectionID_t connectionID, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_DISCONNECT; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackDisconnect(handle_s, static_cast(connectionID), static_cast(error)); - mpLookpData->removeHandle(handle); - //todo: Check whether the connection should be removed here! + mpLookpData->removeHandle(handle_s); mpLookpData->removeConnectionLookup(connectionID); } -void CAmRoutingService::ackSetSinkVolume(uint16_t handle, am_gen::am_volume_t volume, uint16_t error) { +void CAmRoutingService::ackSetSinkVolumeChange(org::genivi::am::am_Handle_s handle , org::genivi::am::am_volume_t volume, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSINKVOLUME; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSetSinkVolumeChange(handle_s, volume, static_cast(error)); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSetSourceVolume(uint16_t handle, am_gen::am_volume_t volume, uint16_t error) { +void CAmRoutingService::ackSetSourceVolumeChange(org::genivi::am::am_Handle_s handle, org::genivi::am::am_volume_t volume, org::genivi::am::am_Error_e error){ assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSOURCEVOLUME; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSetSourceVolumeChange(handle_s, volume, static_cast(error)); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSetSourceState(uint16_t handle, uint16_t error) { +void CAmRoutingService::ackSetSourceState(org::genivi::am::am_Handle_s handle, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSOURCESTATE; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSetSourceState(handle_s,static_cast(error)); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSetSinkSoundProperties(uint16_t handle, uint16_t error) { +void CAmRoutingService::ackSetSinkSoundProperties(org::genivi::am::am_Handle_s handle, org::genivi::am::am_Error_e error){ assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSINKSOUNDPROPERTIES; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSetSinkSoundProperties(handle_s, static_cast(error)); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSetSinkSoundProperty(uint16_t handle, uint16_t error) { +void CAmRoutingService::ackSetSinkSoundProperty(org::genivi::am::am_Handle_s handle, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSINKSOUNDPROPERTY; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSetSinkSoundProperty(handle_s, static_cast(error)); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSetSourceSoundProperties(uint16_t handle, uint16_t error) { +void CAmRoutingService::ackSetSourceSoundProperties(org::genivi::am::am_Handle_s handle, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSOURCESOUNDPROPERTIES; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSetSourceSoundProperties(handle_s, static_cast(error)); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSetSourceSoundProperty(uint16_t handle, uint16_t error) { +void CAmRoutingService::ackSetSourceSoundProperty(org::genivi::am::am_Handle_s handle, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSOURCESOUNDPROPERTY; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSetSourceSoundProperty(handle_s, static_cast(error)); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackCrossFading(uint16_t handle, am_gen::am_HotSink_e hotSink, am_gen::am_Error_e returnError) { +void CAmRoutingService::ackCrossFading(org::genivi::am::am_Handle_s handle, org::genivi::am::am_HotSink_e hotSink, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_CROSSFADE; - mpIAmRoutingReceive->ackCrossFading(handle_s, static_cast(hotSink), static_cast(returnError)); - mpLookpData->removeHandle(handle); + CAmConvertCAPI2AM(handle,handle_s); + mpIAmRoutingReceive->ackCrossFading(handle_s, static_cast(hotSink), static_cast(error)); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSourceVolumeTick(uint16_t handle, am_gen::am_sourceID_t source, am_gen::am_volume_t volume) { +void CAmRoutingService::ackSourceVolumeTick(org::genivi::am::am_Handle_s handle, org::genivi::am::am_sourceID_t source, org::genivi::am::am_volume_t volume) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSOURCEVOLUME; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSourceVolumeTick(handle_s, source, volume); } -void CAmRoutingService::ackSinkVolumeTick(uint16_t handle, am_gen::am_sinkID_t sink, am_gen::am_volume_t volume) { +void CAmRoutingService::ackSinkVolumeTick(org::genivi::am::am_Handle_s handle, org::genivi::am::am_sinkID_t sink, org::genivi::am::am_volume_t volume) { assert(mpIAmRoutingReceive); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETSINKVOLUME; + CAmConvertCAPI2AM(handle,handle_s); mpIAmRoutingReceive->ackSinkVolumeTick(handle_s, sink, volume); } -void CAmRoutingService::peekDomain(std::string name, am_gen::am_domainID_t& domainID, am_gen::am_Error_e& error) { +void CAmRoutingService::peekDomain(std::string name, org::genivi::am::am_domainID_t& domainID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); - error = static_cast(mpIAmRoutingReceive->peekDomain(name, domainID)); + error = static_cast(mpIAmRoutingReceive->peekDomain(name, domainID)); } -void CAmRoutingService::registerDomain(am_gen::am_Domain_s domainData, std::string returnBusname, std::string, std::string returnInterface, am_gen::am_domainID_t& domainID, am_gen::am_Error_e& error) { +void CAmRoutingService::registerDomain(org::genivi::am::am_Domain_s domainData, std::string returnBusname, std::string, std::string returnInterface, org::genivi::am::am_domainID_t& domainID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); assert(mpLookpData); assert(mpCAmCAPIWrapper); @@ -171,182 +158,150 @@ void CAmRoutingService::registerDomain(am_gen::am_Domain_s domainData, std::stri CAmConvertCAPI2AM(domainData, converted); converted.busname = CAmLookupData::BUS_NAME; am_Error_e resultCode = mpIAmRoutingReceive->registerDomain(converted, domainID); - error = static_cast(resultCode); + error = static_cast(resultCode); if(E_OK==resultCode) { std::shared_ptr factory = mpCAmCAPIWrapper->factory(); - std::shared_ptr> shpSenderProxy = factory->buildProxy(returnBusname, returnInterface , "local"); + std::shared_ptr> shpSenderProxy = factory->buildProxy(returnBusname, returnInterface , "local"); mpLookpData->addDomainLookup(domainID, shpSenderProxy); } } -void CAmRoutingService::deregisterDomain(am_gen::am_domainID_t domainID, am_gen::am_Error_e& returnError) { +void CAmRoutingService::deregisterDomain(org::genivi::am::am_domainID_t domainID, org::genivi::am::am_Error_e& returnError) { assert(mpIAmRoutingReceive); assert(mpLookpData); - returnError = static_cast(mpIAmRoutingReceive->deregisterDomain(domainID)); - if(am_gen::am_Error_e::E_OK==returnError) + returnError = static_cast(mpIAmRoutingReceive->deregisterDomain(domainID)); + if(org::genivi::am::am_Error_e::E_OK==returnError) mpLookpData->removeDomainLookup(domainID); } -void CAmRoutingService::registerGateway(am_gen::am_Gateway_s gatewayData, am_gen::am_gatewayID_t& gatewayID, am_gen::am_Error_e& error) { +void CAmRoutingService::registerGateway(org::genivi::am::am_Gateway_s gatewayData, org::genivi::am::am_gatewayID_t& gatewayID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); am_Gateway_s converted; CAmConvertCAPI2AM(gatewayData, converted); - error = static_cast(mpIAmRoutingReceive->registerGateway(converted, gatewayID)); + error = static_cast(mpIAmRoutingReceive->registerGateway(converted, gatewayID)); } -void CAmRoutingService::deregisterGateway(am_gen::am_gatewayID_t gatewayID, am_gen::am_Error_e& returnError) { - returnError = static_cast(mpIAmRoutingReceive->deregisterGateway(gatewayID)); +void CAmRoutingService::deregisterGateway(org::genivi::am::am_gatewayID_t gatewayID, org::genivi::am::am_Error_e& returnError) { + returnError = static_cast(mpIAmRoutingReceive->deregisterGateway(gatewayID)); } -void CAmRoutingService::peekSink(std::string name, am_gen::am_sinkID_t& sinkID, am_gen::am_Error_e& error) { +void CAmRoutingService::peekSink(std::string name, org::genivi::am::am_sinkID_t& sinkID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); - error = static_cast(mpIAmRoutingReceive->peekSink(name, sinkID)); + error = static_cast(mpIAmRoutingReceive->peekSink(name, sinkID)); } -void CAmRoutingService::registerSink(am_gen::sinkData_s sinkData, am_gen::am_sinkID_t& sinkID, am_gen::am_Error_e& error) { +void CAmRoutingService::registerSink(org::genivi::am::am_Sink_s sinkData, org::genivi::am::am_sinkID_t& sinkID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Sink_s converted; CAmConvertCAPI2AM(sinkData, converted); am_Error_e result = mpIAmRoutingReceive->registerSink(converted, sinkID); - error = static_cast(result); + error = static_cast(result); if(E_OK==result) mpLookpData->addSinkLookup(sinkID, converted.domainID); } -void CAmRoutingService::deregisterSink(am_gen::am_sinkID_t sinkID, am_gen::am_Error_e& returnError) { +void CAmRoutingService::deregisterSink(org::genivi::am::am_sinkID_t sinkID, org::genivi::am::am_Error_e& returnError) { assert(mpIAmRoutingReceive); assert(mpLookpData); - returnError = static_cast(mpIAmRoutingReceive->deregisterSink(sinkID)); - if(returnError==am_gen::am_Error_e::E_OK) + returnError = static_cast(mpIAmRoutingReceive->deregisterSink(sinkID)); + if(returnError==org::genivi::am::am_Error_e::E_OK) mpLookpData->removeSinkLookup(sinkID); } -void CAmRoutingService::peekSource(std::string name, am_gen::am_sourceID_t& sourceID, am_gen::am_Error_e& error) { +void CAmRoutingService::peekSource(std::string name, org::genivi::am::am_sourceID_t& sourceID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); - error = static_cast(mpIAmRoutingReceive->peekSource(name, sourceID)); + error = static_cast(mpIAmRoutingReceive->peekSource(name, sourceID)); } -void CAmRoutingService::registerSource(am_gen::sourceData_s sourceData, am_gen::am_sourceID_t& sourceID, am_gen::am_Error_e& error) { +void CAmRoutingService::registerSource(org::genivi::am::am_Source_s sourceData, org::genivi::am::am_sourceID_t& sourceID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); assert(mpLookpData); am_Source_s converted; CAmConvertCAPI2AM(sourceData, converted); - error = static_cast(mpIAmRoutingReceive->registerSource(converted, sourceID)); - if(error==am_gen::am_Error_e::E_OK) + error = static_cast(mpIAmRoutingReceive->registerSource(converted, sourceID)); + if(error==org::genivi::am::am_Error_e::E_OK) mpLookpData->addSourceLookup(sourceID, sourceData.domainID); } -void CAmRoutingService::deregisterSource(am_gen::am_sourceID_t sourceID, am_gen::am_Error_e& returnError) { +void CAmRoutingService::deregisterSource(org::genivi::am::am_sourceID_t sourceID, org::genivi::am::am_Error_e& returnError) { assert(mpIAmRoutingReceive); assert(mpLookpData); - returnError = static_cast(mpIAmRoutingReceive->deregisterSource(sourceID)); - if(returnError==am_gen::am_Error_e::E_OK) + returnError = static_cast(mpIAmRoutingReceive->deregisterSource(sourceID)); + if(returnError==org::genivi::am::am_Error_e::E_OK) mpLookpData->removeSourceLookup(sourceID); } -void CAmRoutingService::registerCrossfader(am_gen::crossfaderData_s crossfaderData, am_gen::am_crossfaderID_t& crossfaderID, am_gen::am_Error_e& error) { +void CAmRoutingService::registerCrossfader(org::genivi::am::am_Crossfader_s crossfaderData, org::genivi::am::am_crossfaderID_t& crossfaderID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); am_Crossfader_s converted; CAmConvertCAPI2AM(crossfaderData, converted); - error = static_cast(mpIAmRoutingReceive->registerCrossfader(converted, crossfaderID)); - if(error==am_gen::am_Error_e::E_OK) + error = static_cast(mpIAmRoutingReceive->registerCrossfader(converted, crossfaderID)); + if(error==org::genivi::am::am_Error_e::E_OK) mpLookpData->addCrossfaderLookup(crossfaderID, crossfaderData.sourceID); } -void CAmRoutingService::deregisterCrossfader(am_gen::am_crossfaderID_t crossfaderID, am_gen::am_Error_e& returnError) { +void CAmRoutingService::deregisterCrossfader(org::genivi::am::am_crossfaderID_t crossfaderID, org::genivi::am::am_Error_e& returnError) { assert(mpIAmRoutingReceive); - returnError = static_cast(mpIAmRoutingReceive->deregisterCrossfader(crossfaderID)); - if(returnError==am_gen::am_Error_e::E_OK) + returnError = static_cast(mpIAmRoutingReceive->deregisterCrossfader(crossfaderID)); + if(returnError==org::genivi::am::am_Error_e::E_OK) mpLookpData->removeCrossfaderLookup(crossfaderID); } -void CAmRoutingService::peekSourceClassID(std::string name, am_gen::am_sourceClass_t& sourceClassID, am_gen::am_Error_e& error) { - error = static_cast(mpIAmRoutingReceive->peekSourceClassID(name, sourceClassID)); +void CAmRoutingService::peekSourceClassID(std::string name, org::genivi::am::am_sourceClass_t& sourceClassID, org::genivi::am::am_Error_e& error) { + error = static_cast(mpIAmRoutingReceive->peekSourceClassID(name, sourceClassID)); } -void CAmRoutingService::peekSinkClassID(std::string name, am_gen::am_sinkClass_t& sinkClassID, am_gen::am_Error_e& error) { +void CAmRoutingService::peekSinkClassID(std::string name, org::genivi::am::am_sinkClass_t& sinkClassID, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); - error = static_cast(mpIAmRoutingReceive->peekSinkClassID(name, sinkClassID)); + error = static_cast(mpIAmRoutingReceive->peekSinkClassID(name, sinkClassID)); } -void CAmRoutingService::hookInterruptStatusChange(am_gen::am_sourceID_t sourceID, uint16_t interruptState) { +void CAmRoutingService::hookInterruptStatusChange(org::genivi::am::am_sourceID_t sourceID, org::genivi::am::am_InterruptState_e InterruptState) { assert(mpIAmRoutingReceive); - mpIAmRoutingReceive->hookInterruptStatusChange(sourceID, static_cast(interruptState)); + mpIAmRoutingReceive->hookInterruptStatusChange(sourceID, static_cast(InterruptState)); } -void CAmRoutingService::hookDomainRegistrationComplete(am_gen::am_domainID_t domainID) { +void CAmRoutingService::hookDomainRegistrationComplete(org::genivi::am::am_domainID_t domainID) { assert(mpIAmRoutingReceive != NULL); mpIAmRoutingReceive->hookDomainRegistrationComplete(domainID); } -void CAmRoutingService::hookSinkAvailablityStatusChange(am_gen::am_sinkID_t sinkID, am_gen::am_Availability_s availability) { +void CAmRoutingService::hookSinkAvailablityStatusChange(org::genivi::am::am_sinkID_t sinkID, org::genivi::am::am_Availability_s availability) { assert(mpIAmRoutingReceive); am_Availability_s am_avialabilty; CAmConvertCAPI2AM(availability, am_avialabilty); mpIAmRoutingReceive->hookSinkAvailablityStatusChange(sinkID, am_avialabilty); } -void CAmRoutingService::hookSourceAvailablityStatusChange(am_gen::am_sourceID_t sourceID, am_gen::am_Availability_s availability) { +void CAmRoutingService::hookSourceAvailablityStatusChange(org::genivi::am::am_sourceID_t sourceID, org::genivi::am::am_Availability_s availability) { assert(mpIAmRoutingReceive); am_Availability_s am_availabilty; CAmConvertCAPI2AM(availability, am_availabilty); mpIAmRoutingReceive->hookSourceAvailablityStatusChange(sourceID, am_availabilty); } -void CAmRoutingService::hookDomainStateChange(am_gen::am_domainID_t domainID, am_gen::am_DomainState_e domainState) { +void CAmRoutingService::hookDomainStateChange(org::genivi::am::am_domainID_t domainID, org::genivi::am::am_DomainState_e domainState) { assert(mpIAmRoutingReceive); am_DomainState_e am_domainState = static_cast(domainState); mpIAmRoutingReceive->hookDomainStateChange(domainID, am_domainState); } -void CAmRoutingService::hookTimingInformationChanged(am_gen::am_connectionID_t connectionID, int16_t delay) { +void CAmRoutingService::hookTimingInformationChanged(org::genivi::am::am_connectionID_t connectionID, int16_t delay) { assert(mpIAmRoutingReceive); mpIAmRoutingReceive->hookTimingInformationChanged(connectionID, delay); } -void CAmRoutingService::sendChangedData(am_gen::am_EarlyData_l earlyData_volumes, am_gen::am_EarlyData_l earlyData_soundproperties) { +void CAmRoutingService::sendChangedData(org::genivi::am::am_EarlyData_L earlyData) { assert(mpIAmRoutingReceive); - std::vector earlyData; - auto func = [&](const am_gen::am_EarlyData_s &refObject) - { - am_EarlyData_s object; - CAmConvertCAPI2AM(refObject, object); - earlyData.push_back(object); - }; - std::for_each(earlyData_volumes.begin(), earlyData_volumes.end(), func); - std::for_each(earlyData_soundproperties.begin(), earlyData_soundproperties.end(), func); - mpIAmRoutingReceive->sendChangedData(earlyData); -} - -void CAmRoutingService::gotReady(int16_t numberDomains, uint16_t handle) -{ - mReady=true; - mNumberDomains=numberDomains; - mHandle=handle; -} - -void CAmRoutingService::gotRundown(int16_t numberDomains, uint16_t handle) -{ - mReady=false; - mNumberDomains=numberDomains; - mHandle=handle; -} - -void CAmRoutingService::confirmRoutingReady(am_gen::am_domainID_t) { - mpIAmRoutingReceive->confirmRoutingReady(mHandle, E_OK); - mNumberDomains++; -} - -void CAmRoutingService::confirmRoutingRundown(am_gen::am_domainID_t) { - assert(mpIAmRoutingReceive); - mpIAmRoutingReceive->confirmRoutingRundown(mHandle, E_OK); - mNumberDomains--; + std::vector dest; + CAmConvertCAPIVector2AM(earlyData,dest); + mpIAmRoutingReceive->sendChangedData(dest); } -void CAmRoutingService::updateGateway(am_gen::am_gatewayID_t gatewayID, am_gen::am_ConnectionFormat_L listSourceFormats, am_gen::am_ConnectionFormat_L listSinkFormats, am_gen::bool_L convertionMatrix) { +void CAmRoutingService::updateGateway(org::genivi::am::am_gatewayID_t gatewayID, org::genivi::am::am_ConnectionFormat_L listSourceFormats, org::genivi::am::am_ConnectionFormat_L listSinkFormats, org::genivi::am::am_Convertion_L convertionMatrix, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); std::vector destinationSourceConnectionFormats; @@ -358,7 +313,7 @@ void CAmRoutingService::updateGateway(am_gen::am_gatewayID_t gatewayID, am_gen:: mpIAmRoutingReceive->updateGateway(gatewayID, destinationSourceConnectionFormats, destinationSinkConnectionFormats, convertionMatrix); } -void CAmRoutingService::updateSink(am_gen::am_sinkID_t sinkID, am_gen::am_sinkClass_t sinkClassID, am_gen::am_SoundProperty_L listSoundProperties, am_gen::am_ConnectionFormat_L listConnectionFormats, am_gen::am_MainSoundProperty_L listMainSoundProperties) { +void CAmRoutingService::updateSink(org::genivi::am::am_sinkID_t sinkID, org::genivi::am::am_sinkClass_t sinkClassID, org::genivi::am::am_SoundProperty_L listSoundProperties, org::genivi::am::am_ConnectionFormat_L listConnectionFormats, org::genivi::am::am_MainSoundProperty_L listMainSoundProperties, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); std::vector dstListSoundProperties; CAmConvertCAPIVector2AM(listSoundProperties, dstListSoundProperties); @@ -369,7 +324,7 @@ void CAmRoutingService::updateSink(am_gen::am_sinkID_t sinkID, am_gen::am_sinkCl mpIAmRoutingReceive->updateSink( sinkID, sinkClassID, dstListSoundProperties,dstListSinkConnectionFormats,dstListMainSoundProperties); } -void CAmRoutingService::updateSource(am_gen::am_sourceID_t sourceID, am_gen::am_sourceClass_t sourceClassID, am_gen::am_SoundProperty_L listSoundProperties, am_gen::am_ConnectionFormat_L listConnectionFormats, am_gen::am_MainSoundProperty_L listMainSoundProperties) { +void CAmRoutingService::updateSource(org::genivi::am::am_sourceID_t sourceID, org::genivi::am::am_sourceClass_t sourceClassID, org::genivi::am::am_SoundProperty_L listSoundProperties, org::genivi::am::am_ConnectionFormat_L listConnectionFormats, org::genivi::am::am_MainSoundProperty_L listMainSoundProperties, org::genivi::am::am_Error_e& error) { assert(mpIAmRoutingReceive); std::vector dstListSoundProperties; CAmConvertCAPIVector2AM(listSoundProperties, dstListSoundProperties); @@ -380,56 +335,63 @@ void CAmRoutingService::updateSource(am_gen::am_sourceID_t sourceID, am_gen::am_ mpIAmRoutingReceive->updateSource( sourceID, sourceClassID, dstListSoundProperties,dstListSinkConnectionFormats,dstListMainSoundProperties); } -void CAmRoutingService::ackSetVolumes(uint16_t handle, am_gen::am_Volumes_l listVolumes, uint16_t error) { +void CAmRoutingService::ackSetVolumes(org::genivi::am::am_Handle_s handle , org::genivi::am::am_Volumes_L listVolumes, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); am_Handle_s handle_s; - handle_s.handle = handle; - handle_s.handleType = H_SETVOLUMES; + CAmConvertCAPI2AM(handle,handle_s); std::vector list; CAmConvertCAPIVector2AM(listVolumes, list); am_Error_e amError = static_cast(error); mpIAmRoutingReceive->ackSetVolumes(handle_s, list, amError); - mpLookpData->removeHandle(handle); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSinkNotificationConfiguration(uint16_t handle, uint16_t error) { +void CAmRoutingService::ackSinkNotificationConfiguration (org::genivi::am::am_Handle_s handle, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); - am_Handle_s myhandle; - myhandle.handleType = H_CONNECT; - myhandle.handle = handle; + am_Handle_s handle_s; + CAmConvertCAPI2AM(handle,handle_s); am_Error_e amError = static_cast(error); - mpIAmRoutingReceive->ackSinkNotificationConfiguration(myhandle, amError); - mpLookpData->removeHandle(handle); + mpIAmRoutingReceive->ackSinkNotificationConfiguration(handle_s, amError); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::ackSourceNotificationConfiguration(uint16_t handle, uint16_t error) { +void CAmRoutingService::ackSourceNotificationConfiguration(org::genivi::am::am_Handle_s handle, org::genivi::am::am_Error_e error) { assert(mpIAmRoutingReceive); assert(mpLookpData); - am_Handle_s myhandle; - myhandle.handleType = H_CONNECT; - myhandle.handle = handle; + am_Handle_s handle_s; + CAmConvertCAPI2AM(handle,handle_s); am_Error_e amError = static_cast(error); - mpIAmRoutingReceive->ackSourceNotificationConfiguration(myhandle, amError); - mpLookpData->removeHandle(handle); + mpIAmRoutingReceive->ackSourceNotificationConfiguration(handle_s, amError); + mpLookpData->removeHandle(handle_s); } -void CAmRoutingService::hookSinkNotificationDataChange(am_gen::am_sinkID_t sinkID, am_gen::notificationPayload_s payload) { +void CAmRoutingService::hookSinkNotificationDataChange(org::genivi::am::am_sinkID_t sinkID, org::genivi::am::am_NotificationPayload_s payload) { assert(mpIAmRoutingReceive); am_NotificationPayload_s converted; CAmConvertCAPI2AM(payload, converted); mpIAmRoutingReceive->hookSinkNotificationDataChange(sinkID, converted); } -void CAmRoutingService::hookSourceNotificationDataChange(am_gen::am_sourceID_t sourceID, am_gen::notificationPayload_s payload) { +void CAmRoutingService::hookSourceNotificationDataChange(org::genivi::am::am_sourceID_t sourceID, org::genivi::am::am_NotificationPayload_s payload) { assert(mpIAmRoutingReceive); am_NotificationPayload_s converted; CAmConvertCAPI2AM(payload, converted); mpIAmRoutingReceive->hookSourceNotificationDataChange(sourceID, converted); } -void CAmRoutingService::getRoutingReadyState(bool& readyState) { - readyState = mReady; +void CAmRoutingService::confirmRoutingRundown(std::string domainName) +{ + mNumberDomains--; + if (mNumberDomains==0) + mpIAmRoutingReceive->confirmRoutingRundown(mHandle,E_OK); +} + +void CAmRoutingService::gotRundown(int16_t numberDomains, uint16_t handle) +{ + mReady=false; + mNumberDomains=numberDomains; + mHandle=handle; } } /* namespace am */ -- cgit v1.2.1