From c628fa5304171cd827f56aa475668d99d26ad28a Mon Sep 17 00:00:00 2001 From: Alexandar Donchev Date: Wed, 11 Mar 2015 19:10:54 +0100 Subject: * Sound property lookup enhancement throught caching . Tests for cached sound properties. Signed-off-by: Christian Linke Signed-off-by: Alexandar Donchev > --- include/control/IAmControlReceive.h | 51 +++++++++++++++++++++++++++--- include/shared/CAmSerializer.h | 62 +++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/control/IAmControlReceive.h b/include/control/IAmControlReceive.h index 79c0981..9f7bd4e 100755 --- a/include/control/IAmControlReceive.h +++ b/include/control/IAmControlReceive.h @@ -20,8 +20,8 @@ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. * PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN. */ -#if !defined(EA_770423FB_365F_4c4b_824E_276D1AE06003__INCLUDED_) -#define EA_770423FB_365F_4c4b_824E_276D1AE06003__INCLUDED_ +#if !defined(EA_302355E7_3225_415d_AC7F_F0F7468FCCCF__INCLUDED_) +#define EA_302355E7_3225_415d_AC7F_F0F7468FCCCF__INCLUDED_ #include #include @@ -30,11 +30,11 @@ namespace am { class CAmSocketHandler; } +#include "NodeStateManager.h" #include "audiomanagertypes.h" -#include "NodeStateManager.h" -#define ControlReceiveVersion "3.0" +#define ControlReceiveVersion "3.1" namespace am { /** @@ -652,7 +652,48 @@ public: * @return NsmErrorStatus_Ok in case of success */ virtual NsmErrorStatus_e sendLifecycleRequestCompleteNSM(const uint32_t RequestId, const NsmErrorStatus_e status) =0; + /** + * This function retrieves a list of all sink mainsoundproperties with its values + * @return E_OK when successful, E_DATABASE on error + */ + virtual am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector& listSoundproperties) const =0; + /** + * This function retrieves a list of all source mainsoundproperties with its + * values + * @return E_OK when successful, E_DATABASE on error + */ + virtual am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector& listSoundproperties) const =0; + /** + * This function retrieves a list of all sink soundproperties with its values + * @return E_OK when successful, E_DATABASE on error + */ + virtual am_Error_e getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector& listSoundproperties) const =0; + /** + * This function retrieves a list of all sink soundproperties with its values + * @return E_OK when successful, E_DATABASE on error + */ + virtual am_Error_e getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector& listSoundproperties) const =0; + /** + * This function retrieves the value of a sink Mainsoundproperty. + * @return E_OK when successful, E_DATABASE on error + */ + virtual am_Error_e getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const =0; + /** + * This function retrieves the value of a sink soundproperty. + * @return E_OK when successful, E_DATABASE on error + */ + virtual am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const =0; + /** + * This function retrieves the value of a source Mainsoundproperty. + * @return E_OK when successful, E_DATABASE on error + */ + virtual am_Error_e getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const =0; + /** + * This function retrieves the value of a source soundproperty. + * @return E_OK when successful, E_DATABASE on error + */ + virtual am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const =0; }; } -#endif // !defined(EA_770423FB_365F_4c4b_824E_276D1AE06003__INCLUDED_) +#endif // !defined(EA_302355E7_3225_415d_AC7F_F0F7468FCCCF__INCLUDED_) diff --git a/include/shared/CAmSerializer.h b/include/shared/CAmSerializer.h index ff131d4..7d6cf80 100644 --- a/include/shared/CAmSerializer.h +++ b/include/shared/CAmSerializer.h @@ -744,6 +744,48 @@ private: } }; + /** + * template for synchronous const calls with three arguments + */ + template class CAmSyncThreeArgConstDelegate: public CAmDelegate + { + private: + TClass* mInstance; + TretVal (TClass::*mFunction)(TargCall argument, TargCall1 argument1, TargCall2 argument2) const; + Targ mArgument; + Targ1 mArgument1; + Targ2 mArgument2; + TretVal mRetval; + + public: + CAmSyncThreeArgConstDelegate(TClass* instance, TretVal (TClass::*function)(TargCall argument, TargCall1 argument1, TargCall2 argument2) const, Targ argument, Targ1 argument1, Targ2 argument2) : + mInstance(instance), // + mFunction(function), // + mArgument(argument), // + mArgument1(argument1), // + mArgument2(argument2), // + mRetval() + { + } + ; + + bool call(int* pipe) + { + mRetval = (*mInstance.*mFunction)(mArgument, mArgument1, mArgument2); + write(pipe[1], this, sizeof(this)); + return (false); + } + ; + + TretVal returnResults(Targ& argument, Targ1& argument1, Targ2& argument2) + { + argument = mArgument; + argument1 = mArgument1; + argument2 = mArgument2; + return (mRetval); + } + }; + /** * template for synchronous calls with four arguments */ @@ -1300,6 +1342,26 @@ public: delete p; } + /** + * calls a const function with three arguments synchronously threadsafe. for more see syncCall with one argument + */ + template + void syncCall(TClass1* instance, TretVal (TClass1::*function)(TargCall, TargCall1, TargCall2) const, TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2) + { + CAmSyncThreeArgConstDelegate* p(new CAmSyncThreeArgConstDelegate(instance, function, argument, argument1, argument2)); + send(static_cast(p)); + int numReads; + CAmDelegagePtr ptr; + if ((numReads = read(mReturnPipe[0], &ptr, sizeof(ptr))) == -1) + { + logError("CAmSerializer::receiverCallback could not read pipe!"); + throw std::runtime_error("CAmSerializer Could not read pipe!"); + } + //working with friend class here is not the finest of all programming stiles but it worCAmTwoArgDelegateks... + retVal = p->returnResults(argument, argument1, argument2); + delete p; + } + /** * calls a function with four arguments synchronously threadsafe. for more see syncCall with one argument */ -- cgit v1.2.1