summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-03-01 19:12:55 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-03-01 19:12:55 +0100
commitdfcafbec34e0e454d9995551998af5d40a27c7ad (patch)
treed93d70fea7feb7004f6a2ce9bfce9b83d3469e42
parentffccf1e2003cea4230413ccfdfd4cd6515484e4f (diff)
downloadaudiomanager-dfcafbec34e0e454d9995551998af5d40a27c7ad.tar.gz
* fix [GAM-28] problems in routingsender.cpp
* [GAM-27] major refactoring: bringing everything to standardized names * Enhancement of CAmSerializer.h * improvement of documentation * adoption & regeneration of inerfaces
-rw-r--r--AudioManagerDaemon/CMakeLists.txt36
-rw-r--r--AudioManagerDaemon/include/CAmCommandReceiver.h (renamed from AudioManagerDaemon/include/CommandReceiver.h)30
-rw-r--r--AudioManagerDaemon/include/CAmCommandSender.h (renamed from AudioManagerDaemon/include/CommandSender.h)20
-rw-r--r--AudioManagerDaemon/include/CAmControlReceiver.h (renamed from AudioManagerDaemon/include/ControlReceiver.h)32
-rw-r--r--AudioManagerDaemon/include/CAmControlSender.h (renamed from AudioManagerDaemon/include/ControlSender.h)18
-rw-r--r--AudioManagerDaemon/include/CAmDatabaseHandler.h (renamed from AudioManagerDaemon/include/DatabaseHandler.h)20
-rw-r--r--AudioManagerDaemon/include/CAmDatabaseObserver.h (renamed from AudioManagerDaemon/include/DatabaseObserver.h)26
-rw-r--r--AudioManagerDaemon/include/CAmRouter.h (renamed from AudioManagerDaemon/include/Router.h)48
-rw-r--r--AudioManagerDaemon/include/CAmRoutingReceiver.h (renamed from AudioManagerDaemon/include/RoutingReceiver.h)36
-rw-r--r--AudioManagerDaemon/include/CAmRoutingSender.h (renamed from AudioManagerDaemon/include/RoutingSender.h)34
-rw-r--r--AudioManagerDaemon/include/CAmTelnetMenuHelper.h44
-rw-r--r--AudioManagerDaemon/include/CAmTelnetServer.h (renamed from AudioManagerDaemon/include/TelnetServer.h)70
-rw-r--r--AudioManagerDaemon/include/DAmDoxygenMainPage.h (renamed from AudioManagerDaemon/include/mainpage.h)2
-rw-r--r--AudioManagerDaemon/include/TAmPluginTemplate.h (renamed from AudioManagerDaemon/include/PluginTemplate.h)4
-rw-r--r--AudioManagerDaemon/src/CAmCommandReceiver.cpp (renamed from AudioManagerDaemon/src/CommandReceiver.cpp)72
-rw-r--r--AudioManagerDaemon/src/CAmCommandSender.cpp (renamed from AudioManagerDaemon/src/CommandSender.cpp)87
-rw-r--r--AudioManagerDaemon/src/CAmControlReceiver.cpp (renamed from AudioManagerDaemon/src/ControlReceiver.cpp)201
-rw-r--r--AudioManagerDaemon/src/CAmControlSender.cpp (renamed from AudioManagerDaemon/src/ControlSender.cpp)114
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandler.cpp (renamed from AudioManagerDaemon/src/DatabaseHandler.cpp)249
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseObserver.cpp207
-rw-r--r--AudioManagerDaemon/src/CAmDbusWrapper.cpp (renamed from AudioManagerDaemon/src/DBusWrapper.cpp)186
-rw-r--r--AudioManagerDaemon/src/CAmDltWrapper.cpp (renamed from AudioManagerDaemon/src/DLTWrapper.cpp)61
-rw-r--r--AudioManagerDaemon/src/CAmRouter.cpp (renamed from AudioManagerDaemon/src/Router.cpp)66
-rw-r--r--AudioManagerDaemon/src/CAmRoutingReceiver.cpp (renamed from AudioManagerDaemon/src/RoutingReceiver.cpp)130
-rw-r--r--AudioManagerDaemon/src/CAmRoutingSender.cpp (renamed from AudioManagerDaemon/src/RoutingSender.cpp)168
-rw-r--r--AudioManagerDaemon/src/CAmSocketHandler.cpp (renamed from AudioManagerDaemon/src/SocketHandler.cpp)69
-rw-r--r--AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp28
-rw-r--r--AudioManagerDaemon/src/CAmTelnetServer.cpp (renamed from AudioManagerDaemon/src/TelnetServer.cpp)39
-rw-r--r--AudioManagerDaemon/src/DatabaseObserver.cpp206
-rw-r--r--AudioManagerDaemon/src/main.cpp73
-rw-r--r--AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp (renamed from AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp)46
-rw-r--r--AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.h (renamed from AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h)67
-rw-r--r--AudioManagerDaemon/test/AmControlInterfaceTest/CMakeLists.txt (renamed from AudioManagerDaemon/test/controlInterface/CMakeLists.txt)40
-rw-r--r--AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp (renamed from AudioManagerDaemon/test/database/databaseTest.cpp)146
-rw-r--r--AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.h (renamed from AudioManagerDaemon/test/database/databaseTest.h)55
-rw-r--r--AudioManagerDaemon/test/AmDatabaseHandlerTest/CMakeLists.txt (renamed from AudioManagerDaemon/test/database/CMakeLists.txt)40
-rw-r--r--AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp (renamed from AudioManagerDaemon/test/routing/routingTest.cpp)49
-rw-r--r--AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.h (renamed from AudioManagerDaemon/test/routing/routingTest.h)58
-rw-r--r--AudioManagerDaemon/test/AmRouterTest/CMakeLists.txt (renamed from AudioManagerDaemon/test/routing/CMakeLists.txt)38
-rw-r--r--AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp (renamed from AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp)42
-rw-r--r--AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h (renamed from AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h)50
-rw-r--r--AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt (renamed from AudioManagerDaemon/test/routingInterface/CMakeLists.txt)40
-rw-r--r--AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp (renamed from AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp)88
-rw-r--r--AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.h (renamed from AudioManagerDaemon/test/sockethandler/sockethandlerTest.h)40
-rw-r--r--AudioManagerDaemon/test/AmSocketHandlerTest/CMakeLists.txt (renamed from AudioManagerDaemon/test/sockethandler/CMakeLists.txt)24
-rw-r--r--AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp (renamed from AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.cpp)34
-rw-r--r--AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.h87
-rw-r--r--AudioManagerDaemon/test/AmTelnetServerTest/CMakeLists.txt (renamed from AudioManagerDaemon/test/telnetserver/CMakeLists.txt)46
-rw-r--r--AudioManagerDaemon/test/CAmCommonFunctions.cpp (renamed from AudioManagerDaemon/test/CommonFunctions.cpp)68
-rw-r--r--AudioManagerDaemon/test/CAmCommonFunctions.h (renamed from AudioManagerDaemon/test/CommonFunctions.h)4
-rw-r--r--AudioManagerDaemon/test/CMakeLists.txt12
-rw-r--r--AudioManagerDaemon/test/IAmCommandBackdoor.h (renamed from AudioManagerDaemon/test/CommandInterfaceBackdoor.h)20
-rw-r--r--AudioManagerDaemon/test/IAmControlBackdoor.h (renamed from AudioManagerDaemon/test/ControlInterfaceBackdoor.h)16
-rw-r--r--AudioManagerDaemon/test/IAmRoutingBackdoor.h (renamed from AudioManagerDaemon/test/RoutingInterfaceBackdoor.h)18
-rw-r--r--AudioManagerDaemon/test/MockIAmCommandSend.h82
-rw-r--r--AudioManagerDaemon/test/MockIAmControlSend.h134
-rw-r--r--AudioManagerDaemon/test/MockIAmRoutingSend.h (renamed from AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h)6
-rw-r--r--AudioManagerDaemon/test/controlInterface/MockInterfaces.h182
-rw-r--r--AudioManagerDaemon/test/database/MockInterfaces.h189
-rw-r--r--AudioManagerDaemon/test/routing/MockInterfaces.h187
-rw-r--r--AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.h87
-rw-r--r--CMakeLists.txt13
-rw-r--r--PluginCommandInterfaceDbus/CMakeLists.txt12
-rw-r--r--PluginCommandInterfaceDbus/include/CAmCommandSenderDbus.h (renamed from PluginCommandInterfaceDbus/include/DBusCommandSender.h)77
-rw-r--r--PluginCommandInterfaceDbus/include/CAmDbusMessageHandler.h (renamed from PluginCommandInterfaceDbus/include/DBusMessageHandler.h)15
-rw-r--r--PluginCommandInterfaceDbus/include/CommandInterface.xml (renamed from includes/dbus/CommandInterface.xml)0
-rw-r--r--PluginCommandInterfaceDbus/include/IAmCommandReceiverShadow.h (renamed from PluginCommandInterfaceDbus/include/CommandReceiverShadow.h)28
-rw-r--r--PluginCommandInterfaceDbus/include/mainpage.h32
-rw-r--r--PluginCommandInterfaceDbus/src/CAmCommandSenderDbus.cpp331
-rw-r--r--PluginCommandInterfaceDbus/src/CAmDbusMessageHandler.cpp (renamed from PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp)116
-rw-r--r--PluginCommandInterfaceDbus/src/DBusCommandSender.cpp328
-rw-r--r--PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp (renamed from PluginCommandInterfaceDbus/src/CommandReceiverShadow.cpp)225
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.cpp (renamed from PluginCommandInterfaceDbus/test/DbusCommandInterfaceBackdoor.cpp)19
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.h (renamed from PluginCommandInterfaceDbus/test/DbusCommandInterfaceBackdoor.h)25
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.cpp (renamed from PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp)352
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.h (renamed from PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.h)18
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.cpp (renamed from PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp)95
-rw-r--r--PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.h (renamed from PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.h)23
-rw-r--r--PluginCommandInterfaceDbus/test/CMakeLists.txt47
-rw-r--r--PluginCommandInterfaceDbus/test/MockIAmCommandReceive.h59
-rw-r--r--PluginCommandInterfaceDbus/test/MockInterfaces.h85
-rw-r--r--PluginControlInterface/CMakeLists.txt8
-rw-r--r--PluginControlInterface/include/CAmControlSenderBase.h (renamed from PluginControlInterface/include/ControlSender.h)14
-rw-r--r--PluginControlInterface/src/CAmControlSenderBase.cpp (renamed from PluginControlInterface/src/ControlSender.cpp)112
-rw-r--r--PluginRoutingInterfaceAsync/CMakeLists.txt8
-rw-r--r--PluginRoutingInterfaceAsync/include/CAmRoutingSenderAsync.h (renamed from PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h)120
-rw-r--r--PluginRoutingInterfaceAsync/include/IAmRoutingReceiverShadow.h (renamed from PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h)17
-rw-r--r--PluginRoutingInterfaceAsync/src/CAmRoutingSenderAsync.cpp (renamed from PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp)432
-rw-r--r--PluginRoutingInterfaceAsync/src/IAmRoutingReceiverShadow.cpp195
-rw-r--r--PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp188
-rw-r--r--PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp (renamed from PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp)99
-rw-r--r--PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.h (renamed from PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h)25
-rw-r--r--PluginRoutingInterfaceAsync/test/CMakeLists.txt36
-rw-r--r--PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h91
-rw-r--r--PluginRoutingInterfaceAsync/test/mocklnterfaces.h119
-rw-r--r--PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp157
-rw-r--r--PluginRoutingInterfaceDbus/CMakeLists.txt10
-rw-r--r--PluginRoutingInterfaceDbus/include/CAmRoutingSenderDbus.h (renamed from PluginRoutingInterfaceDbus/include/RoutingSender.h)12
-rw-r--r--PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp (renamed from PluginRoutingInterfaceDbus/src/RoutingSender.cpp)48
-rw-r--r--cmake/AudioManagerCodestyle.xml (renamed from cmake/AudioManager_Codestyle.xml)0
-rw-r--r--cmake/FindDBUS.cmake4
-rw-r--r--cmake/config.cmake2
-rw-r--r--include/audiomanagertypes.h (renamed from includes/audiomanagertypes.h)100
-rw-r--r--include/command/IAmCommandReceive.h (renamed from includes/command/CommandReceiveInterface.h)22
-rw-r--r--include/command/IAmCommandSend.h (renamed from includes/command/CommandSendInterface.h)20
-rw-r--r--include/control/IAmControlReceive.h (renamed from includes/control/ControlReceiveInterface.h)18
-rw-r--r--include/control/IAmControlSend.h (renamed from includes/control/ControlSendInterface.h)18
-rw-r--r--include/projecttypes.h (renamed from includes/projecttypes.h)20
-rw-r--r--include/routing/IAmRoutingReceive.h (renamed from includes/routing/RoutingReceiveInterface.h)22
-rw-r--r--include/routing/IAmRoutingSend.h (renamed from includes/routing/RoutingSendInterface.h)20
-rw-r--r--include/shared/CAmDbusWrapper.h92
-rw-r--r--include/shared/CAmDltWrapper.h (renamed from includes/DLTWrapper.h)417
-rw-r--r--include/shared/CAmSerializer.h (renamed from includes/CAmSerializer.h)16
-rw-r--r--include/shared/CAmSocketHandler.h258
-rw-r--r--includes/SocketHandler.h266
-rw-r--r--includes/dbus/DBusWrapper.h101
116 files changed, 4453 insertions, 4905 deletions
diff --git a/AudioManagerDaemon/CMakeLists.txt b/AudioManagerDaemon/CMakeLists.txt
index beb1a74..c0a31b0 100644
--- a/AudioManagerDaemon/CMakeLists.txt
+++ b/AudioManagerDaemon/CMakeLists.txt
@@ -29,7 +29,7 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/AudioManager)
-set(INCLUDES_FOLDER "include")
+set(include_FOLDER "include")
pkg_check_modules(SQLITE REQUIRED sqlite3)
@@ -39,40 +39,40 @@ ENDIF(WITH_DBUS_WRAPPER)
SET(AUDIOMAN_SRCS_CXX
src/main.cpp
- src/CommandReceiver.cpp
- src/CommandSender.cpp
- src/ControlReceiver.cpp
- src/ControlSender.cpp
- src/DatabaseHandler.cpp
- src/DatabaseObserver.cpp
- src/RoutingReceiver.cpp
- src/RoutingSender.cpp
- src/SocketHandler.cpp
- src/TelnetServer.cpp
- src/Router.cpp
- src/DLTWrapper.cpp
+ src/CAmCommandReceiver.cpp
+ src/CAmCommandSender.cpp
+ src/CAmControlReceiver.cpp
+ src/CAmControlSender.cpp
+ src/CAmDatabaseHandler.cpp
+ src/CAmDatabaseObserver.cpp
+ src/CAmRoutingReceiver.cpp
+ src/CAmRoutingSender.cpp
+ src/CAmSocketHandler.cpp
+ src/CAmTelnetServer.cpp
+ src/CAmRouter.cpp
+ src/CAmDltWrapper.cpp
src/CAmTelnetMenuHelper.cpp
)
IF(WITH_DBUS_WRAPPER)
SET (AUDIOMAN_SRCS_CXX
${AUDIOMAN_SRCS_CXX}
- src/DBusWrapper.cpp
+ src/CAmDbusWrapper.cpp
)
ENDIF(WITH_DBUS_WRAPPER)
IF(WITH_SOCKETHANDLER_LOOP)
SET (AUDIOMAN_SRCS_CXX
${AUDIOMAN_SRCS_CXX}
- src/SocketHandler.cpp
+ src/CAmSocketHandler.cpp
)
ENDIF(WITH_SOCKETHANDLER_LOOP)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
- ${INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
+ ${include_FOLDER}
)
IF(WITH_DLT)
@@ -127,7 +127,7 @@ INSTALL(TARGETS AudioManager
COMPONENT bin
)
-INSTALL(DIRECTORY "${AUDIO_INCLUDES_FOLDER}/"
+INSTALL(DIRECTORY "${AUDIO_include_FOLDER}/"
DESTINATION include
COMPONENT dev
)
diff --git a/AudioManagerDaemon/include/CommandReceiver.h b/AudioManagerDaemon/include/CAmCommandReceiver.h
index 5279a31..72f72f2 100644
--- a/AudioManagerDaemon/include/CommandReceiver.h
+++ b/AudioManagerDaemon/include/CAmCommandReceiver.h
@@ -25,26 +25,26 @@
#ifndef COMMANDRECEIVER_H_
#define COMMANDRECEIVER_H_
-#include <command/CommandReceiveInterface.h>
+#include <command/IAmCommandReceive.h>
#include <config.h>
namespace am
{
-class DatabaseHandler;
-class ControlSender;
-class DBusWrapper;
-class SocketHandler;
+class CAmDatabaseHandler;
+class CAmControlSender;
+class CAmDbusWrapper;
+class CAmSocketHandler;
/**
* This class realizes the command Interface
*/
-class CommandReceiver: public CommandReceiveInterface
+class CAmCommandReceiver: public IAmCommandReceive
{
public:
- CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, SocketHandler* iSocketHandler);
- CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, SocketHandler* iSocketHandler, DBusWrapper* iDBusWrapper);
- ~CommandReceiver();
+ CAmCommandReceiver(CAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler);
+ CAmCommandReceiver(CAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iControlSender, CAmSocketHandler* iSocketHandler, CAmDbusWrapper* iDBusWrapper);
+ ~CAmCommandReceiver();
am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID);
am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID);
am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume);
@@ -62,8 +62,8 @@ public:
am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const;
- am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const;
- am_Error_e getSocketHandler(SocketHandler*& socketHandler) const;
+ am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const;
+ am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const;
void getInterfaceVersion(std::string& version) const;
void confirmCommandReady(const uint16_t handle);
void confirmCommandRundown(const uint16_t handle);
@@ -75,10 +75,10 @@ public:
void waitOnRundown(bool rundown); //!< tells the ComandReceiver to start waiting for all handles to be confirmed
private:
- DatabaseHandler* mDatabaseHandler; //!< pointer to the databasehandler
- ControlSender* mControlSender; //!< pointer to the control sender
- DBusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper
- SocketHandler* mSocketHandler; //!< pointer to the SocketHandler
+ CAmDatabaseHandler* mDatabaseHandler; //!< pointer to the databasehandler
+ CAmControlSender* mControlSender; //!< pointer to the control sender
+ CAmDbusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper
+ CAmSocketHandler* mSocketHandler; //!< pointer to the SocketHandler
uint16_t handleCount; //!< counts all handles
std::vector<uint16_t> mListStartupHandles; //!< list of handles that wait for a confirm
diff --git a/AudioManagerDaemon/include/CommandSender.h b/AudioManagerDaemon/include/CAmCommandSender.h
index 0a8d2b2..d902e96 100644
--- a/AudioManagerDaemon/include/CommandSender.h
+++ b/AudioManagerDaemon/include/CAmCommandSender.h
@@ -26,27 +26,27 @@
#define COMMANDSENDER_H_
#ifdef UNIT_TEST
-#include "../test/CommandInterfaceBackdoor.h" //we need this for the unit test
+#include "../test/IAmCommandBackdoor.h" //we need this for the unit test
#endif
-#include "command/CommandSendInterface.h"
+#include "command/IAmCommandSend.h"
namespace am
{
-class CommandReceiver;
+class CAmCommandReceiver;
/**
* This class is used to send data to the CommandInterface.
* All loaded plugins will be called when a callback is invoked.
*/
-class CommandSender
+class CAmCommandSender
{
public:
- CommandSender(const std::vector<std::string>& listOfPluginDirectories);
- ~CommandSender();
- am_Error_e startupInterfaces(CommandReceiver* iCommandReceiver);
+ CAmCommandSender(const std::vector<std::string>& listOfPluginDirectories);
+ ~CAmCommandSender();
+ am_Error_e startupInterfaces(CAmCommandReceiver* iCommandReceiver);
void setCommandReady();
void setCommandRundown();
void cbNewMainConnection(const am_MainConnectionType_s mainConnection);
@@ -69,15 +69,15 @@ public:
void getInterfaceVersion(std::string& version) const;
am_Error_e getListPlugins(std::vector<std::string>& interfaces) const;
#ifdef UNIT_TEST
- friend class CommandInterfaceBackdoor; //this is to get access to the loaded plugins and be able to exchange the interfaces
+ friend class IAmCommandBackdoor; //this is to get access to the loaded plugins and be able to exchange the interfaces
#endif
private:
void unloadLibraries(void); //!< unload the shared libraries
- std::vector<CommandSendInterface*> mListInterfaces; //!< list of all interfaces
+ std::vector<IAmCommandSend*> mListInterfaces; //!< list of all interfaces
std::vector<void*> mListLibraryHandles; //!< list of all library handles. This information is used to unload the plugins correctly.
std::vector<std::string> mListLibraryNames; //!< list of all library names. This information is used for getListPlugins.
- CommandReceiver *mCommandReceiver;
+ CAmCommandReceiver *mCommandReceiver;
};
}
diff --git a/AudioManagerDaemon/include/ControlReceiver.h b/AudioManagerDaemon/include/CAmControlReceiver.h
index dfb0695..af5a0e4 100644
--- a/AudioManagerDaemon/include/ControlReceiver.h
+++ b/AudioManagerDaemon/include/CAmControlReceiver.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file ControlReceiver.h
+ * \file CAmControlReceiver.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -25,26 +25,26 @@
#ifndef CONTRONLRECEIVER_H_
#define CONTRONLRECEIVER_H_
-#include <control/ControlReceiveInterface.h>
+#include <control/IAmControlReceive.h>
#include <config.h>
namespace am
{
-class SocketHandler;
-class DatabaseHandler;
-class RoutingSender;
-class CommandSender;
-class Router;
+class CAmSocketHandler;
+class CAmDatabaseHandler;
+class CAmRoutingSender;
+class CAmCommandSender;
+class CAmRouter;
/**
* This class is used to receive all commands from the control interface
*/
-class ControlReceiver: public ControlReceiveInterface
+class CAmControlReceiver: public IAmControlReceive
{
public:
- ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler, Router* iRouter);
- ~ControlReceiver();
+ CAmControlReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter);
+ ~CAmControlReceiver();
am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
am_Error_e connect(am_Handle_s& handle, am_connectionID_t& connectionID, const am_ConnectionFormat_e format, const am_sourceID_t sourceID, const am_sinkID_t sinkID);
am_Error_e disconnect(am_Handle_s& handle, const am_connectionID_t connectionID);
@@ -115,15 +115,15 @@ public:
void setRoutingRundown();
void confirmControllerReady();
void confirmControllerRundown();
- am_Error_e getSocketHandler(SocketHandler*& socketHandler);
+ am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler);
void getInterfaceVersion(std::string& version) const;
private:
- DatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler
- RoutingSender* mRoutingSender; //!< pointer to the routing send interface.
- CommandSender* mCommandSender; //!< pointer to the command send interface
- SocketHandler* mSocketHandler; //!< pointer to the socketHandler
- Router* mRouter; //!< pointer to the Router
+ CAmDatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler
+ CAmRoutingSender* mRoutingSender; //!< pointer to the routing send interface.
+ CAmCommandSender* mCommandSender; //!< pointer to the command send interface
+ CAmSocketHandler* mSocketHandler; //!< pointer to the socketHandler
+ CAmRouter* mRouter; //!< pointer to the Router
};
}
diff --git a/AudioManagerDaemon/include/ControlSender.h b/AudioManagerDaemon/include/CAmControlSender.h
index 6e04d48..ddc8cf3 100644
--- a/AudioManagerDaemon/include/ControlSender.h
+++ b/AudioManagerDaemon/include/CAmControlSender.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file ControlSender.h
+ * \file CAmControlSender.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,10 +26,10 @@
#define CONTROLSENDER_H_
#ifdef UNIT_TEST
-#include "../test/ControlInterfaceBackdoor.h"
+#include "../test/IAmControlBackdoor.h"
#endif
-#include "control/ControlSendInterface.h"
+#include "control/IAmControlSend.h"
namespace am
{
@@ -37,12 +37,12 @@ namespace am
/**
* sends data to the commandInterface, takes the file of the library that needs to be loaded
*/
-class ControlSender
+class CAmControlSender
{
public:
- ControlSender(std::string controlPluginFile);
- ~ControlSender();
- am_Error_e startupController(ControlReceiveInterface* controlreceiveinterface) ;
+ CAmControlSender(std::string controlPluginFile);
+ ~CAmControlSender();
+ am_Error_e startupController(IAmControlReceive* controlreceiveinterface) ;
void setControllerReady() ;
void setControllerRundown() ;
am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) ;
@@ -91,11 +91,11 @@ public:
void confirmRoutingRundown() ;
#ifdef UNIT_TEST
- friend class ControlInterfaceBackdoor;
+ friend class IAmControlBackdoor;
#endif
private:
void* mlibHandle; //!< pointer to the loaded control plugin interface
- ControlSendInterface* mController; //!< pointer to the ControlSend interface
+ IAmControlSend* mController; //!< pointer to the ControlSend interface
};
}
diff --git a/AudioManagerDaemon/include/DatabaseHandler.h b/AudioManagerDaemon/include/CAmDatabaseHandler.h
index 964bbbe..ceaff88 100644
--- a/AudioManagerDaemon/include/DatabaseHandler.h
+++ b/AudioManagerDaemon/include/CAmDatabaseHandler.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file Databasehandler.h
+ * \file CAmDatabaseHandler.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -33,9 +33,9 @@
namespace am
{
-class DatabaseObserver;
-class RoutingTree;
-class RoutingTreeItem;
+class CAmDatabaseObserver;
+class CAmRoutingTree;
+class CAmRoutingTreeItem;
#define DYNAMIC_ID_BOUNDARY 100 //!< the value below is reserved for staticIDs, the value above will be assigned to dynamically registered items
//todo: check the enum values before entering & changing in the database.
@@ -49,11 +49,11 @@ class RoutingTreeItem;
/**
* This class handles and abstracts the database
*/
-class DatabaseHandler
+class CAmDatabaseHandler
{
public:
- DatabaseHandler(std::string databasePath);
- ~DatabaseHandler();
+ CAmDatabaseHandler(std::string databasePath);
+ ~CAmDatabaseHandler();
am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID);
am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID);
am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
@@ -132,7 +132,7 @@ public:
am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const;
am_Error_e getSoureState(const am_sourceID_t sourceID, am_SourceState_e& sourceState) const;
am_Error_e getDomainState(const am_domainID_t domainID, am_DomainState_e state) const;
- am_Error_e getRoutingTree(bool onlyfree, RoutingTree& tree, std::vector<RoutingTreeItem*>& flatTree);
+ am_Error_e getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree);
am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
@@ -241,7 +241,7 @@ public:
* registers the Observer at the Database
* @param iObserver pointer to the observer
*/
- void registerObserver(DatabaseObserver *iObserver);
+ void registerObserver(CAmDatabaseObserver *iObserver);
/**
* gives information about the visibility of a source
@@ -264,7 +264,7 @@ private:
void createTables(); //!< creates all tables from the static table
sqlite3 *mDatabase; //!< pointer to the database
std::string mPath; //!< path to the database
- DatabaseObserver *mDatabaseObserver; //!< pointer to the Observer
+ CAmDatabaseObserver *mDatabaseObserver; //!< pointer to the Observer
bool mFirstStaticSink;
bool mFirstStaticSource;
bool mFirstStaticGateway;
diff --git a/AudioManagerDaemon/include/DatabaseObserver.h b/AudioManagerDaemon/include/CAmDatabaseObserver.h
index 3862a79..430f061 100644
--- a/AudioManagerDaemon/include/DatabaseObserver.h
+++ b/AudioManagerDaemon/include/CAmDatabaseObserver.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file DatabaseObserver.h
+ * \file CAmDatabaseObserver.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -27,26 +27,26 @@
#include <audiomanagertypes.h>
#include <queue>
-#include "CAmSerializer.h"
+#include "shared/CAmSerializer.h"
namespace am
{
-class TelnetServer;
-class CommandSender;
-class RoutingSender;
-class SocketHandler;
+class CAmTelnetServer;
+class CAmCommandSender;
+class CAmRoutingSender;
+class CAmSocketHandler;
/**
* This class observes the Database and notifies other classes about important events, mainly the CommandSender.
*/
-class DatabaseObserver
+class CAmDatabaseObserver
{
public:
- DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, SocketHandler *iSocketHandler);
- DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, SocketHandler *iSocketHandler, TelnetServer *iTelnetServer);
- ~DatabaseObserver();
+ CAmDatabaseObserver(CAmCommandSender *iCommandSender, CAmRoutingSender *iRoutingSender, CAmSocketHandler *iSocketHandler);
+ CAmDatabaseObserver(CAmCommandSender *iCommandSender, CAmRoutingSender *iRoutingSender, CAmSocketHandler *iSocketHandler, CAmTelnetServer *iTelnetServer);
+ ~CAmDatabaseObserver();
void numberOfSinkClassesChanged();
void numberOfSourceClassesChanged();
void newSink(const am_Sink_s& sink);
@@ -72,9 +72,9 @@ public:
void timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time);
private:
- CommandSender *mCommandSender; //!< pointer to the comandSender
- RoutingSender* mRoutingSender; //!< pointer to the routingSender
- TelnetServer* mTelnetServer; //!< pointer to the telnetserver
+ CAmCommandSender *mCommandSender; //!< pointer to the comandSender
+ CAmRoutingSender* mRoutingSender; //!< pointer to the routingSender
+ CAmTelnetServer* mTelnetServer; //!< pointer to the telnetserver
CAmSerializer mSerializer;
};
diff --git a/AudioManagerDaemon/include/Router.h b/AudioManagerDaemon/include/CAmRouter.h
index 11a5634..ba13bf1 100644
--- a/AudioManagerDaemon/include/Router.h
+++ b/AudioManagerDaemon/include/CAmRouter.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file Router.h
+ * \file CAmRouter.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -30,53 +30,53 @@
namespace am
{
-class DatabaseHandler;
-class ControlSender;
+class CAmDatabaseHandler;
+class CAmControlSender;
-class Router
+class CAmRouter
{
public:
- Router(DatabaseHandler* iDatabaseHandler, ControlSender* iSender);
+ CAmRouter(CAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSender);
am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
- ~Router();
+ ~CAmRouter();
private:
am_Error_e findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, std::vector<am_RoutingElement_s>& listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator);
void listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e>& listFormats) const;
void listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e>& listFormats) const;
- DatabaseHandler* mDatabaseHandler;
- ControlSender* mControlSender;
+ CAmDatabaseHandler* mDatabaseHandler;
+ CAmControlSender* mControlSender;
};
-class RoutingTreeItem
+class CAmRoutingTreeItem
{
public:
- RoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID = 0, RoutingTreeItem *parent = 0);
- void appendChild(RoutingTreeItem *newChild);
- void returnChildItems(std::vector<RoutingTreeItem*> listChildItems);
+ CAmRoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID = 0, CAmRoutingTreeItem *parent = 0);
+ void appendChild(CAmRoutingTreeItem *newChild);
+ void returnChildItems(std::vector<CAmRoutingTreeItem*> listChildItems);
am_domainID_t returnDomainID() const;
am_gatewayID_t returnGatewayID() const;
- virtual ~RoutingTreeItem();
- RoutingTreeItem* returnParent() const;
+ virtual ~CAmRoutingTreeItem();
+ CAmRoutingTreeItem* returnParent() const;
private:
- std::vector<RoutingTreeItem*> mListChildItems; //!< List of all child items
+ std::vector<CAmRoutingTreeItem*> mListChildItems; //!< List of all child items
am_domainID_t mDomainID; //!< the domain ID of the item
am_gatewayID_t mGatewayID; //!< the gateway Id
- RoutingTreeItem *mParentItem; //!< pointer to the parent item
+ CAmRoutingTreeItem *mParentItem; //!< pointer to the parent item
};
-class RoutingTree
+class CAmRoutingTree
{
public:
- RoutingTree(const am_domainID_t rootDomainID);
- RoutingTreeItem* insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, RoutingTreeItem *parent);
- void getRoute(RoutingTreeItem* targetItem, std::vector<am_gatewayID_t>& listGateways);
+ CAmRoutingTree(const am_domainID_t rootDomainID);
+ CAmRoutingTreeItem* insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, CAmRoutingTreeItem *parent);
+ void getRoute(CAmRoutingTreeItem* targetItem, std::vector<am_gatewayID_t>& listGateways);
am_domainID_t returnRootDomainID() const;
- RoutingTreeItem* returnRootItem();
- virtual ~RoutingTree();
+ CAmRoutingTreeItem* returnRootItem();
+ virtual ~CAmRoutingTree();
private:
- RoutingTreeItem mRootItem; //!< pointer to root item
- std::vector<RoutingTreeItem*> mListChild; //!< list of all childs
+ CAmRoutingTreeItem mRootItem; //!< pointer to root item
+ std::vector<CAmRoutingTreeItem*> mListChild; //!< list of all childs
};
} /* namespace am */
diff --git a/AudioManagerDaemon/include/RoutingReceiver.h b/AudioManagerDaemon/include/CAmRoutingReceiver.h
index ae964ff..dfacc3b 100644
--- a/AudioManagerDaemon/include/RoutingReceiver.h
+++ b/AudioManagerDaemon/include/CAmRoutingReceiver.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file RoutingReceiver.h
+ * \file CAmRoutingReceiver.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -25,27 +25,27 @@
#ifndef ROUTINGRECEIVER_H_
#define ROUTINGRECEIVER_H_
-#include <routing/RoutingReceiveInterface.h>
+#include <routing/IAmRoutingReceive.h>
#include <config.h>
namespace am
{
-class SocketHandler;
-class DBusWrapper;
-class DatabaseHandler;
-class RoutingSender;
-class ControlSender;
+class CAmSocketHandler;
+class CAmDbusWrapper;
+class CAmDatabaseHandler;
+class CAmRoutingSender;
+class CAmControlSender;
/**
* Implements the Receiving side of the RoutingPlugins.
*/
-class RoutingReceiver: public RoutingReceiveInterface
+class CAmRoutingReceiver: public IAmRoutingReceive
{
public:
- RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler);
- RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper);
- ~RoutingReceiver();
+ CAmRoutingReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler);
+ CAmRoutingReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper);
+ ~CAmRoutingReceiver();
void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
@@ -80,8 +80,8 @@ public:
void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState);
void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay);
void sendChangedData(const std::vector<am_EarlyData_s>& earlyData);
- am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const;
- am_Error_e getSocketHandler(SocketHandler*& socketHandler) const;
+ am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const;
+ am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const;
void getInterfaceVersion(std::string& version) const;
void confirmRoutingReady(const uint16_t handle);
void confirmRoutingRundown(const uint16_t handle);
@@ -93,11 +93,11 @@ public:
void waitOnRundown(bool rundown); //!< tells the RoutingReceiver to start waiting for all handles to be confirmed
private:
- DatabaseHandler *mDatabaseHandler; //!< pointer to the databaseHandler
- RoutingSender *mRoutingSender; //!< pointer to the routingSender
- ControlSender *mControlSender; //!< pointer to the controlSender
- SocketHandler *mSocketHandler; //!< pointer to sockethandler
- DBusWrapper *mDBusWrapper; //!< pointer to dbuswrapper
+ CAmDatabaseHandler *mDatabaseHandler; //!< pointer to the databaseHandler
+ CAmRoutingSender *mRoutingSender; //!< pointer to the routingSender
+ CAmControlSender *mControlSender; //!< pointer to the controlSender
+ CAmSocketHandler *mSocketHandler; //!< pointer to sockethandler
+ CAmDbusWrapper *mDBusWrapper; //!< pointer to dbuswrapper
uint16_t handleCount; //!< counts all handles
std::vector<uint16_t> mListStartupHandles; //!< list of handles that wait for a confirm
diff --git a/AudioManagerDaemon/include/RoutingSender.h b/AudioManagerDaemon/include/CAmRoutingSender.h
index f445313..c6a7677 100644
--- a/AudioManagerDaemon/include/RoutingSender.h
+++ b/AudioManagerDaemon/include/CAmRoutingSender.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file RoutingSender.h
+ * \file CAmRoutingSender.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -25,26 +25,26 @@
#ifndef ROUTINGSENDER_H_
#define ROUTINGSENDER_H_
-#include "routing/RoutingSendInterface.h"
+#include "routing/IAmRoutingSend.h"
#include <map>
#ifdef UNIT_TEST //this is needed to test RoutingSender
-#include "../test/RoutingInterfaceBackdoor.h"
+#include "../test/IAmRoutingBackdoor.h"
#endif
namespace am
{
-class RoutingReceiver;
+class CAmRoutingReceiver;
/**
* Implements the RoutingSendInterface. Loads all plugins and dispatches calls to the plugins
*/
-class RoutingSender
+class CAmRoutingSender
{
public:
- RoutingSender(const std::vector<std::string>& listOfPluginDirectories);
- ~RoutingSender();
+ CAmRoutingSender(const std::vector<std::string>& listOfPluginDirectories);
+ ~CAmRoutingSender();
/**
* removes a handle from the list
@@ -97,7 +97,7 @@ public:
* this removes the Crossfader to the lookup table of the Router. This must be done everytime a crossfader is deregistered.
*/
am_Error_e removeCrossfaderLookup(const am_crossfaderID_t crossfaderID);
- am_Error_e startupInterfaces(RoutingReceiver* iRoutingReceiver);
+ am_Error_e startupInterfaces(CAmRoutingReceiver* iRoutingReceiver);
void setRoutingReady();
void setRoutingRundown();
am_Error_e asyncAbort(const am_Handle_s& handle);
@@ -119,7 +119,7 @@ public:
//!< is used to pair interfaces with busnames
struct InterfaceNamePairs
{
- RoutingSendInterface* routingInterface;
+ IAmRoutingSend* routingInterface;
std::string busName;
};
@@ -146,7 +146,7 @@ public:
};
#ifdef UNIT_TEST //this is needed to test RoutingSender
- friend class RoutingInterfaceBackdoor;
+ friend class IAmRoutingBackdoor;
#endif
/**
@@ -176,12 +176,12 @@ private:
am_Handle_s createHandle(const am_handleData_c& handleData, const am_Handle_e type);
void unloadLibraries(void); //!< unloads all loaded plugins
- typedef std::map<am_domainID_t, RoutingSendInterface*> DomainInterfaceMap; //!< maps domains to interfaces
- typedef std::map<am_sinkID_t, RoutingSendInterface*> SinkInterfaceMap; //!< maps sinks to interfaces
- typedef std::map<am_sourceID_t, RoutingSendInterface*> SourceInterfaceMap; //!< maps sources to interfaces
- typedef std::map<am_crossfaderID_t, RoutingSendInterface*> CrossfaderInterfaceMap; //!< maps crossfaders to interfaces
- typedef std::map<am_connectionID_t, RoutingSendInterface*> ConnectionInterfaceMap; //!< maps connections to interfaces
- typedef std::map<uint16_t, RoutingSendInterface*> HandleInterfaceMap; //!< maps handles to interfaces
+ typedef std::map<am_domainID_t, IAmRoutingSend*> DomainInterfaceMap; //!< maps domains to interfaces
+ typedef std::map<am_sinkID_t, IAmRoutingSend*> SinkInterfaceMap; //!< maps sinks to interfaces
+ typedef std::map<am_sourceID_t, IAmRoutingSend*> SourceInterfaceMap; //!< maps sources to interfaces
+ typedef std::map<am_crossfaderID_t, IAmRoutingSend*> CrossfaderInterfaceMap; //!< maps crossfaders to interfaces
+ typedef std::map<am_connectionID_t, IAmRoutingSend*> ConnectionInterfaceMap; //!< maps connections to interfaces
+ typedef std::map<uint16_t, IAmRoutingSend*> HandleInterfaceMap; //!< maps handles to interfaces
typedef std::map<am_Handle_s, am_handleData_c, comparator> HandlesMap; //!< maps handleData to handles
int16_t mHandleCount; //!< is used to create handles
@@ -194,7 +194,7 @@ private:
SinkInterfaceMap mMapSinkInterface; //!< map of sinks to interfaces
SourceInterfaceMap mMapSourceInterface; //!< map of sources to interfaces
HandleInterfaceMap mMapHandleInterface; //!< map of handles to interfaces
- RoutingReceiver *mRoutingReceiver;
+ CAmRoutingReceiver *mRoutingReceiver;
};
}
diff --git a/AudioManagerDaemon/include/CAmTelnetMenuHelper.h b/AudioManagerDaemon/include/CAmTelnetMenuHelper.h
index 5322526..54a0ee5 100644
--- a/AudioManagerDaemon/include/CAmTelnetMenuHelper.h
+++ b/AudioManagerDaemon/include/CAmTelnetMenuHelper.h
@@ -41,17 +41,17 @@
namespace am
{
-class TelnetServer;
-class DatabaseHandler;
-class CommandSender;
-class RoutingSender;
-class ControlSender;
-class CommandReceiver;
-class RoutingReceiver;
-class ControlReceiver;
-
-class Router;
-class SocketHandler;
+class CAmTelnetServer;
+class CAmDatabaseHandler;
+class CAmCommandSender;
+class CAmRoutingSender;
+class CAmControlSender;
+class CAmCommandReceiver;
+class CAmRoutingReceiver;
+class CAmControlReceiver;
+
+class CAmRouter;
+class CAmSocketHandler;
class CAmTelnetMenuHelper
{
@@ -62,7 +62,7 @@ public:
eRootState = 0, eListState, eInfoState, eGetState, eSetState
};
- CAmTelnetMenuHelper(SocketHandler *iSocketHandler, CommandSender *iCommandSender, CommandReceiver *iCommandReceiver, RoutingSender *iRoutingSender, RoutingReceiver *iRoutingReceiver, ControlSender *iControlSender, ControlReceiver *iControlReceiver, DatabaseHandler *iDatabasehandler, Router *iRouter, TelnetServer *iTelnetServer);
+ CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer);
~CAmTelnetMenuHelper();
@@ -171,16 +171,16 @@ private:
std::map<int, EMainState> mCurrentMainStateMap;
static CAmTelnetMenuHelper* instance;
- TelnetServer *mpTelenetServer;
- SocketHandler *mpSocketHandler;
- CommandSender *mpCommandSender;
- CommandReceiver *mpCommandReceiver;
- RoutingSender *mpRoutingSender;
- RoutingReceiver *mpRoutingReceiver;
- ControlSender *mpControlSender;
- ControlReceiver *mpControlReceiver;
- DatabaseHandler *mpDatabasehandler;
- Router *mpRouter;
+ CAmTelnetServer *mpTelenetServer;
+ CAmSocketHandler *mpSocketHandler;
+ CAmCommandSender *mpCommandSender;
+ CAmCommandReceiver *mpCommandReceiver;
+ CAmRoutingSender *mpRoutingSender;
+ CAmRoutingReceiver *mpRoutingReceiver;
+ CAmControlSender *mpControlSender;
+ CAmControlReceiver *mpControlReceiver;
+ CAmDatabaseHandler *mpDatabasehandler;
+ CAmRouter *mpRouter;
tCommandMap mRootCommands;
tCommandMap mListCommands;
diff --git a/AudioManagerDaemon/include/TelnetServer.h b/AudioManagerDaemon/include/CAmTelnetServer.h
index f95bd84..f7bf274 100644
--- a/AudioManagerDaemon/include/TelnetServer.h
+++ b/AudioManagerDaemon/include/CAmTelnetServer.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file TelnetServer.h
+ * \file CAmTelnetServer.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -25,7 +25,7 @@
#ifndef TELNETSERVER_H_
#define TELNETSERVER_H_
-#include "SocketHandler.h"
+#include "shared/CAmSocketHandler.h"
#include "CAmTelnetMenuHelper.h"
#include <queue>
#include <map>
@@ -33,41 +33,41 @@
namespace am
{
-class DatabaseHandler;
-class CommandSender;
-class RoutingSender;
-class ControlSender;
-class CommandReceiver;
-class RoutingReceiver;
-class ControlReceiver;
-class Router;
+class CAmDatabaseHandler;
+class CAmCommandSender;
+class CAmRoutingSender;
+class CAmControlSender;
+class CAmCommandReceiver;
+class CAmRoutingReceiver;
+class CAmControlReceiver;
+class CAmRouter;
class CAmTelnetMenuHelper;
-class TelnetServer
+class CAmTelnetServer
{
public:
- TelnetServer(SocketHandler *iSocketHandler,
- CommandSender *iCommandSender,
- CommandReceiver *iCommandReceiver,
- RoutingSender *iRoutingSender,
- RoutingReceiver *iRoutingReceiver,
- ControlSender *iControlSender,
- ControlReceiver *iControlReceiver,
- DatabaseHandler *iDatabasehandler,
- Router *iRouter,
+ CAmTelnetServer(CAmSocketHandler *iSocketHandler,
+ CAmCommandSender *iCommandSender,
+ CAmCommandReceiver *iCommandReceiver,
+ CAmRoutingSender *iRoutingSender,
+ CAmRoutingReceiver *iRoutingReceiver,
+ CAmControlSender *iControlSender,
+ CAmControlReceiver *iControlReceiver,
+ CAmDatabaseHandler *iDatabasehandler,
+ CAmRouter *iRouter,
unsigned int servPort,
unsigned int maxConnections);
- ~TelnetServer();
+ ~CAmTelnetServer();
void connectSocket(const pollfd pfd, const sh_pollHandle_t handle, void* userData);
void disconnectClient(int filedescriptor);
void receiveData(const pollfd pfd, const sh_pollHandle_t handle, void* userData);
bool dispatchData(const sh_pollHandle_t handle, void* userData);
bool check(const sh_pollHandle_t handle, void* userData);
- shPollFired_T<TelnetServer> telnetConnectFiredCB;
- shPollFired_T<TelnetServer> telnetReceiveFiredCB;
- shPollDispatch_T<TelnetServer> telnetDispatchCB;
- shPollCheck_T<TelnetServer> telnetCheckCB;
+ TAmShPollFired<CAmTelnetServer> telnetConnectFiredCB;
+ TAmShPollFired<CAmTelnetServer> telnetReceiveFiredCB;
+ TAmShPollDispatch<CAmTelnetServer> telnetDispatchCB;
+ TAmShPollCheck<CAmTelnetServer> telnetCheckCB;
private:
typedef void (*CommandPrototype)(std::vector<std::string>& msg,int filedescriptor);
@@ -81,16 +81,16 @@ private:
sh_pollHandle_t handle;
};
- static TelnetServer* instance;
- SocketHandler *mSocketHandler;
- CommandSender *mCommandSender;
- CommandReceiver *mCommandReceiver;
- RoutingSender *mRoutingSender;
- RoutingReceiver *mRoutingReceiver;
- ControlSender *mControlSender;
- ControlReceiver *mControlReceiver;
- DatabaseHandler *mDatabasehandler;
- Router *mRouter;
+ static CAmTelnetServer* instance;
+ CAmSocketHandler *mSocketHandler;
+ CAmCommandSender *mCommandSender;
+ CAmCommandReceiver *mCommandReceiver;
+ CAmRoutingSender *mRoutingSender;
+ CAmRoutingReceiver *mRoutingReceiver;
+ CAmControlSender *mControlSender;
+ CAmControlReceiver *mControlReceiver;
+ CAmDatabaseHandler *mDatabasehandler;
+ CAmRouter *mRouter;
sh_pollHandle_t mConnecthandle;
std::queue<std::string> mMsgList;
std::vector<connection_s> mListConnections;
diff --git a/AudioManagerDaemon/include/mainpage.h b/AudioManagerDaemon/include/DAmDoxygenMainPage.h
index 8d8fdab..e27b233 100644
--- a/AudioManagerDaemon/include/mainpage.h
+++ b/AudioManagerDaemon/include/DAmDoxygenMainPage.h
@@ -46,7 +46,7 @@
* \section routing_adaptor Routing Adapter
*
* Via this adapter, the interconnection from the AudioManager to the AudioDomains is accomplished. An AudioDomain shall have exactly one RoutingAdapter. In the terms of GENIVI, a RoutingAdapter is an AbstractComponent, this means that we define an API and a certain behavior in UML models but do not maintain components itself. Existing implementations from Proof of Concepts are shipped as example Adapters "as is" but cannot be seen as maintained components.\n
- * The implementation of a routing adapter can and will vary from each project to another since the combination of sinks and sources, the used hardware etc has influence on the adapters. Besides interchanging and abstracting information between the AudioManager and the sinks and sources, the Adapters also need to implement some business logic in order to interact with the AudioManager. This includes for example the registering of components, managing the current state, error handling etc.\n
+ * The implementation of a routing adapter can and will vary from each project to another since the combination of sinks and sources, the used hardware etc has influence on the adapters. Besides interchanging and abstracting information between the AudioManager and the sinks and sources, the Adapters also need to implement some business logic in order to interact with the AudioManager. This include for example the registering of components, managing the current state, error handling etc.\n
* In the special case of an EarlyDomain, the routing adapter also has to manage start-up and rundown including persistence for his domain while the AudioManager is not started or already stopped. During this periods of time, these special adapters have to be able to fulfill basic tasks like changing volumes, for example (this implies that the Adapter is implemented on a different piece of hardware, e.g. vehicle processor).
*
* \section Gateway
diff --git a/AudioManagerDaemon/include/PluginTemplate.h b/AudioManagerDaemon/include/TAmPluginTemplate.h
index 2c4dc42..e525ce3 100644
--- a/AudioManagerDaemon/include/PluginTemplate.h
+++ b/AudioManagerDaemon/include/TAmPluginTemplate.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file pluginTemplate.h
+ * \file TAmPluginTemplate.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -27,7 +27,7 @@
#include <dlfcn.h>
#include <libgen.h>
-#include "DLTWrapper.h"
+#include "shared/CAmDltWrapper.h"
namespace am
{
diff --git a/AudioManagerDaemon/src/CommandReceiver.cpp b/AudioManagerDaemon/src/CAmCommandReceiver.cpp
index 21e19d9..c6f760c 100644
--- a/AudioManagerDaemon/src/CommandReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmCommandReceiver.cpp
@@ -22,17 +22,18 @@
*
*/
-#include "CommandReceiver.h"
-#include "DatabaseHandler.h"
-#include "ControlSender.h"
-#include "DLTWrapper.h"
-#include <SocketHandler.h>
+#include "CAmCommandReceiver.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmControlSender.h"
+#include "shared/CAmDltWrapper.h"
+#include <shared/CAmSocketHandler.h>
#include <cassert>
#include <algorithm>
-using namespace am;
+namespace am
+{
-CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSender *iControlSender, SocketHandler *iSocketHandler) :
+CAmCommandReceiver::CAmCommandReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler) :
mDatabaseHandler(iDatabaseHandler), //
mControlSender(iControlSender), //
mSocketHandler(iSocketHandler), //
@@ -47,7 +48,7 @@ CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSende
assert(mControlSender!=NULL);
}
-CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper) :
+CAmCommandReceiver::CAmCommandReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper) :
mDatabaseHandler(iDatabaseHandler), //
mControlSender(iControlSender), //
mDBusWrapper(iDBusWrapper), //
@@ -63,105 +64,105 @@ CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSende
assert(mDBusWrapper!=NULL);
}
-CommandReceiver::~CommandReceiver()
+CAmCommandReceiver::~CAmCommandReceiver()
{
}
-am_Error_e CommandReceiver::connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
+am_Error_e CAmCommandReceiver::connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
logInfo("CommandReceiver::connect got called, sourceID=", sourceID, "sinkID=", sinkID);
return mControlSender->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID);
}
-am_Error_e CommandReceiver::disconnect(const am_mainConnectionID_t mainConnectionID)
+am_Error_e CAmCommandReceiver::disconnect(const am_mainConnectionID_t mainConnectionID)
{
logInfo("CommandReceiver::disconnect got called, mainConnectionID=", mainConnectionID);
return mControlSender->hookUserDisconnectionRequest(mainConnectionID);
}
-am_Error_e CommandReceiver::setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume)
+am_Error_e CAmCommandReceiver::setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
logInfo("CommandReceiver::setVolume got called, sinkID=", sinkID, "volume=", volume);
return mControlSender->hookUserVolumeChange(sinkID, volume);
}
-am_Error_e CommandReceiver::volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep)
+am_Error_e CAmCommandReceiver::volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep)
{
logInfo("CommandReceiver::volumeStep got called, sinkID=", sinkID, "volumeStep=", volumeStep);
return mControlSender->hookUserVolumeStep(sinkID, volumeStep);
}
-am_Error_e CommandReceiver::setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
+am_Error_e CAmCommandReceiver::setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
logInfo("CommandReceiver::setSinkMuteState got called, sinkID=", sinkID, "muteState=", muteState);
return mControlSender->hookUserSetSinkMuteState(sinkID, muteState);
}
-am_Error_e CommandReceiver::setMainSinkSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
+am_Error_e CAmCommandReceiver::setMainSinkSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
logInfo("CommandReceiver::setMainSinkSoundProperty got called, sinkID=", sinkID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
return mControlSender->hookUserSetMainSinkSoundProperty(sinkID, soundProperty);
}
-am_Error_e CommandReceiver::setMainSourceSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e CAmCommandReceiver::setMainSourceSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
logInfo("CommandReceiver::setMainSourceSoundProperty got called, sourceID=", sourceID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
return mControlSender->hookUserSetMainSourceSoundProperty(sourceID, soundProperty);
}
-am_Error_e CommandReceiver::setSystemProperty(const am_SystemProperty_s & property)
+am_Error_e CAmCommandReceiver::setSystemProperty(const am_SystemProperty_s & property)
{
logInfo("CommandReceiver::setSystemProperty got called", "type=", property.type, "soundPropertyValue=", property.value);
return mControlSender->hookUserSetSystemProperty(property);
}
-am_Error_e CommandReceiver::getListMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
+am_Error_e CAmCommandReceiver::getListMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
return mDatabaseHandler->getListVisibleMainConnections(listConnections);
}
-am_Error_e CommandReceiver::getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const
+am_Error_e CAmCommandReceiver::getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const
{
return mDatabaseHandler->getListMainSinks(listMainSinks);
}
-am_Error_e CommandReceiver::getListMainSources(std::vector<am_SourceType_s>& listMainSources) const
+am_Error_e CAmCommandReceiver::getListMainSources(std::vector<am_SourceType_s>& listMainSources) const
{
return mDatabaseHandler->getListMainSources(listMainSources);
}
-am_Error_e CommandReceiver::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
+am_Error_e CAmCommandReceiver::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
{
return mDatabaseHandler->getListMainSinkSoundProperties(sinkID, listSoundProperties);
}
-am_Error_e CommandReceiver::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
+am_Error_e CAmCommandReceiver::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
{
return mDatabaseHandler->getListMainSourceSoundProperties(sourceID, listSourceProperties);
}
-am_Error_e CommandReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
+am_Error_e CAmCommandReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
return mDatabaseHandler->getListSourceClasses(listSourceClasses);
}
-am_Error_e CommandReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
+am_Error_e CAmCommandReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
return mDatabaseHandler->getListSinkClasses(listSinkClasses);
}
-am_Error_e CommandReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
+am_Error_e CAmCommandReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
return mDatabaseHandler->getListSystemProperties(listSystemProperties);
}
-am_Error_e CommandReceiver::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
+am_Error_e CAmCommandReceiver::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
{
return mDatabaseHandler->getTimingInformation(mainConnectionID, delay);
}
-am_Error_e CommandReceiver::getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const
+am_Error_e CAmCommandReceiver::getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const
{
#ifdef WITH_DBUS_WRAPPER
dbusConnectionWrapper = mDBusWrapper;
@@ -171,52 +172,53 @@ am_Error_e CommandReceiver::getDBusConnectionWrapper(DBusWrapper*& dbusConnectio
#endif /*WITH_DBUS_WRAPPER*/
}
-am_Error_e CommandReceiver::getSocketHandler(SocketHandler *& socketHandler) const
+am_Error_e CAmCommandReceiver::getSocketHandler(CAmSocketHandler *& socketHandler) const
{
socketHandler = mSocketHandler;
return E_OK;
}
-void CommandReceiver::getInterfaceVersion(std::string & version) const
+void CAmCommandReceiver::getInterfaceVersion(std::string & version) const
{
version = CommandReceiveVersion;
}
-void CommandReceiver::confirmCommandReady(const uint16_t handle)
+void CAmCommandReceiver::confirmCommandReady(const uint16_t handle)
{
mListStartupHandles.erase(std::remove(mListStartupHandles.begin(), mListStartupHandles.end(), handle), mListStartupHandles.end());
if (mWaitStartup && mListStartupHandles.empty())
mControlSender->confirmCommandReady();
}
-void CommandReceiver::confirmCommandRundown(const uint16_t handle)
+void CAmCommandReceiver::confirmCommandRundown(const uint16_t handle)
{
mListRundownHandles.erase(std::remove(mListRundownHandles.begin(), mListRundownHandles.end(), handle), mListRundownHandles.end());
if (mWaitRundown && mListRundownHandles.empty())
mControlSender->confirmCommandRundown();
}
-uint16_t CommandReceiver::getStartupHandle()
+uint16_t CAmCommandReceiver::getStartupHandle()
{
uint16_t handle = ++handleCount; //todo: handle overflow
mListStartupHandles.push_back(handle);
return handle;
}
-uint16_t CommandReceiver::getRundownHandle()
+uint16_t CAmCommandReceiver::getRundownHandle()
{
uint16_t handle = ++handleCount; //todo: handle overflow
mListRundownHandles.push_back(handle);
return handle;
}
-void CommandReceiver::waitOnStartup(bool startup)
+void CAmCommandReceiver::waitOnStartup(bool startup)
{
mWaitStartup = startup;
}
-void CommandReceiver::waitOnRundown(bool rundown)
+void CAmCommandReceiver::waitOnRundown(bool rundown)
{
mWaitRundown = rundown;
}
+}
diff --git a/AudioManagerDaemon/src/CommandSender.cpp b/AudioManagerDaemon/src/CAmCommandSender.cpp
index c613a4e..0ada15c 100644
--- a/AudioManagerDaemon/src/CommandSender.cpp
+++ b/AudioManagerDaemon/src/CAmCommandSender.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file CommandSender.cpp
+ * \file CAmCommandSender.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,29 +22,30 @@
*
*/
-#include "CommandSender.h"
+#include "CAmCommandSender.h"
#include <dirent.h>
#include <sstream>
#include <string>
-#include "CommandReceiver.h"
-#include "PluginTemplate.h"
-#include "DLTWrapper.h"
+#include "CAmCommandReceiver.h"
+#include "TAmPluginTemplate.h"
+#include "shared/CAmDltWrapper.h"
-using namespace am;
+namespace am
+{
#define REQUIRED_INTERFACE_VERSION_MAJOR 1
#define REQUIRED_INTERFACE_VERSION_MINOR 0
//!< macro to call all interfaces
#define CALL_ALL_INTERFACES(...) \
- std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin(); \
- std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end(); \
+ std::vector<IAmCommandSend*>::iterator iter = mListInterfaces.begin(); \
+ std::vector<IAmCommandSend*>::iterator iterEnd = mListInterfaces.end(); \
for (; iter<iterEnd;++iter) \
{ \
(*iter)->__VA_ARGS__; \
}
-CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirectories) :
+CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginDirectories) :
mListInterfaces(), //
mListLibraryHandles(), //
mListLibraryNames(), //
@@ -93,9 +94,9 @@ CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirecto
for (; iter < iterEnd; ++iter)
{
logInfo("Loading CommandSender plugin", *iter);
- CommandSendInterface* (*createFunc)();
+ IAmCommandSend* (*createFunc)();
void* tempLibHandle = NULL;
- createFunc = getCreateFunction<CommandSendInterface*()>(*iter, tempLibHandle);
+ createFunc = getCreateFunction<IAmCommandSend*()>(*iter, tempLibHandle);
if (!createFunc)
{
@@ -103,7 +104,7 @@ CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirecto
continue;
}
- CommandSendInterface* commander = createFunc();
+ IAmCommandSend* commander = createFunc();
if (!commander)
{
@@ -130,18 +131,18 @@ CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirecto
}
}
-CommandSender::~CommandSender()
+CAmCommandSender::~CAmCommandSender()
{
unloadLibraries();
}
-am_Error_e CommandSender::startupInterfaces(CommandReceiver *iCommandReceiver)
+am_Error_e CAmCommandSender::startupInterfaces(CAmCommandReceiver *iCommandReceiver)
{
mCommandReceiver = iCommandReceiver;
am_Error_e returnError = E_OK;
- std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin();
- std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end();
+ std::vector<IAmCommandSend*>::iterator iter = mListInterfaces.begin();
+ std::vector<IAmCommandSend*>::iterator iterEnd = mListInterfaces.end();
for (; iter < iterEnd; ++iter)
{
am_Error_e error = (*iter)->startupInterface(iCommandReceiver);
@@ -153,96 +154,96 @@ am_Error_e CommandSender::startupInterfaces(CommandReceiver *iCommandReceiver)
return returnError;
}
-void CommandSender::cbNumberOfSinkClassesChanged()
+void CAmCommandSender::cbNumberOfSinkClassesChanged()
{
CALL_ALL_INTERFACES(cbNumberOfSinkClassesChanged())
}
-void CommandSender::cbNumberOfSourceClassesChanged()
+void CAmCommandSender::cbNumberOfSourceClassesChanged()
{
CALL_ALL_INTERFACES(cbNumberOfSourceClassesChanged())
}
-void CommandSender::cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
+void CAmCommandSender::cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
{
CALL_ALL_INTERFACES(cbMainConnectionStateChanged(connectionID,connectionState))
}
-void CommandSender::cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty)
+void CAmCommandSender::cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty)
{
CALL_ALL_INTERFACES(cbMainSinkSoundPropertyChanged(sinkID,SoundProperty))
}
-void CommandSender::cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty)
+void CAmCommandSender::cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty)
{
CALL_ALL_INTERFACES(cbMainSourceSoundPropertyChanged(sourceID,SoundProperty))
}
-void CommandSender::cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
+void CAmCommandSender::cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
CALL_ALL_INTERFACES(cbSinkAvailabilityChanged(sinkID,availability))
}
-void CommandSender::cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
+void CAmCommandSender::cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
CALL_ALL_INTERFACES(cbSourceAvailabilityChanged(sourceID,availability))
}
-void CommandSender::cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
+void CAmCommandSender::cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
CALL_ALL_INTERFACES(cbVolumeChanged(sinkID,volume))
}
-void CommandSender::cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
+void CAmCommandSender::cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
CALL_ALL_INTERFACES(cbSinkMuteStateChanged(sinkID,muteState))
}
-void CommandSender::cbSystemPropertyChanged(const am_SystemProperty_s & SystemProperty)
+void CAmCommandSender::cbSystemPropertyChanged(const am_SystemProperty_s & SystemProperty)
{
CALL_ALL_INTERFACES(cbSystemPropertyChanged(SystemProperty))
}
-void CommandSender::cbTimingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
+void CAmCommandSender::cbTimingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
{
CALL_ALL_INTERFACES(cbTimingInformationChanged(mainConnection,time))
}
-void CommandSender::cbNewMainConnection(const am_MainConnectionType_s mainConnection)
+void CAmCommandSender::cbNewMainConnection(const am_MainConnectionType_s mainConnection)
{
CALL_ALL_INTERFACES(cbNewMainConnection(mainConnection))
}
-void CommandSender::cbRemovedMainConnection(const am_mainConnectionID_t mainConnection)
+void CAmCommandSender::cbRemovedMainConnection(const am_mainConnectionID_t mainConnection)
{
CALL_ALL_INTERFACES(cbRemovedMainConnection(mainConnection))
}
-void CommandSender::cbNewSink(const am_SinkType_s sink)
+void CAmCommandSender::cbNewSink(const am_SinkType_s sink)
{
CALL_ALL_INTERFACES(cbNewSink(sink))
}
-void CommandSender::cbRemovedSink(const am_sinkID_t sink)
+void CAmCommandSender::cbRemovedSink(const am_sinkID_t sink)
{
CALL_ALL_INTERFACES(cbRemovedSink(sink))
}
-void CommandSender::cbNewSource(const am_SourceType_s source)
+void CAmCommandSender::cbNewSource(const am_SourceType_s source)
{
CALL_ALL_INTERFACES(cbNewSource(source))
}
-void CommandSender::cbRemovedSource(const am_sourceID_t source)
+void CAmCommandSender::cbRemovedSource(const am_sourceID_t source)
{
CALL_ALL_INTERFACES(cbRemovedSource(source))
}
-void CommandSender::setCommandReady()
+void CAmCommandSender::setCommandReady()
{
mCommandReceiver->waitOnStartup(false);
- std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin();
- std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end();
+ std::vector<IAmCommandSend*>::iterator iter = mListInterfaces.begin();
+ std::vector<IAmCommandSend*>::iterator iterEnd = mListInterfaces.end();
for (; iter < iterEnd; ++iter)
{
(*iter)->setCommandReady(mCommandReceiver->getStartupHandle());
@@ -250,11 +251,11 @@ void CommandSender::setCommandReady()
mCommandReceiver->waitOnStartup(true);
}
-void CommandSender::setCommandRundown()
+void CAmCommandSender::setCommandRundown()
{
mCommandReceiver->waitOnRundown(false);
- std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin();
- std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end();
+ std::vector<IAmCommandSend*>::iterator iter = mListInterfaces.begin();
+ std::vector<IAmCommandSend*>::iterator iterEnd = mListInterfaces.end();
for (; iter < iterEnd; ++iter)
{
(*iter)->setCommandRundown(mCommandReceiver->getRundownHandle());
@@ -262,18 +263,18 @@ void CommandSender::setCommandRundown()
mCommandReceiver->waitOnRundown(true);
}
-void CommandSender::getInterfaceVersion(std::string & version) const
+void CAmCommandSender::getInterfaceVersion(std::string & version) const
{
version = CommandSendVersion;
}
-am_Error_e am::CommandSender::getListPlugins(std::vector<std::string> & interfaces) const
+am_Error_e am::CAmCommandSender::getListPlugins(std::vector<std::string> & interfaces) const
{
interfaces = mListLibraryNames;
return E_OK;
}
-void CommandSender::unloadLibraries(void)
+void CAmCommandSender::unloadLibraries(void)
{
std::vector<void*>::iterator iterator = mListLibraryHandles.begin();
for (; iterator < mListLibraryHandles.end(); ++iterator)
@@ -282,4 +283,4 @@ void CommandSender::unloadLibraries(void)
}
mListLibraryHandles.clear();
}
-
+}
diff --git a/AudioManagerDaemon/src/ControlReceiver.cpp b/AudioManagerDaemon/src/CAmControlReceiver.cpp
index 8ef8d23..6d68089 100644
--- a/AudioManagerDaemon/src/ControlReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmControlReceiver.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file ControlReceiver.cpp
+ * \file CAmControlReceiver.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -23,18 +23,18 @@
*/
#include <config.h>
-#include <SocketHandler.h>
-#include "ControlReceiver.h"
-#include "DatabaseHandler.h"
-#include "RoutingSender.h"
-#include "CommandSender.h"
-#include "Router.h"
-#include "DLTWrapper.h"
+#include <shared/CAmSocketHandler.h>
+#include "CAmControlReceiver.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmRoutingSender.h"
+#include "CAmCommandSender.h"
+#include "CAmRouter.h"
+#include "shared/CAmDltWrapper.h"
#include <cassert>
-using namespace am;
+namespace am {
-ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler, Router* iRouter) :
+CAmControlReceiver::CAmControlReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
mCommandSender(iCommandSender), //
@@ -48,18 +48,18 @@ ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSende
assert(mRouter!=NULL);
}
-ControlReceiver::~ControlReceiver()
+CAmControlReceiver::~CAmControlReceiver()
{
}
-am_Error_e ControlReceiver::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
+am_Error_e CAmControlReceiver::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
{
return mRouter->getRoute(onlyfree, sourceID, sinkID, returnList);
}
-am_Error_e ControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & connectionID, const am_ConnectionFormat_e format, const am_sourceID_t sourceID, const am_sinkID_t sinkID)
+am_Error_e CAmControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & connectionID, const am_ConnectionFormat_e format, const am_sourceID_t sourceID, const am_sinkID_t sinkID)
{
- logInfo("ControlReceiver::connect got called, connectionFormat=", format, "sourceID=", sourceID, "sinkID=", sinkID);
+ logInfo("CAmControlReceiver::connect got called, connectionFormat=", format, "sourceID=", sourceID, "sinkID=", sinkID);
am_Connection_s tempConnection;
tempConnection.sinkID = sinkID;
@@ -75,27 +75,27 @@ am_Error_e ControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & co
return mRoutingSender->asyncConnect(handle, connectionID, sourceID, sinkID, format);
}
-am_Error_e ControlReceiver::disconnect(am_Handle_s & handle, const am_connectionID_t connectionID)
+am_Error_e CAmControlReceiver::disconnect(am_Handle_s & handle, const am_connectionID_t connectionID)
{
- logInfo("ControlReceiver::disconnect got called, connectionID=", connectionID);
+ logInfo("CAmControlReceiver::disconnect got called, connectionID=", connectionID);
if (!mDatabaseHandler->existConnectionID(connectionID))
return E_NON_EXISTENT; //todo: check with EA model and correct
return mRoutingSender->asyncDisconnect(handle, connectionID);
}
-am_Error_e ControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime)
+am_Error_e CAmControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime)
{
- logInfo("ControlReceiver::crossfade got called, hotSource=", hotSource, "crossfaderID=", crossfaderID, "rampType=", rampType, "rampTime=", rampTime);
+ logInfo("CAmControlReceiver::crossfade got called, hotSource=", hotSource, "crossfaderID=", crossfaderID, "rampType=", rampType, "rampTime=", rampTime);
if (!mDatabaseHandler->existcrossFader(crossfaderID))
return E_NON_EXISTENT;
return mRoutingSender->asyncCrossFade(handle, crossfaderID, hotSource, rampType, rampTime);
}
-am_Error_e ControlReceiver::setSourceState(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SourceState_e state)
+am_Error_e CAmControlReceiver::setSourceState(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
- logInfo("ControlReceiver::setSourceState got called, sourceID=", sourceID, "state=", state);
+ logInfo("CAmControlReceiver::setSourceState got called, sourceID=", sourceID, "state=", state);
am_SourceState_e sourceState;
if (mDatabaseHandler->getSoureState(sourceID, sourceState) != E_OK)
@@ -105,9 +105,9 @@ am_Error_e ControlReceiver::setSourceState(am_Handle_s & handle, const am_source
return mRoutingSender->asyncSetSourceState(handle, sourceID, state);
}
-am_Error_e ControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
+am_Error_e CAmControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
- logInfo("ControlReceiver::setSinkVolume got called, sinkID=", sinkID, "volume=", volume, "ramp=", ramp, "time=", time);
+ logInfo("CAmControlReceiver::setSinkVolume got called, sinkID=", sinkID, "volume=", volume, "ramp=", ramp, "time=", time);
am_volume_t tempVolume;
if (mDatabaseHandler->getSinkVolume(sinkID, tempVolume) != E_OK)
@@ -117,9 +117,9 @@ am_Error_e ControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_
return mRoutingSender->asyncSetSinkVolume(handle, sinkID, volume, ramp, time);
}
-am_Error_e ControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e rampType, const am_time_t time)
+am_Error_e CAmControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e rampType, const am_time_t time)
{
- logInfo("ControlReceiver::setSourceVolume got called, sourceID=", sourceID, "volume=", volume, "ramp=", rampType, "time=", time);
+ logInfo("CAmControlReceiver::setSourceVolume got called, sourceID=", sourceID, "volume=", volume, "ramp=", rampType, "time=", time);
am_volume_t tempVolume;
if (mDatabaseHandler->getSourceVolume(sourceID, tempVolume) != E_OK)
@@ -129,9 +129,9 @@ am_Error_e ControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourc
return mRoutingSender->asyncSetSourceVolume(handle, sourceID, volume, rampType, time);
}
-am_Error_e ControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
+am_Error_e CAmControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
- logInfo("ControlReceiver::setSinkSoundProperty got called, sinkID=", sinkID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value);
+ logInfo("CAmControlReceiver::setSinkSoundProperty got called, sinkID=", sinkID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value);
uint16_t value;
if (mDatabaseHandler->getSinkSoundPropertyValue(sinkID, soundProperty.type, value) != E_OK)
@@ -141,9 +141,9 @@ am_Error_e ControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_
return mRoutingSender->asyncSetSinkSoundProperty(handle, sinkID, soundProperty);
}
-am_Error_e ControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
+am_Error_e CAmControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
- logInfo("ControlReceiver::setSinkSoundProperties got called, sinkID=", sinkID);
+ logInfo("CAmControlReceiver::setSinkSoundProperties got called, sinkID=", sinkID);
uint16_t value;
bool noChange = true;
@@ -160,9 +160,9 @@ am_Error_e ControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const a
return (mRoutingSender->asyncSetSinkSoundProperties(handle, listSoundProperties, sinkID));
}
-am_Error_e ControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
+am_Error_e CAmControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
{
- logInfo("ControlReceiver::setSourceSoundProperty got called, sourceID=", sourceID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value);
+ logInfo("CAmControlReceiver::setSourceSoundProperty got called, sourceID=", sourceID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value);
uint16_t value;
if (mDatabaseHandler->getSourceSoundPropertyValue(sourceID, soundProperty.type, value) != E_OK)
@@ -172,9 +172,9 @@ am_Error_e ControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const a
return mRoutingSender->asyncSetSourceSoundProperty(handle, sourceID, soundProperty);
}
-am_Error_e ControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
+am_Error_e CAmControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
- logInfo("ControlReceiver::setSourceSoundProperties got called, sourceID=", sourceID);
+ logInfo("CAmControlReceiver::setSourceSoundProperties got called, sourceID=", sourceID);
uint16_t value;
bool noChange = true;
@@ -191,9 +191,9 @@ am_Error_e ControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const
return (mRoutingSender->asyncSetSourceSoundProperties(handle, listSoundProperties, sourceID));
}
-am_Error_e ControlReceiver::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
+am_Error_e CAmControlReceiver::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- logInfo("ControlReceiver::setDomainState got called, domainID=", domainID, "domainState=", domainState);
+ logInfo("CAmControlReceiver::setDomainState got called, domainID=", domainID, "domainState=", domainState);
am_DomainState_e tempState = DS_UNKNOWN;
if (mDatabaseHandler->getDomainState(domainID, tempState) != E_OK)
@@ -203,312 +203,311 @@ am_Error_e ControlReceiver::setDomainState(const am_domainID_t domainID, const a
return mRoutingSender->setDomainState(domainID, domainState);
}
-am_Error_e ControlReceiver::abortAction(const am_Handle_s handle)
+am_Error_e CAmControlReceiver::abortAction(const am_Handle_s handle)
{
- logInfo("ControlReceiver::abortAction got called, handle.type=", handle.handle, "handle.handleType=", handle.handleType);
+ logInfo("CAmControlReceiver::abortAction got called, handle.type=", handle.handle, "handle.handleType=", handle.handleType);
return mRoutingSender->asyncAbort(handle);
}
-am_Error_e ControlReceiver::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
+am_Error_e CAmControlReceiver::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
{
return mDatabaseHandler->enterDomainDB(domainData, domainID);
}
-am_Error_e ControlReceiver::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
+am_Error_e CAmControlReceiver::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
{
return mDatabaseHandler->enterMainConnectionDB(mainConnectionData, connectionID);
}
-am_Error_e ControlReceiver::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+am_Error_e CAmControlReceiver::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
return mDatabaseHandler->enterSinkDB(sinkData, sinkID);
}
-am_Error_e ControlReceiver::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+am_Error_e CAmControlReceiver::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
return mDatabaseHandler->enterCrossfaderDB(crossfaderData, crossfaderID);
}
-am_Error_e ControlReceiver::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+am_Error_e CAmControlReceiver::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
return mDatabaseHandler->enterGatewayDB(gatewayData, gatewayID);
}
-am_Error_e ControlReceiver::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+am_Error_e CAmControlReceiver::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
return mDatabaseHandler->enterSourceDB(sourceData, sourceID);
}
-am_Error_e ControlReceiver::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
+am_Error_e CAmControlReceiver::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
{
return mDatabaseHandler->enterSinkClassDB(sinkClass, sinkClassID);
}
-am_Error_e ControlReceiver::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
+am_Error_e CAmControlReceiver::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
{
return mDatabaseHandler->enterSourceClassDB(sourceClassID, sourceClass);
}
-am_Error_e ControlReceiver::enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s> & listSystemProperties)
+am_Error_e CAmControlReceiver::enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s> & listSystemProperties)
{
return mDatabaseHandler->enterSystemProperties(listSystemProperties);
}
-am_Error_e ControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
+am_Error_e CAmControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
{
return mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, listConnectionID);
}
-am_Error_e ControlReceiver::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
+am_Error_e CAmControlReceiver::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
{
return mDatabaseHandler->changeMainConnectionStateDB(mainconnectionID, connectionState);
}
-am_Error_e ControlReceiver::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
+am_Error_e CAmControlReceiver::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
{
return mDatabaseHandler->changeSinkMainVolumeDB(mainVolume, sinkID);
}
-am_Error_e ControlReceiver::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
+am_Error_e CAmControlReceiver::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
{
return mDatabaseHandler->changeSinkAvailabilityDB(availability, sinkID);
}
-am_Error_e ControlReceiver::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
+am_Error_e CAmControlReceiver::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
{
return mDatabaseHandler->changDomainStateDB(domainState, domainID);
}
-am_Error_e ControlReceiver::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
+am_Error_e CAmControlReceiver::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
{
return mDatabaseHandler->changeSinkMuteStateDB(muteState, sinkID);
}
-am_Error_e ControlReceiver::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
+am_Error_e CAmControlReceiver::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
return mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sinkID);
}
-am_Error_e ControlReceiver::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e CAmControlReceiver::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
return mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sourceID);
}
-am_Error_e ControlReceiver::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
+am_Error_e CAmControlReceiver::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
{
return mDatabaseHandler->changeSourceAvailabilityDB(availability, sourceID);
}
-am_Error_e ControlReceiver::changeSystemPropertyDB(const am_SystemProperty_s & property)
+am_Error_e CAmControlReceiver::changeSystemPropertyDB(const am_SystemProperty_s & property)
{
return mDatabaseHandler->changeSystemPropertyDB(property);
}
-am_Error_e ControlReceiver::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
+am_Error_e CAmControlReceiver::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
{
return mDatabaseHandler->removeMainConnectionDB(mainConnectionID);
}
-am_Error_e ControlReceiver::removeSinkDB(const am_sinkID_t sinkID)
+am_Error_e CAmControlReceiver::removeSinkDB(const am_sinkID_t sinkID)
{
return mDatabaseHandler->removeSinkDB(sinkID);
}
-am_Error_e ControlReceiver::removeSourceDB(const am_sourceID_t sourceID)
+am_Error_e CAmControlReceiver::removeSourceDB(const am_sourceID_t sourceID)
{
return mDatabaseHandler->removeSourceDB(sourceID);
}
-am_Error_e ControlReceiver::removeGatewayDB(const am_gatewayID_t gatewayID)
+am_Error_e CAmControlReceiver::removeGatewayDB(const am_gatewayID_t gatewayID)
{
return mDatabaseHandler->removeGatewayDB(gatewayID);
}
-am_Error_e ControlReceiver::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
+am_Error_e CAmControlReceiver::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
return mDatabaseHandler->removeCrossfaderDB(crossfaderID);
}
-am_Error_e ControlReceiver::removeDomainDB(const am_domainID_t domainID)
+am_Error_e CAmControlReceiver::removeDomainDB(const am_domainID_t domainID)
{
return mDatabaseHandler->removeDomainDB(domainID);
}
-am_Error_e ControlReceiver::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
+am_Error_e CAmControlReceiver::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
{
return mDatabaseHandler->getSourceClassInfoDB(sourceID, classInfo);
}
-am_Error_e ControlReceiver::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
+am_Error_e CAmControlReceiver::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
{
return mDatabaseHandler->getSinkClassInfoDB(sinkID, sinkClass);
}
-am_Error_e ControlReceiver::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
+am_Error_e CAmControlReceiver::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
{
return mDatabaseHandler->getSinkInfoDB(sinkID, sinkData);
}
-am_Error_e ControlReceiver::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
+am_Error_e CAmControlReceiver::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
{
return mDatabaseHandler->getSourceInfoDB(sourceID, sourceData);
}
-am_Error_e ControlReceiver::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
+am_Error_e CAmControlReceiver::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
{
return mDatabaseHandler->getMainConnectionInfoDB(mainConnectionID, mainConnectionData);
}
-am_Error_e ControlReceiver::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
+am_Error_e CAmControlReceiver::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
{
return mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData);
}
-am_Error_e ControlReceiver::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
+am_Error_e CAmControlReceiver::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
return mDatabaseHandler->getCrossfaderInfoDB(crossfaderID, crossfaderData);
}
-am_Error_e ControlReceiver::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
+am_Error_e CAmControlReceiver::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
{
return mDatabaseHandler->getListSinksOfDomain(domainID, listSinkID);
}
-am_Error_e ControlReceiver::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
+am_Error_e CAmControlReceiver::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
{
return mDatabaseHandler->getListSourcesOfDomain(domainID, listSourceID);
}
-am_Error_e ControlReceiver::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listGatewaysID) const
+am_Error_e CAmControlReceiver::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listGatewaysID) const
{
return mDatabaseHandler->getListCrossfadersOfDomain(domainID, listGatewaysID);
}
-am_Error_e ControlReceiver::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
+am_Error_e CAmControlReceiver::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
{
return mDatabaseHandler->getListGatewaysOfDomain(domainID, listGatewaysID);
}
-am_Error_e ControlReceiver::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
+am_Error_e CAmControlReceiver::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
return mDatabaseHandler->getListMainConnections(listMainConnections);
}
-am_Error_e ControlReceiver::getListDomains(std::vector<am_Domain_s> & listDomains) const
+am_Error_e CAmControlReceiver::getListDomains(std::vector<am_Domain_s> & listDomains) const
{
return mDatabaseHandler->getListDomains(listDomains);
}
-am_Error_e ControlReceiver::getListConnections(std::vector<am_Connection_s> & listConnections) const
+am_Error_e CAmControlReceiver::getListConnections(std::vector<am_Connection_s> & listConnections) const
{
return mDatabaseHandler->getListConnections(listConnections);
}
-am_Error_e ControlReceiver::getListSinks(std::vector<am_Sink_s> & listSinks) const
+am_Error_e CAmControlReceiver::getListSinks(std::vector<am_Sink_s> & listSinks) const
{
return mDatabaseHandler->getListSinks(listSinks);
}
-am_Error_e ControlReceiver::getListSources(std::vector<am_Source_s> & listSources) const
+am_Error_e CAmControlReceiver::getListSources(std::vector<am_Source_s> & listSources) const
{
return mDatabaseHandler->getListSources(listSources);
}
-am_Error_e ControlReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
+am_Error_e CAmControlReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
return mDatabaseHandler->getListSourceClasses(listSourceClasses);
}
-am_Error_e ControlReceiver::getListHandles(std::vector<am_Handle_s> & listHandles) const
+am_Error_e CAmControlReceiver::getListHandles(std::vector<am_Handle_s> & listHandles) const
{
return mRoutingSender->getListHandles(listHandles);
}
-am_Error_e ControlReceiver::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
+am_Error_e CAmControlReceiver::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
{
return mDatabaseHandler->getListCrossfaders(listCrossfaders);
}
-am_Error_e ControlReceiver::getListGateways(std::vector<am_Gateway_s> & listGateways) const
+am_Error_e CAmControlReceiver::getListGateways(std::vector<am_Gateway_s> & listGateways) const
{
return mDatabaseHandler->getListGateways(listGateways);
}
-am_Error_e ControlReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
+am_Error_e CAmControlReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
return mDatabaseHandler->getListSinkClasses(listSinkClasses);
}
-am_Error_e ControlReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
+am_Error_e CAmControlReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
return mDatabaseHandler->getListSystemProperties(listSystemProperties);
}
-am_Error_e ControlReceiver::changeSinkClassInfoDB(const am_SinkClass_s & classInfo)
+am_Error_e CAmControlReceiver::changeSinkClassInfoDB(const am_SinkClass_s & classInfo)
{
return mDatabaseHandler->changeSinkClassInfoDB(classInfo);
}
-am_Error_e ControlReceiver::changeSourceClassInfoDB(const am_SourceClass_s & classInfo)
+am_Error_e CAmControlReceiver::changeSourceClassInfoDB(const am_SourceClass_s & classInfo)
{
return mDatabaseHandler->changeSourceClassInfoDB(classInfo);
}
-am_Error_e ControlReceiver::removeSinkClassDB(const am_sinkClass_t sinkClassID)
+am_Error_e CAmControlReceiver::removeSinkClassDB(const am_sinkClass_t sinkClassID)
{
return mDatabaseHandler->removeSinkClassDB(sinkClassID);
}
-am_Error_e ControlReceiver::removeSourceClassDB(const am_sourceClass_t sourceClassID)
+am_Error_e CAmControlReceiver::removeSourceClassDB(const am_sourceClass_t sourceClassID)
{
return mDatabaseHandler->removeSourceClassDB(sourceClassID);
}
-void ControlReceiver::setCommandReady()
+void CAmControlReceiver::setCommandReady()
{
- logInfo("ControlReceiver::setCommandReady got called");
+ logInfo("CAmControlReceiver::setCommandReady got called");
mCommandSender->setCommandReady();
}
-void ControlReceiver::setRoutingReady()
+void CAmControlReceiver::setRoutingReady()
{
- logInfo("ControlReceiver::setRoutingReady got called");
+ logInfo("CAmControlReceiver::setRoutingReady got called");
mRoutingSender->setRoutingReady();
}
-void ControlReceiver::confirmControllerReady()
+void CAmControlReceiver::confirmControllerReady()
{
//todo: one time implement here system interaction with NSM
}
-void ControlReceiver::confirmControllerRundown()
+void CAmControlReceiver::confirmControllerRundown()
{
//todo: one time implement here system interaction with NSM
}
-am_Error_e ControlReceiver::getSocketHandler(SocketHandler *& socketHandler)
+am_Error_e CAmControlReceiver::getSocketHandler(CAmSocketHandler *& socketHandler)
{
socketHandler = mSocketHandler;
return E_OK;
}
-void ControlReceiver::setCommandRundown()
+void CAmControlReceiver::setCommandRundown()
{
- logInfo("ControlReceiver::setCommandRundown got called");
+ logInfo("CAmControlReceiver::setCommandRundown got called");
mCommandSender->setCommandRundown();
}
-void ControlReceiver::setRoutingRundown()
+void CAmControlReceiver::setRoutingRundown()
{
- logInfo("ControlReceiver::setRoutingRundown got called");
+ logInfo("CAmControlReceiver::setRoutingRundown got called");
mRoutingSender->setRoutingRundown();
}
-void ControlReceiver::getInterfaceVersion(std::string & version) const
+void CAmControlReceiver::getInterfaceVersion(std::string & version) const
{
version = ControlReceiveVersion;
}
-
-
+}
diff --git a/AudioManagerDaemon/src/ControlSender.cpp b/AudioManagerDaemon/src/CAmControlSender.cpp
index 492244e..cc26c90 100644
--- a/AudioManagerDaemon/src/ControlSender.cpp
+++ b/AudioManagerDaemon/src/CAmControlSender.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file ControlSender.cpp
+ * \file CAmControlSender.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,21 +22,21 @@
*
*/
-#include "ControlSender.h"
-#include "PluginTemplate.h"
-#include "DLTWrapper.h"
+#include "CAmControlSender.h"
+#include "TAmPluginTemplate.h"
+#include "shared/CAmDltWrapper.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdexcept>
-using namespace am;
+namespace am {
#define REQUIRED_INTERFACE_VERSION_MAJOR 1
#define REQUIRED_INTERFACE_VERSION_MINOR 0
-ControlSender::ControlSender(std::string controlPluginFile) :
+CAmControlSender::CAmControlSender(std::string controlPluginFile) :
mlibHandle(NULL), //
mController(NULL)
{
@@ -47,8 +47,8 @@ ControlSender::ControlSender(std::string controlPluginFile) :
}
else if (!controlPluginFile.empty())
{
- ControlSendInterface* (*createFunc)();
- createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile, mlibHandle);
+ IAmControlSend* (*createFunc)();
+ createFunc = getCreateFunction<IAmControlSend*()>(controlPluginFile, mlibHandle);
assert(createFunc!=NULL);
mController = createFunc();
@@ -71,244 +71,244 @@ ControlSender::ControlSender(std::string controlPluginFile) :
}
}
-ControlSender::~ControlSender()
+CAmControlSender::~CAmControlSender()
{
if (mlibHandle)
dlclose(mlibHandle);
}
-am_Error_e ControlSender::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
+am_Error_e CAmControlSender::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
return mController->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID);
}
-am_Error_e ControlSender::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
+am_Error_e CAmControlSender::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
{
return mController->hookUserDisconnectionRequest(connectionID);
}
-am_Error_e ControlSender::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
+am_Error_e CAmControlSender::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
{
return mController->hookUserSetMainSinkSoundProperty(sinkID, soundProperty);
}
-am_Error_e ControlSender::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
+am_Error_e CAmControlSender::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
{
return mController->hookUserSetMainSourceSoundProperty(sourceID, soundProperty);
}
-am_Error_e ControlSender::hookUserSetSystemProperty(const am_SystemProperty_s & property)
+am_Error_e CAmControlSender::hookUserSetSystemProperty(const am_SystemProperty_s & property)
{
return mController->hookUserSetSystemProperty(property);
}
-am_Error_e ControlSender::hookUserVolumeChange(const am_sinkID_t sinkID, const am_mainVolume_t newVolume)
+am_Error_e CAmControlSender::hookUserVolumeChange(const am_sinkID_t sinkID, const am_mainVolume_t newVolume)
{
return mController->hookUserVolumeChange(sinkID, newVolume);
}
-am_Error_e ControlSender::hookUserVolumeStep(const am_sinkID_t sinkID, const int16_t increment)
+am_Error_e CAmControlSender::hookUserVolumeStep(const am_sinkID_t sinkID, const int16_t increment)
{
return mController->hookUserVolumeStep(sinkID, increment);
}
-am_Error_e ControlSender::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
+am_Error_e CAmControlSender::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
return mController->hookUserSetSinkMuteState(sinkID, muteState);
}
-am_Error_e ControlSender::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
+am_Error_e CAmControlSender::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
return mController->hookSystemRegisterDomain(domainData, domainID);
}
-am_Error_e ControlSender::hookSystemDeregisterDomain(const am_domainID_t domainID)
+am_Error_e CAmControlSender::hookSystemDeregisterDomain(const am_domainID_t domainID)
{
return mController->hookSystemDeregisterDomain(domainID);
}
-void ControlSender::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
+void CAmControlSender::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
{
return mController->hookSystemDomainRegistrationComplete(domainID);
}
-am_Error_e ControlSender::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+am_Error_e CAmControlSender::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
return mController->hookSystemRegisterSink(sinkData, sinkID);
}
-am_Error_e ControlSender::hookSystemDeregisterSink(const am_sinkID_t sinkID)
+am_Error_e CAmControlSender::hookSystemDeregisterSink(const am_sinkID_t sinkID)
{
return mController->hookSystemDeregisterSink(sinkID);
}
-am_Error_e ControlSender::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+am_Error_e CAmControlSender::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
return mController->hookSystemRegisterSource(sourceData, sourceID);
}
-am_Error_e ControlSender::hookSystemDeregisterSource(const am_sourceID_t sourceID)
+am_Error_e CAmControlSender::hookSystemDeregisterSource(const am_sourceID_t sourceID)
{
return mController->hookSystemDeregisterSource(sourceID);
}
-am_Error_e ControlSender::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+am_Error_e CAmControlSender::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
return mController->hookSystemRegisterGateway(gatewayData, gatewayID);
}
-am_Error_e ControlSender::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
+am_Error_e CAmControlSender::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
{
return mController->hookSystemDeregisterGateway(gatewayID);
}
-am_Error_e ControlSender::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+am_Error_e CAmControlSender::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
return mController->hookSystemRegisterCrossfader(crossfaderData, crossfaderID);
}
-am_Error_e ControlSender::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
+am_Error_e CAmControlSender::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
return mController->hookSystemDeregisterCrossfader(crossfaderID);
}
-void ControlSender::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
+void CAmControlSender::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
mController->hookSystemSinkVolumeTick(handle, sinkID, volume);
}
-void ControlSender::hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
+void CAmControlSender::hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
mController->hookSystemSourceVolumeTick(handle, sourceID, volume);
}
-void ControlSender::hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
+void CAmControlSender::hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
mController->hookSystemInterruptStateChange(sourceID, interruptState);
}
-void ControlSender::hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
+void CAmControlSender::hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
mController->hookSystemSinkAvailablityStateChange(sinkID, availability);
}
-void ControlSender::hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
+void CAmControlSender::hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
mController->hookSystemSourceAvailablityStateChange(sourceID, availability);
}
-void ControlSender::hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
+void CAmControlSender::hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
{
mController->hookSystemDomainStateChange(domainID, state);
}
-void ControlSender::hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> & data)
+void CAmControlSender::hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> & data)
{
mController->hookSystemReceiveEarlyData(data);
}
-void ControlSender::hookSystemSpeedChange(const am_speed_t speed)
+void CAmControlSender::hookSystemSpeedChange(const am_speed_t speed)
{
mController->hookSystemSpeedChange(speed);
}
-void ControlSender::hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
+void CAmControlSender::hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
{
mController->hookSystemTimingInformationChanged(mainConnectionID, time);
}
-void ControlSender::cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
+void CAmControlSender::cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
{
mController->cbAckConnect(handle, errorID);
}
-void ControlSender::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
+void CAmControlSender::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
{
mController->cbAckDisconnect(handle, errorID);
}
-void ControlSender::cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
+void CAmControlSender::cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
{
mController->cbAckCrossFade(handle, hostsink, error);
}
-void ControlSender::cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
+void CAmControlSender::cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
mController->cbAckSetSinkVolumeChange(handle, volume, error);
}
-void ControlSender::cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
+void CAmControlSender::cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
mController->cbAckSetSourceVolumeChange(handle, volume, error);
}
-void ControlSender::cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSender::cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
mController->cbAckSetSourceState(handle, error);
}
-void ControlSender::cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSender::cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
mController->cbAckSetSourceSoundProperty(handle, error);
}
-am_Error_e ControlSender::startupController(ControlReceiveInterface *controlreceiveinterface)
+am_Error_e CAmControlSender::startupController(IAmControlReceive *controlreceiveinterface)
{
return mController->startupController(controlreceiveinterface);
}
-void ControlSender::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSender::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
mController->cbAckSetSinkSoundProperty(handle, error);
}
-void ControlSender::cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSender::cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
mController->cbAckSetSinkSoundProperties(handle, error);
}
-void ControlSender::cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSender::cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
mController->cbAckSetSourceSoundProperties(handle, error);
}
-void ControlSender::setControllerReady()
+void CAmControlSender::setControllerReady()
{
mController->setControllerReady();
}
-void ControlSender::setControllerRundown()
+void CAmControlSender::setControllerRundown()
{
mController->setControllerRundown();
}
-am_Error_e am::ControlSender::getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e> & listPrioConnectionFormats)
+am_Error_e am::CAmControlSender::getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e> & listPrioConnectionFormats)
{
return mController->getConnectionFormatChoice(sourceID, sinkID, listRoute, listPossibleConnectionFormats, listPrioConnectionFormats);
}
-void ControlSender::getInterfaceVersion(std::string & version) const
+void CAmControlSender::getInterfaceVersion(std::string & version) const
{
version = ControlSendVersion;
}
-void ControlSender::confirmCommandReady()
+void CAmControlSender::confirmCommandReady()
{
mController->confirmCommandReady();
}
-void ControlSender::confirmRoutingReady()
+void CAmControlSender::confirmRoutingReady()
{
mController->confirmRoutingReady();
}
-void ControlSender::confirmCommandRundown()
+void CAmControlSender::confirmCommandRundown()
{
mController->confirmCommandRundown();
}
-void ControlSender::confirmRoutingRundown()
+void CAmControlSender::confirmRoutingRundown()
{
mController->confirmRoutingRundown();
}
-
+}
diff --git a/AudioManagerDaemon/src/DatabaseHandler.cpp b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp
index 54e0129..b9da10e 100644
--- a/AudioManagerDaemon/src/DatabaseHandler.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file Databasehandler.cpp
+ * \file CAmDatabaseHandler.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,15 +22,15 @@
*
*/
-#include "DatabaseHandler.h"
-#include "DatabaseObserver.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmDatabaseObserver.h"
#include <cassert>
#include <vector>
#include <fstream>
#include <sstream>
#include <string>
-#include "DLTWrapper.h"
-#include "Router.h"
+#include "shared/CAmDltWrapper.h"
+#include "CAmRouter.h"
#define DOMAIN_TABLE "Domains"
#define SOURCE_CLASS_TABLE "SourceClasses"
@@ -45,7 +45,8 @@
#define MAIN_TABLE "MainTable"
#define SYSTEM_TABLE "SystemProperties"
-using namespace am;
+namespace am
+{
const std::string databaseTables[] =
{ " Domains (domainID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), busname VARCHAR(50), nodename VARCHAR(50), early BOOL, complete BOOL, state INTEGER, reserved BOOL);", //
@@ -72,7 +73,7 @@ inline std::string i2s(T const& x)
return o.str();
}
-DatabaseHandler::DatabaseHandler(std::string databasePath) :
+CAmDatabaseHandler::CAmDatabaseHandler(std::string databasePath) :
mDatabase(NULL), //
mPath(databasePath), //
mDatabaseObserver(NULL), //
@@ -102,13 +103,13 @@ DatabaseHandler::DatabaseHandler(std::string databasePath) :
createTables();
}
-DatabaseHandler::~DatabaseHandler()
+CAmDatabaseHandler::~CAmDatabaseHandler()
{
logInfo("Closed Database");
sqlite3_close(mDatabase);
}
-am_Error_e DatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
+am_Error_e CAmDatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
{
assert(domainData.domainID==0);
assert(!domainData.name.empty());
@@ -174,7 +175,7 @@ am_Error_e DatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_dom
return E_OK;
}
-am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
+am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
{
assert(mainConnectionData.mainConnectionID==0);
assert(mainConnectionData.connectionState>=CS_UNKNOWN && mainConnectionData.connectionState<=CS_MAX);
@@ -263,11 +264,11 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
if (mDatabaseObserver)
{
am_MainConnectionType_s mainConnection;
- mainConnection.mainConnectionID=connectionID;
- mainConnection.connectionState=mainConnectionData.connectionState;
- mainConnection.delay=delay;
- mainConnection.sinkID=mainConnectionData.sinkID;
- mainConnection.sourceID=mainConnectionData.sourceID;
+ mainConnection.mainConnectionID = connectionID;
+ mainConnection.connectionState = mainConnectionData.connectionState;
+ mainConnection.delay = delay;
+ mainConnection.sinkID = mainConnectionData.sinkID;
+ mainConnection.sourceID = mainConnectionData.sourceID;
mDatabaseObserver->newMainConnection(mainConnection);
mDatabaseObserver->mainConnectionStateChanged(connectionID, mainConnectionData.connectionState);
}
@@ -278,7 +279,7 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
return changeDelayMainConnection(delay, connectionID);
}
-am_Error_e DatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
assert(sinkData.sinkID<DYNAMIC_ID_BOUNDARY);
assert(sinkData.domainID!=0);
@@ -455,7 +456,7 @@ am_Error_e DatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t
return E_OK;
}
-am_Error_e DatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+am_Error_e CAmDatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
assert(crossfaderData.crossfaderID<DYNAMIC_ID_BOUNDARY);
assert(crossfaderData.hotSink>=HS_UNKNOWN && crossfaderData.hotSink<=HS_MAX);
@@ -542,7 +543,7 @@ am_Error_e DatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfader
return E_OK;
}
-am_Error_e DatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
assert(gatewayData.gatewayID<DYNAMIC_ID_BOUNDARY);
assert(gatewayData.sinkID!=0);
@@ -654,7 +655,7 @@ am_Error_e DatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData, am_
return E_OK;
}
-am_Error_e DatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
assert(sourceData.sourceID<DYNAMIC_ID_BOUNDARY);
assert(sourceData.domainID!=0);
@@ -833,7 +834,7 @@ am_Error_e DatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sou
return E_OK;
}
-am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
+am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
{
assert(mainconnectionID!=0);
if (!existMainConnection(mainconnectionID))
@@ -905,7 +906,7 @@ am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionI
return E_OK;
}
-am_Error_e DatabaseHandler::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
+am_Error_e CAmDatabaseHandler::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
{
assert(mainconnectionID!=0);
assert(connectionState>=CS_UNKNOWN && connectionState<=CS_MAX);
@@ -938,7 +939,7 @@ am_Error_e DatabaseHandler::changeMainConnectionStateDB(const am_mainConnectionI
return E_OK;
}
-am_Error_e DatabaseHandler::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandler::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
@@ -972,7 +973,7 @@ am_Error_e DatabaseHandler::changeSinkMainVolumeDB(const am_mainVolume_t mainVol
return E_OK;
}
-am_Error_e DatabaseHandler::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandler::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
assert(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX);
@@ -1009,7 +1010,7 @@ am_Error_e DatabaseHandler::changeSinkAvailabilityDB(const am_Availability_s & a
return E_OK;
}
-am_Error_e DatabaseHandler::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
+am_Error_e CAmDatabaseHandler::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
{
assert(domainID!=0);
assert(domainState>=DS_UNKNOWN && domainState<=DS_MAX);
@@ -1042,7 +1043,7 @@ am_Error_e DatabaseHandler::changDomainStateDB(const am_DomainState_e domainStat
return E_OK;
}
-am_Error_e DatabaseHandler::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandler::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
{
assert(sinkID!=0);
assert(muteState>=MS_UNKNOWN && muteState<=MS_MAX);
@@ -1078,7 +1079,7 @@ am_Error_e DatabaseHandler::changeSinkMuteStateDB(const am_MuteState_e muteState
return E_OK;
}
-am_Error_e DatabaseHandler::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandler::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
assert(soundProperty.type>=MSP_UNKNOWN && soundProperty.type<=MSP_MAX);
assert(sinkID!=0);
@@ -1112,7 +1113,7 @@ am_Error_e DatabaseHandler::changeMainSinkSoundPropertyDB(const am_MainSoundProp
return E_OK;
}
-am_Error_e DatabaseHandler::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandler::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
assert(soundProperty.type>=MSP_UNKNOWN && soundProperty.type<=MSP_MAX);
assert(sourceID!=0);
@@ -1147,7 +1148,7 @@ am_Error_e DatabaseHandler::changeMainSourceSoundPropertyDB(const am_MainSoundPr
return E_OK;
}
-am_Error_e DatabaseHandler::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandler::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
{
assert(sourceID!=0);
assert(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX);
@@ -1184,7 +1185,7 @@ am_Error_e DatabaseHandler::changeSourceAvailabilityDB(const am_Availability_s &
return E_OK;
}
-am_Error_e DatabaseHandler::changeSystemPropertyDB(const am_SystemProperty_s & property)
+am_Error_e CAmDatabaseHandler::changeSystemPropertyDB(const am_SystemProperty_s & property)
{
assert(property.type>=SYP_UNKNOWN && property.type<=SYP_MAX);
sqlite3_stmt* query = NULL;
@@ -1215,7 +1216,7 @@ am_Error_e DatabaseHandler::changeSystemPropertyDB(const am_SystemProperty_s & p
return E_OK;
}
-am_Error_e DatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
+am_Error_e CAmDatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
{
assert(mainConnectionID!=0);
@@ -1238,7 +1239,7 @@ am_Error_e DatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_t m
return E_OK;
}
-am_Error_e DatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
{
assert(sinkID!=0);
@@ -1247,7 +1248,7 @@ am_Error_e DatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
return E_NON_EXISTENT;
}
- bool visible=sinkVisible(sinkID);
+ bool visible = sinkVisible(sinkID);
std::string command = "DELETE from " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
std::string command1 = "DROP table SinkConnectionFormat" + i2s(sinkID);
@@ -1264,12 +1265,12 @@ am_Error_e DatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
logInfo("DatabaseHandler::removeSinkDB removed:", sinkID);
if (mDatabaseObserver != NULL)
- mDatabaseObserver->removedSink(sinkID,visible);
+ mDatabaseObserver->removedSink(sinkID, visible);
return E_OK;
}
-am_Error_e DatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
{
assert(sourceID!=0);
@@ -1278,7 +1279,7 @@ am_Error_e DatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
return E_NON_EXISTENT;
}
- bool visible=sourceVisible(sourceID);
+ bool visible = sourceVisible(sourceID);
std::string command = "DELETE from " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
std::string command1 = "DROP table SourceConnectionFormat" + i2s(sourceID);
@@ -1294,11 +1295,11 @@ am_Error_e DatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
return E_DATABASE_ERROR;
logInfo("DatabaseHandler::removeSourceDB removed:", sourceID);
if (mDatabaseObserver)
- mDatabaseObserver->removedSource(sourceID,visible);
+ mDatabaseObserver->removedSource(sourceID, visible);
return E_OK;
}
-am_Error_e DatabaseHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
+am_Error_e CAmDatabaseHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
{
assert(gatewayID!=0);
@@ -1315,7 +1316,7 @@ am_Error_e DatabaseHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
return E_OK;
}
-am_Error_e DatabaseHandler::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
+am_Error_e CAmDatabaseHandler::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
assert(crossfaderID!=0);
@@ -1332,7 +1333,7 @@ am_Error_e DatabaseHandler::removeCrossfaderDB(const am_crossfaderID_t crossfade
return E_OK;
}
-am_Error_e DatabaseHandler::removeDomainDB(const am_domainID_t domainID)
+am_Error_e CAmDatabaseHandler::removeDomainDB(const am_domainID_t domainID)
{
assert(domainID!=0);
@@ -1349,7 +1350,7 @@ am_Error_e DatabaseHandler::removeDomainDB(const am_domainID_t domainID)
return E_OK;
}
-am_Error_e DatabaseHandler::removeSinkClassDB(const am_sinkClass_t sinkClassID)
+am_Error_e CAmDatabaseHandler::removeSinkClassDB(const am_sinkClass_t sinkClassID)
{
assert(sinkClassID!=0);
@@ -1371,7 +1372,7 @@ am_Error_e DatabaseHandler::removeSinkClassDB(const am_sinkClass_t sinkClassID)
return E_OK;
}
-am_Error_e DatabaseHandler::removeSourceClassDB(const am_sourceClass_t sourceClassID)
+am_Error_e CAmDatabaseHandler::removeSourceClassDB(const am_sourceClass_t sourceClassID)
{
assert(sourceClassID!=0);
@@ -1391,7 +1392,7 @@ am_Error_e DatabaseHandler::removeSourceClassDB(const am_sourceClass_t sourceCla
return E_OK;
}
-am_Error_e DatabaseHandler::removeConnection(const am_connectionID_t connectionID)
+am_Error_e CAmDatabaseHandler::removeConnection(const am_connectionID_t connectionID)
{
assert(connectionID!=0);
@@ -1402,7 +1403,7 @@ am_Error_e DatabaseHandler::removeConnection(const am_connectionID_t connectionI
return E_OK;
}
-am_Error_e DatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
+am_Error_e CAmDatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
{
assert(sourceID!=0);
@@ -1477,7 +1478,7 @@ am_Error_e DatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, a
return E_OK;
}
-am_Error_e DatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
+am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
{
assert(sinkID!=0);
@@ -1576,7 +1577,7 @@ am_Error_e DatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s &
return E_OK;
}
-am_Error_e DatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
+am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
{
assert(sourceID!=0);
@@ -1673,7 +1674,7 @@ am_Error_e DatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_Sou
return E_OK;
}
-am_Error_e am::DatabaseHandler::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
+am_Error_e am::CAmDatabaseHandler::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
{
assert(mainConnectionID!=0);
if (!existMainConnection(mainConnectionID))
@@ -1717,7 +1718,7 @@ am_Error_e am::DatabaseHandler::getMainConnectionInfoDB(const am_mainConnectionI
return E_OK;
}
-am_Error_e DatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
+am_Error_e CAmDatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
{
assert(sinkClass.sinkClassID!=0);
assert(!sinkClass.listClassProperties.empty());
@@ -1755,7 +1756,7 @@ am_Error_e DatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClas
return E_OK;
}
-am_Error_e DatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
+am_Error_e CAmDatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
{
assert(sourceClass.sourceClassID!=0);
assert(!sourceClass.listClassProperties.empty());
@@ -1793,7 +1794,7 @@ am_Error_e DatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& sour
return E_OK;
}
-am_Error_e DatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
+am_Error_e CAmDatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
{
assert(sinkID!=0);
@@ -1868,7 +1869,7 @@ am_Error_e DatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_Sink
return E_OK;
}
-am_Error_e DatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
+am_Error_e CAmDatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
{
assert(gatewayID!=0);
if (!existGateway(gatewayID))
@@ -1949,7 +1950,7 @@ am_Error_e DatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_
}
-am_Error_e DatabaseHandler::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
+am_Error_e CAmDatabaseHandler::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
assert(crossfaderID!=0);
if (!existcrossFader(crossfaderID))
@@ -1986,7 +1987,7 @@ am_Error_e DatabaseHandler::getCrossfaderInfoDB(const am_crossfaderID_t crossfad
return E_OK;
}
-am_Error_e DatabaseHandler::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
+am_Error_e CAmDatabaseHandler::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
{
assert(domainID!=0);
listSinkID.clear();
@@ -2021,7 +2022,7 @@ am_Error_e DatabaseHandler::getListSinksOfDomain(const am_domainID_t domainID, s
return E_OK;
}
-am_Error_e DatabaseHandler::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
+am_Error_e CAmDatabaseHandler::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
{
assert(domainID!=0);
listSourceID.clear();
@@ -2057,7 +2058,7 @@ am_Error_e DatabaseHandler::getListSourcesOfDomain(const am_domainID_t domainID,
return E_OK;
}
-am_Error_e DatabaseHandler::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
+am_Error_e CAmDatabaseHandler::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
{
assert(domainID!=0);
listCrossfader.clear();
@@ -2094,7 +2095,7 @@ am_Error_e DatabaseHandler::getListCrossfadersOfDomain(const am_domainID_t domai
}
-am_Error_e DatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
+am_Error_e CAmDatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
{
assert(domainID!=0);
listGatewaysID.clear();
@@ -2130,7 +2131,7 @@ am_Error_e DatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domainID
return E_OK;
}
-am_Error_e DatabaseHandler::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
+am_Error_e CAmDatabaseHandler::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
listMainConnections.clear();
sqlite3_stmt *query = NULL, *query1 = NULL;
@@ -2171,7 +2172,7 @@ am_Error_e DatabaseHandler::getListMainConnections(std::vector<am_MainConnection
return E_OK;
}
-am_Error_e DatabaseHandler::getListDomains(std::vector<am_Domain_s> & listDomains) const
+am_Error_e CAmDatabaseHandler::getListDomains(std::vector<am_Domain_s> & listDomains) const
{
listDomains.clear();
sqlite3_stmt* query = NULL;
@@ -2209,7 +2210,7 @@ am_Error_e DatabaseHandler::getListDomains(std::vector<am_Domain_s> & listDomain
return E_OK;
}
-am_Error_e DatabaseHandler::getListConnections(std::vector<am_Connection_s> & listConnections) const
+am_Error_e CAmDatabaseHandler::getListConnections(std::vector<am_Connection_s> & listConnections) const
{
listConnections.clear();
sqlite3_stmt* query = NULL;
@@ -2243,7 +2244,7 @@ am_Error_e DatabaseHandler::getListConnections(std::vector<am_Connection_s> & li
return E_OK;
}
-am_Error_e DatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks) const
+am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks) const
{
listSinks.clear();
sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
@@ -2340,7 +2341,7 @@ am_Error_e DatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks) con
return E_OK;
}
-am_Error_e DatabaseHandler::getListSources(std::vector<am_Source_s> & listSources) const
+am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSources) const
{
listSources.clear();
sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
@@ -2437,7 +2438,7 @@ am_Error_e DatabaseHandler::getListSources(std::vector<am_Source_s> & listSource
return E_OK;
}
-am_Error_e DatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
+am_Error_e CAmDatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
listSourceClasses.clear();
@@ -2499,7 +2500,7 @@ am_Error_e DatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s> &
return E_OK;
}
-am_Error_e DatabaseHandler::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
+am_Error_e CAmDatabaseHandler::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
{
listCrossfaders.clear();
sqlite3_stmt* query = NULL;
@@ -2534,7 +2535,7 @@ am_Error_e DatabaseHandler::getListCrossfaders(std::vector<am_Crossfader_s> & li
return E_OK;
}
-am_Error_e DatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listGateways) const
+am_Error_e CAmDatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listGateways) const
{
listGateways.clear();
sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
@@ -2620,7 +2621,7 @@ am_Error_e DatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listGate
return E_OK;
}
-am_Error_e DatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
+am_Error_e CAmDatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
listSinkClasses.clear();
@@ -2682,7 +2683,7 @@ am_Error_e DatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> & lis
return E_OK;
}
-am_Error_e DatabaseHandler::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
+am_Error_e CAmDatabaseHandler::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
listConnections.clear();
sqlite3_stmt *query = NULL;
@@ -2719,7 +2720,7 @@ am_Error_e DatabaseHandler::getListVisibleMainConnections(std::vector<am_MainCon
return E_OK;
}
-am_Error_e DatabaseHandler::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
+am_Error_e CAmDatabaseHandler::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
{
listMainSinks.clear();
sqlite3_stmt* query = NULL;
@@ -2758,7 +2759,7 @@ am_Error_e DatabaseHandler::getListMainSinks(std::vector<am_SinkType_s> & listMa
return E_OK;
}
-am_Error_e DatabaseHandler::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
+am_Error_e CAmDatabaseHandler::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
{
listMainSources.clear();
sqlite3_stmt* query = NULL;
@@ -2795,7 +2796,7 @@ am_Error_e DatabaseHandler::getListMainSources(std::vector<am_SourceType_s> & li
return E_OK;
}
-am_Error_e DatabaseHandler::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
+am_Error_e CAmDatabaseHandler::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
{
assert(sinkID!=0);
if (!existSink(sinkID))
@@ -2832,7 +2833,7 @@ am_Error_e DatabaseHandler::getListMainSinkSoundProperties(const am_sinkID_t sin
return E_OK;
}
-am_Error_e DatabaseHandler::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
+am_Error_e CAmDatabaseHandler::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
{
assert(sourceID!=0);
if (!existSource(sourceID))
@@ -2869,7 +2870,7 @@ am_Error_e DatabaseHandler::getListMainSourceSoundProperties(const am_sourceID_t
return E_OK;
}
-am_Error_e DatabaseHandler::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
+am_Error_e CAmDatabaseHandler::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
listSystemProperties.clear();
@@ -2903,7 +2904,7 @@ am_Error_e DatabaseHandler::getListSystemProperties(std::vector<am_SystemPropert
return E_OK;
}
-am_Error_e am::DatabaseHandler::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
+am_Error_e am::CAmDatabaseHandler::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
{
listConnectionFormats.clear();
sqlite3_stmt *qConnectionFormat = NULL;
@@ -2927,7 +2928,7 @@ am_Error_e am::DatabaseHandler::getListSinkConnectionFormats(const am_sinkID_t s
return E_OK;
}
-am_Error_e am::DatabaseHandler::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
+am_Error_e am::CAmDatabaseHandler::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
{
listConnectionFormats.clear();
sqlite3_stmt* qConnectionFormat = NULL;
@@ -2953,7 +2954,7 @@ am_Error_e am::DatabaseHandler::getListSourceConnectionFormats(const am_sourceID
return E_OK;
}
-am_Error_e am::DatabaseHandler::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
+am_Error_e am::CAmDatabaseHandler::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
{
ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
iter = mListConnectionFormat.find(gatewayID);
@@ -2968,7 +2969,7 @@ am_Error_e am::DatabaseHandler::getListGatewayConnectionFormats(const am_gateway
return (E_OK);
}
-am_Error_e DatabaseHandler::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
+am_Error_e CAmDatabaseHandler::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
{
assert(mainConnectionID!=0);
delay = -1;
@@ -3003,7 +3004,7 @@ am_Error_e DatabaseHandler::getTimingInformation(const am_mainConnectionID_t mai
return E_OK;
}
-bool DatabaseHandler::sqQuery(const std::string& query)
+bool CAmDatabaseHandler::sqQuery(const std::string& query)
{
sqlite3_stmt* statement;
int eCode = 0;
@@ -3015,7 +3016,7 @@ bool DatabaseHandler::sqQuery(const std::string& query)
return true;
}
-bool DatabaseHandler::openDatabase()
+bool CAmDatabaseHandler::openDatabase()
{
if (sqlite3_open_v2(mPath.c_str(), &mDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL) == SQLITE_OK)
{
@@ -3026,7 +3027,7 @@ bool DatabaseHandler::openDatabase()
return false;
}
-am_Error_e DatabaseHandler::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
+am_Error_e CAmDatabaseHandler::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
{
assert(connectionID!=0);
@@ -3066,7 +3067,7 @@ am_Error_e DatabaseHandler::changeDelayMainConnection(const am_timeSync_t & dela
return E_OK;
}
-am_Error_e DatabaseHandler::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
+am_Error_e CAmDatabaseHandler::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
{
assert(connection.connectionID==0);
assert(connection.sinkID!=0);
@@ -3104,7 +3105,7 @@ am_Error_e DatabaseHandler::enterConnectionDB(const am_Connection_s& connection,
return E_OK;
}
-am_Error_e DatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
+am_Error_e CAmDatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
{
assert(sinkClass.sinkClassID<DYNAMIC_ID_BOUNDARY);
assert(!sinkClass.name.empty());
@@ -3192,7 +3193,7 @@ am_Error_e DatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass, a
return E_OK;
}
-am_Error_e DatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
+am_Error_e CAmDatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
{
assert(sourceClass.sourceClassID<DYNAMIC_ID_BOUNDARY);
assert(!sourceClass.name.empty());
@@ -3281,7 +3282,7 @@ am_Error_e DatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClassID,
return E_OK;
}
-am_Error_e DatabaseHandler::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
+am_Error_e CAmDatabaseHandler::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
{
assert(!listSystemProperties.empty());
sqlite3_stmt* query = NULL;
@@ -3319,7 +3320,7 @@ am_Error_e DatabaseHandler::enterSystemProperties(const std::vector<am_SystemPro
return E_OK;
}
-bool DatabaseHandler::existMainConnection(const am_mainConnectionID_t mainConnectionID) const
+bool CAmDatabaseHandler::existMainConnection(const am_mainConnectionID_t mainConnectionID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
@@ -3337,7 +3338,7 @@ bool DatabaseHandler::existMainConnection(const am_mainConnectionID_t mainConnec
return returnVal;
}
-bool DatabaseHandler::existSource(const am_sourceID_t sourceID) const
+bool CAmDatabaseHandler::existSource(const am_sourceID_t sourceID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID);
@@ -3355,7 +3356,7 @@ bool DatabaseHandler::existSource(const am_sourceID_t sourceID) const
return returnVal;
}
-bool DatabaseHandler::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
+bool CAmDatabaseHandler::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND (name=? OR sourceID=?)";
@@ -3375,7 +3376,7 @@ bool DatabaseHandler::existSourceNameOrID(const am_sourceID_t sourceID, const st
return returnVal;
}
-bool DatabaseHandler::existSourceName(const std::string & name) const
+bool CAmDatabaseHandler::existSourceName(const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND name=?";
@@ -3394,7 +3395,7 @@ bool DatabaseHandler::existSourceName(const std::string & name) const
return returnVal;
}
-bool DatabaseHandler::existSink(const am_sinkID_t sinkID) const
+bool CAmDatabaseHandler::existSink(const am_sinkID_t sinkID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
@@ -3412,7 +3413,7 @@ bool DatabaseHandler::existSink(const am_sinkID_t sinkID) const
return returnVal;
}
-bool DatabaseHandler::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
+bool CAmDatabaseHandler::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND (name=? OR sinkID=?)";
@@ -3432,7 +3433,7 @@ bool DatabaseHandler::existSinkNameOrID(const am_sinkID_t sinkID, const std::str
return returnVal;
}
-bool DatabaseHandler::existSinkName(const std::string & name) const
+bool CAmDatabaseHandler::existSinkName(const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND name=?";
@@ -3451,7 +3452,7 @@ bool DatabaseHandler::existSinkName(const std::string & name) const
return returnVal;
}
-bool DatabaseHandler::existDomain(const am_domainID_t domainID) const
+bool CAmDatabaseHandler::existDomain(const am_domainID_t domainID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
@@ -3469,7 +3470,7 @@ bool DatabaseHandler::existDomain(const am_domainID_t domainID) const
return returnVal;
}
-bool DatabaseHandler::existGateway(const am_gatewayID_t gatewayID) const
+bool CAmDatabaseHandler::existGateway(const am_gatewayID_t gatewayID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
@@ -3487,7 +3488,7 @@ bool DatabaseHandler::existGateway(const am_gatewayID_t gatewayID) const
return returnVal;
}
-am_Error_e DatabaseHandler::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
+am_Error_e CAmDatabaseHandler::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
{
assert(sourceID!=0);
@@ -3509,7 +3510,7 @@ am_Error_e DatabaseHandler::getDomainOfSource(const am_sourceID_t sourceID, am_d
return (returnVal);
}
-am_Error_e am::DatabaseHandler::getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t & domainID) const
+am_Error_e am::CAmDatabaseHandler::getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t & domainID) const
{
assert(sinkID!=0);
@@ -3531,7 +3532,7 @@ am_Error_e am::DatabaseHandler::getDomainOfSink(const am_sinkID_t sinkID, am_dom
return (returnVal);
}
-bool DatabaseHandler::existSinkClass(const am_sinkClass_t sinkClassID) const
+bool CAmDatabaseHandler::existSinkClass(const am_sinkClass_t sinkClassID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkClassID FROM " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
@@ -3549,7 +3550,7 @@ bool DatabaseHandler::existSinkClass(const am_sinkClass_t sinkClassID) const
return returnVal;
}
-bool DatabaseHandler::existSourceClass(const am_sourceClass_t sourceClassID) const
+bool CAmDatabaseHandler::existSourceClass(const am_sourceClass_t sourceClassID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
@@ -3567,7 +3568,7 @@ bool DatabaseHandler::existSourceClass(const am_sourceClass_t sourceClassID) con
return returnVal;
}
-am_Error_e DatabaseHandler::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
+am_Error_e CAmDatabaseHandler::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
assert(connectionID!=0);
@@ -3637,7 +3638,7 @@ am_Error_e DatabaseHandler::changeConnectionTimingInformation(const am_connectio
return E_OK;
}
-am_Error_e DatabaseHandler::changeConnectionFinal(const am_connectionID_t connectionID)
+am_Error_e CAmDatabaseHandler::changeConnectionFinal(const am_connectionID_t connectionID)
{
assert(connectionID!=0);
@@ -3664,7 +3665,7 @@ am_Error_e DatabaseHandler::changeConnectionFinal(const am_connectionID_t connec
return E_OK;
}
-am_timeSync_t DatabaseHandler::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
+am_timeSync_t CAmDatabaseHandler::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
{
assert(mainConnectionID!=0);
sqlite3_stmt* query = NULL;
@@ -3697,13 +3698,13 @@ am_timeSync_t DatabaseHandler::calculateMainConnectionDelay(const am_mainConnect
}
-void DatabaseHandler::registerObserver(DatabaseObserver *iObserver)
+void CAmDatabaseHandler::registerObserver(CAmDatabaseObserver *iObserver)
{
assert(iObserver!=NULL);
mDatabaseObserver = iObserver;
}
-bool DatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
+bool CAmDatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
{
assert(sourceID!=0);
sqlite3_stmt* query = NULL;
@@ -3724,7 +3725,7 @@ bool DatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
return returnVal;
}
-bool DatabaseHandler::sinkVisible(const am_sinkID_t sinkID) const
+bool CAmDatabaseHandler::sinkVisible(const am_sinkID_t sinkID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT visible FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
@@ -3744,7 +3745,7 @@ bool DatabaseHandler::sinkVisible(const am_sinkID_t sinkID) const
return returnVal;
}
-bool DatabaseHandler::existConnection(const am_Connection_s connection)
+bool CAmDatabaseHandler::existConnection(const am_Connection_s connection)
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE sinkID=? AND sourceID=? AND connectionFormat=? AND reserved=0";
@@ -3765,7 +3766,7 @@ bool DatabaseHandler::existConnection(const am_Connection_s connection)
return returnVal;
}
-bool DatabaseHandler::existConnectionID(const am_connectionID_t connectionID)
+bool CAmDatabaseHandler::existConnectionID(const am_connectionID_t connectionID)
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=? AND reserved=0";
@@ -3784,7 +3785,7 @@ bool DatabaseHandler::existConnectionID(const am_connectionID_t connectionID)
return returnVal;
}
-bool DatabaseHandler::existcrossFader(const am_crossfaderID_t crossfaderID) const
+bool CAmDatabaseHandler::existcrossFader(const am_crossfaderID_t crossfaderID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=?";
@@ -3803,7 +3804,7 @@ bool DatabaseHandler::existcrossFader(const am_crossfaderID_t crossfaderID) cons
return returnVal;
}
-am_Error_e DatabaseHandler::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
+am_Error_e CAmDatabaseHandler::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
{
assert(sourceID!=0);
sqlite3_stmt* query = NULL;
@@ -3823,7 +3824,7 @@ am_Error_e DatabaseHandler::getSoureState(const am_sourceID_t sourceID, am_Sourc
return E_OK;
}
-am_Error_e DatabaseHandler::changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
+am_Error_e CAmDatabaseHandler::changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
{
assert(sourceID!=0);
assert(sourceState>=SS_UNKNNOWN && sourceState<=SS_MAX);
@@ -3848,7 +3849,7 @@ am_Error_e DatabaseHandler::changeSourceState(const am_sourceID_t sourceID, cons
return E_OK;
}
-am_Error_e DatabaseHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
+am_Error_e CAmDatabaseHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
{
assert(sinkID!=0);
sqlite3_stmt* query = NULL;
@@ -3868,7 +3869,7 @@ am_Error_e DatabaseHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume_t
return E_OK;
}
-am_Error_e DatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
+am_Error_e CAmDatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
{
assert(sourceID!=0);
sqlite3_stmt* query = NULL;
@@ -3888,7 +3889,7 @@ am_Error_e DatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_vol
return E_OK;
}
-am_Error_e DatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t & value) const
+am_Error_e CAmDatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t & value) const
{
assert(sinkID!=0);
if (!existSink(sinkID))
@@ -3921,7 +3922,7 @@ am_Error_e DatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID,
return E_OK;
}
-am_Error_e DatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, uint16_t & value) const
+am_Error_e CAmDatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, uint16_t & value) const
{
assert(sourceID!=0);
if (!existSource(sourceID))
@@ -3954,7 +3955,7 @@ am_Error_e DatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t sour
return E_OK;
}
-am_Error_e DatabaseHandler::getDomainState(const am_domainID_t domainID, am_DomainState_e state) const
+am_Error_e CAmDatabaseHandler::getDomainState(const am_domainID_t domainID, am_DomainState_e state) const
{
assert(domainID!=0);
sqlite3_stmt* query = NULL;
@@ -3975,7 +3976,7 @@ am_Error_e DatabaseHandler::getDomainState(const am_domainID_t domainID, am_Doma
}
-am_Error_e DatabaseHandler::peekDomain(const std::string & name, am_domainID_t & domainID)
+am_Error_e CAmDatabaseHandler::peekDomain(const std::string & name, am_domainID_t & domainID)
{
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
@@ -4014,7 +4015,7 @@ am_Error_e DatabaseHandler::peekDomain(const std::string & name, am_domainID_t &
return E_OK;
}
-am_Error_e DatabaseHandler::peekSink(const std::string & name, am_sinkID_t & sinkID)
+am_Error_e CAmDatabaseHandler::peekSink(const std::string & name, am_sinkID_t & sinkID)
{
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
@@ -4061,7 +4062,7 @@ am_Error_e DatabaseHandler::peekSink(const std::string & name, am_sinkID_t & sin
return E_OK;
}
-am_Error_e DatabaseHandler::peekSource(const std::string & name, am_sourceID_t & sourceID)
+am_Error_e CAmDatabaseHandler::peekSource(const std::string & name, am_sourceID_t & sourceID)
{
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
@@ -4108,7 +4109,7 @@ am_Error_e DatabaseHandler::peekSource(const std::string & name, am_sourceID_t &
return E_OK;
}
-am_Error_e DatabaseHandler::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
+am_Error_e CAmDatabaseHandler::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
{
assert(sinkID!=0);
@@ -4141,7 +4142,7 @@ am_Error_e DatabaseHandler::changeSinkVolume(const am_sinkID_t sinkID, const am_
return E_OK;
}
-am_Error_e DatabaseHandler::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
+am_Error_e CAmDatabaseHandler::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
{
assert(sourceID!=0);
@@ -4174,7 +4175,7 @@ am_Error_e DatabaseHandler::changeSourceVolume(const am_sourceID_t sourceID, con
return E_OK;
}
-am_Error_e DatabaseHandler::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e CAmDatabaseHandler::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
assert(soundProperty.type>=SP_UNKNOWN && soundProperty.type<=SP_MAX);
assert(sourceID!=0);
@@ -4209,7 +4210,7 @@ am_Error_e DatabaseHandler::changeSourceSoundPropertyDB(const am_SoundProperty_s
return E_OK;
}
-am_Error_e DatabaseHandler::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
+am_Error_e CAmDatabaseHandler::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
assert(soundProperty.type>=SP_UNKNOWN && soundProperty.type<=SP_MAX);
assert(sinkID!=0);
@@ -4242,7 +4243,7 @@ am_Error_e DatabaseHandler::changeSinkSoundPropertyDB(const am_SoundProperty_s &
return E_OK;
}
-am_Error_e DatabaseHandler::changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
+am_Error_e CAmDatabaseHandler::changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
{
assert(crossfaderID!=0);
assert(hotsink>=HS_UNKNOWN && hotsink>=HS_MAX);
@@ -4275,14 +4276,14 @@ am_Error_e DatabaseHandler::changeCrossFaderHotSink(const am_crossfaderID_t cros
return E_OK;
}
-am_Error_e DatabaseHandler::getRoutingTree(bool onlyfree, RoutingTree& tree, std::vector<RoutingTreeItem*>& flatTree)
+am_Error_e CAmDatabaseHandler::getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree)
{
sqlite3_stmt* query = NULL;
int eCode = 0;
size_t i = 0;
std::string command;
am_domainID_t rootID = tree.returnRootDomainID();
- RoutingTreeItem *parent = tree.returnRootItem();
+ CAmRoutingTreeItem *parent = tree.returnRootItem();
if (onlyfree)
{
@@ -4327,7 +4328,7 @@ am_Error_e DatabaseHandler::getRoutingTree(bool onlyfree, RoutingTree& tree, std
return (E_OK);
}
-am_Error_e am::DatabaseHandler::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
+am_Error_e am::CAmDatabaseHandler::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
{
if (name.empty())
return E_NON_EXISTENT;
@@ -4359,7 +4360,7 @@ am_Error_e am::DatabaseHandler::peekSinkClassID(const std::string & name, am_sin
return returnVal;
}
-am_Error_e am::DatabaseHandler::peekSourceClassID(const std::string & name, am_sourceClass_t & sourceClassID)
+am_Error_e am::CAmDatabaseHandler::peekSourceClassID(const std::string & name, am_sourceClass_t & sourceClassID)
{
if (name.empty())
return E_NON_EXISTENT;
@@ -4391,11 +4392,11 @@ am_Error_e am::DatabaseHandler::peekSourceClassID(const std::string & name, am_s
return returnVal;
}
-void DatabaseHandler::createTables()
+void CAmDatabaseHandler::createTables()
{
for (uint16_t i = 0; i < sizeof(databaseTables) / sizeof(databaseTables[0]); i++)
{
assert(sqQuery("CREATE TABLE " + databaseTables[i]));
}
}
-
+}
diff --git a/AudioManagerDaemon/src/CAmDatabaseObserver.cpp b/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
new file mode 100644
index 0000000..9bbc275
--- /dev/null
+++ b/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
@@ -0,0 +1,207 @@
+/**
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file CAmDatabaseObserver.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statiasyncCally or dynamiasyncCally with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ */
+
+#include "CAmDatabaseObserver.h"
+#include <string.h>
+#include <cassert>
+#include <errno.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include "CAmCommandSender.h"
+#include "CAmRoutingSender.h"
+#include "CAmTelnetServer.h"
+#include "shared/CAmDltWrapper.h"
+#include "shared/CAmSerializer.h"
+
+namespace am {
+
+CAmDatabaseObserver::CAmDatabaseObserver(CAmCommandSender *iCommandSender, CAmRoutingSender *iRoutingSender, CAmSocketHandler *iSocketHandler) :
+ mCommandSender(iCommandSender), //
+ mRoutingSender(iRoutingSender), //
+ mSerializer(iSocketHandler) //
+{
+ assert(mCommandSender!=0);
+ assert(mRoutingSender!=0);
+ assert(iSocketHandler!=0);
+}
+
+CAmDatabaseObserver::CAmDatabaseObserver(CAmCommandSender *iCommandSender, CAmRoutingSender *iRoutingSender, CAmSocketHandler *iSocketHandler, CAmTelnetServer *iTelnetServer) :
+ mCommandSender(iCommandSender), //
+ mRoutingSender(iRoutingSender), //
+ mTelnetServer(iTelnetServer), //
+ mSerializer(iSocketHandler) //
+{
+ assert(mTelnetServer!=0);
+ assert(mCommandSender!=0);
+ assert(mRoutingSender!=0);
+ assert(iSocketHandler!=0);
+}
+
+CAmDatabaseObserver::~CAmDatabaseObserver()
+{
+}
+
+void CAmDatabaseObserver::newMainConnection(const am_MainConnectionType_s& mainConnection)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_MainConnectionType_s>(mCommandSender, &CAmCommandSender::cbNewMainConnection, mainConnection);
+}
+
+void CAmDatabaseObserver::removedMainConnection(const am_mainConnectionID_t mainConnection)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_mainConnectionID_t>(mCommandSender, &CAmCommandSender::cbRemovedMainConnection, mainConnection);
+}
+
+void CAmDatabaseObserver::newSink(const am_Sink_s& sink)
+{
+ mRoutingSender->addSinkLookup(sink);
+ if (sink.visible)
+ {
+ am_SinkType_s s;
+ s.availability = sink.available;
+ s.muteState = sink.muteState;
+ s.name = sink.name;
+ s.sinkClassID = sink.sinkClassID;
+ s.sinkID = sink.sinkID;
+ s.volume = sink.mainVolume;
+ mSerializer.asyncCall<CAmCommandSender, const am_SinkType_s>(mCommandSender, &CAmCommandSender::cbNewSink, s);
+ }
+}
+
+void CAmDatabaseObserver::newSource(const am_Source_s& source)
+{
+ mRoutingSender->addSourceLookup(source);
+ if (source.visible)
+ {
+ am_SourceType_s s;
+ s.availability = source.available;
+ s.name = source.name;
+ s.sourceClassID = source.sourceClassID;
+ s.sourceID = source.sourceID;
+ mSerializer.asyncCall<CAmCommandSender, const am_SourceType_s>(mCommandSender, &CAmCommandSender::cbNewSource, s);
+ }
+}
+
+void CAmDatabaseObserver::newDomain(const am_Domain_s& domain)
+{
+ mRoutingSender->addDomainLookup(domain);
+}
+
+void CAmDatabaseObserver::newGateway(const am_Gateway_s& gateway)
+{
+ (void) gateway;
+ //todo: implement something
+}
+
+void CAmDatabaseObserver::newCrossfader(const am_Crossfader_s& crossfader)
+{
+ mRoutingSender->addCrossfaderLookup(crossfader);
+}
+
+void CAmDatabaseObserver::removedSink(const am_sinkID_t sinkID, const bool visible)
+{
+ mRoutingSender->removeSinkLookup(sinkID);
+
+ if (visible)
+ mSerializer.asyncCall<CAmCommandSender, const am_sinkID_t>(mCommandSender, &CAmCommandSender::cbRemovedSink, sinkID);
+}
+
+void CAmDatabaseObserver::removedSource(const am_sourceID_t sourceID, const bool visible)
+{
+ mRoutingSender->removeSourceLookup(sourceID);
+
+ if (visible)
+ mSerializer.asyncCall<CAmCommandSender, const am_sourceID_t>(mCommandSender, &CAmCommandSender::cbRemovedSource, sourceID);
+}
+
+void CAmDatabaseObserver::removeDomain(const am_domainID_t domainID)
+{
+ mRoutingSender->removeDomainLookup(domainID);
+}
+
+void CAmDatabaseObserver::removeGateway(const am_gatewayID_t gatewayID)
+{
+ (void) gatewayID;
+ //todo: implement something?
+}
+
+void CAmDatabaseObserver::removeCrossfader(const am_crossfaderID_t crossfaderID)
+{
+ mRoutingSender->removeCrossfaderLookup(crossfaderID);
+}
+
+void CAmDatabaseObserver::numberOfSinkClassesChanged()
+{
+ mSerializer.asyncCall<CAmCommandSender>(mCommandSender, &CAmCommandSender::cbNumberOfSinkClassesChanged);
+}
+
+void CAmDatabaseObserver::numberOfSourceClassesChanged()
+{
+ mSerializer.asyncCall<CAmCommandSender>(mCommandSender, &CAmCommandSender::cbNumberOfSourceClassesChanged);
+}
+
+void CAmDatabaseObserver::mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_connectionID_t, const am_ConnectionState_e>(mCommandSender, &CAmCommandSender::cbMainConnectionStateChanged, connectionID, connectionState);
+}
+
+void CAmDatabaseObserver::mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_sinkID_t, const am_MainSoundProperty_s&>(mCommandSender, &CAmCommandSender::cbMainSinkSoundPropertyChanged, sinkID, SoundProperty);
+}
+
+void CAmDatabaseObserver::mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_sourceID_t, const am_MainSoundProperty_s&>(mCommandSender, &CAmCommandSender::cbMainSourceSoundPropertyChanged, sourceID, SoundProperty);
+}
+
+void CAmDatabaseObserver::sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_sinkID_t, const am_Availability_s&>(mCommandSender, &CAmCommandSender::cbSinkAvailabilityChanged, sinkID, availability);
+}
+
+void CAmDatabaseObserver::sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_sourceID_t, const am_Availability_s&>(mCommandSender, &CAmCommandSender::cbSourceAvailabilityChanged, sourceID, availability);
+}
+
+void CAmDatabaseObserver::volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_sinkID_t, const am_mainVolume_t>(mCommandSender, &CAmCommandSender::cbVolumeChanged, sinkID, volume);
+}
+
+void CAmDatabaseObserver::sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_sinkID_t, const am_MuteState_e>(mCommandSender, &CAmCommandSender::cbSinkMuteStateChanged, sinkID, muteState);
+}
+
+void CAmDatabaseObserver::systemPropertyChanged(const am_SystemProperty_s& SystemProperty)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_SystemProperty_s&>(mCommandSender, &CAmCommandSender::cbSystemPropertyChanged, SystemProperty);
+}
+
+void CAmDatabaseObserver::timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
+{
+ mSerializer.asyncCall<CAmCommandSender, const am_mainConnectionID_t, const am_timeSync_t>(mCommandSender, &CAmCommandSender::cbTimingInformationChanged, mainConnection, time);
+}
+}
diff --git a/AudioManagerDaemon/src/DBusWrapper.cpp b/AudioManagerDaemon/src/CAmDbusWrapper.cpp
index 71352ef..082d62f 100644
--- a/AudioManagerDaemon/src/DBusWrapper.cpp
+++ b/AudioManagerDaemon/src/CAmDbusWrapper.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file SocketHandler.cpp
+ * \file CAmSocketHandler.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,17 +22,18 @@
*
*/
-#include <dbus/DBusWrapper.h>
-#include <SocketHandler.h>
+#include "shared/CAmDbusWrapper.h"
#include <config.h>
#include <fstream>
#include <sstream>
#include <string>
#include <cassert>
#include <cstdlib>
-#include "DLTWrapper.h"
+#include "shared/CAmDltWrapper.h"
+#include "shared/CAmSocketHandler.h"
-using namespace am;
+namespace am
+{
#define ROOT_INTROSPECT_XML \
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
@@ -43,59 +44,59 @@ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
"</method>" \
"</interface>" \
-DBusWrapper* DBusWrapper::mReference = NULL;
+CAmDbusWrapper* CAmDbusWrapper::mpReference = NULL;
-DBusWrapper::DBusWrapper(SocketHandler* socketHandler) :
- pDbusDispatchCallback(this, &DBusWrapper::dbusDispatchCallback), //
- pDbusFireCallback(this, &DBusWrapper::dbusFireCallback), //
- pDbusCheckCallback(this, &DBusWrapper::dbusCheckCallback), //
- pDbusTimerCallback(this, &DBusWrapper::dbusTimerCallback), //
- mDbusConnection(0), //
+CAmDbusWrapper::CAmDbusWrapper(CAmSocketHandler* socketHandler) :
+ pDbusDispatchCallback(this, &CAmDbusWrapper::dbusDispatchCallback), //
+ pDbusFireCallback(this, &CAmDbusWrapper::dbusFireCallback), //
+ pDbusCheckCallback(this, &CAmDbusWrapper::dbusCheckCallback), //
+ pDbusTimerCallback(this, &CAmDbusWrapper::dbusTimerCallback), //
+ mpDbusConnection(0), //
mDBusError(), //
- mNodesList(), //
- mListTimerhandlePointer(), //
- mSocketHandler(socketHandler)
+ mListNodes(), //
+ mpListTimerhandles(), //
+ mpSocketHandler(socketHandler)
{
- assert(mSocketHandler!=0);
+ assert(mpSocketHandler!=0);
dbus_error_init(&mDBusError);
logInfo("DBusWrapper::DBusWrapper Opening DBus connection");
- mDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
+ mpDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
if (dbus_error_is_set(&mDBusError))
{
logError("DBusWrapper::DBusWrapper Error while getting the DBus");
dbus_error_free(&mDBusError);
}
- if (NULL == mDbusConnection)
+ if (NULL == mpDbusConnection)
{
logError("DBusWrapper::DBusWrapper DBus Connection is null");
}
//then we need to adopt the dbus to our mainloop:
//first, we are old enought to live longer then the connection:
- dbus_connection_set_exit_on_disconnect(mDbusConnection, FALSE);
+ dbus_connection_set_exit_on_disconnect(mpDbusConnection, FALSE);
//we do not need the manual dispatching, since it is not allowed to call from a different thread. So leave it uncommented:
//dbus_connection_set_dispatch_status_function
//add watch functions:
- dbus_bool_t watch = dbus_connection_set_watch_functions(mDbusConnection, addWatch, removeWatch, toogleWatch, this, NULL);
+ dbus_bool_t watch = dbus_connection_set_watch_functions(mpDbusConnection, addWatch, removeWatch, toogleWatch, this, NULL);
if (!watch)
{
logError("DBusWrapper::DBusWrapper Registering of watch functions failed");
}
//add timer functions:
- dbus_bool_t timer = dbus_connection_set_timeout_functions(mDbusConnection, addTimeout, removeTimeout, toggleTimeout, this, NULL);
+ dbus_bool_t timer = dbus_connection_set_timeout_functions(mpDbusConnection, addTimeout, removeTimeout, toggleTimeout, this, NULL);
if (!timer)
{
logError("DBusWrapper::DBusWrapper Registering of timer functions failed");
}
//register callback for Introspectio
- mObjectPathVTable.message_function = DBusWrapper::cbRootIntrospection;
- dbus_connection_register_object_path(mDbusConnection, DBUS_SERVICE_OBJECT_PATH, &mObjectPathVTable, this);
- int ret = dbus_bus_request_name(mDbusConnection, DBUS_SERVICE_PREFIX, DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError);
+ mObjectPathVTable.message_function = CAmDbusWrapper::cbRootIntrospection;
+ dbus_connection_register_object_path(mpDbusConnection, DBUS_SERVICE_OBJECT_PATH, &mObjectPathVTable, this);
+ int ret = dbus_bus_request_name(mpDbusConnection, DBUS_SERVICE_PREFIX, DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError);
if (dbus_error_is_set(&mDBusError))
{
logError("DBusWrapper::DBusWrapper Name Error",mDBusError.message);
@@ -108,42 +109,42 @@ DBusWrapper::DBusWrapper(SocketHandler* socketHandler) :
}
}
-DBusWrapper::~DBusWrapper()
+CAmDbusWrapper::~CAmDbusWrapper()
{
//close the connection again
logInfo("DBusWrapper::~DBusWrapper Closing DBus connection");
- dbus_connection_unref(mDbusConnection);
+ dbus_connection_unref(mpDbusConnection);
//clean up all timerhandles we created but did not delete before
- std::vector<sh_timerHandle_t*>::iterator it = mListTimerhandlePointer.begin();
- for (; it != mListTimerhandlePointer.end(); ++it)
+ std::vector<sh_timerHandle_t*>::iterator it = mpListTimerhandles.begin();
+ for (; it != mpListTimerhandles.end(); ++it)
{
delete *it;
}
}
-void DBusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata)
+void CAmDbusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata)
{
logInfo("DBusWrapper::~registerCallback register callback:",path);
std::string completePath = std::string(DBUS_SERVICE_OBJECT_PATH) + "/" + path;
dbus_error_init(&mDBusError);
- mDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
- dbus_connection_register_object_path(mDbusConnection, completePath.c_str(), vtable, userdata);
+ mpDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
+ dbus_connection_register_object_path(mpDbusConnection, completePath.c_str(), vtable, userdata);
if (dbus_error_is_set(&mDBusError))
{
logError("DBusWrapper::registerCallack error: ",mDBusError.message);
dbus_error_free(&mDBusError);
}
- mNodesList.push_back(path);
+ mListNodes.push_back(path);
}
-DBusHandlerResult DBusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference)
+DBusHandlerResult CAmDbusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference)
{
logInfo("DBusWrapper::~cbRootIntrospection called:");
- mReference = (DBusWrapper*) reference;
- std::list<std::string> nodesList = mReference->mNodesList;
+ mpReference = (CAmDbusWrapper*) reference;
+ std::list<std::string> nodesList = mpReference->mListNodes;
DBusMessage * reply;
DBusMessageIter args;
dbus_uint32_t serial = 0;
@@ -187,19 +188,19 @@ DBusHandlerResult DBusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMes
}
}
-void DBusWrapper::getDBusConnection(DBusConnection *& connection) const
+void CAmDbusWrapper::getDBusConnection(DBusConnection *& connection) const
{
- connection = mDbusConnection;
+ connection = mpDbusConnection;
}
-dbus_bool_t DBusWrapper::addWatch(DBusWatch *watch, void *userData)
+dbus_bool_t CAmDbusWrapper::addWatch(DBusWatch *watch, void *userData)
{
- mReference = (DBusWrapper*) userData;
- assert(mReference!=0);
- return mReference->addWatchDelegate(watch, userData);
+ mpReference = (CAmDbusWrapper*) userData;
+ assert(mpReference!=0);
+ return mpReference->addWatchDelegate(watch, userData);
}
-dbus_bool_t DBusWrapper::addWatchDelegate(DBusWatch * watch, void* userData)
+dbus_bool_t CAmDbusWrapper::addWatchDelegate(DBusWatch * watch, void* userData)
{
(void) userData;
int16_t event = 0;
@@ -216,7 +217,7 @@ dbus_bool_t DBusWrapper::addWatchDelegate(DBusWatch * watch, void* userData)
}
logInfo("DBusWrapper::addWatchDelegate entered new watch, fd=",dbus_watch_get_unix_fd(watch),"event flag=",event);
- am_Error_e error = mSocketHandler->addFDPoll(dbus_watch_get_unix_fd(watch), event, NULL, &pDbusFireCallback, &pDbusCheckCallback, &pDbusDispatchCallback, watch, handle);
+ am_Error_e error = mpSocketHandler->addFDPoll(dbus_watch_get_unix_fd(watch), event, NULL, &pDbusFireCallback, &pDbusCheckCallback, &pDbusDispatchCallback, watch, handle);
//if everything is alright, add the watch and the handle to our map so we know this relationship
if (error == E_OK && handle != 0)
@@ -228,32 +229,32 @@ dbus_bool_t DBusWrapper::addWatchDelegate(DBusWatch * watch, void* userData)
return (true);
}
-void DBusWrapper::removeWatch(DBusWatch *watch, void *userData)
+void CAmDbusWrapper::removeWatch(DBusWatch *watch, void *userData)
{
- mReference = (DBusWrapper*) userData;
- assert(mReference!=0);
- mReference->removeWatchDelegate(watch, userData);
+ mpReference = (CAmDbusWrapper*) userData;
+ assert(mpReference!=0);
+ mpReference->removeWatchDelegate(watch, userData);
}
-void DBusWrapper::removeWatchDelegate(DBusWatch *watch, void *userData)
+void CAmDbusWrapper::removeWatchDelegate(DBusWatch *watch, void *userData)
{
(void) userData;
std::map<DBusWatch*, sh_pollHandle_t>::iterator iterator = mMapHandleWatch.begin();
iterator = mMapHandleWatch.find(watch);
if (iterator != mMapHandleWatch.end())
- mSocketHandler->removeFDPoll(iterator->second);
+ mpSocketHandler->removeFDPoll(iterator->second);
logInfo("DBusWrapper::removeWatch removed watch with handle",iterator->second);
mMapHandleWatch.erase(iterator);
}
-void DBusWrapper::toogleWatch(DBusWatch *watch, void *userData)
+void CAmDbusWrapper::toogleWatch(DBusWatch *watch, void *userData)
{
- mReference = (DBusWrapper*) userData;
- assert(mReference!=0);
- mReference->toogleWatchDelegate(watch, userData);
+ mpReference = (CAmDbusWrapper*) userData;
+ assert(mpReference!=0);
+ mpReference->toogleWatchDelegate(watch, userData);
}
-void DBusWrapper::toogleWatchDelegate(DBusWatch *watch, void *userData)
+void CAmDbusWrapper::toogleWatchDelegate(DBusWatch *watch, void *userData)
{
(void) userData;
int16_t event = 0;
@@ -270,18 +271,18 @@ void DBusWrapper::toogleWatchDelegate(DBusWatch *watch, void *userData)
std::map<DBusWatch*, sh_pollHandle_t>::iterator iterator = mMapHandleWatch.begin();
iterator = mMapHandleWatch.find(watch);
if (iterator != mMapHandleWatch.end())
- mSocketHandler->updateEventFlags(iterator->second, event);
+ mpSocketHandler->updateEventFlags(iterator->second, event);
logInfo("DBusWrapper::toogleWatchDelegate watch was toggeled");
}
-dbus_bool_t DBusWrapper::addTimeout(DBusTimeout *timeout, void* userData)
+dbus_bool_t CAmDbusWrapper::addTimeout(DBusTimeout *timeout, void* userData)
{
- mReference = (DBusWrapper*) userData;
- assert(mReference!=0);
- return mReference->addTimeoutDelegate(timeout, userData);
+ mpReference = (CAmDbusWrapper*) userData;
+ assert(mpReference!=0);
+ return mpReference->addTimeoutDelegate(timeout, userData);
}
-dbus_bool_t DBusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userData)
+dbus_bool_t CAmDbusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userData)
{
if (!dbus_timeout_get_enabled(timeout))
return false;
@@ -294,11 +295,11 @@ dbus_bool_t DBusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userData
//prepare handle and callback. new is eval, but there is no other choice because we need the pointer!
sh_timerHandle_t* handle = new sh_timerHandle_t;
- mListTimerhandlePointer.push_back(handle);
- shTimerCallBack* buffer = &pDbusTimerCallback;
+ mpListTimerhandles.push_back(handle);
+ CAmShTimerCallBack* buffer = &pDbusTimerCallback;
//add the timer to the pollLoop
- mSocketHandler->addTimer(pollTimeout, buffer, *handle, timeout);
+ mpSocketHandler->addTimer(pollTimeout, buffer, *handle, timeout);
//save the handle with dbus context
dbus_timeout_set_data(timeout, handle, NULL);
@@ -309,27 +310,27 @@ dbus_bool_t DBusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userData
return true;
}
-void DBusWrapper::removeTimeout(DBusTimeout *timeout, void* userData)
+void CAmDbusWrapper::removeTimeout(DBusTimeout *timeout, void* userData)
{
- mReference = (DBusWrapper*) userData;
- assert(mReference!=0);
- mReference->removeTimeoutDelegate(timeout, userData);
+ mpReference = (CAmDbusWrapper*) userData;
+ assert(mpReference!=0);
+ mpReference->removeTimeoutDelegate(timeout, userData);
}
-void DBusWrapper::removeTimeoutDelegate(DBusTimeout *timeout, void* userData)
+void CAmDbusWrapper::removeTimeoutDelegate(DBusTimeout *timeout, void* userData)
{
(void) userData;
//get the pointer to the handle and remove the timer
sh_timerHandle_t* handle = (sh_timerHandle_t*) dbus_timeout_get_data(timeout);
- mSocketHandler->removeTimer(*handle);
+ mpSocketHandler->removeTimer(*handle);
//now go throught the timerlist and remove the pointer, free memory
- std::vector<sh_timerHandle_t*>::iterator it = mListTimerhandlePointer.begin();
- for (; it != mListTimerhandlePointer.end(); ++it)
+ std::vector<sh_timerHandle_t*>::iterator it = mpListTimerhandles.begin();
+ for (; it != mpListTimerhandles.end(); ++it)
{
if (*it == handle)
{
- mListTimerhandlePointer.erase(it);
+ mpListTimerhandles.erase(it);
break;
}
}
@@ -337,40 +338,40 @@ void DBusWrapper::removeTimeoutDelegate(DBusTimeout *timeout, void* userData)
logInfo("DBusWrapper::removeTimeoutDelegate a timeout was removed");
}
-void DBusWrapper::toggleTimeout(DBusTimeout *timeout, void* userData)
+void CAmDbusWrapper::toggleTimeout(DBusTimeout *timeout, void* userData)
{
- mReference = (DBusWrapper*) userData;
- assert(mReference!=0);
- mReference->toggleTimeoutDelegate(timeout, userData);
+ mpReference = (CAmDbusWrapper*) userData;
+ assert(mpReference!=0);
+ mpReference->toggleTimeoutDelegate(timeout, userData);
}
-bool am::DBusWrapper::dbusDispatchCallback(const sh_pollHandle_t handle, void *userData)
+bool am::CAmDbusWrapper::dbusDispatchCallback(const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
bool returnVal = true;
- dbus_connection_ref(mDbusConnection);
- if (dbus_connection_dispatch(mDbusConnection) == DBUS_DISPATCH_COMPLETE)
+ dbus_connection_ref(mpDbusConnection);
+ if (dbus_connection_dispatch(mpDbusConnection) == DBUS_DISPATCH_COMPLETE)
returnVal = false;
- dbus_connection_unref(mDbusConnection);
+ dbus_connection_unref(mpDbusConnection);
// logInfo("DBusWrapper::dbusDispatchCallback was called");
return returnVal;
}
-bool am::DBusWrapper::dbusCheckCallback(const sh_pollHandle_t handle, void *userData)
+bool am::CAmDbusWrapper::dbusCheckCallback(const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
bool returnVal = false;
- dbus_connection_ref(mDbusConnection);
- if (dbus_connection_get_dispatch_status(mDbusConnection) == DBUS_DISPATCH_DATA_REMAINS)
+ dbus_connection_ref(mpDbusConnection);
+ if (dbus_connection_get_dispatch_status(mpDbusConnection) == DBUS_DISPATCH_DATA_REMAINS)
returnVal = true;
- dbus_connection_unref(mDbusConnection);
+ dbus_connection_unref(mpDbusConnection);
// logInfo("DBusWrapper::dbusCheckCallback was called");
return returnVal;
}
-void am::DBusWrapper::dbusFireCallback(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
+void am::CAmDbusWrapper::dbusFireCallback(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
@@ -388,13 +389,13 @@ void am::DBusWrapper::dbusFireCallback(const pollfd pollfd, const sh_pollHandle_
DBusWatch *watch = (DBusWatch*) userData;
- dbus_connection_ref(mDbusConnection);
+ dbus_connection_ref(mpDbusConnection);
dbus_watch_handle(watch, flags);
- dbus_connection_unref(mDbusConnection);
+ dbus_connection_unref(mpDbusConnection);
// logInfo("DBusWrapper::dbusFireCallback was called");
}
-void DBusWrapper::toggleTimeoutDelegate(DBusTimeout *timeout, void* userData)
+void CAmDbusWrapper::toggleTimeoutDelegate(DBusTimeout *timeout, void* userData)
{
(void) userData;
//get the pointer to the handle and remove the timer
@@ -408,15 +409,15 @@ void DBusWrapper::toggleTimeoutDelegate(DBusTimeout *timeout, void* userData)
int localTimeout = dbus_timeout_get_interval(timeout);
pollTimeout.tv_sec = localTimeout / 1000;
pollTimeout.tv_nsec = (localTimeout % 1000) * 1000000;
- mSocketHandler->restartTimer(*handle, pollTimeout);
+ mpSocketHandler->restartTimer(*handle, pollTimeout);
}
else
{
- mSocketHandler->stopTimer(*handle);
+ mpSocketHandler->stopTimer(*handle);
}logInfo("DBusWrapper::toggleTimeoutDelegate was called");
}
-void DBusWrapper::dbusTimerCallback(sh_timerHandle_t handle, void *userData)
+void CAmDbusWrapper::dbusTimerCallback(sh_timerHandle_t handle, void *userData)
{
assert(userData!=NULL);
if (dbus_timeout_get_enabled((DBusTimeout*) userData))
@@ -424,9 +425,10 @@ void DBusWrapper::dbusTimerCallback(sh_timerHandle_t handle, void *userData)
timespec ts;
ts.tv_nsec = -1;
ts.tv_sec = -1;
- mSocketHandler->restartTimer(handle, ts);
+ mpSocketHandler->restartTimer(handle, ts);
}
dbus_timeout_handle((DBusTimeout*) userData);
logInfo("DBusWrapper::dbusTimerCallback was called");
}
+}
diff --git a/AudioManagerDaemon/src/DLTWrapper.cpp b/AudioManagerDaemon/src/CAmDltWrapper.cpp
index ad03692..968f911 100644
--- a/AudioManagerDaemon/src/DLTWrapper.cpp
+++ b/AudioManagerDaemon/src/CAmDltWrapper.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file DLTWrapper.cpp
+ * \file CAmDltWrapper.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -23,44 +23,48 @@
*/
-#include "DLTWrapper.h"
+#include "shared/CAmDltWrapper.h"
#include <string.h>
#include <sstream>
#include <iostream>
-DLTWrapper* DLTWrapper::mDLTWrapper = NULL;
+namespace am
+{
+
+CAmDltWrapper* CAmDltWrapper::mpDLTWrapper = NULL;
-DLTWrapper *DLTWrapper::instance(const bool enableNoDLTDebug)
+CAmDltWrapper *CAmDltWrapper::instance(const bool enableNoDLTDebug)
{
- if (!mDLTWrapper)
- mDLTWrapper = new DLTWrapper(enableNoDLTDebug);
+ if (!mpDLTWrapper)
+ mpDLTWrapper = new CAmDltWrapper(enableNoDLTDebug);
#ifndef WITH_DLT
if(enableNoDLTDebug)
- mDLTWrapper->enableNoDLTDebug(true);
+ mpDLTWrapper->enableNoDLTDebug(true);
#endif
- return mDLTWrapper;
+ return mpDLTWrapper;
}
-void DLTWrapper::unregisterContext(DltContext & handle)
+void CAmDltWrapper::unregisterContext(DltContext & handle)
{
#ifdef WITH_DLT
dlt_unregister_context(&handle);
#endif
}
-DLTWrapper::DLTWrapper(const bool enableNoDLTDebug) :
+CAmDltWrapper::CAmDltWrapper(const bool enableNoDLTDebug) :
#ifndef WITH_DLT
mEnableNoDLTDebug(enableNoDLTDebug),
#endif
mDltContext(), //
mDltContextData()
{
+ (void) enableNoDLTDebug;
#ifndef WITH_DLT
std::cout << "[DLT] Running without DLT-support" << std::endl;
#endif
}
-void DLTWrapper::registerApp(const char *appid, const char *description)
+void CAmDltWrapper::registerApp(const char *appid, const char *description)
{
#ifdef WITH_DLT
dlt_register_app(appid, description);
@@ -69,7 +73,7 @@ void DLTWrapper::registerApp(const char *appid, const char *description)
#endif
}
-void DLTWrapper::registerContext(DltContext& handle, const char *contextid, const char *description)
+void CAmDltWrapper::registerContext(DltContext& handle, const char *contextid, const char *description)
{
#ifdef WITH_DLT
dlt_register_context(&handle, contextid, description);
@@ -85,7 +89,7 @@ void DLTWrapper::registerContext(DltContext& handle, const char *contextid, cons
#endif
}
-void DLTWrapper::init(DltLogLevelType loglevel, DltContext* context)
+void CAmDltWrapper::init(DltLogLevelType loglevel, DltContext* context)
{
if (!context)
context = &mDltContext;
@@ -95,7 +99,7 @@ void DLTWrapper::init(DltLogLevelType loglevel, DltContext* context)
}
-void DLTWrapper::send()
+void CAmDltWrapper::send()
{
#ifdef WITH_DLT
dlt_user_log_write_finish(&mDltContextData);
@@ -107,7 +111,7 @@ void DLTWrapper::send()
#endif
}
-void DLTWrapper::append(const int8_t value)
+void CAmDltWrapper::append(const int8_t value)
{
#ifdef WITH_DLT
dlt_user_log_write_int8(&mDltContextData, value);
@@ -116,7 +120,7 @@ void DLTWrapper::append(const int8_t value)
#endif
}
-void DLTWrapper::append(const uint8_t value)
+void CAmDltWrapper::append(const uint8_t value)
{
#ifdef WITH_DLT
dlt_user_log_write_uint8(&mDltContextData, value);
@@ -125,7 +129,7 @@ void DLTWrapper::append(const uint8_t value)
#endif
}
-void DLTWrapper::append(const int16_t value)
+void CAmDltWrapper::append(const int16_t value)
{
#ifdef WITH_DLT
dlt_user_log_write_int16(&mDltContextData, value);
@@ -134,7 +138,7 @@ void DLTWrapper::append(const int16_t value)
#endif
}
-void DLTWrapper::append(const uint16_t value)
+void CAmDltWrapper::append(const uint16_t value)
{
#ifdef WITH_DLT
dlt_user_log_write_uint16(&mDltContextData, value);
@@ -143,7 +147,7 @@ void DLTWrapper::append(const uint16_t value)
#endif
}
-void DLTWrapper::append(const int32_t value)
+void CAmDltWrapper::append(const int32_t value)
{
#ifdef WITH_DLT
dlt_user_log_write_int32(&mDltContextData, value);
@@ -152,7 +156,7 @@ void DLTWrapper::append(const int32_t value)
#endif
}
-void DLTWrapper::append(const uint32_t value)
+void CAmDltWrapper::append(const uint32_t value)
{
#ifdef WITH_DLT
dlt_user_log_write_uint32(&mDltContextData, value);
@@ -161,7 +165,7 @@ void DLTWrapper::append(const uint32_t value)
#endif
}
-void DLTWrapper::append(const char*& value)
+void CAmDltWrapper::append(const char*& value)
{
#ifdef WITH_DLT
dlt_user_log_write_string(&mDltContextData, value);
@@ -171,7 +175,7 @@ void DLTWrapper::append(const char*& value)
#endif
}
-void DLTWrapper::append(const std::string& value)
+void CAmDltWrapper::append(const std::string& value)
{
#ifdef WITH_DLT
dlt_user_log_write_string(&mDltContextData, value.c_str());
@@ -181,7 +185,7 @@ void DLTWrapper::append(const std::string& value)
#endif
}
-void DLTWrapper::append(const bool value)
+void CAmDltWrapper::append(const bool value)
{
#ifdef WITH_DLT
dlt_user_log_write_bool(&mDltContextData, static_cast<uint8_t>(value));
@@ -191,7 +195,7 @@ void DLTWrapper::append(const bool value)
}
#ifndef WITH_DLT
-template<class T> void DLTWrapper::appendNoDLT(T value)
+template<class T> void CAmDltWrapper::appendNoDLT(T value)
{
if((mDltContextData.size + sizeof(value)) < DLT_USER_BUF_MAX_SIZE)
{
@@ -200,15 +204,16 @@ template<class T> void DLTWrapper::appendNoDLT(T value)
}
}
-void DLTWrapper::enableNoDLTDebug(const bool enableNoDLTDebug)
+void CAmDltWrapper::enableNoDLTDebug(const bool enableNoDLTDebug)
{
mEnableNoDLTDebug = enableNoDLTDebug;
}
#endif
-DLTWrapper::~DLTWrapper()
+CAmDltWrapper::~CAmDltWrapper()
{
- if (mDLTWrapper)
- delete mDLTWrapper;
+ if (mpDLTWrapper)
+ delete mpDLTWrapper;
+}
}
diff --git a/AudioManagerDaemon/src/Router.cpp b/AudioManagerDaemon/src/CAmRouter.cpp
index c74989a..265f77d 100644
--- a/AudioManagerDaemon/src/Router.cpp
+++ b/AudioManagerDaemon/src/CAmRouter.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file Router.cpp
+ * \file CAmRouter.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,17 +22,17 @@
*
*/
-#include "Router.h"
-#include "DatabaseHandler.h"
-#include "ControlSender.h"
+#include "CAmRouter.h"
#include <cassert>
#include <algorithm>
#include <vector>
#include <iterator>
+#include "CAmDatabaseHandler.h"
+#include "CAmControlSender.h"
-using namespace am;
+namespace am {
-Router::Router(DatabaseHandler* iDatabaseHandler, ControlSender* iSender) :
+CAmRouter::CAmRouter(CAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSender) :
mDatabaseHandler(iDatabaseHandler), //
mControlSender(iSender)
{
@@ -40,7 +40,7 @@ Router::Router(DatabaseHandler* iDatabaseHandler, ControlSender* iSender) :
assert(mControlSender);
}
-am_Error_e Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
+am_Error_e CAmRouter::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
{
returnList.clear();
//first find out in which domains the source and sink are
@@ -88,9 +88,9 @@ am_Error_e Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, c
return E_OK;
}
- RoutingTree routingtree(sourceDomainID); //Build up a Tree from the Source_Domain to every other domain.
- std::vector<RoutingTreeItem*> flattree; //This list is the flat tree
- std::vector<RoutingTreeItem*> matchtree;
+ CAmRoutingTree routingtree(sourceDomainID); //Build up a Tree from the Source_Domain to every other domain.
+ std::vector<CAmRoutingTreeItem*> flattree; //This list is the flat tree
+ std::vector<CAmRoutingTreeItem*> matchtree;
std::vector<am_gatewayID_t> listGatewayID; //holds all gateway ids of the route
am_RoutingElement_s routingElement;
am_Route_s actualRoute; //holds the actual Route
@@ -99,7 +99,7 @@ am_Error_e Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, c
mDatabaseHandler->getRoutingTree(onlyfree, routingtree, flattree); //Build up the tree out of the database as
//we go through the returned flattree and look for our sink, after that flattree holds only treeItems that match
- std::vector<RoutingTreeItem*>::iterator iterator = flattree.begin();
+ std::vector<CAmRoutingTreeItem*>::iterator iterator = flattree.begin();
for (; iterator != flattree.end(); ++iterator)
{
if ((*iterator)->returnDomainID() == sinkDomainID)
@@ -164,7 +164,7 @@ am_Error_e Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, c
return (E_OK);
}
-void Router::listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e>& listFormats) const
+void CAmRouter::listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e>& listFormats) const
{
std::vector<am_ConnectionFormat_e> listSourceFormats;
std::vector<am_ConnectionFormat_e> listSinkFormats;
@@ -176,7 +176,7 @@ void Router::listPossibleConnectionFormats(const am_sourceID_t sourceID, const a
set_intersection(listSourceFormats.begin(), listSourceFormats.end(), listSinkFormats.begin(), listSinkFormats.end(), inserter);
}
-am_Error_e Router::findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, std::vector<am_RoutingElement_s> & listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator)
+am_Error_e CAmRouter::findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, std::vector<am_RoutingElement_s> & listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator)
{
am_Error_e returnError = E_NOT_POSSIBLE;
std::vector<am_ConnectionFormat_e> listConnectionFormats;
@@ -239,7 +239,7 @@ am_Error_e Router::findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, std::
return (returnError);
}
-void Router::listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e> & listFormats) const
+void CAmRouter::listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e> & listFormats) const
{
listFormats.clear();
am_Gateway_s gatewayData;
@@ -265,11 +265,11 @@ void Router::listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID,
} while (gatewayData.convertionMatrix.end() - matrixIterator > 0);
}
-Router::~Router()
+CAmRouter::~CAmRouter()
{
}
-RoutingTreeItem::RoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, RoutingTreeItem *parent) :
+CAmRoutingTreeItem::CAmRoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, CAmRoutingTreeItem *parent) :
mDomainID(domainID), //
mGatewayID(gatewayID), //
mParentItem(parent)
@@ -277,54 +277,54 @@ RoutingTreeItem::RoutingTreeItem(const am_domainID_t domainID, const am_gatewayI
assert(mDomainID!=0);
}
-void RoutingTreeItem::appendChild(RoutingTreeItem *newChild)
+void CAmRoutingTreeItem::appendChild(CAmRoutingTreeItem *newChild)
{
assert(newChild);
mListChildItems.push_back(newChild);
}
-void RoutingTreeItem::returnChildItems(std::vector<RoutingTreeItem*> listChildItems)
+void CAmRoutingTreeItem::returnChildItems(std::vector<CAmRoutingTreeItem*> listChildItems)
{
listChildItems = mListChildItems;
}
-am_domainID_t RoutingTreeItem::returnDomainID() const
+am_domainID_t CAmRoutingTreeItem::returnDomainID() const
{
return (mDomainID);
}
-am_gatewayID_t RoutingTreeItem::returnGatewayID() const
+am_gatewayID_t CAmRoutingTreeItem::returnGatewayID() const
{
return (mGatewayID);
}
-RoutingTreeItem* RoutingTreeItem::returnParent() const
+CAmRoutingTreeItem* CAmRoutingTreeItem::returnParent() const
{
return (mParentItem);
}
-RoutingTreeItem::~RoutingTreeItem()
+CAmRoutingTreeItem::~CAmRoutingTreeItem()
{
}
-RoutingTree::RoutingTree(const am_domainID_t rootDomainID) :
- mRootItem(RoutingTreeItem(rootDomainID))
+CAmRoutingTree::CAmRoutingTree(const am_domainID_t rootDomainID) :
+ mRootItem(CAmRoutingTreeItem(rootDomainID))
{
assert(rootDomainID!=0);
}
-RoutingTreeItem *RoutingTree::insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, RoutingTreeItem *parent)
+CAmRoutingTreeItem *CAmRoutingTree::insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, CAmRoutingTreeItem *parent)
{
- RoutingTreeItem *newTree = new RoutingTreeItem(domainID, gatewayID, parent);
+ CAmRoutingTreeItem *newTree = new CAmRoutingTreeItem(domainID, gatewayID, parent);
parent->appendChild(newTree);
mListChild.push_back(newTree);
return newTree;
}
-void RoutingTree::getRoute(RoutingTreeItem *targetItem, std::vector<am_gatewayID_t>& listGateways)
+void CAmRoutingTree::getRoute(CAmRoutingTreeItem *targetItem, std::vector<am_gatewayID_t>& listGateways)
{
listGateways.clear();
- RoutingTreeItem *parentItem = targetItem;
+ CAmRoutingTreeItem *parentItem = targetItem;
while (parentItem != &mRootItem)
{
listGateways.push_back(parentItem->returnGatewayID());
@@ -333,22 +333,22 @@ void RoutingTree::getRoute(RoutingTreeItem *targetItem, std::vector<am_gatewayID
std::reverse(listGateways.begin(), listGateways.end());
}
-am_domainID_t RoutingTree::returnRootDomainID() const
+am_domainID_t CAmRoutingTree::returnRootDomainID() const
{
return (mRootItem.returnDomainID());
}
-RoutingTreeItem *RoutingTree::returnRootItem()
+CAmRoutingTreeItem *CAmRoutingTree::returnRootItem()
{
return (&mRootItem);
}
-RoutingTree::~RoutingTree()
+CAmRoutingTree::~CAmRoutingTree()
{
- std::vector<RoutingTreeItem*>::iterator it = mListChild.begin();
+ std::vector<CAmRoutingTreeItem*>::iterator it = mListChild.begin();
for (; it != mListChild.end(); ++it)
{
delete *it;
}
}
-
+}
diff --git a/AudioManagerDaemon/src/RoutingReceiver.cpp b/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
index 715fa36..8f489fb 100644
--- a/AudioManagerDaemon/src/RoutingReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
@@ -3,12 +3,12 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file RoutingReceiver.cpp
+ * \file CAmRoutingReceiver.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section LicenseRoutingReceiver.h
+ * \section LicenseCAmRoutingReceiver.h
*
* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
@@ -23,19 +23,19 @@
*
*/
-#include "RoutingReceiver.h"
-#include "DatabaseHandler.h"
-#include "RoutingSender.h"
-#include "ControlSender.h"
-#include "DLTWrapper.h"
-#include <SocketHandler.h>
+#include "CAmRoutingReceiver.h"
#include <cassert>
#include <algorithm>
+#include "CAmDatabaseHandler.h"
+#include "CAmRoutingSender.h"
+#include "CAmControlSender.h"
+#include "shared/CAmDltWrapper.h"
+#include "shared/CAmSocketHandler.h"
+namespace am
+{
-using namespace am;
-
-RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler) :
+CAmRoutingReceiver::CAmRoutingReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
mControlSender(iControlSender), //
@@ -51,7 +51,7 @@ RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSende
assert(mSocketHandler!=NULL);
}
-RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper) :
+CAmRoutingReceiver::CAmRoutingReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
mControlSender(iControlSender), //
@@ -69,11 +69,11 @@ RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSende
assert(mDBusWrapper!=NULL);
}
-RoutingReceiver::~RoutingReceiver()
+CAmRoutingReceiver::~CAmRoutingReceiver()
{
}
-void RoutingReceiver::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
+void CAmRoutingReceiver::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
mRoutingSender->removeHandle(handle);
if (error == E_OK)
@@ -87,7 +87,7 @@ void RoutingReceiver::ackConnect(const am_Handle_s handle, const am_connectionID
mControlSender->cbAckConnect(handle, error);
}
-void RoutingReceiver::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
+void CAmRoutingReceiver::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
mRoutingSender->removeHandle(handle);
if (error == E_OK)
@@ -97,9 +97,9 @@ void RoutingReceiver::ackDisconnect(const am_Handle_s handle, const am_connectio
mControlSender->cbAckDisconnect(handle, error);
}
-void RoutingReceiver::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
+void CAmRoutingReceiver::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sinkID != 0)
{
//todo: check if volume in handleData is same than volume. React to it.
@@ -109,9 +109,9 @@ void RoutingReceiver::ackSetSinkVolumeChange(const am_Handle_s handle, const am_
mControlSender->cbAckSetSinkVolumeChange(handle, volume, error);
}
-void RoutingReceiver::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
+void CAmRoutingReceiver::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sourceID != 0)
{
//todo: check if volume in handleData is same than volume. React to it.
@@ -121,9 +121,9 @@ void RoutingReceiver::ackSetSourceVolumeChange(const am_Handle_s handle, const a
mControlSender->cbAckSetSourceVolumeChange(handle, volume, error);
}
-void RoutingReceiver::ackSetSourceState(const am_Handle_s handle, const am_Error_e error)
+void CAmRoutingReceiver::ackSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
- RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sourceID != 0)
{
//todo: check if volume in handleData is same than volume. React to it.
@@ -133,9 +133,9 @@ void RoutingReceiver::ackSetSourceState(const am_Handle_s handle, const am_Error
mControlSender->cbAckSetSourceState(handle, error);
}
-void RoutingReceiver::ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
+void CAmRoutingReceiver::ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sinkID != 0)
{
mDatabaseHandler->changeSinkSoundPropertyDB(handleData.soundPropery, handleData.sinkID);
@@ -145,9 +145,9 @@ void RoutingReceiver::ackSetSinkSoundProperty(const am_Handle_s handle, const am
}
-void am::RoutingReceiver::ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
+void am::CAmRoutingReceiver::ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
- RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sinkID != 0)
{
std::vector<am_SoundProperty_s>::const_iterator it = handleData.soundProperties->begin();
@@ -161,9 +161,9 @@ void am::RoutingReceiver::ackSetSinkSoundProperties(const am_Handle_s handle, co
mControlSender->cbAckSetSinkSoundProperties(handle, error);
}
-void RoutingReceiver::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
+void CAmRoutingReceiver::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sourceID != 0)
{
mDatabaseHandler->changeSourceSoundPropertyDB(handleData.soundPropery, handleData.sourceID);
@@ -172,9 +172,9 @@ void RoutingReceiver::ackSetSourceSoundProperty(const am_Handle_s handle, const
mControlSender->cbAckSetSourceSoundProperty(handle, error);
}
-void am::RoutingReceiver::ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
+void am::CAmRoutingReceiver::ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
- RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sourceID != 0)
{
std::vector<am_SoundProperty_s>::const_iterator it = handleData.soundProperties->begin();
@@ -188,9 +188,9 @@ void am::RoutingReceiver::ackSetSourceSoundProperties(const am_Handle_s handle,
mControlSender->cbAckSetSourceSoundProperties(handle, error);
}
-void RoutingReceiver::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error)
+void CAmRoutingReceiver::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error)
{
- RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.crossfaderID != 0)
{
//todo: check if volume in handleData is same than volume. React to it.
@@ -200,128 +200,128 @@ void RoutingReceiver::ackCrossFading(const am_Handle_s handle, const am_HotSink_
mControlSender->cbAckCrossFade(handle, hotSink, error);
}
-void RoutingReceiver::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
+void CAmRoutingReceiver::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
mControlSender->hookSystemSourceVolumeTick(handle, sourceID, volume);
}
-void RoutingReceiver::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
+void CAmRoutingReceiver::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
mControlSender->hookSystemSinkVolumeTick(handle, sinkID, volume);
}
-am_Error_e RoutingReceiver::peekDomain(const std::string & name, am_domainID_t & domainID)
+am_Error_e CAmRoutingReceiver::peekDomain(const std::string & name, am_domainID_t & domainID)
{
return mDatabaseHandler->peekDomain(name, domainID);
}
-am_Error_e RoutingReceiver::registerDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
+am_Error_e CAmRoutingReceiver::registerDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
return mControlSender->hookSystemRegisterDomain(domainData, domainID);
}
-am_Error_e RoutingReceiver::deregisterDomain(const am_domainID_t domainID)
+am_Error_e CAmRoutingReceiver::deregisterDomain(const am_domainID_t domainID)
{
return mControlSender->hookSystemDeregisterDomain(domainID);
}
-am_Error_e RoutingReceiver::registerGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+am_Error_e CAmRoutingReceiver::registerGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
return mControlSender->hookSystemRegisterGateway(gatewayData, gatewayID);
}
-am_Error_e RoutingReceiver::deregisterGateway(const am_gatewayID_t gatewayID)
+am_Error_e CAmRoutingReceiver::deregisterGateway(const am_gatewayID_t gatewayID)
{
return mControlSender->hookSystemDeregisterGateway(gatewayID);
}
-am_Error_e RoutingReceiver::peekSink(const std::string& name, am_sinkID_t & sinkID)
+am_Error_e CAmRoutingReceiver::peekSink(const std::string& name, am_sinkID_t & sinkID)
{
return mDatabaseHandler->peekSink(name, sinkID);
}
-am_Error_e RoutingReceiver::registerSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+am_Error_e CAmRoutingReceiver::registerSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
return mControlSender->hookSystemRegisterSink(sinkData, sinkID);
}
-am_Error_e RoutingReceiver::deregisterSink(const am_sinkID_t sinkID)
+am_Error_e CAmRoutingReceiver::deregisterSink(const am_sinkID_t sinkID)
{
return mControlSender->hookSystemDeregisterSink(sinkID);
}
-am_Error_e RoutingReceiver::peekSource(const std::string & name, am_sourceID_t & sourceID)
+am_Error_e CAmRoutingReceiver::peekSource(const std::string & name, am_sourceID_t & sourceID)
{
return mDatabaseHandler->peekSource(name, sourceID);
}
-am_Error_e RoutingReceiver::registerSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+am_Error_e CAmRoutingReceiver::registerSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
return mControlSender->hookSystemRegisterSource(sourceData, sourceID);
}
-am_Error_e RoutingReceiver::deregisterSource(const am_sourceID_t sourceID)
+am_Error_e CAmRoutingReceiver::deregisterSource(const am_sourceID_t sourceID)
{
return mControlSender->hookSystemDeregisterSource(sourceID);
}
-am_Error_e RoutingReceiver::registerCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+am_Error_e CAmRoutingReceiver::registerCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
return mControlSender->hookSystemRegisterCrossfader(crossfaderData, crossfaderID);
}
-am_Error_e RoutingReceiver::deregisterCrossfader(const am_crossfaderID_t crossfaderID)
+am_Error_e CAmRoutingReceiver::deregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
return mControlSender->hookSystemDeregisterCrossfader(crossfaderID);
}
-void RoutingReceiver::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
+void CAmRoutingReceiver::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
return mControlSender->hookSystemInterruptStateChange(sourceID, interruptState);
}
-void RoutingReceiver::hookDomainRegistrationComplete(const am_domainID_t domainID)
+void CAmRoutingReceiver::hookDomainRegistrationComplete(const am_domainID_t domainID)
{
mControlSender->hookSystemDomainRegistrationComplete(domainID);
}
-void RoutingReceiver::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
+void CAmRoutingReceiver::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
mControlSender->hookSystemSinkAvailablityStateChange(sinkID, availability);
}
-void RoutingReceiver::hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
+void CAmRoutingReceiver::hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
mControlSender->hookSystemSourceAvailablityStateChange(sourceID, availability);
}
-void RoutingReceiver::hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState)
+void CAmRoutingReceiver::hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState)
{
mControlSender->hookSystemDomainStateChange(domainID, domainState);
}
-void RoutingReceiver::hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay)
+void CAmRoutingReceiver::hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
mDatabaseHandler->changeConnectionTimingInformation(connectionID, delay);
}
-void RoutingReceiver::sendChangedData(const std::vector<am_EarlyData_s> & earlyData)
+void CAmRoutingReceiver::sendChangedData(const std::vector<am_EarlyData_s> & earlyData)
{
mControlSender->hookSystemReceiveEarlyData(earlyData);
}
-am_Error_e RoutingReceiver::peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID)
+am_Error_e CAmRoutingReceiver::peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID)
{
return mDatabaseHandler->peekSinkClassID(name, sinkClassID);
}
-am_Error_e RoutingReceiver::peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID)
+am_Error_e CAmRoutingReceiver::peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID)
{
return mDatabaseHandler->peekSourceClassID(name, sourceClassID);
}
-am_Error_e RoutingReceiver::getDBusConnectionWrapper(DBusWrapper *& dbusConnectionWrapper) const
+am_Error_e CAmRoutingReceiver::getDBusConnectionWrapper(CAmDbusWrapper *& dbusConnectionWrapper) const
{
#ifdef WITH_DBUS_WRAPPER
dbusConnectionWrapper = mDBusWrapper;
@@ -331,52 +331,52 @@ am_Error_e RoutingReceiver::getDBusConnectionWrapper(DBusWrapper *& dbusConnecti
#endif
}
-am_Error_e RoutingReceiver::getSocketHandler(SocketHandler *& socketHandler) const
+am_Error_e CAmRoutingReceiver::getSocketHandler(CAmSocketHandler *& socketHandler) const
{
socketHandler = mSocketHandler;
return E_OK;
}
-void RoutingReceiver::getInterfaceVersion(std::string & version) const
+void CAmRoutingReceiver::getInterfaceVersion(std::string & version) const
{
version = RoutingReceiveVersion;
}
-void RoutingReceiver::confirmRoutingReady(const uint16_t handle)
+void CAmRoutingReceiver::confirmRoutingReady(const uint16_t handle)
{
mListStartupHandles.erase(std::remove(mListStartupHandles.begin(), mListStartupHandles.end(), handle), mListStartupHandles.end());
if (mWaitStartup && mListStartupHandles.empty())
mControlSender->confirmRoutingReady();
}
-void RoutingReceiver::confirmRoutingRundown(const uint16_t handle)
+void CAmRoutingReceiver::confirmRoutingRundown(const uint16_t handle)
{
mListRundownHandles.erase(std::remove(mListRundownHandles.begin(), mListRundownHandles.end(), handle), mListRundownHandles.end());
if (mWaitRundown && mListRundownHandles.empty())
mControlSender->confirmCommandRundown();
}
-uint16_t am::RoutingReceiver::getStartupHandle()
+uint16_t am::CAmRoutingReceiver::getStartupHandle()
{
uint16_t handle = ++handleCount; //todo: handle overflow
mListStartupHandles.push_back(handle);
return handle;
}
-uint16_t am::RoutingReceiver::getRundownHandle()
+uint16_t am::CAmRoutingReceiver::getRundownHandle()
{
uint16_t handle = ++handleCount; //todo: handle overflow
mListRundownHandles.push_back(handle);
return handle;
}
-void am::RoutingReceiver::waitOnStartup(bool startup)
+void am::CAmRoutingReceiver::waitOnStartup(bool startup)
{
mWaitStartup = startup;
}
-void am::RoutingReceiver::waitOnRundown(bool rundown)
+void am::CAmRoutingReceiver::waitOnRundown(bool rundown)
{
mWaitRundown = rundown;
}
-
+}
diff --git a/AudioManagerDaemon/src/RoutingSender.cpp b/AudioManagerDaemon/src/CAmRoutingSender.cpp
index c59641d..c134c3f 100644
--- a/AudioManagerDaemon/src/RoutingSender.cpp
+++ b/AudioManagerDaemon/src/CAmRoutingSender.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file RoutingSender.h
+ * \file CAmRoutingSender.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,19 +22,19 @@
*
*/
-#include "RoutingSender.h"
+#include "CAmRoutingSender.h"
#include <utility>
#include <dirent.h>
#include <dlfcn.h>
#include <cassert>
#include <iostream>
#include <sstream>
+#include "CAmRoutingReceiver.h"
+#include "TAmPluginTemplate.h"
+#include "shared/CAmDltWrapper.h"
-#include "RoutingReceiver.h"
-#include "PluginTemplate.h"
-#include "DLTWrapper.h"
-
-using namespace am;
+namespace am
+{
#define REQUIRED_INTERFACE_VERSION_MAJOR 1
#define REQUIRED_INTERFACE_VERSION_MINOR 0
@@ -47,7 +47,7 @@ using namespace am;
(*iter).routingInterface->__VA_ARGS__; \
}
-RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirectories) :
+CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginDirectories) :
mHandleCount(0), //
mlistActiveHandles(), //
mListInterfaces(), //
@@ -109,9 +109,9 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
{
logInfo("RoutingSender::RoutingSender try loading: ", *iter);
- RoutingSendInterface* (*createFunc)();
+ IAmRoutingSend* (*createFunc)();
void* tempLibHandle = NULL;
- createFunc = getCreateFunction<RoutingSendInterface*()>(*iter, tempLibHandle);
+ createFunc = getCreateFunction<IAmRoutingSend*()>(*iter, tempLibHandle);
if (!createFunc)
{
@@ -119,7 +119,7 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
continue;
}
- RoutingSendInterface* router = createFunc();
+ IAmRoutingSend* router = createFunc();
if (!router)
{
@@ -150,7 +150,7 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
}
}
-RoutingSender::~RoutingSender()
+CAmRoutingSender::~CAmRoutingSender()
{
unloadLibraries();
HandlesMap::iterator it = mlistActiveHandles.begin();
@@ -165,7 +165,7 @@ RoutingSender::~RoutingSender()
}
}
-am_Error_e RoutingSender::startupInterfaces(RoutingReceiver *iRoutingReceiver)
+am_Error_e CAmRoutingSender::startupInterfaces(CAmRoutingReceiver *iRoutingReceiver)
{
mRoutingReceiver = iRoutingReceiver;
am_Error_e returnError = E_OK;
@@ -183,7 +183,7 @@ am_Error_e RoutingSender::startupInterfaces(RoutingReceiver *iRoutingReceiver)
return returnError;
}
-am_Error_e RoutingSender::asyncAbort(const am_Handle_s& handle)
+am_Error_e CAmRoutingSender::asyncAbort(const am_Handle_s& handle)
{
HandleInterfaceMap::iterator iter = mMapHandleInterface.begin();
iter = mMapHandleInterface.find(handle.handle);
@@ -195,7 +195,7 @@ am_Error_e RoutingSender::asyncAbort(const am_Handle_s& handle)
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::asyncConnect(am_Handle_s& handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
+am_Error_e CAmRoutingSender::asyncConnect(am_Handle_s& handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
{
am_handleData_c handleData;
SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
@@ -212,11 +212,11 @@ am_Error_e RoutingSender::asyncConnect(am_Handle_s& handle, const am_connectionI
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::asyncDisconnect(am_Handle_s& handle, const am_connectionID_t connectionID)
+am_Error_e CAmRoutingSender::asyncDisconnect(am_Handle_s& handle, const am_connectionID_t connectionID)
{
am_handleData_c handleData;
ConnectionInterfaceMap::iterator iter = mMapConnectionInterface.begin();
- mMapConnectionInterface.find(connectionID);
+ iter = mMapConnectionInterface.find(connectionID);
if (iter != mMapConnectionInterface.end())
{
handleData.connectionID = connectionID;
@@ -230,120 +230,136 @@ am_Error_e RoutingSender::asyncDisconnect(am_Handle_s& handle, const am_connecti
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::asyncSetSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
+am_Error_e CAmRoutingSender::asyncSetSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
am_handleData_c handleData;
SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
iter = mMapSinkInterface.find(sinkID);
if (iter != mMapSinkInterface.end())
+ {
handleData.sinkID = sinkID;
- handleData.volume = volume;
- handle = createHandle(handleData, H_SETSINKVOLUME);
- mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSinkVolume(handle, sinkID, volume, ramp, time);
+ handleData.volume = volume;
+ handle = createHandle(handleData, H_SETSINKVOLUME);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSinkVolume(handle, sinkID, volume, ramp, time);
+ }
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::asyncSetSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
+am_Error_e CAmRoutingSender::asyncSetSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
am_handleData_c handleData;
SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
iter = mMapSourceInterface.find(sourceID);
if (iter != mMapSourceInterface.end())
+ {
handleData.sourceID = sourceID;
- handleData.volume = volume;
- handle = createHandle(handleData, H_SETSOURCEVOLUME);
- mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceVolume(handle, sourceID, volume, ramp, time);
+ handleData.volume = volume;
+ handle = createHandle(handleData, H_SETSOURCEVOLUME);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSourceVolume(handle, sourceID, volume, ramp, time);
+ }
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::asyncSetSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state)
+am_Error_e CAmRoutingSender::asyncSetSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
am_handleData_c handleData;
SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
iter = mMapSourceInterface.find(sourceID);
if (iter != mMapSourceInterface.end())
+ {
handleData.sourceID = sourceID;
- handleData.sourceState = state;
- handle = createHandle(handleData, H_SETSOURCESTATE);
- mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceState(handle, sourceID, state);
+ handleData.sourceState = state;
+ handle = createHandle(handleData, H_SETSOURCESTATE);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSourceState(handle, sourceID, state);
+ }
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
+am_Error_e CAmRoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
am_handleData_c handleData;
SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
iter = mMapSinkInterface.find(sinkID);
if (iter != mMapSinkInterface.end())
+ {
handleData.sinkID = sinkID;
- handleData.soundPropery = soundProperty;
- handle = createHandle(handleData, H_SETSINKSOUNDPROPERTY);
- mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSinkSoundProperty(handle, sinkID, soundProperty);
+ handleData.soundPropery = soundProperty;
+ handle = createHandle(handleData, H_SETSINKSOUNDPROPERTY);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSinkSoundProperty(handle, sinkID, soundProperty);
+ }
return (E_NON_EXISTENT);
}
-am_Error_e RoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
+am_Error_e CAmRoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
{
am_handleData_c handleData;
SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
iter = mMapSourceInterface.find(sourceID);
if (iter != mMapSourceInterface.end())
+ {
handleData.sourceID = sourceID;
- handleData.soundPropery = soundProperty;
- handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTY);
- mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceSoundProperty(handle, sourceID, soundProperty);
+ handleData.soundPropery = soundProperty;
+ handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTY);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSourceSoundProperty(handle, sourceID, soundProperty);
+ }
return (E_NON_EXISTENT);
}
-am_Error_e RoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sourceID_t sourceID)
+am_Error_e CAmRoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sourceID_t sourceID)
{
am_handleData_c handleData;
SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
iter = mMapSourceInterface.find(sourceID);
if (iter != mMapSourceInterface.end())
+ {
handleData.sourceID = sourceID;
- handleData.soundProperties = new std::vector<am_SoundProperty_s>(listSoundProperties);
- handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTIES);
- mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceSoundProperties(handle, sourceID, listSoundProperties);
+ handleData.soundProperties = new std::vector<am_SoundProperty_s>(listSoundProperties);
+ handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTIES);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSourceSoundProperties(handle, sourceID, listSoundProperties);
+ }
return (E_NON_EXISTENT);
}
-am_Error_e RoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sinkID_t sinkID)
+am_Error_e CAmRoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sinkID_t sinkID)
{
am_handleData_c handleData;
SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
iter = mMapSinkInterface.find(sinkID);
if (iter != mMapSinkInterface.end())
+ {
handleData.sinkID = sinkID;
- handleData.soundProperties = new std::vector<am_SoundProperty_s>(listSoundProperties);
- handle = createHandle(handleData, H_SETSINKSOUNDPROPERTIES);
- mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSinkSoundProperties(handle, sinkID, listSoundProperties);
+ handleData.soundProperties = new std::vector<am_SoundProperty_s>(listSoundProperties);
+ handle = createHandle(handleData, H_SETSINKSOUNDPROPERTIES);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSinkSoundProperties(handle, sinkID, listSoundProperties);
+ }
return (E_NON_EXISTENT);
}
-am_Error_e RoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
+am_Error_e CAmRoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
{
am_handleData_c handleData;
CrossfaderInterfaceMap::iterator iter = mMapCrossfaderInterface.begin();
iter = mMapCrossfaderInterface.find(crossfaderID);
if (iter != mMapCrossfaderInterface.end())
+ {
handleData.crossfaderID = crossfaderID;
- handleData.hotSink = hotSink;
- handle = createHandle(handleData, H_CROSSFADE);
- mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncCrossFade(handle, crossfaderID, hotSink, rampType, time);
+ handleData.hotSink = hotSink;
+ handle = createHandle(handleData, H_CROSSFADE);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncCrossFade(handle, crossfaderID, hotSink, rampType, time);
+ }
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
+am_Error_e CAmRoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
iter = mMapDomainInterface.find(domainID);
@@ -352,7 +368,7 @@ am_Error_e RoutingSender::setDomainState(const am_domainID_t domainID, const am_
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::addDomainLookup(const am_Domain_s& domainData)
+am_Error_e CAmRoutingSender::addDomainLookup(const am_Domain_s& domainData)
{
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end();
@@ -368,7 +384,7 @@ am_Error_e RoutingSender::addDomainLookup(const am_Domain_s& domainData)
return E_UNKNOWN;
}
-am_Error_e RoutingSender::addSourceLookup(const am_Source_s& sourceData)
+am_Error_e CAmRoutingSender::addSourceLookup(const am_Source_s& sourceData)
{
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
iter = mMapDomainInterface.find(sourceData.domainID);
@@ -381,7 +397,7 @@ am_Error_e RoutingSender::addSourceLookup(const am_Source_s& sourceData)
return E_UNKNOWN;
}
-am_Error_e RoutingSender::addSinkLookup(const am_Sink_s& sinkData)
+am_Error_e CAmRoutingSender::addSinkLookup(const am_Sink_s& sinkData)
{
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
iter = mMapDomainInterface.find(sinkData.domainID);
@@ -394,7 +410,7 @@ am_Error_e RoutingSender::addSinkLookup(const am_Sink_s& sinkData)
return E_UNKNOWN;
}
-am_Error_e RoutingSender::addCrossfaderLookup(const am_Crossfader_s& crossfaderData)
+am_Error_e CAmRoutingSender::addCrossfaderLookup(const am_Crossfader_s& crossfaderData)
{
DomainInterfaceMap::iterator iter = mMapSourceInterface.begin();
iter = mMapSourceInterface.find(crossfaderData.sourceID);
@@ -407,7 +423,7 @@ am_Error_e RoutingSender::addCrossfaderLookup(const am_Crossfader_s& crossfaderD
return E_UNKNOWN;
}
-am_Error_e RoutingSender::removeDomainLookup(const am_domainID_t domainID)
+am_Error_e CAmRoutingSender::removeDomainLookup(const am_domainID_t domainID)
{
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
iter = mMapDomainInterface.find(domainID);
@@ -420,7 +436,7 @@ am_Error_e RoutingSender::removeDomainLookup(const am_domainID_t domainID)
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::removeSourceLookup(const am_sourceID_t sourceID)
+am_Error_e CAmRoutingSender::removeSourceLookup(const am_sourceID_t sourceID)
{
SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
iter = mMapSourceInterface.find(sourceID);
@@ -433,7 +449,7 @@ am_Error_e RoutingSender::removeSourceLookup(const am_sourceID_t sourceID)
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::removeSinkLookup(const am_sinkID_t sinkID)
+am_Error_e CAmRoutingSender::removeSinkLookup(const am_sinkID_t sinkID)
{
SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
iter = mMapSinkInterface.find(sinkID);
@@ -446,7 +462,7 @@ am_Error_e RoutingSender::removeSinkLookup(const am_sinkID_t sinkID)
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::removeCrossfaderLookup(const am_crossfaderID_t crossfaderID)
+am_Error_e CAmRoutingSender::removeCrossfaderLookup(const am_crossfaderID_t crossfaderID)
{
CrossfaderInterfaceMap::iterator iter = mMapCrossfaderInterface.begin();
iter = mMapCrossfaderInterface.find(crossfaderID);
@@ -459,14 +475,14 @@ am_Error_e RoutingSender::removeCrossfaderLookup(const am_crossfaderID_t crossfa
return E_NON_EXISTENT;
}
-am_Error_e RoutingSender::removeHandle(const am_Handle_s& handle)
+am_Error_e CAmRoutingSender::removeHandle(const am_Handle_s& handle)
{
if (mlistActiveHandles.erase(handle))
return E_OK;
return E_UNKNOWN;
}
-am_Error_e RoutingSender::getListHandles(std::vector<am_Handle_s> & listHandles) const
+am_Error_e CAmRoutingSender::getListHandles(std::vector<am_Handle_s> & listHandles) const
{
listHandles.clear();
HandlesMap::const_iterator it = mlistActiveHandles.begin();
@@ -477,7 +493,7 @@ am_Error_e RoutingSender::getListHandles(std::vector<am_Handle_s> & listHandles)
return E_OK;
}
-am_Handle_s RoutingSender::createHandle(const am_handleData_c& handleData, const am_Handle_e type)
+am_Handle_s CAmRoutingSender::createHandle(const am_handleData_c& handleData, const am_Handle_e type)
{
am_Handle_s handle;
handle.handle = ++mHandleCount; //todo: handle overflows here...
@@ -486,14 +502,14 @@ am_Handle_s RoutingSender::createHandle(const am_handleData_c& handleData, const
return handle;
}
-RoutingSender::am_handleData_c RoutingSender::returnHandleData(const am_Handle_s handle) const
+CAmRoutingSender::am_handleData_c CAmRoutingSender::returnHandleData(const am_Handle_s handle) const
{
HandlesMap::const_iterator it = mlistActiveHandles.begin();
it = mlistActiveHandles.find(handle);
return (it->second);
}
-void RoutingSender::setRoutingReady()
+void CAmRoutingSender::setRoutingReady()
{
mRoutingReceiver->waitOnStartup(false);
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
@@ -505,7 +521,7 @@ void RoutingSender::setRoutingReady()
mRoutingReceiver->waitOnStartup(true);
}
-void RoutingSender::setRoutingRundown()
+void CAmRoutingSender::setRoutingRundown()
{
mRoutingReceiver->waitOnRundown(false);
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
@@ -517,7 +533,7 @@ void RoutingSender::setRoutingRundown()
mRoutingReceiver->waitOnRundown(true);
}
-void RoutingSender::unloadLibraries(void)
+void CAmRoutingSender::unloadLibraries(void)
{
std::vector<void*>::iterator iterator = mListLibraryHandles.begin();
for (; iterator < mListLibraryHandles.end(); ++iterator)
@@ -527,7 +543,7 @@ void RoutingSender::unloadLibraries(void)
mListLibraryHandles.clear();
}
-am_Error_e RoutingSender::getListPlugins(std::vector<std::string>& interfaces) const
+am_Error_e CAmRoutingSender::getListPlugins(std::vector<std::string>& interfaces) const
{
std::vector<InterfaceNamePairs>::const_iterator it = mListInterfaces.begin();
for (; it != mListInterfaces.end(); ++it)
@@ -537,8 +553,8 @@ am_Error_e RoutingSender::getListPlugins(std::vector<std::string>& interfaces) c
return E_OK;
}
-void RoutingSender::getInterfaceVersion(std::string & version) const
+void CAmRoutingSender::getInterfaceVersion(std::string & version) const
{
version = RoutingSendVersion;
}
-
+}
diff --git a/AudioManagerDaemon/src/SocketHandler.cpp b/AudioManagerDaemon/src/CAmSocketHandler.cpp
index 444289f..2d5c7d7 100644
--- a/AudioManagerDaemon/src/SocketHandler.cpp
+++ b/AudioManagerDaemon/src/CAmSocketHandler.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file DBusWrapper.cpp
+ * \file CAmDbusWrapper.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,7 +22,7 @@
*
*/
-#include "SocketHandler.h"
+#include "shared/CAmSocketHandler.h"
#include <config.h>
#include <cassert>
#include <sys/fcntl.h>
@@ -32,14 +32,14 @@
#include <time.h>
#include <features.h>
#include <csignal>
-#include "DLTWrapper.h"
+#include "shared/CAmDltWrapper.h"
//todo: implement time correction if timer was interrupted by call
//todo: change hitlist to a list that holds all information, because entering and removing items will be cheaper than with std::vector
-using namespace am;
+namespace am {
-SocketHandler::SocketHandler() :
+CAmSocketHandler::CAmSocketHandler() :
mListPoll(), //
mListTimer(), //
mListActiveTimer(), //
@@ -54,7 +54,7 @@ SocketHandler::SocketHandler() :
gDispatchDone = 0;
}
-SocketHandler::~SocketHandler()
+CAmSocketHandler::~CAmSocketHandler()
{
}
@@ -62,7 +62,7 @@ SocketHandler::~SocketHandler()
/**
* start the block listening for filedescriptors. This is the mainloop.
*/
-void SocketHandler::start_listenting()
+void CAmSocketHandler::start_listenting()
{
gDispatchDone=0;
int16_t pollStatus;
@@ -84,7 +84,7 @@ void SocketHandler::start_listenting()
{
//first we go through the registered filedescriptors and check if someone needs preparation:
mListPoll_t::iterator prepIter = mListPoll.begin();
- shPollPrepare *prep = NULL;
+ CAmShPollPrepare *prep = NULL;
for (; prepIter != mListPoll.end(); ++prepIter)
{
if ((prep = prepIter->prepareCB) != NULL)
@@ -95,7 +95,7 @@ void SocketHandler::start_listenting()
{
mfdPollingArray.clear();
//there was a change in the setup, so we need to recreate the fdarray from the list
- std::for_each(mListPoll.begin(), mListPoll.end(), CopyPollfd(mfdPollingArray));
+ std::for_each(mListPoll.begin(), mListPoll.end(), CAmShCopyPollfd(mfdPollingArray));
mRecreatePollfds = false;
}
@@ -156,7 +156,7 @@ void SocketHandler::start_listenting()
std::list<int16_t>::iterator hListIt = hitList.begin();
for (; hListIt != hitList.end(); ++hListIt)
{
- shPollFired* fire = NULL;
+ CAmShPollFired* fire = NULL;
if ((fire = listPoll.at(*hListIt).firedCB) != NULL)
fire->Call(mfdPollingArray.at(*hListIt), listPoll.at(*hListIt).handle, listPoll.at(*hListIt).userData);
}
@@ -165,7 +165,7 @@ void SocketHandler::start_listenting()
hListIt = hitList.begin();
for (; hListIt != hitList.end(); ++hListIt)
{
- shPollCheck* check = NULL;
+ CAmShPollCheck* check = NULL;
if ((check = listPoll.at(*hListIt).checkCB) != NULL)
{
if (!check->Call(listPoll.at(*hListIt).handle, listPoll.at(*hListIt).userData))
@@ -181,7 +181,7 @@ void SocketHandler::start_listenting()
hListIt = hitList.begin();
for (; hListIt != hitList.end(); ++hListIt)
{
- shPollDispatch *dispatch = NULL;
+ CAmShPollDispatch *dispatch = NULL;
if ((dispatch = listPoll.at(*hListIt).dispatchCB) != NULL)
{
if (!dispatch->Call(listPoll.at(*hListIt).handle, listPoll.at(*hListIt).userData))
@@ -208,7 +208,7 @@ void SocketHandler::start_listenting()
/**
* exits the loop
*/
-void SocketHandler::stop_listening()
+void CAmSocketHandler::stop_listening()
{
gDispatchDone = 1;
}
@@ -220,8 +220,7 @@ void SocketHandler::stop_listening()
* @param callback the callback that shall be called if the filedescriptor poll succeeded
* @return E_OK if the descriptor was added, E_NON_EXISTENT if the fd is not valid
*/
-
-am_Error_e SocketHandler::addFDPoll(const int fd, const short event, shPollPrepare *prepare, shPollFired *fired, shPollCheck *check, shPollDispatch *dispatch, void *userData, sh_pollHandle_t & handle)
+am_Error_e CAmSocketHandler::addFDPoll(const int fd, const short event, CAmShPollPrepare *prepare, CAmShPollFired *fired, CAmShPollCheck *check, CAmShPollDispatch *dispatch, void *userData, sh_pollHandle_t & handle)
{
if (!fdIsValid(fd))
return E_NON_EXISTENT;
@@ -251,7 +250,7 @@ am_Error_e SocketHandler::addFDPoll(const int fd, const short event, shPollPrep
* @param fd the filedescriptor to be removed
* @return E_OK in case of sucess, E_NON_EXISTENT or E_UNKNOWN if the fd in not registered
*/
-am_Error_e SocketHandler::removeFDPoll(const sh_pollHandle_t handle)
+am_Error_e CAmSocketHandler::removeFDPoll(const sh_pollHandle_t handle)
{
mListPoll_t::iterator iterator = mListPoll.begin();
@@ -277,12 +276,12 @@ am_Error_e SocketHandler::removeFDPoll(const sh_pollHandle_t handle)
* @param handle the handle that is created for the timer is returned. Can be used to remove the timer
* @return E_OK in case of success
*/
-am_Error_e SocketHandler::addTimer(const timespec timeouts, shTimerCallBack*& callback, sh_timerHandle_t& handle, void * userData)
+am_Error_e CAmSocketHandler::addTimer(const timespec timeouts, CAmShTimerCallBack*& callback, sh_timerHandle_t& handle, void * userData)
{
assert(!((timeouts.tv_sec==0) && (timeouts.tv_nsec==0)));
assert(callback!=NULL);
- timer_s timerItem;
+ sh_timer_s timerItem;
//create a new handle for the timer
handle = ++mLastInsertedHandle; //todo: overflow ruling !
@@ -307,14 +306,14 @@ am_Error_e SocketHandler::addTimer(const timespec timeouts, shTimerCallBack*& ca
* @param handle the handle to the timer
* @return E_OK in case of success, E_UNKNOWN if timer was not found.
*/
-am_Error_e SocketHandler::removeTimer(const sh_timerHandle_t handle)
+am_Error_e CAmSocketHandler::removeTimer(const sh_timerHandle_t handle)
{
assert(handle!=0);
//stop the current timer
stopTimer(handle);
- std::list<timer_s>::iterator it = mListTimer.begin();
+ std::list<sh_timer_s>::iterator it = mListTimer.begin();
for (; it != mListTimer.end(); ++it)
{
if (it->handle == handle)
@@ -332,10 +331,10 @@ am_Error_e SocketHandler::removeTimer(const sh_timerHandle_t handle)
* @param timeouts new timout time
* @return E_OK on success, E_NON_EXISTENT if the handle was not found
*/
-am_Error_e SocketHandler::restartTimer(const sh_timerHandle_t handle, const timespec timeouts)
+am_Error_e CAmSocketHandler::restartTimer(const sh_timerHandle_t handle, const timespec timeouts)
{
- timer_s timerItem;
- std::list<timer_s>::iterator it = mListTimer.begin();
+ sh_timer_s timerItem;
+ std::list<sh_timer_s>::iterator it = mListTimer.begin();
for (; it != mListTimer.end(); ++it)
{
if (it->handle == handle)
@@ -358,10 +357,10 @@ am_Error_e SocketHandler::restartTimer(const sh_timerHandle_t handle, const time
return E_OK;
}
-am_Error_e SocketHandler::stopTimer(const sh_timerHandle_t handle)
+am_Error_e CAmSocketHandler::stopTimer(const sh_timerHandle_t handle)
{
//go through the list and remove the timer with the handle
- std::list<timer_s>::iterator it = mListActiveTimer.begin();
+ std::list<sh_timer_s>::iterator it = mListActiveTimer.begin();
for (; it != mListActiveTimer.end(); ++it)
{
if (it->handle == handle)
@@ -388,7 +387,7 @@ am_Error_e SocketHandler::stopTimer(const sh_timerHandle_t handle)
* @param event the event flags
* @return E_OK on succsess, E_NON_EXISTENT if fd was not found
*/
-am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const short events)
+am_Error_e CAmSocketHandler::updateEventFlags(const sh_pollHandle_t handle, const short events)
{
mListPoll_t::iterator iterator = mListPoll.begin();
@@ -409,7 +408,7 @@ am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const s
* @param fd the filedescriptor
* @return true if the fd is valid
*/
-bool SocketHandler::fdIsValid(const int fd) const
+bool CAmSocketHandler::fdIsValid(const int fd) const
{
return (fcntl(fd, F_GETFL) != -1 || errno != EBADF);
}
@@ -418,7 +417,7 @@ bool SocketHandler::fdIsValid(const int fd) const
* whenever a timer is up, this function needs to be called.
* Removes the fired timer, calls the callback and resets mTimeout
*/
-void SocketHandler::timerUp()
+void CAmSocketHandler::timerUp()
{
//first fire the event
mListActiveTimer.front().callback->Call(mListActiveTimer.front().handle, mListActiveTimer.front().userData);
@@ -428,7 +427,7 @@ void SocketHandler::timerUp()
if (!mListActiveTimer.empty())
{
//substract the old value from all timers in the list
- std::for_each(mListActiveTimer.begin(), mListActiveTimer.end(), SubstractTime(mTimeout));
+ std::for_each(mListActiveTimer.begin(), mListActiveTimer.end(), CAmShSubstractTime(mTimeout));
mTimeout = mListActiveTimer.front().countdown;
}
else
@@ -441,7 +440,7 @@ void SocketHandler::timerUp()
/**
* init the timers
*/
-void SocketHandler::initTimer()
+void CAmSocketHandler::initTimer()
{
if (!mListActiveTimer.empty())
{
@@ -459,12 +458,12 @@ void SocketHandler::initTimer()
* @param time time in timespec
* @return time in milliseconds
*/
-inline int SocketHandler::timespec2ms(const timespec & time)
+inline int CAmSocketHandler::timespec2ms(const timespec & time)
{
return (time.tv_nsec == -1 && time.tv_sec == -1) ? -1 : time.tv_sec * 1000 + time.tv_nsec / 1000000;
}
-inline timespec* am::SocketHandler::insertTime(timespec& buffertime)
+inline timespec* CAmSocketHandler::insertTime(timespec& buffertime)
{
buffertime.tv_nsec = mTimeout.tv_nsec;
buffertime.tv_sec = mTimeout.tv_sec;
@@ -475,7 +474,7 @@ inline timespec* am::SocketHandler::insertTime(timespec& buffertime)
* functor to easy substract from each countdown
* @param t value to substract from
*/
-void SocketHandler::SubstractTime::operator ()(timer_s & t) const
+void CAmSocketHandler::CAmShSubstractTime::operator ()(sh_timer_s & t) const
{
int val = 0;
if ((val = t.countdown.tv_nsec - param.tv_nsec) < 0)
@@ -490,10 +489,10 @@ void SocketHandler::SubstractTime::operator ()(timer_s & t) const
(t.countdown.tv_sec - param.tv_sec) < 0 ? 0 : (t.countdown.tv_sec -= param.tv_sec);
}
-void SocketHandler::CopyPollfd::operator ()(const sh_poll_s & row)
+void CAmSocketHandler::CAmShCopyPollfd::operator ()(const sh_poll_s & row)
{
pollfd temp = row.pollfdValue;
temp.revents = 0;
mArray.push_back(temp);
}
-
+}
diff --git a/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp b/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
index 9e052cc..92fb09d 100644
--- a/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
+++ b/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
@@ -23,30 +23,30 @@
*/
#include "CAmTelnetMenuHelper.h"
-#include "TelnetServer.h"
-#include "DatabaseHandler.h"
-#include "ControlSender.h"
-#include "CommandSender.h"
-#include "RoutingSender.h"
-#include "RoutingReceiver.h"
-#include "CommandReceiver.h"
-#include "ControlReceiver.h"
-#include "Router.h"
-#include "config.h"
-#include "DLTWrapper.h"
#include <cassert>
+#include "config.h"
+#include "CAmRouter.h"
+#include "CAmTelnetServer.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmControlSender.h"
+#include "CAmCommandSender.h"
+#include "CAmRoutingSender.h"
+#include "CAmRoutingReceiver.h"
+#include "CAmCommandReceiver.h"
+#include "CAmControlReceiver.h"
+#include "shared/CAmDltWrapper.h"
static const std::string COLOR_WELCOME("\033[1;33m\033[44m");
static const std::string COLOR_HEAD("\033[1m\033[42m");
static const std::string COLOR_DEFAULT("\033[0m");
-using namespace am;
+namespace am {
CAmTelnetMenuHelper* CAmTelnetMenuHelper::instance = NULL;
/****************************************************************************/
-CAmTelnetMenuHelper::CAmTelnetMenuHelper(SocketHandler *iSocketHandler, CommandSender *iCommandSender, CommandReceiver *iCommandReceiver, RoutingSender *iRoutingSender, RoutingReceiver *iRoutingReceiver, ControlSender *iControlSender, ControlReceiver *iControlReceiver, DatabaseHandler *iDatabasehandler, Router *iRouter, TelnetServer *iTelnetServer)
+CAmTelnetMenuHelper::CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer)
/****************************************************************************/
:mpTelenetServer(iTelnetServer), mpSocketHandler(iSocketHandler), mpCommandSender(iCommandSender), mpCommandReceiver(iCommandReceiver), mpRoutingSender(iRoutingSender), mpRoutingReceiver(iRoutingReceiver), mpControlSender(iControlSender), mpControlReceiver(iControlReceiver), mpDatabasehandler(iDatabasehandler), mpRouter(iRouter)
{
@@ -1296,7 +1296,7 @@ void CAmTelnetMenuHelper::listMainConnectionsCommandExec(std::queue<std::string>
sendError(filedescriptor,"ERROR: mDatabasehandler->getListMainSinks");
}
}
-
+}
diff --git a/AudioManagerDaemon/src/TelnetServer.cpp b/AudioManagerDaemon/src/CAmTelnetServer.cpp
index 1cae985..1274a8d 100644
--- a/AudioManagerDaemon/src/TelnetServer.cpp
+++ b/AudioManagerDaemon/src/CAmTelnetServer.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file TelnetServer.cpp
+ * \file CAmTelnetServer.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,7 +22,7 @@
*
*/
-#include "TelnetServer.h"
+#include "CAmTelnetServer.h"
#include <cassert>
#include <sys/socket.h>
#include <arpa/inet.h>
@@ -35,22 +35,22 @@
#include <istream>
#include <iostream>
#include <iterator>
-#include "DatabaseHandler.h"
-#include "RoutingSender.h"
-#include "DLTWrapper.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmRoutingSender.h"
+#include "shared/CAmDltWrapper.h"
#include "CAmTelnetMenuHelper.h"
-using namespace am;
+namespace am {
-TelnetServer* TelnetServer::instance = NULL;
+CAmTelnetServer* CAmTelnetServer::instance = NULL;
#define PRINT_BOOL(var) var ? output+="true\t\t" : output+="false\t\t";
-TelnetServer::TelnetServer(SocketHandler *iSocketHandler, CommandSender *iCommandSender, CommandReceiver *iCommandReceiver, RoutingSender *iRoutingSender, RoutingReceiver *iRoutingReceiver, ControlSender *iControlSender, ControlReceiver *iControlReceiver, DatabaseHandler *iDatabasehandler, Router *iRouter, unsigned int servPort, unsigned int maxConnections)
- :telnetConnectFiredCB(this,&TelnetServer::connectSocket),
- telnetReceiveFiredCB(this,&TelnetServer::receiveData),
- telnetDispatchCB(this,&TelnetServer::dispatchData),
- telnetCheckCB(this,&TelnetServer::check),
+CAmTelnetServer::CAmTelnetServer(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, unsigned int servPort, unsigned int maxConnections)
+ :telnetConnectFiredCB(this,&CAmTelnetServer::connectSocket),
+ telnetReceiveFiredCB(this,&CAmTelnetServer::receiveData),
+ telnetDispatchCB(this,&CAmTelnetServer::dispatchData),
+ telnetCheckCB(this,&CAmTelnetServer::check),
mSocketHandler(iSocketHandler),
mCommandSender(iCommandSender),
mCommandReceiver(iCommandReceiver),
@@ -111,11 +111,11 @@ TelnetServer::TelnetServer(SocketHandler *iSocketHandler, CommandSender *iComman
mSocketHandler->addFDPoll(mConnectFD, events, NULL, &telnetConnectFiredCB, NULL, NULL, NULL, mConnecthandle);
}
-TelnetServer::~TelnetServer()
+CAmTelnetServer::~CAmTelnetServer()
{
}
-void TelnetServer::connectSocket(const pollfd pfd, const sh_pollHandle_t handle, void *userData)
+void CAmTelnetServer::connectSocket(const pollfd pfd, const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
@@ -138,7 +138,7 @@ void TelnetServer::connectSocket(const pollfd pfd, const sh_pollHandle_t handle,
mListConnections.push_back(connection);
}
-void TelnetServer::disconnectClient(int filedescriptor)
+void CAmTelnetServer::disconnectClient(int filedescriptor)
{
std::vector<connection_s>::iterator iter = mListConnections.begin();
while(iter != mListConnections.end())
@@ -161,7 +161,7 @@ void TelnetServer::disconnectClient(int filedescriptor)
}
}
-void TelnetServer::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
+void CAmTelnetServer::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
@@ -177,7 +177,7 @@ void TelnetServer::receiveData(const pollfd pollfd, const sh_pollHandle_t handle
}
}
-bool TelnetServer::dispatchData(const sh_pollHandle_t handle, void *userData)
+bool CAmTelnetServer::dispatchData(const sh_pollHandle_t handle, void *userData)
{
(void) userData;
std::vector<connection_s>::iterator iterator=mListConnections.begin();
@@ -219,7 +219,7 @@ bool TelnetServer::dispatchData(const sh_pollHandle_t handle, void *userData)
*/
}
-bool TelnetServer::check(const sh_pollHandle_t handle, void *userData)
+bool CAmTelnetServer::check(const sh_pollHandle_t handle, void *userData)
{
(void)handle;
(void)userData;
@@ -227,7 +227,7 @@ bool TelnetServer::check(const sh_pollHandle_t handle, void *userData)
return false;
}
-void am::TelnetServer::sliceCommand(const std::string & string, std::string & command, std::queue<std::string> & MsgQueue)
+void am::CAmTelnetServer::sliceCommand(const std::string & string, std::string & command, std::queue<std::string> & MsgQueue)
{
(void) command;
std::stringstream stream(string);
@@ -257,5 +257,6 @@ void am::TelnetServer::sliceCommand(const std::string & string, std::string & co
msg = std::vector<std::string>(begin, end);
*/
}
+}
diff --git a/AudioManagerDaemon/src/DatabaseObserver.cpp b/AudioManagerDaemon/src/DatabaseObserver.cpp
deleted file mode 100644
index 93031ef..0000000
--- a/AudioManagerDaemon/src/DatabaseObserver.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/**
- * Copyright (C) 2011, BMW AG
- *
- * GeniviAudioMananger AudioManagerDaemon
- *
- * \file DatabaseObserver.cpp
- *
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
- *
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statiasyncCally or dynamiasyncCally with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
- *
- */
-
-#include "DatabaseObserver.h"
-#include <string.h>
-#include <cassert>
-#include <errno.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include "CommandSender.h"
-#include "RoutingSender.h"
-#include "TelnetServer.h"
-#include "DLTWrapper.h"
-//#include "CAmSerializer.h"
-
-using namespace am;
-
-DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, SocketHandler *iSocketHandler) :
- mCommandSender(iCommandSender), //
- mRoutingSender(iRoutingSender), //
- mSerializer(iSocketHandler) //
-{
- assert(mCommandSender!=0);
- assert(mRoutingSender!=0);
- assert(iSocketHandler!=0);
-}
-
-DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, SocketHandler *iSocketHandler, TelnetServer *iTelnetServer) :
- mCommandSender(iCommandSender), //
- mRoutingSender(iRoutingSender), //
- mTelnetServer(iTelnetServer), //
- mSerializer(iSocketHandler) //
-{
- assert(mTelnetServer!=0);
- assert(mCommandSender!=0);
- assert(mRoutingSender!=0);
- assert(iSocketHandler!=0);
-}
-
-DatabaseObserver::~DatabaseObserver()
-{
-}
-
-void DatabaseObserver::newMainConnection(const am_MainConnectionType_s& mainConnection)
-{
- mSerializer.asyncCall<CommandSender, const am_MainConnectionType_s>(mCommandSender, &CommandSender::cbNewMainConnection, mainConnection);
-}
-
-void DatabaseObserver::removedMainConnection(const am_mainConnectionID_t mainConnection)
-{
- mSerializer.asyncCall<CommandSender, const am_mainConnectionID_t>(mCommandSender, &CommandSender::cbRemovedMainConnection, mainConnection);
-}
-
-void DatabaseObserver::newSink(const am_Sink_s& sink)
-{
- mRoutingSender->addSinkLookup(sink);
- if (sink.visible)
- {
- am_SinkType_s s;
- s.availability = sink.available;
- s.muteState = sink.muteState;
- s.name = sink.name;
- s.sinkClassID = sink.sinkClassID;
- s.sinkID = sink.sinkID;
- s.volume = sink.mainVolume;
- mSerializer.asyncCall<CommandSender, const am_SinkType_s>(mCommandSender, &CommandSender::cbNewSink, s);
- }
-}
-
-void DatabaseObserver::newSource(const am_Source_s& source)
-{
- mRoutingSender->addSourceLookup(source);
- if (source.visible)
- {
- am_SourceType_s s;
- s.availability = source.available;
- s.name = source.name;
- s.sourceClassID = source.sourceClassID;
- s.sourceID = source.sourceID;
- mSerializer.asyncCall<CommandSender, const am_SourceType_s>(mCommandSender, &CommandSender::cbNewSource, s);
- }
-}
-
-void DatabaseObserver::newDomain(const am_Domain_s& domain)
-{
- mRoutingSender->addDomainLookup(domain);
-}
-
-void DatabaseObserver::newGateway(const am_Gateway_s& gateway)
-{
- (void) gateway;
- //todo: implement something
-}
-
-void DatabaseObserver::newCrossfader(const am_Crossfader_s& crossfader)
-{
- mRoutingSender->addCrossfaderLookup(crossfader);
-}
-
-void DatabaseObserver::removedSink(const am_sinkID_t sinkID, const bool visible)
-{
- mRoutingSender->removeSinkLookup(sinkID);
-
- if (visible)
- mSerializer.asyncCall<CommandSender, const am_sinkID_t>(mCommandSender, &CommandSender::cbRemovedSink, sinkID);
-}
-
-void DatabaseObserver::removedSource(const am_sourceID_t sourceID, const bool visible)
-{
- mRoutingSender->removeSourceLookup(sourceID);
-
- if (visible)
- mSerializer.asyncCall<CommandSender, const am_sourceID_t>(mCommandSender, &CommandSender::cbRemovedSource, sourceID);
-}
-
-void DatabaseObserver::removeDomain(const am_domainID_t domainID)
-{
- mRoutingSender->removeDomainLookup(domainID);
-}
-
-void DatabaseObserver::removeGateway(const am_gatewayID_t gatewayID)
-{
- (void) gatewayID;
- //todo: implement something?
-}
-
-void DatabaseObserver::removeCrossfader(const am_crossfaderID_t crossfaderID)
-{
- mRoutingSender->removeCrossfaderLookup(crossfaderID);
-}
-
-void DatabaseObserver::numberOfSinkClassesChanged()
-{
- mSerializer.asyncCall<CommandSender>(mCommandSender, &CommandSender::cbNumberOfSinkClassesChanged);
-}
-
-void DatabaseObserver::numberOfSourceClassesChanged()
-{
- mSerializer.asyncCall<CommandSender>(mCommandSender, &CommandSender::cbNumberOfSourceClassesChanged);
-}
-
-void DatabaseObserver::mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
-{
- mSerializer.asyncCall<CommandSender, const am_connectionID_t, const am_ConnectionState_e>(mCommandSender, &CommandSender::cbMainConnectionStateChanged, connectionID, connectionState);
-}
-
-void DatabaseObserver::mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s& SoundProperty)
-{
- mSerializer.asyncCall<CommandSender, const am_sinkID_t, const am_MainSoundProperty_s&>(mCommandSender, &CommandSender::cbMainSinkSoundPropertyChanged, sinkID, SoundProperty);
-}
-
-void DatabaseObserver::mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
-{
- mSerializer.asyncCall<CommandSender, const am_sourceID_t, const am_MainSoundProperty_s&>(mCommandSender, &CommandSender::cbMainSourceSoundPropertyChanged, sourceID, SoundProperty);
-}
-
-void DatabaseObserver::sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
-{
- mSerializer.asyncCall<CommandSender, const am_sinkID_t, const am_Availability_s&>(mCommandSender, &CommandSender::cbSinkAvailabilityChanged, sinkID, availability);
-}
-
-void DatabaseObserver::sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
-{
- mSerializer.asyncCall<CommandSender, const am_sourceID_t, const am_Availability_s&>(mCommandSender, &CommandSender::cbSourceAvailabilityChanged, sourceID, availability);
-}
-
-void DatabaseObserver::volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
-{
- mSerializer.asyncCall<CommandSender, const am_sinkID_t, const am_mainVolume_t>(mCommandSender, &CommandSender::cbVolumeChanged, sinkID, volume);
-}
-
-void DatabaseObserver::sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
-{
- mSerializer.asyncCall<CommandSender, const am_sinkID_t, const am_MuteState_e>(mCommandSender, &CommandSender::cbSinkMuteStateChanged, sinkID, muteState);
-}
-
-void DatabaseObserver::systemPropertyChanged(const am_SystemProperty_s& SystemProperty)
-{
- mSerializer.asyncCall<CommandSender, const am_SystemProperty_s&>(mCommandSender, &CommandSender::cbSystemPropertyChanged, SystemProperty);
-}
-
-void DatabaseObserver::timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
-{
- mSerializer.asyncCall<CommandSender, const am_mainConnectionID_t, const am_timeSync_t>(mCommandSender, &CommandSender::cbTimingInformationChanged, mainConnection, time);
-}
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index dee5edb..b6acf5d 100644
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -35,22 +35,22 @@
#include <config.h>
#ifdef WITH_TELNET
-#include "TelnetServer.h"
+#include "CAmTelnetServer.h"
#endif
#ifdef WITH_DBUS_WRAPPER
-#include <dbus/DBusWrapper.h>
+#include <shared/CAmDbusWrapper.h>
#endif
-#include <SocketHandler.h>
-#include "DatabaseHandler.h"
-#include "ControlSender.h"
-#include "CommandSender.h"
-#include "RoutingSender.h"
-#include "RoutingReceiver.h"
-#include "CommandReceiver.h"
-#include "ControlReceiver.h"
-#include "DatabaseObserver.h"
-#include "Router.h"
-#include "DLTWrapper.h"
+#include <shared/CAmSocketHandler.h>
+#include "CAmDatabaseHandler.h"
+#include "CAmControlSender.h"
+#include "CAmCommandSender.h"
+#include "CAmRoutingSender.h"
+#include "CAmRoutingReceiver.h"
+#include "CAmCommandReceiver.h"
+#include "CAmControlReceiver.h"
+#include "CAmDatabaseObserver.h"
+#include "CAmRouter.h"
+#include "shared/CAmDltWrapper.h"
#include <sys/resource.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -219,16 +219,15 @@ static void signalHandler(int sig, siginfo_t *siginfo, void *context)
logError("signal handler was called, exit now...");
gDispatchDone = 1;
//todo: maually fire the mainloop
- //todo: ifdef no sockethandler
exit(1);
}
int main(int argc, char *argv[])
{
- DLTWrapper::instance()->registerApp("AudioManagerDeamon", "AudioManagerDeamon");
- DLTWrapper::instance()->registerContext(AudioManager, "Main", "Main Context");
+ CAmDltWrapper::instance(true)->registerApp("AudioManagerDeamon", "AudioManagerDeamon");
+ CAmDltWrapper::instance()->registerContext(AudioManager, "Main", "Main Context");
logInfo("The Audiomanager is started");
- log(&AudioManager, DLT_LOG_ERROR, "The version of the Audiomanager", DAEMONVERSION);
+ logInfo("The version of the Audiomanager", DAEMONVERSION);
listCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
listRoutingPluginDirs.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
@@ -256,40 +255,36 @@ int main(int argc, char *argv[])
std::set_new_handler(&OutOfMemoryHandler);
//Instantiate all classes. Keep in same order !
- SocketHandler iSocketHandler;
+ CAmSocketHandler iSocketHandler;
#ifdef WITH_DBUS_WRAPPER
- DBusWrapper iDBusWrapper(&iSocketHandler);
+ CAmDbusWrapper iDBusWrapper(&iSocketHandler);
#endif /*WITH_DBUS_WRAPPER */
- DatabaseHandler iDatabaseHandler(databasePath);
- RoutingSender iRoutingSender(listRoutingPluginDirs);
- CommandSender iCommandSender(listCommandPluginDirs);
- ControlSender iControlSender(controllerPlugin);
- Router iRouter(&iDatabaseHandler, &iControlSender);
+ CAmDatabaseHandler iDatabaseHandler(databasePath);
+ CAmRoutingSender iRoutingSender(listRoutingPluginDirs);
+ CAmCommandSender iCommandSender(listCommandPluginDirs);
+ CAmControlSender iControlSender(controllerPlugin);
+ CAmRouter iRouter(&iDatabaseHandler, &iControlSender);
#ifdef WITH_DBUS_WRAPPER
- CommandReceiver iCommandReceiver(&iDatabaseHandler, &iControlSender, &iSocketHandler, &iDBusWrapper);
- RoutingReceiver iRoutingReceiver(&iDatabaseHandler, &iRoutingSender, &iControlSender, &iSocketHandler, &iDBusWrapper);
- ControlReceiver iControlReceiver(&iDatabaseHandler, &iRoutingSender, &iCommandSender, &iSocketHandler, &iRouter);
-#ifdef WITH_TELNET
- TelnetServer iTelnetServer(&iSocketHandler, &iCommandSender, &iCommandReceiver, &iRoutingSender, &iRoutingReceiver, &iControlSender, &iControlReceiver, &iDatabaseHandler, &iRouter, telnetport, maxConnections);
- DatabaseObserver iObserver(&iCommandSender, &iRoutingSender, &iSocketHandler, &iTelnetServer);
-#else /*WITH_TELNET*/
- DatabaseObserver iObserver(&iCommandSender,&iRoutingSender, &iSocketHandler);
-#endif
+ CAmCommandReceiver iCommandReceiver(&iDatabaseHandler, &iControlSender, &iSocketHandler, &iDBusWrapper);
+ CAmRoutingReceiver iRoutingReceiver(&iDatabaseHandler, &iRoutingSender, &iControlSender, &iSocketHandler, &iDBusWrapper);
+ CAmControlReceiver iControlReceiver(&iDatabaseHandler, &iRoutingSender, &iCommandSender, &iSocketHandler, &iRouter);
#else /*WITH_DBUS_WRAPPER*/
- CommandReceiver iCommandReceiver(&iDatabaseHandler,&iControlSender,&iSocketHandler);
- RoutingReceiver iRoutingReceiver(&iDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
+ CAmCommandReceiver iCommandReceiver(&iDatabaseHandler,&iControlSender,&iSocketHandler);
+ CAmRoutingReceiver iRoutingReceiver(&iDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
+#endif /*WITH_DBUS_WRAPPER*/
+
#ifdef WITH_TELNET
- TelnetServer iTelnetServer(&iSocketHandler,telnetport,maxConnections);
- DatabaseObserver iObserver(&iCommandSender, &iRoutingSender, &iSocketHandler, &iTelnetServer);
+ CAmTelnetServer iTelnetServer(&iSocketHandler, &iCommandSender, &iCommandReceiver, &iRoutingSender, &iRoutingReceiver, &iControlSender, &iControlReceiver, &iDatabaseHandler, &iRouter, telnetport, maxConnections);
+ CAmDatabaseObserver iObserver(&iCommandSender, &iRoutingSender, &iSocketHandler, &iTelnetServer);
#else /*WITH_TELNET*/
- DatabaseObserver iObserver(&iCommandSender, &iSocketHandler, &iRoutingSender);
+ CAmDatabaseObserver iObserver(&iCommandSender,&iRoutingSender, &iSocketHandler);
#endif
-#endif /*WITH_DBUS_WRAPPER*/
+
iDatabaseHandler.registerObserver(&iObserver);
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp b/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp
index c262692..6e9ead1 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp
@@ -21,19 +21,19 @@
* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
*
*/
-#include "controlInterfaceTest.h"
+#include "CAmControlInterfaceTest.h"
#include <algorithm>
#include <string>
#include <vector>
#include <set>
-#include "DLTWrapper.h"
+#include "shared/CAmDltWrapper.h"
using namespace am;
using namespace testing;
-controlInterfaceTest::controlInterfaceTest() :
+CAmControlInterfaceTest::CAmControlInterfaceTest() :
pSocketHandler(), //
- pDBusWrapper((DBusWrapper*) 1), //
+ pDBusWrapper((CAmDbusWrapper*) 1), //
plistCommandPluginDirs(), //
plistRoutingPluginDirs(), //
pDatabaseHandler(std::string(":memory:")), //
@@ -56,20 +56,20 @@ controlInterfaceTest::controlInterfaceTest() :
}
-controlInterfaceTest::~controlInterfaceTest()
+CAmControlInterfaceTest::~CAmControlInterfaceTest()
{
}
-void controlInterfaceTest::SetUp()
+void CAmControlInterfaceTest::SetUp()
{
logInfo("RoutingSendInterface Test started");
}
-void controlInterfaceTest::TearDown()
+void CAmControlInterfaceTest::TearDown()
{
}
-TEST_F(controlInterfaceTest,registerDomain)
+TEST_F(CAmControlInterfaceTest,registerDomain)
{
am_Domain_s domain;
@@ -82,7 +82,7 @@ TEST_F(controlInterfaceTest,registerDomain)
ASSERT_EQ(domainID, 2);
}
-TEST_F(controlInterfaceTest,deregisterDomain)
+TEST_F(CAmControlInterfaceTest,deregisterDomain)
{
am_domainID_t domainID = 34;
@@ -91,7 +91,7 @@ TEST_F(controlInterfaceTest,deregisterDomain)
ASSERT_EQ(E_OK, pRoutingReceiver.deregisterDomain(domainID));
}
-TEST_F(controlInterfaceTest,registerSink)
+TEST_F(CAmControlInterfaceTest,registerSink)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -103,7 +103,7 @@ TEST_F(controlInterfaceTest,registerSink)
ASSERT_EQ(sinkID, 2);
}
-TEST_F(controlInterfaceTest,deregisterSink)
+TEST_F(CAmControlInterfaceTest,deregisterSink)
{
am_sinkID_t sinkID = 12;
@@ -112,7 +112,7 @@ TEST_F(controlInterfaceTest,deregisterSink)
ASSERT_EQ(E_OK, pRoutingReceiver.deregisterSink(sinkID));
}
-TEST_F(controlInterfaceTest,registerSource)
+TEST_F(CAmControlInterfaceTest,registerSource)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -124,7 +124,7 @@ TEST_F(controlInterfaceTest,registerSource)
ASSERT_EQ(sourceID, 2);
}
-TEST_F(controlInterfaceTest,deregisterSource)
+TEST_F(CAmControlInterfaceTest,deregisterSource)
{
am_sourceID_t sourceID = 12;
@@ -133,7 +133,7 @@ TEST_F(controlInterfaceTest,deregisterSource)
ASSERT_EQ(E_OK, pRoutingReceiver.deregisterSource(sourceID));
}
-TEST_F(controlInterfaceTest,registerGateway)
+TEST_F(CAmControlInterfaceTest,registerGateway)
{
am_Gateway_s gateway;
am_gatewayID_t gatewayID;
@@ -145,7 +145,7 @@ TEST_F(controlInterfaceTest,registerGateway)
ASSERT_EQ(gatewayID, 2);
}
-TEST_F(controlInterfaceTest,deregisterGateway)
+TEST_F(CAmControlInterfaceTest,deregisterGateway)
{
am_gatewayID_t gatewayID = 12;
@@ -154,7 +154,7 @@ TEST_F(controlInterfaceTest,deregisterGateway)
ASSERT_EQ(E_OK, pRoutingReceiver.deregisterGateway(gatewayID));
}
-TEST_F(controlInterfaceTest,ackConnect)
+TEST_F(CAmControlInterfaceTest,ackConnect)
{
am_connectionID_t connectionID;
am_Sink_s sink;
@@ -209,7 +209,7 @@ TEST_F(controlInterfaceTest,ackConnect)
ASSERT_EQ(E_ALREADY_EXISTS, pControlReceiver.connect(handle,connectionID,CF_GENIVI_STEREO,2,2));
}
-TEST_F(controlInterfaceTest,ackDisconnect)
+TEST_F(CAmControlInterfaceTest,ackDisconnect)
{
am_connectionID_t connectionID;
am_Sink_s sink;
@@ -262,7 +262,7 @@ TEST_F(controlInterfaceTest,ackDisconnect)
ASSERT_EQ(E_NON_EXISTENT, pControlReceiver.disconnect(handle,2));
}
-TEST_F(controlInterfaceTest,setSourceState)
+TEST_F(CAmControlInterfaceTest,setSourceState)
{
am_Source_s source;
@@ -312,7 +312,7 @@ TEST_F(controlInterfaceTest,setSourceState)
ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
}
-TEST_F(controlInterfaceTest,SetSinkVolumeChange)
+TEST_F(CAmControlInterfaceTest,SetSinkVolumeChange)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -362,7 +362,7 @@ TEST_F(controlInterfaceTest,SetSinkVolumeChange)
ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_GENIVI_DIRECT,23));
}
-TEST_F(controlInterfaceTest,ackSetSourceVolumeChange)
+TEST_F(CAmControlInterfaceTest,ackSetSourceVolumeChange)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -412,7 +412,7 @@ TEST_F(controlInterfaceTest,ackSetSourceVolumeChange)
ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_GENIVI_DIRECT,23));
}
-TEST_F(controlInterfaceTest,ackSetSinkSoundProperty)
+TEST_F(CAmControlInterfaceTest,ackSetSinkSoundProperty)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -464,7 +464,7 @@ TEST_F(controlInterfaceTest,ackSetSinkSoundProperty)
ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkSoundProperty(handle,sink.sinkID,soundProperty));
}
-TEST_F(controlInterfaceTest,ackSetSourceSoundProperty)
+TEST_F(CAmControlInterfaceTest,ackSetSourceSoundProperty)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -516,7 +516,7 @@ TEST_F(controlInterfaceTest,ackSetSourceSoundProperty)
ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceSoundProperty(handle,source.sourceID,soundProperty));
}
-TEST_F(controlInterfaceTest,crossFading)
+TEST_F(CAmControlInterfaceTest,crossFading)
{
//todo: implement crossfading test
}
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h b/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.h
index 72e2f63..a39e9ed 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
+++ b/AudioManagerDaemon/test/AmControlInterfaceTest/CAmControlInterfaceTest.h
@@ -28,47 +28,48 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include <dbus/DBusWrapper.h>
-#include "MockInterfaces.h"
-#include "DatabaseHandler.h"
-#include "ControlReceiver.h"
-#include "RoutingReceiver.h"
-#include "DatabaseObserver.h"
-#include "ControlSender.h"
-#include "RoutingSender.h"
-#include "SocketHandler.h"
-#include "Router.h"
-#include "../RoutingInterfaceBackdoor.h"
-#include "../CommandInterfaceBackdoor.h"
-#include "../ControlInterfaceBackdoor.h"
-#include "../CommonFunctions.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmControlReceiver.h"
+#include "CAmRoutingReceiver.h"
+#include "CAmDatabaseObserver.h"
+#include "CAmControlSender.h"
+#include "CAmRoutingSender.h"
+#include "CAmRouter.h"
+#include "../IAmRoutingBackdoor.h"
+#include "../IAmCommandBackdoor.h"
+#include "../IAmControlBackdoor.h"
+#include "../CAmCommonFunctions.h"
+#include "../MockIAmRoutingSend.h"
+#include "../MockIAmControlSend.h"
+#include "shared/CAmSocketHandler.h"
+#include "shared/CAmDbusWrapper.h"
namespace am
{
-class controlInterfaceTest: public ::testing::Test
+class CAmControlInterfaceTest: public ::testing::Test
{
public:
- controlInterfaceTest();
- ~controlInterfaceTest();
- SocketHandler pSocketHandler;
- DBusWrapper* pDBusWrapper;
+ CAmControlInterfaceTest();
+ ~CAmControlInterfaceTest();
+ CAmSocketHandler pSocketHandler;
+ CAmDbusWrapper* pDBusWrapper;
std::vector<std::string> plistCommandPluginDirs;
std::vector<std::string> plistRoutingPluginDirs;
- DatabaseHandler pDatabaseHandler;
- RoutingSender pRoutingSender;
- CommandSender pCommandSender;
- MockControlSendInterface pMockControlInterface;
- MockRoutingSendInterface pMockRoutingInterface;
- RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
- CommandInterfaceBackdoor pCommandInterfaceBackdoor;
- ControlInterfaceBackdoor pControlInterfaceBackdoor;
- ControlSender pControlSender;
- Router pRouter;
- DatabaseObserver pDatabaseObserver;
- ControlReceiver pControlReceiver;
- RoutingReceiver pRoutingReceiver;
- CommonFunctions pCF;
+ CAmDatabaseHandler pDatabaseHandler;
+ CAmRoutingSender pRoutingSender;
+ CAmCommandSender pCommandSender;
+ MockIAmControlSend pMockControlInterface;
+ MockIAmRoutingSend pMockRoutingInterface;
+ IAmRoutingBackdoor pRoutingInterfaceBackdoor;
+ IAmCommandBackdoor pCommandInterfaceBackdoor;
+ IAmControlBackdoor pControlInterfaceBackdoor;
+ CAmControlSender pControlSender;
+ CAmRouter pRouter;
+ CAmDatabaseObserver pDatabaseObserver;
+ CAmControlReceiver pControlReceiver;
+ CAmRoutingReceiver pRoutingReceiver;
+ CAmCommonFunctions pCF;
void SetUp();
void TearDown();
};
diff --git a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt b/AudioManagerDaemon/test/AmControlInterfaceTest/CMakeLists.txt
index bdf8ac5..54f7c35 100644
--- a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/AmControlInterfaceTest/CMakeLists.txt
@@ -1,7 +1,7 @@
#
# Copyright (C) 2011, BMW AG
#
-# GeniviAudioMananger ControlInterfaceTest
+# GeniviAudioMananger AmControlInterfaceTest
#
# \file CMakeLists.txt
#
@@ -23,7 +23,7 @@
cmake_minimum_required(VERSION 2.6)
-PROJECT(controlInterfacetest)
+PROJECT(AmControlInterfaceTest)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
@@ -33,36 +33,36 @@ pkg_check_modules(DLT REQUIRED automotive-dlt)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDES_FOLDER}
+ ${DBUS_include_FOLDER}
${CMAKE_SOURCE_DIR}
${STD_INCLUDE_DIRS}
${DLT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIR}
${GTEST_INCLUDE_DIR}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
)
file(GLOB CONTROL_INTERFACE_SRCS_CXX
- "../../src/DatabaseHandler.cpp"
- "../../src/DatabaseObserver.cpp"
- "../../src/RoutingSender.cpp"
- "../../src/RoutingReceiver.cpp"
- "../../src/CommandSender.cpp"
- "../../src/ControlReceiver.cpp"
- "../../src/ControlSender.cpp"
- "../../src/Router.cpp"
- "../../src/DLTWrapper.cpp"
- "../../src/SocketHandler.cpp"
- "../../src/CommandReceiver.cpp"
- "../CommonFunctions.cpp"
+ "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseObserver.cpp"
+ "../../src/CAmRoutingSender.cpp"
+ "../../src/CAmRoutingReceiver.cpp"
+ "../../src/CAmCommandSender.cpp"
+ "../../src/CAmControlReceiver.cpp"
+ "../../src/CAmControlSender.cpp"
+ "../../src/CAmRouter.cpp"
+ "../../src/CAmDltWrapper.cpp"
+ "../../src/CAmSocketHandler.cpp"
+ "../../src/CAmCommandReceiver.cpp"
+ "../CAmCommonFunctions.cpp"
"*.cpp"
)
-ADD_EXECUTABLE(controlInterfaceTest ${CONTROL_INTERFACE_SRCS_CXX})
+ADD_EXECUTABLE(AmControlInterfaceTest ${CONTROL_INTERFACE_SRCS_CXX})
-TARGET_LINK_LIBRARIES(controlInterfaceTest
+TARGET_LINK_LIBRARIES(AmControlInterfaceTest
${SQLITE_LIBRARIES}
${DLT_LIBRARIES}
${DBUS_LIBRARY}
@@ -71,7 +71,7 @@ TARGET_LINK_LIBRARIES(controlInterfaceTest
gmock
)
-INSTALL(TARGETS controlInterfaceTest
+INSTALL(TARGETS AmControlInterfaceTest
DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp
index a43e436..a5948ed 100644
--- a/AudioManagerDaemon/test/database/databaseTest.cpp
+++ b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp
@@ -23,12 +23,12 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "databaseTest.h"
+#include "CAmDatabaseHandlerTest.h"
#include <algorithm>
#include <string>
#include <vector>
#include <set>
-#include "DLTWrapper.h"
+#include "shared/CAmDltWrapper.h"
using namespace am;
using namespace testing;
@@ -40,7 +40,7 @@ extern bool equalMainSoundProperty(const am_MainSoundProperty_s a, const am_Main
extern bool equalClassProperties(const am_ClassProperty_s a, const am_ClassProperty_s b);
extern std::string int2string(int i);
-databasetest::databasetest() :
+CAmDatabaseHandlerTest::CAmDatabaseHandlerTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
pSocketHandler(),//
@@ -59,11 +59,11 @@ databasetest::databasetest() :
pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
}
-databasetest::~databasetest()
+CAmDatabaseHandlerTest::~CAmDatabaseHandlerTest()
{
}
-void databasetest::createMainConnectionSetup()
+void CAmDatabaseHandlerTest::createMainConnectionSetup()
{
//fill the connection database
am_Connection_s connection;
@@ -135,15 +135,15 @@ void databasetest::createMainConnectionSetup()
ASSERT_EQ(true, equal);
}
-void databasetest::SetUp()
+void CAmDatabaseHandlerTest::SetUp()
{
}
-void databasetest::TearDown()
+void CAmDatabaseHandlerTest::TearDown()
{
}
-TEST_F(databasetest,getMainConnectionInfo)
+TEST_F(CAmDatabaseHandlerTest,getMainConnectionInfo)
{
//fill the connection database
am_Connection_s connection;
@@ -219,7 +219,7 @@ TEST_F(databasetest,getMainConnectionInfo)
}
-TEST_F(databasetest,getSinKInfo)
+TEST_F(CAmDatabaseHandlerTest,getSinKInfo)
{
//fill the connection database
am_Sink_s staticSink, firstDynamicSink, secondDynamicSink;
@@ -280,7 +280,7 @@ TEST_F(databasetest,getSinKInfo)
}
-TEST_F(databasetest,getSourceInfo)
+TEST_F(CAmDatabaseHandlerTest,getSourceInfo)
{
//fill the connection database
am_Source_s staticSource, firstDynamicSource, secondDynamicSource;
@@ -346,7 +346,7 @@ TEST_F(databasetest,getSourceInfo)
}
-TEST_F(databasetest, peekSourceID)
+TEST_F(CAmDatabaseHandlerTest, peekSourceID)
{
std::string sourceName("myClassID");
@@ -370,7 +370,7 @@ TEST_F(databasetest, peekSourceID)
ASSERT_EQ(sourceClassID, peekID);
}
-TEST_F(databasetest, peekSinkID)
+TEST_F(CAmDatabaseHandlerTest, peekSinkID)
{
std::string sinkName("myClassID");
@@ -394,7 +394,7 @@ TEST_F(databasetest, peekSinkID)
ASSERT_EQ(sinkClassID, peekID);
}
-TEST_F(databasetest,crossfaders)
+TEST_F(CAmDatabaseHandlerTest,crossfaders)
{
@@ -434,7 +434,7 @@ TEST_F(databasetest,crossfaders)
ASSERT_EQ(crossfader.name.compare(listCrossfaders[0].name), 0);
}
-TEST_F(databasetest,crossfadersGetFromDomain)
+TEST_F(CAmDatabaseHandlerTest,crossfadersGetFromDomain)
{
@@ -477,7 +477,7 @@ TEST_F(databasetest,crossfadersGetFromDomain)
}
-TEST_F(databasetest,sourceState)
+TEST_F(CAmDatabaseHandlerTest,sourceState)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -497,7 +497,7 @@ TEST_F(databasetest,sourceState)
ASSERT_EQ(listSources[0].sourceState, SS_ON);
}
-TEST_F(databasetest,sinkVolumeChange)
+TEST_F(CAmDatabaseHandlerTest,sinkVolumeChange)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -515,7 +515,7 @@ TEST_F(databasetest,sinkVolumeChange)
ASSERT_EQ(listSinks[0].volume, 34);
}
-TEST_F(databasetest,sourceVolumeChange)
+TEST_F(CAmDatabaseHandlerTest,sourceVolumeChange)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -533,7 +533,7 @@ TEST_F(databasetest,sourceVolumeChange)
ASSERT_EQ(listSources[0].volume, 34);
}
-TEST_F(databasetest, peekSource)
+TEST_F(CAmDatabaseHandlerTest, peekSource)
{
std::vector<am_Source_s> listSources;
am_sourceID_t sourceID, source2ID, source3ID;
@@ -564,7 +564,7 @@ TEST_F(databasetest, peekSource)
ASSERT_EQ(source3ID, source2ID);
}
-TEST_F(databasetest, peekSourceDouble)
+TEST_F(CAmDatabaseHandlerTest, peekSourceDouble)
{
std::vector<am_Source_s> listSources;
am_sourceID_t sourceID;
@@ -595,7 +595,7 @@ TEST_F(databasetest, peekSourceDouble)
ASSERT_TRUE(listSources[0].sourceID==sourceID);
}
-TEST_F(databasetest, peekSink)
+TEST_F(CAmDatabaseHandlerTest, peekSink)
{
std::vector<am_Sink_s> listSinks;
am_sinkID_t sinkID, sink2ID, sink3ID;
@@ -626,7 +626,7 @@ TEST_F(databasetest, peekSink)
ASSERT_EQ(sink3ID, sink2ID);
}
-TEST_F(databasetest, peekSinkDouble)
+TEST_F(CAmDatabaseHandlerTest, peekSinkDouble)
{
std::vector<am_Sink_s> listSinks;
am_sinkID_t sinkID;
@@ -657,7 +657,7 @@ TEST_F(databasetest, peekSinkDouble)
ASSERT_TRUE(listSinks[0].sinkID==sinkID);
}
-TEST_F(databasetest,changeConnectionTimingInformationCheckMainConnection)
+TEST_F(CAmDatabaseHandlerTest,changeConnectionTimingInformationCheckMainConnection)
{
std::vector<am_Connection_s> connectionList;
std::vector<am_MainConnectionType_s> mainList;
@@ -682,7 +682,7 @@ TEST_F(databasetest,changeConnectionTimingInformationCheckMainConnection)
ASSERT_EQ(mainList[0].delay, 216);
}
-TEST_F(databasetest,changeConnectionTimingInformation)
+TEST_F(CAmDatabaseHandlerTest,changeConnectionTimingInformation)
{
am_Connection_s connection;
am_connectionID_t connectionID;
@@ -699,7 +699,7 @@ TEST_F(databasetest,changeConnectionTimingInformation)
ASSERT_TRUE(connectionList[0].delay==24);
}
-TEST_F(databasetest,getSinkClassOfSink)
+TEST_F(CAmDatabaseHandlerTest,getSinkClassOfSink)
{
std::vector<am_SinkClass_s> sinkClassList;
std::vector<am_ClassProperty_s> classPropertyList;
@@ -737,7 +737,7 @@ TEST_F(databasetest,getSinkClassOfSink)
ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),returnClass.listClassProperties.begin(),equalClassProperties));
}
-TEST_F(databasetest,getSourceClassOfSource)
+TEST_F(CAmDatabaseHandlerTest,getSourceClassOfSource)
{
std::vector<am_SourceClass_s> sourceClassList;
std::vector<am_ClassProperty_s> classPropertyList;
@@ -771,7 +771,7 @@ TEST_F(databasetest,getSourceClassOfSource)
ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),sinkSourceClass.listClassProperties.begin(),equalClassProperties));
}
-TEST_F(databasetest,removeSourceClass)
+TEST_F(CAmDatabaseHandlerTest,removeSourceClass)
{
std::vector<am_SourceClass_s> sourceClassList;
std::vector<am_ClassProperty_s> classPropertyList;
@@ -799,7 +799,7 @@ TEST_F(databasetest,removeSourceClass)
ASSERT_TRUE(sourceClassList.empty());
}
-TEST_F(databasetest,updateSourceClass)
+TEST_F(CAmDatabaseHandlerTest,updateSourceClass)
{
std::vector<am_SourceClass_s> sourceClassList;
std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
@@ -832,7 +832,7 @@ TEST_F(databasetest,updateSourceClass)
ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
}
-TEST_F(databasetest,enterSourceClass)
+TEST_F(CAmDatabaseHandlerTest,enterSourceClass)
{
std::vector<am_SourceClass_s> sourceClassList;
std::vector<am_ClassProperty_s> classPropertyList;
@@ -857,7 +857,7 @@ TEST_F(databasetest,enterSourceClass)
ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
}
-TEST_F(databasetest,enterSourceClassStatic)
+TEST_F(CAmDatabaseHandlerTest,enterSourceClassStatic)
{
std::vector<am_SourceClass_s> sourceClassList;
std::vector<am_ClassProperty_s> classPropertyList;
@@ -882,7 +882,7 @@ TEST_F(databasetest,enterSourceClassStatic)
ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
}
-TEST_F(databasetest,removeSinkClass)
+TEST_F(CAmDatabaseHandlerTest,removeSinkClass)
{
std::vector<am_SinkClass_s> sinkClassList;
std::vector<am_ClassProperty_s> classPropertyList;
@@ -910,7 +910,7 @@ TEST_F(databasetest,removeSinkClass)
ASSERT_TRUE(sinkClassList.empty());
}
-TEST_F(databasetest,updateSinkClass)
+TEST_F(CAmDatabaseHandlerTest,updateSinkClass)
{
std::vector<am_SinkClass_s> sinkClassList;
std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
@@ -943,7 +943,7 @@ TEST_F(databasetest,updateSinkClass)
ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
}
-TEST_F(databasetest,enterSinkClass)
+TEST_F(CAmDatabaseHandlerTest,enterSinkClass)
{
std::vector<am_SinkClass_s> sinkClassList;
std::vector<am_ClassProperty_s> classPropertyList;
@@ -968,7 +968,7 @@ TEST_F(databasetest,enterSinkClass)
ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
}
-TEST_F(databasetest,enterSinkClassStatic)
+TEST_F(CAmDatabaseHandlerTest,enterSinkClassStatic)
{
std::vector<am_SinkClass_s> sinkClassList;
std::vector<am_ClassProperty_s> classPropertyList;
@@ -993,7 +993,7 @@ TEST_F(databasetest,enterSinkClassStatic)
ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
}
-TEST_F(databasetest, changeSystemProperty)
+TEST_F(CAmDatabaseHandlerTest, changeSystemProperty)
{
std::vector<am_SystemProperty_s> listSystemProperties, listReturn;
am_SystemProperty_s systemProperty;
@@ -1009,7 +1009,7 @@ TEST_F(databasetest, changeSystemProperty)
ASSERT_EQ(listReturn[0].value, systemProperty.value);
}
-TEST_F(databasetest, systemProperties)
+TEST_F(CAmDatabaseHandlerTest, systemProperties)
{
std::vector<am_SystemProperty_s> listSystemProperties, listReturn;
am_SystemProperty_s systemProperty;
@@ -1024,7 +1024,7 @@ TEST_F(databasetest, systemProperties)
ASSERT_EQ(listReturn[0].value, systemProperty.value);
}
-TEST_F(databasetest,enterSourcesCorrect)
+TEST_F(CAmDatabaseHandlerTest,enterSourcesCorrect)
{
//fill the connection database
am_Source_s staticSource, firstDynamicSource, secondDynamicSource;
@@ -1084,7 +1084,7 @@ TEST_F(databasetest,enterSourcesCorrect)
ASSERT_EQ(true, equal);
}
-TEST_F(databasetest, changeSourceMainSoundProperty)
+TEST_F(CAmDatabaseHandlerTest, changeSourceMainSoundProperty)
{
std::vector<am_Source_s> listSources;
am_Source_s source;
@@ -1108,7 +1108,7 @@ TEST_F(databasetest, changeSourceMainSoundProperty)
}
}
-TEST_F(databasetest, changeSinkMuteState)
+TEST_F(CAmDatabaseHandlerTest, changeSinkMuteState)
{
std::vector<am_Sink_s> listSinks;
am_Sink_s sink;
@@ -1123,7 +1123,7 @@ TEST_F(databasetest, changeSinkMuteState)
ASSERT_EQ(muteState, listSinks[0].muteState);
}
-TEST_F(databasetest, changeSinkMainSoundProperty)
+TEST_F(CAmDatabaseHandlerTest, changeSinkMainSoundProperty)
{
std::vector<am_Sink_s> listSinks;
am_Sink_s sink;
@@ -1148,7 +1148,7 @@ TEST_F(databasetest, changeSinkMainSoundProperty)
}
}
-TEST_F(databasetest, peekDomain)
+TEST_F(CAmDatabaseHandlerTest, peekDomain)
{
std::vector<am_Domain_s> listDomains;
am_Domain_s domain;
@@ -1166,7 +1166,7 @@ TEST_F(databasetest, peekDomain)
ASSERT_TRUE(listDomains[0].domainID==domainID);
}
-TEST_F(databasetest, peekDomainFirstEntered)
+TEST_F(CAmDatabaseHandlerTest, peekDomainFirstEntered)
{
std::vector<am_Domain_s> listDomains;
am_Domain_s domain;
@@ -1181,7 +1181,7 @@ TEST_F(databasetest, peekDomainFirstEntered)
ASSERT_TRUE(listDomains.size()==1);
}
-TEST_F(databasetest, changeDomainState)
+TEST_F(CAmDatabaseHandlerTest, changeDomainState)
{
std::vector<am_Domain_s> listDomains;
am_Domain_s domain;
@@ -1194,7 +1194,7 @@ TEST_F(databasetest, changeDomainState)
ASSERT_EQ(newState, listDomains[0].state);
}
-TEST_F(databasetest, changeMainConnectionState)
+TEST_F(CAmDatabaseHandlerTest, changeMainConnectionState)
{
std::vector<am_MainConnection_s> listMainConnections;
createMainConnectionSetup();
@@ -1204,7 +1204,7 @@ TEST_F(databasetest, changeMainConnectionState)
ASSERT_EQ(CS_DISCONNECTING, listMainConnections[0].connectionState);
}
-TEST_F(databasetest, changeSinkAvailability)
+TEST_F(CAmDatabaseHandlerTest, changeSinkAvailability)
{
std::vector<am_Sink_s> listSinks;
am_Sink_s sink;
@@ -1222,7 +1222,7 @@ TEST_F(databasetest, changeSinkAvailability)
ASSERT_EQ(availability.availabilityReason, listSinks[0].available.availabilityReason);
}
-TEST_F(databasetest, changeSourceAvailability)
+TEST_F(CAmDatabaseHandlerTest, changeSourceAvailability)
{
std::vector<am_Source_s> listSources;
am_Source_s source;
@@ -1241,7 +1241,7 @@ TEST_F(databasetest, changeSourceAvailability)
ASSERT_EQ(availability.availabilityReason, listSources[0].available.availabilityReason);
}
-TEST_F(databasetest,changeMainConnectionRoute)
+TEST_F(CAmDatabaseHandlerTest,changeMainConnectionRoute)
{
std::vector<am_MainConnection_s> originalList;
std::vector<am_MainConnection_s> newList;
@@ -1288,7 +1288,7 @@ TEST_F(databasetest,changeMainConnectionRoute)
ASSERT_FALSE(std::equal(newList[0].listConnectionID.begin(),newList[0].listConnectionID.end(),originalList[0].listConnectionID.begin()));
}
-TEST_F(databasetest,changeMainSinkVolume)
+TEST_F(CAmDatabaseHandlerTest,changeMainSinkVolume)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -1304,7 +1304,7 @@ TEST_F(databasetest,changeMainSinkVolume)
ASSERT_EQ(listSinks[0].mainVolume, newVol);
}
-TEST_F(databasetest,getMainSourceSoundProperties)
+TEST_F(CAmDatabaseHandlerTest,getMainSourceSoundProperties)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -1318,7 +1318,7 @@ TEST_F(databasetest,getMainSourceSoundProperties)
ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
}
-TEST_F(databasetest,getMainSinkSoundProperties)
+TEST_F(CAmDatabaseHandlerTest,getMainSinkSoundProperties)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -1332,7 +1332,7 @@ TEST_F(databasetest,getMainSinkSoundProperties)
ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
}
-TEST_F(databasetest,getMainSources)
+TEST_F(CAmDatabaseHandlerTest,getMainSources)
{
am_Source_s source, source1, source2;
am_sourceID_t sourceID;
@@ -1364,7 +1364,7 @@ TEST_F(databasetest,getMainSources)
ASSERT_TRUE(equal);
}
-TEST_F(databasetest,getMainSinks)
+TEST_F(CAmDatabaseHandlerTest,getMainSinks)
{
am_Sink_s sink, sink1, sink2;
am_sinkID_t sinkID;
@@ -1395,7 +1395,7 @@ TEST_F(databasetest,getMainSinks)
ASSERT_TRUE(equal);
}
-TEST_F(databasetest,getVisibleMainConnections)
+TEST_F(CAmDatabaseHandlerTest,getVisibleMainConnections)
{
createMainConnectionSetup();
std::vector<am_MainConnectionType_s> listVisibleMainConnections;
@@ -1409,7 +1409,7 @@ TEST_F(databasetest,getVisibleMainConnections)
ASSERT_EQ(listMainConnections[0].sourceID, listVisibleMainConnections[0].sourceID);
}
-TEST_F(databasetest,getListSourcesOfDomain)
+TEST_F(CAmDatabaseHandlerTest,getListSourcesOfDomain)
{
am_Source_s source, source2;
am_Domain_s domain;
@@ -1440,7 +1440,7 @@ TEST_F(databasetest,getListSourcesOfDomain)
ASSERT_TRUE(std::equal(sourceList.begin(),sourceList.end(),sourceCheckList.begin()) && !sourceList.empty());
}
-TEST_F(databasetest,getListSinksOfDomain)
+TEST_F(CAmDatabaseHandlerTest,getListSinksOfDomain)
{
am_Sink_s sink, sink2;
am_Domain_s domain;
@@ -1469,7 +1469,7 @@ TEST_F(databasetest,getListSinksOfDomain)
ASSERT_TRUE(std::equal(sinkList.begin(),sinkList.end(),sinkCheckList.begin()) && !sinkList.empty());
}
-TEST_F(databasetest,getListGatewaysOfDomain)
+TEST_F(CAmDatabaseHandlerTest,getListGatewaysOfDomain)
{
@@ -1518,7 +1518,7 @@ TEST_F(databasetest,getListGatewaysOfDomain)
ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()) && !gatewayList.empty());
}
-TEST_F(databasetest,removeDomain)
+TEST_F(CAmDatabaseHandlerTest,removeDomain)
{
am_Domain_s domain;
am_domainID_t domainID;
@@ -1533,7 +1533,7 @@ TEST_F(databasetest,removeDomain)
ASSERT_TRUE(listDomains.empty());
}
-TEST_F(databasetest,removeGateway)
+TEST_F(CAmDatabaseHandlerTest,removeGateway)
{
@@ -1560,7 +1560,7 @@ TEST_F(databasetest,removeGateway)
ASSERT_TRUE(listGateways.empty());
}
-TEST_F(databasetest,removeSink)
+TEST_F(CAmDatabaseHandlerTest,removeSink)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -1576,7 +1576,7 @@ TEST_F(databasetest,removeSink)
ASSERT_TRUE(listSinks.empty());
}
-TEST_F(databasetest,removeSource)
+TEST_F(CAmDatabaseHandlerTest,removeSource)
{
//fill the connection database
am_Source_s source;
@@ -1594,7 +1594,7 @@ TEST_F(databasetest,removeSource)
ASSERT_TRUE(listSources.empty());
}
-TEST_F(databasetest, removeMainConnection)
+TEST_F(CAmDatabaseHandlerTest, removeMainConnection)
{
createMainConnectionSetup();
@@ -1603,31 +1603,31 @@ TEST_F(databasetest, removeMainConnection)
<< "ERROR: database error";
}
-TEST_F(databasetest,removeNonexistentMainConnectionFail)
+TEST_F(CAmDatabaseHandlerTest,removeNonexistentMainConnectionFail)
{
ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeMainConnectionDB(34))
<< "ERROR: database error";
}
-TEST_F(databasetest,removeNonexistentSource)
+TEST_F(CAmDatabaseHandlerTest,removeNonexistentSource)
{
ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSourceDB(3))
<< "ERROR: database error";
}
-TEST_F(databasetest,removeNonexistentSink)
+TEST_F(CAmDatabaseHandlerTest,removeNonexistentSink)
{
ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSinkDB(2))
<< "ERROR: database error";
}
-TEST_F(databasetest,removeNonexistentGateway)
+TEST_F(CAmDatabaseHandlerTest,removeNonexistentGateway)
{
ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeGatewayDB(12))
<< "ERROR: database error";
}
-TEST_F(databasetest,registerGatewayCorrect)
+TEST_F(CAmDatabaseHandlerTest,registerGatewayCorrect)
{
@@ -1691,7 +1691,7 @@ TEST_F(databasetest,registerGatewayCorrect)
ASSERT_EQ(true, equal);
}
-TEST_F(databasetest,getGatewayInfo)
+TEST_F(CAmDatabaseHandlerTest,getGatewayInfo)
{
@@ -1760,7 +1760,7 @@ TEST_F(databasetest,getGatewayInfo)
}
-TEST_F(databasetest,enterSinkThatAlreadyExistFail)
+TEST_F(CAmDatabaseHandlerTest,enterSinkThatAlreadyExistFail)
{
//fill the connection database
am_Sink_s staticSink, SecondSink;
@@ -1784,7 +1784,7 @@ TEST_F(databasetest,enterSinkThatAlreadyExistFail)
<< "ERROR: database error";
}
-TEST_F(databasetest,enterSourcesThatAlreadyExistFail)
+TEST_F(CAmDatabaseHandlerTest,enterSourcesThatAlreadyExistFail)
{
//fill the connection database
am_Source_s staticSource, SecondSource;
@@ -1805,7 +1805,7 @@ TEST_F(databasetest,enterSourcesThatAlreadyExistFail)
<< "ERROR: database error";
}
-TEST_F(databasetest,registerDomainCorrect)
+TEST_F(CAmDatabaseHandlerTest,registerDomainCorrect)
{
//initialize domain
std::vector<am_Domain_s> returnList;
@@ -1832,7 +1832,7 @@ TEST_F(databasetest,registerDomainCorrect)
ASSERT_EQ(true, equal);
}
-TEST_F(databasetest,registerConnectionCorrect)
+TEST_F(CAmDatabaseHandlerTest,registerConnectionCorrect)
{
am_Connection_s connection;
am_connectionID_t connectionID;
@@ -1859,12 +1859,12 @@ TEST_F(databasetest,registerConnectionCorrect)
ASSERT_EQ(true, equal);
}
-TEST_F(databasetest,enterMainConnectionCorrect)
+TEST_F(CAmDatabaseHandlerTest,enterMainConnectionCorrect)
{
createMainConnectionSetup();
}
-TEST_F(databasetest,enterSinksCorrect)
+TEST_F(CAmDatabaseHandlerTest,enterSinksCorrect)
{
//fill the connection database
am_Sink_s staticSink, firstDynamicSink, secondDynamicSink;
@@ -1933,7 +1933,7 @@ TEST_F(databasetest,enterSinksCorrect)
int main(int argc, char **argv)
{
- DLTWrapper::instance()->registerApp("databse", "databasetest");
+ CAmDltWrapper::instance()->registerApp("databse", "databasetest");
logInfo("Database Test started ");
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/AudioManagerDaemon/test/database/databaseTest.h b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.h
index 4dba9c6..a66af97 100644
--- a/AudioManagerDaemon/test/database/databaseTest.h
+++ b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.h
@@ -31,41 +31,42 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "MockInterfaces.h"
-#include "DatabaseHandler.h"
-#include "ControlReceiver.h"
-#include "ControlSender.h"
-#include "DatabaseObserver.h"
-#include "RoutingSender.h"
-#include "Router.h"
-#include "ControlSender.h"
-#include "SocketHandler.h"
-#include "../ControlInterfaceBackdoor.h"
-#include "../CommandInterfaceBackdoor.h"
-#include "../CommonFunctions.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmControlReceiver.h"
+#include "CAmControlSender.h"
+#include "CAmDatabaseObserver.h"
+#include "CAmRoutingSender.h"
+#include "CAmRouter.h"
+#include "CAmControlSender.h"
+#include "../IAmControlBackdoor.h"
+#include "../IAmCommandBackdoor.h"
+#include "../CAmCommonFunctions.h"
+#include "../MockIAmControlSend.h"
+#include "../MockIAmCommandSend.h"
+#include "shared/CAmSocketHandler.h"
namespace am
{
-class databasetest: public ::testing::Test
+class CAmDatabaseHandlerTest: public ::testing::Test
{
public:
- databasetest();
- ~databasetest();
+ CAmDatabaseHandlerTest();
+ ~CAmDatabaseHandlerTest();
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
- SocketHandler pSocketHandler;
- DatabaseHandler pDatabaseHandler;
- RoutingSender pRoutingSender;
- CommandSender pCommandSender;
- MockCommandSendInterface pMockInterface;
- RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
- CommandInterfaceBackdoor pCommandInterfaceBackdoor;
- ControlSender pControlSender;
- Router pRouter;
- ControlReceiver pControlReceiver;
- DatabaseObserver pObserver;
- CommonFunctions pCF;
+ CAmSocketHandler pSocketHandler;
+ CAmDatabaseHandler pDatabaseHandler;
+ CAmRoutingSender pRoutingSender;
+ CAmCommandSender pCommandSender;
+ MockIAmCommandSend pMockInterface;
+ IAmRoutingBackdoor pRoutingInterfaceBackdoor;
+ IAmCommandBackdoor pCommandInterfaceBackdoor;
+ CAmControlSender pControlSender;
+ CAmRouter pRouter;
+ CAmControlReceiver pControlReceiver;
+ CAmDatabaseObserver pObserver;
+ CAmCommonFunctions pCF;
void SetUp();
void TearDown();
diff --git a/AudioManagerDaemon/test/database/CMakeLists.txt b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CMakeLists.txt
index 18e2883..da326da 100644
--- a/AudioManagerDaemon/test/database/CMakeLists.txt
+++ b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CMakeLists.txt
@@ -1,7 +1,7 @@
#
# Copyright (C) 2011, BMW AG
#
-# GeniviAudioMananger DatbaseTest
+# GeniviAudioMananger AmDatabaseHandlerTest
#
# \file CMakeLists.txt
#
@@ -23,7 +23,7 @@
cmake_minimum_required(VERSION 2.6)
-PROJECT(datbaseTest)
+PROJECT(AmDatabaseHandlerTest)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
@@ -33,35 +33,35 @@ pkg_check_modules(DLT REQUIRED automotive-dlt)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDES_FOLDER}
+ ${DBUS_include_FOLDER}
${CMAKE_SOURCE_DIR}
${STD_INCLUDE_DIRS}
${DLT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIR}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
)
file(GLOB DATABASE_SRCS_CXX
- "../../src/DatabaseHandler.cpp"
- "../../src/DatabaseObserver.cpp"
- "../../src/CommandSender.cpp"
- "../../src/RoutingSender.cpp"
- "../../src/ControlReceiver.cpp"
- "../../src/ControlSender.cpp"
- "../../src/Router.cpp"
- "../../src/DLTWrapper.cpp"
- "../../src/SocketHandler.cpp"
- "../../src/CommandReceiver.cpp"
- "../../src/RoutingReceiver.cpp"
- "../CommonFunctions.cpp"
+ "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseObserver.cpp"
+ "../../src/CAmCommandSender.cpp"
+ "../../src/CAmRoutingSender.cpp"
+ "../../src/CAmControlReceiver.cpp"
+ "../../src/CAmControlSender.cpp"
+ "../../src/CAmRouter.cpp"
+ "../../src/CAmDltWrapper.cpp"
+ "../../src/CAmSocketHandler.cpp"
+ "../../src/CAmCommandReceiver.cpp"
+ "../../src/CAmRoutingReceiver.cpp"
+ "../CAmCommonFunctions.cpp"
"*.cpp"
)
-ADD_EXECUTABLE( databasetest ${DATABASE_SRCS_CXX})
+ADD_EXECUTABLE( AmDatabaseHandlerTest ${DATABASE_SRCS_CXX})
-TARGET_LINK_LIBRARIES( databasetest
+TARGET_LINK_LIBRARIES( AmDatabaseHandlerTest
${SQLITE_LIBRARIES}
${DLT_LIBRARIES}
${DBUS_LIBRARY}
@@ -70,7 +70,7 @@ TARGET_LINK_LIBRARIES( databasetest
gmock
)
-INSTALL(TARGETS databasetest
+INSTALL(TARGETS AmDatabaseHandlerTest
DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
diff --git a/AudioManagerDaemon/test/routing/routingTest.cpp b/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp
index aa3f333..27ad546 100644
--- a/AudioManagerDaemon/test/routing/routingTest.cpp
+++ b/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.cpp
@@ -23,23 +23,14 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "routingTest.h"
-#include "MockInterfaces.h"
-#include "DatabaseHandler.h"
-#include "ControlReceiver.h"
-#include "ControlSender.h"
-#include "DatabaseObserver.h"
-#include "Router.h"
-#include "../ControlInterfaceBackdoor.h"
-#include "../CommandInterfaceBackdoor.h"
-#include "../CommonFunctions.h"
-#include "DLTWrapper.h"
+#include "CAmRouterTest.h"
#include <string.h>
+#include "shared/CAmDltWrapper.h"
using namespace am;
using namespace testing;
-routingTest::routingTest() :
+CAmRouterTest::CAmRouterTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
pSocketHandler(), //
@@ -61,16 +52,16 @@ routingTest::routingTest() :
pControlInterfaceBackdoor.replaceController(&pControlSender, &pMockControlInterface);
}
-routingTest::~routingTest()
+CAmRouterTest::~CAmRouterTest()
{
}
-void routingTest::SetUp()
+void CAmRouterTest::SetUp()
{
logInfo("Routing Test started ");
}
-void routingTest::TearDown()
+void CAmRouterTest::TearDown()
{
}
@@ -79,7 +70,7 @@ arg4=arg3;
}
//test that checks just sinks and source in a domain but connectionformats do not match
-TEST_F(routingTest,simpleRoute2withDomainNoMatchFormats)
+TEST_F(CAmRouterTest,simpleRoute2withDomainNoMatchFormats)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -140,7 +131,7 @@ TEST_F(routingTest,simpleRoute2withDomainNoMatchFormats)
}
//test that checks just sinks and source in a domain
-TEST_F(routingTest,simpleRoute2withDomain)
+TEST_F(CAmRouterTest,simpleRoute2withDomain)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -202,7 +193,7 @@ TEST_F(routingTest,simpleRoute2withDomain)
}
//test that checks just 2 domains, one sink one source with only one connection format each
-TEST_F(routingTest,simpleRoute2DomainsOnlyFree)
+TEST_F(CAmRouterTest,simpleRoute2DomainsOnlyFree)
{
@@ -310,7 +301,7 @@ TEST_F(routingTest,simpleRoute2DomainsOnlyFree)
}
//test that checks just 2 domains, one sink one source with only one connection format each
-TEST_F(routingTest,simpleRoute2DomainsOnlyFreeNotFree)
+TEST_F(CAmRouterTest,simpleRoute2DomainsOnlyFreeNotFree)
{
@@ -434,7 +425,7 @@ TEST_F(routingTest,simpleRoute2DomainsOnlyFreeNotFree)
}
//test that checks 3 domains, one sink one source, longer lists of connectionformats.
-TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_2)
+TEST_F(CAmRouterTest,simpleRoute3DomainsListConnectionFormats_2)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -594,7 +585,7 @@ TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_2)
}
//test that checks 3 domains, one sink one source, longer lists of connectionformats.
-TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_1)
+TEST_F(CAmRouterTest,simpleRoute3DomainsListConnectionFormats_1)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -749,7 +740,7 @@ TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_1)
//test that checks 3 domains, one sink one source, longer lists of connectionformats.
-TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats)
+TEST_F(CAmRouterTest,simpleRoute3DomainsListConnectionFormats)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -898,7 +889,7 @@ TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats)
//test that checks 4 domains, one sink and one source but there are 2 routes because there are 2 gateways
-TEST_F(routingTest,simpleRoute4Domains2Routes)
+TEST_F(CAmRouterTest,simpleRoute4Domains2Routes)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -1132,7 +1123,7 @@ TEST_F(routingTest,simpleRoute4Domains2Routes)
}
//test that checks 3 domains, one sink one source but the connectionformat of third domains do not fit.
-TEST_F(routingTest,simpleRoute3DomainsNoConnection)
+TEST_F(CAmRouterTest,simpleRoute3DomainsNoConnection)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -1276,7 +1267,7 @@ TEST_F(routingTest,simpleRoute3DomainsNoConnection)
ASSERT_EQ(0, listRoutes.size());
}
//test that checks just 2 domains, one sink one source with only one connection format each
-TEST_F(routingTest,simpleRoute2Domains)
+TEST_F(CAmRouterTest,simpleRoute2Domains)
{
@@ -1384,7 +1375,7 @@ TEST_F(routingTest,simpleRoute2Domains)
}
//test that checks just 2 domains, one sink one source but the connectionformat of source
-TEST_F(routingTest,simpleRoute2DomainsNoMatchConnectionFormats)
+TEST_F(CAmRouterTest,simpleRoute2DomainsNoMatchConnectionFormats)
{
@@ -1490,7 +1481,7 @@ TEST_F(routingTest,simpleRoute2DomainsNoMatchConnectionFormats)
}
//test that checks 3 domains, one sink one source.
-TEST_F(routingTest,simpleRoute3Domains)
+TEST_F(CAmRouterTest,simpleRoute3Domains)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -1635,7 +1626,7 @@ TEST_F(routingTest,simpleRoute3Domains)
}
//test that checks 4 domains, one sink and one source.
-TEST_F(routingTest,simpleRoute4Domains)
+TEST_F(CAmRouterTest,simpleRoute4Domains)
{
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
@@ -1821,7 +1812,7 @@ TEST_F(routingTest,simpleRoute4Domains)
int main(int argc, char **argv)
{
- DLTWrapper::instance()->registerApp("routing", "routingtest");
+ CAmDltWrapper::instance()->registerApp("routing", "CAmRouterTest");
logInfo("Routing Test started ");
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/AudioManagerDaemon/test/routing/routingTest.h b/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.h
index 64ed8c5..53788be 100644
--- a/AudioManagerDaemon/test/routing/routingTest.h
+++ b/AudioManagerDaemon/test/AmRouterTest/CAmRouterTest.h
@@ -30,46 +30,48 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
+
#include <algorithm>
#include <string>
#include <vector>
#include <set>
-#include "MockInterfaces.h"
-#include "DatabaseHandler.h"
-#include "ControlReceiver.h"
-#include "ControlSender.h"
-#include "DatabaseObserver.h"
-#include "RoutingSender.h"
-#include "Router.h"
-#include "SocketHandler.h"
-#include "../ControlInterfaceBackdoor.h"
-#include "../CommandInterfaceBackdoor.h"
-#include "../CommonFunctions.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmControlReceiver.h"
+#include "CAmControlSender.h"
+#include "CAmDatabaseObserver.h"
+#include "CAmRoutingSender.h"
+#include "CAmRouter.h"
+#include "shared/CAmSocketHandler.h"
+#include "../IAmControlBackdoor.h"
+#include "../IAmCommandBackdoor.h"
+#include "../CAmCommonFunctions.h"
+#include "../MockIAmControlSend.h"
+#include "../MockIAmCommandSend.h"
namespace am
{
-class routingTest: public ::testing::Test
+class CAmRouterTest: public ::testing::Test
{
public:
- routingTest();
- ~routingTest();
+ CAmRouterTest();
+ ~CAmRouterTest();
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
- SocketHandler pSocketHandler;
- DatabaseHandler pDatabaseHandler;
- ControlSender pControlSender;
- Router pRouter;
- RoutingSender pRoutingSender;
- CommandSender pCommandSender;
- MockCommandSendInterface pMockInterface;
- MockControlSendInterface pMockControlInterface;
- RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
- CommandInterfaceBackdoor pCommandInterfaceBackdoor;
- ControlInterfaceBackdoor pControlInterfaceBackdoor;
- ControlReceiver pControlReceiver;
- DatabaseObserver pObserver;
- CommonFunctions pCF;
+ CAmSocketHandler pSocketHandler;
+ CAmDatabaseHandler pDatabaseHandler;
+ CAmControlSender pControlSender;
+ CAmRouter pRouter;
+ CAmRoutingSender pRoutingSender;
+ CAmCommandSender pCommandSender;
+ MockIAmCommandSend pMockInterface;
+ MockIAmControlSend pMockControlInterface;
+ IAmRoutingBackdoor pRoutingInterfaceBackdoor;
+ IAmCommandBackdoor pCommandInterfaceBackdoor;
+ IAmControlBackdoor pControlInterfaceBackdoor;
+ CAmControlReceiver pControlReceiver;
+ CAmDatabaseObserver pObserver;
+ CAmCommonFunctions pCF;
void SetUp();
void TearDown();
diff --git a/AudioManagerDaemon/test/routing/CMakeLists.txt b/AudioManagerDaemon/test/AmRouterTest/CMakeLists.txt
index a7c70f9..3c06729 100644
--- a/AudioManagerDaemon/test/routing/CMakeLists.txt
+++ b/AudioManagerDaemon/test/AmRouterTest/CMakeLists.txt
@@ -23,7 +23,7 @@
cmake_minimum_required(VERSION 2.6)
-PROJECT(routingTest)
+PROJECT(AmRouterTest)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
@@ -33,35 +33,35 @@ pkg_check_modules(DLT REQUIRED automotive-dlt)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDES_FOLDER}
+ ${DBUS_include_FOLDER}
${CMAKE_SOURCE_DIR}
${STD_INCLUDE_DIRS}
${DLT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIR}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
)
file(GLOB ROUTING_SRCS_CXX
- "../../src/DatabaseHandler.cpp"
- "../../src/DatabaseObserver.cpp"
- "../../src/CommandSender.cpp"
- "../../src/RoutingSender.cpp"
- "../../src/ControlReceiver.cpp"
- "../../src/ControlSender.cpp"
- "../../src/Router.cpp"
- "../../src/DLTWrapper.cpp"
- "../../src/SocketHandler.cpp"
- "../../src/CommandReceiver.cpp"
- "../../src/RoutingReceiver.cpp"
- "../CommonFunctions.cpp"
+ "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseObserver.cpp"
+ "../../src/CAmCommandSender.cpp"
+ "../../src/CAmRoutingSender.cpp"
+ "../../src/CAmControlReceiver.cpp"
+ "../../src/CAmControlSender.cpp"
+ "../../src/CAmRouter.cpp"
+ "../../src/CAmDltWrapper.cpp"
+ "../../src/CAmSocketHandler.cpp"
+ "../../src/CAmCommandReceiver.cpp"
+ "../../src/CAmRoutingReceiver.cpp"
+ "../CAmCommonFunctions.cpp"
"*.cpp"
)
-ADD_EXECUTABLE( routingtest ${ROUTING_SRCS_CXX})
+ADD_EXECUTABLE( AmRouterTest ${ROUTING_SRCS_CXX})
-TARGET_LINK_LIBRARIES( routingtest
+TARGET_LINK_LIBRARIES( AmRouterTest
${SQLITE_LIBRARIES}
${DLT_LIBRARIES}
${DBUS_LIBRARY}
@@ -70,7 +70,7 @@ TARGET_LINK_LIBRARIES( routingtest
gmock
)
-INSTALL(TARGETS routingtest
+INSTALL(TARGETS AmRouterTest
DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp
index a827ebe..3e8cd21 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.cpp
@@ -23,13 +23,13 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "routingInterfaceTest.h"
-#include "DLTWrapper.h"
+#include "CAmRoutingInterfaceTest.h"
+#include "shared/CAmDltWrapper.h"
using namespace am;
using namespace testing;
-routingInterfaceTest::routingInterfaceTest() :
+CAmRoutingInterfaceTest::CAmRoutingInterfaceTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
pSocketHandler(), //
@@ -50,21 +50,21 @@ routingInterfaceTest::routingInterfaceTest() :
pCommandInterfaceBackdoor.unloadPlugins(&pCommandSender);
}
-routingInterfaceTest::~routingInterfaceTest()
+CAmRoutingInterfaceTest::~CAmRoutingInterfaceTest()
{
}
-void routingInterfaceTest::SetUp()
+void CAmRoutingInterfaceTest::SetUp()
{
logInfo("RoutingSendInterface Test started ");
}
-void routingInterfaceTest::TearDown()
+void CAmRoutingInterfaceTest::TearDown()
{
}
-TEST_F(routingInterfaceTest,abort)
+TEST_F(CAmRoutingInterfaceTest,abort)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -108,14 +108,14 @@ TEST_F(routingInterfaceTest,abort)
ASSERT_EQ(E_NON_EXISTENT, pControlReceiver.abortAction(handle));
}
-TEST_F(routingInterfaceTest,abortNonExistent)
+TEST_F(CAmRoutingInterfaceTest,abortNonExistent)
{
EXPECT_CALL(pMockInterface,asyncAbort(_)).Times(0);
am_Handle_s handle;
ASSERT_EQ(E_NON_EXISTENT, pControlReceiver.abortAction(handle));
}
-TEST_F(routingInterfaceTest,alreadyConnected)
+TEST_F(CAmRoutingInterfaceTest,alreadyConnected)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -139,7 +139,7 @@ TEST_F(routingInterfaceTest,alreadyConnected)
ASSERT_EQ(handle.handleType, H_CONNECT);
}
-TEST_F(routingInterfaceTest,setSinkSoundPropertyNoChange)
+TEST_F(CAmRoutingInterfaceTest,setSinkSoundPropertyNoChange)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -163,7 +163,7 @@ TEST_F(routingInterfaceTest,setSinkSoundPropertyNoChange)
ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkSoundProperty(handle,sinkID,soundProperty));
}
-TEST_F(routingInterfaceTest,setSourceState)
+TEST_F(CAmRoutingInterfaceTest,setSourceState)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -185,7 +185,7 @@ TEST_F(routingInterfaceTest,setSourceState)
ASSERT_EQ(handle.handleType, H_SETSOURCESTATE);
}
-TEST_F(routingInterfaceTest,setSourceSoundProperty)
+TEST_F(CAmRoutingInterfaceTest,setSourceSoundProperty)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -211,7 +211,7 @@ TEST_F(routingInterfaceTest,setSourceSoundProperty)
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
-TEST_F(routingInterfaceTest,setSinkSoundProperty)
+TEST_F(CAmRoutingInterfaceTest,setSinkSoundProperty)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -237,7 +237,7 @@ TEST_F(routingInterfaceTest,setSinkSoundProperty)
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
-TEST_F(routingInterfaceTest,setSourceVolumeNoChange)
+TEST_F(CAmRoutingInterfaceTest,setSourceVolumeNoChange)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -263,7 +263,7 @@ TEST_F(routingInterfaceTest,setSourceVolumeNoChange)
ASSERT_TRUE(listHandles.empty());
}
-TEST_F(routingInterfaceTest,setSourceVolume)
+TEST_F(CAmRoutingInterfaceTest,setSourceVolume)
{
am_Source_s source;
am_sourceID_t sourceID;
@@ -291,7 +291,7 @@ TEST_F(routingInterfaceTest,setSourceVolume)
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
-TEST_F(routingInterfaceTest,setSinkVolumeNoChange)
+TEST_F(CAmRoutingInterfaceTest,setSinkVolumeNoChange)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -317,7 +317,7 @@ TEST_F(routingInterfaceTest,setSinkVolumeNoChange)
ASSERT_TRUE(listHandles.empty());
}
-TEST_F(routingInterfaceTest,setSinkVolume)
+TEST_F(CAmRoutingInterfaceTest,setSinkVolume)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -345,7 +345,7 @@ TEST_F(routingInterfaceTest,setSinkVolume)
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
-TEST_F(routingInterfaceTest,connect)
+TEST_F(CAmRoutingInterfaceTest,connect)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -371,7 +371,7 @@ TEST_F(routingInterfaceTest,connect)
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
-TEST_F(routingInterfaceTest,disconnect)
+TEST_F(CAmRoutingInterfaceTest,disconnect)
{
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -400,7 +400,7 @@ TEST_F(routingInterfaceTest,disconnect)
ASSERT_TRUE(listHandles[1].handleType==handle.handleType);
}
-TEST_F(routingInterfaceTest,nothingTodisconnect)
+TEST_F(CAmRoutingInterfaceTest,nothingTodisconnect)
{
am_Handle_s handle;
am_connectionID_t connectionID = 4;
@@ -410,7 +410,7 @@ TEST_F(routingInterfaceTest,nothingTodisconnect)
ASSERT_TRUE(listHandles.empty());
}
-TEST_F(routingInterfaceTest,setSourceStateNoChange)
+TEST_F(CAmRoutingInterfaceTest,setSourceStateNoChange)
{
am_Source_s source;
am_sourceID_t sourceID;
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h
index f102221..a66599d 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
+++ b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CAmRoutingInterfaceTest.h
@@ -32,39 +32,39 @@
#include <string>
#include <vector>
#include <set>
-#include "MockRoutingInterface.h"
-#include "DatabaseHandler.h"
-#include "ControlReceiver.h"
-#include "ControlSender.h"
-#include "DatabaseObserver.h"
-#include "SocketHandler.h"
-#include "Router.h"
-#include "../RoutingInterfaceBackdoor.h"
-#include "../CommandInterfaceBackdoor.h"
-#include "../CommonFunctions.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmControlReceiver.h"
+#include "CAmControlSender.h"
+#include "CAmDatabaseObserver.h"
+#include "CAmRouter.h"
+#include "../IAmRoutingBackdoor.h"
+#include "../IAmCommandBackdoor.h"
+#include "../CAmCommonFunctions.h"
+#include "../MockIAmRoutingSend.h"
+#include "shared/CAmSocketHandler.h"
namespace am
{
-class routingInterfaceTest: public ::testing::Test
+class CAmRoutingInterfaceTest: public ::testing::Test
{
public:
- routingInterfaceTest();
- ~routingInterfaceTest();
+ CAmRoutingInterfaceTest();
+ ~CAmRoutingInterfaceTest();
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
- SocketHandler pSocketHandler;
- DatabaseHandler pDatabaseHandler;
- RoutingSender pRoutingSender;
- CommandSender pCommandSender;
- ControlSender pControlSender;
- Router pRouter;
- MockRoutingSendInterface pMockInterface;
- RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
- CommandInterfaceBackdoor pCommandInterfaceBackdoor;
- ControlReceiver pControlReceiver;
- DatabaseObserver pObserver;
- CommonFunctions pCF;
+ CAmSocketHandler pSocketHandler;
+ CAmDatabaseHandler pDatabaseHandler;
+ CAmRoutingSender pRoutingSender;
+ CAmCommandSender pCommandSender;
+ CAmControlSender pControlSender;
+ CAmRouter pRouter;
+ MockIAmRoutingSend pMockInterface;
+ IAmRoutingBackdoor pRoutingInterfaceBackdoor;
+ IAmCommandBackdoor pCommandInterfaceBackdoor;
+ CAmControlReceiver pControlReceiver;
+ CAmDatabaseObserver pObserver;
+ CAmCommonFunctions pCF;
void SetUp();
void TearDown();
};
diff --git a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt
index fbb4ac1..ac87e8d 100644
--- a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/AmRoutingInterfaceTest/CMakeLists.txt
@@ -1,7 +1,7 @@
#
# Copyright (C) 2011, BMW AG
#
-# GeniviAudioMananger RoutingInterfaceTest
+# GeniviAudioMananger AmRoutingInterfaceTest
#
# \file CMakeLists.txt
#
@@ -23,7 +23,7 @@
cmake_minimum_required(VERSION 2.6)
-PROJECT(routingInterfaceTest)
+PROJECT(AmRoutingInterfaceTest)
#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
@@ -34,35 +34,35 @@ pkg_check_modules(DLT REQUIRED automotive-dlt)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDES_FOLDER}
+ ${DBUS_include_FOLDER}
${CMAKE_SOURCE_DIR}
${STD_INCLUDE_DIRS}
${DLT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIR}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
)
file(GLOB ROUTING_INTERFACE_SRCS_CXX
- "../../src/ControlReceiver.cpp"
- "../../src/DatabaseHandler.cpp"
- "../../src/DatabaseObserver.cpp"
- "../../src/CommandSender.cpp"
- "../../src/RoutingSender.cpp"
- "../../src/Router.cpp"
- "../../src/ControlSender.cpp"
- "../CommonFunctions.cpp"
- "../../src/DLTWrapper.cpp"
- "../../src/SocketHandler.cpp"
- "../../src/RoutingReceiver.cpp"
- "../../src/CommandReceiver.cpp"
+ "../../src/CAmControlReceiver.cpp"
+ "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseObserver.cpp"
+ "../../src/CAmCommandSender.cpp"
+ "../../src/CAmRoutingSender.cpp"
+ "../../src/CAmRouter.cpp"
+ "../../src/CAmControlSender.cpp"
+ "../CAmCommonFunctions.cpp"
+ "../../src/CAmDltWrapper.cpp"
+ "../../src/CAmSocketHandler.cpp"
+ "../../src/CAmRoutingReceiver.cpp"
+ "../../src/CAmCommandReceiver.cpp"
"*.cpp"
)
-ADD_EXECUTABLE(routinginterfacetest ${ROUTING_INTERFACE_SRCS_CXX})
+ADD_EXECUTABLE(AmRoutingInterfaceTest ${ROUTING_INTERFACE_SRCS_CXX})
-TARGET_LINK_LIBRARIES(routinginterfacetest
+TARGET_LINK_LIBRARIES(AmRoutingInterfaceTest
${SQLITE_LIBRARIES}
${DLT_LIBRARIES}
${DBUS_LIBRARY}
@@ -71,7 +71,7 @@ TARGET_LINK_LIBRARIES(routinginterfacetest
gmock
)
-INSTALL(TARGETS routinginterfacetest
+INSTALL(TARGETS AmRoutingInterfaceTest
DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp b/AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp
index 91eee2c..b0b5639 100644
--- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp
+++ b/AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.cpp
@@ -23,15 +23,17 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "sockethandlerTest.h"
+#include "CAmSocketHandlerTest.h"
#include <stdio.h>
-#include <sys/socket.h> /* for socket(), connect(), (), and recv() */
-#include <arpa/inet.h> /* for sockaddr_in and inet_addr() */
+#include <sys/socket.h>
+#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <string.h>
#include <netdb.h>
#include <fcntl.h>
#include <sys/un.h>
+#include <sys/poll.h>
+#include "shared/CAmSocketHandler.h"
//todo: expand test, implement more usecases
//todo: test removeFD
@@ -41,29 +43,29 @@
using namespace testing;
using namespace am;
-sockethandlerTest::sockethandlerTest()
+CAmSocketHandlerTest::CAmSocketHandlerTest()
{
}
-sockethandlerTest::~sockethandlerTest()
+CAmSocketHandlerTest::~CAmSocketHandlerTest()
{
}
-timerCallBack::timerCallBack(SocketHandler *myHandler) :
- pTimer1Callback(this, &timerCallBack::timer1Callback), //
- pTimer2Callback(this, &timerCallBack::timer2Callback), //
- pTimer3Callback(this, &timerCallBack::timer3Callback), //
- pTimer4Callback(this, &timerCallBack::timer4Callback), //
+CAmTimerCb::CAmTimerCb(CAmSocketHandler *myHandler) :
+ pTimer1Callback(this, &CAmTimerCb::timer1Callback), //
+ pTimer2Callback(this, &CAmTimerCb::timer2Callback), //
+ pTimer3Callback(this, &CAmTimerCb::timer3Callback), //
+ pTimer4Callback(this, &CAmTimerCb::timer4Callback), //
mSocketHandler(myHandler)
{
}
-am::timerCallBack::~timerCallBack()
+am::CAmTimerCb::~CAmTimerCb()
{
}
-void am::timerCallBack::timer1Callback(sh_timerHandle_t handle, void* userData)
+void am::CAmTimerCb::timer1Callback(sh_timerHandle_t handle, void* userData)
{
(void) handle;
(void) userData;
@@ -71,12 +73,12 @@ void am::timerCallBack::timer1Callback(sh_timerHandle_t handle, void* userData)
timespec timeout;
timeout.tv_nsec = 0;
timeout.tv_sec = 1;
- shTimerCallBack *buf = &pTimer1Callback;
+ CAmShTimerCallBack *buf = &pTimer1Callback;
sh_timerHandle_t handle_;
mSocketHandler->addTimer(timeout, buf, handle_, NULL);
}
-void am::timerCallBack::timer2Callback(sh_timerHandle_t handle, void* userData)
+void am::CAmTimerCb::timer2Callback(sh_timerHandle_t handle, void* userData)
{
(void) handle;
(void) userData;
@@ -84,18 +86,18 @@ void am::timerCallBack::timer2Callback(sh_timerHandle_t handle, void* userData)
timespec timeout;
timeout.tv_nsec = 0;
timeout.tv_sec = 1;
- shTimerCallBack *buf = &pTimer2Callback;
+ CAmShTimerCallBack *buf = &pTimer2Callback;
sh_timerHandle_t handle_;
mSocketHandler->addTimer(timeout, buf, handle_, NULL);
}
-void am::timerCallBack::timer3Callback(sh_timerHandle_t, void* userData)
+void am::CAmTimerCb::timer3Callback(sh_timerHandle_t, void* userData)
{
(void) userData;
std::cout << "callback3 called" << std::endl;
}
-void am::timerCallBack::timer4Callback(sh_timerHandle_t, void* userData)
+void am::CAmTimerCb::timer4Callback(sh_timerHandle_t, void* userData)
{
(void) userData;
std::cout << "callback4 called" << std::endl;
@@ -105,9 +107,9 @@ void am::timerCallBack::timer4Callback(sh_timerHandle_t, void* userData)
void* playWithSocketServer(void* data)
{
(void) data;
- SocketHandler myHandler;
- SamplePlugin::sockType_e type = SamplePlugin::INET;
- SamplePlugin myplugin(&myHandler, type);
+ CAmSocketHandler myHandler;
+ CAmSamplePlugin::sockType_e type = CAmSamplePlugin::INET;
+ CAmSamplePlugin myplugin(&myHandler, type);
myHandler.start_listenting();
return (NULL);
}
@@ -115,14 +117,14 @@ void* playWithSocketServer(void* data)
void* playWithUnixSocketServer(void* data)
{
(void) data;
- SocketHandler myHandler;
- SamplePlugin::sockType_e type = SamplePlugin::UNIX;
- SamplePlugin myplugin(&myHandler, type);
+ CAmSocketHandler myHandler;
+ CAmSamplePlugin::sockType_e type = CAmSamplePlugin::UNIX;
+ CAmSamplePlugin myplugin(&myHandler, type);
myHandler.start_listenting();
return (NULL);
}
-TEST(sockethandlerTest,playWithUNIXSockets)
+TEST(CAmSocketHandlerTest,playWithUNIXSockets)
{
pthread_t serverThread;
struct sockaddr_un servAddr;
@@ -157,7 +159,7 @@ TEST(sockethandlerTest,playWithUNIXSockets)
pthread_join(serverThread, NULL);
}
-TEST(sockethandlerTest,playWithSockets)
+TEST(CAmSocketHandlerTest,playWithSockets)
{
pthread_t serverThread;
struct sockaddr_in servAddr;
@@ -202,11 +204,11 @@ TEST(sockethandlerTest,playWithSockets)
pthread_join(serverThread, NULL);
}
-TEST(sockethandlerTest,playWithTimers)
+TEST(CAmSocketHandlerTest,playWithTimers)
{
gDispatchDone = 0;
- SocketHandler myHandler;
- timerCallBack testCallback(&myHandler);
+ CAmSocketHandler myHandler;
+ CAmTimerCb testCallback(&myHandler);
timespec timeoutTime, timeout2, timeout3, timeout4;
timeoutTime.tv_sec = 3;
timeoutTime.tv_nsec = 0;
@@ -216,10 +218,10 @@ TEST(sockethandlerTest,playWithTimers)
timeout3.tv_sec = 2;
timeout4.tv_nsec = 0;
timeout4.tv_sec = 13;
- shTimerCallBack* buf = &testCallback.pTimer1Callback;
- shTimerCallBack* buf2 = &testCallback.pTimer2Callback;
- shTimerCallBack* buf3 = &testCallback.pTimer3Callback;
- shTimerCallBack* buf4 = &testCallback.pTimer4Callback;
+ CAmShTimerCallBack* buf = &testCallback.pTimer1Callback;
+ CAmShTimerCallBack* buf2 = &testCallback.pTimer2Callback;
+ CAmShTimerCallBack* buf3 = &testCallback.pTimer3Callback;
+ CAmShTimerCallBack* buf4 = &testCallback.pTimer4Callback;
sh_timerHandle_t handle;
myHandler.addTimer(timeoutTime, buf, handle, NULL);
myHandler.addTimer(timeout2, buf2, handle, NULL);
@@ -229,11 +231,11 @@ TEST(sockethandlerTest,playWithTimers)
}
-void sockethandlerTest::SetUp()
+void CAmSocketHandlerTest::SetUp()
{
}
-void sockethandlerTest::TearDown()
+void CAmSocketHandlerTest::TearDown()
{
}
@@ -243,11 +245,11 @@ int main(int argc, char **argv)
return RUN_ALL_TESTS();
}
-am::SamplePlugin::SamplePlugin(SocketHandler *mySocketHandler, sockType_e socketType) :
- connectFiredCB(this, &SamplePlugin::connectSocket), //
- receiveFiredCB(this, &SamplePlugin::receiveData), //
- sampleDispatchCB(this, &SamplePlugin::dispatchData), //
- sampleCheckCB(this, &SamplePlugin::check), //
+am::CAmSamplePlugin::CAmSamplePlugin(CAmSocketHandler *mySocketHandler, sockType_e socketType) :
+ connectFiredCB(this, &CAmSamplePlugin::connectSocket), //
+ receiveFiredCB(this, &CAmSamplePlugin::receiveData), //
+ sampleDispatchCB(this, &CAmSamplePlugin::dispatchData), //
+ sampleCheckCB(this, &CAmSamplePlugin::check), //
mSocketHandler(mySocketHandler), //
mConnecthandle(), //
mReceiveHandle(), //
@@ -297,7 +299,7 @@ am::SamplePlugin::SamplePlugin(SocketHandler *mySocketHandler, sockType_e socket
std::cout << "setup server - listening" << std::endl;
}
-void am::SamplePlugin::connectSocket(const pollfd pollfd1, const sh_pollHandle_t handle, void *userData)
+void am::CAmSamplePlugin::connectSocket(const pollfd pollfd1, const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
@@ -316,7 +318,7 @@ void am::SamplePlugin::connectSocket(const pollfd pollfd1, const sh_pollHandle_t
}
-void am::SamplePlugin::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
+void am::CAmSamplePlugin::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
@@ -333,7 +335,7 @@ void am::SamplePlugin::receiveData(const pollfd pollfd, const sh_pollHandle_t ha
}
}
-bool am::SamplePlugin::dispatchData(const sh_pollHandle_t handle, void *userData)
+bool am::CAmSamplePlugin::dispatchData(const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
@@ -352,7 +354,7 @@ bool am::SamplePlugin::dispatchData(const sh_pollHandle_t handle, void *userData
return false;
}
-bool am::SamplePlugin::check(const sh_pollHandle_t handle, void *userData)
+bool am::CAmSamplePlugin::check(const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h b/AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
index abb8ace..f45376e 100644
--- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h
+++ b/AudioManagerDaemon/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
@@ -28,20 +28,20 @@
#include <gtest/gtest.h>
#include <queue>
-#include "SocketHandler.h"
+#include "shared/CAmSocketHandler.h"
namespace am
{
-class SamplePlugin
+class CAmSamplePlugin
{
public:
enum sockType_e
{
UNIX, INET
};
- SamplePlugin(SocketHandler *mySocketHandler, sockType_e socketType);
- ~SamplePlugin()
+ CAmSamplePlugin(CAmSocketHandler *mySocketHandler, sockType_e socketType);
+ ~CAmSamplePlugin()
{
}
;
@@ -49,37 +49,37 @@ public:
void receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
bool dispatchData(const sh_pollHandle_t handle, void* userData);
bool check(const sh_pollHandle_t handle, void* userData);
- shPollFired_T<SamplePlugin> connectFiredCB;
- shPollFired_T<SamplePlugin> receiveFiredCB;
- shPollDispatch_T<SamplePlugin> sampleDispatchCB;
- shPollCheck_T<SamplePlugin> sampleCheckCB;
+ TAmShPollFired<CAmSamplePlugin> connectFiredCB;
+ TAmShPollFired<CAmSamplePlugin> receiveFiredCB;
+ TAmShPollDispatch<CAmSamplePlugin> sampleDispatchCB;
+ TAmShPollCheck<CAmSamplePlugin> sampleCheckCB;
private:
- SocketHandler *mSocketHandler;
+ CAmSocketHandler *mSocketHandler;
sh_pollHandle_t mConnecthandle, mReceiveHandle;
std::queue<std::string> msgList;
};
-class timerCallBack
+class CAmTimerCb
{
public:
- timerCallBack(SocketHandler *SocketHandler);
- virtual ~timerCallBack();
+ CAmTimerCb(CAmSocketHandler *SocketHandler);
+ virtual ~CAmTimerCb();
void timer1Callback(sh_timerHandle_t handle, void * userData);
void timer2Callback(sh_timerHandle_t handle, void * userData);
void timer3Callback(sh_timerHandle_t handle, void * userData);
void timer4Callback(sh_timerHandle_t handle, void * userData);
- shTimerCallBack_T<timerCallBack> pTimer1Callback;
- shTimerCallBack_T<timerCallBack> pTimer2Callback;
- shTimerCallBack_T<timerCallBack> pTimer3Callback;
- shTimerCallBack_T<timerCallBack> pTimer4Callback;
- SocketHandler *mSocketHandler;
+ TAmShTimerCallBack<CAmTimerCb> pTimer1Callback;
+ TAmShTimerCallBack<CAmTimerCb> pTimer2Callback;
+ TAmShTimerCallBack<CAmTimerCb> pTimer3Callback;
+ TAmShTimerCallBack<CAmTimerCb> pTimer4Callback;
+ CAmSocketHandler *mSocketHandler;
};
-class sockethandlerTest: public ::testing::Test
+class CAmSocketHandlerTest: public ::testing::Test
{
public:
- sockethandlerTest();
- ~sockethandlerTest();
+ CAmSocketHandlerTest();
+ ~CAmSocketHandlerTest();
void SetUp();
void TearDown();
};
diff --git a/AudioManagerDaemon/test/sockethandler/CMakeLists.txt b/AudioManagerDaemon/test/AmSocketHandlerTest/CMakeLists.txt
index 8858e5a..692b903 100644
--- a/AudioManagerDaemon/test/sockethandler/CMakeLists.txt
+++ b/AudioManagerDaemon/test/AmSocketHandlerTest/CMakeLists.txt
@@ -23,16 +23,16 @@
cmake_minimum_required(VERSION 2.6)
-PROJECT(socketHandlerTest)
+PROJECT(AmSocketHandlerTest)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
set(STD_INCLUDE_DIRS "/usr/include")
set(DBUS_FOLDER ${CMAKE_SOURCE_DIR}/../../../dbusInterfaces)
-set(AUDIO_INCLUDES_FOLDER ${CMAKE_SOURCE_DIR}/../../../includes)
-set(DBUS_INCLUDES_FOLDER ${CMAKE_SOURCE_DIR}/../../../../dbusIncludes)
-set(INCLUDES_FOLDER ${CMAKE_SOURCE_DIR}/../../include)
+set(AUDIO_include_FOLDER ${CMAKE_SOURCE_DIR}/../../../include)
+set(DBUS_include_FOLDER ${CMAKE_SOURCE_DIR}/../../../../dbusinclude)
+set(include_FOLDER ${CMAKE_SOURCE_DIR}/../../include)
FIND_PACKAGE(PkgConfig)
@@ -40,25 +40,25 @@ pkg_check_modules(DLT REQUIRED automotive-dlt)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDES_FOLDER}
+ ${DBUS_include_FOLDER}
${CMAKE_SOURCE_DIR}
${STD_INCLUDE_DIRS}
${DLT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIR}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
)
file(GLOB Socket_SRCS_CXX
- "../../src/SocketHandler.cpp"
- "../../src/DLTWrapper.cpp"
+ "../../src/CAmSocketHandler.cpp"
+ "../../src/CAmDltWrapper.cpp"
"*.cpp"
)
-ADD_EXECUTABLE(socketHandlerTest ${Socket_SRCS_CXX})
+ADD_EXECUTABLE(AmSocketHandlerTest ${Socket_SRCS_CXX})
-TARGET_LINK_LIBRARIES(socketHandlerTest
+TARGET_LINK_LIBRARIES(AmSocketHandlerTest
${DLT_LIBRARIES}
${DBUS_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
@@ -66,7 +66,7 @@ TARGET_LINK_LIBRARIES(socketHandlerTest
gmock
)
-INSTALL(TARGETS socketHandlerTest
+INSTALL(TARGETS AmSocketHandlerTest
DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
diff --git a/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.cpp b/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp
index d727fff..2219834 100644
--- a/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.cpp
+++ b/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp
@@ -10,9 +10,9 @@
#include <netdb.h> /* for struct hostent */
#include "CAmTelnetServerTest.h"
-#include "CommandReceiver.h"
-#include "RoutingReceiver.h"
-#include "ControlReceiver.h"
+#include "CAmCommandReceiver.h"
+#include "CAmRoutingReceiver.h"
+#include "CAmControlReceiver.h"
using namespace testing;
@@ -23,19 +23,19 @@ using namespace std;
static std::string controllerPlugin = std::string(CONTROLLER_PLUGIN);
static unsigned short servPort = 6060;
static int staticSocket = -1;
-static SocketHandler* mpSocketHandler = NULL;
+static CAmSocketHandler* mpSocketHandler = NULL;
void* startSocketHandler(void* data)
{
- MyEnvironment* Env = static_cast<MyEnvironment*>(data);
- SocketHandler mySocketHandler;
+ CAmEnvironment* Env = static_cast<CAmEnvironment*>(data);
+ CAmSocketHandler mySocketHandler;
Env->setSocketHandler(&mySocketHandler);
mySocketHandler.start_listenting();
Env->setSocketHandler(NULL);
return (NULL);
}
-MyEnvironment::MyEnvironment()
+CAmEnvironment::CAmEnvironment()
: mlistRoutingPluginDirs()
, mlistCommandPluginDirs()
//, mpSocketHandler(NULL)
@@ -52,7 +52,7 @@ MyEnvironment::MyEnvironment()
{
}
-MyEnvironment::~MyEnvironment()
+CAmEnvironment::~CAmEnvironment()
{
usleep(500);
if(NULL != mpTelnetServer)
@@ -65,26 +65,26 @@ MyEnvironment::~MyEnvironment()
delete(mpCommandReceiver);
}
-void MyEnvironment::SetUp()
+void CAmEnvironment::SetUp()
{
pthread_create(&mSocketHandlerThread, NULL, startSocketHandler, this);
sleep(1);
}
-void MyEnvironment::TearDown()
+void CAmEnvironment::TearDown()
{
}
-void MyEnvironment::setSocketHandler(SocketHandler* pSocketHandler)
+void CAmEnvironment::setSocketHandler(CAmSocketHandler* pSocketHandler)
{
mpSocketHandler = pSocketHandler;
if(NULL != pSocketHandler)
{
- mpCommandReceiver = new CommandReceiver(&mDatabasehandler,&mControlSender,mpSocketHandler);
- mpRoutingReceiver = new RoutingReceiver(&mDatabasehandler,&mRoutingSender,&mControlSender,mpSocketHandler);
- mpControlReceiver = new ControlReceiver(&mDatabasehandler,&mRoutingSender,&mCommandSender,mpSocketHandler,&mRouter);
+ mpCommandReceiver = new CAmCommandReceiver(&mDatabasehandler,&mControlSender,mpSocketHandler);
+ mpRoutingReceiver = new CAmRoutingReceiver(&mDatabasehandler,&mRoutingSender,&mControlSender,mpSocketHandler);
+ mpControlReceiver = new CAmControlReceiver(&mDatabasehandler,&mRoutingSender,&mCommandSender,mpSocketHandler,&mRouter);
//startup all the Plugins and Interfaces
mControlSender.startupController(mpControlReceiver);
@@ -95,11 +95,11 @@ void MyEnvironment::setSocketHandler(SocketHandler* pSocketHandler)
mControlSender.setControllerReady();
// Starting TelnetServer
- mpTelnetServer = new TelnetServer(mpSocketHandler,&mCommandSender,mpCommandReceiver,&mRoutingSender,mpRoutingReceiver,&mControlSender,mpControlReceiver,&mDatabasehandler,&mRouter,servPort,3);
+ mpTelnetServer = new CAmTelnetServer(mpSocketHandler,&mCommandSender,mpCommandReceiver,&mRoutingSender,mpRoutingReceiver,&mControlSender,mpControlReceiver,&mDatabasehandler,&mRouter,servPort,3);
}
}
-void MyEnvironment::stopSocketHandler()
+void CAmEnvironment::stopSocketHandler()
{
mpSocketHandler->stop_listening();
}
@@ -184,7 +184,7 @@ TEST_F(CAmTelnetServerTest,closeTelnetServerConnection)
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
- ::testing::Environment* const env = ::testing::AddGlobalTestEnvironment(new MyEnvironment);
+ ::testing::Environment* const env = ::testing::AddGlobalTestEnvironment(new CAmEnvironment);
(void) env;
return RUN_ALL_TESTS();
}
diff --git a/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.h b/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.h
new file mode 100644
index 0000000..7a87e68
--- /dev/null
+++ b/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.h
@@ -0,0 +1,87 @@
+/*
+ * CAmTelnetServerTest.h
+ *
+ * Created on: Feb 7, 2012
+ * Author: Frank Herchet
+ */
+
+#ifndef CAMTELNETSERVERTEST_H_
+#define CAMTELNETSERVERTEST_H_
+
+#include "gtest/gtest.h"
+#include "CAmTelnetServer.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmRoutingSender.h"
+#include "CAmCommandSender.h"
+#include "CAmControlSender.h"
+#include "CAmRouter.h"
+
+namespace am
+{
+
+class CAmSocketHandler;
+class CAmDatabaseHandler;
+class CAmRoutingSender;
+class CAmCommandSender;
+class CAmControlSender;
+class CAmRouter;
+class CAmCommandReceiver;
+class CAmRoutingReceiver;
+class CAmControlReceiver;
+class CAmTelnetServer;
+
+
+class CAmEnvironment : public ::testing::Environment
+{
+ public:
+ CAmEnvironment();
+
+ ~CAmEnvironment();
+ // Override this to define how to set up the environment.
+ void SetUp();
+ // Override this to define how to tear down the environment.
+ void TearDown();
+
+ void setSocketHandler(CAmSocketHandler* pSocketHandler);
+
+ void stopSocketHandler();
+
+ std::vector<std::string> mlistRoutingPluginDirs;
+ std::vector<std::string> mlistCommandPluginDirs;
+
+ //SocketHandler* mpSocketHandler;
+ CAmDatabaseHandler mDatabasehandler;
+ CAmRoutingSender mRoutingSender;
+ CAmCommandSender mCommandSender;
+ CAmControlSender mControlSender;
+ CAmRouter mRouter;
+
+ CAmCommandReceiver* mpCommandReceiver;
+ CAmRoutingReceiver* mpRoutingReceiver;
+ CAmControlReceiver* mpControlReceiver;
+
+ CAmTelnetServer* mpTelnetServer;
+
+ pthread_t mSocketHandlerThread;
+};
+
+class CAmTelnetServerTest : public ::testing::Test
+{
+ public:
+ CAmTelnetServerTest();
+ ~CAmTelnetServerTest();
+
+
+ void SetUp() ;
+
+ void TearDown() ;
+
+ //int mSocket;
+};
+
+}
+
+
+
+
+#endif /* CAMTELNETSERVERTEST_H_ */
diff --git a/AudioManagerDaemon/test/telnetserver/CMakeLists.txt b/AudioManagerDaemon/test/AmTelnetServerTest/CMakeLists.txt
index ff6d90d..c70ec2d 100644
--- a/AudioManagerDaemon/test/telnetserver/CMakeLists.txt
+++ b/AudioManagerDaemon/test/AmTelnetServerTest/CMakeLists.txt
@@ -23,16 +23,16 @@
cmake_minimum_required(VERSION 2.6)
-PROJECT(telnetServerText)
+PROJECT(AmTelnetServerTest)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
set(STD_INCLUDE_DIRS "/usr/include")
set(DBUS_FOLDER ${CMAKE_SOURCE_DIR}/../../../dbusInterfaces)
-set(AUDIO_INCLUDES_FOLDER ${CMAKE_SOURCE_DIR}/../../../includes)
-set(DBUS_INCLUDES_FOLDER ${CMAKE_SOURCE_DIR}/../../../../dbusIncludes)
-set(INCLUDES_FOLDER ${CMAKE_SOURCE_DIR}/../../include)
+set(AUDIO_include_FOLDER ${CMAKE_SOURCE_DIR}/../../../include)
+set(DBUS_include_FOLDER ${CMAKE_SOURCE_DIR}/../../../../dbusinclude)
+set(include_FOLDER ${CMAKE_SOURCE_DIR}/../../include)
FIND_PACKAGE(PkgConfig)
@@ -40,37 +40,37 @@ pkg_check_modules(DLT REQUIRED automotive-dlt)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDES_FOLDER}
+ ${DBUS_include_FOLDER}
${CMAKE_SOURCE_DIR}
${STD_INCLUDE_DIRS}
${DLT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIR}
${GTEST_INCLUDE_DIR}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
)
file(GLOB TELNET_SRCS_CXX
- "../../src/CommandReceiver.cpp"
- "../../src/CommandSender.cpp"
- "../../src/ControlReceiver.cpp"
- "../../src/ControlSender.cpp"
- "../../src/DatabaseHandler.cpp"
- "../../src/DatabaseObserver.cpp"
- "../../src/RoutingReceiver.cpp"
- "../../src/RoutingSender.cpp"
- "../../src/SocketHandler.cpp"
- "../../src/TelnetServer.cpp"
- "../../src/Router.cpp"
- "../../src/DLTWrapper.cpp"
+ "../../src/CAmCommandReceiver.cpp"
+ "../../src/CAmCommandSender.cpp"
+ "../../src/CAmControlReceiver.cpp"
+ "../../src/CAmControlSender.cpp"
+ "../../src/CAmDatabaseHandler.cpp"
+ "../../src/CAmDatabaseObserver.cpp"
+ "../../src/CAmRoutingReceiver.cpp"
+ "../../src/CAmRoutingSender.cpp"
+ "../../src/CAmSocketHandler.cpp"
+ "../../src/CAmTelnetServer.cpp"
+ "../../src/CAmRouter.cpp"
+ "../../src/CAmDltWrapper.cpp"
"../../src/CAmTelnetMenuHelper.cpp"
"*.cpp"
)
-ADD_EXECUTABLE(telnetServerTest ${TELNET_SRCS_CXX})
+ADD_EXECUTABLE(AmTelnetServerTest ${TELNET_SRCS_CXX})
-TARGET_LINK_LIBRARIES(telnetServerTest
+TARGET_LINK_LIBRARIES(AmTelnetServerTest
${SQLITE_LIBRARIES}
${DLT_LIBRARIES}
${DBUS_LIBRARY}
@@ -80,8 +80,8 @@ TARGET_LINK_LIBRARIES(telnetServerTest
gmock
)
-INSTALL(TARGETS telnetServerTest
- DESTINATION "~/TelnetServerTest/"
+INSTALL(TARGETS AmTelnetServerTest
+ DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
)
diff --git a/AudioManagerDaemon/test/CommonFunctions.cpp b/AudioManagerDaemon/test/CAmCommonFunctions.cpp
index 101548c..5136e59 100644
--- a/AudioManagerDaemon/test/CommonFunctions.cpp
+++ b/AudioManagerDaemon/test/CAmCommonFunctions.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file CommonFunctions.cpp
+ * \file CAmCommonFunctions.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -23,23 +23,23 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "CommonFunctions.h"
-#include "CommandInterfaceBackdoor.h"
-#include "RoutingInterfaceBackdoor.h"
-#include "ControlInterfaceBackdoor.h"
+#include "CAmCommonFunctions.h"
+#include "IAmCommandBackdoor.h"
+#include "IAmRoutingBackdoor.h"
+#include "IAmControlBackdoor.h"
#include <cassert>
#include <sstream>
using namespace am;
-CommandInterfaceBackdoor::CommandInterfaceBackdoor()
+IAmCommandBackdoor::IAmCommandBackdoor()
{
}
-CommandInterfaceBackdoor::~CommandInterfaceBackdoor()
+IAmCommandBackdoor::~IAmCommandBackdoor()
{
}
-bool CommandInterfaceBackdoor::unloadPlugins(CommandSender *CommandSender)
+bool IAmCommandBackdoor::unloadPlugins(CAmCommandSender *CommandSender)
{
assert(CommandSender != NULL);
CommandSender->unloadLibraries();
@@ -49,7 +49,7 @@ bool CommandInterfaceBackdoor::unloadPlugins(CommandSender *CommandSender)
return false;
}
-bool CommandInterfaceBackdoor::injectInterface(CommandSender *CommandSender, CommandSendInterface *CommandSendInterface)
+bool IAmCommandBackdoor::injectInterface(CAmCommandSender *CommandSender, IAmCommandSend *CommandSendInterface)
{
assert(CommandSender != NULL);
assert(CommandSendInterface != NULL);
@@ -57,14 +57,14 @@ bool CommandInterfaceBackdoor::injectInterface(CommandSender *CommandSender, Com
return true;
}
-RoutingInterfaceBackdoor::RoutingInterfaceBackdoor()
+IAmRoutingBackdoor::IAmRoutingBackdoor()
{
}
-RoutingInterfaceBackdoor::~RoutingInterfaceBackdoor()
+IAmRoutingBackdoor::~IAmRoutingBackdoor()
{
}
-bool RoutingInterfaceBackdoor::unloadPlugins(RoutingSender *RoutingSender)
+bool IAmRoutingBackdoor::unloadPlugins(CAmRoutingSender *RoutingSender)
{
assert(RoutingSender != NULL);
RoutingSender->unloadLibraries();
@@ -74,27 +74,27 @@ bool RoutingInterfaceBackdoor::unloadPlugins(RoutingSender *RoutingSender)
return false;
}
-bool RoutingInterfaceBackdoor::injectInterface(RoutingSender *RoutingSender, RoutingSendInterface *newInterface, const std::string& busname)
+bool IAmRoutingBackdoor::injectInterface(CAmRoutingSender *RoutingSender, IAmRoutingSend *newInterface, const std::string& busname)
{
assert(RoutingSender != NULL);
assert(newInterface != NULL);
- RoutingSender::InterfaceNamePairs newInterfacePair;
+ CAmRoutingSender::InterfaceNamePairs newInterfacePair;
newInterfacePair.routingInterface = newInterface;
newInterfacePair.busName = busname;
RoutingSender->mListInterfaces.push_back(newInterfacePair);
return true;
}
-ControlInterfaceBackdoor::ControlInterfaceBackdoor()
+IAmControlBackdoor::IAmControlBackdoor()
{
}
-ControlInterfaceBackdoor::~ControlInterfaceBackdoor()
+IAmControlBackdoor::~IAmControlBackdoor()
{
}
-bool ControlInterfaceBackdoor::replaceController(ControlSender *controlSender, ControlSendInterface *newController)
+bool IAmControlBackdoor::replaceController(CAmControlSender *controlSender, IAmControlSend *newController)
{
controlSender->mController = newController;
return true;
@@ -131,29 +131,29 @@ std::string int2string(int i)
return out.str();
}
-bool CommonFunctions::compareSource(std::vector<am_Source_s>::iterator listIterator, const am_Source_s& sourceData)
+bool CAmCommonFunctions::compareSource(std::vector<am_Source_s>::iterator listIterator, const am_Source_s& sourceData)
{
return (listIterator->available.availability == sourceData.available.availability) && (listIterator->available.availabilityReason == sourceData.available.availabilityReason) && (listIterator->sourceClassID == sourceData.sourceClassID) && (listIterator->domainID == sourceData.domainID) && (listIterator->interruptState == sourceData.interruptState) && (listIterator->visible == sourceData.visible) && (listIterator->name.compare(sourceData.name) == 0) && (listIterator->volume == sourceData.volume) && std::equal(listIterator->listConnectionFormats.begin(), listIterator->listConnectionFormats.end(), sourceData.listConnectionFormats.begin())
&& std::equal(listIterator->listMainSoundProperties.begin(), listIterator->listMainSoundProperties.end(), sourceData.listMainSoundProperties.begin(), equalMainSoundProperty) && std::equal(listIterator->listSoundProperties.begin(), listIterator->listSoundProperties.end(), sourceData.listSoundProperties.begin(), equalSoundProperty);
}
-bool CommonFunctions::compareSink(std::vector<am_Sink_s>::iterator listIterator, const am_Sink_s& sinkData)
+bool CAmCommonFunctions::compareSink(std::vector<am_Sink_s>::iterator listIterator, const am_Sink_s& sinkData)
{
return (listIterator->available.availability == sinkData.available.availability) && (listIterator->available.availabilityReason == sinkData.available.availabilityReason) && (listIterator->sinkClassID == sinkData.sinkClassID) && (listIterator->domainID == sinkData.domainID) && (listIterator->mainVolume == sinkData.mainVolume) && (listIterator->muteState == sinkData.muteState) && (listIterator->visible == sinkData.visible) && (listIterator->name.compare(sinkData.name) == 0) && (listIterator->volume == sinkData.volume) && std::equal(listIterator->listConnectionFormats.begin(), listIterator->listConnectionFormats.end(), sinkData.listConnectionFormats.begin())
&& std::equal(listIterator->listMainSoundProperties.begin(), listIterator->listMainSoundProperties.end(), sinkData.listMainSoundProperties.begin(), equalMainSoundProperty) && std::equal(listIterator->listSoundProperties.begin(), listIterator->listSoundProperties.end(), sinkData.listSoundProperties.begin(), equalSoundProperty);
}
-bool CommonFunctions::compareGateway(std::vector<am_Gateway_s>::iterator listIterator, const am_Gateway_s& gatewayData)
+bool CAmCommonFunctions::compareGateway(std::vector<am_Gateway_s>::iterator listIterator, const am_Gateway_s& gatewayData)
{
return (listIterator->name.compare(gatewayData.name) == 0) && (listIterator->sinkID == gatewayData.sinkID) && (listIterator->sourceID == gatewayData.sourceID) && (listIterator->controlDomainID == gatewayData.controlDomainID) && (listIterator->domainSinkID == gatewayData.domainSinkID) && (listIterator->domainSourceID == gatewayData.domainSourceID) && std::equal(listIterator->convertionMatrix.begin(), listIterator->convertionMatrix.end(), gatewayData.convertionMatrix.begin()) && std::equal(listIterator->listSourceFormats.begin(), listIterator->listSourceFormats.end(), gatewayData.listSourceFormats.begin()) && std::equal(listIterator->listSinkFormats.begin(), listIterator->listSinkFormats.end(), gatewayData.listSinkFormats.begin());
}
-bool CommonFunctions::compareGateway1(const am_Gateway_s gateway1, const am_Gateway_s gatewayData)
+bool CAmCommonFunctions::compareGateway1(const am_Gateway_s gateway1, const am_Gateway_s gatewayData)
{
return (gateway1.name.compare(gatewayData.name) == 0) && (gateway1.sinkID == gatewayData.sinkID) && (gateway1.sourceID == gatewayData.sourceID) && (gateway1.controlDomainID == gatewayData.controlDomainID) && (gateway1.domainSinkID == gatewayData.domainSinkID) && (gateway1.domainSourceID == gatewayData.domainSourceID) && std::equal(gateway1.convertionMatrix.begin(), gateway1.convertionMatrix.end(), gatewayData.convertionMatrix.begin()) && std::equal(gateway1.listSourceFormats.begin(), gateway1.listSourceFormats.end(), gatewayData.listSourceFormats.begin()) && std::equal(gateway1.listSinkFormats.begin(), gateway1.listSinkFormats.end(), gatewayData.listSinkFormats.begin());
}
-bool CommonFunctions::compareSinkMainSink(std::vector<am_SinkType_s>::iterator listIterator, const std::vector<am_Sink_s>& sinkList)
+bool CAmCommonFunctions::compareSinkMainSink(std::vector<am_SinkType_s>::iterator listIterator, const std::vector<am_Sink_s>& sinkList)
{
std::vector<am_Sink_s>::const_iterator sinkListIterator = sinkList.begin();
for (; sinkListIterator < sinkList.end(); ++sinkListIterator)
@@ -166,7 +166,7 @@ bool CommonFunctions::compareSinkMainSink(std::vector<am_SinkType_s>::iterator l
return false;
}
-bool CommonFunctions::compareSinkMainSource(std::vector<am_SourceType_s>::iterator listIterator, const std::vector<am_Source_s>& sourceList)
+bool CAmCommonFunctions::compareSinkMainSource(std::vector<am_SourceType_s>::iterator listIterator, const std::vector<am_Source_s>& sourceList)
{
std::vector<am_Source_s>::const_iterator sinkListIterator = sourceList.begin();
for (; sinkListIterator < sourceList.end(); ++sinkListIterator)
@@ -179,7 +179,7 @@ bool CommonFunctions::compareSinkMainSource(std::vector<am_SourceType_s>::iterat
return false;
}
-bool CommonFunctions::compareRoute(am_Route_s a, am_Route_s b)
+bool CAmCommonFunctions::compareRoute(am_Route_s a, am_Route_s b)
{
bool retVal = true;
std::vector<am_RoutingElement_s>::iterator itA = a.route.begin(), itB = b.route.begin();
@@ -196,7 +196,7 @@ bool CommonFunctions::compareRoute(am_Route_s a, am_Route_s b)
return retVal;
}
-std::vector<am_ConnectionFormat_e> CommonFunctions::getStandardConnectionFormatList()
+std::vector<am_ConnectionFormat_e> CAmCommonFunctions::getStandardConnectionFormatList()
{
std::vector<am_ConnectionFormat_e> list;
list.push_back(CF_GENIVI_ANALOG);
@@ -204,7 +204,7 @@ std::vector<am_ConnectionFormat_e> CommonFunctions::getStandardConnectionFormatL
return list;
}
-std::vector<am_SoundProperty_s> CommonFunctions::getStandardSoundPropertyList()
+std::vector<am_SoundProperty_s> CAmCommonFunctions::getStandardSoundPropertyList()
{
std::vector<am_SoundProperty_s> soundPropertyList;
am_SoundProperty_s soundProperty;
@@ -217,7 +217,7 @@ std::vector<am_SoundProperty_s> CommonFunctions::getStandardSoundPropertyList()
return soundPropertyList;
}
-std::vector<am_MainSoundProperty_s> CommonFunctions::getStandardMainSoundPropertyList()
+std::vector<am_MainSoundProperty_s> CAmCommonFunctions::getStandardMainSoundPropertyList()
{
std::vector<am_MainSoundProperty_s> mainSoundPropertyList;
am_MainSoundProperty_s mainSoundProperty;
@@ -230,7 +230,7 @@ std::vector<am_MainSoundProperty_s> CommonFunctions::getStandardMainSoundPropert
return mainSoundPropertyList;
}
-void CommonFunctions::createSink(am_Sink_s& sink) const
+void CAmCommonFunctions::createSink(am_Sink_s& sink) const
{
sink.name = "AnySink";
sink.domainID = 4;
@@ -247,7 +247,7 @@ void CommonFunctions::createSink(am_Sink_s& sink) const
sink.sinkID = 0;
}
-void CommonFunctions::createSource(am_Source_s& source) const
+void CAmCommonFunctions::createSource(am_Source_s& source) const
{
source.name = "AnySource";
source.domainID = 4;
@@ -264,7 +264,7 @@ void CommonFunctions::createSource(am_Source_s& source) const
source.sourceState = SS_ON;
}
-void CommonFunctions::createDomain(am_Domain_s & domain) const
+void CAmCommonFunctions::createDomain(am_Domain_s & domain) const
{
domain.domainID = 0;
@@ -276,7 +276,7 @@ void CommonFunctions::createDomain(am_Domain_s & domain) const
domain.state = DS_CONTROLLED;
}
-void CommonFunctions::createGateway(am_Gateway_s & gateway)
+void CAmCommonFunctions::createGateway(am_Gateway_s & gateway)
{
gateway.name = "AnyGateway";
gateway.sinkID = 1;
@@ -291,7 +291,7 @@ void CommonFunctions::createGateway(am_Gateway_s & gateway)
}
-void CommonFunctions::createConnection(am_Connection_s & connection) const
+void CAmCommonFunctions::createConnection(am_Connection_s & connection) const
{
connection.connectionID = 0;
connection.sinkID = 1;
@@ -300,7 +300,7 @@ void CommonFunctions::createConnection(am_Connection_s & connection) const
connection.connectionFormat = CF_GENIVI_ANALOG;
}
-std::vector<bool> CommonFunctions::getStandardConvertionMatrix()
+std::vector<bool> CAmCommonFunctions::getStandardConvertionMatrix()
{
std::vector<bool> convMatrix;
convMatrix.push_back(true);
@@ -312,7 +312,7 @@ std::vector<bool> CommonFunctions::getStandardConvertionMatrix()
return convMatrix;
}
-void CommonFunctions::connectionList2RoutingList(std::vector<am_RoutingElement_s> & routingList, const std::vector<am_Connection_s>& connectionList)
+void CAmCommonFunctions::connectionList2RoutingList(std::vector<am_RoutingElement_s> & routingList, const std::vector<am_Connection_s>& connectionList)
{
am_RoutingElement_s routingElement;
std::vector<am_Connection_s>::const_iterator cIterator = connectionList.begin();
diff --git a/AudioManagerDaemon/test/CommonFunctions.h b/AudioManagerDaemon/test/CAmCommonFunctions.h
index 6e5a996..9d6b5e6 100644
--- a/AudioManagerDaemon/test/CommonFunctions.h
+++ b/AudioManagerDaemon/test/CAmCommonFunctions.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file CommonFunctions.h
+ * \file CAmCommonFunctions.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -31,7 +31,7 @@
namespace am
{
-class CommonFunctions
+class CAmCommonFunctions
{
public:
diff --git a/AudioManagerDaemon/test/CMakeLists.txt b/AudioManagerDaemon/test/CMakeLists.txt
index f7243ad..97600a9 100644
--- a/AudioManagerDaemon/test/CMakeLists.txt
+++ b/AudioManagerDaemon/test/CMakeLists.txt
@@ -27,9 +27,9 @@ cmake_minimum_required(VERSION 2.6)
set(EXECUTABLE_OUTPUT_PATH ${TEST_EXECUTABLE_OUTPUT_PATH})
FIND_PACKAGE(GTest REQUIRED)
-add_subdirectory (database)
-add_subdirectory (routing)
-add_subdirectory (routingInterface)
-add_subdirectory (controlInterface)
-add_subdirectory (sockethandler)
-add_subdirectory (telnetserver)
+add_subdirectory (AmControlInterfaceTest)
+add_subdirectory (AmDatabaseHandlerTest)
+add_subdirectory (AmRouterTest)
+add_subdirectory (AmRoutingInterfaceTest)
+add_subdirectory (AmSocketHandlerTest)
+add_subdirectory (AmTelnetServerTest)
diff --git a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h b/AudioManagerDaemon/test/IAmCommandBackdoor.h
index 5d06fb1..650d3e1 100644
--- a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/IAmCommandBackdoor.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file CommandInterfaceBackdoor.h
+ * \file IAmCommandBackdoor
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,25 +26,25 @@
#ifndef COMMANDINTERFACEBACKDOOR_H_
#define COMMANDINTERFACEBACKDOOR_H_
-#include <command/CommandSendInterface.h>
-#include "CommandSender.h"
+#include <command/IAmCommandSend.h>
+#include "CAmCommandSender.h"
namespace am
{
-class CommandSender;
+class CAmCommandSender;
-class CommandInterfaceBackdoor
+class IAmCommandBackdoor
{
public:
- CommandInterfaceBackdoor();
- virtual ~CommandInterfaceBackdoor();
- bool unloadPlugins(CommandSender *CommandSender);
- bool injectInterface(CommandSender* CommandSender, CommandSendInterface* CommandSendInterface);
+ IAmCommandBackdoor();
+ virtual ~IAmCommandBackdoor();
+ bool unloadPlugins(CAmCommandSender *CommandSender);
+ bool injectInterface(CAmCommandSender* CommandSender, IAmCommandSend* CommandSendInterface);
};
}
-//definitions are in CommonFunctions.cpp!
+//definitions are in CAmCommonFunctions.cpp!
#endif /* COMMANDINTERFACEBACKDOOR_H_ */
diff --git a/AudioManagerDaemon/test/ControlInterfaceBackdoor.h b/AudioManagerDaemon/test/IAmControlBackdoor.h
index 135bc48..90a2c67 100644
--- a/AudioManagerDaemon/test/ControlInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/IAmControlBackdoor.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file ControlInterfaceBackdoor.h
+ * \file IAmControlBackdoor.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,20 +26,20 @@
#ifndef CONTROLINTERFACEBACKDOOR_H_
#define CONTROLINTERFACEBACKDOOR_H_
-#include "control/ControlSendInterface.h"
-#include "ControlSender.h"
+#include "control/IAmControlSend.h"
+#include "CAmControlSender.h"
namespace am
{
-class ControlSender;
+class CAmControlSender;
-class ControlInterfaceBackdoor
+class IAmControlBackdoor
{
public:
- ControlInterfaceBackdoor();
- virtual ~ControlInterfaceBackdoor();
- bool replaceController(ControlSender *controlSender, ControlSendInterface *newController);
+ IAmControlBackdoor();
+ virtual ~IAmControlBackdoor();
+ bool replaceController(CAmControlSender *controlSender, IAmControlSend *newController);
};
}
diff --git a/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h b/AudioManagerDaemon/test/IAmRoutingBackdoor.h
index ff7ffdb..9ffff54 100644
--- a/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/IAmRoutingBackdoor.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
- * \file RoutingInterfaceBackdoor.h
+ * \file IAmRoutingBackdoor.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,24 +26,24 @@
#ifndef ROUTINGINTERFACEBACKDOOR_H_
#define ROUTINGINTERFACEBACKDOOR_H_
-#include "RoutingSender.h"
+#include "CAmRoutingSender.h"
namespace am
{
-class RoutingSender;
+class CAmRoutingSender;
-class RoutingInterfaceBackdoor
+class IAmRoutingBackdoor
{
public:
- RoutingInterfaceBackdoor();
- virtual ~RoutingInterfaceBackdoor();
- bool unloadPlugins(RoutingSender *RoutingSender);
- bool injectInterface(RoutingSender *RoutingSender, RoutingSendInterface *newInterface, const std::string& busname);
+ IAmRoutingBackdoor();
+ virtual ~IAmRoutingBackdoor();
+ bool unloadPlugins(CAmRoutingSender *RoutingSender);
+ bool injectInterface(CAmRoutingSender *RoutingSender, IAmRoutingSend *newInterface, const std::string& busname);
};
}
-//definitions are in CommonFunctions.cpp!
+//definitions are in CAmCommonFunctions.cpp!
#endif /* ROUTINGINTERFACEBACKDOOR_H_ */
diff --git a/AudioManagerDaemon/test/MockIAmCommandSend.h b/AudioManagerDaemon/test/MockIAmCommandSend.h
new file mode 100644
index 0000000..1833511
--- /dev/null
+++ b/AudioManagerDaemon/test/MockIAmCommandSend.h
@@ -0,0 +1,82 @@
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file MockInterfaces.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
+
+#ifndef MOCKCOMMANDINTERFACE_H_
+#define MOCKCOMMANDINTERFACE_H_
+
+#include "command/IAmCommandSend.h"
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+namespace am {
+
+class MockIAmCommandSend : public IAmCommandSend {
+ public:
+ MOCK_METHOD1(startupInterface,
+ am_Error_e(IAmCommandReceive* commandreceiveinterface));
+ MOCK_METHOD1(setCommandReady,
+ void(const uint16_t handle));
+ MOCK_METHOD1(setCommandRundown,
+ void(const uint16_t handle));
+ MOCK_METHOD1(cbNewMainConnection,
+ void(const am_MainConnectionType_s mainConnection));
+ MOCK_METHOD1(cbRemovedMainConnection,
+ void(const am_mainConnectionID_t mainConnection));
+ MOCK_METHOD1(cbNewSink,
+ void(const am_SinkType_s& sink));
+ MOCK_METHOD1(cbRemovedSink,
+ void(const am_sinkID_t sinkID));
+ MOCK_METHOD1(cbNewSource,
+ void(const am_SourceType_s& source));
+ MOCK_METHOD1(cbRemovedSource,
+ void(const am_sourceID_t source));
+ MOCK_METHOD0(cbNumberOfSinkClassesChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSourceClassesChanged,
+ void());
+ MOCK_METHOD2(cbMainConnectionStateChanged,
+ void(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState));
+ MOCK_METHOD2(cbMainSinkSoundPropertyChanged,
+ void(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD2(cbMainSourceSoundPropertyChanged,
+ void(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD2(cbSinkAvailabilityChanged,
+ void(const am_sinkID_t sinkID, const am_Availability_s& availability));
+ MOCK_METHOD2(cbSourceAvailabilityChanged,
+ void(const am_sourceID_t sourceID, const am_Availability_s& availability));
+ MOCK_METHOD2(cbVolumeChanged,
+ void(const am_sinkID_t sinkID, const am_mainVolume_t volume));
+ MOCK_METHOD2(cbSinkMuteStateChanged,
+ void(const am_sinkID_t sinkID, const am_MuteState_e muteState));
+ MOCK_METHOD1(cbSystemPropertyChanged,
+ void(const am_SystemProperty_s& systemProperty));
+ MOCK_METHOD2(cbTimingInformationChanged,
+ void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
+ MOCK_CONST_METHOD1(getInterfaceVersion,
+ void(std::string& version));
+};
+
+} // namespace am
+#endif /* MOCKCOMMANDINTERFACE_H_ */
diff --git a/AudioManagerDaemon/test/MockIAmControlSend.h b/AudioManagerDaemon/test/MockIAmControlSend.h
new file mode 100644
index 0000000..dc45fab
--- /dev/null
+++ b/AudioManagerDaemon/test/MockIAmControlSend.h
@@ -0,0 +1,134 @@
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file MockInterfaces.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
+
+#ifndef MOCKCONTROLINTERFACE_H_
+#define MOCKCONTROLINTERFACE_H_
+
+#include "control/IAmControlSend.h"
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+namespace am {
+
+class MockIAmControlSend : public IAmControlSend {
+ public:
+ MOCK_METHOD1(startupController,
+ am_Error_e(IAmControlReceive* controlreceiveinterface));
+ MOCK_METHOD0(setControllerReady,
+ void());
+ MOCK_METHOD0(setControllerRundown,
+ void());
+ MOCK_METHOD3(hookUserConnectionRequest,
+ am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID));
+ MOCK_METHOD1(hookUserDisconnectionRequest,
+ am_Error_e(const am_mainConnectionID_t connectionID));
+ MOCK_METHOD2(hookUserSetMainSinkSoundProperty,
+ am_Error_e(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD2(hookUserSetMainSourceSoundProperty,
+ am_Error_e(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD1(hookUserSetSystemProperty,
+ am_Error_e(const am_SystemProperty_s& property));
+ MOCK_METHOD2(hookUserVolumeChange,
+ am_Error_e(const am_sinkID_t SinkID, const am_mainVolume_t newVolume));
+ MOCK_METHOD2(hookUserVolumeStep,
+ am_Error_e(const am_sinkID_t SinkID, const int16_t increment));
+ MOCK_METHOD2(hookUserSetSinkMuteState,
+ am_Error_e(const am_sinkID_t sinkID, const am_MuteState_e muteState));
+ MOCK_METHOD2(hookSystemRegisterDomain,
+ am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
+ MOCK_METHOD1(hookSystemDeregisterDomain,
+ am_Error_e(const am_domainID_t domainID));
+ MOCK_METHOD1(hookSystemDomainRegistrationComplete,
+ void(const am_domainID_t domainID));
+ MOCK_METHOD2(hookSystemRegisterSink,
+ am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
+ MOCK_METHOD1(hookSystemDeregisterSink,
+ am_Error_e(const am_sinkID_t sinkID));
+ MOCK_METHOD2(hookSystemRegisterSource,
+ am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
+ MOCK_METHOD1(hookSystemDeregisterSource,
+ am_Error_e(const am_sourceID_t sourceID));
+ MOCK_METHOD2(hookSystemRegisterGateway,
+ am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
+ MOCK_METHOD1(hookSystemDeregisterGateway,
+ am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD2(hookSystemRegisterCrossfader,
+ am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
+ MOCK_METHOD1(hookSystemDeregisterCrossfader,
+ am_Error_e(const am_crossfaderID_t crossfaderID));
+ MOCK_METHOD3(hookSystemSinkVolumeTick,
+ void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
+ MOCK_METHOD3(hookSystemSourceVolumeTick,
+ void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
+ MOCK_METHOD2(hookSystemInterruptStateChange,
+ void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
+ MOCK_METHOD2(hookSystemSinkAvailablityStateChange,
+ void(const am_sinkID_t sinkID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookSystemSourceAvailablityStateChange,
+ void(const am_sourceID_t sourceID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookSystemDomainStateChange,
+ void(const am_domainID_t domainID, const am_DomainState_e state));
+ MOCK_METHOD1(hookSystemReceiveEarlyData,
+ void(const std::vector<am_EarlyData_s>& data));
+ MOCK_METHOD1(hookSystemSpeedChange,
+ void(const am_speed_t speed));
+ MOCK_METHOD2(hookSystemTimingInformationChanged,
+ void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
+ MOCK_METHOD2(cbAckConnect,
+ void(const am_Handle_s handle, const am_Error_e errorID));
+ MOCK_METHOD2(cbAckDisconnect,
+ void(const am_Handle_s handle, const am_Error_e errorID));
+ MOCK_METHOD3(cbAckCrossFade,
+ void(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error));
+ MOCK_METHOD3(cbAckSetSinkVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
+ MOCK_METHOD3(cbAckSetSourceVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSourceState,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSourceSoundProperties,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSourceSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSinkSoundProperties,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSinkSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD5(getConnectionFormatChoice,
+ am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats));
+ MOCK_CONST_METHOD1(getInterfaceVersion,
+ void(std::string& version));
+ MOCK_METHOD0(confirmCommandReady,
+ void());
+ MOCK_METHOD0(confirmRoutingReady,
+ void());
+ MOCK_METHOD0(confirmCommandRundown,
+ void());
+ MOCK_METHOD0(confirmRoutingRundown,
+ void());
+};
+
+} // namespace am
+#endif /* MOCKCONTROLINTERFACE_H_ */
diff --git a/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h b/AudioManagerDaemon/test/MockIAmRoutingSend.h
index 2c21fe6..4e6c6cb 100644
--- a/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h
+++ b/AudioManagerDaemon/test/MockIAmRoutingSend.h
@@ -26,16 +26,16 @@
#ifndef MOCKROUTINGINTERFACE_H_
#define MOCKROUTINGINTERFACE_H_
-#include <routing/RoutingSendInterface.h>
+#include "routing/IAmRoutingSend.h"
#include <gtest/gtest.h>
#include <gmock/gmock.h>
namespace am {
-class MockRoutingSendInterface : public RoutingSendInterface {
+class MockIAmRoutingSend : public IAmRoutingSend {
public:
MOCK_METHOD1(startupInterface,
- am_Error_e(RoutingReceiveInterface* routingreceiveinterface));
+ am_Error_e(IAmRoutingReceive* routingreceiveinterface));
MOCK_METHOD1(setRoutingReady,
void(const uint16_t handle));
MOCK_METHOD1(setRoutingRundown,
diff --git a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
deleted file mode 100644
index a341eee..0000000
--- a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file MockInterfaces.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-*/
-
-#ifndef MOCKROUTINGINTERFACE_H_
-#define MOCKROUTINGINTERFACE_H_
-
-#include <control/ControlSendInterface.h>
-#include <routing/RoutingSendInterface.h>
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-namespace am {
-
-class MockRoutingSendInterface : public RoutingSendInterface {
- public:
- MOCK_METHOD1(startupInterface,
- am_Error_e(RoutingReceiveInterface* routingreceiveinterface));
- MOCK_METHOD1(setRoutingReady,
- void(const uint16_t handle));
- MOCK_METHOD1(setRoutingRundown,
- void(const uint16_t handle));
- MOCK_METHOD1(asyncAbort,
- am_Error_e(const am_Handle_s handle));
- MOCK_METHOD5(asyncConnect,
- am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat));
- MOCK_METHOD2(asyncDisconnect,
- am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID));
- MOCK_METHOD5(asyncSetSinkVolume,
- am_Error_e(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time));
- MOCK_METHOD5(asyncSetSourceVolume,
- am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time));
- MOCK_METHOD3(asyncSetSourceState,
- am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state));
- MOCK_METHOD3(asyncSetSinkSoundProperties,
- am_Error_e(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties));
- MOCK_METHOD3(asyncSetSinkSoundProperty,
- am_Error_e(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty));
- MOCK_METHOD3(asyncSetSourceSoundProperties,
- am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties));
- MOCK_METHOD3(asyncSetSourceSoundProperty,
- am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty));
- MOCK_METHOD5(asyncCrossFade,
- am_Error_e(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time));
- MOCK_METHOD2(setDomainState,
- am_Error_e(const am_domainID_t domainID, const am_DomainState_e domainState));
- MOCK_CONST_METHOD1(returnBusName,
- am_Error_e(std::string& BusName));
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
-
-};
-
-
-
-class MockControlSendInterface : public ControlSendInterface {
- public:
- MOCK_METHOD1(startupController,
- am_Error_e(ControlReceiveInterface* controlreceiveinterface));
- MOCK_METHOD0(setControllerReady,
- void());
- MOCK_METHOD0(setControllerRundown,
- void());
- MOCK_METHOD3(hookUserConnectionRequest,
- am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID));
- MOCK_METHOD1(hookUserDisconnectionRequest,
- am_Error_e(const am_mainConnectionID_t connectionID));
- MOCK_METHOD2(hookUserSetMainSinkSoundProperty,
- am_Error_e(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD2(hookUserSetMainSourceSoundProperty,
- am_Error_e(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD1(hookUserSetSystemProperty,
- am_Error_e(const am_SystemProperty_s& property));
- MOCK_METHOD2(hookUserVolumeChange,
- am_Error_e(const am_sinkID_t SinkID, const am_mainVolume_t newVolume));
- MOCK_METHOD2(hookUserVolumeStep,
- am_Error_e(const am_sinkID_t SinkID, const int16_t increment));
- MOCK_METHOD2(hookUserSetSinkMuteState,
- am_Error_e(const am_sinkID_t sinkID, const am_MuteState_e muteState));
- MOCK_METHOD2(hookSystemRegisterDomain,
- am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
- MOCK_METHOD1(hookSystemDeregisterDomain,
- am_Error_e(const am_domainID_t domainID));
- MOCK_METHOD1(hookSystemDomainRegistrationComplete,
- void(const am_domainID_t domainID));
- MOCK_METHOD2(hookSystemRegisterSink,
- am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
- MOCK_METHOD1(hookSystemDeregisterSink,
- am_Error_e(const am_sinkID_t sinkID));
- MOCK_METHOD2(hookSystemRegisterSource,
- am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
- MOCK_METHOD1(hookSystemDeregisterSource,
- am_Error_e(const am_sourceID_t sourceID));
- MOCK_METHOD2(hookSystemRegisterGateway,
- am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
- MOCK_METHOD1(hookSystemDeregisterGateway,
- am_Error_e(const am_gatewayID_t gatewayID));
- MOCK_METHOD2(hookSystemRegisterCrossfader,
- am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
- MOCK_METHOD1(hookSystemDeregisterCrossfader,
- am_Error_e(const am_crossfaderID_t crossfaderID));
- MOCK_METHOD3(hookSystemSinkVolumeTick,
- void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
- MOCK_METHOD3(hookSystemSourceVolumeTick,
- void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
- MOCK_METHOD2(hookSystemInterruptStateChange,
- void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
- MOCK_METHOD2(hookSystemSinkAvailablityStateChange,
- void(const am_sinkID_t sinkID, const am_Availability_s& availability));
- MOCK_METHOD2(hookSystemSourceAvailablityStateChange,
- void(const am_sourceID_t sourceID, const am_Availability_s& availability));
- MOCK_METHOD2(hookSystemDomainStateChange,
- void(const am_domainID_t domainID, const am_DomainState_e state));
- MOCK_METHOD1(hookSystemReceiveEarlyData,
- void(const std::vector<am_EarlyData_s>& data));
- MOCK_METHOD1(hookSystemSpeedChange,
- void(const am_speed_t speed));
- MOCK_METHOD2(hookSystemTimingInformationChanged,
- void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
- MOCK_METHOD2(cbAckConnect,
- void(const am_Handle_s handle, const am_Error_e errorID));
- MOCK_METHOD2(cbAckDisconnect,
- void(const am_Handle_s handle, const am_Error_e errorID));
- MOCK_METHOD3(cbAckCrossFade,
- void(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error));
- MOCK_METHOD3(cbAckSetSinkVolumeChange,
- void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
- MOCK_METHOD3(cbAckSetSourceVolumeChange,
- void(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceState,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSinkSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSinkSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD5(getConnectionFormatChoice,
- am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats));
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
- MOCK_METHOD0(confirmCommandReady,
- void());
- MOCK_METHOD0(confirmRoutingReady,
- void());
- MOCK_METHOD0(confirmCommandRundown,
- void());
- MOCK_METHOD0(confirmRoutingRundown,
- void());
-
-};
-
-
-
-
-} // namespace am
-
-
-
-#endif /* MOCKROUTINGINTERFACE_H_ */
diff --git a/AudioManagerDaemon/test/database/MockInterfaces.h b/AudioManagerDaemon/test/database/MockInterfaces.h
deleted file mode 100644
index 453add8..0000000
--- a/AudioManagerDaemon/test/database/MockInterfaces.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file MockInterfaces.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
-
-#ifndef MOCKROUTINGINTERFACE_H_
-#define MOCKROUTINGINTERFACE_H_
-
-#include <control/ControlSendInterface.h>
-#include <command/CommandSendInterface.h>
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-namespace am {
-
-class MockCommandSendInterface : public CommandSendInterface {
- public:
- MOCK_METHOD1(startupInterface,
- am_Error_e(CommandReceiveInterface* commandreceiveinterface));
- MOCK_METHOD1(setCommandReady,
- void(const uint16_t handle));
- MOCK_METHOD1(setCommandRundown,
- void(const uint16_t handle));
- MOCK_METHOD1(cbNewMainConnection,
- void(const am_MainConnectionType_s mainConnection));
- MOCK_METHOD1(cbRemovedMainConnection,
- void(const am_mainConnectionID_t mainConnection));
- MOCK_METHOD1(cbNewSink,
- void(const am_SinkType_s& sink));
- MOCK_METHOD1(cbRemovedSink,
- void(const am_sinkID_t sinkID));
- MOCK_METHOD1(cbNewSource,
- void(const am_SourceType_s& source));
- MOCK_METHOD1(cbRemovedSource,
- void(const am_sourceID_t source));
- MOCK_METHOD0(cbNumberOfSinkClassesChanged,
- void());
- MOCK_METHOD0(cbNumberOfSourceClassesChanged,
- void());
- MOCK_METHOD2(cbMainConnectionStateChanged,
- void(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState));
- MOCK_METHOD2(cbMainSinkSoundPropertyChanged,
- void(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD2(cbMainSourceSoundPropertyChanged,
- void(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD2(cbSinkAvailabilityChanged,
- void(const am_sinkID_t sinkID, const am_Availability_s& availability));
- MOCK_METHOD2(cbSourceAvailabilityChanged,
- void(const am_sourceID_t sourceID, const am_Availability_s& availability));
- MOCK_METHOD2(cbVolumeChanged,
- void(const am_sinkID_t sinkID, const am_mainVolume_t volume));
- MOCK_METHOD2(cbSinkMuteStateChanged,
- void(const am_sinkID_t sinkID, const am_MuteState_e muteState));
- MOCK_METHOD1(cbSystemPropertyChanged,
- void(const am_SystemProperty_s& systemProperty));
- MOCK_METHOD2(cbTimingInformationChanged,
- void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
-
-};
-
-
-
-
-class MockControlSendInterface : public ControlSendInterface {
- public:
- MOCK_METHOD1(startupController,
- am_Error_e(ControlReceiveInterface* controlreceiveinterface));
- MOCK_METHOD0(setControllerReady,
- void());
- MOCK_METHOD0(setControllerRundown,
- void());
- MOCK_METHOD3(hookUserConnectionRequest,
- am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID));
- MOCK_METHOD1(hookUserDisconnectionRequest,
- am_Error_e(const am_mainConnectionID_t connectionID));
- MOCK_METHOD2(hookUserSetMainSinkSoundProperty,
- am_Error_e(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD2(hookUserSetMainSourceSoundProperty,
- am_Error_e(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD1(hookUserSetSystemProperty,
- am_Error_e(const am_SystemProperty_s& property));
- MOCK_METHOD2(hookUserVolumeChange,
- am_Error_e(const am_sinkID_t SinkID, const am_mainVolume_t newVolume));
- MOCK_METHOD2(hookUserVolumeStep,
- am_Error_e(const am_sinkID_t SinkID, const int16_t increment));
- MOCK_METHOD2(hookUserSetSinkMuteState,
- am_Error_e(const am_sinkID_t sinkID, const am_MuteState_e muteState));
- MOCK_METHOD2(hookSystemRegisterDomain,
- am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
- MOCK_METHOD1(hookSystemDeregisterDomain,
- am_Error_e(const am_domainID_t domainID));
- MOCK_METHOD1(hookSystemDomainRegistrationComplete,
- void(const am_domainID_t domainID));
- MOCK_METHOD2(hookSystemRegisterSink,
- am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
- MOCK_METHOD1(hookSystemDeregisterSink,
- am_Error_e(const am_sinkID_t sinkID));
- MOCK_METHOD2(hookSystemRegisterSource,
- am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
- MOCK_METHOD1(hookSystemDeregisterSource,
- am_Error_e(const am_sourceID_t sourceID));
- MOCK_METHOD2(hookSystemRegisterGateway,
- am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
- MOCK_METHOD1(hookSystemDeregisterGateway,
- am_Error_e(const am_gatewayID_t gatewayID));
- MOCK_METHOD2(hookSystemRegisterCrossfader,
- am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
- MOCK_METHOD1(hookSystemDeregisterCrossfader,
- am_Error_e(const am_crossfaderID_t crossfaderID));
- MOCK_METHOD3(hookSystemSinkVolumeTick,
- void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
- MOCK_METHOD3(hookSystemSourceVolumeTick,
- void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
- MOCK_METHOD2(hookSystemInterruptStateChange,
- void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
- MOCK_METHOD2(hookSystemSinkAvailablityStateChange,
- void(const am_sinkID_t sinkID, const am_Availability_s& availability));
- MOCK_METHOD2(hookSystemSourceAvailablityStateChange,
- void(const am_sourceID_t sourceID, const am_Availability_s& availability));
- MOCK_METHOD2(hookSystemDomainStateChange,
- void(const am_domainID_t domainID, const am_DomainState_e state));
- MOCK_METHOD1(hookSystemReceiveEarlyData,
- void(const std::vector<am_EarlyData_s>& data));
- MOCK_METHOD1(hookSystemSpeedChange,
- void(const am_speed_t speed));
- MOCK_METHOD2(hookSystemTimingInformationChanged,
- void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
- MOCK_METHOD2(cbAckConnect,
- void(const am_Handle_s handle, const am_Error_e errorID));
- MOCK_METHOD2(cbAckDisconnect,
- void(const am_Handle_s handle, const am_Error_e errorID));
- MOCK_METHOD3(cbAckCrossFade,
- void(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error));
- MOCK_METHOD3(cbAckSetSinkVolumeChange,
- void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
- MOCK_METHOD3(cbAckSetSourceVolumeChange,
- void(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceState,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSinkSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSinkSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD5(getConnectionFormatChoice,
- am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats));
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
- MOCK_METHOD0(confirmCommandReady,
- void());
- MOCK_METHOD0(confirmRoutingReady,
- void());
- MOCK_METHOD0(confirmCommandRundown,
- void());
- MOCK_METHOD0(confirmRoutingRundown,
- void());
-
-};
-
-} // namespace am
-
-
-
-#endif /* MOCKROUTINGINTERFACE_H_ */
diff --git a/AudioManagerDaemon/test/routing/MockInterfaces.h b/AudioManagerDaemon/test/routing/MockInterfaces.h
deleted file mode 100644
index ea527ac..0000000
--- a/AudioManagerDaemon/test/routing/MockInterfaces.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Copyright (C) 2011, BMW AG
- *
- * GeniviAudioMananger AudioManagerDaemon
- *
- * \file MockInterfaces.h
- *
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
- *
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
- */
-
-#ifndef MOCKROUTINGINTERFACE_H_
-#define MOCKROUTINGINTERFACE_H_
-
-#include <control/ControlSendInterface.h>
-#include <command/CommandSendInterface.h>
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-namespace am
-{
-
-class MockCommandSendInterface : public CommandSendInterface {
- public:
- MOCK_METHOD1(startupInterface,
- am_Error_e(CommandReceiveInterface* commandreceiveinterface));
- MOCK_METHOD1(setCommandReady,
- void(const uint16_t handle));
- MOCK_METHOD1(setCommandRundown,
- void(const uint16_t handle));
- MOCK_METHOD1(cbNewMainConnection,
- void(const am_MainConnectionType_s mainConnection));
- MOCK_METHOD1(cbRemovedMainConnection,
- void(const am_mainConnectionID_t mainConnection));
- MOCK_METHOD1(cbNewSink,
- void(const am_SinkType_s& sink));
- MOCK_METHOD1(cbRemovedSink,
- void(const am_sinkID_t sinkID));
- MOCK_METHOD1(cbNewSource,
- void(const am_SourceType_s& source));
- MOCK_METHOD1(cbRemovedSource,
- void(const am_sourceID_t source));
- MOCK_METHOD0(cbNumberOfSinkClassesChanged,
- void());
- MOCK_METHOD0(cbNumberOfSourceClassesChanged,
- void());
- MOCK_METHOD2(cbMainConnectionStateChanged,
- void(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState));
- MOCK_METHOD2(cbMainSinkSoundPropertyChanged,
- void(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD2(cbMainSourceSoundPropertyChanged,
- void(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD2(cbSinkAvailabilityChanged,
- void(const am_sinkID_t sinkID, const am_Availability_s& availability));
- MOCK_METHOD2(cbSourceAvailabilityChanged,
- void(const am_sourceID_t sourceID, const am_Availability_s& availability));
- MOCK_METHOD2(cbVolumeChanged,
- void(const am_sinkID_t sinkID, const am_mainVolume_t volume));
- MOCK_METHOD2(cbSinkMuteStateChanged,
- void(const am_sinkID_t sinkID, const am_MuteState_e muteState));
- MOCK_METHOD1(cbSystemPropertyChanged,
- void(const am_SystemProperty_s& systemProperty));
- MOCK_METHOD2(cbTimingInformationChanged,
- void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
-
-};
-
-
-class MockControlSendInterface : public ControlSendInterface {
- public:
- MOCK_METHOD1(startupController,
- am_Error_e(ControlReceiveInterface* controlreceiveinterface));
- MOCK_METHOD0(setControllerReady,
- void());
- MOCK_METHOD0(setControllerRundown,
- void());
- MOCK_METHOD3(hookUserConnectionRequest,
- am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID));
- MOCK_METHOD1(hookUserDisconnectionRequest,
- am_Error_e(const am_mainConnectionID_t connectionID));
- MOCK_METHOD2(hookUserSetMainSinkSoundProperty,
- am_Error_e(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD2(hookUserSetMainSourceSoundProperty,
- am_Error_e(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
- MOCK_METHOD1(hookUserSetSystemProperty,
- am_Error_e(const am_SystemProperty_s& property));
- MOCK_METHOD2(hookUserVolumeChange,
- am_Error_e(const am_sinkID_t SinkID, const am_mainVolume_t newVolume));
- MOCK_METHOD2(hookUserVolumeStep,
- am_Error_e(const am_sinkID_t SinkID, const int16_t increment));
- MOCK_METHOD2(hookUserSetSinkMuteState,
- am_Error_e(const am_sinkID_t sinkID, const am_MuteState_e muteState));
- MOCK_METHOD2(hookSystemRegisterDomain,
- am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
- MOCK_METHOD1(hookSystemDeregisterDomain,
- am_Error_e(const am_domainID_t domainID));
- MOCK_METHOD1(hookSystemDomainRegistrationComplete,
- void(const am_domainID_t domainID));
- MOCK_METHOD2(hookSystemRegisterSink,
- am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
- MOCK_METHOD1(hookSystemDeregisterSink,
- am_Error_e(const am_sinkID_t sinkID));
- MOCK_METHOD2(hookSystemRegisterSource,
- am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
- MOCK_METHOD1(hookSystemDeregisterSource,
- am_Error_e(const am_sourceID_t sourceID));
- MOCK_METHOD2(hookSystemRegisterGateway,
- am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
- MOCK_METHOD1(hookSystemDeregisterGateway,
- am_Error_e(const am_gatewayID_t gatewayID));
- MOCK_METHOD2(hookSystemRegisterCrossfader,
- am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
- MOCK_METHOD1(hookSystemDeregisterCrossfader,
- am_Error_e(const am_crossfaderID_t crossfaderID));
- MOCK_METHOD3(hookSystemSinkVolumeTick,
- void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
- MOCK_METHOD3(hookSystemSourceVolumeTick,
- void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
- MOCK_METHOD2(hookSystemInterruptStateChange,
- void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
- MOCK_METHOD2(hookSystemSinkAvailablityStateChange,
- void(const am_sinkID_t sinkID, const am_Availability_s& availability));
- MOCK_METHOD2(hookSystemSourceAvailablityStateChange,
- void(const am_sourceID_t sourceID, const am_Availability_s& availability));
- MOCK_METHOD2(hookSystemDomainStateChange,
- void(const am_domainID_t domainID, const am_DomainState_e state));
- MOCK_METHOD1(hookSystemReceiveEarlyData,
- void(const std::vector<am_EarlyData_s>& data));
- MOCK_METHOD1(hookSystemSpeedChange,
- void(const am_speed_t speed));
- MOCK_METHOD2(hookSystemTimingInformationChanged,
- void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
- MOCK_METHOD2(cbAckConnect,
- void(const am_Handle_s handle, const am_Error_e errorID));
- MOCK_METHOD2(cbAckDisconnect,
- void(const am_Handle_s handle, const am_Error_e errorID));
- MOCK_METHOD3(cbAckCrossFade,
- void(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error));
- MOCK_METHOD3(cbAckSetSinkVolumeChange,
- void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
- MOCK_METHOD3(cbAckSetSourceVolumeChange,
- void(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceState,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSourceSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSinkSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(cbAckSetSinkSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD5(getConnectionFormatChoice,
- am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats));
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
- MOCK_METHOD0(confirmCommandReady,
- void());
- MOCK_METHOD0(confirmRoutingReady,
- void());
- MOCK_METHOD0(confirmCommandRundown,
- void());
- MOCK_METHOD0(confirmRoutingRundown,
- void());
-
-};
-
-
-} // namespace am
-
-#endif /* MOCKROUTINGINTERFACE_H_ */
diff --git a/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.h b/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.h
deleted file mode 100644
index 182dfa1..0000000
--- a/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * CAmTelnetServerTest.h
- *
- * Created on: Feb 7, 2012
- * Author: Frank Herchet
- */
-
-#ifndef CAMTELNETSERVERTEST_H_
-#define CAMTELNETSERVERTEST_H_
-
-#include "gtest/gtest.h"
-#include "TelnetServer.h"
-#include "DatabaseHandler.h"
-#include "RoutingSender.h"
-#include "CommandSender.h"
-#include "ControlSender.h"
-#include "Router.h"
-
-namespace am
-{
-
-class SocketHandler;
-class DatabaseHandler;
-class RoutingSender;
-class CommandSender;
-class ControlSender;
-class Router;
-class CommandReceiver;
-class RoutingReceiver;
-class ControlReceiver;
-class TelnetServer;
-
-
-class MyEnvironment : public ::testing::Environment
-{
- public:
- MyEnvironment();
-
- ~MyEnvironment();
- // Override this to define how to set up the environment.
- void SetUp();
- // Override this to define how to tear down the environment.
- void TearDown();
-
- void setSocketHandler(SocketHandler* pSocketHandler);
-
- void stopSocketHandler();
-
- std::vector<std::string> mlistRoutingPluginDirs;
- std::vector<std::string> mlistCommandPluginDirs;
-
- //SocketHandler* mpSocketHandler;
- DatabaseHandler mDatabasehandler;
- RoutingSender mRoutingSender;
- CommandSender mCommandSender;
- ControlSender mControlSender;
- Router mRouter;
-
- CommandReceiver* mpCommandReceiver;
- RoutingReceiver* mpRoutingReceiver;
- ControlReceiver* mpControlReceiver;
-
- TelnetServer* mpTelnetServer;
-
- pthread_t mSocketHandlerThread;
-};
-
-class CAmTelnetServerTest : public ::testing::Test
-{
- public:
- CAmTelnetServerTest();
- ~CAmTelnetServerTest();
-
-
- void SetUp() ;
-
- void TearDown() ;
-
- //int mSocket;
-};
-
-}
-
-
-
-
-#endif /* CAMTELNETSERVERTEST_H_ */
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa944de..f847ec9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,14 +118,13 @@ else(USE_BUILD_LIBS)
endif(USE_BUILD_LIBS)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
-SET(AUDIO_INCLUDES_FOLDER ${CMAKE_SOURCE_DIR}/includes)
+SET(AUDIO_include_FOLDER ${CMAKE_SOURCE_DIR}/include)
SET(DOC_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/doc)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
SET(TEST_EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin/test)
SET(DOXY_FILE ${CMAKE_SOURCE_DIR}/cmake/DoxyFile.in)
-SET(INTROSPECTION_COMMAND_XML_FILE "${AUDIO_INCLUDES_FOLDER}/dbus/CommandInterface.xml")
-CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/cmake/config.cmake ${CMAKE_SOURCE_DIR}/includes/config.h )
+CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/cmake/config.cmake ${CMAKE_SOURCE_DIR}/include/config.h )
IF(WITH_DLT)
@@ -239,7 +238,7 @@ STRING(REGEX REPLACE ".$" "" all_DEPENDENCIES ${all_DEPENDENCIES})
execute_process(COMMAND cp ${CMAKE_MODULE_PATH}/add_package_dependencies.sh ${CMAKE_CURRENT_BINARY_DIR})
#component based dep package generation is only supported above 2.8.5
-IF (${CMAKE_VERSION} VERSION_GREATER 2.9.4)
+IF (${CMAKE_VERSION} VERSION_GREATER 2.8.5)
SET(CPACK_COMPONENTS_ALL bin sampleplugins tests dev)
SET(CPACK_COMPONENTS_IGNORE_GROUPS 1)
@@ -252,12 +251,12 @@ IF (${CMAKE_VERSION} VERSION_GREATER 2.9.4)
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/add_package_dependencies.sh ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Linux-tests.deb ${CPACK_OUTPUT_FILE_PREFIX} \"${tests_DEPENDENCIES}\"
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/add_package_dependencies.sh ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Linux-dev.deb ${CPACK_OUTPUT_FILE_PREFIX} \"${dev_DEPENDENCIES}\"
)
-ELSE (${CMAKE_VERSION} VERSION_GREATER 2.9.4)
+ELSE (${CMAKE_VERSION} VERSION_GREATER 2.8.5)
IF(${CMAKE_VERSION} VERSION_GREATER 2.8.3)
ADD_CUSTOM_TARGET(genivi_package
COMMAND ${CMAKE_COMMAND} ${CMAKE_BINARY_DIR} -DUSE_BUILD_LIBS=ON
COMMAND make package
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/add_package_dependencies.sh ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Linux.deb ${CPACK_OUTPUT_FILE_PREFIX} \"${all_DEPENDENCIES}\"
+ COMMAND ${CMAKE_CURRENT_BINARY_DIR}A logical block opening on t/add_package_dependencies.sh ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Linux.deb ${CPACK_OUTPUT_FILE_PREFIX} \"${all_DEPENDENCIES}\"
)
ELSE(${CMAKE_VERSION} VERSION_GREATER 2.8.3)
ADD_CUSTOM_TARGET(genivi_package
@@ -268,7 +267,7 @@ ELSE (${CMAKE_VERSION} VERSION_GREATER 2.9.4)
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/add_package_dependencies.sh ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Linux.deb ${CPACK_OUTPUT_FILE_PREFIX} \"${all_DEPENDENCIES}\"
)
ENDIF(${CMAKE_VERSION} VERSION_GREATER 2.8.3)
-ENDIF (${CMAKE_VERSION} VERSION_GREATER 2.9.4)
+ENDIF (${CMAKE_VERSION} VERSION_GREATER 2.8.5)
INCLUDE(CPack)
diff --git a/PluginCommandInterfaceDbus/CMakeLists.txt b/PluginCommandInterfaceDbus/CMakeLists.txt
index 7c4c776..2d5c6cc 100644
--- a/PluginCommandInterfaceDbus/CMakeLists.txt
+++ b/PluginCommandInterfaceDbus/CMakeLists.txt
@@ -4,9 +4,9 @@ PROJECT(PluginCommandInterfaceDbus)
set(LIBRARY_OUTPUT_PATH ${PLUGINS_OUTPUT_PATH}/command)
set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/CommandDBusPlugin)
-set(INCLUDES_FOLDER "include")
+set(include_FOLDER "include")
-FILE(READ "${AUDIO_INCLUDES_FOLDER}/command/CommandSendInterface.h" VERSION_BUFFER LIMIT 6000)
+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}")
@@ -18,9 +18,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${DBUS_INCLUDE_DIR}
${DBUS_ARCH_INCLUDE_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${DLT_INCLUDE_DIRS}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
)
# all source files go here
@@ -38,7 +38,7 @@ TARGET_LINK_LIBRARIES(PluginCommandInterfaceDbus
)
IF(WITH_TESTS)
-# add_subdirectory (test)
+ add_subdirectory (test)
ENDIF(WITH_TESTS)
#IF(WITH_DOCUMENTATION)
@@ -56,5 +56,7 @@ INSTALL(TARGETS PluginCommandInterfaceDbus
COMPONENT sampleplugins
)
+execute_process(COMMAND cp "${CMAKE_SOURCE_DIR}/PluginCommandInterfaceDbus/${include_FOLDER}/CommandInterface.xml" ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml)
+
SET(ADD_DEPEND "audiomanager-bin" "dlt" "libdbus-1-3(>=1.2.16)")
set_property(GLOBAL APPEND PROPERTY sampleplugins_prop "${ADD_DEPEND}")
diff --git a/PluginCommandInterfaceDbus/include/DBusCommandSender.h b/PluginCommandInterfaceDbus/include/CAmCommandSenderDbus.h
index e64e6f6..ad625dc 100644
--- a/PluginCommandInterfaceDbus/include/DBusCommandSender.h
+++ b/PluginCommandInterfaceDbus/include/CAmCommandSenderDbus.h
@@ -26,16 +26,18 @@
#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/DbusCommandInterfaceBackdoor.h"
+#include "../test/CAmCommandSenderDbusBackdoor.h"
#endif
-#include <command/CommandSendInterface.h>
-#include <dbus/dbus.h>
-#include <dbus/DBusWrapper.h>
-#include <map>
-#include "DBusMessageHandler.h"
-#include "CommandReceiverShadow.h"
+
namespace am
{
@@ -45,43 +47,42 @@ const char MY_NODE[] = "CommandInterface";
/**
* Dbus Implementation of CommandSendInterface
*/
-class DbusCommandSender: public CommandSendInterface
+class CAmCommandSenderDbus: public IAmCommandSend
{
public:
- DbusCommandSender();
- virtual ~DbusCommandSender();
- am_Error_e startupInterface(CommandReceiveInterface* 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 ;
+ 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;
#ifdef UNIT_TEST
- friend class DbusCommandInterfaceBackdoor;
+ friend class CAmCommandSenderDbusBackdoor;
#endif
private:
- DBusMessageHandler mDBUSMessageHandler;
- CommandReceiverShadow mCommandReceiverShadow;
- DBusWrapper* mDBusWrapper;
- CommandReceiveInterface* mCommandReceiveInterface;
- bool mReady; ///< ! if false, calls shall be ignored.
-
+ 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
diff --git a/PluginCommandInterfaceDbus/include/DBusMessageHandler.h b/PluginCommandInterfaceDbus/include/CAmDbusMessageHandler.h
index 71a4078..5431e2b 100644
--- a/PluginCommandInterfaceDbus/include/DBusMessageHandler.h
+++ b/PluginCommandInterfaceDbus/include/CAmDbusMessageHandler.h
@@ -26,12 +26,13 @@
#ifndef _DBUSMESSAGEHANDLER_H_
#define _DBUSMESSAGEHANDLER_H_
-#include <audiomanagertypes.h>
#include <dbus/dbus.h>
#include <vector>
#include <sstream>
#include <string>
#include <list>
+#include "audiomanagertypes.h"
+
namespace am
{
@@ -39,11 +40,11 @@ namespace am
/**
* handles DBus Messages, is used to extract & append parameters and send messages
*/
-class DBusMessageHandler
+class CAmDbusMessageHandler
{
public:
- DBusMessageHandler();
- ~DBusMessageHandler();
+ CAmDbusMessageHandler();
+ ~CAmDbusMessageHandler();
/**
* sets the DBus Connection
@@ -116,9 +117,9 @@ private:
dbus_uint32_t mSerial;
std::string mErrorName;
std::string mErrorMsg;
- DBusMessage* mDbusMessage;
- DBusMessage* mReveiveMessage;
- DBusConnection* mDBusConnection;
+ DBusMessage* mpDBusMessage;
+ DBusMessage* mpReveiveMessage;
+ DBusConnection* mpDBusConnection;
};
}
diff --git a/includes/dbus/CommandInterface.xml b/PluginCommandInterfaceDbus/include/CommandInterface.xml
index f6f07a0..f6f07a0 100644
--- a/includes/dbus/CommandInterface.xml
+++ b/PluginCommandInterfaceDbus/include/CommandInterface.xml
diff --git a/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h b/PluginCommandInterfaceDbus/include/IAmCommandReceiverShadow.h
index d2c63cb..dd5a23d 100644
--- a/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h
+++ b/PluginCommandInterfaceDbus/include/IAmCommandReceiverShadow.h
@@ -26,28 +26,30 @@
#ifndef COMMANDRECEIVERSHADOW_H_
#define COMMANDRECEIVERSHADOW_H_
-#include <config.h>
-#include <command/CommandReceiveInterface.h>
-#include <dbus/DBusWrapper.h>
+
+
#include <dbus/dbus.h>
#include <map>
-#include "DBusMessageHandler.h"
+#include "config.h"
+#include "command/IAmCommandReceive.h"
+#include "CAmDbusMessageHandler.h"
+#include "shared/CAmDbusWrapper.h"
namespace am
{
-class CommandReceiverShadow;
+class IAmCommandReceiverShadow;
-typedef void (CommandReceiverShadow::*CallBackMethod)(DBusConnection *connection, DBusMessage *message);
+typedef void (IAmCommandReceiverShadow::*CallBackMethod)(DBusConnection *connection, DBusMessage *message);
/**
* receives the DBus Callbacks, marhsalls and demarshalls the parameters and calls CommandReceive
*/
-class CommandReceiverShadow
+class IAmCommandReceiverShadow
{
public:
- CommandReceiverShadow();
- virtual ~CommandReceiverShadow();
+ IAmCommandReceiverShadow();
+ virtual ~IAmCommandReceiverShadow();
void connect(DBusConnection *conn, DBusMessage *msg);
void disconnect(DBusConnection *conn, DBusMessage *msg);
void setVolume(DBusConnection *conn, DBusMessage *msg);
@@ -70,13 +72,13 @@ public:
* sets the pointer to the CommandReceiveInterface and registers Callback
* @param receiver
*/
- void setCommandReceiver(CommandReceiveInterface*& receiver);
+ void setCommandReceiver(IAmCommandReceive*& receiver);
private:
- CommandReceiveInterface* mCommandReceiveInterface;
- DBusWrapper* mDBusWrapper;
typedef std::map<std::string, CallBackMethod> functionMap_t;
functionMap_t mFunctionMap;
- DBusMessageHandler mDBUSMessageHandler;
+ CAmDbusMessageHandler mDBUSMessageHandler;
+ IAmCommandReceive* mpIAmCommandReceive;
+ CAmDbusWrapper* mpCAmDbusWrapper;
/**
* receives a callback whenever the path of the plugin is called
diff --git a/PluginCommandInterfaceDbus/include/mainpage.h b/PluginCommandInterfaceDbus/include/mainpage.h
deleted file mode 100644
index 8a2848c..0000000
--- a/PluginCommandInterfaceDbus/include/mainpage.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * \mainpage
- * \image html "Bild1.png"
- * Copyright Copyright (C) 2011, BMW AG
- *
- * \date 22.06.2011
- * \author Christian Müller (christian.ei.mueller@bmw.de)
- *
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG – Christian Müller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
- *
- * \section About About PluginInterfaceDBus
- * This plugin for the Genivi AudioManager serves as interface for DBus.
- *
- * \section Info More information
- * can be found at <https://collab.genivi.org/wiki/display/genivi/GENIVI+Home>
- *
- */
-
-#ifndef MAINPAGE_H_
-#define MAINPAGE_H_
-
-#endif /* MAINPAGE_H_ */
diff --git a/PluginCommandInterfaceDbus/src/CAmCommandSenderDbus.cpp b/PluginCommandInterfaceDbus/src/CAmCommandSenderDbus.cpp
new file mode 100644
index 0000000..cb5b838
--- /dev/null
+++ b/PluginCommandInterfaceDbus/src/CAmCommandSenderDbus.cpp
@@ -0,0 +1,331 @@
+/**
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger DbusPlugin
+ *
+ * \file CAmCommandSender.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+
+#include "CAmCommandSenderDbus.h"
+#include <algorithm>
+#include <string>
+#include <vector>
+#include <cassert>
+#include <set>
+#include "CAmDbusMessageHandler.h"
+#include "shared/CAmDltWrapper.h"
+#include "shared/CAmDbusWrapper.h"
+
+
+DLT_DECLARE_CONTEXT(commandDbus)
+
+using namespace am;
+
+/**
+ * factory for plugin loading
+ */
+extern "C" IAmCommandSend* PluginCommandInterfaceDbusFactory()
+{
+ 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)
+{
+ CAmDltWrapper::instance()->registerContext(commandDbus, "DBP", "DBus Plugin");
+ 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);
+}
+
+void CAmCommandSenderDbus::setCommandRundown(const uint16_t handle)
+{
+ log(&commandDbus, DLT_LOG_INFO, "cbCommunicationRundown called");
+ mReady = false;
+ mpIAmCommandReceive->confirmCommandRundown(handle);
+ /**
+ * 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 SinkAdded");
+ mCAmDbusMessageHandler.sendMessage();
+ }
+}
+
+void CAmCommandSenderDbus::cbNewSource(const am_SourceType_s& source)
+{
+ log(&commandDbus, DLT_LOG_INFO, "cbNumberOfSourcesChanged 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;
+}
+
diff --git a/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp b/PluginCommandInterfaceDbus/src/CAmDbusMessageHandler.cpp
index 3dd9172..6b2dc3f 100644
--- a/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp
+++ b/PluginCommandInterfaceDbus/src/CAmDbusMessageHandler.cpp
@@ -22,40 +22,42 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include <config.h>
-#include "DBusMessageHandler.h"
-#include "DBusCommandSender.h"
-#include "DLTWrapper.h"
-#include <stdlib.h>
+
+#include "CAmDbusMessageHandler.h"
+#include "config.h"
+#include <cstdlib>
#include <cassert>
#include <vector>
+#include "CAmCommandSenderDbus.h"
+#include "shared/CAmDltWrapper.h"
DLT_IMPORT_CONTEXT(commandDbus)
-using namespace am;
+namespace am
+{
-DBusMessageHandler::DBusMessageHandler() :
+CAmDbusMessageHandler::CAmDbusMessageHandler() :
mDBusMessageIter(), //
mDBusError(), //
mSerial(0), //
mErrorName(""), //
mErrorMsg(""), //
- mDbusMessage(NULL), //
- mReveiveMessage(NULL), //
- mDBusConnection(NULL)
+ mpDBusMessage(NULL), //
+ mpReveiveMessage(NULL), //
+ mpDBusConnection(NULL)
{
log(&commandDbus, DLT_LOG_INFO, "DBusMessageHandler constructed");
}
-DBusMessageHandler::~DBusMessageHandler()
+CAmDbusMessageHandler::~CAmDbusMessageHandler()
{
log(&commandDbus, DLT_LOG_INFO, "DBUSMessageHandler destructed");
}
-void DBusMessageHandler::initReceive(DBusMessage* msg)
+void CAmDbusMessageHandler::initReceive(DBusMessage* msg)
{
assert(msg!=NULL);
- mReveiveMessage = msg;
+ mpReveiveMessage = msg;
if (!dbus_message_iter_init(msg, &mDBusMessageIter))
{
log(&commandDbus, DLT_LOG_INFO, "DBusMessageHandler::initReceive DBus Message has no arguments!");
@@ -64,39 +66,39 @@ void DBusMessageHandler::initReceive(DBusMessage* msg)
}
}
-void DBusMessageHandler::initReply(DBusMessage* msg)
+void CAmDbusMessageHandler::initReply(DBusMessage* msg)
{
assert(msg!=NULL);
- mDbusMessage = dbus_message_new_method_return(msg);
- if (mDbusMessage == 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(mDbusMessage, &mDBusMessageIter);
+ dbus_message_iter_init_append(mpDBusMessage, &mDBusMessageIter);
}
-void DBusMessageHandler::initSignal(std::string path, std::string signalName)
+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;
- mDbusMessage = dbus_message_new_signal(completePath.c_str(), DBUS_SERVICE_PREFIX, signalName.c_str());
+ mpDBusMessage = dbus_message_new_signal(completePath.c_str(), DBUS_SERVICE_PREFIX, signalName.c_str());
- if (mDbusMessage == NULL)
+ if (mpDBusMessage == NULL)
{
log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::initSignal Cannot allocate DBus message!");
}
- dbus_message_iter_init_append(mDbusMessage, &mDBusMessageIter);
+ dbus_message_iter_init_append(mpDBusMessage, &mDBusMessageIter);
}
-void DBusMessageHandler::sendMessage()
+void CAmDbusMessageHandler::sendMessage()
{
- assert(mDBusConnection!=NULL);
- if (mReveiveMessage != 0)
+ assert(mpDBusConnection!=NULL);
+ if (mpReveiveMessage != 0)
{
- mSerial = dbus_message_get_serial(mReveiveMessage);
+ mSerial = dbus_message_get_serial(mpReveiveMessage);
}
else
{
@@ -104,18 +106,18 @@ void DBusMessageHandler::sendMessage()
}
if (!mErrorName.empty())
{
- mDbusMessage = dbus_message_new_error(mReveiveMessage, mErrorName.c_str(), mErrorMsg.c_str());
+ mpDBusMessage = dbus_message_new_error(mpReveiveMessage, mErrorName.c_str(), mErrorMsg.c_str());
}
- if (!dbus_connection_send(mDBusConnection, mDbusMessage, &mSerial))
+ if (!dbus_connection_send(mpDBusConnection, mpDBusMessage, &mSerial))
{
log(&commandDbus, DLT_LOG_ERROR, "DBusMessageHandler::sendMessage cannot send message!");
}
- dbus_connection_flush(mDBusConnection);
- dbus_message_unref(mDbusMessage);
- mDbusMessage = NULL;
+ dbus_connection_flush(mpDBusConnection);
+ dbus_message_unref(mpDBusMessage);
+ mpDBusMessage = NULL;
}
-char* DBusMessageHandler::getString()
+char* CAmDbusMessageHandler::getString()
{
char* param = NULL;
@@ -133,7 +135,7 @@ char* DBusMessageHandler::getString()
return (param);
}
-dbus_bool_t DBusMessageHandler::getBool()
+dbus_bool_t CAmDbusMessageHandler::getBool()
{
dbus_bool_t boolparam = false;
@@ -151,7 +153,7 @@ dbus_bool_t DBusMessageHandler::getBool()
return (boolparam);
}
-char DBusMessageHandler::getByte()
+char CAmDbusMessageHandler::getByte()
{
char param;
@@ -169,7 +171,7 @@ char DBusMessageHandler::getByte()
return (param);
}
-dbus_uint16_t DBusMessageHandler::getUInt()
+dbus_uint16_t CAmDbusMessageHandler::getUInt()
{
dbus_uint16_t param;
@@ -191,7 +193,7 @@ dbus_uint16_t DBusMessageHandler::getUInt()
return (param);
}
-dbus_int16_t DBusMessageHandler::getInt()
+dbus_int16_t CAmDbusMessageHandler::getInt()
{
dbus_int16_t param;
@@ -213,7 +215,7 @@ dbus_int16_t DBusMessageHandler::getInt()
return (param);
}
-double DBusMessageHandler::getDouble()
+double CAmDbusMessageHandler::getDouble()
{
double param;
if (DBUS_TYPE_DOUBLE != dbus_message_iter_get_arg_type(&mDBusMessageIter))
@@ -230,7 +232,7 @@ double DBusMessageHandler::getDouble()
return (param);
}
-void DBusMessageHandler::getProperty(dbus_int16_t & type, dbus_int16_t & value)
+void CAmDbusMessageHandler::getProperty(dbus_int16_t & type, dbus_int16_t & value)
{
DBusMessageIter arrayIter;
if (DBUS_TYPE_STRUCT != dbus_message_iter_get_arg_type(&mDBusMessageIter))
@@ -249,7 +251,7 @@ void DBusMessageHandler::getProperty(dbus_int16_t & type, dbus_int16_t & value)
}
}
-void DBusMessageHandler::append(bool toAppend)
+void CAmDbusMessageHandler::append(bool toAppend)
{
dbus_bool_t mybool = toAppend;
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_BOOLEAN, &mybool))
@@ -260,7 +262,7 @@ void DBusMessageHandler::append(bool toAppend)
}
}
-void DBusMessageHandler::append(double toAppend)
+void CAmDbusMessageHandler::append(double toAppend)
{
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_DOUBLE, &toAppend))
{
@@ -270,7 +272,7 @@ void DBusMessageHandler::append(double toAppend)
}
}
-void DBusMessageHandler::append(char toAppend)
+void CAmDbusMessageHandler::append(char toAppend)
{
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_BYTE, &toAppend))
{
@@ -280,7 +282,7 @@ void DBusMessageHandler::append(char toAppend)
}
}
-void DBusMessageHandler::append(dbus_int16_t toAppend)
+void CAmDbusMessageHandler::append(dbus_int16_t toAppend)
{
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_INT16, &toAppend))
{
@@ -290,7 +292,7 @@ void DBusMessageHandler::append(dbus_int16_t toAppend)
}
}
-void DBusMessageHandler::append(dbus_uint16_t toAppend)
+void CAmDbusMessageHandler::append(dbus_uint16_t toAppend)
{
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_UINT16, &toAppend))
{
@@ -300,13 +302,13 @@ void DBusMessageHandler::append(dbus_uint16_t toAppend)
}
}
-void DBusMessageHandler::setDBusConnection(DBusConnection *& connection)
+void CAmDbusMessageHandler::setDBusConnection(DBusConnection *& connection)
{
assert(connection!=NULL);
- mDBusConnection = connection;
+ mpDBusConnection = connection;
}
-void DBusMessageHandler::append(const am::am_SinkType_s& sinkType)
+void CAmDbusMessageHandler::append(const am::am_SinkType_s& sinkType)
{
DBusMessageIter structIter;
DBusMessageIter structAvailIter;
@@ -333,7 +335,7 @@ void DBusMessageHandler::append(const am::am_SinkType_s& sinkType)
}
}
-void DBusMessageHandler::append(const am::am_SourceType_s & sourceType)
+void CAmDbusMessageHandler::append(const am::am_SourceType_s & sourceType)
{
DBusMessageIter structIter;
DBusMessageIter structAvailIter;
@@ -358,7 +360,7 @@ void DBusMessageHandler::append(const am::am_SourceType_s & sourceType)
}
}
-void DBusMessageHandler::append(const am::am_MainSoundProperty_s mainSoundProperty)
+void CAmDbusMessageHandler::append(const am::am_MainSoundProperty_s mainSoundProperty)
{
DBusMessageIter structIter;
dbus_bool_t success = true;
@@ -375,7 +377,7 @@ void DBusMessageHandler::append(const am::am_MainSoundProperty_s mainSoundProper
}
}
-void DBusMessageHandler::append(const am::am_Availability_s & availability)
+void CAmDbusMessageHandler::append(const am::am_Availability_s & availability)
{
DBusMessageIter structAvailIter;
dbus_bool_t success = true;
@@ -392,7 +394,7 @@ void DBusMessageHandler::append(const am::am_Availability_s & availability)
}
}
-void DBusMessageHandler::append(const am::am_SystemProperty_s & SystemProperty)
+void CAmDbusMessageHandler::append(const am::am_SystemProperty_s & SystemProperty)
{
DBusMessageIter structIter;
dbus_bool_t success = true;
@@ -409,7 +411,7 @@ void DBusMessageHandler::append(const am::am_SystemProperty_s & SystemProperty)
}
}
-void DBusMessageHandler::append(const std::vector<am::am_MainConnectionType_s>& listMainConnections)
+void CAmDbusMessageHandler::append(const std::vector<am::am_MainConnectionType_s>& listMainConnections)
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
@@ -437,7 +439,7 @@ void DBusMessageHandler::append(const std::vector<am::am_MainConnectionType_s>&
}
}
-void DBusMessageHandler::append(const std::vector<am::am_SinkType_s> & listMainSinks)
+void CAmDbusMessageHandler::append(const std::vector<am::am_SinkType_s> & listMainSinks)
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
@@ -470,7 +472,7 @@ void DBusMessageHandler::append(const std::vector<am::am_SinkType_s> & listMainS
}
}
-void DBusMessageHandler::append(const std::vector<am::am_SourceType_s> & listMainSources)
+void CAmDbusMessageHandler::append(const std::vector<am::am_SourceType_s> & listMainSources)
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
@@ -501,7 +503,7 @@ void DBusMessageHandler::append(const std::vector<am::am_SourceType_s> & listMai
}
}
-void DBusMessageHandler::append(const std::vector<am::am_MainSoundProperty_s> & listMainSoundProperties)
+void CAmDbusMessageHandler::append(const std::vector<am::am_MainSoundProperty_s> & listMainSoundProperties)
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
@@ -526,7 +528,7 @@ void DBusMessageHandler::append(const std::vector<am::am_MainSoundProperty_s> &
}
}
-void DBusMessageHandler::append(const std::vector<am::am_SourceClass_s> & listSourceClasses)
+void CAmDbusMessageHandler::append(const std::vector<am::am_SourceClass_s> & listSourceClasses)
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
@@ -564,7 +566,7 @@ void DBusMessageHandler::append(const std::vector<am::am_SourceClass_s> & listSo
}
}
-void DBusMessageHandler::append(const std::vector<am::am_SinkClass_s> & listSinkClasses)
+void CAmDbusMessageHandler::append(const std::vector<am::am_SinkClass_s> & listSinkClasses)
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
@@ -602,7 +604,7 @@ void DBusMessageHandler::append(const std::vector<am::am_SinkClass_s> & listSink
}
}
-void DBusMessageHandler::append(const std::vector<am::am_SystemProperty_s> & listSystemProperties)
+void CAmDbusMessageHandler::append(const std::vector<am::am_SystemProperty_s> & listSystemProperties)
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
@@ -626,4 +628,4 @@ void DBusMessageHandler::append(const std::vector<am::am_SystemProperty_s> & lis
mErrorMsg = "Cannot create reply!";
}
}
-
+}
diff --git a/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp b/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp
deleted file mode 100644
index de577c9..0000000
--- a/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/**
- * Copyright (C) 2011, BMW AG
- *
- * GeniviAudioMananger DbusPlugin
- *
- * \file CommandSender.cpp
- *
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
- *
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
- */
-
-#include <command/CommandReceiveInterface.h>
-#include <dbus/DBusWrapper.h>
-#include "DBusCommandSender.h"
-#include "DBusMessageHandler.h"
-#include "DLTWrapper.h"
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <cassert>
-#include <set>
-
-DLT_DECLARE_CONTEXT(commandDbus)
-
-using namespace am;
-
-/**
- * factory for plugin loading
- */
-extern "C" CommandSendInterface* PluginCommandInterfaceDbusFactory()
-{
- return (new DbusCommandSender());
-}
-
-/**
- * destroy instance of commandSendInterface
- */
-extern "C" void destroyRoutingPluginInterfaceDbus(CommandSendInterface* commandSendInterface)
-{
- delete commandSendInterface;
-}
-
-DbusCommandSender::DbusCommandSender() :
- mDBUSMessageHandler(), //
- mCommandReceiverShadow(), //
- mDBusWrapper(NULL), //
- mCommandReceiveInterface(NULL), //
- mReady(false)
-{
- DLTWrapper::instance()->registerContext(commandDbus, "DBP", "DBus Plugin");
- log(&commandDbus, DLT_LOG_INFO, "DbusCommandSender constructor called");
-}
-
-DbusCommandSender::~DbusCommandSender()
-{
- log(&commandDbus, DLT_LOG_INFO, "DbusCommandSender destructed");
- DLTWrapper::instance()->unregisterContext(commandDbus);
-}
-
-am_Error_e DbusCommandSender::startupInterface(CommandReceiveInterface* commandreceiveinterface)
-{
- log(&commandDbus, DLT_LOG_INFO, "startupInterface called");
-
- mCommandReceiveInterface = commandreceiveinterface;
- mCommandReceiverShadow.setCommandReceiver(mCommandReceiveInterface);
- mCommandReceiveInterface->getDBusConnectionWrapper(mDBusWrapper);
- assert(mDBusWrapper!=NULL);
- DBusConnection * connection;
- mDBusWrapper->getDBusConnection(connection);
- assert(connection!=NULL);
- mDBUSMessageHandler.setDBusConnection(connection);
- return (E_OK);
-}
-
-void DbusCommandSender::setCommandReady(const uint16_t handle)
-{
- //todo:implement handle handling
- log(&commandDbus, DLT_LOG_INFO, "cbCommunicationReady called");
- mReady = true;
-}
-
-void DbusCommandSender::setCommandRundown(const uint16_t handle)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbCommunicationRundown called");
- mReady = false;
- /**
- * todo: implement DbusCommandSender::cbCommunicationRundown()
- */
-}
-
-void DbusCommandSender::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)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfMainConnectionsChanged"));
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbRemovedMainConnection(const am_mainConnectionID_t mainConnection)
-{
-//todo: change xml and interface to differetiate between new connection and removed one
- log(&commandDbus, DLT_LOG_INFO, "cbNumberOfMainConnectionsChanged called");
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfMainConnectionsChanged"));
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbNewSink(const am_SinkType_s& sink)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbNewSink called");
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), "SinkAdded");
- mDBUSMessageHandler.append(sink);
-
- log(&commandDbus, DLT_LOG_INFO, "send signal SinkAdded");
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbRemovedSink(const am_sinkID_t sinkID)
-{
- //todo: check if this really works!
- log(&commandDbus, DLT_LOG_INFO, "cbRemovedSink called");
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), "SinkRemoved");
- mDBUSMessageHandler.append(sinkID);
-
- log(&commandDbus, DLT_LOG_INFO, "send signal SinkAdded");
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbNewSource(const am_SourceType_s& source)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbNumberOfSourcesChanged called");
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), "SourceAdded");
- mDBUSMessageHandler.append(source);
-
- log(&commandDbus, DLT_LOG_INFO, "send signal SourceAdded");
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void am::DbusCommandSender::cbRemovedSource(const am_sourceID_t source)
-{
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), "SourceRemoved");
- mDBUSMessageHandler.append(source);
-
- log(&commandDbus, DLT_LOG_INFO, "send signal SourceRemoved");
-
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbNumberOfSinkClassesChanged()
-{
- log(&commandDbus, DLT_LOG_INFO, "cbNumberOfSinkClassesChanged called");
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfSinkClassesChanged"));
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbNumberOfSourceClassesChanged()
-{
- log(&commandDbus, DLT_LOG_INFO, "cbNumberOfSourceClassesChanged called");
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfSourceClassesChanged"));
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbMainConnectionStateChanged called, connectionID=", connectionID, "connectionState=", connectionState);
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("MainConnectionStateChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t) connectionID);
- mDBUSMessageHandler.append((dbus_int16_t) connectionState);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::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)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("MainSinkSoundPropertyChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t) sinkID);
- mDBUSMessageHandler.append(soundProperty);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::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)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("MainSourceSoundPropertyChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t) sourceID);
- mDBUSMessageHandler.append(SoundProperty);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::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)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkAvailabilityChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t) sinkID);
- mDBUSMessageHandler.append(availability);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::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)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("SourceAvailabilityChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t) sourceID);
- mDBUSMessageHandler.append(availability);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbVolumeChanged called, sinkID", sinkID, "volume", volume);
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("VolumeChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t) sinkID);
- mDBUSMessageHandler.append((dbus_int16_t) volume);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSinkMuteStateChanged called, sinkID", sinkID, "muteState", muteState);
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkMuteStateChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t) sinkID);
- mDBUSMessageHandler.append((dbus_int16_t) muteState);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::cbSystemPropertyChanged(const am_SystemProperty_s & SystemProperty)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbSystemPropertyChanged called, SystemProperty.type", SystemProperty.type, "SystemProperty.value", SystemProperty.value);
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("SystemPropertyChanged"));
- mDBUSMessageHandler.append(SystemProperty);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void am::DbusCommandSender::cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
-{
- log(&commandDbus, DLT_LOG_INFO, "cbTimingInformationChanged called, mainConnectionID=", mainConnectionID, "time=", time);
-
- if (mReady)
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("TimingInformationChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t) mainConnectionID);
- mDBUSMessageHandler.append((dbus_int16_t) time);
- mDBUSMessageHandler.sendMessage();
- }
-}
-
-void DbusCommandSender::getInterfaceVersion(std::string & version) const
-{
- version = CommandSendVersion;
-}
-
diff --git a/PluginCommandInterfaceDbus/src/CommandReceiverShadow.cpp b/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp
index 313818f..f43c9e6 100644
--- a/PluginCommandInterfaceDbus/src/CommandReceiverShadow.cpp
+++ b/PluginCommandInterfaceDbus/src/IAmCommandReceiverShadow.cpp
@@ -23,13 +23,14 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include <audiomanagertypes.h>
+#include "IAmCommandReceiverShadow.h"
#include <string>
#include <fstream>
+#include <stdexcept>
#include <cassert>
-#include "CommandReceiverShadow.h"
-#include "DBusCommandSender.h"
-#include "DLTWrapper.h"
+#include "audiomanagertypes.h"
+#include "CAmCommandSenderDbus.h"
+#include "shared/CAmDltWrapper.h"
using namespace am;
@@ -40,107 +41,107 @@ DLT_IMPORT_CONTEXT(commandDbus)
*/
static DBusObjectPathVTable gObjectPathVTable;
-CommandReceiverShadow::CommandReceiverShadow() :
- mCommandReceiveInterface(NULL), //
- mDBusWrapper(NULL), //
+IAmCommandReceiverShadow::IAmCommandReceiverShadow() :
mFunctionMap(createMap()), //
- mDBUSMessageHandler()
+ mDBUSMessageHandler(), //
+ mpIAmCommandReceive(NULL), //
+ mpCAmDbusWrapper(NULL)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow constructed");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow constructed");
}
-CommandReceiverShadow::~CommandReceiverShadow()
+IAmCommandReceiverShadow::~IAmCommandReceiverShadow()
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow destructed");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow destructed");
}
-void CommandReceiverShadow::connect(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::connect(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::connect called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::connect called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ 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 = mCommandReceiveInterface->connect(sourceID, sinkID, mainConnectionID);
+ 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 CommandReceiverShadow::disconnect(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::disconnect(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::disconnect called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::disconnect called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
mDBUSMessageHandler.initReceive(msg);
am_mainConnectionID_t mainConnnectionID = (am_mainConnectionID_t) mDBUSMessageHandler.getUInt();
- am_Error_e returnCode = mCommandReceiveInterface->disconnect(mainConnnectionID);
+ am_Error_e returnCode = mpIAmCommandReceive->disconnect(mainConnnectionID);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::setVolume(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::setVolume(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::setVolume called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setVolume called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ 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 = mCommandReceiveInterface->setVolume(sinkID, volume);
+ am_Error_e returnCode = mpIAmCommandReceive->setVolume(sinkID, volume);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::volumeStep(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::volumeStep(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::volumeStep called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::volumeStep called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ 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 = mCommandReceiveInterface->volumeStep(sinkID, volumeStep);
+ am_Error_e returnCode = mpIAmCommandReceive->volumeStep(sinkID, volumeStep);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::setSinkMuteState(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::setSinkMuteState(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::setSinkMuteState called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setSinkMuteState called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ 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 = mCommandReceiveInterface->setSinkMuteState(sinkID, muteState);
+ am_Error_e returnCode = mpIAmCommandReceive->setSinkMuteState(sinkID, muteState);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::setMainSinkSoundProperty called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setMainSinkSoundProperty called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
mDBUSMessageHandler.initReceive(msg);
am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
@@ -150,18 +151,18 @@ void CommandReceiverShadow::setMainSinkSoundProperty(DBusConnection *conn, DBusM
am_MainSoundProperty_s mainSoundProperty;
mainSoundProperty.type = (am_MainSoundPropertyType_e) type;
mainSoundProperty.value = (int32_t) value;
- am_Error_e returnCode = mCommandReceiveInterface->setMainSinkSoundProperty(mainSoundProperty, sinkID);
+ am_Error_e returnCode = mpIAmCommandReceive->setMainSinkSoundProperty(mainSoundProperty, sinkID);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::setMainSourceSoundProperty called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setMainSourceSoundProperty called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
mDBUSMessageHandler.initReceive(msg);
am_sourceID_t sourceID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
@@ -171,18 +172,18 @@ void CommandReceiverShadow::setMainSourceSoundProperty(DBusConnection *conn, DBu
am_MainSoundProperty_s mainSoundProperty;
mainSoundProperty.type = (am_MainSoundPropertyType_e) type;
mainSoundProperty.value = (int32_t) value;
- am_Error_e returnCode = mCommandReceiveInterface->setMainSourceSoundProperty(mainSoundProperty, sourceID);
+ am_Error_e returnCode = mpIAmCommandReceive->setMainSourceSoundProperty(mainSoundProperty, sourceID);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::setSystemProperty(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::setSystemProperty(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::setSystemProperty called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::setSystemProperty called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
mDBUSMessageHandler.initReceive(msg);
dbus_int16_t type = 0;
@@ -191,157 +192,157 @@ void CommandReceiverShadow::setSystemProperty(DBusConnection *conn, DBusMessage
am_SystemProperty_s systemProperty;
systemProperty.type = (am_SystemPropertyType_e) type;
systemProperty.value = (int32_t) value;
- am_Error_e returnCode = mCommandReceiveInterface->setSystemProperty(systemProperty);
+ am_Error_e returnCode = mpIAmCommandReceive->setSystemProperty(systemProperty);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getListMainConnections(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getListMainConnections(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getListMainConnections called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainConnections called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
std::vector<am_MainConnectionType_s> listMainConnections;
- am_Error_e returnCode = mCommandReceiveInterface->getListMainConnections(listMainConnections);
+ am_Error_e returnCode = mpIAmCommandReceive->getListMainConnections(listMainConnections);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.append(listMainConnections);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getListMainSinks(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getListMainSinks(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getListMainSinks called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainSinks called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
std::vector<am_SinkType_s> listSinks;
- am_Error_e returnCode = mCommandReceiveInterface->getListMainSinks(listSinks);
+ am_Error_e returnCode = mpIAmCommandReceive->getListMainSinks(listSinks);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.append(listSinks);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getListMainSources(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getListMainSources(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getListMainSources called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainSources called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
std::vector<am_SourceType_s> listSources;
- am_Error_e returnCode = mCommandReceiveInterface->getListMainSources(listSources);
+ am_Error_e returnCode = mpIAmCommandReceive->getListMainSources(listSources);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.append(listSources);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getListMainSinkSoundProperties called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainSinkSoundProperties called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ 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 = mCommandReceiveInterface->getListMainSinkSoundProperties(sinkID, listSinkSoundProperties);
+ am_Error_e returnCode = mpIAmCommandReceive->getListMainSinkSoundProperties(sinkID, listSinkSoundProperties);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.append(listSinkSoundProperties);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getListMainSourceSoundProperties called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListMainSourceSoundProperties called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ 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 = mCommandReceiveInterface->getListMainSourceSoundProperties(sourceID, listSinkSoundProperties);
+ am_Error_e returnCode = mpIAmCommandReceive->getListMainSourceSoundProperties(sourceID, listSinkSoundProperties);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.append(listSinkSoundProperties);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getListSourceClasses(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getListSourceClasses(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getListSourceClasses called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListSourceClasses called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
std::vector<am_SourceClass_s> listSourceClasses;
- am_Error_e returnCode = mCommandReceiveInterface->getListSourceClasses(listSourceClasses);
+ am_Error_e returnCode = mpIAmCommandReceive->getListSourceClasses(listSourceClasses);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.append(listSourceClasses);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getListSinkClasses(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getListSinkClasses(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getListSinkClasses called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListSinkClasses called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
std::vector<am_SinkClass_s> listSinkClasses;
- am_Error_e returnCode = mCommandReceiveInterface->getListSinkClasses(listSinkClasses);
+ am_Error_e returnCode = mpIAmCommandReceive->getListSinkClasses(listSinkClasses);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.append(listSinkClasses);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getListSystemProperties(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getListSystemProperties(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getListSystemProperties called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getListSystemProperties called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
std::vector<am_SystemProperty_s> listSystemProperties;
- am_Error_e returnCode = mCommandReceiveInterface->getListSystemProperties(listSystemProperties);
+ am_Error_e returnCode = mpIAmCommandReceive->getListSystemProperties(listSystemProperties);
mDBUSMessageHandler.initReply(msg);
mDBUSMessageHandler.append((dbus_int16_t) returnCode);
mDBUSMessageHandler.append(listSystemProperties);
mDBUSMessageHandler.sendMessage();
}
-void CommandReceiverShadow::getTimingInformation(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::getTimingInformation(DBusConnection *conn, DBusMessage *msg)
{
- log(&commandDbus,DLT_LOG_INFO,"CommandReceiverShadow::getTimingInformation called");
+ log(&commandDbus, DLT_LOG_INFO, "CommandReceiverShadow::getTimingInformation called");
(void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ assert(mpIAmCommandReceive!=NULL);
mDBUSMessageHandler.initReceive(msg);
am_mainConnectionID_t mainConnectionID = (am_mainConnectionID_t) mDBUSMessageHandler.getUInt();
am_timeSync_t delay = 0;
- am_Error_e returnCode = mCommandReceiveInterface->getTimingInformation(mainConnectionID, delay);
+ 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 CommandReceiverShadow::receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data)
+DBusHandlerResult IAmCommandReceiverShadow::receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data)
{
assert(conn!=NULL);
assert(msg!=NULL);
assert(user_data!=NULL);
- CommandReceiverShadow* reference = (CommandReceiverShadow*) user_data;
+ IAmCommandReceiverShadow* reference = (IAmCommandReceiverShadow*) user_data;
return (reference->receiveCallbackDelegate(conn, msg));
}
-void CommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessage *msg)
+void IAmCommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessage *msg)
{
assert(conn!=NULL);
assert(msg!=NULL);
@@ -351,8 +352,12 @@ void CommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessage
// create a reply from the message
reply = dbus_message_new_method_return(msg);
- std::ifstream in(INTROSPECTION_COMMAND_XML_FILE);
- assert(in!=NULL);
+ std::ifstream in("CommandInterface.xml", std::ifstream::in);
+ if (!in)
+ {
+ logError("IAmCommandReceiverShadow::sendIntrospection could not load xml file");
+ 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();
@@ -374,7 +379,7 @@ void CommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessage
dbus_message_unref(reply);
}
-DBusHandlerResult CommandReceiverShadow::receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg)
+DBusHandlerResult IAmCommandReceiverShadow::receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg)
{
//DLT_LOG(dMain, DLT_LOG_INFO, DLT_STRING("message received"));
@@ -398,45 +403,45 @@ DBusHandlerResult CommandReceiverShadow::receiveCallbackDelegate(DBusConnection
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
}
-void CommandReceiverShadow::setCommandReceiver(CommandReceiveInterface*& receiver)
+void IAmCommandReceiverShadow::setCommandReceiver(IAmCommandReceive*& receiver)
{
assert(receiver!=NULL);
- mCommandReceiveInterface = receiver;
+ mpIAmCommandReceive = receiver;
- gObjectPathVTable.message_function = CommandReceiverShadow::receiveCallback;
+ gObjectPathVTable.message_function = IAmCommandReceiverShadow::receiveCallback;
DBusConnection* connection;
- mCommandReceiveInterface->getDBusConnectionWrapper(mDBusWrapper);
- assert(mDBusWrapper!=NULL);
+ mpIAmCommandReceive->getDBusConnectionWrapper(mpCAmDbusWrapper);
+ assert(mpCAmDbusWrapper!=NULL);
- mDBusWrapper->getDBusConnection(connection);
+ mpCAmDbusWrapper->getDBusConnection(connection);
assert(connection!=NULL);
mDBUSMessageHandler.setDBusConnection(connection);
std::string path(MY_NODE);
- mDBusWrapper->registerCallback(&gObjectPathVTable, path, this);
+ mpCAmDbusWrapper->registerCallback(&gObjectPathVTable, path, this);
}
-CommandReceiverShadow::functionMap_t CommandReceiverShadow::createMap()
+IAmCommandReceiverShadow::functionMap_t IAmCommandReceiverShadow::createMap()
{
functionMap_t m;
- m["Connect"] = &CommandReceiverShadow::connect;
- m["Disconnect"] = &CommandReceiverShadow::disconnect;
- m["SetVolume"] = &CommandReceiverShadow::setVolume;
- m["VolumeStep"] = &CommandReceiverShadow::volumeStep;
- m["SetSinkMuteState"] = &CommandReceiverShadow::setSinkMuteState;
- m["SetMainSinkSoundProperty"] = &CommandReceiverShadow::setMainSinkSoundProperty;
- m["SetMainSourceSoundProperty"] = &CommandReceiverShadow::setMainSourceSoundProperty;
- m["GetListMainConnections"] = &CommandReceiverShadow::getListMainConnections;
- m["GetListMainSinks"] = &CommandReceiverShadow::getListMainSinks;
- m["GetListMainSources"] = &CommandReceiverShadow::getListMainSources;
- m["GetListMainSinkSoundProperties"] = &CommandReceiverShadow::getListMainSinkSoundProperties;
- m["GetListMainSourceSoundProperties"] = &CommandReceiverShadow::getListMainSourceSoundProperties;
- m["GetListSourceClasses"] = &CommandReceiverShadow::getListSourceClasses;
- m["GetListSinkClasses"] = &CommandReceiverShadow::getListSinkClasses;
- m["GetListSystemProperties"] = &CommandReceiverShadow::getListSystemProperties;
- m["GetTimingInformation"] = &CommandReceiverShadow::getTimingInformation;
- m["SetSystemProperty"] = &CommandReceiverShadow::setSystemProperty;
+ 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;
return (m);
}
diff --git a/PluginCommandInterfaceDbus/test/DbusCommandInterfaceBackdoor.cpp b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.cpp
index a61f693..c3f53e1 100644
--- a/PluginCommandInterfaceDbus/test/DbusCommandInterfaceBackdoor.cpp
+++ b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.cpp
@@ -23,35 +23,36 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "DbusCommandInterfaceBackdoor.h"
+#include "CAmCommandSenderDbusBackdoor.h"
+#include "command/IAmCommandReceive.h"
using namespace am;
-DbusCommandInterfaceBackdoor::DbusCommandInterfaceBackdoor()
+CAmCommandSenderDbusBackdoor::CAmCommandSenderDbusBackdoor()
{
}
-DbusCommandInterfaceBackdoor::~DbusCommandInterfaceBackdoor()
+CAmCommandSenderDbusBackdoor::~CAmCommandSenderDbusBackdoor()
{
}
-void DbusCommandInterfaceBackdoor::setReceiveInterface(DbusCommandSender *sender, CommandReceiveInterface* interface)
+void CAmCommandSenderDbusBackdoor::setReceiveInterface(CAmCommandSenderDbus *sender, IAmCommandReceive* interface)
{
- sender->mCommandReceiveInterface=interface;
+ sender->mpIAmCommandReceive=interface;
}
-void DbusCommandInterfaceBackdoor::setDbusConnection(DbusCommandSender *sender, DBusConnection *conn)
+void CAmCommandSenderDbusBackdoor::setDbusConnection(CAmCommandSenderDbus *sender, DBusConnection *conn)
{
- sender->mDBUSMessageHandler.setDBusConnection(conn);
+ sender->mCAmDbusMessageHandler.setDBusConnection(conn);
}
-void DbusCommandInterfaceBackdoor::setListSinks(DbusCommandSender *sender, std::vector<am_SinkType_s> newList)
+void CAmCommandSenderDbusBackdoor::setListSinks(CAmCommandSenderDbus *sender, std::vector<am_SinkType_s> newList)
{
sender->mlistSinks=newList;
}
-void DbusCommandInterfaceBackdoor::setListSources(DbusCommandSender *sender, std::vector<am_SourceType_s> newList)
+void CAmCommandSenderDbusBackdoor::setListSources(CAmCommandSenderDbus *sender, std::vector<am_SourceType_s> newList)
{
sender->mlistSources=newList;
}
diff --git a/PluginCommandInterfaceDbus/test/DbusCommandInterfaceBackdoor.h b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.h
index 1549e65..bbbeda9 100644
--- a/PluginCommandInterfaceDbus/test/DbusCommandInterfaceBackdoor.h
+++ b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusBackdoor.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger AudioManagerDaemon
*
-* \file DubsCommandInterfaceBackdoor.h
+* \file DubsIAmCommandBackdoor
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,24 +26,25 @@
#ifndef DBUSCOMMANDINTERFACEBACKDOOR_H_
#define DBUSCOMMANDINTERFACEBACKDOOR_H_
+#include "../include/CAmCommandSenderDbus.h"
+#include <vector>
#include <dbus/dbus.h>
-#include "../include/DBusCommandSender.h"
-#include "../include/DBusMessageHandler.h"
-#include "../include/CommandReceiverShadow.h"
+#include "audiomanagertypes.h"
+#include "command/IAmCommandReceive.h"
namespace am {
-class DbusCommandSender;
+class CAmCommandSenderDbus;
-class DbusCommandInterfaceBackdoor
+class CAmCommandSenderDbusBackdoor
{
public:
- DbusCommandInterfaceBackdoor();
- virtual ~DbusCommandInterfaceBackdoor();
- void setReceiveInterface(DbusCommandSender *sender, CommandReceiveInterface* interface);
- void setDbusConnection(DbusCommandSender *sender,DBusConnection *conn);
- void setListSinks(DbusCommandSender *sender, std::vector<am_SinkType_s> newList);
- void setListSources(DbusCommandSender *sender, std::vector<am_SourceType_s> newList);
+ 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);
};
}
diff --git a/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.cpp
index 655a1f3..071af58 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp
+++ b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.cpp
@@ -23,48 +23,47 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "dbuscommaninterfacesignalsTest.h"
+#include "CAmCommandSenderDbusSignalTest.h"
+#include <python2.6/Python.h>
#include <iostream>
#include <fstream>
-#include <python2.6/Python.h>
-#include "../include/DBusCommandSender.h"
-#include "../include/DBusMessageHandler.h"
-#include "DbusCommandInterfaceBackdoor.h"
-#include "MockInterfaces.h"
-#include "DLTWrapper.h"
+#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"
using namespace am;
using namespace testing;
-
-dbuscommaninterfacesignalsTest::dbuscommaninterfacesignalsTest()
+CAmCommandSenderDbusSignalTest::CAmCommandSenderDbusSignalTest()
{
- DLTWrapper::instance()->registerApp("dbusTest","dbusTest");
+ CAmDltWrapper::instance()->registerApp("dbusTest", "dbusTest");
logInfo("dbusCommandInterfaceSignalTest started");
}
-dbuscommaninterfacesignalsTest::~dbuscommaninterfacesignalsTest()
+CAmCommandSenderDbusSignalTest::~CAmCommandSenderDbusSignalTest()
{
}
-void* NumberOfMainConnectionsChanged(void*)
+void* NumberOfMainConnectionsChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- sender.cbNumberOfMainConnectionsChanged();
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
+ am_MainConnectionType_s mainConnection;
+ sender->cbNewMainConnection(mainConnection);
return (NULL);
}
-void* cbSinkAdded(void*)
+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";
@@ -74,290 +73,191 @@ void* cbSinkAdded(void*)
mysink.muteState = MS_UNKNOWN;
mysink.sinkClassID = 3;
mysink.volume = 234;
- list.push_back(mysink);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- sender.cbNewSink(mysink);
+ sender->cbNewSink(mysink);
return (NULL);
}
-void* cbSourceAdded(void*)
+void* cbSourceAdded(void* ppCommandSend)
{
sleep(1);
- std::vector<am_SourceType_s> list;
- am_SourceType_s myource;
- myource.name = "MySink";
- myource.sourceID = 42;
- myource.availability.availability = A_MAX;
- myource.availability.availabilityReason = AR_UNKNOWN;
- myource.sourceClassID = 15;
- list.push_back(myource);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
- sender.cbNumberOfSourcesChanged();
+ 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*)
+void* cbSourceRemoved(void* ppCommandSend)
{
sleep(1);
- std::vector<am_SourceType_s> list;
- am_SourceType_s myource;
- myource.name = "MySink";
- myource.sourceID = 42;
- myource.availability.availability = A_MAX;
- myource.availability.availabilityReason = AR_UNKNOWN;
- myource.sourceClassID = 15;
- list.push_back(myource);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- backdoor.setListSources(&sender, list);
- DBusError error;
- dbus_error_init(&error);
- list.clear();
- EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- sender.cbNumberOfSourcesChanged();
+ 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*)
+void* cbSinkRemoved(void* ppCommandSend)
{
sleep(1);
- std::vector<am_SinkType_s> list;
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
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;
- list.push_back(mysink);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- backdoor.setListSinks(&sender, list);
- DBusError error;
- dbus_error_init(&error);
- list.clear();
- EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- sender.cbNumberOfSinksChanged();
+ sender->cbRemovedSink(mysink.sinkID);
return (NULL);
}
-void* NumberOfSinkClassesChanged(void*)
+void* NumberOfSinkClassesChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- sender.cbNumberOfSinkClassesChanged();
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
+ sender->cbNumberOfSinkClassesChanged();
return (NULL);
}
-void* NumberOfSourceClassesChanged(void*)
+void* NumberOfSourceClassesChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- sender.cbNumberOfSourceClassesChanged();
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
+ sender->cbNumberOfSourceClassesChanged();
return (NULL);
}
-void* MainConnectionStateChanged(void*)
+void* MainConnectionStateChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
am_connectionID_t id = 4;
am_ConnectionState_e state = CS_CONNECTING;
- sender.cbMainConnectionStateChanged(id, state);
+ sender->cbMainConnectionStateChanged(id, state);
return (NULL);
}
-void* MainSinkSoundPropertyChanged(void*)
+void* MainSinkSoundPropertyChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
+ 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);
+ sender->cbMainSinkSoundPropertyChanged(sinkID, soundProperty);
return (NULL);
}
-void* MainSourceSoundPropertyChanged(void*)
+void* MainSourceSoundPropertyChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
+ 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);
+ sender->cbMainSourceSoundPropertyChanged(sourceID, soundProperty);
return (NULL);
}
-void* cbSinkAvailabilityChangedLoop(void*)
+void* cbSinkAvailabilityChangedLoop(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
am_Availability_s av;
av.availability = A_AVAILABLE;
av.availabilityReason = AR_UNKNOWN;
- sender.cbSinkAvailabilityChanged(4, av);
+ sender->cbSinkAvailabilityChanged(4, av);
return (NULL);
}
-void* VolumeChanged(void*)
+void* VolumeChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
am_volume_t volume = 344;
- sender.cbVolumeChanged(23, volume);
+ sender->cbVolumeChanged(23, volume);
return (NULL);
}
-void* cbSourceAvailabilityChangedLoop(void*)
+void* cbSourceAvailabilityChangedLoop(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
am_Availability_s av;
av.availability = A_AVAILABLE;
av.availabilityReason = AR_UNKNOWN;
- sender.cbSourceAvailabilityChanged(2, av);
+ sender->cbSourceAvailabilityChanged(2, av);
return (NULL);
}
-void* SinkMuteStateChanged(void*)
+void* SinkMuteStateChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- sender.cbSinkMuteStateChanged(42, MS_MUTED);
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
+ sender->cbSinkMuteStateChanged(42, MS_MUTED);
return (NULL);
}
-void* SystemPropertyChanged(void*)
+void* SystemPropertyChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
am_SystemProperty_s property;
property.type = SYP_UNKNOWN;
property.value = 355;
- sender.cbSystemPropertyChanged(property);
+ sender->cbSystemPropertyChanged(property);
return (NULL);
}
-void* TimingInformationChanged(void*)
+void* TimingInformationChanged(void* ppCommandSend)
{
sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender, &receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender, co);
- sender.cbTimingInformationChanged(42, 233);
+ IAmCommandSend* sender=static_cast<IAmCommandSend*>(ppCommandSend);
+ sender->cbTimingInformationChanged(42, 233);
return (NULL);
}
-TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
+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("../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));
+
+ ppCommandSend->startupInterface(&pReceiveInterface);
+ ppCommandSend->setCommandReady(10);
+
pthread_t pythonloop;
- pthread_create(&pythonloop, NULL, NumberOfMainConnectionsChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, NumberOfMainConnectionsChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -373,7 +273,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
"loop.run()\n", NULL);
pthread_join(pythonloop, NULL);
- pthread_create(&pythonloop, NULL, cbSinkAdded, (void*) NULL);
+ pthread_create(&pythonloop, NULL, cbSinkAdded, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -402,7 +302,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
}
ifs.close();
- pthread_create(&pythonloop, NULL, cbSinkRemoved, (void*) NULL);
+ pthread_create(&pythonloop, NULL, cbSinkRemoved, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -432,7 +332,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
}
ifs.close();
- pthread_create(&pythonloop, NULL, cbSourceAdded, (void*) NULL);
+ pthread_create(&pythonloop, NULL, cbSourceAdded, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -461,7 +361,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
}
ifs.close();
- pthread_create(&pythonloop, NULL, cbSourceRemoved, (void*) NULL);
+ pthread_create(&pythonloop, NULL, cbSourceRemoved, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -491,7 +391,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
}
ifs.close();
- pthread_create(&pythonloop, NULL, NumberOfSinkClassesChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, NumberOfSinkClassesChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -507,7 +407,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
"loop.run()\n", NULL);
pthread_join(pythonloop, NULL);
- pthread_create(&pythonloop, NULL, NumberOfSourceClassesChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, NumberOfSourceClassesChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -525,7 +425,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, MainConnectionStateChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, MainConnectionStateChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -567,7 +467,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, MainSinkSoundPropertyChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, MainSinkSoundPropertyChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -600,7 +500,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
}
else if (lineCounter == 1)
{
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(23)), signature=None)"), 0);
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(23)), signature=None)"), 0);
}
lineCounter++;
}
@@ -608,7 +508,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, MainSourceSoundPropertyChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, MainSourceSoundPropertyChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -641,7 +541,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
}
else if (lineCounter == 1)
{
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(233)), signature=None)"), 0);
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(233)), signature=None)"), 0);
}
lineCounter++;
}
@@ -649,7 +549,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, cbSinkAvailabilityChangedLoop, (void*) NULL);
+ pthread_create(&pythonloop, NULL, cbSinkAvailabilityChangedLoop, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -682,7 +582,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
}
else if (lineCounter == 1)
{
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"), 0);
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(0)), signature=None)"), 0);
}
lineCounter++;
}
@@ -690,7 +590,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, cbSourceAvailabilityChangedLoop, (void*) NULL);
+ pthread_create(&pythonloop, NULL, cbSourceAvailabilityChangedLoop, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -723,7 +623,7 @@ TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
}
else if (lineCounter == 1)
{
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"), 0);
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(0)), signature=None)"), 0);
}
lineCounter++;
}
@@ -731,7 +631,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, VolumeChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, VolumeChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -773,7 +673,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, SinkMuteStateChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, SinkMuteStateChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -815,7 +715,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, SystemPropertyChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, SystemPropertyChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -846,7 +746,7 @@ TEST_F(dbuscommaninterfacesignalsTest,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...
- pthread_create(&pythonloop, NULL, TimingInformationChanged, (void*) NULL);
+ pthread_create(&pythonloop, NULL, TimingInformationChanged, (void*) ppCommandSend);
PyRun_SimpleStringFlags("import sys\n"
"import traceback\n"
"import gobject\n"
@@ -894,12 +794,12 @@ int main(int argc, char **argv)
return RUN_ALL_TESTS();
}
-void dbuscommaninterfacesignalsTest::SetUp()
+void CAmCommandSenderDbusSignalTest::SetUp()
{
Py_Initialize();
}
-void dbuscommaninterfacesignalsTest::TearDown()
+void CAmCommandSenderDbusSignalTest::TearDown()
{
Py_Finalize();
}
diff --git a/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.h b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.h
index 0f930d6..14ad9ef 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.h
+++ b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusSignalTest.h
@@ -25,25 +25,23 @@
#ifndef DBUSCOMMANINTERFACESIGNALSTEST_H_
#define DBUSCOMMANINTERFACESIGNALSTEST_H_
+
+
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <set>
-#include "CommandReceiver.h"
-#include "CommandSender.h"
-#include "MockInterfaces.h"
#define UNIT_TEST 1
namespace am {
-class dbuscommaninterfacesignalsTest: public ::testing::Test
+class IAmCommandSend;
+
+class CAmCommandSenderDbusSignalTest: public ::testing::Test
{
public:
- dbuscommaninterfacesignalsTest();
- virtual ~dbuscommaninterfacesignalsTest();
+ IAmCommandSend *ppCommandSend;
+ CAmCommandSenderDbusSignalTest();
+ virtual ~CAmCommandSenderDbusSignalTest();
void SetUp();
void TearDown();
};
diff --git a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.cpp
index f4dab30..e1d0197 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp
+++ b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.cpp
@@ -23,50 +23,51 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
+#include "CAmCommandSenderDbusTest.h"
#include <python2.6/Python.h>
-#include <dbus/DBusWrapper.h>
-#include "dbuscommandpluginInterfaceTest.h"
#include <iostream>
#include <fstream>
-#include "../include/DBusCommandSender.h"
-#include "../include/DBusMessageHandler.h"
-#include "DbusCommandInterfaceBackdoor.h"
-#include "MockInterfaces.h"
-#include "DLTWrapper.h"
-#include "SocketHandler.h"
+#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;
-//DLT_DECLARE_CONTEXT(DLT_CONTEXT)
-
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)
{
- SocketHandler* wrap = (SocketHandler*) wrapper;
+ CAmSocketHandler* wrap = (CAmSocketHandler*) wrapper;
wrap->start_listenting();
return (NULL);
}
-dbuscommandpluginInterfaceTest::dbuscommandpluginInterfaceTest() :
- pDatabaseHandler(std::string(":memory:")), //
- pControlSender("") //
+CAmCommandSenderDbusTest::CAmCommandSenderDbusTest()
{
- DLTWrapper::instance()->registerApp("dbusTest", "dbusTest");
+ CAmDltWrapper::instance()->registerApp("dbusTest", "dbusTest");
}
-dbuscommandpluginInterfaceTest::~dbuscommandpluginInterfaceTest()
+CAmCommandSenderDbusTest::~CAmCommandSenderDbusTest()
{
}
-void dbuscommandpluginInterfaceTest::SetUp()
+void CAmCommandSenderDbusTest::SetUp()
{
}
-void dbuscommandpluginInterfaceTest::TearDown()
+void CAmCommandSenderDbusTest::TearDown()
{
}
@@ -172,26 +173,46 @@ am::am_timeSync_t time=23;
arg1=time;
}
-TEST_F(dbuscommandpluginInterfaceTest,Connect)
+TEST_F(CAmCommandSenderDbusTest, MessageTest)
{
Py_Initialize();
//unfortunatly we need to put all in one testcase because testing with the dbus loop caused problems...
- SocketHandler pSocketHandler;
- DBusWrapper pDBusWrapper(&pSocketHandler);
+ CAmSocketHandler pSocketHandler;
+ CAmDbusWrapper pDBusWrapper(&pSocketHandler);
pthread_t ptestThread;
std::vector<std::string> plistCommandPluginDirs;
plistCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
- CommandSender pCommandSender(plistCommandPluginDirs);
- MockCommandReceiveInterface pReceiveInterface;
+ MockIAmCommandReceive pReceiveInterface;
//this class just creates the thread that will handle the mainloop...
pthread_create(&ptestThread, NULL, run_the_loop, (void*) &pSocketHandler);
- CommandReceiver pCommandReceiver(&pDatabaseHandler, &pControlSender, &pSocketHandler, &pDBusWrapper);
+
+ 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)));
- pCommandSender.startupInterfaces(&pCommandReceiver);
+ EXPECT_CALL(pReceiveInterface, confirmCommandReady(10));
+
+ 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());
@@ -204,12 +225,12 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
{
if (lineCounter == 1)
{
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
ASSERT_EQ(result, E_OK);
}
else if (lineCounter == 2)
{
- std::stringstream(line.substr(line.find_first_not_of(" uint16 "))) >> result;
+ std::stringstream(line.replace(line.begin(), line.begin() + 10, "")) >> result;
ASSERT_EQ(result, 35);
}
lineCounter++;
@@ -229,7 +250,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
{
if (lineCounter == 1)
{
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
ASSERT_EQ(result, E_OK);
}
lineCounter++;
@@ -249,7 +270,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
{
if (lineCounter == 1)
{
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
ASSERT_EQ(result, E_OK);
}
lineCounter++;
@@ -269,7 +290,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
{
if (lineCounter == 1)
{
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
ASSERT_EQ(result, E_OK);
}
lineCounter++;
@@ -289,7 +310,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
{
if (lineCounter == 1)
{
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ std::stringstream(line.replace(line.begin(), line.begin() + 9, "")) >> result;
ASSERT_EQ(result, E_OK);
}
lineCounter++;
@@ -417,7 +438,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
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(0), dbus.Int16(2)), signature=None), dbus.Int16(124), dbus.Int16(1), dbus.UInt16(34)), signature=None)], signature=dbus.Signature('(qs(nn)nnq)')))"), 0);
+ 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();
@@ -442,7 +463,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
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(1)), signature=None), dbus.UInt16(12)), signature=None), dbus.Struct((dbus.UInt16(22), dbus.String(u'NextSource'), dbus.Struct((dbus.Int16(3), dbus.Int16(1)), signature=None), dbus.UInt16(12)), signature=None)], signature=dbus.Signature('(qs(nn)q)')))"), 0);
+ 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();
@@ -467,7 +488,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
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);
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(4), dbus.Int16(223)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None)], signature=dbus.Signature('(nn)')))"), 0);
}
ifs.close();
@@ -492,7 +513,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
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);
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(4), dbus.Int16(223)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None)], signature=dbus.Signature('(nn)')))"), 0);
}
ifs.close();
@@ -517,7 +538,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
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(1), 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(1), dbus.Int16(12)), signature=None), dbus.Struct((dbus.Int16(1), dbus.Int16(12)), signature=None)], signature=dbus.Signature('(nn)'))), signature=None)], signature=dbus.Signature('(qsa(nn))')))"), 0);
+ 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();
@@ -542,7 +563,7 @@ TEST_F(dbuscommandpluginInterfaceTest,Connect)
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(0), 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(0), dbus.Int16(122)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(122)), signature=None)], signature=dbus.Signature('(nn)'))), signature=None)], signature=dbus.Signature('(qsa(nn))')))"), 0);
+ 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();
diff --git a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.h b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.h
index d45a107..a89affd 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.h
+++ b/PluginCommandInterfaceDbus/test/CAmCommandSenderDbusTest.h
@@ -29,23 +29,13 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <set>
-#include "CommandReceiver.h"
-#include "CommandSender.h"
-#include "MockInterfaces.h"
-#include "DbusCommandInterfaceBackdoor.h"
-#include "DatabaseHandler.h"
-#include "ControlSender.h"
-
#define UNIT_TEST 1
namespace am {
-class DbusCommandInterfaceBackdoor;
+class CAmCommandSenderDbusBackdoor;
+class IAmCommandSend;
/*
* originally, I would want to have several tests, but there are problems implementing this with
@@ -55,13 +45,12 @@ class DbusCommandInterfaceBackdoor;
*/
-class dbuscommandpluginInterfaceTest :public ::testing::Test
+class CAmCommandSenderDbusTest :public ::testing::Test
{
public:
- DatabaseHandler pDatabaseHandler;
- ControlSender pControlSender;
- dbuscommandpluginInterfaceTest();
- ~dbuscommandpluginInterfaceTest();
+ IAmCommandSend *ppCommandSend;
+ CAmCommandSenderDbusTest();
+ ~CAmCommandSenderDbusTest();
void SetUp();
void TearDown();
diff --git a/PluginCommandInterfaceDbus/test/CMakeLists.txt b/PluginCommandInterfaceDbus/test/CMakeLists.txt
index 8745af8..d1eabbf 100644
--- a/PluginCommandInterfaceDbus/test/CMakeLists.txt
+++ b/PluginCommandInterfaceDbus/test/CMakeLists.txt
@@ -23,7 +23,7 @@
cmake_minimum_required(VERSION 2.6)
-PROJECT(controlInterfacetest)
+PROJECT(CAmCommandSenderDbusTests)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
@@ -41,13 +41,13 @@ INCLUDE_DIRECTORIES(
${STD_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${DBUS_ARCH_INCLUDE_DIR}
- ${DBUS_INCLUDES_FOLDER}
+ ${DBUS_include_FOLDER}
${CMAKE_SOURCE_DIR}
${DLT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIR}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
${PYTHON_INCLUDE_DIRS}
${GTEST_INCLUDE_DIR}
"../../AudioManagerDaemon/include"
@@ -55,31 +55,28 @@ INCLUDE_DIRECTORIES(
)
file(GLOB DBUS_PLUGIN_INTERFACE_SRCS_CXX
- "../../AudioManagerDaemon/src/DBusWrapper.cpp"
- "../../AudioManagerDaemon/src/CommandSender.cpp"
- "../../AudioManagerDaemon/src/SocketHandler.cpp"
- "../../AudioManagerDaemon/src/DLTWrapper.cpp"
+ "../../AudioManagerDaemon/src/CAmDbusWrapper.cpp"
+ "../../AudioManagerDaemon/src/CAmSocketHandler.cpp"
+ "../../AudioManagerDaemon/src/CAmDltWrapper.cpp"
"../src/*.cpp"
- "dbuscommandpluginInterfaceTest.cpp"
- "DbusCommanInterfaceBackdoor.cpp"
+ "CAmCommandSenderDbusBackdoor.cpp"
+ "CAmCommandSenderDbusTest.cpp"
+
)
file(GLOB DBUS_SIGNAL_INTERFACE_SRCS_CXX
- "../../AudioManagerDaemon/src/DBusWrapper.cpp"
- "../../AudioManagerDaemon/src/CommandSender.cpp"
- "../../AudioManagerDaemon/src/SocketHandler.cpp"
- "../../AudioManagerDaemon/src/DLTWrapper.cpp"
- "../../AudioManagerDaemon/src/DatabaseHandler.cpp"
- "../../AudioManagerDaemon/src/ControlSender.cpp"
- "../src/*.cpp"
- "dbuscommaninterfacesignalsTest.cpp"
- "DbusCommandInterfaceBackdoor.cpp"
+ "../../AudioManagerDaemon/src/CAmDbusWrapper.cpp"
+ "../../AudioManagerDaemon/src/CAmSocketHandler.cpp"
+ "../../AudioManagerDaemon/src/CAmDltWrapper.cpp"
+ "../src/*.cpp"
+ "CAmCommandSenderDbusBackdoor.cpp"
+ "CAmCommandSenderDbusSignalTest.cpp"
)
-ADD_EXECUTABLE(dbusCommandMessages ${DBUS_PLUGIN_INTERFACE_SRCS_CXX})
+ADD_EXECUTABLE(AmCommandSenderDbusTest ${DBUS_PLUGIN_INTERFACE_SRCS_CXX})
-ADD_EXECUTABLE(dbusCommandSignals ${DBUS_SIGNAL_INTERFACE_SRCS_CXX})
+ADD_EXECUTABLE(AmCommandSenderDbusSignalTest ${DBUS_SIGNAL_INTERFACE_SRCS_CXX})
-TARGET_LINK_LIBRARIES(dbusCommandMessages
+TARGET_LINK_LIBRARIES(AmCommandSenderDbusTest
${DLT_LIBRARIES}
${DBUS_LIBRARY}
${CMAKE_DL_LIBS}
@@ -90,7 +87,7 @@ TARGET_LINK_LIBRARIES(dbusCommandMessages
)
-TARGET_LINK_LIBRARIES(dbusCommandSignals
+TARGET_LINK_LIBRARIES(AmCommandSenderDbusSignalTest
${DLT_LIBRARIES}
${DBUS_LIBRARY}
${CMAKE_DL_LIBS}
@@ -100,13 +97,13 @@ TARGET_LINK_LIBRARIES(dbusCommandSignals
gmock
)
-INSTALL(TARGETS dbusCommandMessages
+INSTALL(TARGETS AmCommandSenderDbusTest
DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
)
-INSTALL(TARGETS dbusCommandSignals
+INSTALL(TARGETS AmCommandSenderDbusSignalTest
DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
diff --git a/PluginCommandInterfaceDbus/test/MockIAmCommandReceive.h b/PluginCommandInterfaceDbus/test/MockIAmCommandReceive.h
new file mode 100644
index 0000000..bb9e53f
--- /dev/null
+++ b/PluginCommandInterfaceDbus/test/MockIAmCommandReceive.h
@@ -0,0 +1,59 @@
+#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_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_CONST_METHOD1(getInterfaceVersion,
+ void(std::string& version));
+ MOCK_METHOD1(confirmCommandReady,
+ void(const uint16_t handle));
+ MOCK_METHOD1(confirmCommandRundown,
+ void(const uint16_t handle));
+};
+
+} // namespace am
+#endif /* MOCKCOMMANDRECEIVENTERFACE_H_ */
diff --git a/PluginCommandInterfaceDbus/test/MockInterfaces.h b/PluginCommandInterfaceDbus/test/MockInterfaces.h
deleted file mode 100644
index b4e7792..0000000
--- a/PluginCommandInterfaceDbus/test/MockInterfaces.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file MochInterfaces.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
-
-#ifndef MOCKINTERFACES_H_
-#define MOCKINTERFACES_H_
-
-namespace am {
-
-class MockCommandReceiveInterface : public CommandReceiveInterface {
- public:
- 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(DBusWrapper*& dbusConnectionWrapper));
- MOCK_CONST_METHOD1(getSocketHandler,
- am_Error_e(SocketHandler*& socketHandler));
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
- MOCK_METHOD1(confirmCommandReady,
- void(const uint16_t handle));
- MOCK_METHOD1(confirmCommandRundown,
- void(const uint16_t handle));
-
-
-};
-
-} // namespace am
-
-
-
-#endif /* MOCKINTERFACES_H_ */
diff --git a/PluginControlInterface/CMakeLists.txt b/PluginControlInterface/CMakeLists.txt
index 5946df7..7701364 100644
--- a/PluginControlInterface/CMakeLists.txt
+++ b/PluginControlInterface/CMakeLists.txt
@@ -4,9 +4,9 @@ PROJECT(PluginControlInterface)
set(LIBRARY_OUTPUT_PATH ${PLUGINS_OUTPUT_PATH}/control)
set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/ControlPlugin)
-set(INCLUDES_FOLDER "include")
+set(include_FOLDER "include")
-FILE(READ "${AUDIO_INCLUDES_FOLDER}/control/ControlSendInterface.h" VERSION_BUFFER LIMIT 6000)
+FILE(READ "${AUDIO_include_FOLDER}/control/IAmControlSend.h" VERSION_BUFFER LIMIT 6000)
STRING(REGEX MATCH "ControlSendVersion*.[^0-9]*[0-9].[0-9]*[0-9]" LIB_INTERFACE_VERSION_STRING ${VERSION_BUFFER})
STRING(REGEX REPLACE "ControlSendVersion*.." "" LIB_INTERFACE_VERSION ${LIB_INTERFACE_VERSION_STRING})
MESSAGE(STATUS "Building against control interface version ${LIB_INTERFACE_VERSION}")
@@ -15,8 +15,8 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${STD_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
- ${INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
+ ${include_FOLDER}
)
# all source files go here
diff --git a/PluginControlInterface/include/ControlSender.h b/PluginControlInterface/include/CAmControlSenderBase.h
index e96f445..3d06356 100644
--- a/PluginControlInterface/include/ControlSender.h
+++ b/PluginControlInterface/include/CAmControlSenderBase.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger DbusPlugin
*
- * \file ControlSender.h
+ * \file CAmControlSender.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,17 +26,17 @@
#ifndef CONTROLSENDER_H_
#define CONTROLSENDER_H_
-#include <control/ControlSendInterface.h>
+#include "control/IAmControlSend.h"
#include <list>
using namespace am;
-class ControlSenderPlugin: public ControlSendInterface
+class CAmControlSenderBase: public IAmControlSend
{
public:
- ControlSenderPlugin();
- virtual ~ControlSenderPlugin();
- am_Error_e startupController(ControlReceiveInterface* controlreceiveinterface);
+ CAmControlSenderBase();
+ virtual ~CAmControlSenderBase();
+ am_Error_e startupController(IAmControlReceive* controlreceiveinterface);
void setControllerReady();
void setControllerRundown();
am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID);
@@ -85,7 +85,7 @@ public:
void confirmRoutingRundown();
private:
- ControlReceiveInterface * mControlReceiveInterface;
+ IAmControlReceive * mControlReceiveInterface;
struct handleStatus
{
bool status;
diff --git a/PluginControlInterface/src/ControlSender.cpp b/PluginControlInterface/src/CAmControlSenderBase.cpp
index 567f8c6..9538ca3 100644
--- a/PluginControlInterface/src/ControlSender.cpp
+++ b/PluginControlInterface/src/CAmControlSenderBase.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger DbusPlugin
*
- * \file ControlSender.cpp
+ * \file CAmControlSender.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -23,25 +23,25 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "ControlSender.h"
-#include "control/ControlReceiveInterface.h"
+#include "CAmControlSenderBase.h"
#include <cassert>
#include <algorithm>
-#include "DLTWrapper.h"
+#include "shared/CAmDltWrapper.h"
+#include "control/IAmControlReceive.h"
using namespace am;
-extern "C" ControlSendInterface* PluginControlInterfaceFactory()
+extern "C" IAmControlSend* PluginControlInterfaceFactory()
{
- return (new ControlSenderPlugin());
+ return (new CAmControlSenderBase());
}
-extern "C" void destroyControlPluginInterface(ControlSendInterface* controlSendInterface)
+extern "C" void destroyControlPluginInterface(IAmControlSend* controlSendInterface)
{
delete controlSendInterface;
}
-ControlSenderPlugin::ControlSenderPlugin() :
+CAmControlSenderBase::CAmControlSenderBase() :
mControlReceiveInterface(NULL), //
mListOpenConnections(), //
mListOpenDisconnections(), //
@@ -49,11 +49,11 @@ ControlSenderPlugin::ControlSenderPlugin() :
{
}
-ControlSenderPlugin::~ControlSenderPlugin()
+CAmControlSenderBase::~CAmControlSenderBase()
{
}
-am_Error_e ControlSenderPlugin::startupController(ControlReceiveInterface *controlreceiveinterface)
+am_Error_e CAmControlSenderBase::startupController(IAmControlReceive *controlreceiveinterface)
{
assert(controlreceiveinterface);
mControlReceiveInterface = controlreceiveinterface;
@@ -62,14 +62,14 @@ am_Error_e ControlSenderPlugin::startupController(ControlReceiveInterface *contr
return E_NOT_USED;
}
-void ControlSenderPlugin::setControllerReady()
+void CAmControlSenderBase::setControllerReady()
{
//here is a good place to insert Source and SinkClasses into the database...
mControlReceiveInterface->setRoutingReady();
mControlReceiveInterface->setCommandReady();
}
-am_Error_e ControlSenderPlugin::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
+am_Error_e CAmControlSenderBase::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
std::vector<am_Route_s> listRoutes;
std::vector<am_connectionID_t> listConnectionIDs;
@@ -103,7 +103,7 @@ am_Error_e ControlSenderPlugin::hookUserConnectionRequest(const am_sourceID_t so
return E_OK;
}
-am_Error_e ControlSenderPlugin::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
+am_Error_e CAmControlSenderBase::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
{
//first check if there is a connectionID like that
am_MainConnection_s mainConnection;
@@ -129,7 +129,7 @@ am_Error_e ControlSenderPlugin::hookUserDisconnectionRequest(const am_mainConnec
return E_OK;
}
-am_Error_e ControlSenderPlugin::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
+am_Error_e CAmControlSenderBase::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
{
if (sinkID == 0)
return E_NON_EXISTENT;
@@ -150,20 +150,20 @@ am_Error_e ControlSenderPlugin::hookUserSetMainSinkSoundProperty(const am_sinkID
return E_OK;
}
-am_Error_e ControlSenderPlugin::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
+am_Error_e CAmControlSenderBase::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
{
(void) sourceID;
(void) soundProperty;
return E_NOT_USED;
}
-am_Error_e ControlSenderPlugin::hookUserSetSystemProperty(const am_SystemProperty_s & property)
+am_Error_e CAmControlSenderBase::hookUserSetSystemProperty(const am_SystemProperty_s & property)
{
(void) property;
return E_NOT_USED;
}
-am_Error_e ControlSenderPlugin::hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume)
+am_Error_e CAmControlSenderBase::hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume)
{
assert(SinkID!=0);
mainVolumeSet set;
@@ -178,7 +178,7 @@ am_Error_e ControlSenderPlugin::hookUserVolumeChange(const am_sinkID_t SinkID, c
return E_OK;
}
-am_Error_e ControlSenderPlugin::hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment)
+am_Error_e CAmControlSenderBase::hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment)
{
assert(SinkID!=0);
mainVolumeSet set;
@@ -195,133 +195,133 @@ am_Error_e ControlSenderPlugin::hookUserVolumeStep(const am_sinkID_t SinkID, con
return E_OK;
}
-am_Error_e ControlSenderPlugin::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
+am_Error_e CAmControlSenderBase::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
(void) sinkID;
(void) muteState;
return E_NOT_USED;
}
-am_Error_e ControlSenderPlugin::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
+am_Error_e CAmControlSenderBase::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->enterDomainDB(domainData, domainID);
}
-am_Error_e ControlSenderPlugin::hookSystemDeregisterDomain(const am_domainID_t domainID)
+am_Error_e CAmControlSenderBase::hookSystemDeregisterDomain(const am_domainID_t domainID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->removeDomainDB(domainID);
}
-void ControlSenderPlugin::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
+void CAmControlSenderBase::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
{
(void) domainID;
}
-am_Error_e ControlSenderPlugin::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+am_Error_e CAmControlSenderBase::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->enterSinkDB(sinkData, sinkID);
}
-am_Error_e ControlSenderPlugin::hookSystemDeregisterSink(const am_sinkID_t sinkID)
+am_Error_e CAmControlSenderBase::hookSystemDeregisterSink(const am_sinkID_t sinkID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->removeSinkDB(sinkID);
}
-am_Error_e ControlSenderPlugin::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+am_Error_e CAmControlSenderBase::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->enterSourceDB(sourceData, sourceID);
}
-am_Error_e ControlSenderPlugin::hookSystemDeregisterSource(const am_sourceID_t sourceID)
+am_Error_e CAmControlSenderBase::hookSystemDeregisterSource(const am_sourceID_t sourceID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->removeSourceDB(sourceID);
}
-am_Error_e ControlSenderPlugin::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+am_Error_e CAmControlSenderBase::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->enterGatewayDB(gatewayData, gatewayID);
}
-am_Error_e ControlSenderPlugin::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
+am_Error_e CAmControlSenderBase::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->removeGatewayDB(gatewayID);
}
-am_Error_e ControlSenderPlugin::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+am_Error_e CAmControlSenderBase::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->enterCrossfaderDB(crossfaderData, crossfaderID);
}
-am_Error_e ControlSenderPlugin::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
+am_Error_e CAmControlSenderBase::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
//this application does not do anything with it -> but some product might want to take influence here
return mControlReceiveInterface->removeCrossfaderDB(crossfaderID);
}
-void ControlSenderPlugin::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
+void CAmControlSenderBase::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
(void) handle;
(void) sinkID;
(void) volume;
}
-void ControlSenderPlugin::hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
+void CAmControlSenderBase::hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
(void) handle;
(void) sourceID;
(void) volume;
}
-void ControlSenderPlugin::hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
+void CAmControlSenderBase::hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
(void) sourceID;
(void) interruptState;
}
-void ControlSenderPlugin::hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
+void CAmControlSenderBase::hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
(void) sinkID;
(void) availability;
}
-void ControlSenderPlugin::hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
+void CAmControlSenderBase::hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
(void) sourceID;
(void) availability;
}
-void ControlSenderPlugin::hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
+void CAmControlSenderBase::hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
{
(void) domainID;
(void) state;
}
-void ControlSenderPlugin::hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> & data)
+void CAmControlSenderBase::hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> & data)
{
(void) data;
}
-void ControlSenderPlugin::hookSystemSpeedChange(const am_speed_t speed)
+void CAmControlSenderBase::hookSystemSpeedChange(const am_speed_t speed)
{
(void) speed;
}
-void ControlSenderPlugin::hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
+void CAmControlSenderBase::hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
{
(void) mainConnectionID;
(void) time;
}
-void ControlSenderPlugin::cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
+void CAmControlSenderBase::cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
{
(void) errorID;
//\todo:error checking
@@ -345,7 +345,7 @@ void ControlSenderPlugin::cbAckConnect(const am_Handle_s handle, const am_Error_
}
}
-void ControlSenderPlugin::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
+void CAmControlSenderBase::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
{
(void) errorID;
//\todo:error checking
@@ -369,14 +369,14 @@ void ControlSenderPlugin::cbAckDisconnect(const am_Handle_s handle, const am_Err
}
}
-void ControlSenderPlugin::cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
+void CAmControlSenderBase::cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
{
(void) handle;
(void) hostsink;
(void) error;
}
-void ControlSenderPlugin::cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
+void CAmControlSenderBase::cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
(void) error;
(void) volume;
@@ -391,26 +391,26 @@ void ControlSenderPlugin::cbAckSetSinkVolumeChange(const am_Handle_s handle, con
}
}
-void ControlSenderPlugin::cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error)
+void CAmControlSenderBase::cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error)
{
(void) error;
(void) voulme;
(void) handle;
}
-void ControlSenderPlugin::cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSenderBase::cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
(void) error;
(void) handle;
}
-void ControlSenderPlugin::cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSenderBase::cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
(void) error;
(void) handle;
}
-void ControlSenderPlugin::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSenderBase::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
(void) error;
//\todo:error checking
@@ -424,23 +424,23 @@ void ControlSenderPlugin::cbAckSetSinkSoundProperty(const am_Handle_s handle, co
}
}
-void ControlSenderPlugin::cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSenderBase::cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
(void) error;
(void) handle;
}
-void ControlSenderPlugin::cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
+void CAmControlSenderBase::cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
(void) error;
(void) handle;
}
-void ControlSenderPlugin::setControllerRundown()
+void CAmControlSenderBase::setControllerRundown()
{
}
-am_Error_e ControlSenderPlugin::getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e> & listPrioConnectionFormats)
+am_Error_e CAmControlSenderBase::getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e> & listPrioConnectionFormats)
{
(void) sourceID;
(void) sinkID;
@@ -450,27 +450,27 @@ am_Error_e ControlSenderPlugin::getConnectionFormatChoice(const am_sourceID_t so
return (E_OK);
}
-void ControlSenderPlugin::getInterfaceVersion(std::string & version) const
+void CAmControlSenderBase::getInterfaceVersion(std::string & version) const
{
version = ControlSendVersion;
}
-void ControlSenderPlugin::confirmCommandReady()
+void CAmControlSenderBase::confirmCommandReady()
{
logInfo("ControlSenderPlugin got Routing Ready confirmed");
}
-void ControlSenderPlugin::confirmRoutingReady()
+void CAmControlSenderBase::confirmRoutingReady()
{
logInfo("ControlSenderPlugin got Command Ready confirmed");
}
-void ControlSenderPlugin::confirmCommandRundown()
+void CAmControlSenderBase::confirmCommandRundown()
{
logInfo("ControlSenderPlugin got Routing Rundown confirmed");
}
-void ControlSenderPlugin::confirmRoutingRundown()
+void CAmControlSenderBase::confirmRoutingRundown()
{
logInfo("ControlSenderPlugin got Command Rundown confirmed");
}
diff --git a/PluginRoutingInterfaceAsync/CMakeLists.txt b/PluginRoutingInterfaceAsync/CMakeLists.txt
index 598b4fe..35f9e7e 100644
--- a/PluginRoutingInterfaceAsync/CMakeLists.txt
+++ b/PluginRoutingInterfaceAsync/CMakeLists.txt
@@ -26,9 +26,9 @@ PROJECT(PluginRoutingInterfaceAsync)
set(LIBRARY_OUTPUT_PATH ${PLUGINS_OUTPUT_PATH}/routing)
set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/RoutingAsync)
-set(INCLUDES_FOLDER "include")
+set(include_FOLDER "include")
-FILE(READ "${AUDIO_INCLUDES_FOLDER}/routing/RoutingSendInterface.h" VERSION_BUFFER LIMIT 6000)
+FILE(READ "${AUDIO_include_FOLDER}/routing/IAmRoutingSend.h" VERSION_BUFFER LIMIT 6000)
STRING(REGEX MATCH "RoutingSendVersion*.[^0-9]*[0-9].[0-9]*[0-9]" LIB_INTERFACE_VERSION_STRING ${VERSION_BUFFER})
STRING(REGEX REPLACE "RoutingSendVersion*.." "" LIB_INTERFACE_VERSION ${LIB_INTERFACE_VERSION_STRING})
MESSAGE(STATUS "Building against routing interface version ${LIB_INTERFACE_VERSION}")
@@ -39,8 +39,8 @@ FIND_PACKAGE(DBUS REQUIRED)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
- ${INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
+ ${include_FOLDER}
${DBUS_INCLUDE_DIR}
${DBUS_ARCH_INCLUDE_DIR}
)
diff --git a/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h b/PluginRoutingInterfaceAsync/include/CAmRoutingSenderAsync.h
index 96e1b5c..377b7c5 100644
--- a/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h
+++ b/PluginRoutingInterfaceAsync/include/CAmRoutingSenderAsync.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger DbusPlugin
*
- * \file RoutingSender.h
+ * \file CAmRoutingSender.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,28 +26,26 @@
#ifndef ROUTINGSENDER_H_
#define ROUTINGSENDER_H_
-#include <routing/RoutingSendInterface.h>
-#include "RoutingReceiverAsyncShadow.h"
+#include "routing/IAmRoutingSend.h"
+#include "IAmRoutingReceiverShadow.h"
#include <semaphore.h>
#include <memory.h>
namespace am
{
-class WorkerThreadPool;
+class CAmWorkerThreadPool;
/**
* Base class for workers implements everything that is needed to implement a workerthread
* inherit from this class when adding new workers
*/
-class Worker
+class CAmWorker
{
public:
- Worker(WorkerThreadPool* pool);
- virtual ~Worker()
- {
- }
- ;
+ CAmWorker(CAmWorkerThreadPool* pool);
+ virtual ~CAmWorker()
+ {};
/**
* needs to be overwritten, this function is called when the worker should start to work
*/
@@ -72,7 +70,7 @@ public:
* @param cancel
*/
void setCancelSempaphore(sem_t* cancel);
- WorkerThreadPool* pPool;
+ CAmWorkerThreadPool* pPool;
private:
sem_t* mCancelSem; //<! semaphore for cancellation
};
@@ -80,22 +78,22 @@ private:
/**
* This class handles the threadpool
*/
-class WorkerThreadPool
+class CAmWorkerThreadPool
{
public:
/**
* creates the pool. Give the max number of threads as argument
* @param numThreads max number of threads
*/
- WorkerThreadPool(int numThreads);
- virtual ~WorkerThreadPool();
+ CAmWorkerThreadPool(int numThreads);
+ virtual ~CAmWorkerThreadPool();
/**
* assigns a thread to a worker class and starts working.
* @param worker
* @return the actual assigned workerID or -1 in case no thread is free
*/
- int16_t startWork(Worker* worker);
+ int16_t startWork(CAmWorker* worker);
/**
* cancels a thread
* @param workerID thread to be canceled
@@ -110,7 +108,7 @@ public:
void finishedWork(pthread_t threadID);
private:
- static void* WorkerThread(void* data);
+ static void* CAmWorkerThread(void* data);
int mNumThreads;
struct threadInfo_s
{
@@ -119,18 +117,18 @@ private:
bool busy;
sem_t block;
sem_t cancel;
- Worker *worker;
+ CAmWorker *worker;
};
std::vector<threadInfo_s> mListWorkers; //<! list of all workers
static pthread_mutex_t mBlockingMutex; //<! mutex to block the acces of the list
};
-class AsyncRoutingSender: public RoutingSendInterface
+class CAmRoutingSenderAsync: public IAmRoutingSend
{
public:
- AsyncRoutingSender();
- virtual ~AsyncRoutingSender();
- am_Error_e startupInterface(RoutingReceiveInterface* routingreceiveinterface) ;
+ CAmRoutingSenderAsync();
+ virtual ~CAmRoutingSenderAsync();
+ am_Error_e startupInterface(IAmRoutingReceive* routingreceiveinterface) ;
void setRoutingReady(const uint16_t handle) ;
void setRoutingRundown(const uint16_t handle) ;
am_Error_e asyncAbort(const am_Handle_s handle) ;
@@ -227,16 +225,16 @@ private:
std::vector<am_Sink_s> createSinkTable();
std::vector<am_Source_s> createSourceTable();
std::vector<am_Gateway_s> createGatewayTable();
- RoutingReceiverAsyncShadow* mShadow;
- RoutingReceiveInterface* mReceiveInterface;
- SocketHandler *mSocketHandler;
+ IAmRoutingReceiverShadow* mShadow;
+ IAmRoutingReceive* mReceiveInterface;
+ CAmSocketHandler *mSocketHandler;
std::vector<am_Domain_s> mDomains;
std::vector<am_Sink_s> mSinks;
std::vector<am_Source_s> mSources;
std::vector<am_Gateway_s> mGateways;
std::map<uint16_t, int16_t> mMapHandleWorker;
std::map<am_connectionID_t, am_RoutingElement_s> mMapConnectionIDRoute;
- WorkerThreadPool mPool;
+ CAmWorkerThreadPool mPool;
pthread_t mInterruptThread;
static pthread_mutex_t mMapConnectionMutex;
static pthread_mutex_t mMapHandleWorkerMutex;
@@ -248,15 +246,15 @@ private:
/**
* worker to for connection
*/
-class asycConnectWorker: public Worker
+class asycConnectWorker: public CAmWorker
{
public:
- asycConnectWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat);
+ asycConnectWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_connectionID_t mConnectionID;
am_sourceID_t mSourceID;
@@ -267,15 +265,15 @@ private:
/**
* worker for disconnecting
*/
-class asycDisConnectWorker: public Worker
+class asycDisConnectWorker: public CAmWorker
{
public:
- asycDisConnectWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID);
+ asycDisConnectWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_connectionID_t mConnectionID;
am_ConnectionFormat_e mConnectionFormat;
@@ -289,15 +287,15 @@ private:
#include <sys/signalfd.h>
#include <signal.h>
-class asyncSetSinkVolumeWorker: public Worker
+class asyncSetSinkVolumeWorker: public CAmWorker
{
public:
- asyncSetSinkVolumeWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
+ asyncSetSinkVolumeWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_volume_t mCurrentVolume;
am_Handle_s mHandle;
am_sinkID_t mSinkID;
@@ -306,15 +304,15 @@ private:
am_time_t mTime;
};
-class asyncSetSourceVolumeWorker: public Worker
+class asyncSetSourceVolumeWorker: public CAmWorker
{
public:
- asyncSetSourceVolumeWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sourceID_t SourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
+ asyncSetSourceVolumeWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sourceID_t SourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_volume_t mCurrentVolume;
am_Handle_s mHandle;
am_sourceID_t mSourceID;
@@ -323,70 +321,70 @@ private:
am_time_t mTime;
};
-class asyncSetSourceStateWorker: public Worker
+class asyncSetSourceStateWorker: public CAmWorker
{
public:
- asyncSetSourceStateWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state);
+ asyncSetSourceStateWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_sourceID_t mSourceID;
am_SourceState_e mSourcestate;
};
-class asyncSetSinkSoundPropertyWorker: public Worker
+class asyncSetSinkSoundPropertyWorker: public CAmWorker
{
public:
- asyncSetSinkSoundPropertyWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID);
+ asyncSetSinkSoundPropertyWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_sinkID_t mSinkID;
am_SoundProperty_s mSoundProperty;
};
-class asyncSetSourceSoundPropertyWorker: public Worker
+class asyncSetSourceSoundPropertyWorker: public CAmWorker
{
public:
- asyncSetSourceSoundPropertyWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID);
+ asyncSetSourceSoundPropertyWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_Handle_s mHandle;
am_sourceID_t mSourceID;
am_SoundProperty_s mSoundProperty;
};
-class asyncDomainStateChangeWorker: public Worker
+class asyncDomainStateChangeWorker: public CAmWorker
{
public:
- asyncDomainStateChangeWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_domainID_t domainID, const am_DomainState_e domainState);
+ asyncDomainStateChangeWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const am_domainID_t domainID, const am_DomainState_e domainState);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
am_domainID_t mDomainID;
am_DomainState_e mDomainState;
};
-class syncRegisterWorker: public Worker
+class syncRegisterWorker: public CAmWorker
{
public:
- syncRegisterWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const std::vector<am_Domain_s> domains, const std::vector<am_Sink_s> sinks, const std::vector<am_Source_s> sources, const uint16_t handle);
+ syncRegisterWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const std::vector<am_Domain_s> domains, const std::vector<am_Sink_s> sinks, const std::vector<am_Source_s> sources, const uint16_t handle);
void start2work();
void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
+ CAmRoutingSenderAsync * mAsyncSender;
+ IAmRoutingReceiverShadow *mShadow;
std::vector<am_Domain_s> mListDomains;
std::vector<am_Sink_s> mListSinks;
std::vector<am_Source_s> mListSources;
diff --git a/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h b/PluginRoutingInterfaceAsync/include/IAmRoutingReceiverShadow.h
index bf5a5ed..af4685c 100644
--- a/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h
+++ b/PluginRoutingInterfaceAsync/include/IAmRoutingReceiverShadow.h
@@ -25,11 +25,11 @@
#ifndef ROUTINGRECEIVERASYNCSHADOW_H_
#define ROUTINGRECEIVERASYNCSHADOW_H_
-#include <routing/RoutingReceiveInterface.h>
-#include <SocketHandler.h>
+#include "routing/IAmRoutingReceive.h"
#include <pthread.h>
#include <queue>
-#include "CAmSerializer.h"
+#include "shared/CAmSerializer.h"
+#include "shared/CAmSocketHandler.h"
namespace am
{
@@ -38,11 +38,11 @@ namespace am
* Threadsafe shadow of the RoutingReceiverInterface
* Register and deregister Functions are sychronous so they do not show up here...
*/
-class RoutingReceiverAsyncShadow
+class IAmRoutingReceiverShadow
{
public:
- RoutingReceiverAsyncShadow(RoutingReceiveInterface* iReceiveInterface,SocketHandler* iSocketHandler);
- virtual ~RoutingReceiverAsyncShadow();
+ IAmRoutingReceiverShadow(IAmRoutingReceive* iReceiveInterface,CAmSocketHandler* iSocketHandler);
+ virtual ~IAmRoutingReceiverShadow();
void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
@@ -66,11 +66,12 @@ public:
am_Error_e deregisterSource(const am_sourceID_t sourceID) ;
am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
void confirmRoutingReady(uint16_t starupHandle);
+ void confirmRoutingRundown(uint16_t rundownHandle);
private:
- SocketHandler *mSocketHandler;
- RoutingReceiveInterface *mRoutingReceiveInterface;
+ CAmSocketHandler *mSocketHandler;
+ IAmRoutingReceive *mRoutingReceiveInterface;
CAmSerializer mSerializer;
};
diff --git a/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp b/PluginRoutingInterfaceAsync/src/CAmRoutingSenderAsync.cpp
index 68b260f..31e5948 100644
--- a/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp
+++ b/PluginRoutingInterfaceAsync/src/CAmRoutingSenderAsync.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger DbusPlugin
*
- * \file RoutingSender.cpp
+ * \file CAmRoutingSender.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -22,8 +22,7 @@
*
*/
-#include "RoutingSenderAsyn.h"
-#include "DLTWrapper.h"
+#include "CAmRoutingSenderAsync.h"
#include <algorithm>
#include <vector>
#include <poll.h>
@@ -33,255 +32,178 @@
#include <sstream>
#include <string>
#include <dbus/dbus.h>
+#include "shared/CAmDltWrapper.h"
using namespace am;
DLT_DECLARE_CONTEXT(PluginRoutingAsync)
-extern "C" RoutingSendInterface* PluginRoutingInterfaceAsyncFactory()
+extern "C" IAmRoutingSend* PluginRoutingInterfaceAsyncFactory()
{
- return (new AsyncRoutingSender());
+ return (new CAmRoutingSenderAsync());
}
-extern "C" void destroyRoutingPluginInterfaceAsync(RoutingSendInterface* routingSendInterface)
+extern "C" void destroyRoutingPluginInterfaceAsync(IAmRoutingSend* routingSendInterface)
{
delete routingSendInterface;
}
-pthread_mutex_t AsyncRoutingSender::mMapConnectionMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t AsyncRoutingSender::mMapHandleWorkerMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t AsyncRoutingSender::mSinksMutex= PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t AsyncRoutingSender::mSourcesMutex= PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t AsyncRoutingSender::mDomainsMutex= PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t WorkerThreadPool::mBlockingMutex = PTHREAD_MUTEX_INITIALIZER;
-
-//void* AsyncRoutingSender::InterruptEvents(void *data)
-//{
-// RoutingReceiverAsyncShadow *shadow=(RoutingReceiverAsyncShadow *)data;
-// DBusError err;
-// DBusMessage* msg;
-// DBusConnection* conn;
-// dbus_error_init(&err);
-// conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
-// dbus_uint32_t serial = 0;
-// DBusMessage* reply;
-// DBusMessageIter args;
-// dbus_bus_request_name(conn, "org.genivi.test",DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
-//
-// while (dbus_connection_read_write_dispatch(conn, -1))
-// {
-// dbus_connection_read_write(conn, 0);
-// msg = dbus_connection_pop_message(conn);
-//
-// if (dbus_message_is_method_call(msg, "org.genivi.test", "timingChanged"))
-// {
-// am_connectionID_t connectionID;
-// am_timeSync_t delay;
-// dbus_message_iter_init(msg, &args);
-// dbus_message_iter_get_basic(&args,(void*) &connectionID);
-// dbus_message_iter_next(&args);
-// dbus_message_iter_get_basic(&args,(void*) &delay);
-// reply = dbus_message_new_method_return(msg);
-// dbus_message_iter_init_append(reply, &args);
-// dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &connectionID);
-// dbus_connection_send(conn, reply, &serial);
-// shadow->hookTimingInformationChanged(connectionID,delay);
-// dbus_message_unref(reply);
-// }
-// else if (dbus_message_is_method_call(msg, "org.genivi.test", "SinkAvailablityStatusChange"))
-// {
-// am_sinkID_t sinkID;
-// am_Availability_s availability;
-// dbus_message_iter_init(msg, &args);
-// dbus_message_iter_get_basic(&args,(void*) &sinkID);
-// reply = dbus_message_new_method_return(msg);
-// dbus_message_iter_init_append(reply, &args);
-// dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sinkID);
-// dbus_connection_send(conn, reply, &serial);
-// shadow->hookSinkAvailablityStatusChange(sinkID,availability);
-// dbus_message_unref(reply);
-// }
-// else if (dbus_message_is_method_call(msg, "org.genivi.test", "SourceAvailablityStatusChange"))
-// {
-// am_sourceID_t sourceID;
-// am_Availability_s availability;
-// dbus_message_iter_init(msg, &args);
-// dbus_message_iter_get_basic(&args,(void*) &sourceID);
-// reply = dbus_message_new_method_return(msg);
-// dbus_message_iter_init_append(reply, &args);
-// dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sourceID);
-// dbus_connection_send(conn, reply, &serial);
-// shadow->hookSourceAvailablityStatusChange(sourceID,availability);
-// dbus_message_unref(reply);
-// }
-// else if (dbus_message_is_method_call(msg, "org.genivi.test", "InterruptStatusChange"))
-// {
-// am_sourceID_t sourceID;
-//
-// am_InterruptState_e state=IS_UNKNOWN;
-// dbus_message_iter_init(msg, &args);
-// dbus_message_iter_get_basic(&args,(void*) &sourceID);
-// reply = dbus_message_new_method_return(msg);
-// dbus_message_iter_init_append(reply, &args);
-// dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sourceID);
-// dbus_connection_send(conn, reply, &serial);
-// shadow->hookInterruptStatusChange(sourceID,state);
-// dbus_message_unref(reply);
-// }
-// dbus_connection_flush(conn);
-// }
-// return NULL;
-//}
-
- void *WorkerThreadPool::WorkerThread(void* data)
- {
- threadInfo_s *myInfo=(threadInfo_s*)data;
- while (1)
- {
- sem_wait(&myInfo->block);
- pthread_mutex_lock(&mBlockingMutex);
- Worker* actWorker=myInfo->worker;
- pthread_mutex_unlock(&mBlockingMutex);
- actWorker->setCancelSempaphore(&myInfo->cancel);
- actWorker->start2work();
- actWorker->pPool->finishedWork(myInfo->threadID);
- }
- return NULL;
- }
+pthread_mutex_t CAmRoutingSenderAsync::mMapConnectionMutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t CAmRoutingSenderAsync::mMapHandleWorkerMutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t CAmRoutingSenderAsync::mSinksMutex= PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t CAmRoutingSenderAsync::mSourcesMutex= PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t CAmRoutingSenderAsync::mDomainsMutex= PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t CAmWorkerThreadPool::mBlockingMutex = PTHREAD_MUTEX_INITIALIZER;
- WorkerThreadPool::WorkerThreadPool(int numThreads):
- mNumThreads(numThreads)
- {
- int workerID=0;
- mListWorkers.resize(mNumThreads);
- for (int i=0;i<mNumThreads;i++)
- {
- sem_init(&mListWorkers[i].block,NULL,NULL);
- sem_init(&mListWorkers[i].cancel,NULL,NULL);
- mListWorkers[i].busy=false;
- mListWorkers[i].workerID=++workerID;
- pthread_create(&mListWorkers[i].threadID,NULL,&WorkerThreadPool::WorkerThread,(void*)&mListWorkers[i]);
- }
- }
+void *CAmWorkerThreadPool::CAmWorkerThread(void* data)
+{
+ threadInfo_s *myInfo=(threadInfo_s*)data;
+ while (1)
+ {
+ sem_wait(&myInfo->block);
+ pthread_mutex_lock(&mBlockingMutex);
+ CAmWorker* actWorker=myInfo->worker;
+ pthread_mutex_unlock(&mBlockingMutex);
+ actWorker->setCancelSempaphore(&myInfo->cancel);
+ actWorker->start2work();
+ actWorker->pPool->finishedWork(myInfo->threadID);
+ }
+ return NULL;
+}
- int16_t WorkerThreadPool::startWork(Worker *worker)
+CAmWorkerThreadPool::CAmWorkerThreadPool(int numThreads):
+mNumThreads(numThreads)
+{
+ int workerID=0;
+ mListWorkers.resize(mNumThreads);
+ for (int i=0;i<mNumThreads;i++)
+ {
+ sem_init(&mListWorkers[i].block,NULL,NULL);
+ sem_init(&mListWorkers[i].cancel,NULL,NULL);
+ mListWorkers[i].busy=false;
+ mListWorkers[i].workerID=++workerID;
+ pthread_create(&mListWorkers[i].threadID,NULL,&CAmWorkerThreadPool::CAmWorkerThread,(void*)&mListWorkers[i]);
+ }
+}
+
+int16_t CAmWorkerThreadPool::startWork(CAmWorker *worker)
+{
+ pthread_mutex_lock(&mBlockingMutex);
+ std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
+ for(;it!=mListWorkers.end();++it)
+ {
+ if(!it->busy)
{
- pthread_mutex_lock(&mBlockingMutex);
- std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
- for(;it!=mListWorkers.end();++it)
- {
- if(!it->busy)
- {
- it->worker=worker;
- it->busy=true;
- pthread_mutex_unlock(&mBlockingMutex);
- sem_post(&it->block);
- return ((int)it->workerID);
- }
- }
+ it->worker=worker;
+ it->busy=true;
pthread_mutex_unlock(&mBlockingMutex);
- return (-1);
+ sem_post(&it->block);
+ return ((int)it->workerID);
}
+ }
+ pthread_mutex_unlock(&mBlockingMutex);
+ return (-1);
+}
- bool WorkerThreadPool::cancelWork(int workerID)
+bool CAmWorkerThreadPool::cancelWork(int workerID)
+{
+ std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
+ for(;it!=mListWorkers.end();++it)
+ {
+ if(it->workerID==workerID && it->busy)
{
- std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
- for(;it!=mListWorkers.end();++it)
- {
- if(it->workerID==workerID && it->busy)
- {
- sem_post(&it->cancel);
- return (true);
- }
- }
- return (false);
+ sem_post(&it->cancel);
+ return (true);
}
+ }
+ return (false);
+}
- void WorkerThreadPool::finishedWork(pthread_t threadID)
+void CAmWorkerThreadPool::finishedWork(pthread_t threadID)
+{
+ pthread_mutex_lock(&mBlockingMutex);
+ std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
+ for(;it!=mListWorkers.end();++it)
+ {
+ if(it->threadID==threadID)
{
- pthread_mutex_lock(&mBlockingMutex);
- std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
- for(;it!=mListWorkers.end();++it)
- {
- if(it->threadID==threadID)
- {
- it->busy=false;
- delete it->worker;
- break;
- }
- }
- pthread_mutex_unlock(&mBlockingMutex);
+ it->busy=false;
+ delete it->worker;
+ break;
}
+ }
+ pthread_mutex_unlock(&mBlockingMutex);
+}
- WorkerThreadPool::~WorkerThreadPool()
- {
- for (int i=0;i<mNumThreads;i++)
- {
- pthread_cancel(mListWorkers[i].threadID);
- }
- }
+CAmWorkerThreadPool::~CAmWorkerThreadPool()
+{
+ for (int i=0;i<mNumThreads;i++)
+ {
+ pthread_cancel(mListWorkers[i].threadID);
+ }
+}
- Worker::Worker(WorkerThreadPool *pool):
- pPool(pool), mCancelSem()
- {
- }
+CAmWorker::CAmWorker(CAmWorkerThreadPool *pool):
+pPool(pool), mCancelSem()
+{
+}
- void Worker::setCancelSempaphore(sem_t* cancel)
- {
- mCancelSem=cancel;
- }
+void CAmWorker::setCancelSempaphore(sem_t* cancel)
+{
+ mCancelSem=cancel;
+}
- bool Worker::timedWait(timespec timer)
- {
- timespec temp;
- if(clock_gettime(0, &temp)==-1)
- {
- logError("Worker::timedWait error on getting time");
- }
- temp.tv_nsec+=timer.tv_nsec;
- temp.tv_sec+=timer.tv_sec;
- //if(sem_wait(mCancelSem)==-1)
+bool CAmWorker::timedWait(timespec timer)
+{
+ timespec temp;
+ if(clock_gettime(0, &temp)==-1)
+ {
+ logError("Worker::timedWait error on getting time");
+ }
+ temp.tv_nsec+=timer.tv_nsec;
+ temp.tv_sec+=timer.tv_sec;
+ //if(sem_wait(mCancelSem)==-1)
if (sem_timedwait(mCancelSem,&temp)==-1)
{
//a timeout happened
- if(errno == ETIMEDOUT)
- {
- logInfo("Worker::timedWait timed out - no bug !");
- return (false);
- }
- else //failure in waiting, nevertheless, we quit the thread...
- {
- logError("Worker::timedWait semaphore waiting error");
- return (true);
- }
+ if(errno == ETIMEDOUT)
+ {
+ logInfo("Worker::timedWait timed out - no bug !");
+ return (false);
+ }
+ else //failure in waiting, nevertheless, we quit the thread...
+ {
+ logError("Worker::timedWait semaphore waiting error");
+ return (true);
}
- logError("Worker::timedWait semaphore waiting error");
- this->cancelWork();
- return (true);
}
+ logError("Worker::timedWait semaphore waiting error");
+ this->cancelWork();
+ return (true);
+}
- AsyncRoutingSender::AsyncRoutingSender():
- mReceiveInterface(0), mDomains(createDomainTable()), mSinks(createSinkTable()), mSources ( createSourceTable ( ) ), mGateways ( createGatewayTable ( ) ), mMapHandleWorker ( ) , mMapConnectionIDRoute ( ) , mPool (10)
+CAmRoutingSenderAsync::CAmRoutingSenderAsync():
+mReceiveInterface(0), mDomains(createDomainTable()), mSinks(createSinkTable()), mSources ( createSourceTable ( ) ), mGateways ( createGatewayTable ( ) ), mMapHandleWorker ( ) , mMapConnectionIDRoute ( ) , mPool (10)
{
}
-AsyncRoutingSender::~AsyncRoutingSender()
+CAmRoutingSenderAsync::~CAmRoutingSenderAsync()
{
delete mShadow;
}
-am_Error_e AsyncRoutingSender::startupInterface(RoutingReceiveInterface *routingreceiveinterface)
+am_Error_e CAmRoutingSenderAsync::startupInterface(IAmRoutingReceive *routingreceiveinterface)
{
//first, create the Shadow:
assert(routingreceiveinterface!=0);
mReceiveInterface = routingreceiveinterface;
- SocketHandler* handler;
+ CAmSocketHandler* handler;
routingreceiveinterface->getSocketHandler(handler);
- mShadow = new RoutingReceiverAsyncShadow(routingreceiveinterface, handler);
+ mShadow = new IAmRoutingReceiverShadow(routingreceiveinterface, handler);
return E_OK;
}
-void AsyncRoutingSender::setRoutingReady(const uint16_t handle)
+void CAmRoutingSenderAsync::setRoutingReady(const uint16_t handle)
{
syncRegisterWorker *worker = new syncRegisterWorker(this, &mPool, mShadow, mDomains, mSinks, mSources, handle);
@@ -311,12 +233,13 @@ void AsyncRoutingSender::setRoutingReady(const uint16_t handle)
//pthread_create(&mInterruptThread,NULL,&AsyncRoutingSender::InterruptEvents,&mShadow);
}
-void AsyncRoutingSender::setRoutingRundown(const uint16_t handle)
+void CAmRoutingSenderAsync::setRoutingRundown(const uint16_t handle)
{
assert(mReceiveInterface!=0);
+ mShadow->confirmRoutingRundown(handle);
}
-am_Error_e AsyncRoutingSender::asyncAbort(const am_Handle_s handle)
+am_Error_e CAmRoutingSenderAsync::asyncAbort(const am_Handle_s handle)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
@@ -337,7 +260,7 @@ am_Error_e AsyncRoutingSender::asyncAbort(const am_Handle_s handle)
return (E_UNKNOWN);
}
-am_Error_e AsyncRoutingSender::asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
+am_Error_e CAmRoutingSenderAsync::asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
@@ -400,7 +323,7 @@ am_Error_e AsyncRoutingSender::asyncConnect(const am_Handle_s handle, const am_c
return (E_OK);
}
-am_Error_e AsyncRoutingSender::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID)
+am_Error_e CAmRoutingSenderAsync::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
@@ -435,7 +358,7 @@ am_Error_e AsyncRoutingSender::asyncDisconnect(const am_Handle_s handle, const a
return (E_OK);
}
-am_Error_e AsyncRoutingSender::asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
+am_Error_e CAmRoutingSenderAsync::asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
@@ -477,7 +400,7 @@ am_Error_e AsyncRoutingSender::asyncSetSinkVolume(const am_Handle_s handle, cons
return (E_OK);
}
-am_Error_e AsyncRoutingSender::asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
+am_Error_e CAmRoutingSenderAsync::asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
@@ -519,7 +442,7 @@ am_Error_e AsyncRoutingSender::asyncSetSourceVolume(const am_Handle_s handle, co
return (E_OK);
}
-am_Error_e AsyncRoutingSender::asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)
+am_Error_e CAmRoutingSenderAsync::asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
@@ -561,7 +484,7 @@ am_Error_e AsyncRoutingSender::asyncSetSourceState(const am_Handle_s handle, con
return (E_OK);
}
-am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
+am_Error_e CAmRoutingSenderAsync::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
@@ -603,7 +526,7 @@ am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handl
return (E_OK);
}
-am_Error_e AsyncRoutingSender::asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
+am_Error_e CAmRoutingSenderAsync::asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
{
//todo: implement crossfader
(void) handle;
@@ -614,7 +537,7 @@ am_Error_e AsyncRoutingSender::asyncCrossFade(const am_Handle_s handle, const am
return E_NOT_USED;
}
-am_Error_e AsyncRoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
+am_Error_e CAmRoutingSenderAsync::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
assert(mReceiveInterface!=0);
assert(domainID!=0);
@@ -650,7 +573,7 @@ am_Error_e AsyncRoutingSender::setDomainState(const am_domainID_t domainID, cons
}
-am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
+am_Error_e CAmRoutingSenderAsync::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
@@ -692,13 +615,13 @@ am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s han
return (E_OK);
}
-am_Error_e AsyncRoutingSender::returnBusName(std::string & BusName) const
+am_Error_e CAmRoutingSenderAsync::returnBusName(std::string & BusName) const
{
BusName = "RoutingAsync";
return (E_OK);
}
-std::vector<am_Domain_s> AsyncRoutingSender::createDomainTable()
+std::vector<am_Domain_s> CAmRoutingSenderAsync::createDomainTable()
{
//just write two domains into the table and return it
std::vector<am_Domain_s> table;
@@ -720,7 +643,7 @@ std::vector<am_Domain_s> AsyncRoutingSender::createDomainTable()
return (table);
}
-std::vector<am_Sink_s> AsyncRoutingSender::createSinkTable()
+std::vector<am_Sink_s> CAmRoutingSenderAsync::createSinkTable()
{
//create a bunch full of sinks
std::vector<am_Sink_s> table;
@@ -760,7 +683,7 @@ std::vector<am_Sink_s> AsyncRoutingSender::createSinkTable()
return (table);
}
-std::vector<am_Source_s> AsyncRoutingSender::createSourceTable()
+std::vector<am_Source_s> CAmRoutingSenderAsync::createSourceTable()
{
//create a bunch full of sources
std::vector<am_Source_s> table;
@@ -784,14 +707,14 @@ std::vector<am_Source_s> AsyncRoutingSender::createSourceTable()
return (table);
}
-void AsyncRoutingSender::insertConnectionSafe(am_connectionID_t connectionID, am_RoutingElement_s route)
+void CAmRoutingSenderAsync::insertConnectionSafe(am_connectionID_t connectionID, am_RoutingElement_s route)
{
pthread_mutex_lock(&mMapConnectionMutex);
mMapConnectionIDRoute.insert(std::make_pair(connectionID, route));
pthread_mutex_unlock(&mMapConnectionMutex);
}
-void AsyncRoutingSender::removeHandleSafe(uint16_t handle)
+void CAmRoutingSenderAsync::removeHandleSafe(uint16_t handle)
{
pthread_mutex_lock(&mMapHandleWorkerMutex);
if (!mMapHandleWorker.erase(handle))
@@ -801,7 +724,7 @@ void AsyncRoutingSender::removeHandleSafe(uint16_t handle)
pthread_mutex_unlock(&mMapHandleWorkerMutex);
}
-void AsyncRoutingSender::removeConnectionSafe(am_connectionID_t connectionID)
+void CAmRoutingSenderAsync::removeConnectionSafe(am_connectionID_t connectionID)
{
pthread_mutex_lock(&mMapConnectionMutex);
if (!mMapConnectionIDRoute.erase(connectionID))
@@ -811,7 +734,7 @@ void AsyncRoutingSender::removeConnectionSafe(am_connectionID_t connectionID)
pthread_mutex_unlock(&mMapConnectionMutex);
}
-void AsyncRoutingSender::updateSinkVolumeSafe(am_sinkID_t sinkID, am_volume_t volume)
+void CAmRoutingSenderAsync::updateSinkVolumeSafe(am_sinkID_t sinkID, am_volume_t volume)
{
pthread_mutex_lock(&mSinksMutex);
std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
@@ -826,7 +749,7 @@ void AsyncRoutingSender::updateSinkVolumeSafe(am_sinkID_t sinkID, am_volume_t vo
pthread_mutex_unlock(&mSinksMutex);
}
-void am::AsyncRoutingSender::updateSourceVolumeSafe(am_sourceID_t sourceID, am_volume_t volume)
+void am::CAmRoutingSenderAsync::updateSourceVolumeSafe(am_sourceID_t sourceID, am_volume_t volume)
{
pthread_mutex_lock(&mSourcesMutex);
std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
@@ -841,7 +764,7 @@ void am::AsyncRoutingSender::updateSourceVolumeSafe(am_sourceID_t sourceID, am_v
pthread_mutex_unlock(&mSourcesMutex);
}
-void am::AsyncRoutingSender::updateSourceStateSafe(am_sourceID_t sourceID, am_SourceState_e state)
+void am::CAmRoutingSenderAsync::updateSourceStateSafe(am_sourceID_t sourceID, am_SourceState_e state)
{
pthread_mutex_lock(&mSourcesMutex);
std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
@@ -856,7 +779,7 @@ void am::AsyncRoutingSender::updateSourceStateSafe(am_sourceID_t sourceID, am_So
pthread_mutex_unlock(&mSourcesMutex);
}
-void am::AsyncRoutingSender::updateSinkSoundPropertySafe(am_sinkID_t sinkID, am_SoundProperty_s soundProperty)
+void am::CAmRoutingSenderAsync::updateSinkSoundPropertySafe(am_sinkID_t sinkID, am_SoundProperty_s soundProperty)
{
pthread_mutex_lock(&mSinksMutex);
std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
@@ -878,7 +801,7 @@ void am::AsyncRoutingSender::updateSinkSoundPropertySafe(am_sinkID_t sinkID, am_
pthread_mutex_unlock(&mSinksMutex);
}
-void am::AsyncRoutingSender::updateSourceSoundPropertySafe(am_sourceID_t sourceID, am_SoundProperty_s soundProperty)
+void am::CAmRoutingSenderAsync::updateSourceSoundPropertySafe(am_sourceID_t sourceID, am_SoundProperty_s soundProperty)
{
pthread_mutex_lock(&mSourcesMutex);
std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
@@ -900,7 +823,7 @@ void am::AsyncRoutingSender::updateSourceSoundPropertySafe(am_sourceID_t sourceI
pthread_mutex_unlock(&mSourcesMutex);
}
-void am::AsyncRoutingSender::updateDomainstateSafe(am_domainID_t domainID, am_DomainState_e domainState)
+void am::CAmRoutingSenderAsync::updateDomainstateSafe(am_domainID_t domainID, am_DomainState_e domainState)
{
pthread_mutex_lock(&mDomainsMutex);
std::vector<am_Domain_s>::iterator domainIter = mDomains.begin();
@@ -915,33 +838,33 @@ void am::AsyncRoutingSender::updateDomainstateSafe(am_domainID_t domainID, am_Do
pthread_mutex_unlock(&mDomainsMutex);
}
-void am::AsyncRoutingSender::updateDomainListSafe(std::vector<am_Domain_s> listDomains)
+void am::CAmRoutingSenderAsync::updateDomainListSafe(std::vector<am_Domain_s> listDomains)
{
pthread_mutex_lock(&mDomainsMutex);
mDomains = listDomains;
pthread_mutex_unlock(&mDomainsMutex);
}
-void am::AsyncRoutingSender::updateSourceListSafe(std::vector<am_Source_s> listSource)
+void am::CAmRoutingSenderAsync::updateSourceListSafe(std::vector<am_Source_s> listSource)
{
pthread_mutex_lock(&mSourcesMutex);
mSources = listSource;
pthread_mutex_unlock(&mSourcesMutex);
}
-void am::AsyncRoutingSender::updateSinkListSafe(std::vector<am_Sink_s> listSinks)
+void am::CAmRoutingSenderAsync::updateSinkListSafe(std::vector<am_Sink_s> listSinks)
{
pthread_mutex_lock(&mSinksMutex);
mSinks = listSinks;
pthread_mutex_unlock(&mSinksMutex);
}
-void AsyncRoutingSender::getInterfaceVersion(std::string & version) const
+void CAmRoutingSenderAsync::getInterfaceVersion(std::string & version) const
{
version = RoutingSendVersion;
}
-am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
+am_Error_e CAmRoutingSenderAsync::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
//todo: implement
(void) handle;
@@ -950,7 +873,7 @@ am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s h
return (E_NOT_USED);
}
-am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
+am_Error_e CAmRoutingSenderAsync::asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
//todo: implement
(void) handle;
@@ -959,7 +882,7 @@ am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperties(const am_Handle_s han
return (E_NOT_USED);
}
-std::vector<am_Gateway_s> AsyncRoutingSender::createGatewayTable()
+std::vector<am_Gateway_s> CAmRoutingSenderAsync::createGatewayTable()
{
std::vector<am_Gateway_s> table;
am_Gateway_s item;
@@ -970,8 +893,8 @@ std::vector<am_Gateway_s> AsyncRoutingSender::createGatewayTable()
return (table);
}
-asycConnectWorker::asycConnectWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat) :
- Worker(pool), //
+asycConnectWorker::asycConnectWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool *pool, IAmRoutingReceiverShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mHandle(handle), //
@@ -1013,8 +936,8 @@ void asycConnectWorker::cancelWork()
mShadow->ackConnect(mHandle, mConnectionID, E_ABORTED);
}
-asycDisConnectWorker::asycDisConnectWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_connectionID_t connectionID) :
- Worker(pool), //
+asycDisConnectWorker::asycDisConnectWorker(CAmRoutingSenderAsync *asyncSender, CAmWorkerThreadPool *pool, IAmRoutingReceiverShadow *shadow, const am_Handle_s handle, const am_connectionID_t connectionID) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mHandle(handle), //
@@ -1051,8 +974,8 @@ void asycDisConnectWorker::cancelWork()
mShadow->ackDisconnect(mHandle, mConnectionID, E_ABORTED);
}
-asyncSetSinkVolumeWorker::asyncSetSinkVolumeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) :
- Worker(pool), //
+asyncSetSinkVolumeWorker::asyncSetSinkVolumeWorker(CAmRoutingSenderAsync *asyncSender, CAmWorkerThreadPool *pool, IAmRoutingReceiverShadow *shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mCurrentVolume(currentVolume), //
@@ -1100,8 +1023,8 @@ void asyncSetSinkVolumeWorker::cancelWork()
mShadow->ackSetSinkVolumeChange(mHandle, mCurrentVolume, E_ABORTED);
}
-asyncSetSourceVolumeWorker::asyncSetSourceVolumeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sourceID_t SourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) :
- Worker(pool), //
+asyncSetSourceVolumeWorker::asyncSetSourceVolumeWorker(CAmRoutingSenderAsync *asyncSender, CAmWorkerThreadPool *pool, IAmRoutingReceiverShadow *shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sourceID_t SourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mCurrentVolume(currentVolume), //
@@ -1149,8 +1072,8 @@ void asyncSetSourceVolumeWorker::cancelWork()
mShadow->ackSetSourceVolumeChange(mHandle, mCurrentVolume, E_ABORTED);
}
-asyncSetSourceStateWorker::asyncSetSourceStateWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) :
- Worker(pool), //
+asyncSetSourceStateWorker::asyncSetSourceStateWorker(CAmRoutingSenderAsync *asyncSender, CAmWorkerThreadPool *pool, IAmRoutingReceiverShadow *shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mHandle(handle), //
@@ -1189,8 +1112,8 @@ void asyncSetSourceStateWorker::cancelWork()
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-asyncSetSinkSoundPropertyWorker::asyncSetSinkSoundPropertyWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID) :
- Worker(pool), //
+asyncSetSinkSoundPropertyWorker::asyncSetSinkSoundPropertyWorker(CAmRoutingSenderAsync *asyncSender, CAmWorkerThreadPool *pool, IAmRoutingReceiverShadow *shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mHandle(handle), //
@@ -1229,8 +1152,8 @@ void asyncSetSinkSoundPropertyWorker::cancelWork()
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-asyncSetSourceSoundPropertyWorker::asyncSetSourceSoundPropertyWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID) :
- Worker(pool), //
+asyncSetSourceSoundPropertyWorker::asyncSetSourceSoundPropertyWorker(CAmRoutingSenderAsync *asyncSender, CAmWorkerThreadPool *pool, IAmRoutingReceiverShadow *shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mHandle(handle), //
@@ -1269,8 +1192,8 @@ void asyncSetSourceSoundPropertyWorker::cancelWork()
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-asyncDomainStateChangeWorker::asyncDomainStateChangeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_domainID_t domainID, const am_DomainState_e domainState) :
- Worker(pool), //
+asyncDomainStateChangeWorker::asyncDomainStateChangeWorker(CAmRoutingSenderAsync *asyncSender, CAmWorkerThreadPool *pool, IAmRoutingReceiverShadow *shadow, const am_domainID_t domainID, const am_DomainState_e domainState) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mDomainID(domainID), //
@@ -1303,14 +1226,13 @@ void am::asyncDomainStateChangeWorker::cancelWork()
mShadow->hookDomainStateChange(mDomainID, mDomainState);
}
-syncRegisterWorker::syncRegisterWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const std::vector<am_Domain_s> domains, const std::vector<am_Sink_s> sinks, const std::vector<am_Source_s> sources, const uint16_t handle) :
- Worker(pool), //
+syncRegisterWorker::syncRegisterWorker(CAmRoutingSenderAsync * asyncSender, CAmWorkerThreadPool* pool, IAmRoutingReceiverShadow* shadow, const std::vector<am_Domain_s> domains, const std::vector<am_Sink_s> sinks, const std::vector<am_Source_s> sources, const uint16_t handle) :
+ CAmWorker(pool), //
mAsyncSender(asyncSender), //
mShadow(shadow), //
mListDomains(domains), //
mListSinks(sinks), //
- mListSources(sources),
- mHandle(handle)
+ mListSources(sources), mHandle(handle)
{
}
diff --git a/PluginRoutingInterfaceAsync/src/IAmRoutingReceiverShadow.cpp b/PluginRoutingInterfaceAsync/src/IAmRoutingReceiverShadow.cpp
new file mode 100644
index 0000000..b8733db
--- /dev/null
+++ b/PluginRoutingInterfaceAsync/src/IAmRoutingReceiverShadow.cpp
@@ -0,0 +1,195 @@
+/**
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file RoutingReceiverAsyncShadow.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ */
+
+#include "IAmRoutingReceiverShadow.h"
+#include <cassert>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <string.h>
+#include <netdb.h>
+#include <fcntl.h>
+#include <sys/un.h>
+#include <errno.h>
+#include <string>
+#include "shared/CAmDltWrapper.h"
+
+using namespace am;
+
+IAmRoutingReceiverShadow::IAmRoutingReceiverShadow(IAmRoutingReceive* iReceiveInterface, CAmSocketHandler* iSocketHandler) :
+ mSocketHandler(iSocketHandler), //
+ mRoutingReceiveInterface(iReceiveInterface), //
+ mSerializer(iSocketHandler)
+{
+
+}
+
+IAmRoutingReceiverShadow::~IAmRoutingReceiverShadow()
+{
+}
+
+void IAmRoutingReceiverShadow::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_connectionID_t, const am_Error_e>(mRoutingReceiveInterface, &IAmRoutingReceive::ackConnect, handle, connectionID, error);
+}
+
+void IAmRoutingReceiverShadow::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_connectionID_t, const am_Error_e>(mRoutingReceiveInterface, &IAmRoutingReceive::ackDisconnect, handle, connectionID, error);
+}
+
+void IAmRoutingReceiverShadow::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_volume_t, const am_Error_e>(mRoutingReceiveInterface, &IAmRoutingReceive::ackSetSinkVolumeChange, handle, volume, error);
+}
+
+void IAmRoutingReceiverShadow::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_volume_t, const am_Error_e>(mRoutingReceiveInterface, &IAmRoutingReceive::ackSetSourceVolumeChange, handle, volume, error);
+}
+
+void IAmRoutingReceiverShadow::ackSetSourceState(const am_Handle_s handle, const am_Error_e error)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &IAmRoutingReceive::ackSetSourceState, handle, error);
+}
+
+void IAmRoutingReceiverShadow::ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &IAmRoutingReceive::ackSetSinkSoundProperty, handle, error);
+}
+
+void IAmRoutingReceiverShadow::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &IAmRoutingReceive::ackSetSourceSoundProperty, handle, error);
+}
+
+void IAmRoutingReceiverShadow::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_HotSink_e, const am_Error_e>(mRoutingReceiveInterface, &IAmRoutingReceive::ackCrossFading, handle, hotSink, error);
+}
+
+void IAmRoutingReceiverShadow::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_sourceID_t, const am_volume_t>(mRoutingReceiveInterface, &IAmRoutingReceive::ackSourceVolumeTick, handle, sourceID, volume);
+}
+
+void IAmRoutingReceiverShadow::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_Handle_s, const am_sinkID_t, const am_volume_t>(mRoutingReceiveInterface, &IAmRoutingReceive::ackSinkVolumeTick, handle, sinkID, volume);
+}
+
+void IAmRoutingReceiverShadow::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_sinkID_t, const am_InterruptState_e>(mRoutingReceiveInterface, &IAmRoutingReceive::hookInterruptStatusChange, sourceID, interruptState);
+}
+
+void IAmRoutingReceiverShadow::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_sinkID_t, const am_Availability_s&>(mRoutingReceiveInterface, &IAmRoutingReceive::hookSinkAvailablityStatusChange, sinkID, availability);
+}
+
+void IAmRoutingReceiverShadow::hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_sourceID_t, const am_Availability_s&>(mRoutingReceiveInterface, &IAmRoutingReceive::hookSourceAvailablityStatusChange, sourceID, availability);
+}
+
+void IAmRoutingReceiverShadow::hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_domainID_t, const am_DomainState_e>(mRoutingReceiveInterface, &IAmRoutingReceive::hookDomainStateChange, domainID, domainState);
+}
+
+void IAmRoutingReceiverShadow::hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay)
+{
+ mSerializer.asyncCall<IAmRoutingReceive, const am_connectionID_t, const am_timeSync_t>(mRoutingReceiveInterface, &IAmRoutingReceive::hookTimingInformationChanged, connectionID, delay);
+}
+
+am_Error_e IAmRoutingReceiverShadow::registerDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
+{
+ am_Error_e error (E_UNKNOWN);
+ am_Domain_s domainDataCopy(domainData);
+ mSerializer.syncCall<IAmRoutingReceive, am_Error_e, const am_Domain_s&,am_domainID_t&, am_Domain_s, am_domainID_t>(mRoutingReceiveInterface, &IAmRoutingReceive::registerDomain, error, domainDataCopy, domainID);
+ return (error);
+}
+
+am_Error_e am::IAmRoutingReceiverShadow::registerGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
+{
+ am_Error_e error (E_UNKNOWN);
+ am_Gateway_s gatewayDataCopy(gatewayData);
+ mSerializer.syncCall<IAmRoutingReceive, am_Error_e, const am_Gateway_s&, am_gatewayID_t&, am_Gateway_s, am_gatewayID_t>(mRoutingReceiveInterface,&IAmRoutingReceive::registerGateway, error, gatewayDataCopy, gatewayID);
+ return (error);
+}
+
+am_Error_e am::IAmRoutingReceiverShadow::registerSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+{
+ am_Error_e error (E_UNKNOWN);
+ am_Sink_s sinkDataCopy(sinkData);
+ mSerializer.syncCall<IAmRoutingReceive, am_Error_e, const am_Sink_s&, am_sinkID_t&, am_Sink_s, am_sinkID_t>(mRoutingReceiveInterface,&IAmRoutingReceive::registerSink, error, sinkDataCopy, sinkID);
+ return (error);
+}
+
+am_Error_e am::IAmRoutingReceiverShadow::deregisterSink(const am_sinkID_t sinkID)
+{
+ am_Error_e error;
+ am_sinkID_t s(sinkID); //no const values allowed in syncCalls due to reference !
+ mSerializer.syncCall<IAmRoutingReceive, am_Error_e, am_sinkID_t>(mRoutingReceiveInterface, &IAmRoutingReceive::deregisterSink, error, s);
+ return (error);
+}
+
+am_Error_e am::IAmRoutingReceiverShadow::registerSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+{
+ am_Error_e error (E_UNKNOWN);
+ am_Source_s sourceDataCopy(sourceData);
+ mSerializer.syncCall<IAmRoutingReceive, am_Error_e, const am_Source_s&, am_sourceID_t&, am_Source_s, am_sourceID_t>(mRoutingReceiveInterface,&IAmRoutingReceive::registerSource, error, sourceDataCopy, sourceID);
+ return (error);
+}
+
+am_Error_e am::IAmRoutingReceiverShadow::deregisterSource(const am_sourceID_t sourceID)
+{
+ am_Error_e error;
+ am_sourceID_t s(sourceID); //no const values allowed in syncCalls due to reference !
+ mSerializer.syncCall<IAmRoutingReceive, am_Error_e, am_sinkID_t>(mRoutingReceiveInterface, &IAmRoutingReceive::deregisterSource, error, s);
+ return (error);
+}
+
+am_Error_e am::IAmRoutingReceiverShadow::registerCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
+{
+ am_Error_e error (E_UNKNOWN);
+ am_Crossfader_s crossfaderDataCopy(crossfaderData);
+ mSerializer.syncCall<IAmRoutingReceive, am_Error_e, const am_Crossfader_s&, am_crossfaderID_t&, am_Crossfader_s, am_crossfaderID_t>(mRoutingReceiveInterface,&IAmRoutingReceive::registerCrossfader, error, crossfaderDataCopy, crossfaderID);
+ return (error);
+}
+
+void am::IAmRoutingReceiverShadow::confirmRoutingReady(uint16_t starupHandle)
+{
+ mSerializer.asyncCall<IAmRoutingReceive,uint16_t>(mRoutingReceiveInterface,&IAmRoutingReceive::confirmRoutingReady,starupHandle);
+}
+
+void am::IAmRoutingReceiverShadow::confirmRoutingRundown(uint16_t rundownHandle)
+{
+ mSerializer.asyncCall<IAmRoutingReceive,uint16_t>(mRoutingReceiveInterface,&IAmRoutingReceive::confirmRoutingRundown,rundownHandle);
+}
+
+
+
+
+
diff --git a/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp b/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
deleted file mode 100644
index 5c93f60..0000000
--- a/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/**
- * Copyright (C) 2011, BMW AG
- *
- * GeniviAudioMananger AudioManagerDaemon
- *
- * \file RoutingReceiverAsyncShadow.cpp
- *
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
- *
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
- *
- */
-
-#include "RoutingReceiverAsyncShadow.h"
-#include <cassert>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <netdb.h>
-#include <fcntl.h>
-#include <sys/un.h>
-#include <errno.h>
-#include <string>
-#include "DLTWrapper.h"
-
-using namespace am;
-
-RoutingReceiverAsyncShadow::RoutingReceiverAsyncShadow(RoutingReceiveInterface* iReceiveInterface, SocketHandler* iSocketHandler) :
- mSocketHandler(iSocketHandler), //
- mRoutingReceiveInterface(iReceiveInterface), //
- mSerializer(iSocketHandler)
-{
-
-}
-
-RoutingReceiverAsyncShadow::~RoutingReceiverAsyncShadow()
-{
-}
-
-void RoutingReceiverAsyncShadow::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_connectionID_t, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackConnect, handle, connectionID, error);
-}
-
-void RoutingReceiverAsyncShadow::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_connectionID_t, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackDisconnect, handle, connectionID, error);
-}
-
-void RoutingReceiverAsyncShadow::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_volume_t, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSinkVolumeChange, handle, volume, error);
-}
-
-void RoutingReceiverAsyncShadow::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_volume_t, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSourceVolumeChange, handle, volume, error);
-}
-
-void RoutingReceiverAsyncShadow::ackSetSourceState(const am_Handle_s handle, const am_Error_e error)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSourceState, handle, error);
-}
-
-void RoutingReceiverAsyncShadow::ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSinkSoundProperty, handle, error);
-}
-
-void RoutingReceiverAsyncShadow::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSetSourceSoundProperty, handle, error);
-}
-
-void RoutingReceiverAsyncShadow::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_HotSink_e, const am_Error_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackCrossFading, handle, hotSink, error);
-}
-
-void RoutingReceiverAsyncShadow::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_sourceID_t, const am_volume_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSourceVolumeTick, handle, sourceID, volume);
-}
-
-void RoutingReceiverAsyncShadow::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_Handle_s, const am_sinkID_t, const am_volume_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::ackSinkVolumeTick, handle, sinkID, volume);
-}
-
-void RoutingReceiverAsyncShadow::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_sinkID_t, const am_InterruptState_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookInterruptStatusChange, sourceID, interruptState);
-}
-
-void RoutingReceiverAsyncShadow::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_sinkID_t, const am_Availability_s&>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookSinkAvailablityStatusChange, sinkID, availability);
-}
-
-void RoutingReceiverAsyncShadow::hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_sourceID_t, const am_Availability_s&>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookSourceAvailablityStatusChange, sourceID, availability);
-}
-
-void RoutingReceiverAsyncShadow::hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_domainID_t, const am_DomainState_e>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookDomainStateChange, domainID, domainState);
-}
-
-void RoutingReceiverAsyncShadow::hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay)
-{
- mSerializer.asyncCall<RoutingReceiveInterface, const am_connectionID_t, const am_timeSync_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookTimingInformationChanged, connectionID, delay);
-}
-
-am_Error_e RoutingReceiverAsyncShadow::registerDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
-{
- am_Error_e error (E_UNKNOWN);
- am_Domain_s domainDataCopy(domainData);
- mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Domain_s&,am_domainID_t&, am_Domain_s, am_domainID_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::registerDomain, error, domainDataCopy, domainID);
- return (error);
-}
-
-am_Error_e am::RoutingReceiverAsyncShadow::registerGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
-{
- am_Error_e error (E_UNKNOWN);
- am_Gateway_s gatewayDataCopy(gatewayData);
- mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Gateway_s&, am_gatewayID_t&, am_Gateway_s, am_gatewayID_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::registerGateway, error, gatewayDataCopy, gatewayID);
- return (error);
-}
-
-am_Error_e am::RoutingReceiverAsyncShadow::registerSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
-{
- am_Error_e error (E_UNKNOWN);
- am_Sink_s sinkDataCopy(sinkData);
- mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Sink_s&, am_sinkID_t&, am_Sink_s, am_sinkID_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::registerSink, error, sinkDataCopy, sinkID);
- return (error);
-}
-
-am_Error_e am::RoutingReceiverAsyncShadow::deregisterSink(const am_sinkID_t sinkID)
-{
- am_Error_e error;
- am_sinkID_t s(sinkID); //no const values allowed in syncCalls due to reference !
- mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, am_sinkID_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::deregisterSink, error, s);
- return (error);
-}
-
-am_Error_e am::RoutingReceiverAsyncShadow::registerSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
-{
- am_Error_e error (E_UNKNOWN);
- am_Source_s sourceDataCopy(sourceData);
- mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Source_s&, am_sourceID_t&, am_Source_s, am_sourceID_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::registerSource, error, sourceDataCopy, sourceID);
- return (error);
-}
-
-am_Error_e am::RoutingReceiverAsyncShadow::deregisterSource(const am_sourceID_t sourceID)
-{
- am_Error_e error;
- am_sourceID_t s(sourceID); //no const values allowed in syncCalls due to reference !
- mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, am_sinkID_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::deregisterSource, error, s);
- return (error);
-}
-
-am_Error_e am::RoutingReceiverAsyncShadow::registerCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
-{
- am_Error_e error (E_UNKNOWN);
- am_Crossfader_s crossfaderDataCopy(crossfaderData);
- mSerializer.syncCall<RoutingReceiveInterface, am_Error_e, const am_Crossfader_s&, am_crossfaderID_t&, am_Crossfader_s, am_crossfaderID_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::registerCrossfader, error, crossfaderDataCopy, crossfaderID);
- return (error);
-}
-
-void am::RoutingReceiverAsyncShadow::confirmRoutingReady(uint16_t starupHandle)
-{
- mSerializer.asyncCall<RoutingReceiveInterface,uint16_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::confirmRoutingReady,starupHandle);
-}
-
-
-
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp b/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp
index 1e672a6..2d3cbca 100644
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp
+++ b/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp
@@ -22,31 +22,32 @@
*
*/
-#include "testRoutingInterfaceAsync.h"
+#include "CAmRoutingReceiverAsync.h"
#include "config.h"
-#include "DLTWrapper.h"
-#include "RoutingReceiver.h"
-#include "PluginTemplate.h"
+#include "CAmRoutingReceiver.h"
+#include "TAmPluginTemplate.h"
+#include "MockIAmRoutingReceive.h"
+#include "shared/CAmDltWrapper.h"
using namespace am;
using namespace testing;
-am_domainID_t MyEnvironment::mDomainIDCount = 0;
-static RoutingSendInterface* pRouter;
-static SocketHandler pSocketHandler;
-static MockRoutingReceiveInterface pReceiveInterface;
+am_domainID_t CAmEnvironment::mDomainIDCount = 0;
+static IAmRoutingSend* pRouter;
+static CAmSocketHandler pSocketHandler;
+static MockIAmRoutingReceive pReceiveInterface;
-MyEnvironment::MyEnvironment() :
- ptimerCallback(this, &MyEnvironment::timerCallback)
+CAmEnvironment::CAmEnvironment() :
+ ptimerCallback(this, &CAmEnvironment::timerCallback)
{
DefaultValue<am_Error_e>::Set(E_OK); // Sets the default value to be returned.
}
-MyEnvironment::~MyEnvironment()
+CAmEnvironment::~CAmEnvironment()
{
}
-void MyEnvironment::SetUp()
+void CAmEnvironment::SetUp()
{
logInfo("RoutingSendInterface Test started ");
@@ -55,15 +56,15 @@ void MyEnvironment::SetUp()
domainIDs.push_back(1);
EXPECT_CALL(pReceiveInterface,getSocketHandler(_)).WillOnce(DoAll(SetArgReferee<0>(&pSocketHandler), Return(E_OK)));
- EXPECT_CALL(pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(MyEnvironment::handleDomainRegister));
- EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(MyEnvironment::handleSourceRegister));
- EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(MyEnvironment::handleSinkRegister));
+ EXPECT_CALL(pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(CAmEnvironment::handleDomainRegister));
+ EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(CAmEnvironment::handleSourceRegister));
+ EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(CAmEnvironment::handleSinkRegister));
EXPECT_CALL(pReceiveInterface,confirmRoutingReady(_)).Times(1);
- RoutingSendInterface* (*createFunc)();
+ IAmRoutingSend* (*createFunc)();
void* tempLibHandle = NULL;
std::string libname("../plugins/routing/libPluginRoutingInterfaceAsync.so");
- createFunc = getCreateFunction<RoutingSendInterface*()>(libname, tempLibHandle);
+ createFunc = getCreateFunction<IAmRoutingSend*()>(libname, tempLibHandle);
if (!createFunc)
{
@@ -88,35 +89,35 @@ void MyEnvironment::SetUp()
sh_timerHandle_t handle;
- shTimerCallBack *buf = &ptimerCallback;
+ CAmShTimerCallBack *buf = &ptimerCallback;
//lets use a timeout so the test will finish
pSocketHandler.addTimer(t, buf, handle, (void*) NULL);
pSocketHandler.start_listenting();
}
-void MyEnvironment::TearDown()
+void CAmEnvironment::TearDown()
{
}
-testRoutingInterfaceAsync::testRoutingInterfaceAsync() :
- ptimerCallback(this, &testRoutingInterfaceAsync::timerCallback)
+CAmRoutingReceiverAsync::CAmRoutingReceiverAsync() :
+ ptimerCallback(this, &CAmRoutingReceiverAsync::timerCallback)
{
}
-testRoutingInterfaceAsync::~testRoutingInterfaceAsync()
+CAmRoutingReceiverAsync::~CAmRoutingReceiverAsync()
{
}
-void testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
+void CAmRoutingReceiverAsync::timerCallback(sh_timerHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
pSocketHandler.stop_listening();
}
-void testRoutingInterfaceAsync::SetUp()
+void CAmRoutingReceiverAsync::SetUp()
{
// timespec t;
// t.tv_nsec = 0;
@@ -129,26 +130,26 @@ void testRoutingInterfaceAsync::SetUp()
// pSocketHandler.addTimer(t, buf, handle, (void*) NULL);
}
-std::vector<std::string> MyEnvironment::returnListPlugins()
+std::vector<std::string> CAmEnvironment::returnListPlugins()
{
std::vector<std::string> list;
list.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
return (list);
}
-am_Error_e MyEnvironment::handleSourceRegister(const am_Source_s & sourceData, am_sourceID_t & sourceID)
+am_Error_e CAmEnvironment::handleSourceRegister(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
sourceID = sourceData.sourceID;
return (E_OK);
}
-am_Error_e MyEnvironment::handleSinkRegister(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
+am_Error_e CAmEnvironment::handleSinkRegister(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
sinkID = sinkData.sinkID;
return (E_OK);
}
-am_Error_e MyEnvironment::handleDomainRegister(const am_Domain_s & domainData, am_domainID_t & domainID)
+am_Error_e CAmEnvironment::handleDomainRegister(const am_Domain_s & domainData, am_domainID_t & domainID)
{
am_Domain_s domain = domainData;
domainID = ++mDomainIDCount;
@@ -156,7 +157,7 @@ am_Error_e MyEnvironment::handleDomainRegister(const am_Domain_s & domainData, a
return (E_OK);
}
-void MyEnvironment::timerCallback(sh_timerHandle_t handle, void *userData)
+void CAmEnvironment::timerCallback(sh_timerHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
@@ -167,11 +168,11 @@ void MyEnvironment::timerCallback(sh_timerHandle_t handle, void *userData)
pSocketHandler.restartTimer(handle, t);
}
-void testRoutingInterfaceAsync::TearDown()
+void CAmRoutingReceiverAsync::TearDown()
{
}
-TEST_F(testRoutingInterfaceAsync,setDomainState)
+TEST_F(CAmRoutingReceiverAsync,setDomainState)
{
am_domainID_t domainID = 1;
am_DomainState_e state = DS_INDEPENDENT_RUNDOWN;
@@ -182,7 +183,7 @@ TEST_F(testRoutingInterfaceAsync,setDomainState)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,setSourceSoundProperty)
+TEST_F(CAmRoutingReceiverAsync,setSourceSoundProperty)
{
am_Handle_s handle;
@@ -200,7 +201,7 @@ TEST_F(testRoutingInterfaceAsync,setSourceSoundProperty)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,setSinkSoundProperty)
+TEST_F(CAmRoutingReceiverAsync,setSinkSoundProperty)
{
am_Handle_s handle;
@@ -218,7 +219,7 @@ TEST_F(testRoutingInterfaceAsync,setSinkSoundProperty)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,setSourceState)
+TEST_F(CAmRoutingReceiverAsync,setSourceState)
{
am_Handle_s handle;
@@ -234,7 +235,7 @@ TEST_F(testRoutingInterfaceAsync,setSourceState)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,setSourceVolume)
+TEST_F(CAmRoutingReceiverAsync,setSourceVolume)
{
am_Handle_s handle;
@@ -253,7 +254,7 @@ TEST_F(testRoutingInterfaceAsync,setSourceVolume)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,setSinkVolume)
+TEST_F(CAmRoutingReceiverAsync,setSinkVolume)
{
am_Handle_s handle;
@@ -272,7 +273,7 @@ TEST_F(testRoutingInterfaceAsync,setSinkVolume)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,setSinkVolumeAbort)
+TEST_F(CAmRoutingReceiverAsync,setSinkVolumeAbort)
{
am_Handle_s handle;
@@ -293,7 +294,7 @@ TEST_F(testRoutingInterfaceAsync,setSinkVolumeAbort)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,disconnectNonExisting)
+TEST_F(CAmRoutingReceiverAsync,disconnectNonExisting)
{
am_Handle_s handle;
@@ -308,7 +309,7 @@ TEST_F(testRoutingInterfaceAsync,disconnectNonExisting)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,disconnectTooEarly)
+TEST_F(CAmRoutingReceiverAsync,disconnectTooEarly)
{
am_Handle_s handle_c;
@@ -331,7 +332,7 @@ TEST_F(testRoutingInterfaceAsync,disconnectTooEarly)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,disconnectAbort)
+TEST_F(CAmRoutingReceiverAsync,disconnectAbort)
{
am_Handle_s handle_c;
@@ -356,7 +357,7 @@ TEST_F(testRoutingInterfaceAsync,disconnectAbort)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,disconnect)
+TEST_F(CAmRoutingReceiverAsync,disconnect)
{
am_Handle_s handle_c;
@@ -380,7 +381,7 @@ TEST_F(testRoutingInterfaceAsync,disconnect)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,connectNoMoreThreads)
+TEST_F(CAmRoutingReceiverAsync,connectNoMoreThreads)
{
am_Handle_s handle;
@@ -402,7 +403,7 @@ TEST_F(testRoutingInterfaceAsync,connectNoMoreThreads)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,connectAbortTooLate)
+TEST_F(CAmRoutingReceiverAsync,connectAbortTooLate)
{
am_Handle_s handle;
@@ -421,7 +422,7 @@ TEST_F(testRoutingInterfaceAsync,connectAbortTooLate)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,connectAbort)
+TEST_F(CAmRoutingReceiverAsync,connectAbort)
{
am_Handle_s handle;
@@ -440,7 +441,7 @@ TEST_F(testRoutingInterfaceAsync,connectAbort)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,connectWrongFormat)
+TEST_F(CAmRoutingReceiverAsync,connectWrongFormat)
{
am_Handle_s handle;
@@ -457,7 +458,7 @@ TEST_F(testRoutingInterfaceAsync,connectWrongFormat)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,connectWrongSink)
+TEST_F(CAmRoutingReceiverAsync,connectWrongSink)
{
am_Handle_s handle;
@@ -474,7 +475,7 @@ TEST_F(testRoutingInterfaceAsync,connectWrongSink)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,connectWrongSource)
+TEST_F(CAmRoutingReceiverAsync,connectWrongSource)
{
am_Handle_s handle;
handle.handle = 1;
@@ -490,7 +491,7 @@ TEST_F(testRoutingInterfaceAsync,connectWrongSource)
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,connect)
+TEST_F(CAmRoutingReceiverAsync,connect)
{
am_Handle_s handle;
@@ -510,7 +511,7 @@ TEST_F(testRoutingInterfaceAsync,connect)
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
- ::testing::Environment* const env = ::testing::AddGlobalTestEnvironment(new MyEnvironment);
+ ::testing::Environment* const env = ::testing::AddGlobalTestEnvironment(new CAmEnvironment);
(void) env;
return RUN_ALL_TESTS();
}
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h b/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.h
index 3139b5a..ec33c9f 100644
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h
+++ b/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.h
@@ -27,17 +27,18 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include "mocklnterfaces.h"
-#include "SocketHandler.h"
-#include "../../AudioManagerDaemon/include/RoutingSender.h"
-#include "CAmSerializer.h"
+
+#include "MockIAmRoutingReceive.h"
+#include "shared/CAmSocketHandler.h"
+#include "shared/CAmSerializer.h"
+#include "../../AudioManagerDaemon/include/CAmRoutingSender.h"
#define UNIT_TEST 1
namespace am
{
-class MyEnvironment: public ::testing::Environment
+class CAmEnvironment: public ::testing::Environment
{
public:
static std::vector<std::string> returnListPlugins();
@@ -45,9 +46,9 @@ public:
static am_Error_e handleSourceRegister(const am_Source_s& sourceData, am_sourceID_t& sourceID);
static am_Error_e handleSinkRegister(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
void timerCallback(sh_timerHandle_t handle, void* userData);
- shTimerCallBack_T<MyEnvironment> ptimerCallback;
- MyEnvironment();
- ~MyEnvironment();
+ TAmShTimerCallBack<CAmEnvironment> ptimerCallback;
+ CAmEnvironment();
+ ~CAmEnvironment();
// Override this to define how to set up the environment.
void SetUp();
// Override this to define how to tear down the environment.
@@ -56,13 +57,13 @@ private:
static am_domainID_t mDomainIDCount;
};
-class testRoutingInterfaceAsync: public ::testing::Test
+class CAmRoutingReceiverAsync: public ::testing::Test
{
public:
- testRoutingInterfaceAsync();
- ~testRoutingInterfaceAsync();
+ CAmRoutingReceiverAsync();
+ ~CAmRoutingReceiverAsync();
void timerCallback(sh_timerHandle_t handle, void* userData);
- shTimerCallBack_T<testRoutingInterfaceAsync> ptimerCallback;
+ TAmShTimerCallBack<CAmRoutingReceiverAsync> ptimerCallback;
void SetUp();
void TearDown();
private:
diff --git a/PluginRoutingInterfaceAsync/test/CMakeLists.txt b/PluginRoutingInterfaceAsync/test/CMakeLists.txt
index aa4c39d..59c50dc 100644
--- a/PluginRoutingInterfaceAsync/test/CMakeLists.txt
+++ b/PluginRoutingInterfaceAsync/test/CMakeLists.txt
@@ -23,7 +23,7 @@
cmake_minimum_required(VERSION 2.6)
-PROJECT(routingAsyncTest)
+PROJECT(AmRoutingReceiverAsync)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
@@ -40,10 +40,10 @@ INCLUDE_DIRECTORIES(
${STD_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
- ${AUDIO_INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
${CMAKE_SOURCE_DIR}
${DLT_INCLUDE_DIRS}
- ${INCLUDES_FOLDER}
+ ${include_FOLDER}
${GTEST_INCLUDE_DIR}
${DBUS_INCLUDE_DIR}
${DBUS_ARCH_INCLUDE_DIR}
@@ -52,26 +52,17 @@ INCLUDE_DIRECTORIES(
)
file(GLOB ASYNC_PLUGIN_INTERFACE_SRCS_CXX
- "../../AudioManagerDaemon/src/SocketHandler.cpp"
- "../../AudioManagerDaemon/src/DLTWrapper.cpp"
+ "../../AudioManagerDaemon/src/CAmSocketHandler.cpp"
+ "../../AudioManagerDaemon/src/CAmDltWrapper.cpp"
"../src/*.cpp"
- "testRoutingInterfaceAsync.cpp"
+ "CAmRoutingReceiverAsync.cpp"
)
-file(GLOB ASYNC_PLUGIN_INTERFACE_INTERRUPT_SRCS_CXX
- "../../AudioManagerDaemon/src/SocketHandler.cpp"
- "../../AudioManagerDaemon/src/RoutingSender.cpp"
- "../../AudioManagerDaemon/src/DLTWrapper.cpp"
- "../src/*.cpp"
- "testRoutingInterfaceAsyncInterrupt.cpp"
-
-)
-ADD_EXECUTABLE(asyncRoutingInterfaceTest ${ASYNC_PLUGIN_INTERFACE_SRCS_CXX})
-#ADD_EXECUTABLE(asyncRoutingInterfaceInterruptTest ${ASYNC_PLUGIN_INTERFACE_INTERRUPT_SRCS_CXX})
+ADD_EXECUTABLE(AmRoutingReceiveAsyncTest ${ASYNC_PLUGIN_INTERFACE_SRCS_CXX})
-TARGET_LINK_LIBRARIES(asyncRoutingInterfaceTest
+TARGET_LINK_LIBRARIES(AmRoutingReceiveAsyncTest
${DLT_LIBRARIES}
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
@@ -81,16 +72,7 @@ TARGET_LINK_LIBRARIES(asyncRoutingInterfaceTest
gmock
)
-#TARGET_LINK_LIBRARIES(asyncRoutingInterfaceInterruptTest
-# ${DLT_LIBRARIES}
-# ${CMAKE_DL_LIBS}
-# ${CMAKE_THREAD_LIBS_INIT}
-# ${GTEST_LIBRARIES}
-# ${DBUS_LIBRARY}
-# gmock
-#)
-
-INSTALL(TARGETS asyncRoutingInterfaceTest
+INSTALL(TARGETS AmRoutingReceiveAsyncTest
DESTINATION "~/AudioManagerTest/"
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT tests
diff --git a/PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h b/PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h
new file mode 100644
index 0000000..145afd4
--- /dev/null
+++ b/PluginRoutingInterfaceAsync/test/MockIAmRoutingReceive.h
@@ -0,0 +1,91 @@
+#ifndef MOCKROUTINGINTERFACE_H_
+#define MOCKROUTINGINTERFACE_H_
+
+#include "routing/IAmRoutingReceive.h"
+
+namespace am {
+
+class MockIAmRoutingReceive : public IAmRoutingReceive {
+ public:
+ MOCK_METHOD3(ackConnect,
+ void(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error));
+ MOCK_METHOD3(ackDisconnect,
+ void(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error));
+ MOCK_METHOD3(ackSetSinkVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
+ MOCK_METHOD3(ackSetSourceVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
+ MOCK_METHOD2(ackSetSourceState,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSetSinkSoundProperties,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSetSinkSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSetSourceSoundProperties,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(ackSetSourceSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD3(ackCrossFading,
+ void(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error));
+ MOCK_METHOD3(ackSourceVolumeTick,
+ void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
+ MOCK_METHOD3(ackSinkVolumeTick,
+ void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
+ MOCK_METHOD2(peekDomain,
+ am_Error_e(const std::string& name, am_domainID_t& domainID));
+ MOCK_METHOD2(registerDomain,
+ am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
+ MOCK_METHOD1(deregisterDomain,
+ am_Error_e(const am_domainID_t domainID));
+ MOCK_METHOD2(registerGateway,
+ am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
+ MOCK_METHOD1(deregisterGateway,
+ am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD2(peekSink,
+ am_Error_e(const std::string& name, am_sinkID_t& sinkID));
+ MOCK_METHOD2(registerSink,
+ am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
+ MOCK_METHOD1(deregisterSink,
+ am_Error_e(const am_sinkID_t sinkID));
+ MOCK_METHOD2(peekSource,
+ am_Error_e(const std::string& name, am_sourceID_t& sourceID));
+ MOCK_METHOD2(registerSource,
+ am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
+ MOCK_METHOD1(deregisterSource,
+ am_Error_e(const am_sourceID_t sourceID));
+ MOCK_METHOD2(registerCrossfader,
+ am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
+ MOCK_METHOD1(deregisterCrossfader,
+ am_Error_e(const am_crossfaderID_t crossfaderID));
+ MOCK_METHOD2(peekSourceClassID,
+ am_Error_e(const std::string& name, am_sourceClass_t& sourceClassID));
+ MOCK_METHOD2(peekSinkClassID,
+ am_Error_e(const std::string& name, am_sinkClass_t& sinkClassID));
+ MOCK_METHOD2(hookInterruptStatusChange,
+ void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
+ MOCK_METHOD1(hookDomainRegistrationComplete,
+ void(const am_domainID_t domainID));
+ MOCK_METHOD2(hookSinkAvailablityStatusChange,
+ void(const am_sinkID_t sinkID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookSourceAvailablityStatusChange,
+ void(const am_sourceID_t sourceID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookDomainStateChange,
+ void(const am_domainID_t domainID, const am_DomainState_e domainState));
+ MOCK_METHOD2(hookTimingInformationChanged,
+ void(const am_connectionID_t connectionID, const am_timeSync_t delay));
+ MOCK_METHOD1(sendChangedData,
+ void(const std::vector<am_EarlyData_s>& earlyData));
+ MOCK_CONST_METHOD1(getDBusConnectionWrapper,
+ am_Error_e(CAmDbusWrapper*& dbusConnectionWrapper));
+ MOCK_CONST_METHOD1(getSocketHandler,
+ am_Error_e(CAmSocketHandler*& socketHandler));
+ MOCK_CONST_METHOD1(getInterfaceVersion,
+ void(std::string& version));
+ MOCK_METHOD1(confirmRoutingReady,
+ void(const uint16_t handle));
+ MOCK_METHOD1(confirmRoutingRundown,
+ void(const uint16_t handle));
+};
+
+} // namespace am
+#endif /* MOCKROUTINGINTERFACE_H_ */
diff --git a/PluginRoutingInterfaceAsync/test/mocklnterfaces.h b/PluginRoutingInterfaceAsync/test/mocklnterfaces.h
deleted file mode 100644
index d8eef1f..0000000
--- a/PluginRoutingInterfaceAsync/test/mocklnterfaces.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file mockInterfaces.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-*/
-
-#ifndef MOCKLNTERFACES_H_
-#define MOCKLNTERFACES_H_
-
-#include <routing/RoutingReceiveInterface.h>
-
-namespace am {
-
-class MockRoutingReceiveInterface : public RoutingReceiveInterface {
- public:
- MOCK_METHOD3(ackConnect,
- void(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error));
- MOCK_METHOD3(ackDisconnect,
- void(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error));
- MOCK_METHOD3(ackSetSinkVolumeChange,
- void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
- MOCK_METHOD3(ackSetSourceVolumeChange,
- void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
- MOCK_METHOD2(ackSetSourceState,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSetSinkSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSetSinkSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSetSourceSoundProperties,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD2(ackSetSourceSoundProperty,
- void(const am_Handle_s handle, const am_Error_e error));
- MOCK_METHOD3(ackCrossFading,
- void(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error));
- MOCK_METHOD3(ackSourceVolumeTick,
- void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
- MOCK_METHOD3(ackSinkVolumeTick,
- void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
- MOCK_METHOD2(peekDomain,
- am_Error_e(const std::string& name, am_domainID_t& domainID));
- MOCK_METHOD2(registerDomain,
- am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
- MOCK_METHOD1(deregisterDomain,
- am_Error_e(const am_domainID_t domainID));
- MOCK_METHOD2(registerGateway,
- am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
- MOCK_METHOD1(deregisterGateway,
- am_Error_e(const am_gatewayID_t gatewayID));
- MOCK_METHOD2(peekSink,
- am_Error_e(const std::string& name, am_sinkID_t& sinkID));
- MOCK_METHOD2(registerSink,
- am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
- MOCK_METHOD1(deregisterSink,
- am_Error_e(const am_sinkID_t sinkID));
- MOCK_METHOD2(peekSource,
- am_Error_e(const std::string& name, am_sourceID_t& sourceID));
- MOCK_METHOD2(registerSource,
- am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
- MOCK_METHOD1(deregisterSource,
- am_Error_e(const am_sourceID_t sourceID));
- MOCK_METHOD2(registerCrossfader,
- am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
- MOCK_METHOD1(deregisterCrossfader,
- am_Error_e(const am_crossfaderID_t crossfaderID));
- MOCK_METHOD2(peekSourceClassID,
- am_Error_e(const std::string& name, am_sourceClass_t& sourceClassID));
- MOCK_METHOD2(peekSinkClassID,
- am_Error_e(const std::string& name, am_sinkClass_t& sinkClassID));
- MOCK_METHOD2(hookInterruptStatusChange,
- void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
- MOCK_METHOD1(hookDomainRegistrationComplete,
- void(const am_domainID_t domainID));
- MOCK_METHOD2(hookSinkAvailablityStatusChange,
- void(const am_sinkID_t sinkID, const am_Availability_s& availability));
- MOCK_METHOD2(hookSourceAvailablityStatusChange,
- void(const am_sourceID_t sourceID, const am_Availability_s& availability));
- MOCK_METHOD2(hookDomainStateChange,
- void(const am_domainID_t domainID, const am_DomainState_e domainState));
- MOCK_METHOD2(hookTimingInformationChanged,
- void(const am_connectionID_t connectionID, const am_timeSync_t delay));
- MOCK_METHOD1(sendChangedData,
- void(const std::vector<am_EarlyData_s>& earlyData));
- MOCK_CONST_METHOD1(getDBusConnectionWrapper,
- am_Error_e(DBusWrapper*& dbusConnectionWrapper));
- MOCK_CONST_METHOD1(getSocketHandler,
- am_Error_e(SocketHandler*& socketHandler));
- MOCK_CONST_METHOD1(getInterfaceVersion,
- void(std::string& version));
- MOCK_METHOD1(confirmRoutingReady,
- void(const uint16_t handle));
- MOCK_METHOD1(confirmRoutingRundown,
- void(const uint16_t handle));
-
- };
-
-} // namespace am
-
-
-
-#endif /* MOCKLNTERFACES_H_ */
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp
deleted file mode 100644
index e00de40..0000000
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Copyright (C) 2011, BMW AG
- *
- * GeniviAudioMananger AudioManagerDaemon
- *
- * \file testRoutingItnerfaceAsyncInterrupt.cpp
- *
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
- *
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
- *
- */
-
-#define INTERRUPT_TEST 1
-
-#include "testRoutingInterfaceAsync.h"
-#include "config.h"
-#include "DLTWrapper.h"
-
-using namespace am;
-using namespace testing;
-
-std::vector<std::string> testRoutingInterfaceAsync::pListRoutingPluginDirs = returnListPlugins();
-am_domainID_t testRoutingInterfaceAsync::mDomainIDCount = 0;
-RoutingSender testRoutingInterfaceAsync::pRoutingSender = RoutingSender(pListRoutingPluginDirs);
-
-testRoutingInterfaceAsync::testRoutingInterfaceAsync() :
- pSocketHandler(), //
- pReceiveInterface(), //
- ptimerCallback(this, &testRoutingInterfaceAsync::timerCallback)
-{
-}
-
-testRoutingInterfaceAsync::~testRoutingInterfaceAsync()
-{
-}
-
-void testRoutingInterfaceAsync::SetUp()
-{
- logInfo("RoutingSendInterface Test started ");
-
- std::vector<int> domainIDs;
- domainIDs.push_back(0);
- domainIDs.push_back(1);
-
- EXPECT_CALL(pReceiveInterface,getSocketHandler(_)).WillOnce(DoAll(SetArgReferee<0>(&pSocketHandler), Return(E_OK)));
- EXPECT_CALL(pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleDomainRegister));
- EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSourceRegister));
- EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSinkRegister));
-
- //pRoutingSender.startupRoutingInterface(&pReceiveInterface);
- //pRoutingSender.routingInterfacesReady();
-
- timespec t;
- t.tv_nsec = 0;
- t.tv_sec = 4;
-
- sh_timerHandle_t handle;
-
- shTimerCallBack *buf = &ptimerCallback;
- //lets use a timeout so the test will finish
- pSocketHandler.addTimer(t, buf, handle, (void*) NULL);
-}
-
-std::vector<std::string> am::testRoutingInterfaceAsync::returnListPlugins()
-{
- std::vector<std::string> list;
- list.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
- return (list);
-}
-
-am_Error_e am::testRoutingInterfaceAsync::handleSourceRegister(const am_Source_s & sourceData, am_sourceID_t & sourceID)
-{
- sourceID = sourceData.sourceID;
- pRoutingSender.addSourceLookup(sourceData);
- return (E_OK);
-}
-
-am_Error_e am::testRoutingInterfaceAsync::handleSinkRegister(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
-{
- sinkID = sinkData.sinkID;
- pRoutingSender.addSinkLookup(sinkData);
- return (E_OK);
-}
-
-am_Error_e am::testRoutingInterfaceAsync::handleDomainRegister(const am_Domain_s & domainData, am_domainID_t & domainID)
-{
- am_Domain_s domain = domainData;
- domainID = mDomainIDCount++;
- domain.domainID = domainID;
- pRoutingSender.addDomainLookup(domain);
- return (E_OK);
-}
-
-void testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
-{
- (void) handle;
- (void) userData;
- pSocketHandler.stop_listening();
-}
-
-void testRoutingInterfaceAsync::TearDown()
-{
-}
-
-std::string DBUSCOMMAND = "dbus-send --session --print-reply --dest=org.genivi.test /org/genivi/test org.genivi.test.";
-
-TEST_F(testRoutingInterfaceAsync,hookInterruptStatusChange)
-{
- am_sourceID_t sourceID = 2;
- EXPECT_CALL(pReceiveInterface,hookInterruptStatusChange(sourceID,_)).Times(1);
- system((DBUSCOMMAND + std::string("InterruptStatusChange int16:2")).c_str());
- pSocketHandler.start_listenting();
-}
-
-TEST_F(testRoutingInterfaceAsync,hookSourceAvailablityStatusChange)
-{
- am_sourceID_t sourceID = 2;
- EXPECT_CALL(pReceiveInterface,hookSourceAvailablityStatusChange(sourceID,_)).Times(1);
- system((DBUSCOMMAND + std::string("SourceAvailablityStatusChange int16:2")).c_str());
- pSocketHandler.start_listenting();
-}
-
-TEST_F(testRoutingInterfaceAsync,hookSinkAvailablityStatusChange)
-{
- am_sinkID_t sinkID = 2;
- EXPECT_CALL(pReceiveInterface,hookSinkAvailablityStatusChange(sinkID,_)).Times(1);
- system((DBUSCOMMAND + std::string("SinkAvailablityStatusChange int16:2")).c_str());
- pSocketHandler.start_listenting();
-}
-
-TEST_F(testRoutingInterfaceAsync,hookTimingInformationChanged)
-{
- am_connectionID_t connectionID = 4;
- am_timeSync_t delay = 35;
- EXPECT_CALL(pReceiveInterface,hookTimingInformationChanged(connectionID,delay)).Times(1);
- system((DBUSCOMMAND + std::string("timingChanged int16:4 int16:35")).c_str());
- pSocketHandler.start_listenting();
-}
-
-int main(int argc, char **argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
diff --git a/PluginRoutingInterfaceDbus/CMakeLists.txt b/PluginRoutingInterfaceDbus/CMakeLists.txt
index 5bf20aa..5242f51 100644
--- a/PluginRoutingInterfaceDbus/CMakeLists.txt
+++ b/PluginRoutingInterfaceDbus/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT(PluginRoutingInterfaceDbus)
set(LIBRARY_OUTPUT_PATH ${PLUGINS_OUTPUT_PATH}/routing)
set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/RoutingPlugin)
-set(INCLUDES_FOLDER "include")
+set(include_FOLDER "include")
-FILE(READ "${AUDIO_INCLUDES_FOLDER}/routing/RoutingSendInterface.h" VERSION_BUFFER LIMIT 6000)
+FILE(READ "${AUDIO_include_FOLDER}/routing/IAmRoutingSend.h" VERSION_BUFFER LIMIT 6000)
STRING(REGEX MATCH "RoutingSendVersion*.[^0-9]*[0-9].[0-9]*[0-9]" LIB_INTERFACE_VERSION_STRING ${VERSION_BUFFER})
-STRING(REGEX REPLACE "RoutingSendVersion*." "" LIB_INTERFACE_VERSION ${LIB_INTERFACE_VERSION_STRING})
+STRING(REGEX REPLACE "RoutingSendVersion*.." "" LIB_INTERFACE_VERSION ${LIB_INTERFACE_VERSION_STRING})
MESSAGE(STATUS "Building against routing interface version ${LIB_INTERFACE_VERSION}")
FIND_PACKAGE(DBUS REQUIRED)
@@ -18,8 +18,8 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${DBUS_INCLUDE_DIR}
${DBUS_ARCH_INCLUDE_DIR}
- ${AUDIO_INCLUDES_FOLDER}
- ${INCLUDES_FOLDER}
+ ${AUDIO_include_FOLDER}
+ ${include_FOLDER}
)
# all source files go here
diff --git a/PluginRoutingInterfaceDbus/include/RoutingSender.h b/PluginRoutingInterfaceDbus/include/CAmRoutingSenderDbus.h
index 276bd1e..6e27a31 100644
--- a/PluginRoutingInterfaceDbus/include/RoutingSender.h
+++ b/PluginRoutingInterfaceDbus/include/CAmRoutingSenderDbus.h
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger DbusPlugin
*
- * \file RoutingSender.h
+ * \file CAmRoutingSender.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -26,16 +26,16 @@
#ifndef ROUTINGSENDER_H_
#define ROUTINGSENDER_H_
-#include <routing/RoutingSendInterface.h>
+#include "routing/IAmRoutingSend.h"
using namespace am;
-class DbusRoutingSender: public RoutingSendInterface
+class CAmRoutingSenderDbus: public IAmRoutingSend
{
public:
- DbusRoutingSender();
- virtual ~DbusRoutingSender();
- am_Error_e startupInterface(RoutingReceiveInterface* routingreceiveinterface) ;
+ CAmRoutingSenderDbus();
+ virtual ~CAmRoutingSenderDbus();
+ am_Error_e startupInterface(IAmRoutingReceive* routingreceiveinterface) ;
void setRoutingReady(const uint16_t handle) ;
void setRoutingRundown(const uint16_t handle) ;
am_Error_e asyncAbort(const am_Handle_s handle) ;
diff --git a/PluginRoutingInterfaceDbus/src/RoutingSender.cpp b/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp
index 3606c66..53d4380 100644
--- a/PluginRoutingInterfaceDbus/src/RoutingSender.cpp
+++ b/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp
@@ -3,7 +3,7 @@
*
* GeniviAudioMananger DbusPlugin
*
- * \file RoutingSender.cpp
+ * \file CAmRoutingSender.cpp
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -23,33 +23,33 @@
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#include "RoutingSender.h"
+#include "CAmRoutingSenderDbus.h"
-extern "C" RoutingSendInterface* PluginRoutingInterfaceDbusFactory()
+extern "C" IAmRoutingSend* PluginRoutingInterfaceDbusFactory()
{
- return (new DbusRoutingSender());
+ return (new CAmRoutingSenderDbus());
}
-extern "C" void destroyRoutingPluginInterfaceDbus(RoutingSendInterface* routingSendInterface)
+extern "C" void destroyRoutingPluginInterfaceDbus(IAmRoutingSend* routingSendInterface)
{
delete routingSendInterface;
}
-DbusRoutingSender::DbusRoutingSender()
+CAmRoutingSenderDbus::CAmRoutingSenderDbus()
{
}
-DbusRoutingSender::~DbusRoutingSender()
+CAmRoutingSenderDbus::~CAmRoutingSenderDbus()
{
}
-am_Error_e DbusRoutingSender::asyncAbort(const am_Handle_s handle)
+am_Error_e CAmRoutingSenderDbus::asyncAbort(const am_Handle_s handle)
{
(void) handle;
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
+am_Error_e CAmRoutingSenderDbus::asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
{
(void) handle;
(void) connectionID;
@@ -59,14 +59,14 @@ am_Error_e DbusRoutingSender::asyncConnect(const am_Handle_s handle, const am_co
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID)
+am_Error_e CAmRoutingSenderDbus::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID)
{
(void) handle;
(void) connectionID;
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
+am_Error_e CAmRoutingSenderDbus::asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
(void) handle;
(void) sinkID;
@@ -76,7 +76,7 @@ am_Error_e DbusRoutingSender::asyncSetSinkVolume(const am_Handle_s handle, const
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
+am_Error_e CAmRoutingSenderDbus::asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
(void) handle;
(void) sourceID;
@@ -86,7 +86,7 @@ am_Error_e DbusRoutingSender::asyncSetSourceVolume(const am_Handle_s handle, con
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)
+am_Error_e CAmRoutingSenderDbus::asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
(void) handle;
(void) sourceID;
@@ -94,7 +94,7 @@ am_Error_e DbusRoutingSender::asyncSetSourceState(const am_Handle_s handle, cons
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
+am_Error_e CAmRoutingSenderDbus::asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
{
(void) handle;
(void) crossfaderID;
@@ -104,36 +104,36 @@ am_Error_e DbusRoutingSender::asyncCrossFade(const am_Handle_s handle, const am_
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
+am_Error_e CAmRoutingSenderDbus::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
(void) domainID;
(void) domainState;
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::startupInterface(RoutingReceiveInterface *routingreceiveinterface)
+am_Error_e CAmRoutingSenderDbus::startupInterface(IAmRoutingReceive *routingreceiveinterface)
{
(void)routingreceiveinterface;
return (E_NOT_USED);
}
-void DbusRoutingSender::setRoutingReady(const uint16_t handle)
+void CAmRoutingSenderDbus::setRoutingReady(const uint16_t handle)
{
(void) handle;
}
-void DbusRoutingSender::setRoutingRundown(const uint16_t handle)
+void CAmRoutingSenderDbus::setRoutingRundown(const uint16_t handle)
{
(void) handle;
}
-am_Error_e DbusRoutingSender::returnBusName(std::string & BusName) const
+am_Error_e CAmRoutingSenderDbus::returnBusName(std::string & BusName) const
{
BusName = "DbusPlugin";
return (E_OK);
}
-am_Error_e DbusRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
+am_Error_e CAmRoutingSenderDbus::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
(void) handle;
(void) sinkID;
@@ -141,7 +141,7 @@ am_Error_e DbusRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handle
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
+am_Error_e CAmRoutingSenderDbus::asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
(void) handle;
(void) sinkID;
@@ -149,7 +149,7 @@ am_Error_e DbusRoutingSender::asyncSetSinkSoundProperties(const am_Handle_s hand
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
+am_Error_e CAmRoutingSenderDbus::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
{
(void) handle;
(void) sourceID;
@@ -157,7 +157,7 @@ am_Error_e DbusRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s hand
return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
+am_Error_e CAmRoutingSenderDbus::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
(void) handle;
(void) sourceID;
@@ -165,7 +165,7 @@ am_Error_e DbusRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s ha
return (E_NOT_USED);
}
-void DbusRoutingSender::getInterfaceVersion(std::string & version) const
+void CAmRoutingSenderDbus::getInterfaceVersion(std::string & version) const
{
version=RoutingSendVersion;
}
diff --git a/cmake/AudioManager_Codestyle.xml b/cmake/AudioManagerCodestyle.xml
index 0ecdb53..0ecdb53 100644
--- a/cmake/AudioManager_Codestyle.xml
+++ b/cmake/AudioManagerCodestyle.xml
diff --git a/cmake/FindDBUS.cmake b/cmake/FindDBUS.cmake
index e37b93a..0935b2f 100644
--- a/cmake/FindDBUS.cmake
+++ b/cmake/FindDBUS.cmake
@@ -35,8 +35,8 @@ SET( DBUS_FOUND "NO" )
IF(DBUS_LIBRARY)
SET( DBUS_FOUND "YES" )
message(STATUS "Found DBUS libs: ${DBUS_LIBRARY}")
- message(STATUS "Found DBUS includes: ${DBUS_INCLUDE_DIR}")
- message(STATUS "Found DBUS arch dependent includes: ${DBUS_ARCH_INCLUDE_DIR}")
+ message(STATUS "Found DBUS include: ${DBUS_INCLUDE_DIR}")
+ message(STATUS "Found DBUS arch dependent include: ${DBUS_ARCH_INCLUDE_DIR}")
ENDIF(DBUS_LIBRARY)
MARK_AS_ADVANCED(
diff --git a/cmake/config.cmake b/cmake/config.cmake
index 2349bb7..8d1a8e6 100644
--- a/cmake/config.cmake
+++ b/cmake/config.cmake
@@ -19,6 +19,4 @@
#cmakedefine DBUS_SERVICE_PREFIX "@DBUS_SERVICE_PREFIX@"
#cmakedefine DBUS_SERVICE_OBJECT_PATH "@DBUS_SERVICE_OBJECT_PATH@"
-#cmakedefine INTROSPECTION_COMMAND_XML_FILE "@INTROSPECTION_COMMAND_XML_FILE@"
-
#endif /* _CONFIG_H */
diff --git a/includes/audiomanagertypes.h b/include/audiomanagertypes.h
index a489720..afc5519 100644
--- a/includes/audiomanagertypes.h
+++ b/include/audiomanagertypes.h
@@ -17,8 +17,8 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_20D4CA94_946F_4462_BD28_0ABEC8125573__INCLUDED_)
-#define EA_20D4CA94_946F_4462_BD28_0ABEC8125573__INCLUDED_
+#if !defined(EA_1F9A0AD1_FF28_4de6_A5C7_2F570F618734__INCLUDED_)
+#define EA_1F9A0AD1_FF28_4de6_A5C7_2F570F618734__INCLUDED_
#include <stdint.h>
#include "projecttypes.h"
@@ -31,63 +31,63 @@ namespace am {
/**
* a domain ID
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_domainID_t;
/**
* a source ID
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_sourceID_t;
/**
* a sink ID
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_sinkID_t;
/**
* a gateway ID
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_gatewayID_t;
/**
* a crossfader ID
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_crossfaderID_t;
/**
* a connection ID
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_connectionID_t;
/**
* a mainConnection ID
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_mainConnectionID_t;
/**
* speed
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_speed_t;
/**
* The unit is 0.1 db steps,The smallest value -3000 (=AM_MUTE). The minimum and maximum can be limited by actual project.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef int16_t am_volume_t;
@@ -95,40 +95,40 @@ namespace am {
* This is the volume presented on the command interface. It is in the duty of the Controller to change the volumes given here into meaningful values on the routing interface.
* The range of this type is customer specific.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef int16_t am_mainVolume_t;
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_sourceClass_t;
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_sinkClass_t;
/**
* time in ms!
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef uint16_t am_time_t;
/**
* offset time that is introduced in milli seconds.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
typedef int16_t am_timeSync_t;
/**
* with the help of this enum, sinks and sources can report their availability state
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_Availablility_e
{
@@ -150,7 +150,7 @@ namespace am {
/**
* represents the connection state
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_ConnectionState_e
{
@@ -180,7 +180,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_DomainState_e
{
@@ -206,7 +206,7 @@ namespace am {
/**
* This enum characterizes the data of the EarlyData_t
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_EarlyDataType_e
{
@@ -236,7 +236,7 @@ namespace am {
/**
* the errors of the audiomanager. All possible errors are in here. This enum is used widely as return parameter.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_Error_e
{
@@ -289,7 +289,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_MuteState_e
{
@@ -311,7 +311,7 @@ namespace am {
/**
* The source state reflects the state of the source
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_SourceState_e
{
@@ -334,7 +334,7 @@ namespace am {
/**
* This enumeration is used to define the type of the action that is correlated to a handle.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_Handle_e
{
@@ -354,7 +354,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_InterruptState_e
{
@@ -376,7 +376,7 @@ namespace am {
/**
* describes the active sink of a crossfader.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:36 PM
*/
enum am_HotSink_e
{
@@ -402,7 +402,7 @@ namespace am {
/**
* this describes the availability of a sink or a source together with the latest change
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:37 PM
*/
struct am_Availability_s
{
@@ -421,7 +421,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:25 PM
+ * @created 29-Feb-2012 6:16:37 PM
*/
struct am_ClassProperty_s
{
@@ -434,7 +434,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:26 PM
+ * @created 29-Feb-2012 6:16:37 PM
*/
struct am_Crossfader_s
{
@@ -451,7 +451,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:26 PM
+ * @created 29-Feb-2012 6:16:37 PM
*/
struct am_Gateway_s
{
@@ -491,7 +491,7 @@ namespace am {
/**
* This represents one "hopp" in a route
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:26 PM
+ * @created 29-Feb-2012 6:16:37 PM
*/
struct am_RoutingElement_s
{
@@ -506,7 +506,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:26 PM
+ * @created 29-Feb-2012 6:16:37 PM
*/
struct am_Route_s
{
@@ -520,7 +520,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:26 PM
+ * @created 29-Feb-2012 6:16:37 PM
*/
struct am_SoundProperty_s
{
@@ -533,7 +533,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:26 PM
+ * @created 29-Feb-2012 6:16:37 PM
*/
struct am_SystemProperty_s
{
@@ -552,7 +552,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:26 PM
+ * @created 29-Feb-2012 6:16:38 PM
*/
struct am_SinkClass_s
{
@@ -566,7 +566,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:27 PM
+ * @created 29-Feb-2012 6:16:38 PM
*/
struct am_SourceClass_s
{
@@ -584,7 +584,7 @@ namespace am {
/**
* this type holds all information of sources relevant to the HMI
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:27 PM
+ * @created 29-Feb-2012 6:16:38 PM
*/
struct am_SourceType_s
{
@@ -600,7 +600,7 @@ namespace am {
/**
* this type holds all information of sinks relevant to the HMI
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:27 PM
+ * @created 29-Feb-2012 6:16:38 PM
*/
struct am_SinkType_s
{
@@ -617,7 +617,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:27 PM
+ * @created 29-Feb-2012 6:16:38 PM
*/
struct am_Handle_s
{
@@ -630,7 +630,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:27 PM
+ * @created 29-Feb-2012 6:16:38 PM
*/
struct am_MainSoundProperty_s
{
@@ -644,7 +644,7 @@ namespace am {
/**
* this type holds all information of connections relevant to the HMI
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:27 PM
+ * @created 29-Feb-2012 6:16:38 PM
*/
struct am_MainConnectionType_s
{
@@ -660,7 +660,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:27 PM
+ * @created 29-Feb-2012 6:16:39 PM
*/
struct am_MainConnection_s
{
@@ -683,7 +683,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:27 PM
+ * @created 29-Feb-2012 6:16:39 PM
*/
struct am_Sink_s
{
@@ -706,7 +706,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:28 PM
+ * @created 29-Feb-2012 6:16:39 PM
*/
struct am_Source_s
{
@@ -738,7 +738,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:28 PM
+ * @created 29-Feb-2012 6:16:39 PM
*/
struct am_Domain_s
{
@@ -756,7 +756,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:28 PM
+ * @created 29-Feb-2012 6:16:39 PM
*/
struct am_Connection_s
{
@@ -775,7 +775,7 @@ namespace am {
* volume_t in case of ED_SOURCE_VOLUME, ED_SINK_VOLUME
* soundProperty_t in case of ED_SOURCE_PROPERTY, ED_SINK_PROPERTY
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:28 PM
+ * @created 29-Feb-2012 6:16:39 PM
*/
union am_EarlyData_u
{
@@ -791,7 +791,7 @@ namespace am {
* sourceID in case of ED_SOURCE_VOLUME, ED_SOURCE_PROPERTY
* sinkID in case of ED_SINK_VOLUME, ED_SINK_PROPERTY
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:28 PM
+ * @created 29-Feb-2012 6:16:39 PM
*/
union am_DataType_u
{
@@ -804,7 +804,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:28 PM
+ * @created 29-Feb-2012 6:16:40 PM
*/
struct am_EarlyData_s
{
@@ -816,4 +816,4 @@ namespace am {
};
}
-#endif // !defined(EA_20D4CA94_946F_4462_BD28_0ABEC8125573__INCLUDED_)
+#endif // !defined(EA_1F9A0AD1_FF28_4de6_A5C7_2F570F618734__INCLUDED_)
diff --git a/includes/command/CommandReceiveInterface.h b/include/command/IAmCommandReceive.h
index 4190fa8..f56c838 100644
--- a/includes/command/CommandReceiveInterface.h
+++ b/include/command/IAmCommandReceive.h
@@ -17,15 +17,15 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_76AA566B_CDC8_4c91_A89E_BB68E32CC6D1__INCLUDED_)
-#define EA_76AA566B_CDC8_4c91_A89E_BB68E32CC6D1__INCLUDED_
+#if !defined(EA_33827DF9_2BDB_4811_85B2_0EA4CD5519E4__INCLUDED_)
+#define EA_33827DF9_2BDB_4811_85B2_0EA4CD5519E4__INCLUDED_
#include <vector>
#include <string>
#include "audiomanagertypes.h"
namespace am {
-class DBusWrapper;
-class SocketHandler;
+class CAmDbusWrapper;
+class CAmSocketHandler;
}
@@ -39,17 +39,17 @@ namespace am {
* Violation these rules may lead to unexpected behavior! Nevertheless you can implement thread safe by using the deferred-call pattern described on the wiki which also helps to implement calls that are forbidden.\n
* For more information, please check CAmSerializer
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:42 PM
*/
- class CommandReceiveInterface
+ class IAmCommandReceive
{
public:
- CommandReceiveInterface() {
+ IAmCommandReceive() {
}
- virtual ~CommandReceiveInterface() {
+ virtual ~IAmCommandReceive() {
}
@@ -188,14 +188,14 @@ namespace am {
*
* @param dbusConnectionWrapper This is a wrapper class that is needed to keep dbus inclusions away from the interface. The DBusWrapperClass will return the pointer to the DbusConnection call (getDBusConnection)
*/
- virtual am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const =0;
+ virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
/**
* This function returns the pointer to the socketHandler. This can be used to integrate socket-based activites like communication with the mainloop of the AudioManager.
* returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled without socketHandler support,
*
* @param socketHandler
*/
- virtual am_Error_e getSocketHandler(SocketHandler*& socketHandler) const =0;
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
/**
* This function returns the version of the interface.
*
@@ -217,4 +217,4 @@ namespace am {
};
}
-#endif // !defined(EA_76AA566B_CDC8_4c91_A89E_BB68E32CC6D1__INCLUDED_)
+#endif // !defined(EA_33827DF9_2BDB_4811_85B2_0EA4CD5519E4__INCLUDED_)
diff --git a/includes/command/CommandSendInterface.h b/include/command/IAmCommandSend.h
index 70cf3cc..0a447f9 100644
--- a/includes/command/CommandSendInterface.h
+++ b/include/command/IAmCommandSend.h
@@ -17,18 +17,18 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_AE49449C_9BE2_428f_82B5_7BD27DBBFCF2__INCLUDED_)
-#define EA_AE49449C_9BE2_428f_82B5_7BD27DBBFCF2__INCLUDED_
+#if !defined(EA_E4CFF16E_3331_4608_971A_20131753B26D__INCLUDED_)
+#define EA_E4CFF16E_3331_4608_971A_20131753B26D__INCLUDED_
#include <vector>
#include <string>
#include "audiomanagertypes.h"
namespace am {
-class CommandReceiveInterface;
+class IAmCommandReceive;
}
-#include "CommandReceiveInterface.h"
+#include "IAmCommandReceive.h"
#define CommandSendVersion "1.0"
namespace am {
@@ -40,17 +40,17 @@ namespace am {
* Violation these rules may lead to unexpected behavior! Nevertheless you can implement thread safe by using the deferred-call pattern described on the wiki which also helps to implement calls that are forbidden.\n
* For more information, please check CAmSerializer
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:43 PM
*/
- class CommandSendInterface
+ class IAmCommandSend
{
public:
- CommandSendInterface() {
+ IAmCommandSend() {
}
- virtual ~CommandSendInterface() {
+ virtual ~IAmCommandSend() {
}
@@ -61,7 +61,7 @@ namespace am {
*
* @param commandreceiveinterface pointer to the receive interface. Is used to call the audiomanagerdaemon
*/
- virtual am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface) =0;
+ virtual am_Error_e startupInterface(IAmCommandReceive* commandreceiveinterface) =0;
/**
* This function will indirectly be called by the Controller and is used to start the Communication. Before this command, all communication will be ignored by the AudioManager.
* After the Plugin is ready, it will asynchronously answer with condfirmCommandReady, the handle that is handed over must be returned.
@@ -191,4 +191,4 @@ namespace am {
};
}
-#endif // !defined(EA_AE49449C_9BE2_428f_82B5_7BD27DBBFCF2__INCLUDED_)
+#endif // !defined(EA_E4CFF16E_3331_4608_971A_20131753B26D__INCLUDED_)
diff --git a/includes/control/ControlReceiveInterface.h b/include/control/IAmControlReceive.h
index 94a0258..bc160aa 100644
--- a/includes/control/ControlReceiveInterface.h
+++ b/include/control/IAmControlReceive.h
@@ -17,14 +17,14 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_CCBD8A91_5C9B_49d1_88D8_69215A0542F8__INCLUDED_)
-#define EA_CCBD8A91_5C9B_49d1_88D8_69215A0542F8__INCLUDED_
+#if !defined(EA_857044C8_1BA8_4972_9083_E7BDD50F6922__INCLUDED_)
+#define EA_857044C8_1BA8_4972_9083_E7BDD50F6922__INCLUDED_
#include <vector>
#include <string>
#include "audiomanagertypes.h"
namespace am {
-class SocketHandler;
+class CAmSocketHandler;
}
@@ -38,17 +38,17 @@ namespace am {
* Violation these rules may lead to unexpected behavior! Nevertheless you can implement thread safe by using the deferred-call pattern described on the wiki which also helps to implement calls that are forbidden.\n
* For more information, please check CAmSerializer
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:43 PM
*/
- class ControlReceiveInterface
+ class IAmControlReceive
{
public:
- ControlReceiveInterface() {
+ IAmControlReceive() {
}
- virtual ~ControlReceiveInterface() {
+ virtual ~IAmControlReceive() {
}
@@ -601,7 +601,7 @@ namespace am {
*
* @param socketHandler
*/
- virtual am_Error_e getSocketHandler(SocketHandler*& socketHandler) =0;
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) =0;
/**
* This function returns the version of the interface
*
@@ -611,4 +611,4 @@ namespace am {
};
}
-#endif // !defined(EA_CCBD8A91_5C9B_49d1_88D8_69215A0542F8__INCLUDED_)
+#endif // !defined(EA_857044C8_1BA8_4972_9083_E7BDD50F6922__INCLUDED_)
diff --git a/includes/control/ControlSendInterface.h b/include/control/IAmControlSend.h
index 2d706a2..edf6d2e 100644
--- a/includes/control/ControlSendInterface.h
+++ b/include/control/IAmControlSend.h
@@ -17,15 +17,15 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_3F77CFC8_1A30_4d2d_88FD_3E946AA5AB38__INCLUDED_)
-#define EA_3F77CFC8_1A30_4d2d_88FD_3E946AA5AB38__INCLUDED_
+#if !defined(EA_4CA53F2D_FD24_4389_9279_AD92791BD0B6__INCLUDED_)
+#define EA_4CA53F2D_FD24_4389_9279_AD92791BD0B6__INCLUDED_
#include <vector>
#include <string>
#include "audiomanagertypes.h"
namespace am {
-class ControlReceiveInterface;
+class IAmControlReceive;
}
#define ControlSendVersion "1.0"
@@ -39,17 +39,17 @@ namespace am {
* Violation these rules may lead to unexpected behavior! Nevertheless you can implement thread safe by using the deferred-call pattern described on the wiki which also helps to implement calls that are forbidden.\n
* For more information, please check CAmSerializer
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:30 PM
+ * @created 29-Feb-2012 6:16:44 PM
*/
- class ControlSendInterface
+ class IAmControlSend
{
public:
- ControlSendInterface() {
+ IAmControlSend() {
}
- virtual ~ControlSendInterface() {
+ virtual ~IAmControlSend() {
}
@@ -58,7 +58,7 @@ namespace am {
*
* @param controlreceiveinterface This is a pointer to the ControlReceiveInterface so that the controller knows to whom to communicate.
*/
- virtual am_Error_e startupController(ControlReceiveInterface* controlreceiveinterface) =0;
+ virtual am_Error_e startupController(IAmControlReceive* controlreceiveinterface) =0;
/**
* this message is used tell the controller that it should get ready. This message must be acknowledged via confirmControllerReady.
*/
@@ -385,4 +385,4 @@ namespace am {
};
}
-#endif // !defined(EA_3F77CFC8_1A30_4d2d_88FD_3E946AA5AB38__INCLUDED_)
+#endif // !defined(EA_4CA53F2D_FD24_4389_9279_AD92791BD0B6__INCLUDED_)
diff --git a/includes/projecttypes.h b/include/projecttypes.h
index a8f48a7..2c03d5a 100644
--- a/includes/projecttypes.h
+++ b/include/projecttypes.h
@@ -17,14 +17,14 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_D85F87B8_62E9_4a72_9BF7_3DCA2B6559EA__INCLUDED_)
-#define EA_D85F87B8_62E9_4a72_9BF7_3DCA2B6559EA__INCLUDED_
+#if !defined(EA_3B985F0B_FAF4_4ad9_B5EA_59C989D2321B__INCLUDED_)
+#define EA_3B985F0B_FAF4_4ad9_B5EA_59C989D2321B__INCLUDED_
namespace am {
/**
* This enum classifies the format in which data is exchanged within a connection. The enum itself is project specific although there are some Genivi standard formats defined.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:40 PM
*/
enum am_ConnectionFormat_e
{
@@ -54,7 +54,7 @@ namespace am {
/**
* This enum gives the information about reason for reason for Source/Sink change
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:40 PM
*/
enum am_AvailabilityReason_e
{
@@ -92,7 +92,7 @@ namespace am {
/**
* product specific identifier of property
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:40 PM
*/
enum am_ClassProperty_e
{
@@ -115,7 +115,7 @@ namespace am {
* The given ramp types here are just a possiblity. for products, different ramp types can be defined here.
* It is in the responsibility of the product to make sure that the routing plugins are aware of the ramp types used.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:40 PM
*/
enum am_RampType_e
{
@@ -137,7 +137,7 @@ namespace am {
/**
* sound properties. Within genivi only the standard properties are defined, for products these need to be extended.
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:40 PM
*/
enum am_SoundPropertyType_e
{
@@ -163,7 +163,7 @@ namespace am {
/**
* Here are all SoundProperties that can be set via the CommandInterface. Product specific
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:40 PM
*/
enum am_MainSoundPropertyType_e
{
@@ -189,7 +189,7 @@ namespace am {
/**
* describes the different system properties. Project specific
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:29 PM
+ * @created 29-Feb-2012 6:16:40 PM
*/
enum am_SystemPropertyType_e
{
@@ -200,4 +200,4 @@ namespace am {
SYP_MAX
};
}
-#endif // !defined(EA_D85F87B8_62E9_4a72_9BF7_3DCA2B6559EA__INCLUDED_)
+#endif // !defined(EA_3B985F0B_FAF4_4ad9_B5EA_59C989D2321B__INCLUDED_)
diff --git a/includes/routing/RoutingReceiveInterface.h b/include/routing/IAmRoutingReceive.h
index f614fb3..d654d23 100644
--- a/includes/routing/RoutingReceiveInterface.h
+++ b/include/routing/IAmRoutingReceive.h
@@ -17,16 +17,16 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_ACBA7B56_BAFE_481f_8DF3_0B1AB9AE1E8C__INCLUDED_)
-#define EA_ACBA7B56_BAFE_481f_8DF3_0B1AB9AE1E8C__INCLUDED_
+#if !defined(EA_8A0F2164_0638_43df_A114_D343F60C0938__INCLUDED_)
+#define EA_8A0F2164_0638_43df_A114_D343F60C0938__INCLUDED_
#include <vector>
#include <string>
#include "audiomanagertypes.h"
namespace am {
-class DBusWrapper;
-class SocketHandler;
+class CAmDbusWrapper;
+class CAmSocketHandler;
}
@@ -40,17 +40,17 @@ namespace am {
* Violation these rules may lead to unexpected behavior! Nevertheless you can implement thread safe by using the deferred-call pattern described on the wiki which also helps to implement calls that are forbidden.\n
* For more information, please check CAmSerializer
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:30 PM
+ * @created 29-Feb-2012 6:16:44 PM
*/
- class RoutingReceiveInterface
+ class IAmRoutingReceive
{
public:
- RoutingReceiveInterface() {
+ IAmRoutingReceive() {
}
- virtual ~RoutingReceiveInterface() {
+ virtual ~IAmRoutingReceive() {
}
@@ -316,14 +316,14 @@ namespace am {
*
* @param dbusConnectionWrapper This is a wrapper class that is needed to keep dbus inclusions away from the interface. The DBusWrapperClass will return the pointer to the DbusConnection call (getDBusConnection)
*/
- virtual am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const =0;
+ virtual am_Error_e getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const =0;
/**
* This function returns the pointer to the socketHandler. This can be used to integrate socket-based activites like communication with the mainloop of the AudioManager.
* returns E_OK if pointer is valid, E_UNKNOWN in case AudioManager was compiled without socketHandler support,
*
* @param socketHandler
*/
- virtual am_Error_e getSocketHandler(SocketHandler*& socketHandler) const =0;
+ virtual am_Error_e getSocketHandler(CAmSocketHandler*& socketHandler) const =0;
/**
* This function returns the version of the interface
*
@@ -345,4 +345,4 @@ namespace am {
};
}
-#endif // !defined(EA_ACBA7B56_BAFE_481f_8DF3_0B1AB9AE1E8C__INCLUDED_)
+#endif // !defined(EA_8A0F2164_0638_43df_A114_D343F60C0938__INCLUDED_)
diff --git a/includes/routing/RoutingSendInterface.h b/include/routing/IAmRoutingSend.h
index e2bd5c4..d22489b 100644
--- a/includes/routing/RoutingSendInterface.h
+++ b/include/routing/IAmRoutingSend.h
@@ -17,18 +17,18 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_337B4D34_644D_4faf_8A72_3253A0B4F5A0__INCLUDED_)
-#define EA_337B4D34_644D_4faf_8A72_3253A0B4F5A0__INCLUDED_
+#if !defined(EA_98A8173D_A5F4_4ee2_B909_152612E7BF00__INCLUDED_)
+#define EA_98A8173D_A5F4_4ee2_B909_152612E7BF00__INCLUDED_
#include <vector>
#include <string>
#include "audiomanagertypes.h"
namespace am {
-class RoutingReceiveInterface;
+class IAmRoutingReceive;
}
-#include "RoutingReceiveInterface.h"
+#include "IAmRoutingReceive.h"
#define RoutingSendVersion "1.0"
namespace am {
@@ -40,17 +40,17 @@ namespace am {
* Violation these rules may lead to unexpected behavior! Nevertheless you can implement thread safe by using the deferred-call pattern described on the wiki which also helps to implement calls that are forbidden.\n
* For more information, please check CAmSerializer
* @author Christian Mueller
- * @created 29-Feb-2012 12:54:31 PM
+ * @created 29-Feb-2012 6:16:44 PM
*/
- class RoutingSendInterface
+ class IAmRoutingSend
{
public:
- RoutingSendInterface() {
+ IAmRoutingSend() {
}
- virtual ~RoutingSendInterface() {
+ virtual ~IAmRoutingSend() {
}
@@ -59,7 +59,7 @@ namespace am {
*
* @param routingreceiveinterface pointer to the receive interface
*/
- virtual am_Error_e startupInterface(RoutingReceiveInterface* routingreceiveinterface) =0;
+ virtual am_Error_e startupInterface(IAmRoutingReceive* routingreceiveinterface) =0;
/**
* indicates that the routing now ready to be used. Should be used as trigger to register all sinks, sources, etc...
*
@@ -201,4 +201,4 @@ namespace am {
};
}
-#endif // !defined(EA_337B4D34_644D_4faf_8A72_3253A0B4F5A0__INCLUDED_)
+#endif // !defined(EA_98A8173D_A5F4_4ee2_B909_152612E7BF00__INCLUDED_)
diff --git a/include/shared/CAmDbusWrapper.h b/include/shared/CAmDbusWrapper.h
new file mode 100644
index 0000000..26131c2
--- /dev/null
+++ b/include/shared/CAmDbusWrapper.h
@@ -0,0 +1,92 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * \author Christian Mueller, BMW
+ *
+ * \section license
+ * 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.
+ *
+ */
+
+#ifndef DBUSWRAPPER_H_
+#define DBUSWRAPPER_H_
+
+#include <config.h>
+#include <dbus/dbus.h>
+#include <string>
+#include <list>
+#include "shared/CAmSocketHandler.h"
+
+namespace am
+{
+/**
+ * This wraps dbus and provides everything needed to anyone who wants to use dbus (including plugins)
+ */
+class CAmDbusWrapper
+{
+public:
+ CAmDbusWrapper(CAmSocketHandler* socketHandler);
+ virtual ~CAmDbusWrapper();
+
+ /**
+ * registers a callback that is entered as path below the main path.
+ * The configuration of the mainpath is done via DBusConfiguration.h
+ * @param vtable the vtable that holds a pointer to the callback that is called when the path is called from the dbus
+ * @param path the name of the path
+ * @param userdata pointer to the class that will handle the callback
+ */
+ void registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata);
+
+ /**
+ * returns the dbus connection
+ * @param connection pointer to the connection
+ */
+ void getDBusConnection(DBusConnection*& connection) const;
+
+ static dbus_bool_t addWatch(DBusWatch *watch, void *userData);
+ static void removeWatch(DBusWatch *watch, void *userData);
+ static void toogleWatch(DBusWatch *watch, void *userData);
+
+ static dbus_bool_t addTimeout(DBusTimeout *timeout, void* userData);
+ static void removeTimeout(DBusTimeout *timeout, void* userData);
+ static void toggleTimeout(DBusTimeout *timeout, void* userData);
+
+ bool dbusDispatchCallback(const sh_pollHandle_t handle, void* userData);
+ TAmShPollDispatch<CAmDbusWrapper> pDbusDispatchCallback;
+
+ void dbusFireCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+ TAmShPollFired<CAmDbusWrapper> pDbusFireCallback;
+
+ bool dbusCheckCallback(const sh_pollHandle_t handle, void* userData);
+ TAmShPollCheck<CAmDbusWrapper> pDbusCheckCallback;
+
+ void dbusTimerCallback(sh_timerHandle_t handle, void* userData);
+ TAmShTimerCallBack<CAmDbusWrapper> pDbusTimerCallback;
+
+private:
+ static CAmDbusWrapper* mpReference;
+ static DBusHandlerResult cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference);
+ dbus_bool_t addWatchDelegate(DBusWatch * watch, void* userData);
+ void removeWatchDelegate(DBusWatch *watch, void *userData);
+ void toogleWatchDelegate(DBusWatch *watch, void *userData);
+ dbus_bool_t addTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ void removeTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ void toggleTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ DBusObjectPathVTable mObjectPathVTable;
+ DBusConnection* mpDbusConnection;
+ DBusError mDBusError;
+ std::list<std::string> mListNodes;
+ std::vector<sh_timerHandle_t*> mpListTimerhandles;
+ CAmSocketHandler *mpSocketHandler;
+ std::map<DBusWatch*, sh_pollHandle_t> mMapHandleWatch;
+};
+
+}
+
+#endif /* DBUSWRAPPER_H_ */
diff --git a/includes/DLTWrapper.h b/include/shared/CAmDltWrapper.h
index 3a9482a..ea6f246 100644
--- a/includes/DLTWrapper.h
+++ b/include/shared/CAmDltWrapper.h
@@ -1,24 +1,16 @@
-/**
- * Copyright (C) 2011, BMW AG
- *
- * GeniviAudioMananger AudioManagerDaemon
- *
- * \file DLTWrapper.h
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ * \author Christian Mueller, BMW
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ * \section license
+ * 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.
*
*/
@@ -33,6 +25,8 @@
#include <stdint.h>
+namespace am {
+
#define DLT_USER_BUF_MAX_SIZE 2048
/**
@@ -81,17 +75,29 @@ DltContext CONTEXT;
#define DLT_IMPORT_CONTEXT(CONTEXT) \
extern DltContext CONTEXT;
+}
+
#endif
#include <string>
-class DLTWrapper
+namespace am
+{
+
+/**
+ * Wraps around the dlt wrapper. This class is instantiated as a singleton and offers a default
+ * context (maincontext) that is registered to log to.
+ * Logging under the default context can simply be done with the logInfo/logError templates with up to 10 values at a time.
+ * For logging with a different context, you can use the log template. First register a context with registerContext.
+ */
+class CAmDltWrapper
{
public:
- static DLTWrapper* instance(const bool enableNoDLTDebug = false);
+ static CAmDltWrapper* instance(const bool enableNoDLTDebug = false);
void registerApp(const char *appid, const char * description);
void registerContext(DltContext& handle, const char *contextid, const char * description);
void unregisterContext(DltContext& handle);
+
void init(DltLogLevelType loglevel, DltContext* context = NULL);
void send();
void append(const int8_t value);
@@ -106,44 +112,63 @@ public:
#ifndef WITH_DLT
void enableNoDLTDebug(const bool enableNoDLTDebug = true);
#endif
- ~DLTWrapper();
+ ~CAmDltWrapper();
private:
- DLTWrapper(const bool enableNoDLTDebug); //is private because of singleton pattern
+ CAmDltWrapper(const bool enableNoDLTDebug); //is private because of singleton pattern
#ifndef WITH_DLT
template<class T> void appendNoDLT(T value);
bool mEnableNoDLTDebug;
#endif
- DltContext mDltContext;
- DltContextData mDltContextData;
- static DLTWrapper* mDLTWrapper;
+ DltContext mDltContext; //!< the default context
+ DltContextData mDltContextData; //!< contextdata
+ static CAmDltWrapper* mpDLTWrapper; //!< pointer to the wrapper instance
};
-inline DLTWrapper* getWrapper()
+/**
+ * returns the instance of the CAmDltWrapper
+ * @return
+ */
+inline CAmDltWrapper* getWrapper()
{
- return DLTWrapper::instance();
+ return CAmDltWrapper::instance();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ */
template<typename T> void logInfo(T value)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ */
template<typename T, typename T1> void logInfo(T value, T1 value1)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->append(value1);
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ */
template<typename T, typename T1, typename T2> void logInfo(T value, T1 value1, T2 value2)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->append(value1);
@@ -151,9 +176,16 @@ template<typename T, typename T1, typename T2> void logInfo(T value, T1 value1,
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ */
template<typename T, typename T1, typename T2, typename T3> void logInfo(T value, T1 value1, T2 value2, T3 value3)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->append(value1);
@@ -162,9 +194,17 @@ template<typename T, typename T1, typename T2, typename T3> void logInfo(T value
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->append(value1);
@@ -174,9 +214,18 @@ template<typename T, typename T1, typename T2, typename T3, typename T4> void lo
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->append(value1);
@@ -187,9 +236,19 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->append(value1);
@@ -201,9 +260,20 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->append(value1);
@@ -216,9 +286,21 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_INFO);
inst->append(value);
inst->append(value1);
@@ -232,9 +314,22 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ * @param value9
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -249,9 +344,23 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with infolevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ * @param value9
+ * @param value10
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -267,26 +376,41 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ */
template<typename T> void logError(T value)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ */
template<typename T, typename T1> void logError(T value, T1 value1)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ */
template<typename T, typename T1, typename T2> void logError(T value, T1 value1, T2 value2)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -294,9 +418,16 @@ template<typename T, typename T1, typename T2> void logError(T value, T1 value1,
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ */
template<typename T, typename T1, typename T2, typename T3> void logError(T value, T1 value1, T2 value2, T3 value3)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -305,9 +436,17 @@ template<typename T, typename T1, typename T2, typename T3> void logError(T valu
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -317,9 +456,18 @@ template<typename T, typename T1, typename T2, typename T3, typename T4> void lo
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -330,9 +478,19 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -344,9 +502,20 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -359,9 +528,21 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -375,9 +556,22 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ * @param value9
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -392,9 +586,23 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with errorlevel with the default context
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ * @param value9
+ * @param value10
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(DLT_LOG_ERROR);
inst->append(value);
inst->append(value1);
@@ -410,26 +618,47 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ */
template<typename T> void log(DltContext* const context, DltLogLevelType loglevel, T value)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ */
template<typename T, typename T1> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->append(value1);
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ */
template<typename T, typename T1, typename T2> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->append(value1);
@@ -437,9 +666,18 @@ template<typename T, typename T1, typename T2> void log(DltContext* const contex
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ */
template<typename T, typename T1, typename T2, typename T3> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->append(value1);
@@ -448,9 +686,19 @@ template<typename T, typename T1, typename T2, typename T3> void log(DltContext*
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->append(value1);
@@ -460,9 +708,20 @@ template<typename T, typename T1, typename T2, typename T3, typename T4> void lo
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->append(value1);
@@ -473,9 +732,21 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->append(value1);
@@ -487,9 +758,22 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->append(value1);
@@ -502,9 +786,23 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->send();
}
+/**
+ * logs a given value with a given context (register first!) and given loglevel
+ * @param context
+ * @param loglevel
+ * @param value
+ * @param value1
+ * @param value2
+ * @param value3
+ * @param value4
+ * @param value5
+ * @param value6
+ * @param value7
+ * @param value8
+ */
template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
{
- DLTWrapper* inst(getWrapper());
+ CAmDltWrapper* inst(getWrapper());
inst->init(loglevel, context);
inst->append(value);
inst->append(value1);
@@ -517,5 +815,6 @@ template<typename T, typename T1, typename T2, typename T3, typename T4, typenam
inst->append(value8);
inst->send();
}
+}
#endif /* DLTWRAPPER_H_ */
diff --git a/includes/CAmSerializer.h b/include/shared/CAmSerializer.h
index ab6ff03..a27edaf 100644
--- a/includes/CAmSerializer.h
+++ b/include/shared/CAmSerializer.h
@@ -1,9 +1,9 @@
/** Copyright (c) 2012 GENIVI Alliance
* Copyright (c) 2012 BMW
*
- * @author Christian Mueller, BMW
+ * \author Christian Mueller, BMW
*
- * @copyright
+ * \section license
* 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:
@@ -22,8 +22,8 @@
#include <cassert>
#include <memory>
#include <stdexcept>
-#include "DLTWrapper.h"
-#include "SocketHandler.h"
+#include "CAmDltWrapper.h"
+#include "CAmSocketHandler.h"
//todo: performance improvement we could implement a memory pool that is more efficient here and avoids allocation and deallocation times.
@@ -669,15 +669,15 @@ public:
return true;
}
- shPollFired_T<CAmSerializer> receiverCallbackT;
- shPollDispatch_T<CAmSerializer> dispatcherCallbackT;
- shPollCheck_T<CAmSerializer> checkerCallbackT;
+ TAmShPollFired<CAmSerializer> receiverCallbackT;
+ TAmShPollDispatch<CAmSerializer> dispatcherCallbackT;
+ TAmShPollCheck<CAmSerializer> checkerCallbackT;
/**
* The constructor must be called in the mainthread context !
* @param iSocketHandler pointer to the sockethandler
*/
- CAmSerializer(SocketHandler *iSocketHandler) :
+ CAmSerializer(CAmSocketHandler *iSocketHandler) :
mPipe(), //
mListDelegatePoiters(), //
receiverCallbackT(this, &CAmSerializer::receiverCallback), //
diff --git a/include/shared/CAmSocketHandler.h b/include/shared/CAmSocketHandler.h
new file mode 100644
index 0000000..e0ea797
--- /dev/null
+++ b/include/shared/CAmSocketHandler.h
@@ -0,0 +1,258 @@
+/** Copyright (c) 2012 GENIVI Alliance
+ * Copyright (c) 2012 BMW
+ *
+ * \author Christian Mueller, BMW
+ *
+ * \section license
+ * 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.
+ *
+ */
+
+#ifndef SOCKETHANDLER_H_
+#define SOCKETHANDLER_H_
+
+#include "audiomanagertypes.h"
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <stdint.h>
+#include <sys/poll.h>
+#include <list>
+#include <map>
+#include <signal.h>
+
+namespace am
+{
+
+static volatile sig_atomic_t gDispatchDone = 0; //this global is used to stop the mainloop
+
+typedef uint16_t sh_timerHandle_t; //!<this is a handle for a timer to be used with the SocketHandler
+typedef uint16_t sh_pollHandle_t; //!<this is a handle for a filedescriptor to be used with the SocketHandler
+
+class CAmShPollPrepare;
+class CAmShPollCheck;
+class CAmShPollFired;
+class CAmShPollDispatch;
+class CAmShTimerCallBack;
+
+class CAmSocketHandler
+{
+public:
+ CAmSocketHandler();
+ virtual ~CAmSocketHandler();
+
+ am_Error_e addFDPoll(const int fd, const short event, CAmShPollPrepare *prepare, CAmShPollFired *fired, CAmShPollCheck *check, CAmShPollDispatch *dispatch, void* userData, sh_pollHandle_t& handle);
+ am_Error_e removeFDPoll(const sh_pollHandle_t handle);
+ am_Error_e updateEventFlags(const sh_pollHandle_t handle, const short events);
+ am_Error_e addTimer(const timespec timeouts, CAmShTimerCallBack*& callback, sh_timerHandle_t& handle, void* userData);
+ am_Error_e removeTimer(const sh_timerHandle_t handle);
+ am_Error_e restartTimer(const sh_timerHandle_t handle, const timespec timeouts);
+ am_Error_e stopTimer(const sh_timerHandle_t handle);
+ void start_listenting();
+ void stop_listening();
+private:
+ struct sh_timer_s //!<struct that holds information of timers
+ {
+ sh_timerHandle_t handle; //!<the handle of the timer
+ timespec countdown; //!<the countdown, this value is decreased every time the timer is up
+ timespec timeout; //!<the original timer value
+ CAmShTimerCallBack* callback; //!<the callbackfunction
+ void * userData; //!<saves a void pointer together with the rest.
+ };
+
+ class CAmShSubstractTime //!<functor to easy substract from each countdown value
+ {
+ private:
+ timespec param;
+ public:
+ CAmShSubstractTime(timespec param) :
+ param(param){}
+ void operator()(sh_timer_s& t) const;
+ };
+
+ struct sh_poll_s //!<struct that holds information about polls
+ {
+ sh_pollHandle_t handle; //!<handle to uniquely adress a filedesriptor
+ CAmShPollPrepare *prepareCB;
+ CAmShPollFired *firedCB;
+ CAmShPollCheck *checkCB;
+ CAmShPollDispatch *dispatchCB;
+ pollfd pollfdValue; //!<the array for polling the filedescriptors
+ void *userData; //!<userdata saved together with the callback.
+ };
+
+ typedef std::vector<pollfd> mListPollfd_t; //!<vector of filedescriptors
+ typedef std::vector<sh_poll_s> mListPoll_t; //!<list for the callbacks
+
+ class CAmShCopyPollfd
+ {
+ private:
+ mListPollfd_t& mArray;
+ public:
+ CAmShCopyPollfd(mListPollfd_t& dest) :
+ mArray(dest){}
+ void operator()(const sh_poll_s& row);
+ };
+
+ bool fdIsValid(const int fd) const;
+ void initTimer();
+ void timerUp();
+ int timespec2ms(const timespec& time);
+ timespec* insertTime(timespec& buffertime);
+ static bool compareCountdown(const sh_timer_s& a, const sh_timer_s& b)
+ {
+ return (a.countdown.tv_sec == b.countdown.tv_sec) ? (a.countdown.tv_nsec < b.countdown.tv_nsec) : (a.countdown.tv_sec < b.countdown.tv_sec);
+ }
+
+ static bool onlyFiredEvents(const pollfd& a)
+ {
+ return a.revents == 0 ? false : true;
+ }
+
+ //todo: maybe we could simplify mListActiveTimer to hold only the handle and the countdown ....
+ mListPollfd_t mfdPollingArray;
+ mListPoll_t mListPoll;
+ std::list<sh_timer_s> mListTimer; //!<list of all timers
+ std::list<sh_timer_s> mListActiveTimer; //!<list of all currently active timers
+ sh_timerHandle_t mNextTimer;
+ sh_timerHandle_t mLastInsertedHandle;
+ sh_pollHandle_t mLastInsertedPollHandle;
+ bool mRecreatePollfds;
+ timespec mTimeout;
+};
+
+/**
+ * classic functor for the BasicTimerCallback
+ */
+class CAmShTimerCallBack
+{
+public:
+ virtual void Call(const sh_timerHandle_t handle, void* userData)=0;
+ virtual ~CAmShTimerCallBack(){};
+};
+
+class CAmShPollPrepare
+{
+public:
+ virtual void Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~CAmShPollPrepare(){};
+};
+
+class CAmShPollFired
+{
+public:
+ virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ CAmShPollFired(){};
+};
+
+class CAmShPollCheck
+{
+public:
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ CAmShPollCheck(){};
+};
+
+class CAmShPollDispatch
+{
+public:
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ CAmShPollDispatch() {};
+};
+
+/**
+ * template to create the functor for a class
+ */
+template<class TClass> class TAmShTimerCallBack: public CAmShTimerCallBack
+{
+private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(sh_timerHandle_t handle, void* userData);
+
+public:
+ TAmShTimerCallBack(TClass* instance, void(TClass::*function)(sh_timerHandle_t handle, void* userData)) :
+ mInstance(instance),//
+ mFunction(function) {};
+
+ virtual void Call(sh_timerHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(handle, userData);
+ }
+};
+
+/**
+ * template to create the functor for a class
+ */
+template<class TClass> class TAmShPollPrepare: public CAmShPollPrepare
+{
+private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(const sh_timerHandle_t handle, void* userData);
+
+public:
+ TAmShPollPrepare(TClass* instance, void(TClass::*function)(const sh_timerHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual void Call(const sh_timerHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(handle, userData);
+ };
+};
+
+template<class TClass> class TAmShPollFired: public CAmShPollFired
+{
+private:
+ TClass* mInstance;
+ void (TClass::*mFunction)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+
+public:
+ TAmShPollFired(TClass* instance, void(TClass::*function)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(pollfd, handle, userData);
+ };
+};
+
+template<class TClass> class TAmShPollCheck: public CAmShPollCheck
+{
+private:
+ TClass* mInstance;
+ bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
+
+public:
+ TAmShPollCheck(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)
+ {
+ return (*mInstance.*mFunction)(handle, userData);
+ };
+};
+
+template<class TClass> class TAmShPollDispatch: public CAmShPollDispatch
+{
+private:
+ TClass* mInstance;
+ bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
+
+public:
+ TAmShPollDispatch(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function) {};
+
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)
+ {
+ return (*mInstance.*mFunction)(handle, userData);
+ };
+};
+} /* namespace am */
+#endif /* SOCKETHANDLER_H_ */
diff --git a/includes/SocketHandler.h b/includes/SocketHandler.h
deleted file mode 100644
index 2a20af6..0000000
--- a/includes/SocketHandler.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * Copyright (C) 2011, BMW AG
- *
- * GeniviAudioMananger AudioManagerDaemon
- *
- * \file SocketHandler.h
- *
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
- *
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
- *
- */
-
-#ifndef SOCKETHANDLER_H_
-#define SOCKETHANDLER_H_
-
-#include <audiomanagertypes.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <stdint.h>
-#include <sys/poll.h>
-#include <list>
-#include <map>
-#include <signal.h>
-
-namespace am
-{
-
-static volatile sig_atomic_t gDispatchDone = 0; //this global is used to stop the mainloop
-
-typedef uint16_t sh_timerHandle_t; //!<this is a handle for a timer to be used with the SocketHandler
-typedef uint16_t sh_pollHandle_t; //!<this is a handle for a filedescriptor to be used with the SocketHandler
-
-class shPollPrepare;
-class shPollCheck;
-class shPollFired;
-class shPollDispatch;
-class shTimerCallBack;
-
-class SocketHandler
-{
-public:
- SocketHandler();
- virtual ~SocketHandler();
-
- am_Error_e addFDPoll(const int fd, const short event, shPollPrepare *prepare, shPollFired *fired, shPollCheck *check, shPollDispatch *dispatch, void* userData, sh_pollHandle_t& handle);
- am_Error_e removeFDPoll(const sh_pollHandle_t handle);
- am_Error_e updateEventFlags(const sh_pollHandle_t handle, const short events);
- am_Error_e addTimer(const timespec timeouts, shTimerCallBack*& callback, sh_timerHandle_t& handle, void* userData);
- am_Error_e removeTimer(const sh_timerHandle_t handle);
- am_Error_e restartTimer(const sh_timerHandle_t handle, const timespec timeouts);
- am_Error_e stopTimer(const sh_timerHandle_t handle);
- void start_listenting();
- void stop_listening();
-private:
- struct timer_s //!<struct that holds information of timers
- {
- sh_timerHandle_t handle; //!<the handle of the timer
- timespec countdown; //!<the countdown, this value is decreased every time the timer is up
- timespec timeout; //!<the original timer value
- shTimerCallBack* callback; //!<the callbackfunction
- void * userData; //!<saves a void pointer together with the rest.
- };
-
- class SubstractTime //!<functor to easy substract from each countdown value
- {
- private:
- timespec param;
- public:
- SubstractTime(timespec param) :
- param(param){}
- void operator()(timer_s& t) const;
- };
-
- struct sh_poll_s //!<struct that holds information about polls
- {
- sh_pollHandle_t handle; //!<handle to uniquely adress a filedesriptor
- shPollPrepare *prepareCB;
- shPollFired *firedCB;
- shPollCheck *checkCB;
- shPollDispatch *dispatchCB;
- pollfd pollfdValue; //!<the array for polling the filedescriptors
- void *userData; //!<userdata saved together with the callback.
- };
-
- typedef std::vector<pollfd> mPollfd_t; //!<vector of filedescriptors
- typedef std::vector<sh_poll_s> mListPoll_t; //!<list for the callbacks
-
- class CopyPollfd
- {
- private:
- mPollfd_t& mArray;
- public:
- CopyPollfd(mPollfd_t& dest) :
- mArray(dest){}
- void operator()(const sh_poll_s& row);
- };
-
- bool fdIsValid(const int fd) const;
- void initTimer();
- void timerUp();
- int timespec2ms(const timespec& time);
- timespec* insertTime(timespec& buffertime);
- static bool compareCountdown(const timer_s& a, const timer_s& b)
- {
- return (a.countdown.tv_sec == b.countdown.tv_sec) ? (a.countdown.tv_nsec < b.countdown.tv_nsec) : (a.countdown.tv_sec < b.countdown.tv_sec);
- }
-
- static bool onlyFiredEvents(const pollfd& a)
- {
- return a.revents == 0 ? false : true;
- }
-
- //todo: maybe we could simplify mListActiveTimer to hold only the handle and the countdown ....
- mPollfd_t mfdPollingArray;
- mListPoll_t mListPoll;
- std::list<timer_s> mListTimer; //!<list of all timers
- std::list<timer_s> mListActiveTimer; //!<list of all currently active timers
- sh_timerHandle_t mNextTimer;
- sh_timerHandle_t mLastInsertedHandle;
- sh_pollHandle_t mLastInsertedPollHandle;
- bool mRecreatePollfds;
- timespec mTimeout;
-};
-
-/**
- * classic functor for the BasicTimerCallback
- */
-class shTimerCallBack
-{
-public:
- virtual void Call(const sh_timerHandle_t handle, void* userData)=0;
- virtual ~shTimerCallBack(){};
-};
-
-class shPollPrepare
-{
-public:
- virtual void Call(const sh_pollHandle_t handle, void* userData)=0;
- virtual ~shPollPrepare(){};
-};
-
-class shPollFired
-{
-public:
- virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)=0;
- virtual ~ shPollFired(){};
-};
-
-class shPollCheck
-{
-public:
- virtual bool Call(const sh_pollHandle_t handle, void* userData)=0;
- virtual ~ shPollCheck(){};
-};
-
-class shPollDispatch
-{
-public:
- virtual bool Call(const sh_pollHandle_t handle, void* userData)=0;
- virtual ~ shPollDispatch() {};
-};
-
-/**
- * template to create the functor for a class
- */
-template<class TClass> class shTimerCallBack_T: public shTimerCallBack
-{
-private:
- TClass* mInstance;
- void (TClass::*mFunction)(sh_timerHandle_t handle, void* userData);
-
-public:
- shTimerCallBack_T(TClass* instance, void(TClass::*function)(sh_timerHandle_t handle, void* userData)) :
- mInstance(instance),//
- mFunction(function) {};
-
- virtual void Call(sh_timerHandle_t handle, void* userData)
- {
- (*mInstance.*mFunction)(handle, userData);
- }
-};
-
-/**
- * template to create the functor for a class
- */
-template<class TClass> class shPollPrepare_T: public shPollPrepare
-{
-private:
- TClass* mInstance;
- void (TClass::*mFunction)(const sh_timerHandle_t handle, void* userData);
-
-public:
- shPollPrepare_T(TClass* instance, void(TClass::*function)(const sh_timerHandle_t handle, void* userData)) :
- mInstance(instance), //
- mFunction(function){};
-
- virtual void Call(const sh_timerHandle_t handle, void* userData)
- {
- (*mInstance.*mFunction)(handle, userData);
- };
-};
-
-template<class TClass> class shPollFired_T: public shPollFired
-{
-private:
- TClass* mInstance;
- void (TClass::*mFunction)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
-
-public:
- shPollFired_T(TClass* instance, void(TClass::*function)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)) :
- mInstance(instance), //
- mFunction(function){};
-
- virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)
- {
- (*mInstance.*mFunction)(pollfd, handle, userData);
- };
-};
-
-template<class TClass> class shPollCheck_T: public shPollCheck
-{
-private:
- TClass* mInstance;
- bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
-
-public:
- shPollCheck_T(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
- mInstance(instance), //
- mFunction(function){};
-
- virtual bool Call(const sh_pollHandle_t handle, void* userData)
- {
- return (*mInstance.*mFunction)(handle, userData);
- };
-};
-
-template<class TClass> class shPollDispatch_T: public shPollDispatch
-{
-private:
- TClass* mInstance;
- bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
-
-public:
- shPollDispatch_T(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
- mInstance(instance), //
- mFunction(function) {};
-
- virtual bool Call(const sh_pollHandle_t handle, void* userData)
- {
- return (*mInstance.*mFunction)(handle, userData);
- };
-};
-} /* namespace am */
-#endif /* SOCKETHANDLER_H_ */
diff --git a/includes/dbus/DBusWrapper.h b/includes/dbus/DBusWrapper.h
deleted file mode 100644
index 76fd2c1..0000000
--- a/includes/dbus/DBusWrapper.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Copyright (C) 2011, BMW AG
- *
- * GeniviAudioMananger AudioManagerDaemon
- *
- * \file DBusWrapper.h
- *
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
- *
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
- *
- * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
- */
-
-#ifndef DBUSWRAPPER_H_
-#define DBUSWRAPPER_H_
-
-#include <config.h>
-#include <SocketHandler.h>
-#include <dbus/dbus.h>
-#include <string>
-#include <list>
-
-namespace am
-{
-/**
- * This wraps dbus and provides everything needed to anyone who wants to use dbus (including plugins)
- */
-class DBusWrapper
-{
-public:
- DBusWrapper(SocketHandler* socketHandler);
- virtual ~DBusWrapper();
-
- /**
- * registers a callback that is entered as path below the main path.
- * The configuration of the mainpath is done via DBusConfiguration.h
- * @param vtable the vtable that holds a pointer to the callback that is called when the path is called from the dbus
- * @param path the name of the path
- * @param userdata pointer to the class that will handle the callback
- */
- void registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata);
-
- /**
- * returns the dbus connection
- * @param connection pointer to the connection
- */
- void getDBusConnection(DBusConnection*& connection) const;
-
- static dbus_bool_t addWatch(DBusWatch *watch, void *userData);
- static void removeWatch(DBusWatch *watch, void *userData);
- static void toogleWatch(DBusWatch *watch, void *userData);
-
- static dbus_bool_t addTimeout(DBusTimeout *timeout, void* userData);
- static void removeTimeout(DBusTimeout *timeout, void* userData);
- static void toggleTimeout(DBusTimeout *timeout, void* userData);
-
- bool dbusDispatchCallback(const sh_pollHandle_t handle, void* userData);
- shPollDispatch_T<DBusWrapper> pDbusDispatchCallback;
-
- void dbusFireCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
- shPollFired_T<DBusWrapper> pDbusFireCallback;
-
- bool dbusCheckCallback(const sh_pollHandle_t handle, void* userData);
- shPollCheck_T<DBusWrapper> pDbusCheckCallback;
-
- void dbusTimerCallback(sh_timerHandle_t handle, void* userData);
- shTimerCallBack_T<DBusWrapper> pDbusTimerCallback;
-
-private:
- static DBusWrapper* mReference;
- static DBusHandlerResult cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference);
- dbus_bool_t addWatchDelegate(DBusWatch * watch, void* userData);
- void removeWatchDelegate(DBusWatch *watch, void *userData);
- void toogleWatchDelegate(DBusWatch *watch, void *userData);
- dbus_bool_t addTimeoutDelegate(DBusTimeout *timeout, void* userData);
- void removeTimeoutDelegate(DBusTimeout *timeout, void* userData);
- void toggleTimeoutDelegate(DBusTimeout *timeout, void* userData);
- DBusObjectPathVTable mObjectPathVTable;
- DBusConnection* mDbusConnection;
- DBusError mDBusError;
- std::list<std::string> mNodesList;
- std::vector<sh_timerHandle_t*> mListTimerhandlePointer;
- SocketHandler *mSocketHandler;
- std::map<DBusWatch*, sh_pollHandle_t> mMapHandleWatch;
-};
-
-}
-
-#endif /* DBUSWRAPPER_H_ */