summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAleksandar Donchev <aleksander.donchev@partner.bmw.de>2013-09-02 11:57:28 +0200
committerChristian Linke <Christian.Linke@bmw.de>2013-09-03 17:26:04 +0200
commita2edae5cee4254b933f42399edc0e092abd4f5cf (patch)
treeead58f525b947deed4b8c76ab9c89c80b5056227 /include
parent7aee1baeea1777318932cc49a8eac18f194233cd (diff)
downloadaudiomanager-a2edae5cee4254b933f42399edc0e092abd4f5cf.tar.gz
*PluginCommandInterfaceCAPI, PluginRoutingInterfaceCAPI, NodeStateCommunicatorCAPI with unit tests first version.
Choosing between DBUS and Common-API via cmake. CommonAPI - legacy support for DBus properties (Set 1) Signed-off-by: Christian Linke <christian.linke@bmw.de> (cherry picked from commit ea96ef59e29466667c90b506426e2a5a9cdb82d2)
Diffstat (limited to 'include')
-rw-r--r--[-rwxr-xr-x]include/projecttypes.h93
-rw-r--r--include/shared/CAmCommonAPIWrapper.h142
2 files changed, 213 insertions, 22 deletions
diff --git a/include/projecttypes.h b/include/projecttypes.h
index 00919a0..fc889b1 100755..100644
--- a/include/projecttypes.h
+++ b/include/projecttypes.h
@@ -12,22 +12,23 @@
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*
- * \author Christian Mueller, christian.linke@bmw.de BMW 2011,2012
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
* \file
* For further information see http://www.genivi.org/.
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_793BA955_1445_4da2_9C22_4EFA92A026C5__INCLUDED_)
-#define EA_793BA955_1445_4da2_9C22_4EFA92A026C5__INCLUDED_
+#if !defined(EA_B5ABC40A_CD0B_4c35_BB93_F4EA426C0B58__INCLUDED_)
+#define EA_B5ABC40A_CD0B_4c35_BB93_F4EA426C0B58__INCLUDED_
namespace am {
/**
- * This enum classifies the format in which data is exchanged within a connection. The enum itself is project specific
- * although there are some Genivi standard formats defined.
+ * This enum classifies the format in which data is exchanged within a connection.
+ * The enum itself is project specific although there are some Genivi standard
+ * formats defined.
* @author Christian Mueller
- * @created 16-Dez-2012 15:58:14
+ * @created 28-Jun-2012 14:00:25
*/
enum am_ConnectionFormat_e
{
@@ -51,13 +52,14 @@ namespace am {
* automatic connection.
*/
CF_GENIVI_AUTO = 4,
+
CF_MAX
};
/**
* This enum gives the information about reason for reason for Source/Sink change
* @author Christian Mueller
- * @created 16-Dez-2012 15:58:14
+ * @created 28-Jun-2012 14:00:25
*/
enum am_AvailabilityReason_e
{
@@ -95,7 +97,7 @@ namespace am {
/**
* product specific identifier of property
* @author Christian Mueller
- * @created 16-Dez-2012 15:58:14
+ * @created 28-Jun-2012 14:00:25
*/
enum am_ClassProperty_e
{
@@ -104,22 +106,47 @@ namespace am {
*/
CP_UNKNOWN = 0,
/**
- * defines the source type of a source. Project specific, could be for example differentiation between interrupt source
- * and main source.
+ * defines the source type of a source. Project specific, could be for example
+ * differentiation between interrupt source and main source.
*/
- CP_GENIVI_SOURCE_TYPE = 1,
+ CP_ENTERTAINMENT = 1,
/**
* defines the SINK_TYPE. Project specific
*/
- CP_GENIVI_SINK_TYPE = 2,
+ CP_INTERRUPT_OVERLAY = 2,
+
+ CP_INTERRUPT_SUPERSEEDING = 3,
+
+ CP_PDC =4,
+
+ CP_GONG = 5,
+
+ CP_CROSSFADER = 6,
+
+ CP_GENIVI_SOURCE_TYPE=7,
+
+ CP_GENIVI_SINK_TYPE=8,
+
+ CP_VIRTUAL_MAINSINK = 9,
+
+ CP_INVISIBLE_SOURCE = 10,
+
+ CP_PLAINSINK = 11,
+
+ CP_MAINSINK = 12,
+
+ CP_INVISIBLE_SINK = 13,
+
CP_MAX
};
/**
- * The given ramp types here are just a possiblity. for products, different ramp types can be defined here.
- * It is in the responsibility of the product to make sure that the routing plugins are aware of the ramp types used.
+ * The given ramp types here are just a possiblity. for products, different ramp
+ * types can be defined here.
+ * It is in the responsibility of the product to make sure that the routing
+ * plugins are aware of the ramp types used.
* @author Christian Mueller
- * @created 16-Dez-2012 15:58:14
+ * @created 28-Jun-2012 14:00:25
*/
enum am_RampType_e
{
@@ -139,9 +166,10 @@ namespace am {
};
/**
- * sound properties. Within genivi only the standard properties are defined, for products these need to be extended.
+ * sound properties. Within genivi only the standard properties are defined, for
+ * products these need to be extended.
* @author Christian Mueller
- * @created 16-Dez-2012 15:58:14
+ * @created 28-Jun-2012 14:00:25
*/
enum am_SoundPropertyType_e
{
@@ -161,13 +189,23 @@ namespace am {
* example bass value min =-10 max =10
*/
SP_EXAMPLE_BASS = 3,
+
+ SP_ENTER_SINKID = 4,
+
+ SP_INTERR_SUPERSEEDINGID = 5,
+
+ SP_INTERR_OVERLAYID = 6,
+
+ SP_PRIORITY = 7,
+
SP_MAX
};
/**
- * Here are all SoundProperties that can be set via the CommandInterface. Product specific
+ * Here are all SoundProperties that can be set via the CommandInterface. Product
+ * specific
* @author Christian Mueller
- * @created 16-Dez-2012 15:58:14
+ * @created 28-Jun-2012 14:00:25
*/
enum am_MainSoundPropertyType_e
{
@@ -187,13 +225,16 @@ namespace am {
* example value between -10 and +10
*/
MSP_EXAMPLE_BASS = 3,
+
+ MSP_SOURCE_TYPE = 4,
+
MSP_MAX
};
/**
* describes the different system properties. Project specific
* @author Christian Mueller
- * @created 16-Dez-2012 15:58:14
+ * @created 28-Jun-2012 14:00:25
*/
enum am_SystemPropertyType_e
{
@@ -204,11 +245,19 @@ namespace am {
SYP_MAX
};
+ enum am_sourceType_e
+ {
+ ST_MULTIMEDIA_LIBRARY = 0,
+ ST_TUNER = 1,
+ ST_AUX_STREAM = 2,
+ ST_MAX
+ };
+
/**
* gives the type of the Notification.
* @author q232968
* @version 1.0
- * @created 16-Dez-2012 15:58:14
+ * @created 05-Dez-2012 12:36:55
*/
enum am_NotificationType_e
{
@@ -216,4 +265,4 @@ namespace am {
NT_MAX
};
}
-#endif // !defined(EA_793BA955_1445_4da2_9C22_4EFA92A026C5__INCLUDED_)
+#endif // !defined(EA_B5ABC40A_CD0B_4c35_BB93_F4EA426C0B58__INCLUDED_)
diff --git a/include/shared/CAmCommonAPIWrapper.h b/include/shared/CAmCommonAPIWrapper.h
new file mode 100644
index 0000000..d6b8476
--- /dev/null
+++ b/include/shared/CAmCommonAPIWrapper.h
@@ -0,0 +1,142 @@
+/**
+ * Copyright (C) 2012, BMW AG
+ *
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ * \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.
+ *
+ * \file CAmCommonAPIWrapper.h
+ * For further information see http://www.genivi.org/.
+ */
+
+
+#ifndef COMMONAPIWRAPPER_H_
+#define COMMONAPIWRAPPER_H_
+
+#include <string>
+#include <list>
+#include <map>
+#include <queue>
+#include <memory>
+#include <CommonAPI/CommonAPI.h>
+#include "config.h"
+#include "CAmSocketHandler.h"
+
+
+/**
+ * A Common-API wrapper class, that loads the common-api runtime and instantiates all necessary other objects. Works with the CAmSocketHandler.
+ * It is implemented as singleton and usually once instantiated at the beginning with CAmSocketHandler.
+ * Example: CAmCommonAPIWrapper *pCAPIWrapper = CAmCommonAPIWrapper::instantiateOnce( aSocketHandlerPointer );
+ */
+
+namespace am
+{
+using namespace CommonAPI;
+
+class CAmSocketHandler;
+
+class CAmCommonAPIWrapper
+{
+public:
+
+ virtual ~CAmCommonAPIWrapper();
+ /**
+ * \brief Returns an already instantiated object.
+ *
+ * This method should be called after the instantiateOnce(...) has been called with non null socket handler parameter.
+ *
+ * @return The common-api wrapper object.
+ */
+ static CAmCommonAPIWrapper* getInstance();
+ /**
+ * \brief Creates a singleton instance attached to the provided socket handler object.
+ *
+ * This method should be called only once because it instantiates a single object.
+ * Otherwise it will throw an exception.
+ * The first call of this method with non null parameter loads the common-api and attaches it to the main loop.
+ *
+ * @param socketHandler: A pointer to socket handler or NULL
+ *
+ * @return The common-api wrapper object.
+ */
+ static CAmCommonAPIWrapper* instantiateOnce(CAmSocketHandler* socketHandler);
+
+ void registerDispatchSource(DispatchSource* dispatchSource, const DispatchPriority dispatchPriority);
+ void deregisterDispatchSource(DispatchSource* dispatchSource);
+ void registerWatch(Watch* watch, const DispatchPriority dispatchPriority);
+ void deregisterWatch(Watch* watch);
+ void registerTimeout(Timeout* timeout, const DispatchPriority dispatchPriority);
+ void deregisterTimeout(Timeout* timeout);
+ void wakeup();
+
+ std::shared_ptr<CommonAPI::Factory> factory() const;
+ std::shared_ptr<CommonAPI::Runtime> runtime() const;
+ //Wraps the invitation to the service publisher
+ template <class TStubImp> bool registerStub(const std::shared_ptr<TStubImp> & shStub, const std::string & aCommonAPIAddress)
+ {
+ return runtime()->getServicePublisher()->registerService(shStub, aCommonAPIAddress, factory());
+ }
+ bool unregisterStub(const std::string & aCommonAPIAddress)
+ {
+ /** Not implemented yet
+ todo: Check whether the appropriate method is available and uncomment...
+
+ return runtime()->getServicePublisher()->unregisterService(aCommonAPIAddress);
+ */
+ return true;
+ }
+
+
+protected:
+ CAmCommonAPIWrapper(CAmSocketHandler* socketHandler) ;
+private:
+ void commonPrepareCallback(const sh_pollHandle_t handle, void* userData);
+ TAmShPollPrepare<CAmCommonAPIWrapper> pCommonPrepareCallback;
+
+ bool commonDispatchCallback(const sh_pollHandle_t handle, void* userData);
+ TAmShPollDispatch<CAmCommonAPIWrapper> pCommonDispatchCallback;
+
+ void commonFireCallback(const pollfd pollfd, const sh_pollHandle_t, void*);
+ TAmShPollFired<CAmCommonAPIWrapper> pCommonFireCallback;
+
+ bool commonCheckCallback(const sh_pollHandle_t handle, void*);
+ TAmShPollCheck<CAmCommonAPIWrapper> pCommonCheckCallback;
+
+ void commonTimerCallback(sh_timerHandle_t handle, void* userData);
+ TAmShTimerCallBack<CAmCommonAPIWrapper> pCommonTimerCallback;
+
+ struct timerHandles
+ {
+ sh_timerHandle_t handle;
+ Timeout* timeout;
+ };
+ //!< reference to the dbus instance
+ CAmSocketHandler *mpSocketHandler; //!< pointer to the sockethandler
+
+ std::shared_ptr<CommonAPI::Factory> mFactory;
+ std::shared_ptr<CommonAPI::MainLoopContext> mContext;
+
+ DispatchSourceListenerSubscription mDispatchSourceListenerSubscription;
+ WatchListenerSubscription mWatchListenerSubscription;
+ TimeoutSourceListenerSubscription mTimeoutSourceListenerSubscription;
+ WakeupListenerSubscription mWakeupListenerSubscription;
+ std::multimap<DispatchPriority, DispatchSource*> mRegisteredDispatchSources;
+ std::map<int,Watch*> mMapWatches;
+ Watch* mWatchToCheck;
+ std::list<DispatchSource*> mSourcesToDispatch;
+ std::vector<timerHandles> mpListTimerhandles;
+};
+
+#define Am_CAPI CAmCommonAPIWrapper::getInstance()
+
+}
+
+#endif /* COMMONAPIWRAPPER_H_ */