summaryrefslogtreecommitdiff
path: root/PluginCommandInterfaceCAPI/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 /PluginCommandInterfaceCAPI/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 'PluginCommandInterfaceCAPI/include')
-rw-r--r--PluginCommandInterfaceCAPI/include/CAmCommandSenderCAPI.h120
-rw-r--r--PluginCommandInterfaceCAPI/include/CAmCommandSenderCommon.h61
-rw-r--r--PluginCommandInterfaceCAPI/include/CAmCommandSenderService.h74
-rw-r--r--PluginCommandInterfaceCAPI/include/configCommandCAPI.h4
4 files changed, 259 insertions, 0 deletions
diff --git a/PluginCommandInterfaceCAPI/include/CAmCommandSenderCAPI.h b/PluginCommandInterfaceCAPI/include/CAmCommandSenderCAPI.h
new file mode 100644
index 0000000..9427823
--- /dev/null
+++ b/PluginCommandInterfaceCAPI/include/CAmCommandSenderCAPI.h
@@ -0,0 +1,120 @@
+/**
+ * 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 CAPICOMMANDSENDER_H_
+#define CAPICOMMANDSENDER_H_
+
+#include <map>
+#include "shared/CAmCommonAPIWrapper.h"
+#include "command/IAmCommandSend.h"
+#include "command/IAmCommandReceive.h"
+#include "CAmCommandSenderService.h"
+
+
+
+namespace am
+{
+using namespace CommonAPI;
+using namespace org::genivi::audiomanager;
+
+
+/**
+ * Common-api implementation of CommandSendInterface.
+ * This class publish a service
+ */
+class CAmCommandSenderCAPI: public IAmCommandSend
+{
+ CAmCommandSenderCAPI();
+public:
+ CAmCommandSenderCAPI(CAmCommonAPIWrapper *aWrapper);
+ virtual ~CAmCommandSenderCAPI();
+ am_Error_e startService(IAmCommandReceive* commandreceiveinterface);
+ am_Error_e startupInterface(IAmCommandReceive* commandreceiveinterface);
+ am_Error_e tearDownInterface(IAmCommandReceive* commandreceiveinterface = NULL);
+ void setCommandReady(const uint16_t handle);
+ void setCommandRundown(const uint16_t handle);
+ void cbNewMainConnection(const am_MainConnectionType_s& mainConnection);
+ void cbRemovedMainConnection(const am_mainConnectionID_t mainConnection);
+ void cbNewSink(const am_SinkType_s& sink);
+ void cbRemovedSink(const am_sinkID_t sinkID);
+ void cbNewSource(const am_SourceType_s& source);
+ void cbRemovedSource(const am_sourceID_t source);
+ void cbNumberOfSinkClassesChanged();
+ void cbNumberOfSourceClassesChanged();
+ void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState);
+ void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty);
+ void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty);
+ void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability);
+ void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume);
+ void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
+ void cbSystemPropertyChanged(const am_SystemProperty_s& systemProperty);
+ void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
+ void getInterfaceVersion(std::string& version) const;
+ void cbSinkUpdated(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
+ void cbSourceUpdated(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties);
+ void cbSinkNotification(const am_sinkID_t sinkID, const am_NotificationPayload_s& notification) ;
+ void cbSourceNotification(const am_sourceID_t sourceID, const am_NotificationPayload_s& notification) ;
+ void cbMainSinkNotificationConfigurationChanged(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
+ void cbMainSourceNotificationConfigurationChanged(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration) ;
+
+ static const char * COMMAND_SENDER_SERVICE;
+
+private:
+ std::shared_ptr<CAmCommandSenderService> mService;
+ CAmCommonAPIWrapper* mpCAmCAPIWrapper; ///< ! pointer to dbus wrapper
+ IAmCommandReceive* mpIAmCommandReceive; ///< ! pointer to commandReceive Interface
+ bool mReady; ///< ! if false, calls shall be ignored.
+ bool mIsServiceStarted;
+
+ /**
+ * list of sinks, needed to send out only deltas
+ */
+ std::vector<am_SinkType_s> mlistSinks;
+
+ /**
+ * list of sources, needed to send out only deltas
+ */
+ std::vector<am_SourceType_s> mlistSources;
+
+ /**
+ * used as comparison function for am_SinkType_s
+ */
+ struct sortBySinkID
+ {
+ bool operator()(const am_SinkType_s & a, const am_SinkType_s & b)
+ {
+ return (a.sinkID < b.sinkID);
+ }
+ };
+
+ /**
+ * used as comparison function for am_SourceType_s
+ */
+ struct sortBySourceID
+ {
+ bool operator()(const am_SourceType_s & a, const am_SourceType_s & b)
+ {
+ return (a.sourceID < b.sourceID);
+ }
+ };
+
+};
+
+}
+
+#endif /* CAPICOMMANDSENDER_H_ */
diff --git a/PluginCommandInterfaceCAPI/include/CAmCommandSenderCommon.h b/PluginCommandInterfaceCAPI/include/CAmCommandSenderCommon.h
new file mode 100644
index 0000000..4301dd7
--- /dev/null
+++ b/PluginCommandInterfaceCAPI/include/CAmCommandSenderCommon.h
@@ -0,0 +1,61 @@
+/**
+ * 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 CAMCOMMANDSENDERCOMMON_H_
+#define CAMCOMMANDSENDERCOMMON_H_
+
+#include <memory>
+#include "audiomanagertypes.h"
+#include <org/genivi/audiomanager/CommandInterface.h>
+
+using namespace am;
+using namespace org::genivi::audiomanager;
+
+/**
+ * The following functions convert the basics AudiomManager types from/to CommonAPI types.
+ */
+
+extern void CAmConvertAvailablility(const am_Availability_s & , CommandInterface::am_Availability_s & );
+extern void CAmConvertMainSoundProperty(const am_MainSoundProperty_s & , CommandInterface::am_MainSoundProperty_s & );
+extern void CAmConvertSystemProperty(const am_SystemProperty_s &, CommandInterface::am_SystemProperty_s &);
+
+extern CommandInterface::am_ClassProperty_e CAmConvert2CAPIType(const am_ClassProperty_e & property);
+extern CommandInterface::am_SystemPropertyType_e CAmConvert2CAPIType(const am_SystemPropertyType_e &);
+extern CommandInterface::am_Availablility_e CAmConvert2CAPIType(const am_Availability_e & );
+extern CommandInterface::am_AvailabilityReason_e CAmConvert2CAPIType(const am_AvailabilityReason_e & );
+
+extern CommandInterface::am_MuteState_e CAmConvert2CAPIType(const am_MuteState_e &);
+extern am_MuteState_e CAmConvertFromCAPIType(const CommandInterface::am_MuteState_e &);
+
+extern CommandInterface::am_MainSoundPropertyType_e CAmConvert2CAPIType(const am_MainSoundPropertyType_e &);
+extern am_MainSoundPropertyType_e CAmConvertFromCAPIType(const CommandInterface::am_MainSoundPropertyType_e &);
+
+extern CommandInterface::am_ConnectionState_e CAmConvert2CAPIType(const am_ConnectionState_e &);
+extern am_ConnectionState_e CAmConvertFromCAPIType(const CommandInterface::am_ConnectionState_e &);
+
+extern org::genivi::audiomanager::am::am_NotificationType_e CAmConvert2CAPIType(const am_NotificationType_e &);
+extern am_NotificationType_e CAmConvertFromCAPIType(const org::genivi::audiomanager::am::am_NotificationType_e &);
+
+extern org::genivi::audiomanager::am::am_NotificationStatus_e CAmConvert2CAPIType(const am_NotificationStatus_e &);
+extern am_NotificationStatus_e CAmConvertFromCAPIType(const org::genivi::audiomanager::am::am_NotificationStatus_e &);
+
+extern CommandInterface::am_Error_e CAmConvert2CAPIType(const am_Error_e &);
+extern am_Error_e CAmConvertFromCAPIType(const CommandInterface::am_Error_e & error);
+
+extern am_SystemPropertyType_e CAmConvertFromCAPIType(const CommandInterface::am_SystemPropertyType_e &);
+
+#endif /* CAMCOMMANDSENDERCOMMON_H_ */
diff --git a/PluginCommandInterfaceCAPI/include/CAmCommandSenderService.h b/PluginCommandInterfaceCAPI/include/CAmCommandSenderService.h
new file mode 100644
index 0000000..cac6162
--- /dev/null
+++ b/PluginCommandInterfaceCAPI/include/CAmCommandSenderService.h
@@ -0,0 +1,74 @@
+/**
+ * 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 CAMCOMMANDSENDERSERVICE_H_
+#define CAMCOMMANDSENDERSERVICE_H_
+
+#include <org/genivi/audiomanager/CommandInterfaceStubDefault.h>
+#include "../../include/command/IAmCommandReceive.h"
+
+namespace am {
+
+using namespace org::genivi::audiomanager;
+
+/**
+ * A concrete stub implementation used by the command sender plug-in.
+ */
+class CAmCommandSenderService: public CommandInterfaceStubDefault {
+ IAmCommandReceive* mpIAmCommandReceive;
+public:
+ CAmCommandSenderService();
+ CAmCommandSenderService(IAmCommandReceive *aReceiver);
+ virtual ~CAmCommandSenderService();
+
+ virtual void Connect(CommandInterface::am_sourceID_t sourceID, CommandInterface::am_sinkID_t sinkID, CommandInterface::am_Error_e& result, CommandInterface::am_mainConnectionID_t& mainConnectionID);
+
+ virtual void Disconnect(CommandInterface::am_mainConnectionID_t mainConnectionID, CommandInterface::am_Error_e& result);
+
+ virtual void SetVolume(CommandInterface::am_sinkID_t sinkID, CommandInterface::am_mainVolume_t volume, CommandInterface::am_Error_e& result);
+
+ virtual void VolumeStep(CommandInterface::am_sinkID_t sinkID, CommandInterface::am_mainVolume_t volumeStep, CommandInterface::am_Error_e& result);
+
+ virtual void SetSinkMuteState(CommandInterface::am_sinkID_t sinkID, CommandInterface::am_MuteState_e muteState, CommandInterface::am_Error_e& result);
+
+ virtual void SetMainSinkSoundProperty(CommandInterface::am_sinkID_t sinkID, CommandInterface::am_MainSoundProperty_s soundProperty, CommandInterface::am_Error_e& result);
+
+ virtual void SetMainSourceSoundProperty(CommandInterface::am_sourceID_t sourceID, CommandInterface::am_MainSoundProperty_s soundProperty, CommandInterface::am_Error_e& result);
+
+ virtual void SetSystemProperty(CommandInterface::am_SystemProperty_s soundProperty, CommandInterface::am_Error_e& result);
+
+ virtual void GetListMainConnections(CommandInterface::am_Error_e& result, CommandInterface::am_MainConnectionType_l& listConnections);
+
+ virtual void GetListMainSinks(CommandInterface::am_Error_e& result, CommandInterface::am_SinkType_l& listMainSinks);
+
+ virtual void GetListMainSources(CommandInterface::am_Error_e& result, CommandInterface::am_SourceType_l& listMainSources);
+
+ virtual void GetListMainSinkSoundProperties(CommandInterface::am_sinkID_t sinkID, CommandInterface::am_Error_e& result, CommandInterface::am_MainSoundProperty_l& listSoundProperties);
+
+ virtual void GetListMainSourceSoundProperties(CommandInterface::am_sourceID_t sourceID, CommandInterface::am_Error_e& result, CommandInterface::am_MainSoundProperty_l& listSourceProperties);
+
+ virtual void GetListSourceClasses(CommandInterface::am_Error_e& result, CommandInterface::am_SourceClass_l& listSourceClasses);
+
+ virtual void GetListSinkClasses(CommandInterface::am_Error_e& result, CommandInterface::am_SinkClass_l& listSinkClasses);
+
+ virtual void GetListSystemProperties(CommandInterface::am_Error_e& result, CommandInterface::am_SystemProperty_l& listSystemProperties);
+
+ virtual void GetTimingInformation(CommandInterface::am_mainConnectionID_t mainConnectionID, CommandInterface::am_Error_e& result, CommandInterface::am_timeSync_t& delay);
+};
+
+} /* namespace am */
+#endif /* CAMCOMMANDSENDERSERVICE_H_ */
diff --git a/PluginCommandInterfaceCAPI/include/configCommandCAPI.h b/PluginCommandInterfaceCAPI/include/configCommandCAPI.h
new file mode 100644
index 0000000..8bd2faa
--- /dev/null
+++ b/PluginCommandInterfaceCAPI/include/configCommandCAPI.h
@@ -0,0 +1,4 @@
+#ifndef _COMMANDCAPI_CONFIG_H
+#define _COMMANDCAPI_CONFIG_H
+
+#endif /* _COMMANDCAPI_CONFIG_H */