diff options
Diffstat (limited to 'PluginRoutingInterfaceCAPI/include')
5 files changed, 520 insertions, 0 deletions
diff --git a/PluginRoutingInterfaceCAPI/include/CAmLookupData.h b/PluginRoutingInterfaceCAPI/include/CAmLookupData.h new file mode 100644 index 0000000..c3bf93c --- /dev/null +++ b/PluginRoutingInterfaceCAPI/include/CAmLookupData.h @@ -0,0 +1,204 @@ +/** + * Copyright (c) 2012 BMW + * + * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013 + * + * \copyright + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * For further information see http://www.genivi.org/. + */ + +#ifndef CAMLOOKUPDATA_H_ +#define CAMLOOKUPDATA_H_ + +#include <map> +#include <iostream> +#include <cassert> +#include <memory> +#include <CommonAPI/CommonAPI.h> +#include "audiomanagertypes.h" +#include <org/genivi/audiomanager/RoutingSenderProxy.h> + +#ifdef UNIT_TEST +#include "../test/IAmRoutingSenderBackdoor.h" //we need this for the unit test +#endif + +namespace am { + +using namespace CommonAPI; +using namespace org::genivi::audiomanager; + +/** A structure holding info for given domain. + * For every domain a single instance is created which is used by the lookup methods. + */ + +struct rs_lookupData_s +{ +private: + bool mIsConnected; //!< bool indicating whether the domain is reachable or not + std::shared_ptr<RoutingSenderProxy<>> mSenderProxy; //!< a pointer to the proxy object, which implements the connection out from AudioManager + CommonAPI::ProxyStatusEvent::Subscription mSubscription; //!< subscription for the proxy system events + void onServiceStatusEvent(const CommonAPI::AvailabilityStatus& serviceStatus); //!< proxy status event callback +public: + rs_lookupData_s(const std::shared_ptr<RoutingSenderProxy<> > & aProxy); + ~rs_lookupData_s(); + + /** + * returns the proxy object. + */ + std::shared_ptr<RoutingSenderProxy<>> & getProxy(); + /** + * returns whether the proxy object is connected or not. + */ + bool isConnected(); + /** + * proxy wrapping methods. + */ + am_Error_e asyncAbort(const uint16_t handle, RoutingSenderProxyBase::AsyncAbortAsyncCallback); + am_Error_e asyncConnect(const uint16_t handle, const am_connectionID_t, const am_sourceID_t, const am_sinkID_t, const am_ConnectionFormat_e, RoutingSenderProxyBase::AsyncConnectAsyncCallback); + am_Error_e asyncDisconnect(const uint16_t handle, const am_connectionID_t, RoutingSenderProxyBase::AsyncDisconnectAsyncCallback); + am_Error_e asyncSetSinkVolume(const uint16_t handle, const am_sinkID_t, const am_volume_t, const am_RampType_e, const am_time_t, RoutingSenderProxyBase::AsyncSetSinkVolumeAsyncCallback); + am_Error_e asyncSetSourceVolume(const uint16_t handle, const am_sourceID_t , const am_volume_t, const am_RampType_e, const am_time_t, RoutingSenderProxyBase::AsyncSetSourceVolumeAsyncCallback); + am_Error_e asyncSetSourceState(const uint16_t handle, const am_sourceID_t, const am_SourceState_e, RoutingSenderProxyBase::AsyncSetSourceStateAsyncCallback); + am_Error_e asyncSetSinkSoundProperties(const uint16_t handle, const am_sinkID_t, const std::vector<am_SoundProperty_s>&, RoutingSenderProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback); + am_Error_e asyncSetSinkSoundProperty(const uint16_t handle, const am_sinkID_t, const am_SoundProperty_s&, RoutingSenderProxyBase::AsyncSetSinkSoundPropertyAsyncCallback); + am_Error_e asyncSetSourceSoundProperties(const uint16_t handle, const am_sourceID_t, const std::vector<am_SoundProperty_s>&, RoutingSenderProxyBase::AsyncSetSourceSoundPropertiesAsyncCallback); + am_Error_e asyncSetSourceSoundProperty(const uint16_t handle, const am_sourceID_t, const am_SoundProperty_s&, RoutingSenderProxyBase::AsyncSetSourceSoundPropertyAsyncCallback); + am_Error_e asyncCrossFade(const uint16_t handle, const am_crossfaderID_t, const am_HotSink_e, const am_RampType_e, const am_time_t, RoutingSenderProxyBase::AsyncCrossFadeAsyncCallback); + am_Error_e setDomainState(const am_domainID_t, const am_DomainState_e, RoutingSenderProxyBase::SetDomainStateAsyncCallback); + am_Error_e asyncSetVolumes(const uint16_t handle, const std::vector<am_Volumes_s>&, RoutingSenderProxyBase::AsyncSetVolumesAsyncCallback); + am_Error_e asyncSetSinkNotificationConfiguration(const uint16_t handle, const am_sinkID_t, const am_NotificationConfiguration_s&, RoutingSenderProxyBase::AsyncSetSinkNotificationConfigurationAsyncCallback); + am_Error_e asyncSetSourceNotificationConfiguration(const uint16_t handle, const am_sourceID_t, const am_NotificationConfiguration_s&, RoutingSenderProxyBase::AsyncSetSourceNotificationConfigurationAsyncCallback); +}; + + +/** + * The class encapsulate the lookup mechanism and forwards the invocations to the appropriate lookup objects ( proxies ). + */ +class CAmLookupData { + + typedef std::shared_ptr<rs_lookupData_s> RSLookupDataPtr; + /** + * Lookup maps. + */ + typedef std::map<am_domainID_t,RSLookupDataPtr> mapDomain_t; + typedef std::map<am_sinkID_t,RSLookupDataPtr> mapSinks_t; + typedef std::map<am_sourceID_t,RSLookupDataPtr> mapSources_t; + typedef std::map<am_connectionID_t,RSLookupDataPtr> mapConnections_t; + typedef std::map<uint16_t,RSLookupDataPtr> mapHandles_t; + typedef std::map<am_crossfaderID_t,RSLookupDataPtr> mapCrossfaders_t; + + mapDomain_t mMapDomains; + mapSinks_t mMapSinks; + mapSources_t mMapSources; + mapConnections_t mMapConnections; + mapHandles_t mMapHandles; + mapCrossfaders_t mMapCrossfaders; + + /** \brief returns the value for given key if exists. + * + * @param key is a search key. + * @param map is a either domain, sink, source, connection, crossfader or handle map. + */ + template <typename TKey> static const RSLookupDataPtr getValueForKey(const TKey & key, const std::map<TKey,RSLookupDataPtr> & map); + + /** \brief removes all entries which contains given value. + * + * @param value is a search value. + * @param map is a either domain, sink, source, connection, crossfader or handle map. + */ + template <typename TKey> static void removeEntriesForValue(const RSLookupDataPtr & value, std::map<TKey,RSLookupDataPtr> & map); + +public: + CAmLookupData(); + virtual ~CAmLookupData(); + /** \brief adds a lookup for given domain. + * + * @param domainID is a valid domain id. + * @param aProxy is a proxy object constructed by registerDomain + */ + void addDomainLookup(am_domainID_t & domainID, + std::shared_ptr<RoutingSenderProxy<>> & aProxy); + + /** \brief removes given handle from the list. + * + */ + void removeHandle(uint16_t handle); + + /** \brief adds a lookup for given source in a given domain. + * + * @param sourceID is a valid source id. + * @param domainID is a valid domain id + */ + void addSourceLookup(am_sourceID_t sourceID, am_domainID_t domainID); + + /** \brief adds a lookup for given sink in a given domain. + * + * @param sinkID is a valid sink id. + * @param domainID is a valid domain id + */ + void addSinkLookup(am_sinkID_t sinkID, am_domainID_t domainID); + + /** \brief adds a lookup for given crossfader in the domain wherein the given source belongs to. + * + * @param crossfaderID is a valid crossfader id. + * @param soucreID is a valid source id + */ + void addCrossfaderLookup(am_crossfaderID_t crossfaderID, am_sourceID_t soucreID); + + /** \brief removes a given domain lookup. + */ + void removeDomainLookup(am_domainID_t domainID); + + /** \brief removes a given source lookup. + */ + void removeSourceLookup(am_sourceID_t sourceID); + + /** \brief removes a given sink lookup. + */ + void removeSinkLookup(am_sinkID_t sinkID); + + /** \brief removes a given crossfader lookup. + */ + void removeCrossfaderLookup(am_crossfaderID_t crossfaderID); + + /** \brief removes a given connection lookup. + */ + void removeConnectionLookup(am_connectionID_t connectionID); + + size_t numberOfDomains() { return mMapDomains.size(); } + + static const char * BUS_NAME; + + /** + * Wrapping methods. + */ + am_Error_e asyncAbort(const uint16_t, RoutingSenderProxyBase::AsyncAbortAsyncCallback); + am_Error_e asyncConnect(const uint16_t , const am_connectionID_t, const am_sourceID_t, const am_sinkID_t, const am_ConnectionFormat_e, RoutingSenderProxyBase::AsyncConnectAsyncCallback); + am_Error_e asyncDisconnect(const uint16_t , const am_connectionID_t, RoutingSenderProxyBase::AsyncDisconnectAsyncCallback); + am_Error_e asyncSetSinkVolume(const uint16_t , const am_sinkID_t, const am_volume_t, const am_RampType_e, const am_time_t, RoutingSenderProxyBase::AsyncSetSinkVolumeAsyncCallback); + am_Error_e asyncSetSourceVolume(const uint16_t , const am_sourceID_t , const am_volume_t, const am_RampType_e, const am_time_t, RoutingSenderProxyBase::AsyncSetSourceVolumeAsyncCallback); + am_Error_e asyncSetSourceState(const uint16_t , const am_sourceID_t, const am_SourceState_e, RoutingSenderProxyBase::AsyncSetSourceStateAsyncCallback); + am_Error_e asyncSetSinkSoundProperties(const uint16_t , const am_sinkID_t, const std::vector<am_SoundProperty_s>&, RoutingSenderProxyBase::AsyncSetSinkSoundPropertiesAsyncCallback); + am_Error_e asyncSetSinkSoundProperty(const uint16_t , const am_sinkID_t, const am_SoundProperty_s&, RoutingSenderProxyBase::AsyncSetSinkSoundPropertyAsyncCallback); + am_Error_e asyncSetSourceSoundProperties(const uint16_t , const am_sourceID_t, const std::vector<am_SoundProperty_s>&, RoutingSenderProxyBase::AsyncSetSourceSoundPropertiesAsyncCallback); + am_Error_e asyncSetSourceSoundProperty(const uint16_t , const am_sourceID_t, const am_SoundProperty_s&, RoutingSenderProxyBase::AsyncSetSourceSoundPropertyAsyncCallback); + am_Error_e asyncCrossFade(const uint16_t , const am_crossfaderID_t, const am_HotSink_e, const am_RampType_e, const am_time_t, RoutingSenderProxyBase::AsyncCrossFadeAsyncCallback); + am_Error_e setDomainState(const am_domainID_t, const am_DomainState_e, RoutingSenderProxyBase::SetDomainStateAsyncCallback); + am_Error_e asyncSetVolumes(const uint16_t , const std::vector<am_Volumes_s>&, RoutingSenderProxyBase::AsyncSetVolumesAsyncCallback); + am_Error_e asyncSetSinkNotificationConfiguration(const uint16_t , const am_sinkID_t, const am_NotificationConfiguration_s&, RoutingSenderProxyBase::AsyncSetSinkNotificationConfigurationAsyncCallback); + am_Error_e asyncSetSourceNotificationConfiguration(const uint16_t , const am_sourceID_t, const am_NotificationConfiguration_s&, RoutingSenderProxyBase::AsyncSetSourceNotificationConfigurationAsyncCallback); +#ifdef UNIT_TEST + friend class IAmRoutingSenderBackdoor; +#endif +}; + +} /* namespace am */ +#endif /* CAMLOOKUPDATA_H_ */ diff --git a/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCAPI.h b/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCAPI.h new file mode 100644 index 0000000..dc7f081 --- /dev/null +++ b/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCAPI.h @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2012 BMW + * + * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013 + * + * \copyright + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * For further information see http://www.genivi.org/. + */ + +#ifndef CAPIROUTINGSENDER_H_ +#define CAPIROUTINGSENDER_H_ + +#include "routing/IAmRoutingSend.h" +#include "shared/CAmCommonAPIWrapper.h" +#include "CAmRoutingService.h" +#include "CAmLookupData.h" + +#ifdef UNIT_TEST +#include "../test/IAmRoutingSenderBackdoor.h" //we need this for the unit test +#endif + +namespace am +{ +using namespace CommonAPI; +using namespace org::genivi::audiomanager; + +#define ROUTING_NODE "routinginterface" + +class CAmRoutingSenderCAPI: public IAmRoutingSend +{ + bool mIsServiceStarted; + bool mReady; ///< bool indicating whether the plugin have got + CAmLookupData mLookupData; ///< an object which implements the lookup mechanism + CAmCommonAPIWrapper *mpCAmCAPIWrapper; ///< pointer to the common-api wrapper + IAmRoutingReceive *mpIAmRoutingReceive; ///< pointer to the routing receive interface + std::shared_ptr<CAmRoutingService> mService; ///< shared pointer to the routing service implementation + CAmRoutingSenderCAPI(); +public: + CAmRoutingSenderCAPI(CAmCommonAPIWrapper *aWrapper) ; + virtual ~CAmRoutingSenderCAPI(); + + /** \brief starts the plugin - registers the routing interface service. + * + * @param pIAmRoutingReceive pointer to the routing receive interface. + */ + am_Error_e startService(IAmRoutingReceive* pIAmRoutingReceive); + + /** \brief interface method which calls startService. + * + * @param pIAmRoutingReceive pointer to the routing receive interface. + */ + am_Error_e startupInterface(IAmRoutingReceive* pIAmRoutingReceive); + + /** \brief stops the service - deregister the routing interface service. + * + * @param pIAmRoutingReceive pointer to the routing receive interface. + */ + am_Error_e tearDownInterface(IAmRoutingReceive*); + + /** \brief sets and annotates the service ready state. + * + */ + void setRoutingReady(const uint16_t handle); + + /** \brief sets and annotates the service rundown state. + * + */ + void setRoutingRundown(const uint16_t handle); + am_Error_e asyncAbort(const am_Handle_s handle); + am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat); + am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID); + am_Error_e asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time); + am_Error_e asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time); + am_Error_e asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state); + am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties); + am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty); + am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties); + am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty); + am_Error_e asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time); + am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState); + am_Error_e returnBusName(std::string& BusName) const; + void getInterfaceVersion(std::string& version) const; + am_Error_e asyncSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listVolumes) ; + am_Error_e asyncSetSinkNotificationConfiguration(const am_Handle_s handle, const am_sinkID_t sinkID, const am_NotificationConfiguration_s& notificationConfiguration) ; + am_Error_e asyncSetSourceNotificationConfiguration(const am_Handle_s handle, const am_sourceID_t sourceID, const am_NotificationConfiguration_s& notificationConfiguration) ; + + static const char * ROUTING_INTERFACE_SERVICE; +#ifdef UNIT_TEST + friend class IAmRoutingSenderBackdoor; +#endif + +}; +} + +#endif /* CAPIROUTINGSENDER_H_ */ diff --git a/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCommon.h b/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCommon.h new file mode 100644 index 0000000..63c9ea8 --- /dev/null +++ b/PluginRoutingInterfaceCAPI/include/CAmRoutingSenderCommon.h @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2012 BMW + * + * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013 + * + * \copyright + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * For further information see http://www.genivi.org/. + */ + +#ifndef CAMROUTINGSENDERCOMMON_H_ +#define CAMROUTINGSENDERCOMMON_H_ + +#include <memory> +#include "audiomanagertypes.h" +#include <org/genivi/audiomanager/am_gen.h> + +using namespace am; +using namespace org::genivi::audiomanager; +using namespace CommonAPI; + +/** + * Utility functions + */ +extern void CAmConvertCAPI2AM(const am_gen::am_Domain_s &, am_Domain_s &); +extern void CAmConvertCAPI2AM(const am_gen::sourceData_s & , am::am_Source_s & ); +extern void CAmConvertCAPI2AM(const am_gen::sinkData_s & , am::am_Sink_s & ); +extern void CAmConvertCAPI2AM(const am_gen::am_Availability_s & , am_Availability_s & ); +extern void CAmConvertCAPI2AM(const am_gen::am_SoundProperty_s &, am::am_SoundProperty_s &); +extern void CAmConvertCAPI2AM(const am_gen::am_MainSoundProperty_s &, am::am_MainSoundProperty_s & ); +extern void CAmConvertCAPI2AM(const am_gen::am_NotificationConfiguration_s & , am::am_NotificationConfiguration_s & ); +extern void CAmConvertCAPI2AM(const am_gen::am_Gateway_s & , am::am_Gateway_s & ); +extern void CAmConvertCAPI2AM(const am_gen::crossfaderData_s & , am::am_Crossfader_s & ); +extern void CAmConvertCAPI2AM(const am_gen::am_EarlyData_s & , am::am_EarlyData_s & ); +extern void CAmConvertCAPI2AM(const am_gen::am_EarlyData_u &, am::am_EarlyData_u & ); +extern void CAmConvertCAPI2AM(const am_gen::am_DataType_u & , am::am_DataType_u & ); +extern void CAmConvertCAPI2AM(const am_gen::am_Volumes_s &, am::am_Volumes_s &); +extern void CAmConvertCAPI2AM(const am_gen::notificationPayload_s & , am::am_NotificationPayload_s & ); +extern void CAmConvertCAPIVector2AM(const std::vector<am_gen::am_NotificationConfiguration_s> & , std::vector<am::am_NotificationConfiguration_s> & ); +extern void CAmConvertCAPIVector2AM(const std::vector<am_gen::am_SoundProperty_s> &, std::vector<am::am_SoundProperty_s> &); +extern void CAmConvertCAPIVector2AM(const std::vector<am_gen::am_ConnectionFormat_e> &, std::vector<am::am_ConnectionFormat_e> & ); +extern void CAmConvertCAPIVector2AM(const std::vector<am_gen::am_MainSoundProperty_s> &, std::vector<am::am_MainSoundProperty_s> & ); +extern void CAmConvertCAPIVector2AM(const std::vector<am_gen::am_Volumes_s> &, std::vector<am::am_Volumes_s> & ); + +extern void CAmConvertAM2CAPI(const am_Availability_s & , am_gen::am_Availability_s & ); +extern void CAmConvertAM2CAPI(const am::am_SoundProperty_s &, am_gen::am_SoundProperty_s &); +extern void CAmConvertAM2CAPI(const am::am_NotificationConfiguration_s &, am_gen::am_NotificationConfiguration_s &); +extern void CAmConvertAM2CAPI(const am::am_Volumes_s &, am_gen::am_Volumes_s &); +extern void CAmConvertAMVector2CAPI(const std::vector<am::am_SoundProperty_s> &, std::vector<am_gen::am_SoundProperty_s> &); +extern void CAmConvertAMVector2CAPI(const std::vector<am::am_Volumes_s> & , std::vector<am_gen::am_Volumes_s> & ); + +#endif /* CAMROUTINGSENDERCOMMON_H_ */ diff --git a/PluginRoutingInterfaceCAPI/include/CAmRoutingService.h b/PluginRoutingInterfaceCAPI/include/CAmRoutingService.h new file mode 100644 index 0000000..d4d1382 --- /dev/null +++ b/PluginRoutingInterfaceCAPI/include/CAmRoutingService.h @@ -0,0 +1,148 @@ +/** + * Copyright (c) 2012 BMW + * + * \author Aleksandar Donchev, aleksander.donchev@partner.bmw.de BMW 2013 + * + * \copyright + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * For further information see http://www.genivi.org/. + */ + +#ifndef CAMROUTINGSERVICE_H_ +#define CAMROUTINGSERVICE_H_ + +#include <org/genivi/audiomanager/RoutingInterfaceStubDefault.h> +#include "../../include/routing/IAmRoutingReceive.h" +#include "CAmLookupData.h" + +namespace am { + +class CAmCommonAPIWrapper; + +using namespace CommonAPI; +using namespace org::genivi::audiomanager; + +/** Routing interface stub implementation. + * This class is the routing interface service for the Audio Manager. + */ +class CAmRoutingService: public RoutingInterfaceStubDefault { + CAmCommonAPIWrapper *mpCAmCAPIWrapper; ///< pointer to common-api wrapper + IAmRoutingReceive* mpIAmRoutingReceive; ///< pointer to the routing receive interface + CAmLookupData* mpLookpData; ///< pointer to the plugin's lookup mechanism implementation + int16_t mNumberDomains; ///< int number of registred domains + uint16_t mHandle; ///< unsigned current handle + bool mReady; ///< bool whether the service is in ready state or not + CAmRoutingService(); +public: + + CAmRoutingService(IAmRoutingReceive *aReceiver, CAmLookupData* aLookpData, CAmCommonAPIWrapper *aCAPIWrapper); + virtual ~CAmRoutingService(); + + + /** Stub overwritten methods. + * + */ + + virtual void ackConnect(uint16_t handle, am_gen::am_connectionID_t connectionID, uint16_t error); + + virtual void ackDisconnect(uint16_t handle, am_gen::am_connectionID_t connectionID, uint16_t error); + + virtual void ackSetSinkVolume(uint16_t handle, am_gen::am_volume_t volume, uint16_t error); + + virtual void ackSetSourceVolume(uint16_t handle, am_gen::am_volume_t volume, uint16_t error); + + virtual void ackSetSourceState(uint16_t handle, uint16_t error); + + virtual void ackSetSinkSoundProperties(uint16_t handle, uint16_t error); + + virtual void ackSetSinkSoundProperty(uint16_t handle, uint16_t error); + + virtual void ackSetSourceSoundProperties(uint16_t handle, uint16_t error); + + virtual void ackSetSourceSoundProperty(uint16_t handle, uint16_t error); + + virtual void ackCrossFading(uint16_t handle, am_gen::am_HotSink_e hotSink, am_gen::am_Error_e returnError); + + virtual void ackSourceVolumeTick(uint16_t handle, am_gen::am_sourceID_t source, am_gen::am_volume_t volume); + + virtual void ackSinkVolumeTick(uint16_t handle, am_gen::am_sinkID_t sink, am_gen::am_volume_t volume); + + virtual void peekDomain(std::string name, am_gen::am_domainID_t& domainID, am_gen::am_Error_e& error); + + virtual void registerDomain(am_gen::am_Domain_s domainData, std::string returnBusname, std::string returnPath, std::string returnInterface, am_gen::am_domainID_t& domainID, am_gen::am_Error_e& error); + + virtual void deregisterDomain(am_gen::am_domainID_t domainID, am_gen::am_Error_e& returnError); + + virtual void registerGateway(am_gen::am_Gateway_s gatewayData, am_gen::am_gatewayID_t& gatewayID, am_gen::am_Error_e& error); + + virtual void deregisterGateway(am_gen::am_gatewayID_t gatewayID, am_gen::am_Error_e& returnError); + + virtual void peekSink(std::string name, am_gen::am_sinkID_t& sinkID, am_gen::am_Error_e& error); + + virtual void registerSink(am_gen::sinkData_s sinkData, am_gen::am_sinkID_t& sinkID, am_gen::am_Error_e& error); + + virtual void deregisterSink(am_gen::am_sinkID_t sinkID, am_gen::am_Error_e& returnError); + + virtual void peekSource(std::string name, am_gen::am_sourceID_t& sourceID, am_gen::am_Error_e& error); + + virtual void registerSource(am_gen::sourceData_s sourceData, am_gen::am_sourceID_t& sourceID, am_gen::am_Error_e& error); + + virtual void deregisterSource(am_gen::am_sourceID_t sourceID, am_gen::am_Error_e& returnError); + + virtual void registerCrossfader(am_gen::crossfaderData_s crossfaderData, am_gen::am_crossfaderID_t& crossfaderID, am_gen::am_Error_e& error); + + virtual void deregisterCrossfader(am_gen::am_crossfaderID_t crossfaderID, am_gen::am_Error_e& returnError); + + virtual void peekSourceClassID(std::string name, am_gen::am_sourceClass_t& sourceClassID, am_gen::am_Error_e& error); + + virtual void peekSinkClassID(std::string name, am_gen::am_sinkClass_t& sinkClassID, am_gen::am_Error_e& error); + + virtual void hookInterruptStatusChange(am_gen::am_sourceID_t sourceID, uint16_t interruptState); + + virtual void hookDomainRegistrationComplete(am_gen::am_domainID_t domainID); + + virtual void hookSinkAvailablityStatusChange(am_gen::am_sinkID_t sinkID, am_gen::am_Availability_s availability); + + virtual void hookSourceAvailablityStatusChange(am_gen::am_sourceID_t sourceID, am_gen::am_Availability_s availability); + + virtual void hookDomainStateChange(am_gen::am_domainID_t domainID, am_gen::am_DomainState_e domainState); + + virtual void hookTimingInformationChanged(am_gen::am_connectionID_t connectionID, int16_t delay); + + virtual void sendChangedData(am_gen::am_EarlyData_l earlyData_volumes, am_gen::am_EarlyData_l earlyData_soundproperties); + + virtual void confirmRoutingReady(am_gen::am_domainID_t domainID); + + virtual void confirmRoutingRundown(am_gen::am_domainID_t domainID); + + virtual void updateGateway(am_gen::am_gatewayID_t gatewayID, am_gen::am_ConnectionFormat_L listSourceFormats, am_gen::am_ConnectionFormat_L listSinkFormats, am_gen::bool_L convertionMatrix); + + virtual void 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); + + virtual void 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); + + virtual void ackSetVolumes(uint16_t handle, am_gen::am_Volumes_l listVolumes, uint16_t error); + + virtual void ackSinkNotificationConfiguration(uint16_t handle, uint16_t error); + + virtual void ackSourceNotificationConfiguration(uint16_t handle, uint16_t error); + + virtual void hookSinkNotificationDataChange(am_gen::am_sinkID_t sinkID, am_gen::notificationPayload_s payload); + + virtual void hookSourceNotificationDataChange(am_gen::am_sourceID_t sourceID, am_gen::notificationPayload_s payload); + + virtual void getRoutingReadyState(bool& readyState); + + void gotReady(int16_t numberDomains, uint16_t handle); + void gotRundown(int16_t numberDomains, uint16_t handle); +}; + +} /* namespace am */ +#endif /* CAMROUTINGSERVICE_H_ */ diff --git a/PluginRoutingInterfaceCAPI/include/configRoutingCAPI.h b/PluginRoutingInterfaceCAPI/include/configRoutingCAPI.h new file mode 100644 index 0000000..214e75e --- /dev/null +++ b/PluginRoutingInterfaceCAPI/include/configRoutingCAPI.h @@ -0,0 +1,6 @@ +#ifndef _ROUTINGDBUS_CONFIG_H +#define _ROUTINGDBUS_CONFIG_H + +/* #undef ROUTING_DBUS_INTROSPECTION_FILE */ + +#endif /* _ROUTINGDBUS_CONFIG_H */ |