summaryrefslogtreecommitdiff
path: root/PluginCommandInterfaceDbus
diff options
context:
space:
mode:
Diffstat (limited to 'PluginCommandInterfaceDbus')
-rw-r--r--PluginCommandInterfaceDbus/CMakeLists.txt103
-rw-r--r--PluginCommandInterfaceDbus/cmake/config.cmake7
-rw-r--r--PluginCommandInterfaceDbus/include/CAmCommandSenderDbus.h121
-rw-r--r--PluginCommandInterfaceDbus/include/CAmDbusMessageHandler.h123
-rw-r--r--PluginCommandInterfaceDbus/include/CommandInterface.xml226
-rw-r--r--PluginCommandInterfaceDbus/include/IAmCommandReceiverShadow.h109
-rw-r--r--PluginCommandInterfaceDbus/include/configCommandDbus.h7
-rw-r--r--PluginCommandInterfaceDbus/src/CAmCommandSenderDbus.cpp401
-rw-r--r--PluginCommandInterfaceDbus/src/CAmDbusMessageHandler.cpp709
-rw-r--r--PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp526
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.cpp63
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.h44
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.cpp803
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.h43
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.cpp622
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.h53
-rw-r--r--PluginCommandInterfaceDbus/test/CMakeLists.txt115
-rw-r--r--PluginCommandInterfaceDbus/test/MockIAmCommandReceive.h86
18 files changed, 0 insertions, 4161 deletions
diff --git a/PluginCommandInterfaceDbus/CMakeLists.txt b/PluginCommandInterfaceDbus/CMakeLists.txt
deleted file mode 100644
index faf7947..0000000
--- a/PluginCommandInterfaceDbus/CMakeLists.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright (c) 2012 BMW
-#
-# author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
-#
-# 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/.
-#
-
-cmake_minimum_required(VERSION 2.6)
-
-PROJECT(PluginCommandInterfaceDbus)
-
-OPTION (WITH_COMMAND_INTERFACE_DBUS
- "build with commandinterface dbus plugin" ON )
-
-IF (WITH_COMMAND_INTERFACE_DBUS)
-
-set(LIBRARY_OUTPUT_PATH ${PLUGINS_OUTPUT_PATH}/command)
-set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/CommandDBusPlugin)
-set(INCLUDE_FOLDER "include")
-message(STATUS "prefix ${CMAKE_INSTALL_PREFIX}")
-SET(SHARED_FOLDER "${CMAKE_INSTALL_PREFIX}/share")
-
-FILE(READ "${AUDIO_INCLUDE_FOLDER}/command/IAmCommandSend.h" VERSION_BUFFER LIMIT 6000)
-STRING(REGEX MATCH "CommandSendVersion*.[^0-9]*[0-9].[0-9]*[0-9]" LIB_INTERFACE_VERSION_STRING ${VERSION_BUFFER})
-STRING(REGEX REPLACE "CommandSendVersion*.." "" LIB_INTERFACE_VERSION ${LIB_INTERFACE_VERSION_STRING})
-MESSAGE(STATUS "Building against command interface version ${LIB_INTERFACE_VERSION}")
-
-IF(USE_BUILD_LIBS)
- SET(COMMAND_DBUS_INTROSPECTION_FOLDER ${EXECUTABLE_OUTPUT_PATH})
- SET(COMMAND_DBUS_INTROSPECTION_FILE ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml)
-ELSE(USE_BUILD_LIBS)
- SET(COMMAND_DBUS_INTROSPECTION_FOLDER ${SHARED_FOLDER}/audiomanager)
- SET(COMMAND_DBUS_INTROSPECTION_FILE ${SHARED_FOLDER}/audiomanager/CommandInterface.xml)
-ENDIF(USE_BUILD_LIBS)
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake ${CMAKE_CURRENT_SOURCE_DIR}/include/configCommandDbus.h )
-
-FIND_PACKAGE(DBUS REQUIRED)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${DBUS_INCLUDE_DIR}
- ${DBUS_ARCH_INCLUDE_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${PROJECT_INCLUDE_FOLDER}
- ${DLT_INCLUDE_DIRS}
- ${INCLUDE_FOLDER}
-)
-
-# all source files go here
-file(GLOB PLUGINDBUS_SRCS_CXX "src/*.cpp")
-
-add_library(PluginCommandInterfaceDbus MODULE ${PLUGINDBUS_SRCS_CXX})
-
-TARGET_LINK_LIBRARIES(PluginCommandInterfaceDbus
- ${DLT_LIBRARIES}
- ${DBUS_LIBRARY}
-)
-
-IF(WITH_TESTS)
- add_subdirectory (test)
-ENDIF(WITH_TESTS)
-
-#IF(WITH_DOCUMENTATION)
-# file(MAKE_DIRECTORY ${DOC_OUTPUT_PATH})
-# configure_file(${DOXY_FILE} ${DOC_OUTPUT_PATH}/Doxyfile @ONLY IMMEDIATE)
-# add_custom_target (PluginInterfaceDBusDocs ALL
-# COMMAND ${DOXYGEN_EXECUTABLE} ${DOC_OUTPUT_PATH}/Doxyfile WORKING_DIRECTORY ${DOC_OUTPUT_PATH}
-# SOURCES ${PROJECT_BINARY_DIR} ${DOC_OUTPUT_PATH}/Doxyfile
-# )
-#ENDIF(WITH_DOCUMENTATION)
-
-INSTALL(TARGETS PluginCommandInterfaceDbus
- DESTINATION "lib/${LIB_INSTALL_SUFFIX}/command"
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT sampleplugins
-)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/CommandInterface.xml
- DESTINATION "${COMMAND_DBUS_INTROSPECTION_FOLDER}"
- COMPONENT sampleplugins
-)
-
-IF(USE_BUILD_LIBS)
- execute_process(
- COMMAND mkdir -p "${CMAKE_SOURCE_DIR}/bin"
- COMMAND cp "${CMAKE_SOURCE_DIR}/PluginCommandInterfaceDbus/${INCLUDE_FOLDER}/CommandInterface.xml" ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml)
-ENDIF(USE_BUILD_LIBS)
-
-SET(ADD_DEPEND "audiomanager-bin" "dlt" "libdbus-1-3(>=1.2.16)")
-set_property(GLOBAL APPEND PROPERTY sampleplugins_prop "${ADD_DEPEND}")
-
-ENDIF (WITH_COMMAND_INTERFACE_DBUS)
diff --git a/PluginCommandInterfaceDbus/cmake/config.cmake b/PluginCommandInterfaceDbus/cmake/config.cmake
deleted file mode 100644
index 6b8c553..0000000
--- a/PluginCommandInterfaceDbus/cmake/config.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _COMMANDDBUS_CONFIG_H
-#define _COMMANDDBUS_CONFIG_H
-
-#cmakedefine COMMAND_DBUS_INTROSPECTION_FILE "@COMMAND_DBUS_INTROSPECTION_FILE@"
-#cmakedefine LIBRARY_OUTPUT_PATH "@LIBRARY_OUTPUT_PATH@"
-
-#endif /* _COMMANDDBUS_CONFIG_H */
diff --git a/PluginCommandInterfaceDbus/include/CAmCommandSenderDbus.h b/PluginCommandInterfaceDbus/include/CAmCommandSenderDbus.h
deleted file mode 100644
index dbcee7c..0000000
--- a/PluginCommandInterfaceDbus/include/CAmCommandSenderDbus.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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 DBUSCOMMANDSENDER_H_
-#define DBUSCOMMANDSENDER_H_
-
-#include <dbus/dbus.h>
-#include <map>
-#include "shared/CAmDbusWrapper.h"
-#include "CAmDbusMessageHandler.h"
-#include "IAmCommandReceiverShadow.h"
-#include "command/IAmCommandSend.h"
-
-#ifdef UNIT_TEST
-#include "../test/CAmCommandSenderDbusBackdoor.h"
-#endif
-
-
-
-namespace am
-{
-
-const char MY_NODE[] = "commandinterface";
-
-/**
- * Dbus Implementation of CommandSendInterface
- */
-class CAmCommandSenderDbus: public IAmCommandSend
-{
-public:
- CAmCommandSenderDbus();
- virtual ~CAmCommandSenderDbus();
- am_Error_e startupInterface(IAmCommandReceive* commandreceiveinterface);
- 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) ;
-
-#ifdef UNIT_TEST
- friend class CAmCommandSenderDbusBackdoor;
-#endif
-private:
- CAmDbusMessageHandler mCAmDbusMessageHandler; ///< ! instance of message handler
- IAmCommandReceiverShadow mIAmCommandReceiverShadow; ///< ! instance of shadow
- CAmDbusWrapper* mpCAmDbusWrapper; ///< ! pointer to dbus wrapper
- IAmCommandReceive* mpIAmCommandReceive; ///< ! pointer to commandReceive Interface
- bool mReady; ///< ! if false, calls shall be ignored.
-
- /**
- * 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 /* DBUSCOMMANDSENDER_H_ */
diff --git a/PluginCommandInterfaceDbus/include/CAmDbusMessageHandler.h b/PluginCommandInterfaceDbus/include/CAmDbusMessageHandler.h
deleted file mode 100644
index 8360bff..0000000
--- a/PluginCommandInterfaceDbus/include/CAmDbusMessageHandler.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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 _DBUSMESSAGEHANDLER_H_
-#define _DBUSMESSAGEHANDLER_H_
-
-#include <dbus/dbus.h>
-#include <vector>
-#include <sstream>
-#include <string>
-#include <list>
-#include "audiomanagertypes.h"
-
-
-namespace am
-{
-
-/**
- * handles DBus Messages, is used to extract & append parameters and send messages
- */
-class CAmDbusMessageHandler
-{
-public:
- CAmDbusMessageHandler();
- ~CAmDbusMessageHandler();
-
- /**
- * sets the DBus Connection
- * @param connection pointer to the DBus Connection
- */
- void setDBusConnection(DBusConnection*& connection);
-
- /**
- * is called to initiate the receiving of a message
- * @param msg pointer to the message to be received
- */
- void initReceive(DBusMessage* msg);
-
- /**
- * is called to initiate the reply to a message
- * @param msg pointer to the message the reply is for
- */
- void initReply(DBusMessage* msg);
-
- /**
- * inits a signal to be sent via dbus
- * parameters can be added before sending the signal
- * @param path the path
- * @param signalName the signal name
- */
- void initSignal(std::string path, std::string signalName);
-
- /**
- * sends out the message
- */
- void sendMessage();
-
- /**
- * the get functions return a value from the received dbus message
- * @return
- */
- dbus_uint16_t getUInt();
- dbus_int16_t getInt();
- dbus_bool_t getBool();
- char getByte();
- double getDouble();
- char* getString();
- void getProperty(dbus_int16_t& type, dbus_int16_t& value);
- void getNotificationConfiguration(dbus_int16_t& type, dbus_int16_t& status, dbus_int16_t& parameter);
-
- /**
- * the overloaded append function appends different datatypes to the dbusmessage
- */
- void append(dbus_int16_t toAppend);
- void append(dbus_uint16_t toAppend);
- void append(char toAppend);
- void append(bool toAppend);
- void append(double toAppend);
- void append(const am::am_SinkType_s& sinkType);
- void append(const am::am_SourceType_s& sourceType);
- void append(const am::am_MainSoundProperty_s mainSoundProperty);
- void append(const am::am_Availability_s & availability);
- void append(const am::am_SystemProperty_s & SystemProperty);
- void append(const std::vector<am::am_MainConnectionType_s>& listMainConnections);
- void append(const std::vector<am::am_SinkType_s>& listMainSinks);
- void append(const std::vector<am::am_SourceType_s>& listMainSources);
- void append(const std::vector<am::am_MainSoundProperty_s>& listMainSoundProperties);
- void append(const std::vector<am::am_SourceClass_s>& listSourceClasses);
- void append(const std::vector<am::am_SinkClass_s>& listSinkClasses);
- void append(const std::vector<am::am_SystemProperty_s>& listSystemProperties);
- void append(const std::vector<am::am_NotificationConfiguration_s>& listNotifications);
- void append(const am::am_NotificationPayload_s& notificationPayload);
- void append(const am::am_NotificationConfiguration_s& notificationConfiguration);
-
-private:
-
- DBusMessageIter mDBusMessageIter;
- DBusError mDBusError;
- dbus_uint32_t mSerial;
- std::string mErrorName;
- std::string mErrorMsg;
- DBusMessage* mpDBusMessage;
- DBusMessage* mpReveiveMessage;
- DBusConnection* mpDBusConnection;
-};
-
-}
-
-#endif // _DBUSMESSAGEWRAPPER_H_
diff --git a/PluginCommandInterfaceDbus/include/CommandInterface.xml b/PluginCommandInterfaceDbus/include/CommandInterface.xml
deleted file mode 100644
index bab2604..0000000
--- a/PluginCommandInterfaceDbus/include/CommandInterface.xml
+++ /dev/null
@@ -1,226 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE node PUBLIC
- "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
- "http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
-<node>
- <interface name="org.genivi.audiomanager.commandinterface">
- <method name="Connect">
- <arg type="q" name="sourceID" direction="in"/>
- <arg type="q" name="sinkID" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="q" name="mainConnectionID" direction="out"/>
- </method>
-
- <method name="Disconnect">
- <arg type="q" name="mainConnectionID" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- </method>
-
- <method name="SetVolume">
- <arg type="q" name="sinkID" direction="in"/>
- <arg type="n" name="volume" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- </method>
-
- <method name="VolumeStep">
- <arg type="q" name="sinkID" direction="in"/>
- <arg type="n" name="volumeStep" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- </method>
-
- <method name="SetSinkMuteState">
- <arg type="q" name="sinkID" direction="in"/>
- <arg type="n" name="muteState" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- </method>
-
- <method name="SetMainSinkSoundProperty">
- <arg type="q" name="sinkID" direction="in"/>
- <arg type="(nn)" name="soundProperty" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- </method>
-
- <method name="SetMainSourceSoundProperty">
- <arg type="q" name="sourceID" direction="in"/>
- <arg type="(nn)" name="soundProperty" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- </method>
-
- <method name="SetSystemProperty">
- <arg type="(nn)" name="property" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- </method>
-
- <method name="GetListMainConnections">
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(qqqnn)" name="listConnections" direction="out"/> <!-- am_mainConnectionID_t mainConnectionID; am_sourceID_t sourceID; am_sinkID_t sinkID; am_timeSync_t delay; am_ConnectionState_e connectionState; -->
- </method>
-
- <method name="GetListMainSinks">
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(qs(nn)nnq)" name="listMainSinks" direction="out"/> <!-- am_sinkID_t sinkID; std::string name; am_Availability_s availability; am_mainVolume_t volume; am_MuteState_e muteState; am_sinkClass_t sinkClassID; -->
- </method>
-
- <method name="GetListMainSources">
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(qs(nn)q)" name="listMainSources" direction="out"/> <!-- am_sourceID_t sourceID; std::string name; am_Availability_s availability; am_sourceClass_t sourceClassID; -->
- </method>
-
- <method name="GetListMainSinkSoundProperties">
- <arg type="q" name="sinkID" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(nn)" name="listSoundProperties" direction="out"/> <!-- am_CustomMainSoundPropertyType_t type; int16_t value; -->
- </method>
-
- <method name="GetListMainSourceSoundProperties">
- <arg type="q" name="sourceID" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(nn)" name="listSourceProperties" direction="out"/> <!-- am_CustomMainSoundPropertyType_t type; int16_t value; -->
- </method>
-
- <method name="GetListSourceClasses">
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(qsa(nn))" name="listSourceClasses" direction="out"/> <!-- am_sourceClass_t SourceClassID; std::string name; std::vector<am_ClassProperty_s> listClassProperties; -->
- </method>
-
- <method name="GetListSinkClasses">
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(qsa(nn))" name="listSinkClasses" direction="out"/> <!-- am_sourceClass_t SinkClassID; std::string name; std::vector<am_ClassProperty_s> listClassProperties; -->
- </method>
-
- <method name="GetListSystemProperties">
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(nn)" name="listSystemProperties" direction="out"/> <!-- am_SystemProperty_e type; int16_t value; -->
- </method>
-
- <method name="GetTimingInformation">
- <arg type="q" name="mainConnectionID" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="n" name="delay" direction="out"/>
- </method>
-
- <method name="GetListSinkMainNotificationConfigurations">
- <arg type="q" name="sinkID" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(nnn)" name="listMainNotificationConfigurations" direction="out"/> <!-- am_am_notification_e type; am_status_e status; int16t parameter; -->
- </method>
-
- <method name="GetListSourceMainNotificationConfigurations">
- <arg type="q" name="sourceID" direction="in"/>
- <arg type="n" name="result" direction="out"/> <!-- method return code (am_Error_e) -->
- <arg type="a(nnn)" name="listMainNotificationConfigurations" direction="out"/> <!-- am_am_notification_e type; am_status_e status; int16t parameter; -->
- </method>
-
- <method name="setMainSinkNotificationConfiguration">
- <arg type="q" name="sinkID" direction="in"/>
- <arg type="(nnn)" name="mainNotificationConfiguration" direction="in"/> <!-- am_am_notification_e type; am_status_e status; int16t parameter; -->
- <arg type="n" name="error" direction="out"/>
- </method>
-
- <method name="setMainSourceNotificationConfiguration">
- <arg type="q" name="sourceID" direction="in"/>
- <arg type="(nnn)" name="mainNotificationConfiguration" direction="in"/> <!-- am_am_notification_e type; am_status_e status; int16t parameter; -->
- <arg type="n" name="error" direction="out"/>
- </method>
-
- <signal name="NumberOfMainConnectionsChanged"></signal>
-
- <signal name="SinkAdded">
- <arg type="(qs(nn)nnq)" name="newSink" direction="out"/> <!-- am_sinkID_t sinkID; std::string name; am_Availability_s availability; am_mainVolume_t volume; am_MuteState_e muteState; am_sinkClass_t sinkClassID; -->
- </signal>
-
- <signal name="SinkRemoved">
- <arg type="q" name="removedSinkID" direction="out"/>
- </signal>
-
- <signal name="SourceAdded">
- <arg type="(qs(nn)q)" name="newSource" direction="out"/> <!-- am_sourceID_t sourceID; std::string name; am_Availability_s availability; am_sourceClass_t sourceClassID; -->
- </signal>
-
- <signal name="SourceRemoved">
- <arg type="q" name="removedSourceID" direction="out"/>
- </signal>
-
- <signal name="NumberOfSinkClassesChanged">
- </signal>
-
- <signal name="NumberOfSourceClassesChanged">
- </signal>
-
- <signal name="MainConnectionStateChanged">
- <arg type="q" name="connectionID" direction="out"/>
- <arg type="n" name="connectionState" direction="out"/>
- </signal>
-
- <signal name="MainSinkSoundPropertyChanged">
- <arg type="q" name="sinkID" direction="out"/>
- <arg type="(nn)" name="SoundProperty" direction="out"/>
- </signal>
-
- <signal name="MainSourceSoundPropertyChanged">
- <arg type="q" name="sourceID" direction="out"/>
- <arg type="(nn)" name="SoundProperty" direction="out"/>
- </signal>
-
- <signal name="SinkAvailabilityChanged">
- <arg type="q" name="sinkID" direction="out"/>
- <arg type="(nn)" name="availability" direction="out"/>
- </signal>
-
- <signal name="SourceAvailabilityChanged">
- <arg type="q" name="sourceID" direction="out"/>
- <arg type="(nn)" name="availability" direction="out"/>
- </signal>
-
- <signal name="VolumeChanged">
- <arg type="q" name="sinkID" direction="out"/>
- <arg type="n" name="volume" direction="out"/>
- </signal>
-
- <signal name="SinkMuteStateChanged">
- <arg type="q" name="sinkID" direction="out"/>
- <arg type="n" name="muteState" direction="out"/>
- </signal>
-
- <signal name="SystemPropertyChanged">
- <arg type="(nn)" name="SystemProperty" direction="out"/>
- </signal>
-
- <signal name="TimingInformationChanged">
- <arg type="q" name="mainConnection" direction="out"/>
- <arg type="n" name="time" direction="out"/>
- </signal>
-
- <signal name="SinkUpdated">
- <arg type="q" name="sinkID" direction="out"/>
- <arg type="q" name="sinkClassID" direction="out"/>
- <arg type="a(nn)" name="listMainSinkProperties" direction="out"/> <!-- am_CustomMainSoundPropertyType_t type; int16_t value; -->
- </signal>
-
- <signal name="SourceUpdated">
- <arg type="q" name="sourceID" direction="out"/>
- <arg type="q" name="sourceClassID" direction="out"/>
- <arg type="a(nn)" name="listMainSinkProperties" direction="out"/> <!-- am_CustomMainSoundPropertyType_t type; int16_t value; -->
- </signal>
-
- <signal name="SourceNotification">
- <arg type="q" name="sourceID" direction="out"/>
- <arg type="(nn)" name="notificationPayload" direction="out"/> <!-- am_notification_e type; int16_t value; -->
- </signal>
-
- <signal name="SinkNotification">
- <arg type="q" name="sinkID" direction="out"/>
- <arg type="(nn)" name="notificationPayload" direction="out"/> <!-- am_notification_e type; int16_t value; -->
- </signal>
-
- <signal name="SinkMainNotificationConfigurationChanged">
- <arg type="q" name="sinkID" direction="out"/>
- <arg type="(nnn)" name="mainNotificationConfiguration" direction="out"/> <!-- am_am_notification_e type; am_status_e status; int16t parameter; -->
- </signal>
-
- <signal name="SourceMainNotificationConfigurationChanged">
- <arg type="q" name="sourceID" direction="out"/>
- <arg type="(nnn)" name="mainNotificationConfiguration" direction="out"/> <!-- am_am_notification_e type; am_status_e status; int16t parameter; -->
- </signal>
- </interface>
-</node>
diff --git a/PluginCommandInterfaceDbus/include/IAmCommandReceiverShadow.h b/PluginCommandInterfaceDbus/include/IAmCommandReceiverShadow.h
deleted file mode 100644
index c582ee6..0000000
--- a/PluginCommandInterfaceDbus/include/IAmCommandReceiverShadow.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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 COMMANDRECEIVERSHADOW_H_
-#define COMMANDRECEIVERSHADOW_H_
-
-
-
-#include <dbus/dbus.h>
-#include <map>
-#include "config.h"
-#include "command/IAmCommandReceive.h"
-#include "CAmDbusMessageHandler.h"
-#include "shared/CAmDbusWrapper.h"
-
-namespace am
-{
-
-class IAmCommandReceiverShadow;
-
-typedef void (IAmCommandReceiverShadow::*CallBackMethod)(DBusConnection *connection, DBusMessage *message);
-
-/**
- * receives the DBus Callbacks, marhsalls and demarshalls the parameters and calls CommandReceive
- */
-class IAmCommandReceiverShadow
-{
-public:
- IAmCommandReceiverShadow();
- virtual ~IAmCommandReceiverShadow();
- void connect(DBusConnection *conn, DBusMessage *msg);
- void disconnect(DBusConnection *conn, DBusMessage *msg);
- void setVolume(DBusConnection *conn, DBusMessage *msg);
- void volumeStep(DBusConnection *conn, DBusMessage *msg);
- void setSinkMuteState(DBusConnection *conn, DBusMessage *msg);
- void setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg);
- void setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg);
- void setSystemProperty(DBusConnection *conn, DBusMessage *msg);
- void getListMainConnections(DBusConnection *conn, DBusMessage *msg);
- void getListMainSinks(DBusConnection *conn, DBusMessage *msg);
- void getListMainSources(DBusConnection *conn, DBusMessage *msg);
- void getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg);
- void getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg);
- void getListSourceClasses(DBusConnection *conn, DBusMessage *msg);
- void getListSinkClasses(DBusConnection *conn, DBusMessage *msg);
- void getListSystemProperties(DBusConnection *conn, DBusMessage *msg);
- void getTimingInformation(DBusConnection *conn, DBusMessage *msg);
- void getListSinkMainNotificationConfigurations(DBusConnection *conn, DBusMessage *msg);
- void getListSourceMainNotificationConfigurations(DBusConnection *conn, DBusMessage *msg);
- void setSinkMainNotificationConfiguration(DBusConnection *conn, DBusMessage *msg);
- void setSourceMainNotificationConfiguration(DBusConnection *conn, DBusMessage *msg);
-
- /**
- * sets the pointer to the CommandReceiveInterface and registers Callback
- * @param receiver
- */
- void setCommandReceiver(IAmCommandReceive*& receiver);
-private:
- typedef std::map<std::string, CallBackMethod> functionMap_t;
- functionMap_t mFunctionMap;
- CAmDbusMessageHandler mDBUSMessageHandler;
- IAmCommandReceive* mpIAmCommandReceive;
- CAmDbusWrapper* mpCAmDbusWrapper;
-
- /**
- * receives a callback whenever the path of the plugin is called
- */
- static DBusHandlerResult receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
-
- /**
- * dynamic delegate that handles the Callback of the static receiveCallback
- * @param conn DBus connection
- * @param msg DBus message
- * @param user_data pointer to instance of CommandReceiverShadow
- * @return
- */
- DBusHandlerResult receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg);
-
- /**
- * sends out introspectiondata read from an xml file.
- * @param conn
- * @param msg
- */
- void sendIntrospection(DBusConnection* conn, DBusMessage* msg);
-
- /**
- * creates the function map needed to combine DBus messages and function adresses
- * @return the map
- */
- functionMap_t createMap();
-};
-
-}
-
-#endif /* COMMANDRECEIVERSHADOW_H_ */
diff --git a/PluginCommandInterfaceDbus/include/configCommandDbus.h b/PluginCommandInterfaceDbus/include/configCommandDbus.h
deleted file mode 100644
index 8761936..0000000
--- a/PluginCommandInterfaceDbus/include/configCommandDbus.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _COMMANDDBUS_CONFIG_H
-#define _COMMANDDBUS_CONFIG_H
-
-#define COMMAND_DBUS_INTROSPECTION_FILE "/home/genius/workspace/AudioManager/bin/CommandInterface.xml"
-#define LIBRARY_OUTPUT_PATH "/home/genius/workspace/AudioManager/bin/plugins/command"
-
-#endif /* _COMMANDDBUS_CONFIG_H */
diff --git a/PluginCommandInterfaceDbus/src/CAmCommandSenderDbus.cpp b/PluginCommandInterfaceDbus/src/CAmCommandSenderDbus.cpp
deleted file mode 100644
index eebfc00..0000000
--- a/PluginCommandInterfaceDbus/src/CAmCommandSenderDbus.cpp
+++ /dev/null
@@ -1,401 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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/.
- */
-
-#include "CAmCommandSenderDbus.h"
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <cassert>
-#include <set>
-#include "CAmDbusMessageHandler.h"
-#include "shared/CAmDltWrapper.h"
-
-
-using namespace am;
-DLT_DECLARE_CONTEXT(commandDbus)
-
-
-/**
- * factory for plugin loading
- */
-extern "C" IAmCommandSend* PluginCommandInterfaceDbusFactory()
-{
- CAmDltWrapper::instance()->registerContext(commandDbus, "DBP", "DBus Plugin");
- return (new CAmCommandSenderDbus());
-}
-
-/**
- * destroy instance of commandSendInterface
- */
-extern "C" void destroyRoutingPluginInterfaceDbus(IAmCommandSend* commandSendInterface)
-{
- delete commandSendInterface;
-}
-
-CAmCommandSenderDbus::CAmCommandSenderDbus() :
- mCAmDbusMessageHandler(), //
- mIAmCommandReceiverShadow(), //
- mpCAmDbusWrapper(NULL), //
- mpIAmCommandReceive(NULL), //
- mReady(false)
-{
- log(&commandDbus, DLT_LOG_INFO, "DbusCommandSender constructor called");
-}
-
-CAmCommandSenderDbus::~CAmCommandSenderDbus()
-{
- log(&commandDbus, DLT_LOG_INFO, "DbusCommandSender destructed");
- CAmDltWrapper::instance()->unregisterContext(commandDbus);
-}
-
-am_Error_e CAmCommandSenderDbus::startupInterface(IAmCommandReceive* commandreceiveinterface)
-{
- log(&commandDbus, DLT_LOG_INFO, "startupInterface called");
-
- mpIAmCommandReceive = commandreceiveinterface;
- mIAmCommandReceiverShadow.setCommandReceiver(mpIAmCommandReceive);
- mpIAmCommandReceive->getDBusConnectionWrapper(mpCAmDbusWrapper);
- assert(mpCAmDbusWrapper!=NULL);
- DBusConnection * connection;
- mpCAmDbusWrapper->getDBusConnection(connection);
- assert(connection!=NULL);
- mCAmDbusMessageHandler.setDBusConnection(connection);
- return (E_OK);
-}
-
-void CAmCommandSenderDbus::setCommandReady(const uint16_t handle)
-{
- //todo:implement handle handling
- log(&commandDbus, DLT_LOG_INFO, "cbCommunicationReady called");
- mReady = true;
- mpIAmCommandReceive->confirmCommandReady(handle,E_OK);
-}
-
-void CAmCommandSenderDbus::setCommandRundown(const uint16_t handle)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbCommunicationRundown called");
- mReady = false;
- mpIAmCommandReceive->confirmCommandRundown(handle,E_OK);
- /**
- * todo: implement DbusCommandSender::cbCommunicationRundown()
- */
-}
-
-void CAmCommandSenderDbus::cbNewMainConnection(const am_MainConnectionType_s& mainConnection)
-{
- (void)mainConnection;
- //todo: change xml and interface to differetiate between new connection and removed one
- log(&commandDbus, DLT_LOG_INFO, "cbNumberOfMainConnectionsChanged called");
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfMainConnectionsChanged"));
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbRemovedMainConnection(const am_mainConnectionID_t mainConnection)
-{
- (void)mainConnection;
-//todo: change xml and interface to differetiate between new connection and removed one
- log(&commandDbus, DLT_LOG_INFO, "cbNumberOfMainConnectionsChanged called");
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfMainConnectionsChanged"));
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbNewSink(const am_SinkType_s& sink)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbNewSink called");
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), "SinkAdded");
- mCAmDbusMessageHandler.append(sink);
-
- log(&commandDbus, DLT_LOG_INFO, "send signal SinkAdded");
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbRemovedSink(const am_sinkID_t sinkID)
-{
- //todo: check if this really works!
- log(&commandDbus, DLT_LOG_INFO, "cbRemovedSink called");
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), "SinkRemoved");
- mCAmDbusMessageHandler.append(sinkID);
-
- log(&commandDbus, DLT_LOG_INFO, "send signal SinkRemoved");
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbNewSource(const am_SourceType_s& source)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbNewSource called");
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), "SourceAdded");
- mCAmDbusMessageHandler.append(source);
-
- log(&commandDbus, DLT_LOG_INFO, "send signal SourceAdded");
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void am::CAmCommandSenderDbus::cbRemovedSource(const am_sourceID_t source)
-{
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), "SourceRemoved");
- mCAmDbusMessageHandler.append(source);
-
- log(&commandDbus, DLT_LOG_INFO, "send signal SourceRemoved");
-
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbNumberOfSinkClassesChanged()
-{
- log(&commandDbus, DLT_LOG_INFO, "cbNumberOfSinkClassesChanged called");
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfSinkClassesChanged"));
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbNumberOfSourceClassesChanged()
-{
- log(&commandDbus, DLT_LOG_INFO, "cbNumberOfSourceClassesChanged called");
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfSourceClassesChanged"));
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbMainConnectionStateChanged called, connectionID=", connectionID, "connectionState=", connectionState);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("MainConnectionStateChanged"));
- mCAmDbusMessageHandler.append((dbus_uint16_t) connectionID);
- mCAmDbusMessageHandler.append((dbus_int16_t) connectionState);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbMainSinkSoundPropertyChanged called, sinkID", sinkID, "SoundProperty.type", soundProperty.type, "SoundProperty.value", soundProperty.value);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("MainSinkSoundPropertyChanged"));
- mCAmDbusMessageHandler.append((dbus_uint16_t) sinkID);
- mCAmDbusMessageHandler.append(soundProperty);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbMainSourceSoundPropertyChanged called, sourceID", sourceID, "SoundProperty.type", SoundProperty.type, "SoundProperty.value", SoundProperty.value);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("MainSourceSoundPropertyChanged"));
- mCAmDbusMessageHandler.append((dbus_uint16_t) sourceID);
- mCAmDbusMessageHandler.append(SoundProperty);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSinkAvailabilityChanged called, sinkID", sinkID, "availability.availability", availability.availability, "SoundProperty.reason", availability.availabilityReason);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkAvailabilityChanged"));
- mCAmDbusMessageHandler.append((dbus_uint16_t) sinkID);
- mCAmDbusMessageHandler.append(availability);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSourceAvailabilityChanged called, sourceID", sourceID, "availability.availability", availability.availability, "SoundProperty.reason", availability.availabilityReason);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SourceAvailabilityChanged"));
- mCAmDbusMessageHandler.append((dbus_uint16_t) sourceID);
- mCAmDbusMessageHandler.append(availability);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbVolumeChanged called, sinkID", sinkID, "volume", volume);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("VolumeChanged"));
- mCAmDbusMessageHandler.append((dbus_uint16_t) sinkID);
- mCAmDbusMessageHandler.append((dbus_int16_t) volume);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSinkMuteStateChanged called, sinkID", sinkID, "muteState", muteState);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkMuteStateChanged"));
- mCAmDbusMessageHandler.append((dbus_uint16_t) sinkID);
- mCAmDbusMessageHandler.append((dbus_int16_t) muteState);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::cbSystemPropertyChanged(const am_SystemProperty_s & SystemProperty)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSystemPropertyChanged called, SystemProperty.type", SystemProperty.type, "SystemProperty.value", SystemProperty.value);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SystemPropertyChanged"));
- mCAmDbusMessageHandler.append(SystemProperty);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void am::CAmCommandSenderDbus::cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbTimingInformationChanged called, mainConnectionID=", mainConnectionID, "time=", time);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("TimingInformationChanged"));
- mCAmDbusMessageHandler.append((dbus_uint16_t) mainConnectionID);
- mCAmDbusMessageHandler.append((dbus_int16_t) time);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void CAmCommandSenderDbus::getInterfaceVersion(std::string & version) const
-{
- version = CommandSendVersion;
-}
-
-void am::CAmCommandSenderDbus::cbSinkUpdated(const am_sinkID_t sinkID, const am_sinkClass_t sinkClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSinkUpdated called, sinkID", sinkID);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkUpdated"));
- mCAmDbusMessageHandler.append(static_cast<dbus_uint16_t>(sinkID));
- mCAmDbusMessageHandler.append(static_cast<dbus_uint16_t>(sinkClassID));
- mCAmDbusMessageHandler.append(listMainSoundProperties);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void am::CAmCommandSenderDbus::cbSourceUpdated(const am_sourceID_t sourceID, const am_sourceClass_t sourceClassID, const std::vector<am_MainSoundProperty_s>& listMainSoundProperties)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSourceUpdated called, sourceID", sourceID);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkUpdated"));
- mCAmDbusMessageHandler.append(static_cast<dbus_uint16_t>(sourceID));
- mCAmDbusMessageHandler.append(static_cast<dbus_uint16_t>(sourceClassID));
- mCAmDbusMessageHandler.append(listMainSoundProperties);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void am::CAmCommandSenderDbus::cbSinkNotification(const am_sinkID_t sinkID, const am_NotificationPayload_s& notification)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSinkNotification called, sinkID", sinkID);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkNotification"));
- mCAmDbusMessageHandler.append(static_cast<dbus_uint16_t>(sinkID));
- mCAmDbusMessageHandler.append(notification);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void am::CAmCommandSenderDbus::cbSourceNotification(const am_sourceID_t sourceID, const am_NotificationPayload_s& notification)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSourceNotification called, sourceID", sourceID);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SourceNotification"));
- mCAmDbusMessageHandler.append(static_cast<dbus_uint16_t>(sourceID));
- mCAmDbusMessageHandler.append(notification);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void am::CAmCommandSenderDbus::cbMainSinkNotificationConfigurationChanged(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSinkMainNotificationConfigurationChanged called, sinkID", sinkID);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkMainNotificationConfigurationChanged"));
- mCAmDbusMessageHandler.append(static_cast<dbus_uint16_t>(sinkID));
- mCAmDbusMessageHandler.append(mainNotificationConfiguration);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
-
-void am::CAmCommandSenderDbus::cbMainSourceNotificationConfigurationChanged(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSourceMainNotificationConfigurationChanged called, sourceID", sourceID);
-
- if (mReady)
- {
- mCAmDbusMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkMainNotificationConfigurationChanged"));
- mCAmDbusMessageHandler.append(static_cast<dbus_uint16_t>(sourceID));
- mCAmDbusMessageHandler.append(mainNotificationConfiguration);
- mCAmDbusMessageHandler.sendMessage();
- }
-}
diff --git a/PluginCommandInterfaceDbus/src/CAmDbusMessageHandler.cpp b/PluginCommandInterfaceDbus/src/CAmDbusMessageHandler.cpp
deleted file mode 100644
index 491239a..0000000
--- a/PluginCommandInterfaceDbus/src/CAmDbusMessageHandler.cpp
+++ /dev/null
@@ -1,709 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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/.
- */
-
-#include "CAmDbusMessageHandler.h"
-#include "config.h"
-#include <cstdlib>
-#include <cassert>
-#include <vector>
-#include "CAmCommandSenderDbus.h"
-#include "shared/CAmDltWrapper.h"
-
-DLT_IMPORT_CONTEXT(commandDbus)
-
-namespace am
-{
-
-CAmDbusMessageHandler::CAmDbusMessageHandler() :
- mDBusMessageIter(), //
- mDBusError(), //
- mSerial(0), //
- mErrorName(""), //
- mErrorMsg(""), //
- mpDBusMessage(NULL), //
- mpReveiveMessage(NULL), //
- mpDBusConnection(NULL)
-{
- // CAmDltWrapper::instance()->registerContext(commandDbus, "DBP", "DBus Plugin");
- log(&commandDbus, DLT_LOG_INFO, "DBusMessageHandler constructed");
-}
-
-CAmDbusMessageHandler::~CAmDbusMessageHandler()
-{
- log(&commandDbus, DLT_LOG_INFO, "DBUSMessageHandler destructed");
-}
-
-void CAmDbusMessageHandler::initReceive(DBusMessage* msg)
-{
- assert(msg!=NULL);
- mpReveiveMessage = msg;
- if (!dbus_message_iter_init(msg, &mDBusMessageIter))
- {
- log(&commandDbus, DLT_LOG_INFO, "DBusMessageHandler::initReceive DBus Message has no arguments!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBUS Message has no arguments!";
- }
-}
-
-void CAmDbusMessageHandler::initReply(DBusMessage* msg)
-{
- assert(msg!=NULL);
- mpDBusMessage = dbus_message_new_method_return(msg);
- if (mpDBusMessage == NULL)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::initReply Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
- dbus_message_iter_init_append(mpDBusMessage, &mDBusMessageIter);
-}
-
-void CAmDbusMessageHandler::initSignal(std::string path, std::string signalName)
-{
- assert(!path.empty());
- assert(!signalName.empty());
- std::string completePath = std::string(DBUS_SERVICE_OBJECT_PATH) + "/" + path;
- std::string completeInterface = std::string(DBUS_SERVICE_PREFIX) + "." + MY_NODE;
- mpDBusMessage = dbus_message_new_signal(completePath.c_str(), completeInterface.c_str(), signalName.c_str());
-
- if (mpDBusMessage == NULL)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::initSignal Cannot allocate DBus message!");
- }
- dbus_message_iter_init_append(mpDBusMessage, &mDBusMessageIter);
-}
-
-void CAmDbusMessageHandler::sendMessage()
-{
- assert(mpDBusConnection!=NULL);
- if (mpReveiveMessage != 0)
- {
- mSerial = dbus_message_get_serial(mpReveiveMessage);
- }
- else
- {
- mSerial = 1;
- }
- if (!mErrorName.empty())
- {
- mpDBusMessage = dbus_message_new_error(mpReveiveMessage, mErrorName.c_str(), mErrorMsg.c_str());
- }
- if (!dbus_connection_send(mpDBusConnection, mpDBusMessage, &mSerial))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::sendMessage cannot send message!");
- }
- dbus_connection_flush(mpDBusConnection);
- dbus_message_unref(mpDBusMessage);
- mpDBusMessage = NULL;
- mpReveiveMessage = NULL;
-}
-
-char* CAmDbusMessageHandler::getString()
-{
- char* param = NULL;
-
- if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&mDBusMessageIter))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::getString DBUS handler argument is no String!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBus argument is no string";
- }
- else
- {
- dbus_message_iter_get_basic(&mDBusMessageIter, &param);
- dbus_message_iter_next(&mDBusMessageIter);
- }
- return (param);
-}
-
-dbus_bool_t CAmDbusMessageHandler::getBool()
-{
- dbus_bool_t boolparam = false;
-
- if (DBUS_TYPE_BOOLEAN != dbus_message_iter_get_arg_type(&mDBusMessageIter))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::getBool DBUS handler argument is no bool!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBus argument is no bool";
- }
- else
- {
- dbus_message_iter_get_basic(&mDBusMessageIter, &boolparam);
- dbus_message_iter_next(&mDBusMessageIter);
- }
- return (boolparam);
-}
-
-char CAmDbusMessageHandler::getByte()
-{
- char param(0);
-
- if (DBUS_TYPE_BYTE != dbus_message_iter_get_arg_type(&mDBusMessageIter))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::getByte DBUS handler argument is no byte!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBus argument is no byte";
- }
- else
- {
- dbus_message_iter_get_basic(&mDBusMessageIter, &param);
- dbus_message_iter_next(&mDBusMessageIter);
- }
- return (param);
-}
-
-dbus_uint16_t CAmDbusMessageHandler::getUInt()
-{
- dbus_uint16_t param(0);
-
-#ifdef GLIB_DBUS_TYPES_TOLERANT
- if (DBUS_TYPE_UINT16 != dbus_message_iter_get_arg_type(&mDBusMessageIter) && DBUS_TYPE_UINT32 != dbus_message_iter_get_arg_type(&mDBusMessageIter))
-#else
- if (DBUS_TYPE_UINT16 != dbus_message_iter_get_arg_type(&mDBusMessageIter))
-#endif
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::getUInt DBUS handler argument is no uint16_t!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBus argument is no uint16_t";
- }
- else
- {
- dbus_message_iter_get_basic(&mDBusMessageIter, &param);
- dbus_message_iter_next(&mDBusMessageIter);
- }
- return (param);
-}
-
-dbus_int16_t CAmDbusMessageHandler::getInt()
-{
- dbus_int16_t param(0);
-
-#ifdef GLIB_DBUS_TYPES_TOLERANT
- if (DBUS_TYPE_INT16 != dbus_message_iter_get_arg_type(&mDBusMessageIter) && DBUS_TYPE_INT32 != dbus_message_iter_get_arg_type(&mDBusMessageIter))
-#else
- if (DBUS_TYPE_INT16 != dbus_message_iter_get_arg_type(&mDBusMessageIter))
-#endif
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::getInt DBUS handler argument is no int16_t!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBus argument is no int16_t";
- }
- else
- {
- dbus_message_iter_get_basic(&mDBusMessageIter, &param);
- dbus_message_iter_next(&mDBusMessageIter);
- }
- return (param);
-}
-
-double CAmDbusMessageHandler::getDouble()
-{
- double param(0);
- if (DBUS_TYPE_DOUBLE != dbus_message_iter_get_arg_type(&mDBusMessageIter))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::getDouble DBUS handler argument is no double!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBus argument is no double";
- }
- else
- {
- dbus_message_iter_get_basic(&mDBusMessageIter, &param);
- dbus_message_iter_next(&mDBusMessageIter);
- }
- return (param);
-}
-
-void CAmDbusMessageHandler::getProperty(dbus_int16_t & type, dbus_int16_t & value)
-{
- DBusMessageIter arrayIter;
- if (DBUS_TYPE_STRUCT != dbus_message_iter_get_arg_type(&mDBusMessageIter))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::getProperty DBUS handler argument is no array!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBus argument is no array";
- }
- else
- {
- dbus_message_iter_recurse(&mDBusMessageIter, &arrayIter);
- dbus_message_iter_get_basic(&arrayIter, &type);
- dbus_message_iter_next(&arrayIter);
- dbus_message_iter_get_basic(&arrayIter, &value);
- dbus_message_iter_next(&mDBusMessageIter);
- }
-}
-
-void CAmDbusMessageHandler::append(bool toAppend)
-{
- dbus_bool_t mybool = toAppend;
- if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_BOOLEAN, &mybool))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(double toAppend)
-{
- if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_DOUBLE, &toAppend))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(char toAppend)
-{
- if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_BYTE, &toAppend))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(dbus_int16_t toAppend)
-{
- if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_INT16, &toAppend))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(dbus_uint16_t toAppend)
-{
- if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_UINT16, &toAppend))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::setDBusConnection(DBusConnection *& connection)
-{
- assert(connection!=NULL);
- mpDBusConnection = connection;
-}
-
-void CAmDbusMessageHandler::append(const am::am_SinkType_s& sinkType)
-{
- DBusMessageIter structIter;
- DBusMessageIter structAvailIter;
- dbus_bool_t success = true;
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sinkType.sinkID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &sinkType.name);
-
- success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &structAvailIter);
- success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sinkType.availability.availability);
- success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sinkType.availability.availabilityReason);
- success = success && dbus_message_iter_close_container(&structIter, &structAvailIter);
-
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &sinkType.volume);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &sinkType.muteState);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sinkType.sinkClassID);
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const am::am_SourceType_s & sourceType)
-{
- DBusMessageIter structIter;
- DBusMessageIter structAvailIter;
- dbus_bool_t success = true;
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sourceType.sourceID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &sourceType.name);
-
- success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &structAvailIter);
- success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sourceType.availability.availability);
- success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sourceType.availability.availabilityReason);
- success = success && dbus_message_iter_close_container(&structIter, &structAvailIter);
-
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sourceType.sourceClassID);
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const am::am_MainSoundProperty_s mainSoundProperty)
-{
- DBusMessageIter structIter;
- dbus_bool_t success = true;
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &mainSoundProperty.type);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &mainSoundProperty.value);
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const am::am_Availability_s & availability)
-{
- DBusMessageIter structAvailIter;
- dbus_bool_t success = true;
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structAvailIter);
- success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &availability.availability);
- success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &availability.availabilityReason);
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structAvailIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const am::am_SystemProperty_s & SystemProperty)
-{
- DBusMessageIter structIter;
- dbus_bool_t success = true;
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &SystemProperty.type);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &SystemProperty.value);
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const std::vector<am::am_MainConnectionType_s>& listMainConnections)
-{
- DBusMessageIter arrayIter;
- DBusMessageIter structIter;
- std::vector<am::am_MainConnectionType_s>::const_iterator listIterator = listMainConnections.begin();
- dbus_bool_t success = true;
-
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qqqnn)", &arrayIter);
- for (; listIterator < listMainConnections.end(); ++listIterator)
- {
- success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->mainConnectionID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->delay);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->connectionState);
- success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const std::vector<am::am_SinkType_s> & listMainSinks)
-{
- DBusMessageIter arrayIter;
- DBusMessageIter structIter;
- DBusMessageIter availIter;
- std::vector<am::am_SinkType_s>::const_iterator listIterator = listMainSinks.begin();
- dbus_bool_t success = true;
-
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qs(nn)nnq)", &arrayIter);
- for (; listIterator < listMainSinks.end(); ++listIterator)
- {
- success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
- success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &availIter);
- success = success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availability);
- success = success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availabilityReason);
- success = success && dbus_message_iter_close_container(&structIter, &availIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->volume);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->muteState);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkClassID);
- success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const std::vector<am::am_SourceType_s> & listMainSources)
-{
- DBusMessageIter arrayIter;
- DBusMessageIter structIter;
- DBusMessageIter availIter;
- std::vector<am::am_SourceType_s>::const_iterator listIterator = listMainSources.begin();
- dbus_bool_t success = true;
-
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qs(nn)q)", &arrayIter);
- for (; listIterator < listMainSources.end(); ++listIterator)
- {
- success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
- success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &availIter);
- success = success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availability);
- success = success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availabilityReason);
- success = success && dbus_message_iter_close_container(&structIter, &availIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceClassID);
- success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const std::vector<am::am_MainSoundProperty_s> & listMainSoundProperties)
-{
- DBusMessageIter arrayIter;
- DBusMessageIter structIter;
- std::vector<am::am_MainSoundProperty_s>::const_iterator listIterator = listMainSoundProperties.begin();
- dbus_bool_t success = true;
-
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(nn)", &arrayIter);
- for (; listIterator < listMainSoundProperties.end(); ++listIterator)
- {
- success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->type);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->value);
- success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const std::vector<am::am_SourceClass_s> & listSourceClasses)
-{
- DBusMessageIter arrayIter;
- DBusMessageIter structIter;
- DBusMessageIter propIter;
- DBusMessageIter innerIter;
- std::vector<am::am_SourceClass_s>::const_iterator listIterator = listSourceClasses.begin();
- dbus_bool_t success = true;
-
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qsa(nn))", &arrayIter);
- for (; listIterator < listSourceClasses.end(); ++listIterator)
- {
- success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceClassID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
- success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_ARRAY, "(nn)", &innerIter);
-
- std::vector<am::am_ClassProperty_s>::const_iterator listInnerIterator = listIterator->listClassProperties.begin();
- for (; listInnerIterator < listIterator->listClassProperties.end(); ++listInnerIterator)
- {
- success = success && dbus_message_iter_open_container(&innerIter, DBUS_TYPE_STRUCT, NULL, &propIter);
- success = success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->classProperty);
- success = success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->value);
- success = success && dbus_message_iter_close_container(&innerIter, &propIter);
- }
- success = success && dbus_message_iter_close_container(&structIter, &innerIter);
- success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const std::vector<am::am_SinkClass_s> & listSinkClasses)
-{
- DBusMessageIter arrayIter;
- DBusMessageIter structIter;
- DBusMessageIter propIter;
- DBusMessageIter innerIter;
- std::vector<am::am_SinkClass_s>::const_iterator listIterator = listSinkClasses.begin();
- dbus_bool_t success = true;
-
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qsa(nn))", &arrayIter);
- for (; listIterator < listSinkClasses.end(); ++listIterator)
- {
- success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkClassID);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
- success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_ARRAY, "(nn)", &innerIter);
-
- std::vector<am::am_ClassProperty_s>::const_iterator listInnerIterator = listIterator->listClassProperties.begin();
- for (; listInnerIterator < listIterator->listClassProperties.end(); ++listInnerIterator)
- {
- success = success && dbus_message_iter_open_container(&innerIter, DBUS_TYPE_STRUCT, NULL, &propIter);
- success = success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->classProperty);
- success = success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->value);
- success = success && dbus_message_iter_close_container(&innerIter, &propIter);
- }
- success = success && dbus_message_iter_close_container(&structIter, &innerIter);
- success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const std::vector<am::am_SystemProperty_s> & listSystemProperties)
-{
- DBusMessageIter arrayIter;
- DBusMessageIter structIter;
- std::vector<am::am_SystemProperty_s>::const_iterator listIterator = listSystemProperties.begin();
- dbus_bool_t success = true;
-
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(nn)", &arrayIter);
- for (; listIterator < listSystemProperties.end(); ++listIterator)
- {
- success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->type);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->value);
- success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::getNotificationConfiguration(dbus_int16_t& type, dbus_int16_t& status, dbus_int16_t& parameter)
-{
- DBusMessageIter arrayIter;
- if (DBUS_TYPE_STRUCT != dbus_message_iter_get_arg_type(&mDBusMessageIter))
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::getProperty DBUS handler argument is no array!");
- mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg = "DBus argument is no array";
- }
- else
- {
- dbus_message_iter_recurse(&mDBusMessageIter, &arrayIter);
- dbus_message_iter_get_basic(&arrayIter, &type);
- dbus_message_iter_next(&arrayIter);
- dbus_message_iter_get_basic(&arrayIter, &status);
- dbus_message_iter_next(&arrayIter);
- dbus_message_iter_get_basic(&arrayIter, &parameter);
- dbus_message_iter_next(&mDBusMessageIter);
- }
-}
-
-void CAmDbusMessageHandler::append(const std::vector<am::am_NotificationConfiguration_s>& listNotifications)
-{
- DBusMessageIter arrayIter;
- DBusMessageIter structIter;
- std::vector<am::am_NotificationConfiguration_s>::const_iterator listIterator = listNotifications.begin();
- dbus_bool_t success = true;
-
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(nnn)", &arrayIter);
- for (; listIterator < listNotifications.end(); ++listIterator)
- {
- success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->type);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->status);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->parameter);
- success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const am::am_NotificationPayload_s& notificationPayload)
-{
- DBusMessageIter structIter;
- dbus_bool_t success = true;
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &notificationPayload.type);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &notificationPayload.value);
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-void CAmDbusMessageHandler::append(const am::am_NotificationConfiguration_s& notificationConfiguration)
-{
- DBusMessageIter structIter;
- dbus_bool_t success = true;
- success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &notificationConfiguration.type);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &notificationConfiguration.status);
- success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &notificationConfiguration.parameter);
- success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
-
- if (!success)
- {
- log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::append Cannot allocate DBus message!");
- mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg = "Cannot create reply!";
- }
-}
-
-}
diff --git a/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp b/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp
deleted file mode 100644
index 11cacb4..0000000
--- a/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp
+++ /dev/null
@@ -1,526 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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/.
- */
-
-#include "IAmCommandReceiverShadow.h"
-#include <string>
-#include <fstream>
-#include <stdexcept>
-#include <cassert>
-#include "audiomanagertypes.h"
-#include "CAmCommandSenderDbus.h"
-#include "shared/CAmDltWrapper.h"
-#include "configCommandDbus.h"
-
-using namespace am;
-
-DLT_IMPORT_CONTEXT(commandDbus)
-
-/**
- * static ObjectPathTable is needed for DBus Callback handling
- */
-static DBusObjectPathVTable gObjectPathVTable;
-
-IAmCommandReceiverShadow::IAmCommandReceiverShadow() :
- mFunctionMap(createMap()), //
- mDBUSMessageHandler(), //
- mpIAmCommandReceive(NULL), //
- mpCAmDbusWrapper(NULL)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow constructed");
-}
-
-IAmCommandReceiverShadow::~IAmCommandReceiverShadow()
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow destructed");
-}
-
-void IAmCommandReceiverShadow::connect(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::connect called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sourceID_t sourceID = (am_sourceID_t) mDBUSMessageHandler.getUInt();
- am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
- am_mainConnectionID_t mainConnectionID = 0;
- am_Error_e returnCode = mpIAmCommandReceive->connect(sourceID, sinkID, mainConnectionID);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append((dbus_uint16_t) mainConnectionID);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::disconnect(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::disconnect called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_mainConnectionID_t mainConnnectionID = (am_mainConnectionID_t) mDBUSMessageHandler.getUInt();
- am_Error_e returnCode = mpIAmCommandReceive->disconnect(mainConnnectionID);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::setVolume(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setVolume called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
- am_volume_t volume = (am_volume_t) mDBUSMessageHandler.getInt();
- am_Error_e returnCode = mpIAmCommandReceive->setVolume(sinkID, volume);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::volumeStep(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::volumeStep called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
- int16_t volumeStep = (int16_t) mDBUSMessageHandler.getInt();
- am_Error_e returnCode = mpIAmCommandReceive->volumeStep(sinkID, volumeStep);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::setSinkMuteState(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setSinkMuteState called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
- am_MuteState_e muteState = (am_MuteState_e) mDBUSMessageHandler.getInt();
- am_Error_e returnCode = mpIAmCommandReceive->setSinkMuteState(sinkID, muteState);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setMainSinkSoundProperty called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
- dbus_int16_t type = 0;
- dbus_int16_t value = 0;
- mDBUSMessageHandler.getProperty(type, value);
- am_MainSoundProperty_s mainSoundProperty;
- mainSoundProperty.type = (am_CustomMainSoundPropertyType_t) type;
- mainSoundProperty.value = (int32_t) value;
- am_Error_e returnCode = mpIAmCommandReceive->setMainSinkSoundProperty(mainSoundProperty, sinkID);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setMainSourceSoundProperty called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sourceID_t sourceID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
- dbus_int16_t type = 0;
- dbus_int16_t value = 0;
- mDBUSMessageHandler.getProperty(type, value);
- am_MainSoundProperty_s mainSoundProperty;
- mainSoundProperty.type = (am_CustomMainSoundPropertyType_t) type;
- mainSoundProperty.value = (int32_t) value;
- am_Error_e returnCode = mpIAmCommandReceive->setMainSourceSoundProperty(mainSoundProperty, sourceID);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::setSystemProperty(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setSystemProperty called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- dbus_int16_t type = 0;
- dbus_int16_t value = 0;
- mDBUSMessageHandler.getProperty(type, value);
- am_SystemProperty_s systemProperty;
- systemProperty.type = (am_CustomSystemPropertyType_t) type;
- systemProperty.value = (int32_t) value;
- am_Error_e returnCode = mpIAmCommandReceive->setSystemProperty(systemProperty);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getListMainConnections(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainConnections called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
- std::vector<am_MainConnectionType_s> listMainConnections;
- am_Error_e returnCode = mpIAmCommandReceive->getListMainConnections(listMainConnections);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listMainConnections);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getListMainSinks(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainSinks called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
- std::vector<am_SinkType_s> listSinks;
- am_Error_e returnCode = mpIAmCommandReceive->getListMainSinks(listSinks);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listSinks);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getListMainSources(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainSources called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
- std::vector<am_SourceType_s> listSources;
- am_Error_e returnCode = mpIAmCommandReceive->getListMainSources(listSources);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listSources);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainSinkSoundProperties called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
- std::vector<am_MainSoundProperty_s> listSinkSoundProperties;
- am_Error_e returnCode = mpIAmCommandReceive->getListMainSinkSoundProperties(sinkID, listSinkSoundProperties);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listSinkSoundProperties);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainSourceSoundProperties called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sourceID_t sourceID = (am_sourceID_t) mDBUSMessageHandler.getUInt();
- std::vector<am_MainSoundProperty_s> listSinkSoundProperties;
- am_Error_e returnCode = mpIAmCommandReceive->getListMainSourceSoundProperties(sourceID, listSinkSoundProperties);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listSinkSoundProperties);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getListSourceClasses(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListSourceClasses called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
- std::vector<am_SourceClass_s> listSourceClasses;
- am_Error_e returnCode = mpIAmCommandReceive->getListSourceClasses(listSourceClasses);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listSourceClasses);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getListSinkClasses(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListSinkClasses called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
- std::vector<am_SinkClass_s> listSinkClasses;
- am_Error_e returnCode = mpIAmCommandReceive->getListSinkClasses(listSinkClasses);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listSinkClasses);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getListSystemProperties(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListSystemProperties called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
- std::vector<am_SystemProperty_s> listSystemProperties;
- am_Error_e returnCode = mpIAmCommandReceive->getListSystemProperties(listSystemProperties);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listSystemProperties);
- mDBUSMessageHandler.sendMessage();
-}
-
-void IAmCommandReceiverShadow::getTimingInformation(DBusConnection *conn, DBusMessage *msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getTimingInformation called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_mainConnectionID_t mainConnectionID = (am_mainConnectionID_t) mDBUSMessageHandler.getUInt();
- am_timeSync_t delay = 0;
- am_Error_e returnCode = mpIAmCommandReceive->getTimingInformation(mainConnectionID, delay);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append((dbus_int16_t) delay);
- mDBUSMessageHandler.sendMessage();
-}
-
-DBusHandlerResult IAmCommandReceiverShadow::receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data)
-{
- assert(conn!=NULL);
- assert(msg!=NULL);
- assert(user_data!=NULL);
- IAmCommandReceiverShadow* reference = (IAmCommandReceiverShadow*) user_data;
- return (reference->receiveCallbackDelegate(conn, msg));
-}
-
-void IAmCommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessage *msg)
-{
- assert(conn!=NULL);
- assert(msg!=NULL);
- DBusMessage* reply;
- DBusMessageIter args;
- dbus_uint32_t serial = 0;
-
- // create a reply from the message
- reply = dbus_message_new_method_return(msg);
- std::string fullpath(COMMAND_DBUS_INTROSPECTION_FILE);
- std::ifstream in(fullpath.c_str(), std::ifstream::in);
- if (!in)
- {
- logError("IAmCommandReceiverShadow::sendIntrospection could not load xml file ",fullpath);
- throw std::runtime_error("IAmCommandReceiverShadow::sendIntrospection Could not load introspecton XML");
- }
- std::string introspect((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
- const char* string = introspect.c_str();
-
- // add the arguments to the reply
- dbus_message_iter_init_append(reply, &args);
- if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &string))
- {
- // DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBUS handler Out Of Memory!"));
- }
-
- // send the reply && flush the connection
- if (!dbus_connection_send(conn, reply, &serial))
- {
- // DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBUS handler Out Of Memory!"));
- }
- dbus_connection_flush(conn);
-
- // free the reply
- dbus_message_unref(reply);
-}
-
-DBusHandlerResult IAmCommandReceiverShadow::receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg)
-{
- //DLT_LOG(dMain, DLT_LOG_INFO, DLT_STRING("message received"));
-
- if (dbus_message_is_method_call(msg, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- {
- sendIntrospection(conn, msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- functionMap_t::iterator iter = mFunctionMap.begin();
- std::string k(dbus_message_get_member(msg));
- iter = mFunctionMap.find(k);
- if (iter != mFunctionMap.end())
- {
- std::string p(iter->first);
- CallBackMethod cb = iter->second;
- (this->*cb)(conn, msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
-
- return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
-}
-
-void IAmCommandReceiverShadow::setCommandReceiver(IAmCommandReceive*& receiver)
-{
- assert(receiver!=NULL);
- mpIAmCommandReceive = receiver;
-
- gObjectPathVTable.message_function = IAmCommandReceiverShadow::receiveCallback;
-
- DBusConnection* connection;
- mpIAmCommandReceive->getDBusConnectionWrapper(mpCAmDbusWrapper);
- assert(mpCAmDbusWrapper!=NULL);
-
- mpCAmDbusWrapper->getDBusConnection(connection);
- assert(connection!=NULL);
- mDBUSMessageHandler.setDBusConnection(connection);
-
- std::string path(MY_NODE);
- mpCAmDbusWrapper->registerCallback(&gObjectPathVTable, path, this);
-}
-
-void am::IAmCommandReceiverShadow::getListSinkMainNotificationConfigurations(DBusConnection* conn, DBusMessage* msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListSinkMainNotificationConfigurations called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID = static_cast<am_sinkID_t>(mDBUSMessageHandler.getUInt());
- std::vector<am_NotificationConfiguration_s> listNotificationConfigurations;
- am_Error_e returnCode = mpIAmCommandReceive->getListMainSinkNotificationConfigurations(sinkID,listNotificationConfigurations);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listNotificationConfigurations);
- mDBUSMessageHandler.sendMessage();
-}
-
-void am::IAmCommandReceiverShadow::getListSourceMainNotificationConfigurations(DBusConnection* conn, DBusMessage* msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListSourceMainNotificationConfigurations called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sourceID_t sourceID = static_cast<am_sourceID_t>(mDBUSMessageHandler.getUInt());
- std::vector<am_NotificationConfiguration_s> listNotificationConfigurations;
- am_Error_e returnCode = mpIAmCommandReceive->getListMainSourceNotificationConfigurations(sourceID,listNotificationConfigurations);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.append(listNotificationConfigurations);
- mDBUSMessageHandler.sendMessage();
-
-}
-
-void am::IAmCommandReceiverShadow::setSinkMainNotificationConfiguration(DBusConnection* conn, DBusMessage* msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setSinkMainNotificationConfiguration called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
- dbus_int16_t type = 0;
- dbus_int16_t status = 0;
- dbus_int16_t parameter = 0;
- mDBUSMessageHandler.getNotificationConfiguration(type, status, parameter);
- am_NotificationConfiguration_s mainNotificationConfiguration;
- mainNotificationConfiguration.type = static_cast<am_CustomNotificationType_t> (type);
- mainNotificationConfiguration.status = static_cast<am_NotificationStatus_e> (status);
- mainNotificationConfiguration.parameter = static_cast<int16_t>(parameter);
- am_Error_e returnCode = mpIAmCommandReceive->setMainSinkNotificationConfiguration(sinkID,mainNotificationConfiguration);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-void am::IAmCommandReceiverShadow::setSourceMainNotificationConfiguration(DBusConnection* conn, DBusMessage* msg)
-{
- log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setSourceMainNotificationConfiguration called");
-
- (void) conn;
- assert(mpIAmCommandReceive!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sourceID_t sourceID = (am_sourceID_t) mDBUSMessageHandler.getUInt();
- dbus_int16_t type = 0;
- dbus_int16_t status = 0;
- dbus_int16_t parameter = 0;
- mDBUSMessageHandler.getNotificationConfiguration(type, status, parameter);
- am_NotificationConfiguration_s mainNotificationConfiguration;
- mainNotificationConfiguration.type = static_cast<am_CustomNotificationType_t> (type);
- mainNotificationConfiguration.status = static_cast<am_NotificationStatus_e> (status);
- mainNotificationConfiguration.parameter = static_cast<int16_t>(parameter);
- am_Error_e returnCode = mpIAmCommandReceive->setMainSourceNotificationConfiguration(sourceID,mainNotificationConfiguration);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t) returnCode);
- mDBUSMessageHandler.sendMessage();
-}
-
-IAmCommandReceiverShadow::functionMap_t IAmCommandReceiverShadow::createMap()
-{
- functionMap_t m;
- m["Connect"] = &IAmCommandReceiverShadow::connect;
- m["Disconnect"] = &IAmCommandReceiverShadow::disconnect;
- m["SetVolume"] = &IAmCommandReceiverShadow::setVolume;
- m["VolumeStep"] = &IAmCommandReceiverShadow::volumeStep;
- m["SetSinkMuteState"] = &IAmCommandReceiverShadow::setSinkMuteState;
- m["SetMainSinkSoundProperty"] = &IAmCommandReceiverShadow::setMainSinkSoundProperty;
- m["SetMainSourceSoundProperty"] = &IAmCommandReceiverShadow::setMainSourceSoundProperty;
- m["GetListMainConnections"] = &IAmCommandReceiverShadow::getListMainConnections;
- m["GetListMainSinks"] = &IAmCommandReceiverShadow::getListMainSinks;
- m["GetListMainSources"] = &IAmCommandReceiverShadow::getListMainSources;
- m["GetListMainSinkSoundProperties"] = &IAmCommandReceiverShadow::getListMainSinkSoundProperties;
- m["GetListMainSourceSoundProperties"] = &IAmCommandReceiverShadow::getListMainSourceSoundProperties;
- m["GetListSourceClasses"] = &IAmCommandReceiverShadow::getListSourceClasses;
- m["GetListSinkClasses"] = &IAmCommandReceiverShadow::getListSinkClasses;
- m["GetListSystemProperties"] = &IAmCommandReceiverShadow::getListSystemProperties;
- m["GetTimingInformation"] = &IAmCommandReceiverShadow::getTimingInformation;
- m["SetSystemProperty"] = &IAmCommandReceiverShadow::setSystemProperty;
- m["getListSinkMainNotificationConfigurations"] = &IAmCommandReceiverShadow::getListSinkMainNotificationConfigurations;
- m["getListSourceMainNotificationConfigurations"] = &IAmCommandReceiverShadow::getListSourceMainNotificationConfigurations;
- m["setSinkMainNotificationConfiguration"] = &IAmCommandReceiverShadow::setSinkMainNotificationConfiguration;
- m["setSourceMainNotificationConfiguration"] = & IAmCommandReceiverShadow::setSourceMainNotificationConfiguration;
- return (m);
-}
-
diff --git a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.cpp b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.cpp
deleted file mode 100644
index f97c7b6..0000000
--- a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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/.
- */
-
-#include "CAmCommandSenderDbusBackdoor.h"
-#include "command/IAmCommandReceive.h"
-
-
-using namespace am;
-
-CAmCommandSenderDbusBackdoor::CAmCommandSenderDbusBackdoor()
-{
-}
-
-CAmCommandSenderDbusBackdoor::~CAmCommandSenderDbusBackdoor()
-{
-}
-
-void CAmCommandSenderDbusBackdoor::setReceiveInterface(CAmCommandSenderDbus *sender, IAmCommandReceive* interface)
-{
- sender->mpIAmCommandReceive=interface;
-}
-
-void CAmCommandSenderDbusBackdoor::setDbusConnection(CAmCommandSenderDbus *sender, DBusConnection *conn)
-{
- sender->mCAmDbusMessageHandler.setDBusConnection(conn);
-}
-
-void CAmCommandSenderDbusBackdoor::setListSinks(CAmCommandSenderDbus *sender, std::vector<am_SinkType_s> newList)
-{
- sender->mlistSinks=newList;
-}
-
-void CAmCommandSenderDbusBackdoor::setListSources(CAmCommandSenderDbus *sender, std::vector<am_SourceType_s> newList)
-{
- sender->mlistSources=newList;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.h b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.h
deleted file mode 100644
index 9aec152..0000000
--- a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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 DBUSCOMMANDINTERFACEBACKDOOR_H_
-#define DBUSCOMMANDINTERFACEBACKDOOR_H_
-
-#include "../include/CAmCommandSenderDbus.h"
-#include <vector>
-#include <dbus/dbus.h>
-#include "audiomanagertypes.h"
-#include "command/IAmCommandReceive.h"
-
-namespace am {
-
-class CAmCommandSenderDbus;
-
-class CAmCommandSenderDbusBackdoor
-{
-public:
- CAmCommandSenderDbusBackdoor();
- virtual ~CAmCommandSenderDbusBackdoor();
- void setReceiveInterface(CAmCommandSenderDbus *sender, IAmCommandReceive* interface);
- void setDbusConnection(CAmCommandSenderDbus *sender,DBusConnection *conn);
- void setListSinks(CAmCommandSenderDbus *sender, std::vector<am_SinkType_s> newList);
- void setListSources(CAmCommandSenderDbus *sender, std::vector<am_SourceType_s> newList);
-};
-
-}
-
-#endif /* DBUSCOMMANDINTERFACEBACKDOOR_H_ */
diff --git a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.cpp b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.cpp
deleted file mode 100644
index e0d2b97..0000000
--- a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.cpp
+++ /dev/null
@@ -1,803 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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/.
- */
-
-#include "CAmCommandSenderDbusSignalTest.h"
-#include <Python.h>
-#include <iostream>
-#include <fstream>
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <set>
-#include "CAmCommandSenderDbusBackdoor.h"
-#include "MockIAmCommandReceive.h"
-#include "../include/CAmCommandSenderDbus.h"
-#include "../include/CAmDbusMessageHandler.h"
-#include "../../AudioManagerDaemon/include/TAmPluginTemplate.h"
-#include "shared/CAmDltWrapper.h"
-#include "configCommandDbus.h"
-
-using namespace am;
-using namespace testing;
-
-CAmCommandSenderDbusSignalTest::CAmCommandSenderDbusSignalTest() :
- ppCommandSend(NULL) //
-{
- CAmDltWrapper::instance()->registerApp("dbusTest", "dbusTest");
- logInfo("dbusCommandInterfaceSignalTest started");
-}
-
-CAmCommandSenderDbusSignalTest::~CAmCommandSenderDbusSignalTest()
-{
-}
-
-void* NumberOfMainConnectionsChanged(void* ppCommandSend)
-{
- sleep(3);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_MainConnectionType_s mainConnection;
- sender->cbNewMainConnection(mainConnection);
- return (NULL);
-}
-
-void* cbSinkAdded(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- std::vector<am_SinkType_s> list;
- am_SinkType_s mysink;
- mysink.name = "MySink";
- mysink.sinkID = 23;
- mysink.availability.availability = A_MAX;
- mysink.availability.availabilityReason = AR_UNKNOWN;
- mysink.muteState = MS_UNKNOWN;
- mysink.sinkClassID = 3;
- mysink.volume = 234;
- sender->cbNewSink(mysink);
- return (NULL);
-}
-
-void* cbSourceAdded(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_SourceType_s mysource;
- mysource.name = "MySink";
- mysource.sourceID = 42;
- mysource.availability.availability = A_MAX;
- mysource.availability.availabilityReason = AR_UNKNOWN;
- mysource.sourceClassID = 15;
- sender->cbNewSource(mysource);
- return (NULL);
-}
-
-void* cbSourceRemoved(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_SourceType_s mysource;
- mysource.name = "MySink";
- mysource.sourceID = 42;
- sender->cbRemovedSource(mysource.sourceID);
- return (NULL);
-}
-
-void* cbSinkRemoved(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_SinkType_s mysink;
- mysink.name = "MySink";
- mysink.sinkID = 23;
- sender->cbRemovedSink(mysink.sinkID);
- return (NULL);
-}
-
-void* NumberOfSinkClassesChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- sender->cbNumberOfSinkClassesChanged();
- return (NULL);
-}
-
-void* NumberOfSourceClassesChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- sender->cbNumberOfSourceClassesChanged();
- return (NULL);
-}
-
-void* MainConnectionStateChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_connectionID_t id = 4;
- am_ConnectionState_e state = CS_CONNECTING;
- sender->cbMainConnectionStateChanged(id, state);
- return (NULL);
-}
-
-void* MainSinkSoundPropertyChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_sinkID_t sinkID = 3;
- am_MainSoundProperty_s soundProperty;
- soundProperty.type = MSP_UNKNOWN;
- soundProperty.value = 23;
- sender->cbMainSinkSoundPropertyChanged(sinkID, soundProperty);
- return (NULL);
-}
-
-void* MainSourceSoundPropertyChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_sourceID_t sourceID = 35;
- am_MainSoundProperty_s soundProperty;
- soundProperty.type = MSP_UNKNOWN;
- soundProperty.value = 233;
- sender->cbMainSourceSoundPropertyChanged(sourceID, soundProperty);
- return (NULL);
-}
-
-void* cbSinkAvailabilityChangedLoop(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_Availability_s av;
- av.availability = A_AVAILABLE;
- av.availabilityReason = AR_UNKNOWN;
- sender->cbSinkAvailabilityChanged(4, av);
- return (NULL);
-}
-
-void* VolumeChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_volume_t volume = 344;
- sender->cbVolumeChanged(23, volume);
- return (NULL);
-}
-
-void* cbSourceAvailabilityChangedLoop(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_Availability_s av;
- av.availability = A_AVAILABLE;
- av.availabilityReason = AR_UNKNOWN;
- sender->cbSourceAvailabilityChanged(2, av);
- return (NULL);
-}
-
-void* SinkMuteStateChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- sender->cbSinkMuteStateChanged(42, MS_MUTED);
- return (NULL);
-}
-
-void* SystemPropertyChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- am_SystemProperty_s property;
- property.type = SYP_UNKNOWN;
- property.value = 355;
- sender->cbSystemPropertyChanged(property);
- return (NULL);
-}
-
-void* TimingInformationChanged(void* ppCommandSend)
-{
- sleep(1);
- IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
- sender->cbTimingInformationChanged(42, 233);
- return (NULL);
-}
-
-TEST_F(CAmCommandSenderDbusSignalTest,cbSourceAvailabilityChanged)
-{
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- CAmSocketHandler pSocketHandler;
- CAmDbusWrapper pDBusWrapper(&pSocketHandler);
- MockIAmCommandReceive pReceiveInterface;
-
- IAmCommandSend* (*createFunc)();
- void* tempLibHandle = NULL;
- std::string libname(LIBRARY_OUTPUT_PATH);
- libname.append("/libPluginCommandInterfaceDbus.so");
- createFunc = getCreateFunction<IAmCommandSend*()>(libname, tempLibHandle);
-
- if (!createFunc)
- {
- logError("CommandSendInterface Test Entry point of CommandPlugin not found");
- exit(1);
- }
-
- ppCommandSend = createFunc();
-
- if (!ppCommandSend)
- {
- logError("CommandSendInterface Test CommandPlugin initialization failed. Entry Function not callable");
- exit(1);
- }
-
- // ok, here we give the DBusWrapper pointer to the Plugin and start the interface
- EXPECT_CALL(pReceiveInterface,getDBusConnectionWrapper(_)).WillRepeatedly(DoAll(SetArgReferee<0>(&pDBusWrapper), Return(E_OK)));
- EXPECT_CALL(pReceiveInterface, confirmCommandReady(10,_));
-
- ppCommandSend->startupInterface(&pReceiveInterface);
- ppCommandSend->setCommandReady(10);
-
- pthread_t pythonloop;
- pthread_create(&pythonloop, NULL, NumberOfMainConnectionsChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "print('Started thread') \n"
- "loop = gobject.MainLoop()\n"
- "def catchsignal(*arg, **kwarg):\n"
- " print ('Caught NumberOfMainConnectionsChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchsignal, signal_name='NumberOfMainConnectionsChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "print('Started thread') \n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- pthread_create(&pythonloop, NULL, cbSinkAdded, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkAdded(*arg, **karg):\n"
- " print ('Caught signal (in SinkAdded handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkAdded, signal_name='SinkAdded', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- std::ifstream ifs("/tmp/result.txt");
- std::string line;
- int lineCounter = 0, result = 0;
- while (std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(23), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.Int16(234), dbus.Int16(0), dbus.UInt16(3)), signature=None)"), 0);
- }
- ifs.close();
-
- pthread_create(&pythonloop, NULL, cbSinkRemoved, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkRemoved(*arg, **karg):\n"
- " print ('Caught signal (in SinkRemoved handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkRemoved, signal_name='SinkRemoved', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 23);
- }
- ifs.close();
-
- pthread_create(&pythonloop, NULL, cbSourceAdded, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceAdded(*arg, **karg):\n"
- " print ('Caught signal (in SourceAdded handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceAdded, signal_name='SourceAdded', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(42), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.UInt16(15)), signature=None)"), 0);
- }
- ifs.close();
-
- pthread_create(&pythonloop, NULL, cbSourceRemoved, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceRemoved(*arg, **karg):\n"
- " print ('Caught signal (in SinkRemoved handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceRemoved, signal_name='SourceRemoved', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 42);
- }
- ifs.close();
-
- pthread_create(&pythonloop, NULL, NumberOfSinkClassesChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchNumberOfSinkClassesChanged(*arg, **kwarg):\n"
- " print ('Caught catchNumberOfSinkClassesChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchNumberOfSinkClassesChanged, signal_name='NumberOfSinkClassesChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- pthread_create(&pythonloop, NULL, NumberOfSourceClassesChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def CatchNumberOfSourceClassesChanged(*arg, **kwarg):\n"
- " print ('Caught CatchNumberOfSourceClassesChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(CatchNumberOfSourceClassesChanged, signal_name='NumberOfSourceClassesChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, MainConnectionStateChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainConnectionStateChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainConnectionStateChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainConnectionStateChanged, signal_name='MainConnectionStateChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 4);
- }
- else if (lineCounter == 1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, CS_CONNECTING);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, MainSinkSoundPropertyChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainSinkSoundPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainSinkSoundPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainSinkSoundPropertyChanged, signal_name='MainSinkSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 3);
- }
- else if (lineCounter == 1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(23)), signature=None)"), 0);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, MainSourceSoundPropertyChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainSourceSoundPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainSourceSoundPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainSourceSoundPropertyChanged, signal_name='MainSourceSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 35);
- }
- else if (lineCounter == 1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(233)), signature=None)"), 0);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, cbSinkAvailabilityChangedLoop, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkAvailabilityChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSinkAvailabilityChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkAvailabilityChanged, signal_name='SinkAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 4);
- }
- else if (lineCounter == 1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(0)), signature=None)"), 0);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, cbSourceAvailabilityChangedLoop, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceAvailability(*arg, **karg):\n"
- " print ('Caught signal (in catchSourceAvailability handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceAvailability, signal_name='SourceAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 2);
- }
- else if (lineCounter == 1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(0)), signature=None)"), 0);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, VolumeChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchVolumeChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchVolumeChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchVolumeChanged, signal_name='VolumeChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 23);
- }
- else if (lineCounter == 1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 344);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, SinkMuteStateChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkMuteStateChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSinkMuteStateChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkMuteStateChanged, signal_name='SinkMuteStateChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 42);
- }
- else if (lineCounter == 1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, MS_MUTED);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, SystemPropertyChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSystemPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSystemPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSystemPropertyChanged, signal_name='SystemPropertyChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(355)), signature=None)"), 0);
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop, NULL, TimingInformationChanged, (void*) ppCommandSend);
- PyRun_SimpleStringFlags("import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchTimingInformationChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchTimingInformationChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchTimingInformationChanged, signal_name='TimingInformationChanged', dbus_interface = 'org.genivi.audiomanager.commandinterface', message_keyword='dbus_message')\n"
- "loop.run()\n", NULL);
- pthread_join(pythonloop, NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter = 0;
- result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 42);
- }
- else if (lineCounter == 1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result, 233);
- }
- lineCounter++;
- }
- ifs.close();
-
-}
-
-int main(int argc, char **argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
-void CAmCommandSenderDbusSignalTest::SetUp()
-{
- Py_Initialize();
-}
-
-void CAmCommandSenderDbusSignalTest::TearDown()
-{
- Py_Finalize();
-}
-
diff --git a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.h b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.h
deleted file mode 100644
index b92b894..0000000
--- a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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 DBUSCOMMANINTERFACESIGNALSTEST_H_
-#define DBUSCOMMANINTERFACESIGNALSTEST_H_
-
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-#define UNIT_TEST 1
-
-namespace am {
-
-class IAmCommandSend;
-
-class CAmCommandSenderDbusSignalTest: public ::testing::Test
-{
-public:
- IAmCommandSend *ppCommandSend;
- CAmCommandSenderDbusSignalTest();
- virtual ~CAmCommandSenderDbusSignalTest();
- void SetUp();
- void TearDown();
-};
-
-}
-
-#endif /* DBUSCOMMANINTERFACESIGNALSTEST_H_ */
diff --git a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.cpp b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.cpp
deleted file mode 100644
index 9aaa766..0000000
--- a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.cpp
+++ /dev/null
@@ -1,622 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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/.
- */
-
-#include "CAmCommandSenderDbusTest.h"
-#include <Python.h>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <set>
-#include "TAmPluginTemplate.h"
-#include "MockIAmCommandReceive.h"
-#include "shared/CAmDltWrapper.h"
-#include "shared/CAmSocketHandler.h"
-#include "shared/CAmDbusWrapper.h"
-#include "../include/CAmCommandSenderDbus.h"
-#include "../include/CAmDbusMessageHandler.h"
-
-using namespace am;
-using namespace testing;
-
-std::string DBUSCOMMAND = "dbus-send --session --print-reply --dest=org.genivi.audiomanager /org/genivi/audiomanager/commandinterface org.genivi.audiomanager.commandinterface.";
-
-void* run_the_loop(void* wrapper)
-{
- CAmSocketHandler* wrap = (CAmSocketHandler*) wrapper;
- wrap->start_listenting();
- return (NULL);
-}
-
-CAmCommandSenderDbusTest::CAmCommandSenderDbusTest() :
- ppCommandSend(NULL) //
-{
- CAmDltWrapper::instance()->registerApp("dbusTest", "dbusTest");
-}
-
-CAmCommandSenderDbusTest::~CAmCommandSenderDbusTest()
-{
-
-}
-
-void CAmCommandSenderDbusTest::SetUp()
-{
-
-}
-
-void CAmCommandSenderDbusTest::TearDown()
-{
-
-}
-
-ACTION(returnListConnections){
-std::vector<am::am_MainConnectionType_s> list;
-am::am_MainConnectionType_s listItem;
-listItem.mainConnectionID=15;
-listItem.sinkID=4;
-listItem.sourceID=3;
-listItem.connectionState=CS_UNKNOWN;
-listItem.delay=34;
-list.push_back(listItem);
-arg0=list;
-}
-
-ACTION(returnListSinks){
-std::vector<am::am_SinkType_s> list;
-am::am_SinkType_s listItem;
-listItem.availability.availability=A_UNAVAILABLE;
-listItem.availability.availabilityReason=AR_GENIVI_NOMEDIA;
-listItem.muteState=MS_UNMUTED;
-listItem.name="mySink";
-listItem.sinkClassID=34;
-listItem.sinkID=24;
-listItem.volume=124;
-list.push_back(listItem);
-arg0=list;
-}
-
-ACTION(returnListSources){
-std::vector<am::am_SourceType_s> list;
-am::am_SourceType_s listItem;
-listItem.availability.availability=A_MAX;
-listItem.availability.availabilityReason=AR_GENIVI_SAMEMEDIA;
-listItem.name="MySource";
-listItem.sourceClassID=12;
-listItem.sourceID=224;
-list.push_back(listItem);
-listItem.name="NextSource";
-listItem.sourceID=22;
-list.push_back(listItem);
-arg0=list;
-}
-
-ACTION(returnListMainSinkSoundProperties){
-std::vector<am::am_MainSoundProperty_s> list;
-am::am_MainSoundProperty_s listItem;
-listItem.type=MSP_GENIVI_MID;
-listItem.value=223;
-list.push_back(listItem);
-listItem.type=MSP_UNKNOWN;
-listItem.value=2;
-list.push_back(listItem);
-arg1=list;
-}
-
-ACTION(returnListSourceClasses){
-std::vector<am::am_SourceClass_s> list;
-am::am_SourceClass_s listItem;
-am::am_ClassProperty_s property;
-property.classProperty=static_cast<am_CustomClassProperty_t>(2);
-property.value=12;
-listItem.name="FirstCLass";
-listItem.sourceClassID=23;
-listItem.listClassProperties.push_back(property);
-list.push_back(listItem);
-listItem.name="SecondCLass";
-listItem.sourceClassID=2;
-listItem.listClassProperties.push_back(property);
-list.push_back(listItem);
-arg0=list;
-}
-
-ACTION(returnListSinkClasses){
-std::vector<am::am_SinkClass_s> list;
-am::am_SinkClass_s listItem;
-am::am_ClassProperty_s property;
-property.classProperty=static_cast<am_CustomClassProperty_t>(1);
-property.value=122;
-listItem.name="FirstCLass";
-listItem.sinkClassID=2123;
-listItem.listClassProperties.push_back(property);
-list.push_back(listItem);
-listItem.name="SecondCLass";
-listItem.sinkClassID=23;
-listItem.listClassProperties.push_back(property);
-list.push_back(listItem);
-arg0=list;
-}
-
-ACTION(returnListSystemProperties){
-std::vector<am::am_SystemProperty_s> list;
-am::am_SystemProperty_s listItem;
-listItem.type=SYP_UNKNOWN;
-listItem.value=-2245;
-list.push_back(listItem);
-arg0=list;
-}
-
-ACTION(returnTimingInfo){
-am::am_timeSync_t time=23;
-arg1=time;
-}
-
-TEST_F(CAmCommandSenderDbusTest, MessageTest)
-{
- Py_Initialize();
- //unfortunatly we need to put all in one testcase because testing with the dbus loop caused problems...
- CAmSocketHandler pSocketHandler;
- CAmDbusWrapper pDBusWrapper(&pSocketHandler);
- pthread_t ptestThread;
- std::vector<std::string> plistCommandPluginDirs;
- plistCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
-
- MockIAmCommandReceive pReceiveInterface;
-
- //this class just creates the thread that will handle the mainloop...
- pthread_create(&ptestThread, NULL, run_the_loop, (void*) &pSocketHandler);
-
- IAmCommandSend* (*createFunc)();
- void* tempLibHandle = NULL;
- std::string libname("../plugins/command/libPluginCommandInterfaceDbus.so");
- createFunc = getCreateFunction<IAmCommandSend*()>(libname, tempLibHandle);
-
- if (!createFunc)
- {
- logError("CommandSendInterface Test Entry point of RoutingPlugin not found");
- exit(1);
- }
-
- ppCommandSend = createFunc();
-
- if (!ppCommandSend)
- {
- logError("CommandSendInterface Test RoutingPlugin initialization failed. Entry Function not callable");
- exit(1);
- }
-
-// ok, here we give the DBusWrapper pointer to the Plugin and start the interface
- EXPECT_CALL(pReceiveInterface,getDBusConnectionWrapper(_)).WillRepeatedly(DoAll(SetArgReferee<0>(&pDBusWrapper), Return(E_OK)));
- EXPECT_CALL(pReceiveInterface, confirmCommandReady(10,E_OK));
-
- ppCommandSend->startupInterface(&pReceiveInterface);
- ppCommandSend->setCommandReady(10);
-
- EXPECT_CALL(pReceiveInterface,connect(2,3,_)).WillRepeatedly(DoAll(SetArgReferee<2>(35), Return(E_OK)));
- system((DBUSCOMMAND + std::string("Connect uint16:2 uint16:3 > /tmp/result.txt ")).c_str());
-
- //check the results
- std::ifstream ifs("/tmp/result.txt");
- std::string line;
- int lineCounter = 0, result = 0;
- while (std::getline(ifs, line))
- {
- if (lineCounter == 1)
- {
- std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
- ASSERT_EQ(result, E_OK);
- }
- else if (lineCounter == 2)
- {
- std::stringstream(line.replace(line.begin(), line.begin() + 10, "")) >> result;
- ASSERT_EQ(result, 35);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout << "[connect ]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,disconnect(2)).WillOnce(Return(E_OK));
- system((DBUSCOMMAND + std::string("Disconnect uint16:2 > /tmp/result.txt ")).c_str());
-
- //check the results
- lineCounter = 0;
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- if (lineCounter == 1)
- {
- std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
- ASSERT_EQ(result, E_OK);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout << "[disconnect]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,setVolume(22,12)).WillOnce(Return(E_OK));
- system((DBUSCOMMAND + std::string("SetVolume uint16:22 int16:12 > /tmp/result.txt ")).c_str());
-
- //check the results
- lineCounter = 0;
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- if (lineCounter == 1)
- {
- std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
- ASSERT_EQ(result, E_OK);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout << "[setVolume ]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,volumeStep(2,1)).WillOnce(Return(E_OK));
- system((DBUSCOMMAND + std::string("VolumeStep uint16:2 int16:1 > /tmp/result.txt ")).c_str());
-
- //check the results
- lineCounter = 0;
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- if (lineCounter == 1)
- {
- std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
- ASSERT_EQ(result, E_OK);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout << "[volumeStep]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,setSinkMuteState(1,MS_UNKNOWN)).WillOnce(Return(E_OK));
- system((DBUSCOMMAND + std::string("SetSinkMuteState uint16:1 int16:0 > /tmp/result.txt ")).c_str());
-
- //check the results
- lineCounter = 0;
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- if (lineCounter == 1)
- {
- std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
- ASSERT_EQ(result, E_OK);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout << "[sinkmutest]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,setMainSinkSoundProperty(AllOf(Field(&am_MainSoundProperty_s::value, 3),
- Field(&am_MainSoundProperty_s::type,MSP_UNKNOWN)),1)).WillOnce(Return(E_ABORTED));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='SetMainSinkSoundProperty',\n"
- "signature='q(nn)',\n"
- "args=[1,(0,3)],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- }ASSERT_EQ(result, E_ABORTED);
- ifs.close();
-
- std::cout << "[sinksound ]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,setMainSourceSoundProperty(AllOf(Field(&am_MainSoundProperty_s::value, 3),
- Field(&am_MainSoundProperty_s::type,MSP_UNKNOWN)),1)).WillOnce(Return(E_ABORTED));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='SetMainSourceSoundProperty',\n"
- "signature='q(nn)',\n"
- "args=[1,(0,3)],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- }ASSERT_EQ(result, E_ABORTED);
- ifs.close();
-
- std::cout << "[sourcesnd ]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,setSystemProperty(Field(&am_SystemProperty_s::value,2))).WillOnce(Return(E_DATABASE_ERROR));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='SetSystemProperty',\n"
- "signature='(nn)',\n"
- "args=[(2,2)],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
-
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- }ASSERT_EQ(result, E_DATABASE_ERROR);
- ifs.close();
-
- std::cout << "[systemprop]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainConnections(_)).WillOnce(DoAll(returnListConnections(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetListMainConnections',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(15), dbus.UInt16(3), dbus.UInt16(4), dbus.Int16(34), dbus.Int16(0)), signature=None)], signature=dbus.Signature('(qqqnn)')))"), 0);
- }
- ifs.close();
-
- std::cout << "[listmainc ]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainSinks(_)).WillOnce(DoAll(returnListSinks(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetListMainSinks',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(24), dbus.String(u'mySink'), dbus.Struct((dbus.Int16(2), dbus.Int16(3)), signature=None), dbus.Int16(124), dbus.Int16(2), dbus.UInt16(34)), signature=None)], signature=dbus.Signature('(qs(nn)nnq)')))"), 0);
- }
- ifs.close();
-
- std::cout << "[listsinks ]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainSources(_)).WillOnce(DoAll(returnListSources(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetListMainSources',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(224), dbus.String(u'MySource'), dbus.Struct((dbus.Int16(3), dbus.Int16(2)), signature=None), dbus.UInt16(12)), signature=None), dbus.Struct((dbus.UInt16(22), dbus.String(u'NextSource'), dbus.Struct((dbus.Int16(3), dbus.Int16(2)), signature=None), dbus.UInt16(12)), signature=None)], signature=dbus.Signature('(qs(nn)q)')))"), 0);
- }
- ifs.close();
-
- std::cout << "[listsource]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainSinkSoundProperties(1,_)).WillOnce(DoAll(returnListMainSinkSoundProperties(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetListMainSinkSoundProperties',\n"
- "signature='q',\n"
- "args=[1],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(2), dbus.Int16(223)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None)], signature=dbus.Signature('(nn)')))"), 0);
- }
- ifs.close();
-
- std::cout << "[lMainSiPro]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainSourceSoundProperties(1,_)).WillOnce(DoAll(returnListMainSinkSoundProperties(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetListMainSourceSoundProperties',\n"
- "signature='q',\n"
- "args=[1],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(2), dbus.Int16(223)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None)], signature=dbus.Signature('(nn)')))"), 0);
- }
- ifs.close();
-
- std::cout << "[lMainSoPro]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListSourceClasses(_)).WillOnce(DoAll(returnListSourceClasses(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetListSourceClasses',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(23), dbus.String(u'FirstCLass'), dbus.Array([dbus.Struct((dbus.Int16(2), dbus.Int16(12)), signature=None)], signature=dbus.Signature('(nn)'))), signature=None), dbus.Struct((dbus.UInt16(2), dbus.String(u'SecondCLass'), dbus.Array([dbus.Struct((dbus.Int16(2), dbus.Int16(12)), signature=None), dbus.Struct((dbus.Int16(2), dbus.Int16(12)), signature=None)], signature=dbus.Signature('(nn)'))), signature=None)], signature=dbus.Signature('(qsa(nn))')))"), 0);
- }
- ifs.close();
-
- std::cout << "[lSourceCla]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListSinkClasses(_)).WillOnce(DoAll(returnListSinkClasses(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetListSinkClasses',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(2123), dbus.String(u'FirstCLass'), dbus.Array([dbus.Struct((dbus.Int16(1), dbus.Int16(122)), signature=None)], signature=dbus.Signature('(nn)'))), signature=None), dbus.Struct((dbus.UInt16(23), dbus.String(u'SecondCLass'), dbus.Array([dbus.Struct((dbus.Int16(1), dbus.Int16(122)), signature=None), dbus.Struct((dbus.Int16(1), dbus.Int16(122)), signature=None)], signature=dbus.Signature('(nn)'))), signature=None)], signature=dbus.Signature('(qsa(nn))')))"), 0);
- }
- ifs.close();
-
- std::cout << "[lSinkClass]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListSystemProperties(_)).WillOnce(DoAll(returnListSystemProperties(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetListSystemProperties',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(0), dbus.Int16(-2245)), signature=None)], signature=dbus.Signature('(nn)')))"), 0);
- }
- ifs.close();
-
- std::cout << "[lSysProp ]" << std::endl;
-
- EXPECT_CALL(pReceiveInterface,getTimingInformation(2,_)).WillOnce(DoAll(returnTimingInfo(), Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/commandinterface',\n"
- "dbus_interface='org.genivi.audiomanager.commandinterface',\n"
- "method='GetTimingInformation',\n"
- "signature='q',\n"
- "args=[2],) \n"
- "f.write(str(retVal));\n"
- "f.close()", NULL);
- result = 0;
- ifs.open("/tmp/result.txt");
- while (std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Int16(23))"), 0);
- }
- ifs.close();
-
- std::cout << "[timingInfo]" << std::endl;
- Py_Finalize();
-}
-
-int main(int argc, char **argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
diff --git a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.h b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.h
deleted file mode 100644
index 1351da4..0000000
--- a/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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 DBUSCOMMANDPLUGININTERFACETEST_H_
-#define DBUSCOMMANDPLUGININTERFACETEST_H_
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-#define UNIT_TEST 1
-
-namespace am {
-
-class CAmCommandSenderDbusBackdoor;
-class IAmCommandSend;
-
-/*
- * originally, I would want to have several tests, but there are problems implementing this with
- * Dbus.
- * I use python to send put the messages and to check the returns I get from the Plugin.
- *
- */
-
-
-class CAmCommandSenderDbusTest :public ::testing::Test
-{
-public:
- IAmCommandSend *ppCommandSend;
- CAmCommandSenderDbusTest();
- ~CAmCommandSenderDbusTest();
-
- void SetUp();
- void TearDown();
-};
-
-}
-
-#endif /* DBUSCOMMANDPLUGININTERFACETEST_H_ */
diff --git a/PluginCommandInterfaceDbus/test/CMakeLists.txt b/PluginCommandInterfaceDbus/test/CMakeLists.txt
deleted file mode 100644
index d9d9e51..0000000
--- a/PluginCommandInterfaceDbus/test/CMakeLists.txt
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright (c) 2012 GENIVI Alliance
-# Copyright (c) 2012 BMW
-#
-# author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
-#
-# 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/.
-#
-
-cmake_minimum_required(VERSION 2.6)
-
-PROJECT(CAmCommandSenderDbusTests)
-
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
-
-string (REPLACE "-g -Wall -Wextra" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
-string (REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
-
-set(STD_INCLUDE_DIRS "/usr/include")
-set(EXECUTABLE_OUTPUT_PATH ${TEST_EXECUTABLE_OUTPUT_PATH})
-
-FIND_PACKAGE(Threads)
-FIND_PACKAGE(DBUS REQUIRED)
-FIND_PACKAGE(PkgConfig)
-FIND_PACKAGE(PythonLibs REQUIRED)
-
-
-IF(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
-ENDIF(WITH_DLT)
-
-INCLUDE_DIRECTORIES(
- ${STD_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDE_FOLDER}
- ${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDE_FOLDER}
- ${CMAKE_SOURCE_DIR}
- ${DLT_INCLUDE_DIRS}
- ${DBUS_INCLUDE_DIR}
- ${INCLUDE_FOLDER}
- ${PYTHON_INCLUDE_DIRS}
- ${GOOGLE_TEST_INCLUDE_DIR}
- ${GMOCK_INCLUDE_DIR}
- "../../AudioManagerDaemon/include"
- "../include"
-)
-
-file(GLOB DBUS_PLUGIN_INTERFACE_SRCS_CXX
- "../../AudioManagerDaemon/src/CAmDbusWrapper.cpp"
- "../../AudioManagerDaemon/src/CAmSocketHandler.cpp"
- "../../AudioManagerDaemon/src/CAmDltWrapper.cpp"
- "../src/*.cpp"
- "CAmCommandSenderDbusBackdoor.cpp"
- "CAmCommandSenderDbusTest.cpp"
-
-)
-
-file(GLOB DBUS_SIGNAL_INTERFACE_SRCS_CXX
- "../../AudioManagerDaemon/src/CAmDbusWrapper.cpp"
- "../../AudioManagerDaemon/src/CAmSocketHandler.cpp"
- "../../AudioManagerDaemon/src/CAmDltWrapper.cpp"
- "../src/*.cpp"
- "CAmCommandSenderDbusBackdoor.cpp"
- "CAmCommandSenderDbusSignalTest.cpp"
-)
-ADD_EXECUTABLE(AmCommandSenderDbusTest ${DBUS_PLUGIN_INTERFACE_SRCS_CXX})
-
-ADD_EXECUTABLE(AmCommandSenderDbusSignalTest ${DBUS_SIGNAL_INTERFACE_SRCS_CXX})
-
-TARGET_LINK_LIBRARIES(AmCommandSenderDbusTest
- ${DLT_LIBRARIES}
- ${DBUS_LIBRARY}
- ${CMAKE_DL_LIBS}
- ${CMAKE_THREAD_LIBS_INIT}
- ${PYTHON_LIBRARY}
- gtest
- gmock
-)
-
-
-TARGET_LINK_LIBRARIES(AmCommandSenderDbusSignalTest
- ${DLT_LIBRARIES}
- ${DBUS_LIBRARY}
- ${CMAKE_DL_LIBS}
- ${CMAKE_THREAD_LIBS_INIT}
- ${PYTHON_LIBRARY}
- gtest
- gmock
-)
-
-INSTALL(TARGETS AmCommandSenderDbusTest
- DESTINATION "~/AudioManagerTest/"
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
-INSTALL(TARGETS AmCommandSenderDbusSignalTest
- DESTINATION "~/AudioManagerTest/"
- PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
- COMPONENT tests
-)
-
-SET(ADD_DEPEND "audiomanager-bin" "sqlite3(>=3.6.22)" "dlt" "libdbus-1-3(>=1.2.16)" "gtest" "libpthread-stubs0")
-set_property(GLOBAL APPEND PROPERTY tests_prop "${ADD_DEPEND}")
-
diff --git a/PluginCommandInterfaceDbus/test/MockIAmCommandReceive.h b/PluginCommandInterfaceDbus/test/MockIAmCommandReceive.h
deleted file mode 100644
index cf70aa8..0000000
--- a/PluginCommandInterfaceDbus/test/MockIAmCommandReceive.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Copyright (c) 2012 BMW
- *
- * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
- *
- * \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 MOCKCOMMANDRECEIVENTERFACE_H_
-#define MOCKCOMMANDRECEIVENTERFACE_H_
-
-#include "command/IAmCommandReceive.h"
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-namespace am {
-
-class MockIAmCommandReceive : public IAmCommandReceive {
- public:
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
- MOCK_METHOD3(connect,
- am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID));
- MOCK_METHOD1(disconnect,
- am_Error_e(const am_mainConnectionID_t mainConnectionID));
- MOCK_METHOD2(setVolume,
- am_Error_e(const am_sinkID_t sinkID, const am_mainVolume_t volume));
- MOCK_METHOD2(volumeStep,
- am_Error_e(const am_sinkID_t sinkID, const int16_t volumeStep));
- MOCK_METHOD2(setSinkMuteState,
- am_Error_e(const am_sinkID_t sinkID, const am_MuteState_e muteState));
- MOCK_METHOD2(setMainSinkSoundProperty,
- am_Error_e(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID));
- MOCK_METHOD2(setMainSourceSoundProperty,
- am_Error_e(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID));
- MOCK_METHOD1(setSystemProperty,
- am_Error_e(const am_SystemProperty_s& property));
- MOCK_CONST_METHOD1(getListMainConnections,
- am_Error_e(std::vector<am_MainConnectionType_s>& listConnections));
- MOCK_CONST_METHOD1(getListMainSinks,
- am_Error_e(std::vector<am_SinkType_s>& listMainSinks));
- MOCK_CONST_METHOD1(getListMainSources,
- am_Error_e(std::vector<am_SourceType_s>& listMainSources));
- MOCK_CONST_METHOD2(getListMainSinkSoundProperties,
- am_Error_e(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties));
- MOCK_CONST_METHOD2(getListMainSourceSoundProperties,
- am_Error_e(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties));
- MOCK_CONST_METHOD1(getListSourceClasses,
- am_Error_e(std::vector<am_SourceClass_s>& listSourceClasses));
- MOCK_CONST_METHOD1(getListSinkClasses,
- am_Error_e(std::vector<am_SinkClass_s>& listSinkClasses));
- MOCK_CONST_METHOD1(getListSystemProperties,
- am_Error_e(std::vector<am_SystemProperty_s>& listSystemProperties));
- MOCK_CONST_METHOD2(getTimingInformation,
- am_Error_e(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay));
- MOCK_CONST_METHOD1(getDBusConnectionWrapper,
- am_Error_e(CAmDbusWrapper*& dbusConnectionWrapper));
- MOCK_CONST_METHOD1(getSocketHandler,
- am_Error_e(CAmSocketHandler*& socketHandler));
- MOCK_METHOD2(confirmCommandReady,
- void(const uint16_t handle, const am_Error_e error));
- MOCK_METHOD2(confirmCommandRundown,
- void(const uint16_t handle, const am_Error_e error));
- MOCK_CONST_METHOD2(getListMainSinkNotificationConfigurations,
- am_Error_e(const am_sinkID_t sinkID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations));
- MOCK_CONST_METHOD2(getListMainSourceNotificationConfigurations,
- am_Error_e(const am_sourceID_t sourceID, std::vector<am_NotificationConfiguration_s>& listMainNotificationConfigurations));
- MOCK_METHOD2(setMainSinkNotificationConfiguration,
- am_Error_e(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration));
- MOCK_METHOD2(setMainSourceNotificationConfiguration,
- am_Error_e(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration));
-
-
-};
-
-} // namespace am
-#endif /* MOCKCOMMANDRECEIVENTERFACE_H_ */