summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-02-29 13:27:27 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-02-29 13:27:27 +0100
commitd3ccf97331935b181041394b80be20dca282ea71 (patch)
treef85e7b649c8a6d58c11e9728b2442cdcff53826d
parentaa93713377d28a8ce7821466ef828f79a18e982d (diff)
downloadaudiomanager-d3ccf97331935b181041394b80be20dca282ea71.tar.gz
* [ performance] for classes that do not need to be derived from, removed virtual desctructor
* implemented confirmation of routing ready in RoutingReceiver * [Sockethandler] automatically set gDispatchDone to 0 when starting mainloop * fixed unit text to work with latest changes (expect Dbus command interface) * [GAM-4] added way to do synchronous calling on interfaces with the help of CAmSerializer.h * reworked AsyncRoutingPlugin to work with CAmSerializer.h * reworked AsyncRoutingPlugin to register elemtes in thread using CAmSerializer.h * reworked AsncPlugin Tests to work with remodelled Plugin
-rw-r--r--AudioManagerDaemon/include/CommandReceiver.h2
-rw-r--r--AudioManagerDaemon/include/CommandSender.h2
-rw-r--r--AudioManagerDaemon/include/ControlReceiver.h2
-rw-r--r--AudioManagerDaemon/include/ControlSender.h2
-rw-r--r--AudioManagerDaemon/include/DatabaseHandler.h2
-rw-r--r--AudioManagerDaemon/include/DatabaseObserver.h2
-rw-r--r--AudioManagerDaemon/include/Router.h2
-rw-r--r--AudioManagerDaemon/include/RoutingReceiver.h6
-rw-r--r--AudioManagerDaemon/include/RoutingSender.h2
-rw-r--r--AudioManagerDaemon/include/TelnetServer.h2
-rw-r--r--AudioManagerDaemon/src/CommandReceiver.cpp5
-rw-r--r--AudioManagerDaemon/src/RoutingReceiver.cpp19
-rw-r--r--AudioManagerDaemon/src/RoutingSender.cpp8
-rw-r--r--AudioManagerDaemon/src/SocketHandler.cpp1
-rw-r--r--AudioManagerDaemon/test/controlInterface/CMakeLists.txt2
-rw-r--r--AudioManagerDaemon/test/controlInterface/MockInterfaces.h250
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp23
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h27
-rw-r--r--AudioManagerDaemon/test/database/CMakeLists.txt3
-rw-r--r--AudioManagerDaemon/test/database/MockInterfaces.h254
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.cpp167
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.h7
-rw-r--r--AudioManagerDaemon/test/routing/CMakeLists.txt3
-rw-r--r--AudioManagerDaemon/test/routing/MockInterfaces.h262
-rw-r--r--AudioManagerDaemon/test/routing/routingTest.cpp41
-rw-r--r--AudioManagerDaemon/test/routing/routingTest.h2
-rw-r--r--AudioManagerDaemon/test/routingInterface/CMakeLists.txt3
-rw-r--r--AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h17
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp5
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h2
-rw-r--r--AudioManagerDaemon/test/sockethandler/sockethandlerTest.h4
-rw-r--r--AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.cpp6
-rw-r--r--PluginCommandInterfaceDbus/CMakeLists.txt2
-rw-r--r--PluginCommandInterfaceDbus/test/CMakeLists.txt2
-rw-r--r--PluginCommandInterfaceDbus/test/MockInterfaces.h86
-rw-r--r--PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp1105
-rw-r--r--PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.h4
-rw-r--r--PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp2
-rw-r--r--PluginControlInterface/src/ControlSender.cpp9
-rw-r--r--PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h121
-rw-r--r--PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h25
-rw-r--r--PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp473
-rw-r--r--PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp466
-rw-r--r--PluginRoutingInterfaceAsync/test/CMakeLists.txt4
-rw-r--r--PluginRoutingInterfaceAsync/test/mocklnterfaces.h155
-rw-r--r--PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp213
-rw-r--r--PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h28
-rw-r--r--PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp4
-rw-r--r--includes/CAmSerializer.h380
-rw-r--r--includes/audiomanagertypes.h100
-rw-r--r--includes/command/CommandReceiveInterface.h8
-rw-r--r--includes/command/CommandSendInterface.h8
-rw-r--r--includes/control/ControlReceiveInterface.h8
-rw-r--r--includes/control/ControlSendInterface.h8
-rw-r--r--includes/projecttypes.h20
-rw-r--r--includes/routing/RoutingReceiveInterface.h12
-rw-r--r--includes/routing/RoutingSendInterface.h8
57 files changed, 2240 insertions, 2146 deletions
diff --git a/AudioManagerDaemon/include/CommandReceiver.h b/AudioManagerDaemon/include/CommandReceiver.h
index a8f7400..5279a31 100644
--- a/AudioManagerDaemon/include/CommandReceiver.h
+++ b/AudioManagerDaemon/include/CommandReceiver.h
@@ -44,7 +44,7 @@ class CommandReceiver: public CommandReceiveInterface
public:
CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, SocketHandler* iSocketHandler);
CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, SocketHandler* iSocketHandler, DBusWrapper* iDBusWrapper);
- virtual ~CommandReceiver();
+ ~CommandReceiver();
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);
diff --git a/AudioManagerDaemon/include/CommandSender.h b/AudioManagerDaemon/include/CommandSender.h
index 57362f0..0a8d2b2 100644
--- a/AudioManagerDaemon/include/CommandSender.h
+++ b/AudioManagerDaemon/include/CommandSender.h
@@ -45,7 +45,7 @@ class CommandSender
{
public:
CommandSender(const std::vector<std::string>& listOfPluginDirectories);
- virtual ~CommandSender();
+ ~CommandSender();
am_Error_e startupInterfaces(CommandReceiver* iCommandReceiver);
void setCommandReady();
void setCommandRundown();
diff --git a/AudioManagerDaemon/include/ControlReceiver.h b/AudioManagerDaemon/include/ControlReceiver.h
index 03e36d8..dfb0695 100644
--- a/AudioManagerDaemon/include/ControlReceiver.h
+++ b/AudioManagerDaemon/include/ControlReceiver.h
@@ -44,7 +44,7 @@ class ControlReceiver: public ControlReceiveInterface
{
public:
ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler, Router* iRouter);
- virtual ~ControlReceiver();
+ ~ControlReceiver();
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);
diff --git a/AudioManagerDaemon/include/ControlSender.h b/AudioManagerDaemon/include/ControlSender.h
index cb9ff36..6e04d48 100644
--- a/AudioManagerDaemon/include/ControlSender.h
+++ b/AudioManagerDaemon/include/ControlSender.h
@@ -41,7 +41,7 @@ class ControlSender
{
public:
ControlSender(std::string controlPluginFile);
- virtual ~ControlSender();
+ ~ControlSender();
am_Error_e startupController(ControlReceiveInterface* controlreceiveinterface) ;
void setControllerReady() ;
void setControllerRundown() ;
diff --git a/AudioManagerDaemon/include/DatabaseHandler.h b/AudioManagerDaemon/include/DatabaseHandler.h
index 550c13d..964bbbe 100644
--- a/AudioManagerDaemon/include/DatabaseHandler.h
+++ b/AudioManagerDaemon/include/DatabaseHandler.h
@@ -53,7 +53,7 @@ class DatabaseHandler
{
public:
DatabaseHandler(std::string databasePath);
- virtual ~DatabaseHandler();
+ ~DatabaseHandler();
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);
diff --git a/AudioManagerDaemon/include/DatabaseObserver.h b/AudioManagerDaemon/include/DatabaseObserver.h
index 0657b9d..3862a79 100644
--- a/AudioManagerDaemon/include/DatabaseObserver.h
+++ b/AudioManagerDaemon/include/DatabaseObserver.h
@@ -46,7 +46,7 @@ class DatabaseObserver
public:
DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, SocketHandler *iSocketHandler);
DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, SocketHandler *iSocketHandler, TelnetServer *iTelnetServer);
- virtual ~DatabaseObserver();
+ ~DatabaseObserver();
void numberOfSinkClassesChanged();
void numberOfSourceClassesChanged();
void newSink(const am_Sink_s& sink);
diff --git a/AudioManagerDaemon/include/Router.h b/AudioManagerDaemon/include/Router.h
index 5af0cf7..11a5634 100644
--- a/AudioManagerDaemon/include/Router.h
+++ b/AudioManagerDaemon/include/Router.h
@@ -38,7 +38,7 @@ class Router
public:
Router(DatabaseHandler* iDatabaseHandler, ControlSender* iSender);
am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
- virtual ~Router();
+ ~Router();
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);
diff --git a/AudioManagerDaemon/include/RoutingReceiver.h b/AudioManagerDaemon/include/RoutingReceiver.h
index 3803ff4..ae964ff 100644
--- a/AudioManagerDaemon/include/RoutingReceiver.h
+++ b/AudioManagerDaemon/include/RoutingReceiver.h
@@ -45,7 +45,7 @@ class RoutingReceiver: public RoutingReceiveInterface
public:
RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler);
RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper);
- virtual ~RoutingReceiver();
+ ~RoutingReceiver();
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);
@@ -83,8 +83,8 @@ public:
am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const;
am_Error_e getSocketHandler(SocketHandler*& socketHandler) const;
void getInterfaceVersion(std::string& version) const;
- void confirmRoutingReady(const uint16_t handle) const;
- void confirmRoutingRundown(const uint16_t handle) const;
+ void confirmRoutingReady(const uint16_t handle);
+ void confirmRoutingRundown(const uint16_t handle);
uint16_t getStartupHandle(); //!< returns a startup handle
uint16_t getRundownHandle(); //!< returns a rundown handle
diff --git a/AudioManagerDaemon/include/RoutingSender.h b/AudioManagerDaemon/include/RoutingSender.h
index 308d5e5..f445313 100644
--- a/AudioManagerDaemon/include/RoutingSender.h
+++ b/AudioManagerDaemon/include/RoutingSender.h
@@ -44,7 +44,7 @@ class RoutingSender
{
public:
RoutingSender(const std::vector<std::string>& listOfPluginDirectories);
- virtual ~RoutingSender();
+ ~RoutingSender();
/**
* removes a handle from the list
diff --git a/AudioManagerDaemon/include/TelnetServer.h b/AudioManagerDaemon/include/TelnetServer.h
index f06e171..f95bd84 100644
--- a/AudioManagerDaemon/include/TelnetServer.h
+++ b/AudioManagerDaemon/include/TelnetServer.h
@@ -58,7 +58,7 @@ public:
unsigned int servPort,
unsigned int maxConnections);
- virtual ~TelnetServer();
+ ~TelnetServer();
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);
diff --git a/AudioManagerDaemon/src/CommandReceiver.cpp b/AudioManagerDaemon/src/CommandReceiver.cpp
index 74b819b..21e19d9 100644
--- a/AudioManagerDaemon/src/CommandReceiver.cpp
+++ b/AudioManagerDaemon/src/CommandReceiver.cpp
@@ -27,7 +27,6 @@
#include "ControlSender.h"
#include "DLTWrapper.h"
#include <SocketHandler.h>
-#include <config.h>
#include <cassert>
#include <algorithm>
@@ -211,12 +210,12 @@ uint16_t CommandReceiver::getRundownHandle()
return handle;
}
-void am::CommandReceiver::waitOnStartup(bool startup)
+void CommandReceiver::waitOnStartup(bool startup)
{
mWaitStartup = startup;
}
-void am::CommandReceiver::waitOnRundown(bool rundown)
+void CommandReceiver::waitOnRundown(bool rundown)
{
mWaitRundown = rundown;
}
diff --git a/AudioManagerDaemon/src/RoutingReceiver.cpp b/AudioManagerDaemon/src/RoutingReceiver.cpp
index fb160b0..715fa36 100644
--- a/AudioManagerDaemon/src/RoutingReceiver.cpp
+++ b/AudioManagerDaemon/src/RoutingReceiver.cpp
@@ -24,14 +24,14 @@
*/
#include "RoutingReceiver.h"
-#include <SocketHandler.h>
-#ifdef WITH_DBUS_WRAPPER
-#include <dbus/DBusWrapper.h>
-#endif
#include "DatabaseHandler.h"
#include "RoutingSender.h"
#include "ControlSender.h"
+#include "DLTWrapper.h"
+#include <SocketHandler.h>
#include <cassert>
+#include <algorithm>
+
using namespace am;
@@ -342,13 +342,18 @@ void RoutingReceiver::getInterfaceVersion(std::string & version) const
version = RoutingReceiveVersion;
}
-void RoutingReceiver::confirmRoutingReady(const uint16_t handle) const
+void RoutingReceiver::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) const
+void RoutingReceiver::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()
diff --git a/AudioManagerDaemon/src/RoutingSender.cpp b/AudioManagerDaemon/src/RoutingSender.cpp
index 76c671d..c59641d 100644
--- a/AudioManagerDaemon/src/RoutingSender.cpp
+++ b/AudioManagerDaemon/src/RoutingSender.cpp
@@ -300,7 +300,7 @@ am_Error_e RoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, const
return (E_NON_EXISTENT);
}
-am_Error_e am::RoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sourceID_t sourceID)
+am_Error_e RoutingSender::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();
@@ -314,7 +314,7 @@ am_Error_e am::RoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle,
return (E_NON_EXISTENT);
}
-am_Error_e am::RoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sinkID_t sinkID)
+am_Error_e RoutingSender::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();
@@ -493,7 +493,7 @@ RoutingSender::am_handleData_c RoutingSender::returnHandleData(const am_Handle_s
return (it->second);
}
-void am::RoutingSender::setRoutingReady()
+void RoutingSender::setRoutingReady()
{
mRoutingReceiver->waitOnStartup(false);
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
@@ -505,7 +505,7 @@ void am::RoutingSender::setRoutingReady()
mRoutingReceiver->waitOnStartup(true);
}
-void am::RoutingSender::setRoutingRundown()
+void RoutingSender::setRoutingRundown()
{
mRoutingReceiver->waitOnRundown(false);
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
diff --git a/AudioManagerDaemon/src/SocketHandler.cpp b/AudioManagerDaemon/src/SocketHandler.cpp
index d9fdc3a..444289f 100644
--- a/AudioManagerDaemon/src/SocketHandler.cpp
+++ b/AudioManagerDaemon/src/SocketHandler.cpp
@@ -64,6 +64,7 @@ SocketHandler::~SocketHandler()
*/
void SocketHandler::start_listenting()
{
+ gDispatchDone=0;
int16_t pollStatus;
std::list<int16_t> hitList;
diff --git a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt b/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
index 5071326..bdf8ac5 100644
--- a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
@@ -54,6 +54,8 @@ file(GLOB CONTROL_INTERFACE_SRCS_CXX
"../../src/ControlSender.cpp"
"../../src/Router.cpp"
"../../src/DLTWrapper.cpp"
+ "../../src/SocketHandler.cpp"
+ "../../src/CommandReceiver.cpp"
"../CommonFunctions.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
index b49cae6..a341eee 100644
--- a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
+++ b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
@@ -34,132 +34,142 @@ namespace am {
class MockRoutingSendInterface : public RoutingSendInterface {
public:
- MOCK_METHOD1(startupRoutingInterface,
- void(RoutingReceiveInterface* routingreceiveinterface));
- MOCK_METHOD0(routingInterfacesReady,
- void());
- MOCK_METHOD0(routingInterfacesRundown,
- void());
- 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_METHOD0(getInterfaceVersion,
- uint16_t());
+ 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(stopController,
- am_Error_e());
- MOCK_METHOD0(hookAllPluginsLoaded,
- 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_METHOD0(getInterfaceVersion,
- uint16_t());
+ 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());
+
};
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
index 61f11a0..c262692 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
@@ -21,27 +21,12 @@
* 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 <algorithm>
#include <string>
#include <vector>
#include <set>
#include "DLTWrapper.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"
using namespace am;
using namespace testing;
@@ -52,7 +37,7 @@ controlInterfaceTest::controlInterfaceTest() :
plistCommandPluginDirs(), //
plistRoutingPluginDirs(), //
pDatabaseHandler(std::string(":memory:")), //
- pRoutingSender(plistRoutingPluginDirs), //
+ pRoutingSender(plistRoutingPluginDirs), //RoutingReceiver
pCommandSender(plistCommandPluginDirs), //
pMockControlInterface(), //
pMockRoutingInterface(), //
@@ -61,9 +46,9 @@ controlInterfaceTest::controlInterfaceTest() :
pControlInterfaceBackdoor(), //
pControlSender(std::string("")), //
pRouter(&pDatabaseHandler,&pControlSender), //
- pDatabaseObserver(&pCommandSender, &pSocketHandler, &pRoutingSender), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender,&pRouter), //
- pRoutingReceiver(&pDatabaseHandler, &pRoutingSender, &pControlSender, pDBusWrapper)
+ pDatabaseObserver(&pCommandSender, &pRoutingSender, &pSocketHandler), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pSocketHandler, &pRouter), //
+ pRoutingReceiver(&pDatabaseHandler, &pRoutingSender, &pControlSender, &pSocketHandler, pDBusWrapper)
{
pDatabaseHandler.registerObserver(&pDatabaseObserver);
pControlInterfaceBackdoor.replaceController(&pControlSender, &pMockControlInterface);
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
index 864f072..72e2f63 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
@@ -28,19 +28,20 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-class DatbaseHandler;
-class SocketHandler;
-class RoutingSender;
-class CommandSender;
-class RoutingInterfaceBackdoor;
-class CommandInterfaceBackdoor;
-class ControlSender;
-class Router;
-class DatabaseObserver;
-class ControlReceiver;
-class RoutingReceiver;
-class CommonFunctions;
-
+#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"
namespace am
{
diff --git a/AudioManagerDaemon/test/database/CMakeLists.txt b/AudioManagerDaemon/test/database/CMakeLists.txt
index 4f8ac3a..18e2883 100644
--- a/AudioManagerDaemon/test/database/CMakeLists.txt
+++ b/AudioManagerDaemon/test/database/CMakeLists.txt
@@ -52,6 +52,9 @@ file(GLOB DATABASE_SRCS_CXX
"../../src/ControlSender.cpp"
"../../src/Router.cpp"
"../../src/DLTWrapper.cpp"
+ "../../src/SocketHandler.cpp"
+ "../../src/CommandReceiver.cpp"
+ "../../src/RoutingReceiver.cpp"
"../CommonFunctions.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/database/MockInterfaces.h b/AudioManagerDaemon/test/database/MockInterfaces.h
index b48c8e8..453add8 100644
--- a/AudioManagerDaemon/test/database/MockInterfaces.h
+++ b/AudioManagerDaemon/test/database/MockInterfaces.h
@@ -35,44 +35,49 @@ namespace am {
class MockCommandSendInterface : public CommandSendInterface {
public:
- MOCK_METHOD1(startupInterface,
- am_Error_e(CommandReceiveInterface* commandreceiveinterface));
- MOCK_METHOD0(stopInterface,
- am_Error_e());
- MOCK_METHOD0(cbCommunicationReady,
- am_Error_e());
- MOCK_METHOD0(cbCommunicationRundown,
- am_Error_e());
- MOCK_METHOD0(cbNumberOfMainConnectionsChanged,
- void());
- MOCK_METHOD0(cbNumberOfSinksChanged,
- void());
- MOCK_METHOD0(cbNumberOfSourcesChanged,
- void());
- 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_METHOD0(getInterfaceVersion,
- uint16_t());
+ 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));
+
};
@@ -80,84 +85,101 @@ class MockCommandSendInterface : public CommandSendInterface {
class MockControlSendInterface : public ControlSendInterface {
public:
- MOCK_METHOD1(startupController,
- am_Error_e(ControlReceiveInterface* controlreceiveinterface));
- MOCK_METHOD0(stopController,
- am_Error_e());
- MOCK_METHOD0(hookAllPluginsLoaded,
- 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(cbAckSetSourceSoundProperty,
- 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_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
diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp
index b31fd48..a43e436 100644
--- a/AudioManagerDaemon/test/database/databaseTest.cpp
+++ b/AudioManagerDaemon/test/database/databaseTest.cpp
@@ -24,14 +24,10 @@
*/
#include "databaseTest.h"
-#include "MockInterfaces.h"
-#include "DatabaseHandler.h"
-#include "ControlReceiver.h"
-#include "ControlSender.h"
-#include "DatabaseObserver.h"
-#include "../ControlInterfaceBackdoor.h"
-#include "../CommandInterfaceBackdoor.h"
-#include "../CommonFunctions.h"
+#include <algorithm>
+#include <string>
+#include <vector>
+#include <set>
#include "DLTWrapper.h"
using namespace am;
@@ -47,6 +43,7 @@ extern std::string int2string(int i);
databasetest::databasetest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
+ pSocketHandler(),//
pDatabaseHandler(std::string(":memory:")), //
pRoutingSender(plistRoutingPluginDirs), //
pCommandSender(plistCommandPluginDirs), //
@@ -55,8 +52,8 @@ databasetest::databasetest() :
pCommandInterfaceBackdoor(), //
pControlSender(""), //
pRouter(&pDatabaseHandler, &pControlSender), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
- pObserver(&pCommandSender, &pRoutingSender)
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pSocketHandler, &pRouter), //
+ pObserver(&pCommandSender,&pRoutingSender, &pSocketHandler)
{
pDatabaseHandler.registerObserver(&pObserver);
pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
@@ -75,8 +72,8 @@ void databasetest::createMainConnectionSetup()
std::vector<am_connectionID_t> connectionList;
//we create 9 sources and sinks:
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
+
+
for (uint16_t i = 1; i < 10; i++)
{
@@ -119,8 +116,8 @@ void databasetest::createMainConnectionSetup()
mainConnection.delay = -1;
//enter mainconnection in database
- EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
+
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID));
ASSERT_NE(0, mainConnectionID);
@@ -155,8 +152,8 @@ TEST_F(databasetest,getMainConnectionInfo)
std::vector<am_connectionID_t> connectionList;
//we create 9 sources and sinks:
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
+
+
for (uint16_t i = 1; i < 10; i++)
{
@@ -199,8 +196,8 @@ TEST_F(databasetest,getMainConnectionInfo)
mainConnection.delay = -1;
//enter mainconnection in database
- EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
+
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID));
ASSERT_NE(0, mainConnectionID);
@@ -232,7 +229,7 @@ TEST_F(databasetest,getSinKInfo)
pCF.createSink(staticSink);
staticSink.sinkID = 4;
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
<< "ERROR: database error";
ASSERT_EQ(staticSink.sinkID,staticSinkID)
@@ -294,7 +291,7 @@ TEST_F(databasetest,getSourceInfo)
staticSource.sourceID = 4;
staticSource.name = "Static";
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
<< "ERROR: database error";
ASSERT_EQ(staticSource.sourceID,staticSourceID)
@@ -351,7 +348,7 @@ TEST_F(databasetest,getSourceInfo)
TEST_F(databasetest, peekSourceID)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+
std::string sourceName("myClassID");
am_sourceClass_t sourceClassID, peekID;
am_SourceClass_s sourceClass;
@@ -375,7 +372,7 @@ TEST_F(databasetest, peekSourceID)
TEST_F(databasetest, peekSinkID)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+
std::string sinkName("myClassID");
am_sinkClass_t sinkClassID, peekID;
am_SinkClass_s sinkClass;
@@ -400,8 +397,8 @@ TEST_F(databasetest, peekSinkID)
TEST_F(databasetest,crossfaders)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
+
am_Crossfader_s crossfader;
am_crossfaderID_t crossfaderID;
am_Sink_s sinkA, sinkB;
@@ -440,8 +437,8 @@ TEST_F(databasetest,crossfaders)
TEST_F(databasetest,crossfadersGetFromDomain)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
+
am_Crossfader_s crossfader;
am_crossfaderID_t crossfaderID;
am_Sink_s sinkA, sinkB;
@@ -489,7 +486,7 @@ TEST_F(databasetest,sourceState)
source.sourceState = SS_OFF;
//prepare the test
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
//change the source state
@@ -509,7 +506,7 @@ TEST_F(databasetest,sinkVolumeChange)
sink.volume = 23;
//prepare the test
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
//change the volume and check the read out
@@ -527,7 +524,7 @@ TEST_F(databasetest,sourceVolumeChange)
source.volume = 23;
//prepare test
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
//change the volume and check the read out
@@ -544,7 +541,7 @@ TEST_F(databasetest, peekSource)
pCF.createSource(source);
//peek a source that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
+
ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
//make sure it is not in the list
@@ -554,7 +551,7 @@ TEST_F(databasetest, peekSource)
//now enter the source with the same name and make sure it does not get a new ID
source.name = "newsource";
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source2ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
ASSERT_EQ(sourceID, source2ID);
@@ -577,11 +574,11 @@ TEST_F(databasetest, peekSourceDouble)
pCF.createSource(source);
//peek a source that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
+
ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
//peek a second source that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
+
ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource2"),source2ID));
//make sure they are is not in the list
@@ -591,7 +588,7 @@ TEST_F(databasetest, peekSourceDouble)
source.name = "newsource";
//now enter the source with the same name than the first peek and make sure it does not get a new ID
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source3ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
ASSERT_EQ(sourceID, source3ID);
@@ -606,7 +603,7 @@ TEST_F(databasetest, peekSink)
pCF.createSink(sink);
//peek a sink that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
+
ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
//make sure it is not in the list
@@ -616,7 +613,7 @@ TEST_F(databasetest, peekSink)
sink.name = "newsink";
//now enter the source with the same name and make sure it does not get a new ID
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink2ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(sinkID, sink2ID);
@@ -639,11 +636,11 @@ TEST_F(databasetest, peekSinkDouble)
pCF.createSink(sink);
//peek a sink that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
+
ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
//peek again
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
+
ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("nextsink"),sink2ID));
//make sure they are is not in the list
@@ -653,7 +650,7 @@ TEST_F(databasetest, peekSinkDouble)
sink.name = "newsink";
//now enter the sink with the same name than the first peek and make sure it does not get a new ID
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink3ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(sinkID, sink3ID);
@@ -667,7 +664,6 @@ TEST_F(databasetest,changeConnectionTimingInformationCheckMainConnection)
//prepare the test, it is one mainconnection, so we expect one callback
createMainConnectionSetup();
- EXPECT_CALL(pMockInterface,cbTimingInformationChanged(1,216)).Times(1);
//first get all visible mainconnections and make sure, the delay is set to -1 for the first entry
ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(mainList));
@@ -725,11 +721,11 @@ TEST_F(databasetest,getSinkClassOfSink)
sink.sinkClassID = 4;
//prepare test
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
//enter a new sinkclass, read out again and check
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
@@ -761,9 +757,9 @@ TEST_F(databasetest,getSourceClassOfSource)
sourceClass.listClassProperties = classPropertyList;
pCF.createSource(source);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
@@ -792,7 +788,7 @@ TEST_F(databasetest,removeSourceClass)
sourceClass.sourceClassID = 3;
sourceClass.listClassProperties = classPropertyList;
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(2);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
@@ -822,7 +818,7 @@ TEST_F(databasetest,updateSourceClass)
changedClass = sourceClass;
changedClass.listClassProperties[1].value = 6;
changedPropertyList = changedClass.listClassProperties;
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
changedClass.sourceClassID = sourceClassID;
ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
@@ -853,7 +849,7 @@ TEST_F(databasetest,enterSourceClass)
sourceClass.sourceClassID = 0;
sourceClass.listClassProperties = classPropertyList;
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
@@ -878,7 +874,7 @@ TEST_F(databasetest,enterSourceClassStatic)
sourceClass.sourceClassID = 3;
sourceClass.listClassProperties = classPropertyList;
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
@@ -903,7 +899,7 @@ TEST_F(databasetest,removeSinkClass)
sinkClass.sinkClassID = 0;
sinkClass.listClassProperties = classPropertyList;
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(2);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
@@ -933,7 +929,7 @@ TEST_F(databasetest,updateSinkClass)
changedClass = sinkClass;
changedClass.listClassProperties[1].value = 6;
changedPropertyList = changedClass.listClassProperties;
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
changedClass.sinkClassID = sinkClassID;
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
@@ -964,7 +960,7 @@ TEST_F(databasetest,enterSinkClass)
sinkClass.sinkClassID = 0;
sinkClass.listClassProperties = classPropertyList;
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
@@ -989,7 +985,7 @@ TEST_F(databasetest,enterSinkClassStatic)
sinkClass.sinkClassID = 4;
sinkClass.listClassProperties = classPropertyList;
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
@@ -1005,7 +1001,6 @@ TEST_F(databasetest, changeSystemProperty)
systemProperty.type = SYP_UNKNOWN;
systemProperty.value = 33;
listSystemProperties.push_back(systemProperty);
- EXPECT_CALL(pMockInterface,cbSystemPropertyChanged(_)).Times(1); //todo: check the exact value here
ASSERT_EQ(E_OK, pDatabaseHandler.enterSystemProperties(listSystemProperties));
systemProperty.value = 444;
ASSERT_EQ(E_OK, pDatabaseHandler.changeSystemPropertyDB(systemProperty));
@@ -1040,7 +1035,7 @@ TEST_F(databasetest,enterSourcesCorrect)
staticSource.sourceID = 4;
staticSource.name = "Static";
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
<< "ERROR: database error";
ASSERT_EQ(staticSource.sourceID,staticSourceID)
@@ -1098,10 +1093,9 @@ TEST_F(databasetest, changeSourceMainSoundProperty)
am_MainSoundProperty_s property;
property.type = MSP_UNKNOWN;
property.value = 33;
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- EXPECT_CALL(pMockInterface,cbMainSourceSoundPropertyChanged(sourceID,_)).Times(1); //todo: check in detail
ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSourceSoundPropertyDB(property,sourceID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
std::vector<am_MainSoundProperty_s>::iterator listIterator = listSources[0].listMainSoundProperties.begin();
@@ -1121,10 +1115,9 @@ TEST_F(databasetest, changeSinkMuteState)
am_sinkID_t sinkID;
pCF.createSink(sink);
am_MuteState_e muteState = MS_MUTED;
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- EXPECT_CALL(pMockInterface,cbSinkMuteStateChanged(sinkID,muteState)).Times(1);
ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkMuteStateDB(muteState,sinkID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(muteState, listSinks[0].muteState);
@@ -1140,10 +1133,9 @@ TEST_F(databasetest, changeSinkMainSoundProperty)
property.type = MSP_UNKNOWN;
property.value = 33;
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- EXPECT_CALL(pMockInterface,cbMainSinkSoundPropertyChanged(sinkID,_)).Times(1);
ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSinkSoundPropertyDB(property,sinkID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
std::vector<am_MainSoundProperty_s>::iterator listIterator = listSinks[0].listMainSoundProperties.begin();
@@ -1206,7 +1198,7 @@ TEST_F(databasetest, changeMainConnectionState)
{
std::vector<am_MainConnection_s> listMainConnections;
createMainConnectionSetup();
- EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.changeMainConnectionStateDB(1,CS_DISCONNECTING));
ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(listMainConnections));
ASSERT_EQ(CS_DISCONNECTING, listMainConnections[0].connectionState);
@@ -1222,7 +1214,7 @@ TEST_F(databasetest, changeSinkAvailability)
availability.availability = A_UNKNOWN;
availability.availabilityReason = AR_GENIVI_TEMPERATURE;
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkAvailabilityDB(availability,sinkID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
@@ -1241,7 +1233,7 @@ TEST_F(databasetest, changeSourceAvailability)
availability.availabilityReason = AR_GENIVI_TEMPERATURE;
source.visible = true;
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceAvailabilityDB(availability,sourceID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
@@ -1260,8 +1252,8 @@ TEST_F(databasetest,changeMainConnectionRoute)
am_Sink_s sink;
std::vector<am_connectionID_t> listConnectionID;
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
+
+
for (uint16_t i = 1; i < 10; i++)
{
am_sinkID_t forgetSink;
@@ -1304,10 +1296,9 @@ TEST_F(databasetest,changeMainSinkVolume)
std::vector<am_Sink_s> listSinks;
pCF.createSink(sink);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- EXPECT_CALL(pMockInterface,cbVolumeChanged(sinkID,newVol)).Times(1);
ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkMainVolumeDB(newVol,sinkID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(listSinks[0].mainVolume, newVol);
@@ -1321,7 +1312,7 @@ TEST_F(databasetest,getMainSourceSoundProperties)
std::vector<am_MainSoundProperty_s> mainSoundProperties = source.listMainSoundProperties;
std::vector<am_MainSoundProperty_s> listMainSoundProperties;
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSourceSoundProperties(sourceID,listMainSoundProperties));
ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
@@ -1335,7 +1326,7 @@ TEST_F(databasetest,getMainSinkSoundProperties)
std::vector<am_MainSoundProperty_s> mainSoundProperties = sink.listMainSoundProperties;
std::vector<am_MainSoundProperty_s> listMainSoundProperties;
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinkSoundProperties(sinkID,listMainSoundProperties));
ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
@@ -1355,7 +1346,7 @@ TEST_F(databasetest,getMainSources)
std::vector<am_SourceType_s> listMainSources;
std::vector<am_Source_s> listSources;
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
source.sourceID = sourceID;
@@ -1387,7 +1378,7 @@ TEST_F(databasetest,getMainSinks)
std::vector<am_SinkType_s> listMainSinks;
std::vector<am_Sink_s> listSinks;
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
sink.sinkID = sinkID;
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink1,sinkID));
@@ -1436,7 +1427,7 @@ TEST_F(databasetest,getListSourcesOfDomain)
pCF.createDomain(domain);
sourceCheckList.push_back(1); //sink.sinkID);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))
<< "ERROR: database error";
@@ -1465,7 +1456,7 @@ TEST_F(databasetest,getListSinksOfDomain)
pCF.createDomain(domain);
sinkCheckList.push_back(1); //sink.sinkID);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))
<< "ERROR: database error";
@@ -1480,8 +1471,8 @@ TEST_F(databasetest,getListSinksOfDomain)
TEST_F(databasetest,getListGatewaysOfDomain)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
+
am_Gateway_s gateway, gateway2;
am_gatewayID_t gatewayID;
am_domainID_t domainID;
@@ -1544,8 +1535,8 @@ TEST_F(databasetest,removeDomain)
TEST_F(databasetest,removeGateway)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
+
am_Gateway_s gateway;
am_gatewayID_t gatewayID;
std::vector<am_Gateway_s> listGateways;
@@ -1575,7 +1566,7 @@ TEST_F(databasetest,removeSink)
am_sinkID_t sinkID;
std::vector<am_Sink_s> listSinks;
pCF.createSink(sink);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))
<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkDB(sinkID))
@@ -1593,7 +1584,7 @@ TEST_F(databasetest,removeSource)
std::vector<am_Source_s> listSources;
pCF.createSource(source);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))
<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceDB(sourceID))
@@ -1606,8 +1597,8 @@ TEST_F(databasetest,removeSource)
TEST_F(databasetest, removeMainConnection)
{
createMainConnectionSetup();
- EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
+
+
ASSERT_EQ(E_OK,pDatabaseHandler.removeMainConnectionDB(1))
<< "ERROR: database error";
}
@@ -1638,8 +1629,8 @@ TEST_F(databasetest,removeNonexistentGateway)
TEST_F(databasetest,registerGatewayCorrect)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
+
//initialize gateway
std::vector<am_Gateway_s> returnList;
am_Gateway_s gateway, gateway1, gateway2;
@@ -1702,8 +1693,8 @@ TEST_F(databasetest,registerGatewayCorrect)
TEST_F(databasetest,getGatewayInfo)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
+
//initialize gateway
std::vector<am_Gateway_s> returnList;
am_Gateway_s gateway, gateway1, gateway2;
@@ -1779,7 +1770,7 @@ TEST_F(databasetest,enterSinkThatAlreadyExistFail)
staticSink.sinkID = 43;
staticSink.name = "Static";
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
<< "ERROR: database error";
ASSERT_EQ(staticSink.sinkID,staticSinkID)
@@ -1801,7 +1792,7 @@ TEST_F(databasetest,enterSourcesThatAlreadyExistFail)
pCF.createSource(staticSource);
staticSource.sourceID = 4;
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
<< "ERROR: database error";
ASSERT_EQ(staticSource.sourceID,staticSourceID)
@@ -1883,7 +1874,7 @@ TEST_F(databasetest,enterSinksCorrect)
pCF.createSink(staticSink);
staticSink.sinkID = 4;
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
<< "ERROR: database error";
ASSERT_EQ(staticSink.sinkID,staticSinkID)
diff --git a/AudioManagerDaemon/test/database/databaseTest.h b/AudioManagerDaemon/test/database/databaseTest.h
index 6927b4f..4dba9c6 100644
--- a/AudioManagerDaemon/test/database/databaseTest.h
+++ b/AudioManagerDaemon/test/database/databaseTest.h
@@ -30,10 +30,7 @@
#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"
@@ -42,6 +39,7 @@
#include "RoutingSender.h"
#include "Router.h"
#include "ControlSender.h"
+#include "SocketHandler.h"
#include "../ControlInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
@@ -56,6 +54,7 @@ public:
~databasetest();
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
+ SocketHandler pSocketHandler;
DatabaseHandler pDatabaseHandler;
RoutingSender pRoutingSender;
CommandSender pCommandSender;
diff --git a/AudioManagerDaemon/test/routing/CMakeLists.txt b/AudioManagerDaemon/test/routing/CMakeLists.txt
index 8f45741..a7c70f9 100644
--- a/AudioManagerDaemon/test/routing/CMakeLists.txt
+++ b/AudioManagerDaemon/test/routing/CMakeLists.txt
@@ -52,6 +52,9 @@ file(GLOB ROUTING_SRCS_CXX
"../../src/ControlSender.cpp"
"../../src/Router.cpp"
"../../src/DLTWrapper.cpp"
+ "../../src/SocketHandler.cpp"
+ "../../src/CommandReceiver.cpp"
+ "../../src/RoutingReceiver.cpp"
"../CommonFunctions.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/routing/MockInterfaces.h b/AudioManagerDaemon/test/routing/MockInterfaces.h
index 207fadd..ea527ac 100644
--- a/AudioManagerDaemon/test/routing/MockInterfaces.h
+++ b/AudioManagerDaemon/test/routing/MockInterfaces.h
@@ -36,135 +36,149 @@ namespace am
class MockCommandSendInterface : public CommandSendInterface {
public:
- MOCK_METHOD1(startupInterface,
- am_Error_e(CommandReceiveInterface* commandreceiveinterface));
- MOCK_METHOD0(stopInterface,
- am_Error_e());
- MOCK_METHOD0(cbCommunicationReady,
- am_Error_e());
- MOCK_METHOD0(cbCommunicationRundown,
- am_Error_e());
- MOCK_METHOD0(cbNumberOfMainConnectionsChanged,
- void());
- MOCK_METHOD0(cbNumberOfSinksChanged,
- void());
- MOCK_METHOD0(cbNumberOfSourcesChanged,
- void());
- 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_METHOD0(getInterfaceVersion,
- uint16_t());
+ 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(stopController,
- am_Error_e());
- MOCK_METHOD0(hookAllPluginsLoaded,
- 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_METHOD0(getInterfaceVersion,
- uint16_t());
+ 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());
+
};
diff --git a/AudioManagerDaemon/test/routing/routingTest.cpp b/AudioManagerDaemon/test/routing/routingTest.cpp
index 5b073d2..aa3f333 100644
--- a/AudioManagerDaemon/test/routing/routingTest.cpp
+++ b/AudioManagerDaemon/test/routing/routingTest.cpp
@@ -42,6 +42,7 @@ using namespace testing;
routingTest::routingTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
+ pSocketHandler(), //
pDatabaseHandler(std::string(":memory:")), //
pControlSender(std::string("")), //
pRouter(&pDatabaseHandler, &pControlSender), //
@@ -52,8 +53,8 @@ routingTest::routingTest() :
pRoutingInterfaceBackdoor(), //
pCommandInterfaceBackdoor(), //
pControlInterfaceBackdoor(), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
- pObserver(&pCommandSender, &pRoutingSender)
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender,&pSocketHandler, &pRouter), //
+ pObserver(&pCommandSender, &pRoutingSender, &pSocketHandler)
{
pDatabaseHandler.registerObserver(&pObserver);
pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
@@ -80,8 +81,6 @@ arg4=arg3;
//test that checks just sinks and source in a domain but connectionformats do not match
TEST_F(routingTest,simpleRoute2withDomainNoMatchFormats)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -143,8 +142,6 @@ TEST_F(routingTest,simpleRoute2withDomainNoMatchFormats)
//test that checks just sinks and source in a domain
TEST_F(routingTest,simpleRoute2withDomain)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -207,8 +204,8 @@ TEST_F(routingTest,simpleRoute2withDomain)
//test that checks just 2 domains, one sink one source with only one connection format each
TEST_F(routingTest,simpleRoute2DomainsOnlyFree)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+
+
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -315,8 +312,8 @@ TEST_F(routingTest,simpleRoute2DomainsOnlyFree)
//test that checks just 2 domains, one sink one source with only one connection format each
TEST_F(routingTest,simpleRoute2DomainsOnlyFreeNotFree)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+
+
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -439,8 +436,7 @@ TEST_F(routingTest,simpleRoute2DomainsOnlyFreeNotFree)
//test that checks 3 domains, one sink one source, longer lists of connectionformats.
TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_2)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -600,8 +596,6 @@ TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_2)
//test that checks 3 domains, one sink one source, longer lists of connectionformats.
TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_1)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -757,8 +751,6 @@ TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_1)
//test that checks 3 domains, one sink one source, longer lists of connectionformats.
TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -908,8 +900,6 @@ 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)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(5);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(5);
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -1144,8 +1134,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)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -1289,8 +1278,8 @@ TEST_F(routingTest,simpleRoute3DomainsNoConnection)
//test that checks just 2 domains, one sink one source with only one connection format each
TEST_F(routingTest,simpleRoute2Domains)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+
+
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -1397,8 +1386,8 @@ TEST_F(routingTest,simpleRoute2Domains)
//test that checks just 2 domains, one sink one source but the connectionformat of source
TEST_F(routingTest,simpleRoute2DomainsNoMatchConnectionFormats)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+
+
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -1503,8 +1492,6 @@ TEST_F(routingTest,simpleRoute2DomainsNoMatchConnectionFormats)
//test that checks 3 domains, one sink one source.
TEST_F(routingTest,simpleRoute3Domains)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
@@ -1650,8 +1637,6 @@ TEST_F(routingTest,simpleRoute3Domains)
//test that checks 4 domains, one sink and one source.
TEST_F(routingTest,simpleRoute4Domains)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(4);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(4);
EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
diff --git a/AudioManagerDaemon/test/routing/routingTest.h b/AudioManagerDaemon/test/routing/routingTest.h
index 915c239..64ed8c5 100644
--- a/AudioManagerDaemon/test/routing/routingTest.h
+++ b/AudioManagerDaemon/test/routing/routingTest.h
@@ -41,6 +41,7 @@
#include "DatabaseObserver.h"
#include "RoutingSender.h"
#include "Router.h"
+#include "SocketHandler.h"
#include "../ControlInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
@@ -55,6 +56,7 @@ public:
~routingTest();
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
+ SocketHandler pSocketHandler;
DatabaseHandler pDatabaseHandler;
ControlSender pControlSender;
Router pRouter;
diff --git a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
index 5b5da3c..fbb4ac1 100644
--- a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
@@ -54,6 +54,9 @@ file(GLOB ROUTING_INTERFACE_SRCS_CXX
"../../src/ControlSender.cpp"
"../CommonFunctions.cpp"
"../../src/DLTWrapper.cpp"
+ "../../src/SocketHandler.cpp"
+ "../../src/RoutingReceiver.cpp"
+ "../../src/CommandReceiver.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h b/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h
index 6c93507..2c21fe6 100644
--- a/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h
+++ b/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h
@@ -34,12 +34,12 @@ namespace am {
class MockRoutingSendInterface : public RoutingSendInterface {
public:
- MOCK_METHOD1(startupRoutingInterface,
- void(RoutingReceiveInterface* routingreceiveinterface));
- MOCK_METHOD0(routingInterfacesReady,
- void());
- MOCK_METHOD0(routingInterfacesRundown,
- void());
+ 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,
@@ -66,9 +66,10 @@ class MockRoutingSendInterface : public RoutingSendInterface {
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_METHOD0(getInterfaceVersion,
- uint16_t());
+ MOCK_CONST_METHOD1(getInterfaceVersion,
+ void(std::string& version));
};
+
} // namespace am
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
index 33aa7f6..a827ebe 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
@@ -32,6 +32,7 @@ using namespace testing;
routingInterfaceTest::routingInterfaceTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
+ pSocketHandler(), //
pDatabaseHandler(std::string(":memory:")), //
pRoutingSender(plistRoutingPluginDirs), //
pCommandSender(plistCommandPluginDirs), //
@@ -40,8 +41,8 @@ routingInterfaceTest::routingInterfaceTest() :
pMockInterface(), //
pRoutingInterfaceBackdoor(), //
pCommandInterfaceBackdoor(), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
- pObserver(&pCommandSender, &pRoutingSender)
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pSocketHandler, &pRouter), //
+ pObserver(&pCommandSender, &pRoutingSender, &pSocketHandler)
{
pDatabaseHandler.registerObserver(&pObserver);
pRoutingInterfaceBackdoor.unloadPlugins(&pRoutingSender);
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
index 0608eb4..f102221 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
@@ -37,6 +37,7 @@
#include "ControlReceiver.h"
#include "ControlSender.h"
#include "DatabaseObserver.h"
+#include "SocketHandler.h"
#include "Router.h"
#include "../RoutingInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
@@ -52,6 +53,7 @@ public:
~routingInterfaceTest();
std::vector<std::string> plistRoutingPluginDirs;
std::vector<std::string> plistCommandPluginDirs;
+ SocketHandler pSocketHandler;
DatabaseHandler pDatabaseHandler;
RoutingSender pRoutingSender;
CommandSender pCommandSender;
diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h
index d2d1bc6..abb8ace 100644
--- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h
+++ b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h
@@ -41,7 +41,7 @@ public:
UNIX, INET
};
SamplePlugin(SocketHandler *mySocketHandler, sockType_e socketType);
- virtual ~SamplePlugin()
+ ~SamplePlugin()
{
}
;
@@ -79,7 +79,7 @@ class sockethandlerTest: public ::testing::Test
{
public:
sockethandlerTest();
- virtual ~sockethandlerTest();
+ ~sockethandlerTest();
void SetUp();
void TearDown();
};
diff --git a/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.cpp b/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.cpp
index d3d621e..d727fff 100644
--- a/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.cpp
+++ b/AudioManagerDaemon/test/telnetserver/CAmTelnetServerTest.cpp
@@ -88,11 +88,11 @@ void MyEnvironment::setSocketHandler(SocketHandler* pSocketHandler)
//startup all the Plugins and Interfaces
mControlSender.startupController(mpControlReceiver);
- mCommandSender.startupInterface(mpCommandReceiver);
- mRoutingSender.startupRoutingInterface(mpRoutingReceiver);
+ mCommandSender.startupInterfaces(mpCommandReceiver);
+ mRoutingSender.startupInterfaces(mpRoutingReceiver);
//when the routingInterface is done, all plugins are loaded:
- mControlSender.hookAllPluginsLoaded();
+ mControlSender.setControllerReady();
// Starting TelnetServer
mpTelnetServer = new TelnetServer(mpSocketHandler,&mCommandSender,mpCommandReceiver,&mRoutingSender,mpRoutingReceiver,&mControlSender,mpControlReceiver,&mDatabasehandler,&mRouter,servPort,3);
diff --git a/PluginCommandInterfaceDbus/CMakeLists.txt b/PluginCommandInterfaceDbus/CMakeLists.txt
index 10d696c..7c4c776 100644
--- a/PluginCommandInterfaceDbus/CMakeLists.txt
+++ b/PluginCommandInterfaceDbus/CMakeLists.txt
@@ -38,7 +38,7 @@ TARGET_LINK_LIBRARIES(PluginCommandInterfaceDbus
)
IF(WITH_TESTS)
- add_subdirectory (test)
+# add_subdirectory (test)
ENDIF(WITH_TESTS)
#IF(WITH_DOCUMENTATION)
diff --git a/PluginCommandInterfaceDbus/test/CMakeLists.txt b/PluginCommandInterfaceDbus/test/CMakeLists.txt
index 0c33420..8745af8 100644
--- a/PluginCommandInterfaceDbus/test/CMakeLists.txt
+++ b/PluginCommandInterfaceDbus/test/CMakeLists.txt
@@ -69,6 +69,8 @@ file(GLOB DBUS_SIGNAL_INTERFACE_SRCS_CXX
"../../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"
diff --git a/PluginCommandInterfaceDbus/test/MockInterfaces.h b/PluginCommandInterfaceDbus/test/MockInterfaces.h
index 509ee5c..b4e7792 100644
--- a/PluginCommandInterfaceDbus/test/MockInterfaces.h
+++ b/PluginCommandInterfaceDbus/test/MockInterfaces.h
@@ -30,46 +30,52 @@ 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_METHOD0(getInterfaceVersion,
- uint16_t());
+ 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
diff --git a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp b/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp
index c190135..f4dab30 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp
+++ b/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.cpp
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file dbuscommandpluginInterfaceTest.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
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file dbuscommandpluginInterfaceTest.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 <python2.6/Python.h>
#include <dbus/DBusWrapper.h>
@@ -33,6 +33,7 @@
#include "DbusCommandInterfaceBackdoor.h"
#include "MockInterfaces.h"
#include "DLTWrapper.h"
+#include "SocketHandler.h"
using namespace am;
using namespace testing;
@@ -43,14 +44,16 @@ std::string DBUSCOMMAND = "dbus-send --session --print-reply --dest=org.genivi.a
void* run_the_loop(void* wrapper)
{
- DBusWrapper* wrap=(DBusWrapper*)wrapper;
- wrap->dbusMainLoop();
- return (NULL);
+ SocketHandler* wrap = (SocketHandler*) wrapper;
+ wrap->start_listenting();
+ return (NULL);
}
-dbuscommandpluginInterfaceTest::dbuscommandpluginInterfaceTest()
+dbuscommandpluginInterfaceTest::dbuscommandpluginInterfaceTest() :
+ pDatabaseHandler(std::string(":memory:")), //
+ pControlSender("") //
{
- DLTWrapper::instance()->registerApp("dbusTest","dbusTest");
+ DLTWrapper::instance()->registerApp("dbusTest", "dbusTest");
}
dbuscommandpluginInterfaceTest::~dbuscommandpluginInterfaceTest()
@@ -63,575 +66,543 @@ void dbuscommandpluginInterfaceTest::SetUp()
}
-
-
void dbuscommandpluginInterfaceTest::TearDown()
{
}
-ACTION(returnListConnections)
-{
- std::vector<am::am_MainConnectionType_s> list;
- am::am_MainConnectionType_s listItem;
- listItem.mainConnectionID=15;
- listItem.sinkID=4;
- listItem.sourceID=3;
- listItem.connectionState=CS_UNKNOWN;
- listItem.delay=34;
- list.push_back(listItem);
- arg0=list;
+ACTION(returnListConnections){
+std::vector<am::am_MainConnectionType_s> list;
+am::am_MainConnectionType_s listItem;
+listItem.mainConnectionID=15;
+listItem.sinkID=4;
+listItem.sourceID=3;
+listItem.connectionState=CS_UNKNOWN;
+listItem.delay=34;
+list.push_back(listItem);
+arg0=list;
}
-ACTION(returnListSinks)
-{
- std::vector<am::am_SinkType_s> list;
- am::am_SinkType_s listItem;
- listItem.availability.availability=A_UNAVAILABLE;
- listItem.availability.availabilityReason=AR_GENIVI_NOMEDIA;
- listItem.muteState=MS_UNMUTED;
- listItem.name="mySink";
- listItem.sinkClassID=34;
- listItem.sinkID=24;
- listItem.volume=124;
- list.push_back(listItem);
- arg0=list;
+ACTION(returnListSinks){
+std::vector<am::am_SinkType_s> list;
+am::am_SinkType_s listItem;
+listItem.availability.availability=A_UNAVAILABLE;
+listItem.availability.availabilityReason=AR_GENIVI_NOMEDIA;
+listItem.muteState=MS_UNMUTED;
+listItem.name="mySink";
+listItem.sinkClassID=34;
+listItem.sinkID=24;
+listItem.volume=124;
+list.push_back(listItem);
+arg0=list;
}
-ACTION(returnListSources)
-{
- std::vector<am::am_SourceType_s> list;
- am::am_SourceType_s listItem;
- listItem.availability.availability=A_MAX;
- listItem.availability.availabilityReason=AR_GENIVI_SAMEMEDIA;
- listItem.name="MySource";
- listItem.sourceClassID=12;
- listItem.sourceID=224;
- list.push_back(listItem);
- listItem.name="NextSource";
- listItem.sourceID=22;
- list.push_back(listItem);
- arg0=list;
+ACTION(returnListSources){
+std::vector<am::am_SourceType_s> list;
+am::am_SourceType_s listItem;
+listItem.availability.availability=A_MAX;
+listItem.availability.availabilityReason=AR_GENIVI_SAMEMEDIA;
+listItem.name="MySource";
+listItem.sourceClassID=12;
+listItem.sourceID=224;
+list.push_back(listItem);
+listItem.name="NextSource";
+listItem.sourceID=22;
+list.push_back(listItem);
+arg0=list;
}
-ACTION(returnListMainSinkSoundProperties)
-{
- std::vector<am::am_MainSoundProperty_s> list;
- am::am_MainSoundProperty_s listItem;
- listItem.type=MSP_MAX;
- listItem.value=223;
- list.push_back(listItem);
- listItem.type=MSP_UNKNOWN;
- listItem.value=2;
- list.push_back(listItem);
- arg1=list;
+ACTION(returnListMainSinkSoundProperties){
+std::vector<am::am_MainSoundProperty_s> list;
+am::am_MainSoundProperty_s listItem;
+listItem.type=MSP_MAX;
+listItem.value=223;
+list.push_back(listItem);
+listItem.type=MSP_UNKNOWN;
+listItem.value=2;
+list.push_back(listItem);
+arg1=list;
}
-ACTION(returnListSourceClasses)
-{
- std::vector<am::am_SourceClass_s> list;
- am::am_SourceClass_s listItem;
- am::am_ClassProperty_s property;
- property.classProperty=CP_GENIVI_SINK_TYPE;
- property.value=12;
- listItem.name="FirstCLass";
- listItem.sourceClassID=23;
- listItem.listClassProperties.push_back(property);
- list.push_back(listItem);
- listItem.name="SecondCLass";
- listItem.sourceClassID=2;
- listItem.listClassProperties.push_back(property);
- list.push_back(listItem);
- arg0=list;
+ACTION(returnListSourceClasses){
+std::vector<am::am_SourceClass_s> list;
+am::am_SourceClass_s listItem;
+am::am_ClassProperty_s property;
+property.classProperty=CP_GENIVI_SINK_TYPE;
+property.value=12;
+listItem.name="FirstCLass";
+listItem.sourceClassID=23;
+listItem.listClassProperties.push_back(property);
+list.push_back(listItem);
+listItem.name="SecondCLass";
+listItem.sourceClassID=2;
+listItem.listClassProperties.push_back(property);
+list.push_back(listItem);
+arg0=list;
}
-ACTION(returnListSinkClasses)
-{
- std::vector<am::am_SinkClass_s> list;
- am::am_SinkClass_s listItem;
- am::am_ClassProperty_s property;
- property.classProperty=CP_GENIVI_SOURCE_TYPE;
- property.value=122;
- listItem.name="FirstCLass";
- listItem.sinkClassID=2123;
- listItem.listClassProperties.push_back(property);
- list.push_back(listItem);
- listItem.name="SecondCLass";
- listItem.sinkClassID=23;
- listItem.listClassProperties.push_back(property);
- list.push_back(listItem);
- arg0=list;
+ACTION(returnListSinkClasses){
+std::vector<am::am_SinkClass_s> list;
+am::am_SinkClass_s listItem;
+am::am_ClassProperty_s property;
+property.classProperty=CP_GENIVI_SOURCE_TYPE;
+property.value=122;
+listItem.name="FirstCLass";
+listItem.sinkClassID=2123;
+listItem.listClassProperties.push_back(property);
+list.push_back(listItem);
+listItem.name="SecondCLass";
+listItem.sinkClassID=23;
+listItem.listClassProperties.push_back(property);
+list.push_back(listItem);
+arg0=list;
}
-ACTION(returnListSystemProperties)
-{
- std::vector<am::am_SystemProperty_s> list;
- am::am_SystemProperty_s listItem;
- listItem.type=SYP_UNKNOWN;
- listItem.value=-2245;
- list.push_back(listItem);
- arg0=list;
+ACTION(returnListSystemProperties){
+std::vector<am::am_SystemProperty_s> list;
+am::am_SystemProperty_s listItem;
+listItem.type=SYP_UNKNOWN;
+listItem.value=-2245;
+list.push_back(listItem);
+arg0=list;
}
-ACTION(returnTimingInfo)
-{
- am::am_timeSync_t time=23;
- arg1=time;
+ACTION(returnTimingInfo){
+am::am_timeSync_t time=23;
+arg1=time;
}
-
TEST_F(dbuscommandpluginInterfaceTest,Connect)
{
- Py_Initialize();
- //unfortunatly we need to put all in one testcase because testing with the dbus loop caused problems...
- DBusWrapper pDBusWrapper;
- pthread_t ptestThread;
- std::vector<std::string> plistCommandPluginDirs;
- plistCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
+ Py_Initialize();
+ //unfortunatly we need to put all in one testcase because testing with the dbus loop caused problems...
+ SocketHandler pSocketHandler;
+ DBusWrapper pDBusWrapper(&pSocketHandler);
+ pthread_t ptestThread;
+ std::vector<std::string> plistCommandPluginDirs;
+ plistCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
- CommandSender pCommandSender(plistCommandPluginDirs);
- MockCommandReceiveInterface pReceiveInterface;
+ CommandSender pCommandSender(plistCommandPluginDirs);
+ MockCommandReceiveInterface pReceiveInterface;
- //this class just creates the thread that will handle the mainloop...
- pthread_create(&ptestThread,NULL,run_the_loop,(void*)&pDBusWrapper);
+ //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);
// 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.startupInterface(&pReceiveInterface);
-
- EXPECT_CALL(pReceiveInterface,connect(2,3,_)).WillRepeatedly(DoAll(SetArgReferee<2>(35),Return(E_OK)));
- system((DBUSCOMMAND + std::string("Connect uint16:2 uint16:3 > /tmp/result.txt ")).c_str());
-
- //check the results
- std::ifstream ifs("/tmp/result.txt");
- std::string line;
- int lineCounter=0, result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==1)
- {
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
- ASSERT_EQ(result,E_OK);
- }
- else if (lineCounter==2)
- {
- std::stringstream(line.substr(line.find_first_not_of(" uint16 "))) >> result;
- ASSERT_EQ(result,35);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout<<"[connect ]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,disconnect(2)).WillOnce(Return(E_OK));
- system((DBUSCOMMAND + std::string("Disconnect uint16:2 > /tmp/result.txt ")).c_str());
-
- //check the results
- lineCounter=0;
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- if(lineCounter==1)
- {
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
- ASSERT_EQ(result,E_OK);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout<<"[disconnect]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,setVolume(22,12)).WillOnce(Return(E_OK));
- system((DBUSCOMMAND + std::string("SetVolume uint16:22 int16:12 > /tmp/result.txt ")).c_str());
-
- //check the results
- lineCounter=0;
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- if(lineCounter==1)
- {
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
- ASSERT_EQ(result,E_OK);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout<<"[setVolume ]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,volumeStep(2,1)).WillOnce(Return(E_OK));
- system((DBUSCOMMAND + std::string("VolumeStep uint16:2 int16:1 > /tmp/result.txt ")).c_str());
-
- //check the results
- lineCounter=0;
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- if(lineCounter==1)
- {
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
- ASSERT_EQ(result,E_OK);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout<<"[volumeStep]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,setSinkMuteState(1,MS_UNKNOWN)).WillOnce(Return(E_OK));
- system((DBUSCOMMAND + std::string("SetSinkMuteState uint16:1 int16:0 > /tmp/result.txt ")).c_str());
-
- //check the results
- lineCounter=0;
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- if(lineCounter==1)
- {
- std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
- ASSERT_EQ(result,E_OK);
- }
- lineCounter++;
- }
- ifs.close();
-
- std::cout<<"[sinkmutest]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,setMainSinkSoundProperty(AllOf(Field(&am_MainSoundProperty_s::value, 3), \
- Field(&am_MainSoundProperty_s::type,MSP_UNKNOWN)),1)).WillOnce(Return(E_ABORTED));
-
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='SetMainSinkSoundProperty',\n"
- "signature='q(nn)',\n"
- "args=[1,(0,3)],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- }
- ASSERT_EQ(result,E_ABORTED);
- ifs.close();
-
- std::cout<<"[sinksound ]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,setMainSourceSoundProperty(AllOf(Field(&am_MainSoundProperty_s::value, 3), \
- Field(&am_MainSoundProperty_s::type,MSP_UNKNOWN)),1)).WillOnce(Return(E_ABORTED));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='SetMainSourceSoundProperty',\n"
- "signature='q(nn)',\n"
- "args=[1,(0,3)],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- }
- ASSERT_EQ(result,E_ABORTED);
- ifs.close();
-
- std::cout<<"[sourcesnd ]"<<std::endl;
-
-
- EXPECT_CALL(pReceiveInterface,setSystemProperty(Field(&am_SystemProperty_s::value,2))).WillOnce(Return(E_DATABASE_ERROR));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='SetSystemProperty',\n"
- "signature='(nn)',\n"
- "args=[(2,2)],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
-
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- }
- ASSERT_EQ(result,E_DATABASE_ERROR);
- ifs.close();
-
- std::cout<<"[systemprop]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainConnections(_)).WillOnce(DoAll(returnListConnections(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetListMainConnections',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(15), dbus.UInt16(3), dbus.UInt16(4), dbus.Int16(34), dbus.Int16(0)), signature=None)], signature=dbus.Signature('(qqqnn)')))"),0);
- }
- ifs.close();
-
- std::cout<<"[listmainc ]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainSinks(_)).WillOnce(DoAll(returnListSinks(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetListMainSinks',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(24), dbus.String(u'mySink'), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None), dbus.Int16(124), dbus.Int16(1), dbus.UInt16(34)), signature=None)], signature=dbus.Signature('(qs(nn)nnq)')))"),0);
- }
- ifs.close();
-
- std::cout<<"[listsinks ]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainSources(_)).WillOnce(DoAll(returnListSources(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetListMainSources',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(224), dbus.String(u'MySource'), dbus.Struct((dbus.Int16(3), dbus.Int16(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);
- }
- ifs.close();
-
- std::cout<<"[listsource]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainSinkSoundProperties(1,_)).WillOnce(DoAll(returnListMainSinkSoundProperties(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetListMainSinkSoundProperties',\n"
- "signature='q',\n"
- "args=[1],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(2), dbus.Int16(223)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None)], signature=dbus.Signature('(nn)')))"),0);
- }
- ifs.close();
-
- std::cout<<"[lMainSiPro]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListMainSourceSoundProperties(1,_)).WillOnce(DoAll(returnListMainSinkSoundProperties(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetListMainSourceSoundProperties',\n"
- "signature='q',\n"
- "args=[1],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(2), dbus.Int16(223)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None)], signature=dbus.Signature('(nn)')))"),0);
- }
- ifs.close();
-
- std::cout<<"[lMainSoPro]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListSourceClasses(_)).WillOnce(DoAll(returnListSourceClasses(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetListSourceClasses',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(23), dbus.String(u'FirstCLass'), dbus.Array([dbus.Struct((dbus.Int16(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);
- }
- ifs.close();
-
- std::cout<<"[lSourceCla]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListSinkClasses(_)).WillOnce(DoAll(returnListSinkClasses(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetListSinkClasses',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(2123), dbus.String(u'FirstCLass'), dbus.Array([dbus.Struct((dbus.Int16(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);
- }
- ifs.close();
-
- std::cout<<"[lSinkClass]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getListSystemProperties(_)).WillOnce(DoAll(returnListSystemProperties(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetListSystemProperties',\n"
- "signature='',\n"
- "args=[],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(0), dbus.Int16(-2245)), signature=None)], signature=dbus.Signature('(nn)')))"),0);
- }
- ifs.close();
-
- std::cout<<"[lSysProp ]"<<std::endl;
-
- EXPECT_CALL(pReceiveInterface,getTimingInformation(2,_)).WillOnce(DoAll(returnTimingInfo(),Return(E_ABORTED)));
-
- PyRun_SimpleStringFlags("import dbus\n"
- "f = open('/tmp/result.txt','w')\n"
- "bus = dbus.SessionBus()\n"
- "retVal=dbus.Bus().call_blocking(\n"
- "bus_name='org.genivi.audiomanager',\n"
- "object_path='/org/genivi/audiomanager/CommandInterface',\n"
- "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
- "method='GetTimingInformation',\n"
- "signature='q',\n"
- "args=[2],) \n"
- "f.write(str(retVal));\n"
- "f.close()",NULL);
- result=0;
- ifs.open("/tmp/result.txt");
- while(std::getline(ifs, line))
- {
- //we could parse here, but this is the fastest way....
- ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Int16(23))"),0);
- }
- ifs.close();
-
- std::cout<<"[timingInfo]"<<std::endl;
- Py_Finalize();
+ EXPECT_CALL(pReceiveInterface,getDBusConnectionWrapper(_)).WillRepeatedly(DoAll(SetArgReferee<0>(&pDBusWrapper), Return(E_OK)));
+ pCommandSender.startupInterfaces(&pCommandReceiver);
+
+ EXPECT_CALL(pReceiveInterface,connect(2,3,_)).WillRepeatedly(DoAll(SetArgReferee<2>(35), Return(E_OK)));
+ system((DBUSCOMMAND + std::string("Connect uint16:2 uint16:3 > /tmp/result.txt ")).c_str());
+
+ //check the results
+ std::ifstream ifs("/tmp/result.txt");
+ std::string line;
+ int lineCounter = 0, result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 1)
+ {
+ std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ ASSERT_EQ(result, E_OK);
+ }
+ else if (lineCounter == 2)
+ {
+ std::stringstream(line.substr(line.find_first_not_of(" uint16 "))) >> result;
+ ASSERT_EQ(result, 35);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ std::cout << "[connect ]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,disconnect(2)).WillOnce(Return(E_OK));
+ system((DBUSCOMMAND + std::string("Disconnect uint16:2 > /tmp/result.txt ")).c_str());
+
+ //check the results
+ lineCounter = 0;
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 1)
+ {
+ std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ ASSERT_EQ(result, E_OK);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ std::cout << "[disconnect]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,setVolume(22,12)).WillOnce(Return(E_OK));
+ system((DBUSCOMMAND + std::string("SetVolume uint16:22 int16:12 > /tmp/result.txt ")).c_str());
+
+ //check the results
+ lineCounter = 0;
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 1)
+ {
+ std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ ASSERT_EQ(result, E_OK);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ std::cout << "[setVolume ]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,volumeStep(2,1)).WillOnce(Return(E_OK));
+ system((DBUSCOMMAND + std::string("VolumeStep uint16:2 int16:1 > /tmp/result.txt ")).c_str());
+
+ //check the results
+ lineCounter = 0;
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 1)
+ {
+ std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ ASSERT_EQ(result, E_OK);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ std::cout << "[volumeStep]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,setSinkMuteState(1,MS_UNKNOWN)).WillOnce(Return(E_OK));
+ system((DBUSCOMMAND + std::string("SetSinkMuteState uint16:1 int16:0 > /tmp/result.txt ")).c_str());
+
+ //check the results
+ lineCounter = 0;
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 1)
+ {
+ std::stringstream(line.substr(line.find_first_not_of(" int16 "))) >> result;
+ ASSERT_EQ(result, E_OK);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ std::cout << "[sinkmutest]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,setMainSinkSoundProperty(AllOf(Field(&am_MainSoundProperty_s::value, 3),
+ Field(&am_MainSoundProperty_s::type,MSP_UNKNOWN)),1)).WillOnce(Return(E_ABORTED));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='SetMainSinkSoundProperty',\n"
+ "signature='q(nn)',\n"
+ "args=[1,(0,3)],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ std::stringstream(line) >> result;
+ }ASSERT_EQ(result, E_ABORTED);
+ ifs.close();
+
+ std::cout << "[sinksound ]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,setMainSourceSoundProperty(AllOf(Field(&am_MainSoundProperty_s::value, 3),
+ Field(&am_MainSoundProperty_s::type,MSP_UNKNOWN)),1)).WillOnce(Return(E_ABORTED));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='SetMainSourceSoundProperty',\n"
+ "signature='q(nn)',\n"
+ "args=[1,(0,3)],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ std::stringstream(line) >> result;
+ }ASSERT_EQ(result, E_ABORTED);
+ ifs.close();
+
+ std::cout << "[sourcesnd ]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,setSystemProperty(Field(&am_SystemProperty_s::value,2))).WillOnce(Return(E_DATABASE_ERROR));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='SetSystemProperty',\n"
+ "signature='(nn)',\n"
+ "args=[(2,2)],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ std::stringstream(line) >> result;
+ }ASSERT_EQ(result, E_DATABASE_ERROR);
+ ifs.close();
+
+ std::cout << "[systemprop]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getListMainConnections(_)).WillOnce(DoAll(returnListConnections(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetListMainConnections',\n"
+ "signature='',\n"
+ "args=[],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(15), dbus.UInt16(3), dbus.UInt16(4), dbus.Int16(34), dbus.Int16(0)), signature=None)], signature=dbus.Signature('(qqqnn)')))"), 0);
+ }
+ ifs.close();
+
+ std::cout << "[listmainc ]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getListMainSinks(_)).WillOnce(DoAll(returnListSinks(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetListMainSinks',\n"
+ "signature='',\n"
+ "args=[],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(24), dbus.String(u'mySink'), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None), dbus.Int16(124), dbus.Int16(1), dbus.UInt16(34)), signature=None)], signature=dbus.Signature('(qs(nn)nnq)')))"), 0);
+ }
+ ifs.close();
+
+ std::cout << "[listsinks ]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getListMainSources(_)).WillOnce(DoAll(returnListSources(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetListMainSources',\n"
+ "signature='',\n"
+ "args=[],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(224), dbus.String(u'MySource'), dbus.Struct((dbus.Int16(3), dbus.Int16(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);
+ }
+ ifs.close();
+
+ std::cout << "[listsource]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getListMainSinkSoundProperties(1,_)).WillOnce(DoAll(returnListMainSinkSoundProperties(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetListMainSinkSoundProperties',\n"
+ "signature='q',\n"
+ "args=[1],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(2), dbus.Int16(223)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None)], signature=dbus.Signature('(nn)')))"), 0);
+ }
+ ifs.close();
+
+ std::cout << "[lMainSiPro]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getListMainSourceSoundProperties(1,_)).WillOnce(DoAll(returnListMainSinkSoundProperties(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetListMainSourceSoundProperties',\n"
+ "signature='q',\n"
+ "args=[1],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(2), dbus.Int16(223)), signature=None), dbus.Struct((dbus.Int16(0), dbus.Int16(2)), signature=None)], signature=dbus.Signature('(nn)')))"), 0);
+ }
+ ifs.close();
+
+ std::cout << "[lMainSoPro]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getListSourceClasses(_)).WillOnce(DoAll(returnListSourceClasses(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetListSourceClasses',\n"
+ "signature='',\n"
+ "args=[],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(23), dbus.String(u'FirstCLass'), dbus.Array([dbus.Struct((dbus.Int16(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);
+ }
+ ifs.close();
+
+ std::cout << "[lSourceCla]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getListSinkClasses(_)).WillOnce(DoAll(returnListSinkClasses(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetListSinkClasses',\n"
+ "signature='',\n"
+ "args=[],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.UInt16(2123), dbus.String(u'FirstCLass'), dbus.Array([dbus.Struct((dbus.Int16(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);
+ }
+ ifs.close();
+
+ std::cout << "[lSinkClass]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getListSystemProperties(_)).WillOnce(DoAll(returnListSystemProperties(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetListSystemProperties',\n"
+ "signature='',\n"
+ "args=[],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Array([dbus.Struct((dbus.Int16(0), dbus.Int16(-2245)), signature=None)], signature=dbus.Signature('(nn)')))"), 0);
+ }
+ ifs.close();
+
+ std::cout << "[lSysProp ]" << std::endl;
+
+ EXPECT_CALL(pReceiveInterface,getTimingInformation(2,_)).WillOnce(DoAll(returnTimingInfo(), Return(E_ABORTED)));
+
+ PyRun_SimpleStringFlags("import dbus\n"
+ "f = open('/tmp/result.txt','w')\n"
+ "bus = dbus.SessionBus()\n"
+ "retVal=dbus.Bus().call_blocking(\n"
+ "bus_name='org.genivi.audiomanager',\n"
+ "object_path='/org/genivi/audiomanager/CommandInterface',\n"
+ "dbus_interface='org.genivi.audiomanager.CommandInterface',\n"
+ "method='GetTimingInformation',\n"
+ "signature='q',\n"
+ "args=[2],) \n"
+ "f.write(str(retVal));\n"
+ "f.close()", NULL);
+ result = 0;
+ ifs.open("/tmp/result.txt");
+ while (std::getline(ifs, line))
+ {
+ //we could parse here, but this is the fastest way....
+ ASSERT_EQ(line.compare("(dbus.Int16(9), dbus.Int16(23))"), 0);
+ }
+ ifs.close();
+
+ std::cout << "[timingInfo]" << std::endl;
+ Py_Finalize();
}
-
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.h b/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.h
index ae2d14b..d45a107 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.h
+++ b/PluginCommandInterfaceDbus/test/dbuscommandpluginInterfaceTest.h
@@ -37,6 +37,8 @@
#include "CommandSender.h"
#include "MockInterfaces.h"
#include "DbusCommandInterfaceBackdoor.h"
+#include "DatabaseHandler.h"
+#include "ControlSender.h"
#define UNIT_TEST 1
@@ -56,6 +58,8 @@ class DbusCommandInterfaceBackdoor;
class dbuscommandpluginInterfaceTest :public ::testing::Test
{
public:
+ DatabaseHandler pDatabaseHandler;
+ ControlSender pControlSender;
dbuscommandpluginInterfaceTest();
~dbuscommandpluginInterfaceTest();
diff --git a/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp b/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp
index 2b60d7c..655a1f3 100644
--- a/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp
+++ b/PluginCommandInterfaceDbus/test/dbuscommaninterfacesignalsTest.cpp
@@ -84,7 +84,7 @@ void* cbSinkAdded(void*)
dbus_error_init(&error);
DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
backdoor.setDbusConnection(&sender, co);
- sender.cbNumberOfSinksChanged();
+ sender.cbNewSink(mysink);
return (NULL);
}
diff --git a/PluginControlInterface/src/ControlSender.cpp b/PluginControlInterface/src/ControlSender.cpp
index 052d1ff..567f8c6 100644
--- a/PluginControlInterface/src/ControlSender.cpp
+++ b/PluginControlInterface/src/ControlSender.cpp
@@ -27,6 +27,7 @@
#include "control/ControlReceiveInterface.h"
#include <cassert>
#include <algorithm>
+#include "DLTWrapper.h"
using namespace am;
@@ -456,21 +457,21 @@ void ControlSenderPlugin::getInterfaceVersion(std::string & version) const
void ControlSenderPlugin::confirmCommandReady()
{
- //todo:implement
+ logInfo("ControlSenderPlugin got Routing Ready confirmed");
}
void ControlSenderPlugin::confirmRoutingReady()
{
- //todo:implement
+ logInfo("ControlSenderPlugin got Command Ready confirmed");
}
void ControlSenderPlugin::confirmCommandRundown()
{
- //todo:implement
+ logInfo("ControlSenderPlugin got Routing Rundown confirmed");
}
void ControlSenderPlugin::confirmRoutingRundown()
{
- //todo:implement
+ logInfo("ControlSenderPlugin got Command Rundown confirmed");
}
diff --git a/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h b/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h
index ea6da5f..bf5a5ed 100644
--- a/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h
+++ b/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h
@@ -29,6 +29,7 @@
#include <SocketHandler.h>
#include <pthread.h>
#include <queue>
+#include "CAmSerializer.h"
namespace am
{
@@ -40,7 +41,7 @@ namespace am
class RoutingReceiverAsyncShadow
{
public:
- RoutingReceiverAsyncShadow();
+ RoutingReceiverAsyncShadow(RoutingReceiveInterface* iReceiveInterface,SocketHandler* iSocketHandler);
virtual ~RoutingReceiverAsyncShadow();
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);
@@ -57,120 +58,20 @@ public:
void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability);
void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState);
void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay);
-
- am_Error_e setRoutingInterface(RoutingReceiveInterface *receiveInterface);
- void asyncMsgReceiver(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
- bool asyncDispatcher(const sh_pollHandle_t handle, void* userData);
- bool asyncChecker(const sh_pollHandle_t handle, void* userData);
-
- shPollFired_T<RoutingReceiverAsyncShadow> asyncMsgReceive;
- shPollDispatch_T<RoutingReceiverAsyncShadow> asyncDispatch;
- shPollCheck_T<RoutingReceiverAsyncShadow> asyncCheck;
+ am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID) ;
+ am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
+ am_Error_e registerSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) ;
+ am_Error_e deregisterSink(const am_sinkID_t sinkID) ;
+ am_Error_e registerSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) ;
+ 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);
private:
- enum msgID_e
- {
- MSG_ACKCONNECT, MSG_ACKDISCONNECT, MSG_ACKSETSINKVOLUMECHANGE, MSG_ACKSETSOURCEVOLUMECHANGE, MSG_ACKSETSOURCESTATE, MSG_ACKSETSINKSOUNDPROPERTY, MSG_ACKSETSOURCESOUNDPROPERTY, MSG_ACKCROSSFADING, MSG_ACKSOURCEVOLUMETICK, MSG_ACKSINKVOLUMETICK, MSG_HOOKINTERRUPTSTATUSCHANGE, MSG_HOOKSINKAVAILABLITYSTATUSCHANGE, MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE, MSG_HOOKDOMAINSTATECHANGE, MSG_HOOKTIMINGINFORMATIONCHANGED
- };
-
- struct a_connect_s
- {
- am_Handle_s handle;
- am_connectionID_t connectionID;
- am_Error_e error;
- };
-
- struct a_volume_s
- {
- am_Handle_s handle;
- am_volume_t volume;
- am_Error_e error;
- };
-
- struct a_handle_s
- {
- am_Handle_s handle;
- am_Error_e error;
- };
-
- struct a_crossfading_s
- {
- am_Handle_s handle;
- am_HotSink_e hotSink;
- am_Error_e error;
- };
-
- struct a_sourceVolumeTick_s
- {
- am_sourceID_t sourceID;
- am_Handle_s handle;
- am_volume_t volume;
- };
-
- struct a_sinkVolumeTick_s
- {
- am_sinkID_t sinkID;
- am_Handle_s handle;
- am_volume_t volume;
- };
-
- struct a_interruptStatusChange_s
- {
- am_sourceID_t sourceID;
- am_InterruptState_e interruptState;
- };
-
- struct a_sinkAvailability_s
- {
- am_sinkID_t sinkID;
- am_Availability_s availability;
- };
-
- struct a_sourceAvailability_s
- {
- am_sourceID_t sourceID;
- am_Availability_s availability;
- };
-
- struct a_hookDomainStateChange_s
- {
- am_domainID_t domainID;
- am_DomainState_e state;
- };
-
- struct a_timingInfoChanged_s
- {
- am_connectionID_t connectionID;
- am_timeSync_t delay;
- };
-
- union parameter_u
- {
- a_connect_s connect;
- a_volume_s volume;
- a_handle_s handle;
- a_crossfading_s crossfading;
- a_sourceVolumeTick_s sourceVolumeTick;
- a_sinkVolumeTick_s sinkVolumeTick;
- a_interruptStatusChange_s interruptStatusChange;
- a_sinkAvailability_s sinkAvailability;
- a_sourceAvailability_s sourceAvailability;
- a_hookDomainStateChange_s domainStateChange;
- a_timingInfoChanged_s timingInfoChange;
- };
-
- struct msg_s
- {
- msgID_e msgID;
- parameter_u parameters;
- };
SocketHandler *mSocketHandler;
RoutingReceiveInterface *mRoutingReceiveInterface;
- std::queue<msg_s> mQueue;
- static pthread_mutex_t mMutex;
- sh_pollHandle_t mHandle;
- int mPipe[2];
+ CAmSerializer mSerializer;
};
} /* namespace am */
diff --git a/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h b/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h
index dd88be1..96e1b5c 100644
--- a/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h
+++ b/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h
@@ -29,6 +29,7 @@
#include <routing/RoutingSendInterface.h>
#include "RoutingReceiverAsyncShadow.h"
#include <semaphore.h>
+#include <memory.h>
namespace am
{
@@ -208,6 +209,12 @@ public:
*/
void updateDomainstateSafe(am_domainID_t domainID, am_DomainState_e domainState);
+ void updateDomainListSafe(std::vector<am_Domain_s> listDomains);
+
+ void updateSourceListSafe(std::vector<am_Source_s> listSource);
+
+ void updateSinkListSafe(std::vector<am_Sink_s> listSinks);
+
private:
/**
* Extra thread that handles dbus stimulation for interrupt tests
@@ -216,12 +223,11 @@ private:
* it is used just for testing, not intended to be used otherwise...
* @param data
*/
- static void* InterruptEvents(void* data);
std::vector<am_Domain_s> createDomainTable();
std::vector<am_Sink_s> createSinkTable();
std::vector<am_Source_s> createSourceTable();
std::vector<am_Gateway_s> createGatewayTable();
- RoutingReceiverAsyncShadow mShadow;
+ RoutingReceiverAsyncShadow* mShadow;
RoutingReceiveInterface* mReceiveInterface;
SocketHandler *mSocketHandler;
std::vector<am_Domain_s> mDomains;
@@ -372,6 +378,21 @@ private:
am_DomainState_e mDomainState;
};
+class syncRegisterWorker: public Worker
+{
+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);
+ void start2work();
+ void cancelWork();
+private:
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ std::vector<am_Domain_s> mListDomains;
+ std::vector<am_Sink_s> mListSinks;
+ std::vector<am_Source_s> mListSources;
+ uint16_t mHandle;
+};
+
}
#endif /* ROUTINGSENDER_H_ */
diff --git a/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp b/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
index c11201e..5c93f60 100644
--- a/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
+++ b/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
@@ -36,16 +36,10 @@
using namespace am;
-pthread_mutex_t RoutingReceiverAsyncShadow::mMutex = PTHREAD_MUTEX_INITIALIZER;
-
-RoutingReceiverAsyncShadow::RoutingReceiverAsyncShadow():
-asyncMsgReceive(this, &RoutingReceiverAsyncShadow::asyncMsgReceiver), //
- asyncDispatch(this, &RoutingReceiverAsyncShadow::asyncDispatcher), //
- asyncCheck(this, &RoutingReceiverAsyncShadow::asyncChecker), //
- mSocketHandler(), //
- mRoutingReceiveInterface(), //
-mHandle (), //
-mPipe()
+RoutingReceiverAsyncShadow::RoutingReceiverAsyncShadow(RoutingReceiveInterface* iReceiveInterface, SocketHandler* iSocketHandler) :
+ mSocketHandler(iSocketHandler), //
+ mRoutingReceiveInterface(iReceiveInterface), //
+ mSerializer(iSocketHandler)
{
}
@@ -56,472 +50,139 @@ RoutingReceiverAsyncShadow::~RoutingReceiverAsyncShadow()
void RoutingReceiverAsyncShadow::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_connect_s temp;
- temp.handle = handle;
- temp.connectionID = connectionID;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKCONNECT;
- msg.parameters.connect = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackConnect write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_connect_s temp;
- temp.handle = handle;
- temp.connectionID = connectionID;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKDISCONNECT;
- msg.parameters.connect = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackDisconnect write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_volume_s temp;
- temp.handle = handle;
- temp.volume = volume;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSINKVOLUMECHANGE;
- msg.parameters.volume = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSinkVolumeChange write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_volume_s temp;
- temp.handle = handle;
- temp.volume = volume;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCEVOLUMECHANGE;
- msg.parameters.volume = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSourceVolumeChange write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCESTATE;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSourceState write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSINKSOUNDPROPERTY;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSinkSoundProperty write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCESOUNDPROPERTY;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSetSourceSoundProperty write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_crossfading_s temp;
- temp.handle = handle;
- temp.hotSink = hotSink;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKCROSSFADING;
- msg.parameters.crossfading = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackCrossFading write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sourceVolumeTick_s temp;
- temp.sourceID = sourceID;
- temp.handle = handle;
- temp.volume = volume;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSOURCEVOLUMETICK;
- msg.parameters.sourceVolumeTick = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSourceVolumeTick write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sinkVolumeTick_s temp;
- temp.sinkID = sinkID;
- temp.handle = handle;
- temp.volume = volume;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSINKVOLUMETICK;
- msg.parameters.sinkVolumeTick = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::ackSinkVolumeTick write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_interruptStatusChange_s temp;
- temp.sourceID = sourceID;
- temp.interruptState = interruptState;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKINTERRUPTSTATUSCHANGE;
- msg.parameters.interruptStatusChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookInterruptStatusChange write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sinkAvailability_s temp;
- temp.sinkID = sinkID;
- temp.availability = availability;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKSINKAVAILABLITYSTATUSCHANGE;
- msg.parameters.sinkAvailability = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookSinkAvailablityStatusChange write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sourceAvailability_s temp;
- temp.sourceID = sourceID;
- temp.availability = availability;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE;
- msg.parameters.sourceAvailability = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookSourceAvailablityStatusChange write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_hookDomainStateChange_s temp;
- temp.domainID = domainID;
- temp.state = domainState;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKDOMAINSTATECHANGE;
- msg.parameters.domainStateChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookDomainStateChange write failed, error code:", strerror(errno));
- }
+ 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)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_timingInfoChanged_s temp;
- temp.connectionID = connectionID;
- temp.delay = delay;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKTIMINGINFORMATIONCHANGED;
- msg.parameters.timingInfoChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
- {
- logError("RoutingReceiverAsyncShadow::hookTimingInformationChanged write failed, error code:", strerror(errno));
- }
+ mSerializer.asyncCall<RoutingReceiveInterface, const am_connectionID_t, const am_timeSync_t>(mRoutingReceiveInterface, &RoutingReceiveInterface::hookTimingInformationChanged, connectionID, delay);
}
-void RoutingReceiverAsyncShadow::asyncMsgReceiver(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
+am_Error_e RoutingReceiverAsyncShadow::registerDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- (void) handle;
- (void) userData;
- //it is no really important what to read here, we will read the queue later...
- char buffer[10];
- if (read(pollfd.fd, buffer, 10) == -1)
- {
- logError("RoutingReceiverAsyncShadow::asyncMsgReceiver could not read!");
- }
+ 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);
}
-bool RoutingReceiverAsyncShadow::asyncDispatcher(const sh_pollHandle_t handle, void *userData)
+am_Error_e am::RoutingReceiverAsyncShadow::registerGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- (void) handle;
- (void) userData;
- msg_s msg;
-
- //ok, let's receive, first lock
- pthread_mutex_lock(&mMutex);
- msg = mQueue.front();
- mQueue.pop();
- pthread_mutex_unlock(&mMutex);
+ 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);
+}
- //check for the message:
- switch (msg.msgID)
- {
- case MSG_ACKCONNECT:
- mRoutingReceiveInterface->ackConnect(msg.parameters.connect.handle, msg.parameters.connect.connectionID, msg.parameters.connect.error);
- break;
- case MSG_ACKDISCONNECT:
- mRoutingReceiveInterface->ackDisconnect(msg.parameters.connect.handle, msg.parameters.connect.connectionID, msg.parameters.connect.error);
- break;
- case MSG_ACKSETSINKVOLUMECHANGE:
- mRoutingReceiveInterface->ackSetSinkVolumeChange(msg.parameters.volume.handle, msg.parameters.volume.volume, msg.parameters.volume.error);
- break;
- case MSG_ACKSETSOURCEVOLUMECHANGE:
- mRoutingReceiveInterface->ackSetSourceVolumeChange(msg.parameters.volume.handle, msg.parameters.volume.volume, msg.parameters.volume.error);
- break;
- case MSG_ACKSETSOURCESTATE:
- mRoutingReceiveInterface->ackSetSourceState(msg.parameters.handle.handle, msg.parameters.handle.error);
- break;
- case MSG_ACKSETSINKSOUNDPROPERTY:
- mRoutingReceiveInterface->ackSetSinkSoundProperty(msg.parameters.handle.handle, msg.parameters.handle.error);
- break;
- case MSG_ACKSETSOURCESOUNDPROPERTY:
- mRoutingReceiveInterface->ackSetSourceSoundProperty(msg.parameters.handle.handle, msg.parameters.handle.error);
- break;
- case MSG_ACKCROSSFADING:
- mRoutingReceiveInterface->ackCrossFading(msg.parameters.crossfading.handle, msg.parameters.crossfading.hotSink, msg.parameters.crossfading.error);
- break;
- case MSG_ACKSOURCEVOLUMETICK:
- mRoutingReceiveInterface->ackSourceVolumeTick(msg.parameters.sourceVolumeTick.handle, msg.parameters.sourceVolumeTick.sourceID, msg.parameters.sourceVolumeTick.volume);
- break;
- case MSG_ACKSINKVOLUMETICK:
- mRoutingReceiveInterface->ackSinkVolumeTick(msg.parameters.sinkVolumeTick.handle, msg.parameters.sinkVolumeTick.sinkID, msg.parameters.sinkVolumeTick.volume);
- break;
- case MSG_HOOKINTERRUPTSTATUSCHANGE:
- mRoutingReceiveInterface->hookInterruptStatusChange(msg.parameters.interruptStatusChange.sourceID, msg.parameters.interruptStatusChange.interruptState);
- break;
- case MSG_HOOKSINKAVAILABLITYSTATUSCHANGE:
- mRoutingReceiveInterface->hookSinkAvailablityStatusChange(msg.parameters.sinkAvailability.sinkID, msg.parameters.sinkAvailability.availability);
- break;
- case MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE:
- mRoutingReceiveInterface->hookSourceAvailablityStatusChange(msg.parameters.sourceAvailability.sourceID, msg.parameters.sourceAvailability.availability);
- break;
- case MSG_HOOKDOMAINSTATECHANGE:
- mRoutingReceiveInterface->hookDomainStateChange(msg.parameters.domainStateChange.domainID, msg.parameters.domainStateChange.state);
- break;
- case MSG_HOOKTIMINGINFORMATIONCHANGED:
- mRoutingReceiveInterface->hookTimingInformationChanged(msg.parameters.timingInfoChange.connectionID, msg.parameters.timingInfoChange.delay);
- break;
- default:
- logError("RoutingReceiverAsyncShadow::asyncDispatcher unknown message was received:", msg.msgID);
- break;
- }
+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);
+}
- bool retVal = false;
- pthread_mutex_lock(&mMutex);
- if (mQueue.size() > 0)
- retVal = true;
- pthread_mutex_unlock(&mMutex);
+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);
+}
- return (retVal);
+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);
}
-bool RoutingReceiverAsyncShadow::asyncChecker(const sh_pollHandle_t handle, void *userData)
+am_Error_e am::RoutingReceiverAsyncShadow::deregisterSource(const am_sourceID_t sourceID)
{
- (void) handle;
- (void) userData;
- bool returnVal = false;
- pthread_mutex_lock(&mMutex);
- if (mQueue.size() > 0)
- returnVal = true;
- pthread_mutex_unlock(&mMutex);
- return (returnVal);
+ 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 RoutingReceiverAsyncShadow::setRoutingInterface(RoutingReceiveInterface *receiveInterface)
+am_Error_e am::RoutingReceiverAsyncShadow::registerCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- assert(receiveInterface!=0);
- mRoutingReceiveInterface = receiveInterface;
- mRoutingReceiveInterface->getSocketHandler(mSocketHandler);
- if (pipe(mPipe) == -1)
- {
- logError("RoutingReceiverAsyncShadow::setRoutingInterface could not create pipe!:");
- return (E_UNKNOWN);
- }
+ 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);
+}
- short event = 0;
- event |= POLLIN;
- mSocketHandler->addFDPoll(mPipe[0], event, NULL, &asyncMsgReceive, &asyncCheck, &asyncDispatch, NULL, mHandle);
- return (E_OK);
+void am::RoutingReceiverAsyncShadow::confirmRoutingReady(uint16_t starupHandle)
+{
+ mSerializer.asyncCall<RoutingReceiveInterface,uint16_t>(mRoutingReceiveInterface,&RoutingReceiveInterface::confirmRoutingReady,starupHandle);
}
+
+
+
diff --git a/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp b/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp
index 1a1ee70..68b260f 100644
--- a/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp
+++ b/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp
@@ -55,175 +55,174 @@ 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"))
+//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)
{
- 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);
+ 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;
}
- else if (dbus_message_is_method_call(msg, "org.genivi.test", "InterruptStatusChange"))
+
+ WorkerThreadPool::WorkerThreadPool(int numThreads):
+ mNumThreads(numThreads)
{
- 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);
+ 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]);
+ }
}
- 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;
-}
-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]);
- }
-}
-
-int16_t WorkerThreadPool::startWork(Worker *worker)
-{
- pthread_mutex_lock(&mBlockingMutex);
- std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
- for(;it!=mListWorkers.end();++it)
- {
- if(!it->busy)
+ int16_t WorkerThreadPool::startWork(Worker *worker)
{
- it->worker=worker;
- it->busy=true;
+ 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);
+ }
+ }
pthread_mutex_unlock(&mBlockingMutex);
- sem_post(&it->block);
- return ((int)it->workerID);
+ return (-1);
}
- }
- pthread_mutex_unlock(&mBlockingMutex);
- return (-1);
-}
-bool WorkerThreadPool::cancelWork(int workerID)
-{
- std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
- for(;it!=mListWorkers.end();++it)
- {
- if(it->workerID==workerID && it->busy)
+ bool WorkerThreadPool::cancelWork(int workerID)
{
- sem_post(&it->cancel);
- return (true);
+ 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);
}
- }
- return (false);
-}
-void WorkerThreadPool::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)
+ void WorkerThreadPool::finishedWork(pthread_t threadID)
{
- it->busy=false;
- delete it->worker;
- break;
+ 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);
}
- }
- pthread_mutex_unlock(&mBlockingMutex);
-}
-WorkerThreadPool::~WorkerThreadPool()
-{
- for (int i=0;i<mNumThreads;i++)
- {
- pthread_cancel(mListWorkers[i].threadID);
- }
-}
+ WorkerThreadPool::~WorkerThreadPool()
+ {
+ for (int i=0;i<mNumThreads;i++)
+ {
+ pthread_cancel(mListWorkers[i].threadID);
+ }
+ }
-Worker::Worker(WorkerThreadPool *pool):
-pPool(pool), //
- mCancelSem()
+ Worker::Worker(WorkerThreadPool *pool):
+ pPool(pool), mCancelSem()
{
}
@@ -262,20 +261,13 @@ pPool(pool), //
}
AsyncRoutingSender::AsyncRoutingSender():
- mShadow(), //
- mReceiveInterface(0), //
- mDomains(createDomainTable()), //
- mSinks(createSinkTable()), //
-mSources ( createSourceTable ( ) ), //
-mGateways ( createGatewayTable ( ) ) , //
-mMapHandleWorker ( ), //
-mMapConnectionIDRoute(),//
-mPool(10)
+ mReceiveInterface(0), mDomains(createDomainTable()), mSinks(createSinkTable()), mSources ( createSourceTable ( ) ), mGateways ( createGatewayTable ( ) ), mMapHandleWorker ( ) , mMapConnectionIDRoute ( ) , mPool (10)
{
}
AsyncRoutingSender::~AsyncRoutingSender()
{
+ delete mShadow;
}
am_Error_e AsyncRoutingSender::startupInterface(RoutingReceiveInterface *routingreceiveinterface)
@@ -283,50 +275,20 @@ am_Error_e AsyncRoutingSender::startupInterface(RoutingReceiveInterface *routing
//first, create the Shadow:
assert(routingreceiveinterface!=0);
mReceiveInterface = routingreceiveinterface;
- mShadow.setRoutingInterface(routingreceiveinterface);
+ SocketHandler* handler;
+ routingreceiveinterface->getSocketHandler(handler);
+ mShadow = new RoutingReceiverAsyncShadow(routingreceiveinterface, handler);
+ return E_OK;
}
void AsyncRoutingSender::setRoutingReady(const uint16_t handle)
{
- //todo: implement handle !
- assert(mReceiveInterface!=0);
- am_Error_e eCode;
- //first register the domains
- std::vector<am_Domain_s>::iterator domainIter = mDomains.begin();
- for (; domainIter != mDomains.end(); ++domainIter)
- {
- am_domainID_t domainID;
- if ((eCode = mReceiveInterface->registerDomain(*domainIter, domainID)) != E_OK)
- {
- logError("AsyncRoutingSender::routingInterfacesReady error on registering domain, failed with", eCode);
- }
- domainIter->domainID = domainID;
- }
+ syncRegisterWorker *worker = new syncRegisterWorker(this, &mPool, mShadow, mDomains, mSinks, mSources, handle);
- //then sources
- std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
- for (; sourceIter != mSources.end(); ++sourceIter)
+ if ((mPool.startWork(worker)) == -1)
{
- am_sourceID_t sourceID;
- //set the correct domainID
- sourceIter->domainID = mDomains[0].domainID;
- if ((eCode = mReceiveInterface->registerSource(*sourceIter, sourceID)) != E_OK)
- {
- logError("AsyncRoutingSender::routingInterfacesReady error on registering source, failed with", eCode);
- }
- }
-
- //sinks
- std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
- for (; sinkIter != mSinks.end(); ++sinkIter)
- {
- am_sinkID_t sinkID;
- //set the correct domainID
- sinkIter->domainID = mDomains[0].domainID;
- if ((eCode = mReceiveInterface->registerSink(*sinkIter, sinkID)) != E_OK)
- {
- logError("AsyncRoutingSender::routingInterfacesReady error on registering sink, failed with", eCode);
- }
+ logError("AsyncRoutingSender::asyncConnect not enough threads!");
+ delete worker;
}
//gateways
@@ -422,7 +384,7 @@ am_Error_e AsyncRoutingSender::asyncConnect(const am_Handle_s handle, const am_c
return (E_WRONG_FORMAT);
//the operation is ok, lets create a worker, assign it to a task in the task pool
- asycConnectWorker *worker = new asycConnectWorker(this, &mPool, &mShadow, handle, connectionID, sourceID, sinkID, connectionFormat);
+ asycConnectWorker *worker = new asycConnectWorker(this, &mPool, mShadow, handle, connectionID, sourceID, sinkID, connectionFormat);
if ((work = mPool.startWork(worker)) == -1)
{
logError("AsyncRoutingSender::asyncConnect not enough threads!");
@@ -457,7 +419,7 @@ am_Error_e AsyncRoutingSender::asyncDisconnect(const am_Handle_s handle, const a
pthread_mutex_unlock(&mMapConnectionMutex);
//the operation is ok, lets create a worker, assign it to a task in the task pool
- asycDisConnectWorker *worker = new asycDisConnectWorker(this, &mPool, &mShadow, handle, connectionID);
+ asycDisConnectWorker *worker = new asycDisConnectWorker(this, &mPool, mShadow, handle, connectionID);
if ((work = mPool.startWork(worker)) == -1)
{
logError("AsyncRoutingSender::asyncDisconnect not enough threads!");
@@ -499,7 +461,7 @@ am_Error_e AsyncRoutingSender::asyncSetSinkVolume(const am_Handle_s handle, cons
if (sinkIter == mSinks.end())
return (E_NON_EXISTENT); //not found!
- asyncSetSinkVolumeWorker *worker = new asyncSetSinkVolumeWorker(this, &mPool, &mShadow, sinkIter->volume, handle, sinkID, volume, ramp, time);
+ asyncSetSinkVolumeWorker *worker = new asyncSetSinkVolumeWorker(this, &mPool, mShadow, sinkIter->volume, handle, sinkID, volume, ramp, time);
if ((work = mPool.startWork(worker)) == -1)
{
logError("AsyncRoutingSender::asyncSetSinkVolume not enough threads!");
@@ -541,7 +503,7 @@ am_Error_e AsyncRoutingSender::asyncSetSourceVolume(const am_Handle_s handle, co
if (sourceIter == mSources.end())
return (E_NON_EXISTENT); //not found!
- asyncSetSourceVolumeWorker *worker = new asyncSetSourceVolumeWorker(this, &mPool, &mShadow, sourceIter->volume, handle, sourceID, volume, ramp, time);
+ asyncSetSourceVolumeWorker *worker = new asyncSetSourceVolumeWorker(this, &mPool, mShadow, sourceIter->volume, handle, sourceID, volume, ramp, time);
if ((work = mPool.startWork(worker)) == -1)
{
logError("AsyncRoutingSender::asyncSetSourceVolume not enough threads!");
@@ -583,7 +545,7 @@ am_Error_e AsyncRoutingSender::asyncSetSourceState(const am_Handle_s handle, con
if (sourceIter == mSources.end())
return (E_NON_EXISTENT); //not found!
- asyncSetSourceStateWorker *worker = new asyncSetSourceStateWorker(this, &mPool, &mShadow, handle, sourceID, state);
+ asyncSetSourceStateWorker *worker = new asyncSetSourceStateWorker(this, &mPool, mShadow, handle, sourceID, state);
if ((work = mPool.startWork(worker)) == -1)
{
logError("AsyncRoutingSender::asyncSetSourceState not enough threads!");
@@ -625,7 +587,7 @@ am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handl
if (sinkIter == mSinks.end())
return (E_NON_EXISTENT); //not found!
- asyncSetSinkSoundPropertyWorker *worker = new asyncSetSinkSoundPropertyWorker(this, &mPool, &mShadow, handle, soundProperty, sinkID);
+ asyncSetSinkSoundPropertyWorker *worker = new asyncSetSinkSoundPropertyWorker(this, &mPool, mShadow, handle, soundProperty, sinkID);
if ((work = mPool.startWork(worker)) == -1)
{
logError("AsyncRoutingSender::asyncSetSinkSoundProperty not enough threads!");
@@ -676,7 +638,7 @@ am_Error_e AsyncRoutingSender::setDomainState(const am_domainID_t domainID, cons
if (domainIter == mDomains.end())
return (E_NON_EXISTENT); //not found!
- asyncDomainStateChangeWorker *worker = new asyncDomainStateChangeWorker(this, &mPool, &mShadow, domainID, domainState);
+ asyncDomainStateChangeWorker *worker = new asyncDomainStateChangeWorker(this, &mPool, mShadow, domainID, domainState);
if ((work = mPool.startWork(worker)) == -1)
{
logError("AsyncRoutingSender::setDomainState not enough threads!");
@@ -714,7 +676,7 @@ am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s han
if (sourceIter == mSources.end())
return (E_NON_EXISTENT); //not found!
- asyncSetSourceSoundPropertyWorker *worker = new asyncSetSourceSoundPropertyWorker(this, &mPool, &mShadow, handle, soundProperty, sourceID);
+ asyncSetSourceSoundPropertyWorker *worker = new asyncSetSourceSoundPropertyWorker(this, &mPool, mShadow, handle, soundProperty, sourceID);
if ((work = mPool.startWork(worker)) == -1)
{
logError("AsyncRoutingSender::asyncSetSourceState not enough threads!");
@@ -953,6 +915,27 @@ void am::AsyncRoutingSender::updateDomainstateSafe(am_domainID_t domainID, am_Do
pthread_mutex_unlock(&mDomainsMutex);
}
+void am::AsyncRoutingSender::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)
+{
+ pthread_mutex_lock(&mSourcesMutex);
+ mSources = listSource;
+ pthread_mutex_unlock(&mSourcesMutex);
+}
+
+void am::AsyncRoutingSender::updateSinkListSafe(std::vector<am_Sink_s> listSinks)
+{
+ pthread_mutex_lock(&mSinksMutex);
+ mSinks = listSinks;
+ pthread_mutex_unlock(&mSinksMutex);
+}
+
void AsyncRoutingSender::getInterfaceVersion(std::string & version) const
{
version = RoutingSendVersion;
@@ -1320,3 +1303,70 @@ 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), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mListDomains(domains), //
+ mListSinks(sinks), //
+ mListSources(sources),
+ mHandle(handle)
+{
+}
+
+void syncRegisterWorker::start2work()
+{
+ //todo: sendchanged data must be in here !
+ logInfo("Start to register stuff");
+
+ am_Error_e eCode;
+
+ std::vector<am_Domain_s>::iterator domainIter = mListDomains.begin();
+ for (; domainIter != mListDomains.end(); ++domainIter)
+ {
+ am_domainID_t domainID;
+ if ((eCode = mShadow->registerDomain(*domainIter, domainID)) != E_OK)
+ {
+ logError("syncRegisterWorker::start2work error on registering domain, failed with", eCode);
+ }
+ domainIter->domainID = domainID;
+ }
+
+ mAsyncSender->updateDomainListSafe(mListDomains);
+
+ //then sources
+ std::vector<am_Source_s>::iterator sourceIter = mListSources.begin();
+ for (; sourceIter != mListSources.end(); ++sourceIter)
+ {
+ am_sourceID_t sourceID;
+ //set the correct domainID
+ sourceIter->domainID = mListDomains[0].domainID;
+ if ((eCode = mShadow->registerSource(*sourceIter, sourceID)) != E_OK)
+ {
+ logError("syncRegisterWorker::start2work error on registering source, failed with", eCode);
+ }
+ }
+
+ mAsyncSender->updateSourceListSafe(mListSources);
+
+ //sinks
+ std::vector<am_Sink_s>::iterator sinkIter = mListSinks.begin();
+ for (; sinkIter != mListSinks.end(); ++sinkIter)
+ {
+ am_sinkID_t sinkID;
+ //set the correct domainID
+ sinkIter->domainID = mListDomains[0].domainID;
+ if ((eCode = mShadow->registerSink(*sinkIter, sinkID)) != E_OK)
+ {
+ logError("syncRegisterWorker::start2work error on registering sink, failed with", eCode);
+ }
+ }
+
+ mAsyncSender->updateSinkListSafe(mListSinks);
+ mShadow->confirmRoutingReady(mHandle);
+}
+
+void syncRegisterWorker::cancelWork()
+{
+}
+
diff --git a/PluginRoutingInterfaceAsync/test/CMakeLists.txt b/PluginRoutingInterfaceAsync/test/CMakeLists.txt
index e80d80b..aa4c39d 100644
--- a/PluginRoutingInterfaceAsync/test/CMakeLists.txt
+++ b/PluginRoutingInterfaceAsync/test/CMakeLists.txt
@@ -34,6 +34,8 @@ find_package (Threads)
FIND_PACKAGE(PkgConfig)
FIND_PACKAGE(DBUS REQUIRED)
pkg_check_modules(DLT REQUIRED automotive-dlt)
+pkg_check_modules(SQLITE REQUIRED sqlite3)
+
INCLUDE_DIRECTORIES(
${STD_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
@@ -51,7 +53,6 @@ INCLUDE_DIRECTORIES(
file(GLOB ASYNC_PLUGIN_INTERFACE_SRCS_CXX
"../../AudioManagerDaemon/src/SocketHandler.cpp"
- "../../AudioManagerDaemon/src/RoutingSender.cpp"
"../../AudioManagerDaemon/src/DLTWrapper.cpp"
"../src/*.cpp"
"testRoutingInterfaceAsync.cpp"
@@ -76,6 +77,7 @@ TARGET_LINK_LIBRARIES(asyncRoutingInterfaceTest
${CMAKE_THREAD_LIBS_INIT}
${GTEST_LIBRARIES}
${DBUS_LIBRARY}
+ ${SQLITE_LIBRARIES}
gmock
)
diff --git a/PluginRoutingInterfaceAsync/test/mocklnterfaces.h b/PluginRoutingInterfaceAsync/test/mocklnterfaces.h
index 328d416..d8eef1f 100644
--- a/PluginRoutingInterfaceAsync/test/mocklnterfaces.h
+++ b/PluginRoutingInterfaceAsync/test/mocklnterfaces.h
@@ -31,81 +31,86 @@ 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_METHOD0(getInterfaceVersion,
- uint16_t());
-};
+ 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
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp
index 3149e7e..1e672a6 100644
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp
+++ b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp
@@ -25,26 +25,28 @@
#include "testRoutingInterfaceAsync.h"
#include "config.h"
#include "DLTWrapper.h"
+#include "RoutingReceiver.h"
+#include "PluginTemplate.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);
+am_domainID_t MyEnvironment::mDomainIDCount = 0;
+static RoutingSendInterface* pRouter;
+static SocketHandler pSocketHandler;
+static MockRoutingReceiveInterface pReceiveInterface;
-testRoutingInterfaceAsync::testRoutingInterfaceAsync() :
- pSocketHandler(), //
- pReceiveInterface(), //
- ptimerCallback(this, &testRoutingInterfaceAsync::timerCallback)
+MyEnvironment::MyEnvironment() :
+ ptimerCallback(this, &MyEnvironment::timerCallback)
{
+ DefaultValue<am_Error_e>::Set(E_OK); // Sets the default value to be returned.
}
-testRoutingInterfaceAsync::~testRoutingInterfaceAsync()
+MyEnvironment::~MyEnvironment()
{
}
-void testRoutingInterfaceAsync::SetUp()
+void MyEnvironment::SetUp()
{
logInfo("RoutingSendInterface Test started ");
@@ -53,59 +55,116 @@ void testRoutingInterfaceAsync::SetUp()
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));
+ 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,confirmRoutingReady(_)).Times(1);
+
+ RoutingSendInterface* (*createFunc)();
+ void* tempLibHandle = NULL;
+ std::string libname("../plugins/routing/libPluginRoutingInterfaceAsync.so");
+ createFunc = getCreateFunction<RoutingSendInterface*()>(libname, tempLibHandle);
- pRoutingSender.startupRoutingInterface(&pReceiveInterface);
- pRoutingSender.routingInterfacesReady();
+ if (!createFunc)
+ {
+ logError("RoutingSendInterface Test Entry point of RoutingPlugin not found");
+ exit(1);
+ }
+
+ pRouter = createFunc();
+
+ if (!pRouter)
+ {
+ logError("RoutingSendInterface Test RoutingPlugin initialization failed. Entry Function not callable");
+ exit(1);
+ }
+
+ pRouter->startupInterface(&pReceiveInterface);
+ pRouter->setRoutingReady(10);
timespec t;
t.tv_nsec = 0;
- t.tv_sec = 4;
+ t.tv_sec = 2;
sh_timerHandle_t handle;
shTimerCallBack *buf = &ptimerCallback;
//lets use a timeout so the test will finish
pSocketHandler.addTimer(t, buf, handle, (void*) NULL);
+ pSocketHandler.start_listenting();
+
+}
+
+void MyEnvironment::TearDown()
+{
+
+}
+
+testRoutingInterfaceAsync::testRoutingInterfaceAsync() :
+ ptimerCallback(this, &testRoutingInterfaceAsync::timerCallback)
+{
+}
+
+testRoutingInterfaceAsync::~testRoutingInterfaceAsync()
+{
+}
+
+void testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
+{
+ (void) handle;
+ (void) userData;
+ pSocketHandler.stop_listening();
+}
+
+void testRoutingInterfaceAsync::SetUp()
+{
+// timespec t;
+// t.tv_nsec = 0;
+// t.tv_sec = 2;
+//
+// 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> MyEnvironment::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)
+am_Error_e MyEnvironment::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)
+am_Error_e MyEnvironment::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_Error_e MyEnvironment::handleDomainRegister(const am_Domain_s & domainData, am_domainID_t & domainID)
{
am_Domain_s domain = domainData;
- domainID = mDomainIDCount++;
+ domainID = ++mDomainIDCount;
domain.domainID = domainID;
- pRoutingSender.addDomainLookup(domain);
return (E_OK);
}
-void am::testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
+void MyEnvironment::timerCallback(sh_timerHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
pSocketHandler.stop_listening();
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 2;
+ pSocketHandler.restartTimer(handle, t);
}
void testRoutingInterfaceAsync::TearDown()
@@ -119,7 +178,7 @@ TEST_F(testRoutingInterfaceAsync,setDomainState)
EXPECT_CALL(pReceiveInterface,hookDomainStateChange(_,DS_INDEPENDENT_RUNDOWN)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.setDomainState(domainID,state));
+ ASSERT_EQ(E_OK, pRouter->setDomainState(domainID,state));
pSocketHandler.start_listenting();
}
@@ -137,7 +196,7 @@ TEST_F(testRoutingInterfaceAsync,setSourceSoundProperty)
EXPECT_CALL(pReceiveInterface,ackSetSourceSoundProperty(_,E_OK)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.asyncSetSourceSoundProperty(handle,sourceID,property));
+ ASSERT_EQ(E_OK, pRouter->asyncSetSourceSoundProperty(handle,sourceID,property));
pSocketHandler.start_listenting();
}
@@ -155,7 +214,7 @@ TEST_F(testRoutingInterfaceAsync,setSinkSoundProperty)
EXPECT_CALL(pReceiveInterface,ackSetSinkSoundProperty(_,E_OK)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.asyncSetSinkSoundProperty(handle,sinkID,property));
+ ASSERT_EQ(E_OK, pRouter->asyncSetSinkSoundProperty(handle,sinkID,property));
pSocketHandler.start_listenting();
}
@@ -164,14 +223,14 @@ TEST_F(testRoutingInterfaceAsync,setSourceState)
am_Handle_s handle;
handle.handle = 1;
- handle.handleType = H_SETSOURCEVOLUME;
+ handle.handleType = H_SETSOURCESTATE;
am_sourceID_t sourceID = 1;
am_SourceState_e state = SS_OFF;
EXPECT_CALL(pReceiveInterface,ackSetSourceState(_,E_OK)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.asyncSetSourceState(handle,sourceID,state));
+ ASSERT_EQ(E_OK, pRouter->asyncSetSourceState(handle,sourceID,state));
pSocketHandler.start_listenting();
}
@@ -187,10 +246,10 @@ TEST_F(testRoutingInterfaceAsync,setSourceVolume)
am_RampType_e ramp = RAMP_GENIVI_DIRECT;
am_time_t myTime = 25;
- EXPECT_CALL(pReceiveInterface,ackSourceVolumeTick(_,sourceID,_)).Times(3);
+ EXPECT_CALL(pReceiveInterface,ackSourceVolumeTick(_,sourceID,_)).Times(AtLeast(1));
EXPECT_CALL(pReceiveInterface,ackSetSourceVolumeChange(_,volume,E_OK)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.asyncSetSourceVolume(handle,sourceID,volume,ramp,myTime));
+ ASSERT_EQ(E_OK, pRouter->asyncSetSourceVolume(handle,sourceID,volume,ramp,myTime));
pSocketHandler.start_listenting();
}
@@ -206,10 +265,10 @@ TEST_F(testRoutingInterfaceAsync,setSinkVolume)
am_RampType_e ramp = RAMP_GENIVI_DIRECT;
am_time_t myTime = 25;
- EXPECT_CALL(pReceiveInterface,ackSinkVolumeTick(_,sinkID,_)).Times(9);
+ EXPECT_CALL(pReceiveInterface,ackSinkVolumeTick(_,sinkID,_)).Times(AtLeast(2));
EXPECT_CALL(pReceiveInterface,ackSetSinkVolumeChange(_,volume,E_OK)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
+ ASSERT_EQ(E_OK, pRouter->asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
pSocketHandler.start_listenting();
}
@@ -228,37 +287,37 @@ TEST_F(testRoutingInterfaceAsync,setSinkVolumeAbort)
EXPECT_CALL(pReceiveInterface, ackSinkVolumeTick(_,sinkID,_));
EXPECT_CALL(pReceiveInterface,ackSetSinkVolumeChange(_,AllOf(Ne(volume),Ne(0)),E_ABORTED)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
+ ASSERT_EQ(E_OK, pRouter->asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
sleep(0.5);
- ASSERT_EQ(E_OK, pRoutingSender.asyncAbort(handle));
+ ASSERT_EQ(E_OK, pRouter->asyncAbort(handle));
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,disconnectTooEarly)
+TEST_F(testRoutingInterfaceAsync,disconnectNonExisting)
{
am_Handle_s handle;
handle.handle = 1;
- handle.handleType = H_CONNECT;
+ handle.handleType = H_DISCONNECT;
am_connectionID_t connectionID = 4;
- am_sourceID_t sourceID = 2;
- am_sinkID_t sinkID = 1;
- am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
- EXPECT_CALL(pReceiveInterface, ackConnect(_,connectionID,E_OK));
+ EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
EXPECT_CALL(pReceiveInterface,ackDisconnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncDisconnect(handle,connectionID));
+ ASSERT_EQ(E_NON_EXISTENT, pRouter->asyncDisconnect(handle,connectionID));
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,disconnectAbort)
+TEST_F(testRoutingInterfaceAsync,disconnectTooEarly)
{
+ am_Handle_s handle_c;
+ handle_c.handle = 1;
+ handle_c.handleType = H_CONNECT;
+
am_Handle_s handle;
handle.handle = 1;
- handle.handleType = H_CONNECT;
+ handle.handleType = H_DISCONNECT;
am_connectionID_t connectionID = 4;
am_sourceID_t sourceID = 2;
@@ -266,35 +325,47 @@ TEST_F(testRoutingInterfaceAsync,disconnectAbort)
am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
EXPECT_CALL(pReceiveInterface, ackConnect(_,connectionID,E_OK));
- EXPECT_CALL(pReceiveInterface, ackDisconnect(_,connectionID,E_ABORTED));
- ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- sleep(2);
- ASSERT_EQ(E_OK, pRoutingSender.asyncDisconnect(handle,connectionID));
- ASSERT_EQ(E_OK, pRoutingSender.asyncAbort(handle));
+ EXPECT_CALL(pReceiveInterface,ackDisconnect(_,connectionID,E_OK)).Times(0);
+ ASSERT_EQ(E_OK, pRouter->asyncConnect(handle_c,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_NON_EXISTENT, pRouter->asyncDisconnect(handle,connectionID));
pSocketHandler.start_listenting();
}
-TEST_F(testRoutingInterfaceAsync,disconnectNonExisting)
+TEST_F(testRoutingInterfaceAsync,disconnectAbort)
{
+ am_Handle_s handle_c;
+ handle_c.handle = 1;
+ handle_c.handleType = H_CONNECT;
+
am_Handle_s handle;
handle.handle = 1;
- handle.handleType = H_CONNECT;
+ handle.handleType = H_DISCONNECT;
- am_connectionID_t connectionID = 4;
+ am_connectionID_t connectionID = 5;
+ am_sourceID_t sourceID = 2;
+ am_sinkID_t sinkID = 1;
+ am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
- EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
- EXPECT_CALL(pReceiveInterface,ackDisconnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncDisconnect(handle,connectionID));
+ EXPECT_CALL(pReceiveInterface, ackConnect(_,connectionID,E_OK));
+ EXPECT_CALL(pReceiveInterface, ackDisconnect(_,connectionID,E_ABORTED));
+ ASSERT_EQ(E_OK, pRouter->asyncConnect(handle_c,connectionID,sourceID,sinkID,format));
+ sleep(2);
+ ASSERT_EQ(E_OK, pRouter->asyncDisconnect(handle,connectionID));
+ ASSERT_EQ(E_OK, pRouter->asyncAbort(handle));
pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,disconnect)
{
+ am_Handle_s handle_c;
+ handle_c.handle = 1;
+ handle_c.handleType = H_CONNECT;
+
am_Handle_s handle;
handle.handle = 1;
- handle.handleType = H_CONNECT;
+ handle.handleType = H_DISCONNECT;
am_connectionID_t connectionID = 4;
am_sourceID_t sourceID = 2;
@@ -303,9 +374,9 @@ TEST_F(testRoutingInterfaceAsync,disconnect)
EXPECT_CALL(pReceiveInterface, ackConnect(_,connectionID,E_OK));
EXPECT_CALL(pReceiveInterface, ackDisconnect(_,connectionID,E_OK));
- ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_OK, pRouter->asyncConnect(handle_c,connectionID,sourceID,sinkID,format));
sleep(2);
- ASSERT_EQ(E_OK, pRoutingSender.asyncDisconnect(handle,connectionID));
+ ASSERT_EQ(E_OK, pRouter->asyncDisconnect(handle,connectionID));
pSocketHandler.start_listenting();
}
@@ -322,12 +393,12 @@ TEST_F(testRoutingInterfaceAsync,connectNoMoreThreads)
am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
EXPECT_CALL(pReceiveInterface,ackConnect(_,_,E_OK)).Times(10);
- for (int i = 0; i < 10; i++)
+ for (int i = 0; i < 9; i++)
{
handle.handle++;
connectionID++;
- ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- }ASSERT_EQ(E_NOT_POSSIBLE, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_OK, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ }ASSERT_EQ(E_NOT_POSSIBLE, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
pSocketHandler.start_listenting();
}
@@ -344,9 +415,9 @@ TEST_F(testRoutingInterfaceAsync,connectAbortTooLate)
am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_OK, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
sleep(3);
- ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncAbort(handle));
+ ASSERT_EQ(E_NON_EXISTENT, pRouter->asyncAbort(handle));
pSocketHandler.start_listenting();
}
@@ -363,9 +434,9 @@ TEST_F(testRoutingInterfaceAsync,connectAbort)
am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_ABORTED)).Times(1);
- ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_OK, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
sleep(0.5);
- ASSERT_EQ(E_OK, pRoutingSender.asyncAbort(handle));
+ ASSERT_EQ(E_OK, pRouter->asyncAbort(handle));
pSocketHandler.start_listenting();
}
@@ -382,7 +453,7 @@ TEST_F(testRoutingInterfaceAsync,connectWrongFormat)
am_ConnectionFormat_e format = CF_GENIVI_MONO;
EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_WRONG_FORMAT, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_WRONG_FORMAT, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
pSocketHandler.start_listenting();
}
@@ -399,7 +470,7 @@ TEST_F(testRoutingInterfaceAsync,connectWrongSink)
am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_NON_EXISTENT, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
pSocketHandler.start_listenting();
}
@@ -415,7 +486,7 @@ TEST_F(testRoutingInterfaceAsync,connectWrongSource)
am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_NON_EXISTENT, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
pSocketHandler.start_listenting();
}
@@ -432,13 +503,15 @@ TEST_F(testRoutingInterfaceAsync,connect)
am_ConnectionFormat_e format = CF_GENIVI_ANALOG;
EXPECT_CALL(pReceiveInterface, ackConnect(_,connectionID,E_OK));
- ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_OK, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
pSocketHandler.start_listenting();
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
+ ::testing::Environment* const env = ::testing::AddGlobalTestEnvironment(new MyEnvironment);
+ (void) env;
return RUN_ALL_TESTS();
}
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h
index 364100c..3139b5a 100644
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h
+++ b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h
@@ -30,33 +30,43 @@
#include "mocklnterfaces.h"
#include "SocketHandler.h"
#include "../../AudioManagerDaemon/include/RoutingSender.h"
+#include "CAmSerializer.h"
#define UNIT_TEST 1
namespace am
{
-class testRoutingInterfaceAsync: public ::testing::Test
+class MyEnvironment: public ::testing::Environment
{
public:
- static std::vector<std::string> pListRoutingPluginDirs;
- SocketHandler pSocketHandler;
- MockRoutingReceiveInterface pReceiveInterface;
- static RoutingSender pRoutingSender;
static std::vector<std::string> returnListPlugins();
static am_Error_e handleDomainRegister(const am_Domain_s& domainData, am_domainID_t& domainID);
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<testRoutingInterfaceAsync> ptimerCallback;
- testRoutingInterfaceAsync();
- virtual ~testRoutingInterfaceAsync();
-
+ shTimerCallBack_T<MyEnvironment> ptimerCallback;
+ 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();
private:
static am_domainID_t mDomainIDCount;
};
+class testRoutingInterfaceAsync: public ::testing::Test
+{
+public:
+ testRoutingInterfaceAsync();
+ ~testRoutingInterfaceAsync();
+ void timerCallback(sh_timerHandle_t handle, void* userData);
+ shTimerCallBack_T<testRoutingInterfaceAsync> ptimerCallback;
+ void SetUp();
+ void TearDown();
+private:
+};
+
} /* namespace am */
#endif /* TESTROUTINGINTERFACEASYNC_H_ */
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp
index f8ece51..e00de40 100644
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp
+++ b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp
@@ -59,8 +59,8 @@ void testRoutingInterfaceAsync::SetUp()
EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSourceRegister));
EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSinkRegister));
- pRoutingSender.startupRoutingInterface(&pReceiveInterface);
- pRoutingSender.routingInterfacesReady();
+ //pRoutingSender.startupRoutingInterface(&pReceiveInterface);
+ //pRoutingSender.routingInterfacesReady();
timespec t;
t.tv_nsec = 0;
diff --git a/includes/CAmSerializer.h b/includes/CAmSerializer.h
index e4924e9..ab6ff03 100644
--- a/includes/CAmSerializer.h
+++ b/includes/CAmSerializer.h
@@ -25,7 +25,7 @@
#include "DLTWrapper.h"
#include "SocketHandler.h"
-#include "iostream" //todo remove
+//todo: performance improvement we could implement a memory pool that is more efficient here and avoids allocation and deallocation times.
namespace am
{
@@ -48,7 +48,7 @@ private:
{
public:
virtual ~CAmDelegate(){};
- virtual void call()=0;
+ virtual bool call(int* pipe)=0;
};
@@ -68,9 +68,11 @@ private:
mInstance(instance), //
mFunction(function){};
- void call()
+ bool call(int* pipe)
{
+ (void)pipe;
(*mInstance.*mFunction)();
+ return true;
};
};
@@ -90,9 +92,11 @@ private:
mFunction(function), //
mArgument(argument) { };
- void call()
+ bool call(int* pipe)
{
+ (void)pipe;
(*mInstance.*mFunction)(mArgument);
+ return true;
};
};
@@ -114,9 +118,11 @@ private:
mArgument(argument), //
mArgument1(argument1){};
- void call()
+ bool call(int* pipe)
{
+ (void)pipe;
(*mInstance.*mFunction)(mArgument,mArgument1);
+ return true;
};
};
@@ -140,9 +146,11 @@ private:
mArgument1(argument1), //
mArgument2(argument2){};
- void call()
+ bool call(int* pipe)
{
+ (void)pipe;
(*mInstance.*mFunction)(mArgument,mArgument1,mArgument2);
+ return true;
};
};
@@ -168,13 +176,192 @@ private:
mArgument2(argument2), //
mArgument3(argument3){};
- void call()
+ bool call(int* pipe)
{
+ (void)pipe;
(*mInstance.*mFunction)(mArgument,mArgument1,mArgument2,mArgument3);
+ return true;
};
};
/**
+ * Template for synchronous calls with no argument
+ */
+ template<class TClass, typename TretVal> class CAmSyncNoArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)();
+ TretVal mRetval;
+
+ public:
+ friend class CAmSerializer;
+ CAmSyncNoArgDelegate(TClass* instance, TretVal(TClass::*function)()) :
+ mInstance(instance), //
+ mFunction(function), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)();
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults()
+ {
+ return mRetval;
+ }
+ };
+
+ /**
+ * template for synchronous calls with one argument
+ */
+ template<class TClass, typename TretVal, typename Targ> class CAmSyncOneArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)(Targ argument);
+ Targ mArgument;
+ TretVal mRetval;
+
+ public:
+ friend class CAmSerializer;
+ CAmSyncOneArgDelegate(TClass* instance, TretVal(TClass::*function)(Targ argument), Targ argument) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)(mArgument);
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults(Targ& argument)
+ {
+ argument=mArgument;
+ return mRetval;
+ }
+ };
+
+ /**
+ * template for synchronous calls with two arguments
+ */
+ template<class TClass, typename TretVal, typename TargCall, typename TargCall1, typename Targ, typename Targ1> class CAmSyncTwoArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)(TargCall,TargCall1);
+ Targ mArgument;
+ Targ1 mArgument1;
+ TretVal mRetval;
+
+ public:
+ friend class CAmSerializer;
+ CAmSyncTwoArgDelegate(TClass* instance, TretVal(TClass::*function)(TargCall, TargCall1), Targ& argument, Targ1& argument1) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)(mArgument, mArgument1);
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults(Targ& argument, Targ1& argument1)
+ {
+ argument=mArgument;
+ argument1=mArgument1;
+ return mRetval;
+ }
+ };
+
+ /**
+ * template for synchronous calls with three arguments
+ */
+ template<class TClass, typename TretVal, typename Targ, typename Targ1, typename Targ2> class CAmSyncThreeArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)(Targ argument, Targ1 argument1, Targ2 argument2);
+ Targ mArgument;
+ Targ1 mArgument1;
+ Targ2 mArgument2;
+ TretVal mRetval;
+
+ public:
+ CAmSyncThreeArgDelegate(TClass* instance, TretVal(TClass::*function)(Targ argument, Targ1 argument1, Targ2 argument2), Targ argument, Targ1 argument1,Targ2 argument2) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1), //
+ mArgument2(argument2), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)(mArgument, mArgument1, mArgument2);
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults(Targ& argument, Targ1& argument1, Targ2& argument2)
+ {
+ argument=mArgument;
+ argument1=mArgument1;
+ argument2=mArgument2;
+ return mRetval;
+ }
+ };
+
+ /**
+ * template for synchronous calls with four arguments
+ */
+ template<class TClass, typename TretVal, typename Targ, typename Targ1, typename Targ2, typename Targ3> class CAmSyncFourArgDelegate: public CAmDelegate
+ {
+ private:
+ TClass* mInstance;
+ TretVal (TClass::*mFunction)(Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3);
+ Targ mArgument;
+ Targ1 mArgument1;
+ Targ2 mArgument2;
+ Targ3 mArgument3;
+ TretVal mRetval;
+
+ CAmSyncFourArgDelegate(TClass* instance, TretVal(TClass::*function)(Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3), Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3) :
+ mInstance(instance), //
+ mFunction(function), //
+ mArgument(argument), //
+ mArgument1(argument1), //
+ mArgument2(argument2), //
+ mArgument3(argument3), //
+ mRetval(){};
+
+ bool call(int* pipe)
+ {
+ mRetval = (*mInstance.*mFunction)(mArgument, mArgument1, mArgument2, mArgument3);
+ write(pipe[1], this, sizeof(this));
+ return false;
+ };
+
+ TretVal returnResults(Targ& argument, Targ1& argument1, Targ2& argument2, Targ3& argument3)
+ {
+ argument=mArgument;
+ argument1=mArgument1;
+ argument2=mArgument2;
+ argument3=mArgument3;
+ return mRetval;
+ }
+ };
+
+ /**
* rings the line of the pipe and adds the delegate pointer to the queue
* @param p delegate pointer
*/
@@ -186,6 +373,7 @@ private:
}
}
int mPipe[2]; //!< the pipe
+ int mReturnPipe[2]; //!< pipe handling returns
std::deque<CAmDelegagePtr> mListDelegatePoiters; //!< intermediate queue to store the pipe results
public:
@@ -255,7 +443,21 @@ public:
* @param instance
* @param function
* @param argument
- * @param argument1
+ * @param argument1 template<class TClass1, class TretVal, class Targ, class Targ1>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(Targ,Targ1), TretVal& retVal, Targ& argument, Targ1& argument1)
+ {
+ CAmSyncTwoArgDelegate<TClass1, TretVal, Targ, Targ1>* p(new CAmSyncTwoArgDelegate<TClass1, TretVal, Targ, Targ1>(instance, function, argument, argument1));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults(argument,argument1);
+ }
* @param argument2
*/
template<class TClass1, class Targ, class Targ1, class Targ2>
@@ -281,6 +483,156 @@ public:
send(p);
}
+ /**
+ * calls a synchronous function with no arguments threadsafe
+ * @param instance the instance of the class that shall be called
+ * @param function the function that shall be called as memberfunction pointer.
+ * Here is an example:
+ * @code
+ * class myClass
+ * {
+ * public:
+ * am_Error_e myfunction();
+ * }
+ * CAmSerializer serial(&Sockethandler);
+ * myClass instanceMyClass;
+ * am_Error_e error;
+ * serial<CommandSender,am_Error_e>(&instanceMyClass,&myClass::myfunction, error);
+ * @endcode
+ * All arguments given to synchronous functions must be non-const since the results of the operations will be written back to the arguments.
+ *
+ */
+ template<class TClass1, class TretVal>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(), TretVal& retVal)
+ {
+ CAmSyncNoArgDelegate<TClass1, TretVal>* p(new CAmSyncNoArgDelegate<TClass1, TretVal>(instance, function));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults();
+ delete p;
+ }
+
+ /**
+ * calls a function with one argument synchronous threadsafe
+ * @param instance the instance of the class that shall be called
+ * @param function the function that shall be called as memberfunction pointer.
+ * Here is an example:
+ * @code
+ * class myClass
+ * {
+ * public:
+ * am_Error_e myfunction(int k);
+ * }
+ * CAmSerializer serial(&Sockethandler);
+ * myClass instanceMyClass;
+ * am_Error_e error;
+ * int l;
+ * serial<CommandSender,am_Error_e,int>(&instanceMyClass,&myClass::myfunction,error,l);
+ * @endcode
+ * All arguments given to synchronous functions must be non-const since the results of the operations will be written back to the arguments.
+ */
+ template<class TClass1, class TretVal, class Targ>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(Targ), TretVal& retVal,Targ& argument)
+ {
+ CAmSyncOneArgDelegate<TClass1, TretVal, Targ>* p(new CAmSyncOneArgDelegate<TClass1, TretVal, Targ>(instance, function, argument));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults(argument);
+ delete p;
+ }
+
+ /**
+ * calls a function with two arguments synchronously threadsafe. for more see syncCall with one argument
+ * @param instance
+ * @param function
+ * @param retVal
+ * @param argument
+ * @param argument1
+ */
+ template<class TClass1, class TretVal, class TargCall, class Targ1Call,class Targ, class Targ1>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(TargCall,Targ1Call), TretVal& retVal, Targ& argument, Targ1& argument1)
+ {
+ CAmSyncTwoArgDelegate<TClass1, TretVal,TargCall,Targ1Call, Targ, Targ1>* p(new CAmSyncTwoArgDelegate<TClass1, TretVal,TargCall,Targ1Call, Targ, Targ1>(instance, function, argument, argument1));
+ send(dynamic_cast<CAmDelegagePtr>(p));
+
+ CAmDelegagePtr ptr;
+ if (read(mReturnPipe[0],&ptr, sizeof(ptr)) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ retVal=p->returnResults(argument,argument1);
+ delete p;
+ }
+
+ /**
+ * calls a function with three arguments synchronously threadsafe. for more see syncCall with one argument
+ * @param instance
+ * @param function
+ * @param retVal
+ * @param argument
+ * @param argument1
+ * @param argument2
+ */
+ template<class TClass1, class TretVal, class Targ, class Targ1, class Targ2>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(Targ,Targ1,Targ2), TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2)
+ {
+ CAmSyncThreeArgDelegate<TClass1, TretVal, Targ, Targ1, Targ2>* p(new CAmSyncThreeArgDelegate<TClass1, TretVal, Targ, Targ1, Targ2>(instance, function, argument, argument1, argument2));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults(argument, argument1, argument2);
+ delete p;
+ }
+
+ /**
+ * calls a function with four arguments synchronously threadsafe. for more see syncCall with one argument
+ * @param instance
+ * @param function
+ * @param retVal
+ * @param argument
+ * @param argument1
+ * @param argument2
+ * @param argument3
+ */
+ template<class TClass1, class TretVal, class Targ, class Targ1, class Targ2, class Targ3>
+ void syncCall(TClass1* instance, TretVal(TClass1::*function)(Targ,Targ1,Targ2,Targ3), TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2, Targ3& argument3)
+ {
+ CAmSyncFourArgDelegate<TClass1, TretVal, Targ, Targ1, Targ2, Targ3>* p(new CAmSyncFourArgDelegate<TClass1, TretVal, Targ, Targ1, Targ2, Targ3>(instance, function, argument, argument1, argument2, argument3));
+ send(static_cast<CAmDelegagePtr>(p));
+ int numReads;
+ CAmDelegagePtr ptr;
+ if ((numReads=read(mReturnPipe[0],&ptr, sizeof(ptr))) == -1)
+ {
+ logError("CAmSerializer::receiverCallback could not read pipe!");
+ throw std::runtime_error("CAmSerializer Could not read pipe!");
+ }
+ //working with friend class here is not the finest of all programming stiles but it works...
+ retVal=p->returnResults(argument, argument1, argument2, argument3);
+ delete p;
+ }
+
+
void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)
{
(void) handle;
@@ -310,8 +662,8 @@ public:
(void) userData;
CAmDelegagePtr delegatePoiter = mListDelegatePoiters.front();
mListDelegatePoiters.pop_front();
- delegatePoiter->call();
- delete delegatePoiter;
+ if(delegatePoiter->call(mReturnPipe))
+ delete delegatePoiter;
if (mListDelegatePoiters.empty())
return false;
return true;
@@ -338,13 +690,19 @@ public:
throw std::runtime_error("CAmSerializer Could not open pipe!");
}
+ if (pipe(mReturnPipe) == -1)
+ {
+ logError("CAmSerializer could not create mReturnPipe!");
+ throw std::runtime_error("CAmSerializer Could not open mReturnPipe!");
+ }
+
short event = 0;
sh_pollHandle_t handle;
event |= POLLIN;
iSocketHandler->addFDPoll(mPipe[0], event, NULL, &receiverCallbackT, NULL, &dispatcherCallbackT, NULL, handle);
}
- virtual ~CAmSerializer(){}
+ ~CAmSerializer(){}
};
} /* namespace am */
#endif /* CAMSERIALIZER_H_ */
diff --git a/includes/audiomanagertypes.h b/includes/audiomanagertypes.h
index 2d9b883..a489720 100644
--- a/includes/audiomanagertypes.h
+++ b/includes/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_5B7FFAAE_6D10_4b76_8E0F_E8060678C777__INCLUDED_)
-#define EA_5B7FFAAE_6D10_4b76_8E0F_E8060678C777__INCLUDED_
+#if !defined(EA_20D4CA94_946F_4462_BD28_0ABEC8125573__INCLUDED_)
+#define EA_20D4CA94_946F_4462_BD28_0ABEC8125573__INCLUDED_
#include <stdint.h>
#include "projecttypes.h"
@@ -31,63 +31,63 @@ namespace am {
/**
* a domain ID
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:27 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_domainID_t;
/**
* a source ID
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:27 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_sourceID_t;
/**
* a sink ID
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:27 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_sinkID_t;
/**
* a gateway ID
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:27 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_gatewayID_t;
/**
* a crossfader ID
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_crossfaderID_t;
/**
* a connection ID
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_connectionID_t;
/**
* a mainConnection ID
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_mainConnectionID_t;
/**
* speed
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 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 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 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 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef int16_t am_mainVolume_t;
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_sourceClass_t;
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_sinkClass_t;
/**
* time in ms!
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
typedef uint16_t am_time_t;
/**
* offset time that is introduced in milli seconds.
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 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 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
enum am_Availablility_e
{
@@ -150,7 +150,7 @@ namespace am {
/**
* represents the connection state
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
enum am_ConnectionState_e
{
@@ -180,7 +180,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
enum am_DomainState_e
{
@@ -206,7 +206,7 @@ namespace am {
/**
* This enum characterizes the data of the EarlyData_t
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 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 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
enum am_Error_e
{
@@ -289,7 +289,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
enum am_MuteState_e
{
@@ -311,7 +311,7 @@ namespace am {
/**
* The source state reflects the state of the source
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 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 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
enum am_Handle_e
{
@@ -354,7 +354,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
enum am_InterruptState_e
{
@@ -376,7 +376,7 @@ namespace am {
/**
* describes the active sink of a crossfader.
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 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 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
struct am_Availability_s
{
@@ -421,7 +421,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:25 PM
*/
struct am_ClassProperty_s
{
@@ -434,7 +434,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:26 PM
*/
struct am_Crossfader_s
{
@@ -451,7 +451,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:26 PM
*/
struct am_Gateway_s
{
@@ -491,7 +491,7 @@ namespace am {
/**
* This represents one "hopp" in a route
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:28 PM
+ * @created 29-Feb-2012 12:54:26 PM
*/
struct am_RoutingElement_s
{
@@ -506,7 +506,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:29 PM
+ * @created 29-Feb-2012 12:54:26 PM
*/
struct am_Route_s
{
@@ -520,7 +520,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:29 PM
+ * @created 29-Feb-2012 12:54:26 PM
*/
struct am_SoundProperty_s
{
@@ -533,7 +533,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:29 PM
+ * @created 29-Feb-2012 12:54:26 PM
*/
struct am_SystemProperty_s
{
@@ -552,7 +552,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:29 PM
+ * @created 29-Feb-2012 12:54:26 PM
*/
struct am_SinkClass_s
{
@@ -566,7 +566,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:29 PM
+ * @created 29-Feb-2012 12:54:27 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 27-Feb-2012 6:57:29 PM
+ * @created 29-Feb-2012 12:54:27 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 27-Feb-2012 6:57:29 PM
+ * @created 29-Feb-2012 12:54:27 PM
*/
struct am_SinkType_s
{
@@ -617,7 +617,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:29 PM
+ * @created 29-Feb-2012 12:54:27 PM
*/
struct am_Handle_s
{
@@ -630,7 +630,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:30 PM
+ * @created 29-Feb-2012 12:54:27 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 27-Feb-2012 6:57:30 PM
+ * @created 29-Feb-2012 12:54:27 PM
*/
struct am_MainConnectionType_s
{
@@ -660,7 +660,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:30 PM
+ * @created 29-Feb-2012 12:54:27 PM
*/
struct am_MainConnection_s
{
@@ -683,7 +683,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:30 PM
+ * @created 29-Feb-2012 12:54:27 PM
*/
struct am_Sink_s
{
@@ -706,7 +706,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:30 PM
+ * @created 29-Feb-2012 12:54:28 PM
*/
struct am_Source_s
{
@@ -738,7 +738,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:30 PM
+ * @created 29-Feb-2012 12:54:28 PM
*/
struct am_Domain_s
{
@@ -756,7 +756,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:28 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 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:28 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 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:28 PM
*/
union am_DataType_u
{
@@ -804,7 +804,7 @@ namespace am {
/**
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:28 PM
*/
struct am_EarlyData_s
{
@@ -816,4 +816,4 @@ namespace am {
};
}
-#endif // !defined(EA_5B7FFAAE_6D10_4b76_8E0F_E8060678C777__INCLUDED_)
+#endif // !defined(EA_20D4CA94_946F_4462_BD28_0ABEC8125573__INCLUDED_)
diff --git a/includes/command/CommandReceiveInterface.h b/includes/command/CommandReceiveInterface.h
index 2e79f44..4190fa8 100644
--- a/includes/command/CommandReceiveInterface.h
+++ b/includes/command/CommandReceiveInterface.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_7F5A2204_92A2_4006_80F8_099931A426CE__INCLUDED_)
-#define EA_7F5A2204_92A2_4006_80F8_099931A426CE__INCLUDED_
+#if !defined(EA_76AA566B_CDC8_4c91_A89E_BB68E32CC6D1__INCLUDED_)
+#define EA_76AA566B_CDC8_4c91_A89E_BB68E32CC6D1__INCLUDED_
#include <vector>
#include <string>
@@ -39,7 +39,7 @@ 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 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:29 PM
*/
class CommandReceiveInterface
{
@@ -217,4 +217,4 @@ namespace am {
};
}
-#endif // !defined(EA_7F5A2204_92A2_4006_80F8_099931A426CE__INCLUDED_)
+#endif // !defined(EA_76AA566B_CDC8_4c91_A89E_BB68E32CC6D1__INCLUDED_)
diff --git a/includes/command/CommandSendInterface.h b/includes/command/CommandSendInterface.h
index e5135df..70cf3cc 100644
--- a/includes/command/CommandSendInterface.h
+++ b/includes/command/CommandSendInterface.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_78C60EC5_4114_41a8_BE01_4911668CE1C1__INCLUDED_)
-#define EA_78C60EC5_4114_41a8_BE01_4911668CE1C1__INCLUDED_
+#if !defined(EA_AE49449C_9BE2_428f_82B5_7BD27DBBFCF2__INCLUDED_)
+#define EA_AE49449C_9BE2_428f_82B5_7BD27DBBFCF2__INCLUDED_
#include <vector>
#include <string>
@@ -40,7 +40,7 @@ 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 27-Feb-2012 6:57:32 PM
+ * @created 29-Feb-2012 12:54:29 PM
*/
class CommandSendInterface
{
@@ -191,4 +191,4 @@ namespace am {
};
}
-#endif // !defined(EA_78C60EC5_4114_41a8_BE01_4911668CE1C1__INCLUDED_)
+#endif // !defined(EA_AE49449C_9BE2_428f_82B5_7BD27DBBFCF2__INCLUDED_)
diff --git a/includes/control/ControlReceiveInterface.h b/includes/control/ControlReceiveInterface.h
index 35bf977..94a0258 100644
--- a/includes/control/ControlReceiveInterface.h
+++ b/includes/control/ControlReceiveInterface.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_4782C934_9728_44b7_8F9A_D8FB838CF1A7__INCLUDED_)
-#define EA_4782C934_9728_44b7_8F9A_D8FB838CF1A7__INCLUDED_
+#if !defined(EA_CCBD8A91_5C9B_49d1_88D8_69215A0542F8__INCLUDED_)
+#define EA_CCBD8A91_5C9B_49d1_88D8_69215A0542F8__INCLUDED_
#include <vector>
#include <string>
@@ -38,7 +38,7 @@ 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 27-Feb-2012 6:57:32 PM
+ * @created 29-Feb-2012 12:54:29 PM
*/
class ControlReceiveInterface
{
@@ -611,4 +611,4 @@ namespace am {
};
}
-#endif // !defined(EA_4782C934_9728_44b7_8F9A_D8FB838CF1A7__INCLUDED_)
+#endif // !defined(EA_CCBD8A91_5C9B_49d1_88D8_69215A0542F8__INCLUDED_)
diff --git a/includes/control/ControlSendInterface.h b/includes/control/ControlSendInterface.h
index 4857dd0..2d706a2 100644
--- a/includes/control/ControlSendInterface.h
+++ b/includes/control/ControlSendInterface.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_453737DF_D0F3_4dda_8960_2B6C2FE2297F__INCLUDED_)
-#define EA_453737DF_D0F3_4dda_8960_2B6C2FE2297F__INCLUDED_
+#if !defined(EA_3F77CFC8_1A30_4d2d_88FD_3E946AA5AB38__INCLUDED_)
+#define EA_3F77CFC8_1A30_4d2d_88FD_3E946AA5AB38__INCLUDED_
#include <vector>
#include <string>
@@ -39,7 +39,7 @@ 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 27-Feb-2012 6:57:33 PM
+ * @created 29-Feb-2012 12:54:30 PM
*/
class ControlSendInterface
{
@@ -385,4 +385,4 @@ namespace am {
};
}
-#endif // !defined(EA_453737DF_D0F3_4dda_8960_2B6C2FE2297F__INCLUDED_)
+#endif // !defined(EA_3F77CFC8_1A30_4d2d_88FD_3E946AA5AB38__INCLUDED_)
diff --git a/includes/projecttypes.h b/includes/projecttypes.h
index b480070..a8f48a7 100644
--- a/includes/projecttypes.h
+++ b/includes/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_2597AEAA_55EC_440a_8189_04DF7389A1AD__INCLUDED_)
-#define EA_2597AEAA_55EC_440a_8189_04DF7389A1AD__INCLUDED_
+#if !defined(EA_D85F87B8_62E9_4a72_9BF7_3DCA2B6559EA__INCLUDED_)
+#define EA_D85F87B8_62E9_4a72_9BF7_3DCA2B6559EA__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 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:29 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 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:29 PM
*/
enum am_AvailabilityReason_e
{
@@ -92,7 +92,7 @@ namespace am {
/**
* product specific identifier of property
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:29 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 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:29 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 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:29 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 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:29 PM
*/
enum am_MainSoundPropertyType_e
{
@@ -189,7 +189,7 @@ namespace am {
/**
* describes the different system properties. Project specific
* @author Christian Mueller
- * @created 27-Feb-2012 6:57:31 PM
+ * @created 29-Feb-2012 12:54:29 PM
*/
enum am_SystemPropertyType_e
{
@@ -200,4 +200,4 @@ namespace am {
SYP_MAX
};
}
-#endif // !defined(EA_2597AEAA_55EC_440a_8189_04DF7389A1AD__INCLUDED_)
+#endif // !defined(EA_D85F87B8_62E9_4a72_9BF7_3DCA2B6559EA__INCLUDED_)
diff --git a/includes/routing/RoutingReceiveInterface.h b/includes/routing/RoutingReceiveInterface.h
index b9d6f34..f614fb3 100644
--- a/includes/routing/RoutingReceiveInterface.h
+++ b/includes/routing/RoutingReceiveInterface.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_1872FCAA_4ACA_4547_ABD0_F0CC01DE516C__INCLUDED_)
-#define EA_1872FCAA_4ACA_4547_ABD0_F0CC01DE516C__INCLUDED_
+#if !defined(EA_ACBA7B56_BAFE_481f_8DF3_0B1AB9AE1E8C__INCLUDED_)
+#define EA_ACBA7B56_BAFE_481f_8DF3_0B1AB9AE1E8C__INCLUDED_
#include <vector>
#include <string>
@@ -40,7 +40,7 @@ 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 27-Feb-2012 6:57:33 PM
+ * @created 29-Feb-2012 12:54:30 PM
*/
class RoutingReceiveInterface
{
@@ -335,14 +335,14 @@ namespace am {
*
* @param handle the handle that was given via setRoutingReady
*/
- virtual void confirmRoutingReady(const uint16_t handle) const =0;
+ virtual void confirmRoutingReady(const uint16_t handle) =0;
/**
* confirms the setRoutingRundown Command
*
* @param handle handle that was given via setRoutingRundown
*/
- virtual void confirmRoutingRundown(const uint16_t handle) const =0;
+ virtual void confirmRoutingRundown(const uint16_t handle) =0;
};
}
-#endif // !defined(EA_1872FCAA_4ACA_4547_ABD0_F0CC01DE516C__INCLUDED_)
+#endif // !defined(EA_ACBA7B56_BAFE_481f_8DF3_0B1AB9AE1E8C__INCLUDED_)
diff --git a/includes/routing/RoutingSendInterface.h b/includes/routing/RoutingSendInterface.h
index 0f07022..e2bd5c4 100644
--- a/includes/routing/RoutingSendInterface.h
+++ b/includes/routing/RoutingSendInterface.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_C3949186_203B_474d_AD8F_42D39FB00FFA__INCLUDED_)
-#define EA_C3949186_203B_474d_AD8F_42D39FB00FFA__INCLUDED_
+#if !defined(EA_337B4D34_644D_4faf_8A72_3253A0B4F5A0__INCLUDED_)
+#define EA_337B4D34_644D_4faf_8A72_3253A0B4F5A0__INCLUDED_
#include <vector>
#include <string>
@@ -40,7 +40,7 @@ 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 27-Feb-2012 6:57:33 PM
+ * @created 29-Feb-2012 12:54:31 PM
*/
class RoutingSendInterface
{
@@ -201,4 +201,4 @@ namespace am {
};
}
-#endif // !defined(EA_C3949186_203B_474d_AD8F_42D39FB00FFA__INCLUDED_)
+#endif // !defined(EA_337B4D34_644D_4faf_8A72_3253A0B4F5A0__INCLUDED_)