class DatabaseHandler;
class RoutingSender;
class CommandSender;
+class Router;
/**
* This class is used to receive all commands from the control interface
class ControlReceiver: public ControlReceiveInterface
{
public:
- ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler);
- ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender);
+ ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler, Router* iRouter);
+ ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, Router* iRouter);
virtual ~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);
RoutingSender* mRoutingSender; //!< pointer to the routing send interface.
CommandSender* mCommandSender; //!< pointer to the command send interface
SocketHandler* mSocketHandler; //!< pointer to the socketHandler
+ Router* mRouter; //!< pointer to the Router
};
}
virtual ~Router();
private:
- am_Error_e findBestWay(std::vector<am_RoutingElement_s>& listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator, int choiceNumber);
+ am_Error_e findBestWay(std::vector<am_RoutingElement_s>& listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator);
void listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e>& listFormats) const;
void listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e>& listFormats) const;
DatabaseHandler* mDatabaseHandler;
#include "DatabaseHandler.h"
#include "RoutingSender.h"
#include "CommandSender.h"
+#include "Router.h"
#include <assert.h>
#include <dlt/dlt.h>
using namespace am;
-ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler) :
+ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler, Router* iRouter) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
mCommandSender(iCommandSender), //
- mSocketHandler(iSocketHandler)
+ mSocketHandler(iSocketHandler), //
+ mRouter(iRouter)
{
assert(mDatabaseHandler!=NULL);
assert(mRoutingSender!=NULL);
assert(mCommandSender!=NULL);
assert(mSocketHandler!=NULL);
+ assert(mRouter!=NULL);
}
-ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender) :
+ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, Router* iRouter) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
- mCommandSender(iCommandSender)
+ mCommandSender(iCommandSender), //
+ mRouter(iRouter)
{
assert(mDatabaseHandler!=NULL);
assert(mRoutingSender!=NULL);
assert(mCommandSender!=NULL);
+ assert(mRouter!=NULL);
}
ControlReceiver::~ControlReceiver()
am_Error_e ControlReceiver::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
{
- //todo: implement routing algorithm
+ mRouter->getRoute(onlyfree,sourceID,sinkID,returnList);
return E_NOT_USED;
}
dbus_bool_t DBusWrapper::addWatchDelegate(DBusWatch * watch, void* userData)
{
+ (void) userData;
int16_t event = 0;
sh_pollHandle_t handle = 0;
uint flags = dbus_watch_get_flags(watch);
/* no watch flags for disabled watches */
if (dbus_watch_get_enabled(watch))
{
- if (flags & DBUS_WATCH_READABLE) event |= POLLIN;
- if (flags & DBUS_WATCH_WRITABLE) event |= POLLOUT;
+ if (flags & DBUS_WATCH_READABLE)
+ event |= POLLIN;
+ if (flags & DBUS_WATCH_WRITABLE)
+ event |= POLLOUT;
}
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::addWatchDelegate entered new watch, fd="), DLT_INT(dbus_watch_get_unix_fd(watch)), DLT_STRING("event flag="), DLT_INT(event));
mMapHandleWatch.insert(std::make_pair(watch, handle));
return true;
}DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::addWatchDelegate entering watch failed"));
+ return (true);
}
void DBusWrapper::removeWatch(DBusWatch *watch, void *userData)
void DBusWrapper::removeWatchDelegate(DBusWatch *watch, void *userData)
{
+ (void) userData;
std::map<DBusWatch*, sh_pollHandle_t>::iterator iterator = mMapHandleWatch.begin();
iterator = mMapHandleWatch.find(watch);
- if (iterator != mMapHandleWatch.end()) mSocketHandler->removeFDPoll(iterator->second);
+ if (iterator != mMapHandleWatch.end())
+ mSocketHandler->removeFDPoll(iterator->second);
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::removeWatch removed watch with handle"), DLT_INT(iterator->second));
mMapHandleWatch.erase(iterator);
}
void DBusWrapper::toogleWatchDelegate(DBusWatch *watch, void *userData)
{
+ (void) userData;
int16_t event = 0;
- int watchFD = dbus_watch_get_unix_fd(watch);
+ dbus_watch_get_unix_fd(watch);
uint flags = dbus_watch_get_flags(watch);
/* no watch flags for disabled watches */
if (dbus_watch_get_enabled(watch))
{
- if (flags & DBUS_WATCH_READABLE) event |= POLLIN;
- if (flags & DBUS_WATCH_WRITABLE) event |= POLLOUT;
+ if (flags & DBUS_WATCH_READABLE)
+ event |= POLLIN;
+ if (flags & DBUS_WATCH_WRITABLE)
+ event |= POLLOUT;
}
std::map<DBusWatch*, sh_pollHandle_t>::iterator iterator = mMapHandleWatch.begin();
iterator = mMapHandleWatch.find(watch);
- if (iterator != mMapHandleWatch.end()) mSocketHandler->updateEventFlags(iterator->second, event);
+ if (iterator != mMapHandleWatch.end())
+ mSocketHandler->updateEventFlags(iterator->second, event);
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::toogleWatchDelegate watch was toggeled"));
}
dbus_bool_t DBusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userData)
{
- if (!dbus_timeout_get_enabled(timeout)) return false;
+ if (!dbus_timeout_get_enabled(timeout))
+ return false;
//calculate the timeout in timeval
timespec pollTimeout;
void DBusWrapper::removeTimeoutDelegate(DBusTimeout *timeout, void* userData)
{
+ (void) userData;
//get the pointer to the handle and remove the timer
sh_timerHandle_t* handle = (sh_timerHandle_t*) dbus_timeout_get_data(timeout);
mSocketHandler->removeTimer(*handle);
bool am::DBusWrapper::dbusDispatchCallback(const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
bool returnVal = true;
dbus_connection_ref(mDbusConnection);
- if (dbus_connection_dispatch(mDbusConnection) == DBUS_DISPATCH_COMPLETE) returnVal = false;
+ if (dbus_connection_dispatch(mDbusConnection) == DBUS_DISPATCH_COMPLETE)
+ returnVal = false;
dbus_connection_unref(mDbusConnection);
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusDispatchCallback was called"));
return returnVal;
bool am::DBusWrapper::dbusCheckCallback(const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
bool returnVal = false;
dbus_connection_ref(mDbusConnection);
- if (dbus_connection_get_dispatch_status(mDbusConnection) == DBUS_DISPATCH_DATA_REMAINS) returnVal = true;
+ if (dbus_connection_get_dispatch_status(mDbusConnection) == DBUS_DISPATCH_DATA_REMAINS)
+ returnVal = true;
dbus_connection_unref(mDbusConnection);
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusCheckCallback was called"));
return returnVal;
void am::DBusWrapper::dbusFireCallback(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
assert(userData!=NULL);
uint flags = 0;
- if (pollfd.revents & POLLIN) flags |= DBUS_WATCH_READABLE;
- if (pollfd.revents & POLLOUT) flags |= DBUS_WATCH_WRITABLE;
- if (pollfd.revents & POLLHUP) flags |= DBUS_WATCH_HANGUP;
- if (pollfd.revents & POLLERR) flags |= DBUS_WATCH_ERROR;
+ if (pollfd.revents & POLLIN)
+ flags |= DBUS_WATCH_READABLE;
+ if (pollfd.revents & POLLOUT)
+ flags |= DBUS_WATCH_WRITABLE;
+ if (pollfd.revents & POLLHUP)
+ flags |= DBUS_WATCH_HANGUP;
+ if (pollfd.revents & POLLERR)
+ flags |= DBUS_WATCH_ERROR;
DBusWatch *watch = (DBusWatch*) userData;
dbus_connection_ref(mDbusConnection);
- bool ok = dbus_watch_handle(watch, flags);
+ dbus_watch_handle(watch, flags);
dbus_connection_unref(mDbusConnection);
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusFireCallback was called"));
}
void DBusWrapper::toggleTimeoutDelegate(DBusTimeout *timeout, void* userData)
{
+ (void) userData;
//get the pointer to the handle and remove the timer
sh_timerHandle_t* handle = (sh_timerHandle_t*) dbus_timeout_get_data(timeout);
am_Error_e am::DatabaseHandler::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
{
listConnectionFormats.clear();
- sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
+ sqlite3_stmt* qConnectionFormat = NULL;
int eCode = 0;
am_ConnectionFormat_e tempConnectionFormat;
}
//now we need to find all mainConnections that use the changed connection and update their timing
- am_timeSync_t tempDelay = 0;
- am_Error_e error;
int tempMainConnectionID;
//first get all route tables for all mainconnections
void DatabaseObserver::newGateway(am_Gateway_s gateway)
{
+ (void) gateway;
//todo: implement something
}
void DatabaseObserver::removeGateway(am_gatewayID_t gatewayID)
{
+ (void) gatewayID;
//todo: implement something
}
//Step through the routes and try to use always the best connectionFormat
std::vector<am_RoutingElement_s>::iterator routingInterator = actualRoutingElement.begin();
gatewayIterator = listGatewayID.begin();
- if (findBestWay(actualRoutingElement, routingInterator, gatewayIterator, 0) != E_OK)
+ if (findBestWay(actualRoutingElement, routingInterator, gatewayIterator) != E_OK)
+ {
continue;
+ }
//add the route to the list of routes...
actualRoute.sourceID = sourceID;
std::vector<am_ConnectionFormat_e>::iterator it = listSourceFormats.begin();
}
-am_Error_e Router::findBestWay(std::vector<am_RoutingElement_s> & listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator, int choiceNumber)
+am_Error_e Router::findBestWay(std::vector<am_RoutingElement_s> & listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator)
{
+ am_Error_e returnError = E_NOT_POSSIBLE;
std::vector<am_ConnectionFormat_e> listConnectionFormats;
+ std::vector<am_ConnectionFormat_e> listMergeConnectionFormats;
std::vector<am_ConnectionFormat_e> listPriorityConnectionFormats;
- //get best connection format for the first connection, now
+ std::vector<am_RoutingElement_s>::iterator nextIterator = routeIterator + 1;
+ //get best connection format
listPossibleConnectionFormats(routeIterator->sourceID, routeIterator->sinkID, listConnectionFormats);
- //if we get to the point that no choice makes sense, return ...
- if (choiceNumber >= (int) listConnectionFormats.size())
- return (E_NOT_POSSIBLE);
-
//if we have not just started, we need to take care about the gateways...
if (routeIterator != listRoute.begin())
{
//since we have to deal with Gateways, there are restrictions what connectionFormat we can take. So we need to take the subset of connections that are restricted:
std::vector<am_ConnectionFormat_e> listRestrictedConnectionFormats;
- std::insert_iterator<std::vector<am_ConnectionFormat_e> > inserter(listConnectionFormats, listConnectionFormats.begin());
+ std::insert_iterator<std::vector<am_ConnectionFormat_e> > inserter(listMergeConnectionFormats, listMergeConnectionFormats.begin());
std::vector<am_RoutingElement_s>::iterator tempIterator(routeIterator);
tempIterator--;
listRestrictedOutputFormatsGateways(*gatewayIterator, (tempIterator)->connectionFormat, listRestrictedConnectionFormats);
set_intersection(listConnectionFormats.begin(), listConnectionFormats.end(), listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end(), inserter);
gatewayIterator++;
}
+ else
+ {
+ listMergeConnectionFormats = listConnectionFormats;
+ }
//let the controller decide:
- mControlSender->getConnectionFormatChoice(routeIterator->sourceID, routeIterator->sinkID, listConnectionFormats, listPriorityConnectionFormats);
+ mControlSender->getConnectionFormatChoice(routeIterator->sourceID, routeIterator->sinkID, listMergeConnectionFormats, listPriorityConnectionFormats);
+
+ //we have the list sorted after prios - now we try one after the other with the next part of the route
+ std::vector<am_ConnectionFormat_e>::iterator connectionFormatIterator = listPriorityConnectionFormats.begin();
- //go back one step, if we cannot find a format and take the next best!
- if (listPriorityConnectionFormats.empty())
+ //here we need to check if we are at the end and stop
+ if (nextIterator == listRoute.end())
{
- findBestWay(listRoute, --routeIterator, --gatewayIterator, ++choiceNumber);
+ if (!listPriorityConnectionFormats.empty())
+ {
+ routeIterator->connectionFormat = listPriorityConnectionFormats.front();
+ return E_OK;
+ }
+ else
+ return E_NOT_POSSIBLE;
}
- routeIterator->connectionFormat = listPriorityConnectionFormats.at(choiceNumber);
-
- //ok, we are through and found a way, if not, take the next part of the route and start with toplevel
- if (routeIterator < listRoute.end())
+ for (; connectionFormatIterator != listPriorityConnectionFormats.end(); ++connectionFormatIterator)
{
- findBestWay(listRoute, ++routeIterator, gatewayIterator, 0);
+ routeIterator->connectionFormat = *connectionFormatIterator;
+ if ((returnError = findBestWay(listRoute, nextIterator, gatewayIterator)) == E_OK)
+ {
+ break;
+ }
}
- return (E_OK);
+
+ return (returnError);
}
void Router::listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e> & listFormats) const
am_Error_e RoutingReceiver::peekSinkClassID(const std::string name, const am_sinkClass_t& sinkClassID)
{
+ (void) name;
+ (void) sinkClassID;
//todo: implement
return E_NOT_USED;
}
am_Error_e RoutingReceiver::peekSourceClassID(const std::string name, const am_sourceClass_t& sourceClassID)
{
+ (void) name;
+ (void) sourceClassID;
//todo: implement
return E_NOT_USED;
}
handleData.soundPropery = soundProperty;
handle = createHandle(handleData, H_SETSINKSOUNDPROPERTY);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSinkSoundProperty(handle, soundProperty, sinkID);
+ return iter->second->asyncSetSinkSoundProperty(handle, sinkID, soundProperty);
return (E_NON_EXISTENT);
}
handleData.soundPropery = soundProperty;
handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTY);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceSoundProperty(handle, soundProperty, sourceID);
+ return iter->second->asyncSetSourceSoundProperty(handle, sourceID, soundProperty);
return (E_NON_EXISTENT);
}
handleData.soundProperties = new std::vector<am_SoundProperty_s>(listSoundProperties);
handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTIES);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceSoundProperties(handle, listSoundProperties, sourceID);
+ return iter->second->asyncSetSourceSoundProperties(handle, sourceID, listSoundProperties);
return (E_NON_EXISTENT);
}
handleData.soundProperties = new std::vector<am_SoundProperty_s>(listSoundProperties);
handle = createHandle(handleData, H_SETSINKSOUNDPROPERTIES);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSinkSoundProperties(handle, listSoundProperties, sinkID);
+ return iter->second->asyncSetSinkSoundProperties(handle, sinkID, listSoundProperties);
return (E_NON_EXISTENT);
}
void TelnetServer::connectSocket(const pollfd pfd, const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
//first, accept the connection, create a new filedescriptor
struct sockaddr answer;
socklen_t len = sizeof(answer);
void TelnetServer::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
+ (void)handle;
+ (void)userData;
//initialize buffer
char buffer[100];
//read until buffer is full or no more data is there
bool TelnetServer::dispatchData(const sh_pollHandle_t handle, void *userData)
{
+ (void)handle;
+ (void)userData;
std::vector<connection_s>::iterator iterator = mListConnections.begin();
for (; iterator != mListConnections.end(); ++iterator)
{
bool TelnetServer::check(const sh_pollHandle_t handle, void *userData)
{
+ (void)handle;
+ (void)userData;
if (msgList.size() != 0) return true;
return false;
}
//todo: there is a bug in the visible flags of sinks and sources. fix it.
//todo: make sure that iterators have a fixed end to prevent crashed while adding vectors while iterating on critical vectors
//todo: make sure all configurations are tested
+//todo: clean up startup sequences controller, command and routing interfaces----
#include <config.h>
#include <SocketHandler.h>
#ifdef WITH_DBUS_WRAPPER
std::string databasePath = std::string(":memory:");
unsigned int telnetport = DEFAULT_TELNETPORT;
unsigned int maxConnections = MAX_TELNETCONNECTIONS;
+int fd0, fd1, fd2;
void daemonize()
{
close(i);
}
- int fd0 = open("/dev/null", O_RDONLY);
- int fd1 = open("/dev/null", O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
- int fd2 = open("/dev/null", O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
+ fd0 = open("/dev/null", O_RDONLY);
+ fd1 = open("/dev/null", O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
+ fd2 = open("/dev/null", O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
if (fd0 != STDIN_FILENO || fd1 != STDOUT_FILENO || fd2 != STDERR_FILENO)
{
RoutingSender iRoutingSender(listRoutingPluginDirs);
CommandSender iCommandSender(listCommandPluginDirs);
ControlSender iControlSender(controllerPlugin);
+ Router iRouter(&iDatabaseHandler, &iControlSender);
#ifdef WITH_DBUS_WRAPPER
#ifdef WITH_SOCKETHANDLER_LOOP
CommandReceiver iCommandReceiver(&iDatabaseHandler, &iControlSender, &iSocketHandler, &iDBusWrapper);
RoutingReceiver iRoutingReceiver(&iDatabaseHandler, &iRoutingSender, &iControlSender, &iSocketHandler, &iDBusWrapper);
- ControlReceiver iControlReceiver(&iDatabaseHandler, &iRoutingSender, &iCommandSender, &iSocketHandler);
+ ControlReceiver iControlReceiver(&iDatabaseHandler, &iRoutingSender, &iCommandSender, &iSocketHandler, &iRouter);
#ifdef WITH_TELNET
TelnetServer iTelnetServer(&iSocketHandler,&iCommandSender,&iCommandReceiver,&iRoutingSender,&iRoutingReceiver,&iControlSender,&iControlReceiver,&iDatabaseHandler,telnetport,maxConnections);
#endif
#else /*WITH_SOCKETHANDLER_LOOP */
CommandReceiver iCommandReceiver(&iDatabaseHandler,&iControlSender,&iDBusWrapper);
RoutingReceiver iRoutingReceiver(&iDatabaseHandler,&iRoutingSender,&iControlSender,&iDBusWrapper);
- ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender);
+ ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender, &iRouter);
#endif /*WITH_SOCKETHANDLER_LOOP*/
#else /*WITH_DBUS_WRAPPER*/
CommandReceiver iCommandReceiver(&iDatabaseHandler,&iControlSender,&iSocketHandler);
RoutingReceiver iRoutingReceiver(&iDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
- ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler);
+ ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
#ifdef WITH_TELNET
TelnetServer iTelnetServer(&iSocketHandler,telnetport,maxConnections);
#endif
DatabaseObserver iObserver(&iCommandSender, &iRoutingSender);
#endif
- Router iRouter(&iDatabaseHandler,&iControlSender);
-
//since the plugins have been loaded by the *Senders before, we can tell the Controller this:
iControlSender.hookAllPluginsLoaded();
#endif/*WITH_SIMPLEDBUS_LOOP*/
#endif /*WITH_DBUS_WRAPPER*/
+ close(fd0);
+ close(fd1);
+ close(fd2);
exit(0);
}
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 std::vector<am_SoundProperty_s>& listSoundProperties, const am_sinkID_t sinkID));
+ 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_SoundProperty_s& soundProperty, const am_sinkID_t sinkID));
+ 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 std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID));
+ 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_SoundProperty_s& soundProperty, const am_sourceID_t sourceID));
+ 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,
};
+
class MockControlSendInterface : public ControlSendInterface {
public:
MOCK_METHOD1(startupController,
pCommandSender(plistCommandPluginDirs), //
pMockControlInterface(), //
pMockRoutingInterface(), //
- pControlSender(std::string("")), //
pRoutingInterfaceBackdoor(), //
pCommandInterfaceBackdoor(), //
pControlInterfaceBackdoor(), //
+ pControlSender(std::string("")), //
+ pRouter(&pDatabaseHandler,&pControlSender), //
pDatabaseObserver(&pCommandSender, &pRoutingSender), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender,&pRouter), //
pRoutingReceiver(&pDatabaseHandler, &pRoutingSender, &pControlSender, pDBusWrapper)
{
pDatabaseHandler.registerObserver(&pDatabaseObserver);
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
//change the soundproperty, expect a call on the routinginterface
- EXPECT_CALL(pMockRoutingInterface,asyncSetSinkSoundProperty(_,_,2)).WillOnce(Return(E_OK));
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSinkSoundProperty(_,2,_)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK, pControlReceiver.setSinkSoundProperty(handle,sink.sinkID,soundProperty));
//check the list of handles. The handle must be in there and have the right type
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
//we trigger the change and wait for a call on the routinginterface
- EXPECT_CALL(pMockRoutingInterface,asyncSetSourceSoundProperty(_,_,2)).WillOnce(Return(E_OK));
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSourceSoundProperty(_,2,_)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK, pControlReceiver.setSourceSoundProperty(handle,source.sourceID,soundProperty));
//check the list of handles. The handle must be in there and have the right type
#include "DatabaseObserver.h"
#include "ControlSender.h"
#include "RoutingSender.h"
+#include "Router.h"
#include "../RoutingInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../ControlInterfaceBackdoor.h"
CommandSender pCommandSender;
MockControlSendInterface pMockControlInterface;
MockRoutingSendInterface pMockRoutingInterface;
- ControlSender pControlSender;
RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
CommandInterfaceBackdoor pCommandInterfaceBackdoor;
ControlInterfaceBackdoor pControlInterfaceBackdoor;
+ ControlSender pControlSender;
+ Router pRouter;
DatabaseObserver pDatabaseObserver;
ControlReceiver pControlReceiver;
RoutingReceiver pRoutingReceiver;
MOCK_METHOD1(cbSystemPropertyChanged,
void(const am_SystemProperty_s& systemProperty));
MOCK_METHOD2(cbTimingInformationChanged,
- void (const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID));
+ void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
MOCK_CONST_METHOD0(getInterfaceVersion,
uint16_t());
-
};
pMockInterface(), //
pRoutingInterfaceBackdoor(), //
pCommandInterfaceBackdoor(), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
+ pControlSender(""),//
+ pRouter(&pDatabaseHandler,&pControlSender), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
pObserver(&pCommandSender, &pRoutingSender)
{
pDatabaseHandler.registerObserver(&pObserver);
#include "ControlSender.h"
#include "DatabaseObserver.h"
#include "RoutingSender.h"
+#include "Router.h"
+#include "ControlSender.h"
#include "../ControlInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
MockCommandSendInterface pMockInterface;
RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
CommandInterfaceBackdoor pCommandInterfaceBackdoor;
+ ControlSender pControlSender;
+ Router pRouter;
ControlReceiver pControlReceiver;
DatabaseObserver pObserver;
CommonFunctions pCF;
MOCK_METHOD1(cbSystemPropertyChanged,
void(const am_SystemProperty_s& systemProperty));
MOCK_METHOD2(cbTimingInformationChanged,
- void(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID));
+ void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
MOCK_CONST_METHOD0(getInterfaceVersion,
uint16_t());
};
#include "ControlReceiver.h"
#include "ControlSender.h"
#include "DatabaseObserver.h"
+#include "Router.h"
#include "../ControlInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
DLT_DECLARE_CONTEXT(DLT_CONTEXT)
-//extern int GetRandomNumber(int nLow, int nHigh);
-//extern bool equalSoundProperty (const am_SoundProperty_s a, const am_SoundProperty_s b);
-extern bool equalMainSoundProperty(const am_MainSoundProperty_s a, const am_MainSoundProperty_s b);
-extern bool equalRoutingElement(const am_RoutingElement_s a, const am_RoutingElement_s b);
-extern bool equalClassProperties(const am_ClassProperty_s a, const am_ClassProperty_s b);
-extern std::string int2string(int i);
-
routingTest::routingTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
pRoutingInterfaceBackdoor(), //
pCommandInterfaceBackdoor(), //
pControlInterfaceBackdoor(), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
pObserver(&pCommandSender, &pRoutingSender)
{
pDatabaseHandler.registerObserver(&pObserver);
arg3=arg2;
}
-
-
-//test that checks just 2 domains, one sink one source with only one connection format each
-TEST_F(routingTest,simpleRoute2Domains)
+//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(2);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(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
- am_Domain_s domain1, domain2;
- am_domainID_t domainID1, domainID2;
+ am_Domain_s domain1, domain2, domain3;
+ am_domainID_t domainID1, domainID2, domainID3;
domain1.domainID = 0;
domain1.name = "domain1";
domain2.name = "domain2";
domain2.busname = "domain2bus";
domain2.state = DS_CONTROLLED;
+ domain3.domainID = 0;
+ domain3.name = "domain3";
+ domain3.busname = "domain3bus";
+ domain3.state = DS_CONTROLLED;
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain3,domainID3));
- am_Source_s source, gwSource;
- am_sourceID_t sourceID, gwSourceID;
+ am_Source_s source, gwSource, gwSource1;
+ am_sourceID_t sourceID, gwSourceID, gwSourceID1;
source.domainID = domainID1;
source.name = "source1";
source.sourceState = SS_ON;
source.sourceID = 0;
source.sourceClassID = 5;
- source.listConnectionFormats.push_back(CF_ANALOG);
+ source.listConnectionFormats.push_back(CF_MONO);
gwSource.domainID = domainID2;
gwSource.name = "gwsource1";
gwSource.sourceState = SS_ON;
gwSource.sourceID = 0;
gwSource.sourceClassID = 5;
- gwSource.listConnectionFormats.push_back(CF_MONO);
+ gwSource.listConnectionFormats.push_back(CF_ANALOG);
+
+ gwSource1.domainID = domainID3;
+ gwSource1.name = "gwsource2";
+ gwSource1.sourceState = SS_ON;
+ gwSource1.sourceID = 0;
+ gwSource1.sourceClassID = 5;
+ gwSource1.listConnectionFormats.push_back(CF_MONO);
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource1,gwSourceID1));
- am_Sink_s sink, gwSink;
- am_sinkID_t sinkID, gwSinkID;
+ am_Sink_s sink, gwSink, gwSink1;
+ am_sinkID_t sinkID, gwSinkID, gwSinkID1;
- sink.domainID = domainID2;
+ sink.domainID = domainID3;
sink.name = "sink1";
sink.sinkID = 0;
sink.sinkClassID = 5;
sink.muteState = MS_MUTED;
- sink.listConnectionFormats.push_back(CF_MONO);
+ sink.listConnectionFormats.push_back(CF_STEREO);
gwSink.domainID = domainID1;
gwSink.name = "gwSink";
gwSink.sinkID = 0;
gwSink.sinkClassID = 5;
gwSink.muteState = MS_MUTED;
- gwSink.listConnectionFormats.push_back(CF_ANALOG);
+ gwSink.listConnectionFormats.push_back(CF_MONO);
+
+ gwSink1.domainID = domainID2;
+ gwSink1.name = "gwSink1";
+ gwSink1.sinkID = 0;
+ gwSink1.sinkClassID = 5;
+ gwSink1.muteState = MS_MUTED;
+ gwSink1.listConnectionFormats.push_back(CF_ANALOG);
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink1,gwSinkID1));
- am_Gateway_s gateway;
- am_gatewayID_t gatewayID;
+ am_Gateway_s gateway, gateway1;
+ am_gatewayID_t gatewayID, gatewayID1;
gateway.controlDomainID = domainID1;
gateway.gatewayID = 0;
gateway.convertionMatrix.push_back(true);
gateway.name = "gateway";
+ gateway1.controlDomainID = domainID2;
+ gateway1.gatewayID = 0;
+ gateway1.sinkID = gwSinkID1;
+ gateway1.sourceID = gwSourceID1;
+ gateway1.domainSourceID = domainID3;
+ gateway1.domainSinkID = domainID2;
+ gateway1.listSinkFormats = gwSink1.listConnectionFormats;
+ gateway1.listSourceFormats = gwSource1.listConnectionFormats;
+ gateway1.convertionMatrix.push_back(true);
+ gateway1.name = "gateway";
+
ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1));
std::vector<am_Route_s> listRoutes;
std::vector<am_RoutingElement_s> listRoutingElements;
am_RoutingElement_s hopp1;
am_RoutingElement_s hopp2;
+ am_RoutingElement_s hopp3;
- hopp1.sinkID = gwSinkID;
hopp1.sourceID = sourceID;
+ hopp1.sinkID = gwSinkID;
hopp1.domainID = domainID1;
hopp1.connectionFormat = source.listConnectionFormats[0];
- hopp2.sinkID = sinkID;
hopp2.sourceID = gwSourceID;
+ hopp2.sinkID = gwSinkID1;
hopp2.domainID = domainID2;
- hopp2.connectionFormat = sink.listConnectionFormats[0];
+ hopp2.connectionFormat = gwSink1.listConnectionFormats[0];
+
+ hopp3.sourceID = gwSourceID1;
+ hopp3.sinkID = sinkID;
+ hopp3.domainID = domainID3;
+ hopp3.connectionFormat = sink.listConnectionFormats[0];
listRoutingElements.push_back(hopp1);
listRoutingElements.push_back(hopp2);
+ listRoutingElements.push_back(hopp3);
am_Route_s compareRoute;
compareRoute.route = listRoutingElements;
compareRoute.sourceID = sourceID;
ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(1, listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
-
+ ASSERT_EQ(0, listRoutes.size());
}
-
-//test that checks just 2 domains, one sink one source but the connectionformat of source
-TEST_F(routingTest,simpleRoute2DomainsNoMatchConnectionFormats)
+//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);
source.sourceState = SS_ON;
source.sourceID = 0;
source.sourceClassID = 5;
- source.listConnectionFormats.push_back(CF_STEREO);
+ source.listConnectionFormats.push_back(CF_ANALOG);
gwSource.domainID = domainID2;
gwSource.name = "gwsource1";
compareRoute.sourceID = sourceID;
ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(0, listRoutes.size());
+ ASSERT_EQ(1, listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+
}
-//test that checks 3 domains, one sink one source.
-TEST_F(routingTest,simpleRoute3Domains)
+//test that checks just 2 domains, one sink one source but the connectionformat of source
+TEST_F(routingTest,simpleRoute2DomainsNoMatchConnectionFormats)
{
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+ 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
- am_Domain_s domain1, domain2, domain3;
- am_domainID_t domainID1, domainID2, domainID3;
+ am_Domain_s domain1, domain2;
+ am_domainID_t domainID1, domainID2;
domain1.domainID = 0;
domain1.name = "domain1";
domain2.name = "domain2";
domain2.busname = "domain2bus";
domain2.state = DS_CONTROLLED;
- domain3.domainID = 0;
- domain3.name = "domain3";
- domain3.busname = "domain3bus";
- domain3.state = DS_CONTROLLED;
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain3,domainID3));
- am_Source_s source, gwSource, gwSource1;
- am_sourceID_t sourceID, gwSourceID, gwSourceID1;
+ am_Source_s source, gwSource;
+ am_sourceID_t sourceID, gwSourceID;
source.domainID = domainID1;
source.name = "source1";
source.sourceState = SS_ON;
source.sourceID = 0;
source.sourceClassID = 5;
- source.listConnectionFormats.push_back(CF_MONO);
+ source.listConnectionFormats.push_back(CF_STEREO);
gwSource.domainID = domainID2;
gwSource.name = "gwsource1";
gwSource.sourceState = SS_ON;
gwSource.sourceID = 0;
gwSource.sourceClassID = 5;
- gwSource.listConnectionFormats.push_back(CF_ANALOG);
-
- gwSource1.domainID = domainID3;
- gwSource1.name = "gwsource2";
- gwSource1.sourceState = SS_ON;
- gwSource1.sourceID = 0;
- gwSource1.sourceClassID = 5;
- gwSource1.listConnectionFormats.push_back(CF_MONO);
+ gwSource.listConnectionFormats.push_back(CF_MONO);
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource1,gwSourceID1));
- am_Sink_s sink, gwSink, gwSink1;
- am_sinkID_t sinkID, gwSinkID, gwSinkID1;
+ am_Sink_s sink, gwSink;
+ am_sinkID_t sinkID, gwSinkID;
- sink.domainID = domainID3;
+ sink.domainID = domainID2;
sink.name = "sink1";
sink.sinkID = 0;
sink.sinkClassID = 5;
gwSink.sinkID = 0;
gwSink.sinkClassID = 5;
gwSink.muteState = MS_MUTED;
- gwSink.listConnectionFormats.push_back(CF_MONO);
-
- gwSink1.domainID = domainID2;
- gwSink1.name = "gwSink1";
- gwSink1.sinkID = 0;
- gwSink1.sinkClassID = 5;
- gwSink1.muteState = MS_MUTED;
- gwSink1.listConnectionFormats.push_back(CF_ANALOG);
+ gwSink.listConnectionFormats.push_back(CF_ANALOG);
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink1,gwSinkID1));
- am_Gateway_s gateway, gateway1;
- am_gatewayID_t gatewayID, gatewayID1;
+ am_Gateway_s gateway;
+ am_gatewayID_t gatewayID;
gateway.controlDomainID = domainID1;
gateway.gatewayID = 0;
gateway.convertionMatrix.push_back(true);
gateway.name = "gateway";
- gateway1.controlDomainID = domainID2;
- gateway1.gatewayID = 0;
- gateway1.sinkID = gwSinkID1;
- gateway1.sourceID = gwSourceID1;
- gateway1.domainSourceID = domainID3;
- gateway1.domainSinkID = domainID2;
- gateway1.listSinkFormats = gwSink1.listConnectionFormats;
- gateway1.listSourceFormats = gwSource1.listConnectionFormats;
- gateway1.convertionMatrix.push_back(true);
- gateway1.name = "gateway";
-
ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
- ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1));
std::vector<am_Route_s> listRoutes;
std::vector<am_RoutingElement_s> listRoutingElements;
am_RoutingElement_s hopp1;
am_RoutingElement_s hopp2;
- am_RoutingElement_s hopp3;
- hopp1.sourceID = sourceID;
hopp1.sinkID = gwSinkID;
+ hopp1.sourceID = sourceID;
hopp1.domainID = domainID1;
hopp1.connectionFormat = source.listConnectionFormats[0];
+ hopp2.sinkID = sinkID;
hopp2.sourceID = gwSourceID;
- hopp2.sinkID = gwSinkID1;
hopp2.domainID = domainID2;
- hopp2.connectionFormat = gwSink1.listConnectionFormats[0];
-
- hopp3.sourceID = gwSourceID1;
- hopp3.sinkID = sinkID;
- hopp3.domainID = domainID3;
- hopp3.connectionFormat = sink.listConnectionFormats[0];
+ hopp2.connectionFormat = sink.listConnectionFormats[0];
listRoutingElements.push_back(hopp1);
listRoutingElements.push_back(hopp2);
- listRoutingElements.push_back(hopp3);
am_Route_s compareRoute;
compareRoute.route = listRoutingElements;
compareRoute.sourceID = sourceID;
ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(1, listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ ASSERT_EQ(0, listRoutes.size());
}
-//test that checks 3 domains, one sink one source but the connectionformat of third domains do not fit.
-TEST_F(routingTest,simpleRoute3DomainsNoConnection)
+//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);
sink.sinkID = 0;
sink.sinkClassID = 5;
sink.muteState = MS_MUTED;
- sink.listConnectionFormats.push_back(CF_STEREO);
+ sink.listConnectionFormats.push_back(CF_MONO);
gwSink.domainID = domainID1;
gwSink.name = "gwSink";
compareRoute.sourceID = sourceID;
ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
- ASSERT_EQ(0, listRoutes.size());
+ ASSERT_EQ(1, listRoutes.size());
ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
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 std::vector<am_SoundProperty_s>& listSoundProperties, const am_sinkID_t sinkID));
+ 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_SoundProperty_s& soundProperty, const am_sinkID_t sinkID));
+ 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 std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID));
+ 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_SoundProperty_s& soundProperty, const am_sourceID_t sourceID));
+ 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,
MOCK_CONST_METHOD0(getInterfaceVersion,
uint16_t());
};
-
} // namespace am
using namespace am;
using namespace testing;
-DLT_DECLARE_CONTEXT(DLT_CONTEXT);
+DLT_DECLARE_CONTEXT(DLT_CONTEXT)
routingInterfaceTest::routingInterfaceTest() :
plistRoutingPluginDirs(), //
pDatabaseHandler(std::string(":memory:")), //
pRoutingSender(plistRoutingPluginDirs), //
pCommandSender(plistCommandPluginDirs), //
+ pControlSender(""), //
+ pRouter(&pDatabaseHandler, &pControlSender), //
pMockInterface(), //
pRoutingInterfaceBackdoor(), //
pCommandInterfaceBackdoor(), //
- pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
pObserver(&pCommandSender, &pRoutingSender)
{
pDatabaseHandler.registerObserver(&pObserver);
sink.listSoundProperties.push_back(soundProperty);
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- EXPECT_CALL(pMockInterface,asyncSetSinkSoundProperty(_,_,sinkID)).Times(0);
+ EXPECT_CALL(pMockInterface,asyncSetSinkSoundProperty(_,sinkID,_)).Times(0);
ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkSoundProperty(handle,sinkID,soundProperty));
}
source.domainID = 1;
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- EXPECT_CALL(pMockInterface,asyncSetSourceSoundProperty(_,_,sourceID)).WillOnce(Return(E_OK));
+ EXPECT_CALL(pMockInterface,asyncSetSourceSoundProperty(_,sourceID,_)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK, pControlReceiver.setSourceSoundProperty(handle,sourceID,soundProperty));
ASSERT_NE(handle.handle, 0);
ASSERT_EQ(handle.handleType, H_SETSOURCESOUNDPROPERTY);
sink.domainID = 1;
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- EXPECT_CALL(pMockInterface,asyncSetSinkSoundProperty(_,_,sinkID)).WillOnce(Return(E_OK));
+ EXPECT_CALL(pMockInterface,asyncSetSinkSoundProperty(_,sinkID,_)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK, pControlReceiver.setSinkSoundProperty(handle,sinkID,soundProperty));
ASSERT_NE(handle.handle, 0);
ASSERT_EQ(handle.handleType, H_SETSINKSOUNDPROPERTY);
#include "ControlReceiver.h"
#include "ControlSender.h"
#include "DatabaseObserver.h"
+#include "Router.h"
#include "../RoutingInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
DatabaseHandler pDatabaseHandler;
RoutingSender pRoutingSender;
CommandSender pCommandSender;
+ ControlSender pControlSender;
+ Router pRouter;
MockRoutingSendInterface pMockInterface;
RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
CommandInterfaceBackdoor pCommandInterfaceBackdoor;
DLT_DECLARE_CONTEXT(AudioManager)
-static volatile sig_atomic_t gDispatch = 1; //this global is used to stop the mainloop
-
sockethandlerTest::sockethandlerTest()
{
}
void am::timerCallBack::timer1Callback(sh_timerHandle_t handle, void* userData)
{
+ (void) handle;
+ (void) userData;
std::cout << "callback1 called" << std::endl;
timespec timeout;
timeout.tv_nsec = 0;
void am::timerCallBack::timer2Callback(sh_timerHandle_t handle, void* userData)
{
+ (void) handle;
+ (void) userData;
std::cout << "callback2 called" << std::endl;
timespec timeout;
timeout.tv_nsec = 0;
void am::timerCallBack::timer3Callback(sh_timerHandle_t, void* userData)
{
+ (void) userData;
std::cout << "callback3 called" << std::endl;
}
void am::timerCallBack::timer4Callback(sh_timerHandle_t, void* userData)
{
+ (void) userData;
std::cout << "callback4 called" << std::endl;
mSocketHandler->stop_listening();
}
void* playWithSocketServer(void* data)
{
+ (void) data;
SocketHandler myHandler;
SamplePlugin::sockType_e type = SamplePlugin::INET;
SamplePlugin myplugin(&myHandler, type);
myHandler.start_listenting();
+ return (NULL);
}
void* playWithUnixSocketServer(void* data)
{
+ (void) data;
SocketHandler myHandler;
SamplePlugin::sockType_e type = SamplePlugin::UNIX;
SamplePlugin myplugin(&myHandler, type);
myHandler.start_listenting();
+ return (NULL);
}
TEST(sockethandlerTest,playWithUNIXSockets)
{
pthread_t serverThread;
- char buffer[3000];
struct sockaddr_un servAddr;
int socket_;
TEST(sockethandlerTest,playWithSockets)
{
pthread_t serverThread;
- char buffer[3000];
struct sockaddr_in servAddr;
unsigned short servPort = 6060;
struct hostent *host;
if ((host = (struct hostent*) gethostbyname("localhost")) == 0)
{
std::cout << "ERROR: gethostbyname() failed\n" << std::endl;
-
+ exit(1);
}
memset(&servAddr, 0, sizeof(servAddr));
mReceiveHandle(), //
msgList()
{
- int ret;
int yes = 1;
int socketHandle;
void am::SamplePlugin::connectSocket(const pollfd pollfd1, const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
//first, accept the connection, create a new filedescriptor
std::cout << "Got a connection request !" << std::endl;
struct sockaddr answer;
void am::SamplePlugin::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
//initialize buffer
char buffer[10];
//read until buffer is full or no more data is there
bool am::SamplePlugin::dispatchData(const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
//read data from the queue
std::cout << "Data:" << msgList.front() << std::endl;
}
//remove the message from the queue and return false if there is no more message to read.
msgList.pop();
- if (msgList.size() != 0) return true;
+ if (msgList.size() != 0)
+ return true;
return false;
}
bool am::SamplePlugin::check(const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
//checks if there is data to dispatch
std::cout << "check!:" << std::endl;
- if (msgList.size() != 0) return true;
+ if (msgList.size() != 0)
+ return true;
return false;
}
+commit 002295bee9b1a4b4b97060458be4ab8d4cb43eda
+Author: christian mueller <christian.ei.mueller@bmw.de>
+
+ * regenerated EA code based on Conti Feedback.
+ * changed paths of audiomanagertypes include in generated files
+ * changed order of parameters in asyncSetSinkSoundProperty / asyncSetSourceSoundProperty / cbTimingInformationChanged to have common style over all interfaces.
+
+commit 93c6b1973d59ce225e9cb5d2bcaea7d01c5fda52
+Author: christian mueller <christian.ei.mueller@bmw.de>
+
+ * routing algorithm improvements
+ * routing algorithms first tests
+
+commit af0ba5b505b361679c07899187b7043d867742c3
+Author: christian mueller <christian.ei.mueller@bmw.de>
+
+ * finalized Router implementation
+ * added new generated ControlSendInterface with router support
+
commit 4fe50302a695c625d5161b538da771b2c36bd33e
Author: christian mueller <christian.ei.mueller@bmw.de>
OPTION( WITH_PLUGIN_ROUTING
"Build routing pluings" ON)
-OPTION( USE_BUILD_LIBS
- "Sets the default path to the libs that are compiled with the AudioManager together. If turned off, the default location will be the one of the install path" OFF)
-
OPTION( WITH_MAIN
"Build with daemon" ON)
ENDIF(WITH_DOCUMENTATION)
##global build flags set(CPACK_RPM_COMPONENT_INSTALL ON)
+#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -std=c++98 -D_GNU_SOURCE -pedantic -Wno-variadic-macros")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -std=c++98 -D_GNU_SOURCE")
if(WITH_PLUGIN_COMMAND)
void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume);
void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
void cbSystemPropertyChanged(const am_SystemProperty_s& SystemProperty);
- void cbTimingInformationChanged(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID);
+ void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
uint16_t getInterfaceVersion() const;
#ifdef UNIT_TEST
mDBUSMessageHandler.sendMessage();
}
-void am::DbusCommandSender::cbTimingInformationChanged(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID)
+void am::DbusCommandSender::cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
{
DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbTimingInformationChanged called, mainConnectionID"), DLT_INT16(mainConnectionID), DLT_STRING("time"), DLT_INT16(time));
{
DBusWrapper* wrap=(DBusWrapper*)wrapper;
wrap->dbusMainLoop();
+ return (NULL);
}
dbuscommandpluginInterfaceTest::dbuscommandpluginInterfaceTest()
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file dbuscommandinterfacesignalsTest.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 dbuscommandinterfacesignalsTest.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 "dbuscommaninterfacesignalsTest.h"
#include <iostream>
#include <fstream>
-#include <Python.h>
+#include <python2.6/Python.h>
#include "../include/DBusCommandSender.h"
#include "../include/DBusMessageHandler.h"
#include "DbusCommandInterfaceBackdoor.h"
dbuscommaninterfacesignalsTest::dbuscommaninterfacesignalsTest()
{
- DLT_REGISTER_APP("DPtest","RoutingInterfacetest");
- DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context");
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
+ DLT_REGISTER_APP("DPtest", "RoutingInterfacetest");
+ DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
}
dbuscommaninterfacesignalsTest::~dbuscommaninterfacesignalsTest()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
void* NumberOfMainConnectionsChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfMainConnectionsChanged();
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfMainConnectionsChanged();
+ return (NULL);
}
void* cbSinkAdded(void*)
{
- sleep(1);
- std::vector<am_SinkType_s> list;
- am_SinkType_s mysink;
- mysink.name="MySink";
- mysink.sinkID=23;
- mysink.availability.availability=A_MAX;
- mysink.availability.availabilityReason=AR_MIN;
- mysink.muteState=MS_MIN;
- mysink.sinkClassID=3;
- mysink.volume=234;
- list.push_back(mysink);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list),Return(E_OK)));
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSinksChanged();
+ sleep(1);
+ std::vector<am_SinkType_s> list;
+ am_SinkType_s mysink;
+ mysink.name = "MySink";
+ mysink.sinkID = 23;
+ mysink.availability.availability = A_MAX;
+ mysink.availability.availabilityReason = AR_MIN;
+ mysink.muteState = MS_MIN;
+ mysink.sinkClassID = 3;
+ mysink.volume = 234;
+ list.push_back(mysink);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSinksChanged();
+ return (NULL);
}
void* cbSourceAdded(void*)
{
- sleep(1);
- std::vector<am_SourceType_s> list;
- am_SourceType_s myource;
- myource.name="MySink";
- myource.sourceID=42;
- myource.availability.availability=A_MAX;
- myource.availability.availabilityReason=AR_MIN;
- myource.sourceClassID=15;
- list.push_back(myource);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list),Return(E_OK)));
- sender.cbNumberOfSourcesChanged();
+ sleep(1);
+ std::vector<am_SourceType_s> list;
+ am_SourceType_s myource;
+ myource.name = "MySink";
+ myource.sourceID = 42;
+ myource.availability.availability = A_MAX;
+ myource.availability.availabilityReason = AR_MIN;
+ myource.sourceClassID = 15;
+ list.push_back(myource);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
+ sender.cbNumberOfSourcesChanged();
+ return (NULL);
}
void* cbSourceRemoved(void*)
{
- sleep(1);
- std::vector<am_SourceType_s> list;
- am_SourceType_s myource;
- myource.name="MySink";
- myource.sourceID=42;
- myource.availability.availability=A_MAX;
- myource.availability.availabilityReason=AR_MIN;
- myource.sourceClassID=15;
- list.push_back(myource);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- backdoor.setListSources(&sender,list);
- DBusError error;
- dbus_error_init(&error);
- list.clear();
- EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list),Return(E_OK)));
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSourcesChanged();
+ sleep(1);
+ std::vector<am_SourceType_s> list;
+ am_SourceType_s myource;
+ myource.name = "MySink";
+ myource.sourceID = 42;
+ myource.availability.availability = A_MAX;
+ myource.availability.availabilityReason = AR_MIN;
+ myource.sourceClassID = 15;
+ list.push_back(myource);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ backdoor.setListSources(&sender, list);
+ DBusError error;
+ dbus_error_init(&error);
+ list.clear();
+ EXPECT_CALL(receiver,getListMainSources(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSourcesChanged();
+ return (NULL);
}
void* cbSinkRemoved(void*)
{
- sleep(1);
- std::vector<am_SinkType_s> list;
- am_SinkType_s mysink;
- mysink.name="MySink";
- mysink.sinkID=23;
- mysink.availability.availability=A_MAX;
- mysink.availability.availabilityReason=AR_MIN;
- mysink.muteState=MS_MIN;
- mysink.sinkClassID=3;
- mysink.volume=234;
- list.push_back(mysink);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- backdoor.setListSinks(&sender,list);
- DBusError error;
- dbus_error_init(&error);
- list.clear();
- EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list),Return(E_OK)));
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSinksChanged();
+ sleep(1);
+ std::vector<am_SinkType_s> list;
+ am_SinkType_s mysink;
+ mysink.name = "MySink";
+ mysink.sinkID = 23;
+ mysink.availability.availability = A_MAX;
+ mysink.availability.availabilityReason = AR_MIN;
+ mysink.muteState = MS_MIN;
+ mysink.sinkClassID = 3;
+ mysink.volume = 234;
+ list.push_back(mysink);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ backdoor.setListSinks(&sender, list);
+ DBusError error;
+ dbus_error_init(&error);
+ list.clear();
+ EXPECT_CALL(receiver,getListMainSinks(_)).WillOnce(DoAll(SetArgReferee<0>(list), Return(E_OK)));
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSinksChanged();
+ return (NULL);
}
void* NumberOfSinkClassesChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSinkClassesChanged();
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSinkClassesChanged();
+ return (NULL);
}
void* NumberOfSourceClassesChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbNumberOfSourceClassesChanged();
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbNumberOfSourceClassesChanged();
+ return (NULL);
}
-
void* MainConnectionStateChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_connectionID_t id=4;
- am_ConnectionState_e state=CS_CONNECTING;
- sender.cbMainConnectionStateChanged(id,state);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_connectionID_t id = 4;
+ am_ConnectionState_e state = CS_CONNECTING;
+ sender.cbMainConnectionStateChanged(id, state);
+ return (NULL);
}
void* MainSinkSoundPropertyChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_sinkID_t sinkID=3;
- am_MainSoundProperty_s soundProperty;
- soundProperty.type=MSP_TEST;
- soundProperty.value=23;
- sender.cbMainSinkSoundPropertyChanged(sinkID,soundProperty);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_sinkID_t sinkID = 3;
+ am_MainSoundProperty_s soundProperty;
+ soundProperty.type = MSP_TEST;
+ soundProperty.value = 23;
+ sender.cbMainSinkSoundPropertyChanged(sinkID, soundProperty);
+ return (NULL);
}
void* MainSourceSoundPropertyChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_sourceID_t sourceID=35;
- am_MainSoundProperty_s soundProperty;
- soundProperty.type=MSP_TEST;
- soundProperty.value=233;
- sender.cbMainSourceSoundPropertyChanged(sourceID,soundProperty);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_sourceID_t sourceID = 35;
+ am_MainSoundProperty_s soundProperty;
+ soundProperty.type = MSP_TEST;
+ soundProperty.value = 233;
+ sender.cbMainSourceSoundPropertyChanged(sourceID, soundProperty);
+ return (NULL);
}
void* cbSinkAvailabilityChangedLoop(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_Availability_s av;
- av.availability=A_AVAILABLE;
- av.availabilityReason=AR_UNKNOWN;
- sender.cbSinkAvailabilityChanged(4,av);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_Availability_s av;
+ av.availability = A_AVAILABLE;
+ av.availabilityReason = AR_UNKNOWN;
+ sender.cbSinkAvailabilityChanged(4, av);
+ return (NULL);
}
void* VolumeChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_volume_t volume=344;
- sender.cbVolumeChanged(23,volume);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_volume_t volume = 344;
+ sender.cbVolumeChanged(23, volume);
+ return (NULL);
}
void* cbSourceAvailabilityChangedLoop(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_Availability_s av;
- av.availability=A_AVAILABLE;
- av.availabilityReason=AR_UNKNOWN;
- sender.cbSourceAvailabilityChanged(2,av);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_Availability_s av;
+ av.availability = A_AVAILABLE;
+ av.availabilityReason = AR_UNKNOWN;
+ sender.cbSourceAvailabilityChanged(2, av);
+ return (NULL);
}
void* SinkMuteStateChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbSinkMuteStateChanged(42,MS_MUTED);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbSinkMuteStateChanged(42, MS_MUTED);
+ return (NULL);
}
void* SystemPropertyChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- am_SystemProperty_s property;
- property.type=SYP_TEST;
- property.value=355;
- sender.cbSystemPropertyChanged(property);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ am_SystemProperty_s property;
+ property.type = SYP_TEST;
+ property.value = 355;
+ sender.cbSystemPropertyChanged(property);
+ return (NULL);
}
void* TimingInformationChanged(void*)
{
- sleep(1);
- DbusCommandSender sender;
- MockCommandReceiveInterface receiver;
- DbusCommandInterfaceBackdoor backdoor;
- backdoor.setReceiveInterface(&sender,&receiver);
- DBusError error;
- dbus_error_init(&error);
- DBusConnection* co=dbus_bus_get(DBUS_BUS_SESSION, &error);
- backdoor.setDbusConnection(&sender,co);
- sender.cbTimingInformationChanged(42,233);
+ sleep(1);
+ DbusCommandSender sender;
+ MockCommandReceiveInterface receiver;
+ DbusCommandInterfaceBackdoor backdoor;
+ backdoor.setReceiveInterface(&sender, &receiver);
+ DBusError error;
+ dbus_error_init(&error);
+ DBusConnection* co = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ backdoor.setDbusConnection(&sender, co);
+ sender.cbTimingInformationChanged(42, 233);
+ return (NULL);
}
TEST_F(dbuscommaninterfacesignalsTest,cbSourceAvailabilityChanged)
{
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_t pythonloop;
- pthread_create(&pythonloop,NULL,NumberOfMainConnectionsChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchsignal(*arg, **kwarg):\n"
- " print ('Caught NumberOfMainConnectionsChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchsignal, signal_name='NumberOfMainConnectionsChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- pthread_create(&pythonloop,NULL,cbSinkAdded,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkAdded(*arg, **karg):\n"
- " print ('Caught signal (in SinkAdded handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkAdded, signal_name='SinkAdded', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- std::ifstream ifs("/tmp/result.txt");
- std::string line;
- int lineCounter=0, result=0;
- while(std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(23), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.Int16(234), dbus.Int16(0), dbus.UInt16(3)), signature=None)"),0);
- }
- ifs.close();
-
- pthread_create(&pythonloop,NULL,cbSinkRemoved,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkRemoved(*arg, **karg):\n"
- " print ('Caught signal (in SinkRemoved handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkRemoved, signal_name='SinkRemoved', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,23);
- }
- ifs.close();
-
- pthread_create(&pythonloop,NULL,cbSourceAdded,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceAdded(*arg, **karg):\n"
- " print ('Caught signal (in SourceAdded handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceAdded, signal_name='SourceAdded', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(42), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.UInt16(15)), signature=None)"),0);
- }
- ifs.close();
-
-
- pthread_create(&pythonloop,NULL,cbSourceRemoved,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceRemoved(*arg, **karg):\n"
- " print ('Caught signal (in SinkRemoved handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceRemoved, signal_name='SourceRemoved', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,42);
- }
- ifs.close();
-
-
- pthread_create(&pythonloop,NULL,NumberOfSinkClassesChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchNumberOfSinkClassesChanged(*arg, **kwarg):\n"
- " print ('Caught catchNumberOfSinkClassesChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchNumberOfSinkClassesChanged, signal_name='NumberOfSinkClassesChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- pthread_create(&pythonloop,NULL,NumberOfSourceClassesChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def CatchNumberOfSourceClassesChanged(*arg, **kwarg):\n"
- " print ('Caught CatchNumberOfSourceClassesChanged') \n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(CatchNumberOfSourceClassesChanged, signal_name='NumberOfSourceClassesChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,MainConnectionStateChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainConnectionStateChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainConnectionStateChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainConnectionStateChanged, signal_name='MainConnectionStateChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,4);
- }
- else if (lineCounter==1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,CS_CONNECTING);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,MainSinkSoundPropertyChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainSinkSoundPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainSinkSoundPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainSinkSoundPropertyChanged, signal_name='MainSinkSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,3);
- }
- else if (lineCounter==1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(23)), signature=None)"),0);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,MainSourceSoundPropertyChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchMainSourceSoundPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchMainSourceSoundPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchMainSourceSoundPropertyChanged, signal_name='MainSourceSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,35);
- }
- else if (lineCounter==1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(233)), signature=None)"),0);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,cbSinkAvailabilityChangedLoop,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkAvailabilityChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSinkAvailabilityChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkAvailabilityChanged, signal_name='SinkAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,4);
- }
- else if (lineCounter==1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"),0);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,cbSourceAvailabilityChangedLoop,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSourceAvailability(*arg, **karg):\n"
- " print ('Caught signal (in catchSourceAvailability handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSourceAvailability, signal_name='SourceAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,2);
- }
- else if (lineCounter==1)
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"),0);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,VolumeChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchVolumeChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchVolumeChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchVolumeChanged, signal_name='VolumeChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,23);
- }
- else if (lineCounter==1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,344);
- }
- lineCounter++;
- }
- ifs.close();
-
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,SinkMuteStateChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSinkMuteStateChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSinkMuteStateChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSinkMuteStateChanged, signal_name='SinkMuteStateChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,42);
- }
- else if (lineCounter==1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,MS_MUTED);
- }
- lineCounter++;
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,SystemPropertyChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchSystemPropertyChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchSystemPropertyChanged handler) ') \n"
- " print (arg[0])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchSystemPropertyChanged, signal_name='SystemPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(355)), signature=None)"),0);
- }
- ifs.close();
-
- //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
- //so it is running in the main context and the signals are send from threads...
- pthread_create(&pythonloop,NULL,TimingInformationChanged,(void*)NULL);
- PyRun_SimpleStringFlags(
- "import sys\n"
- "import traceback\n"
- "import gobject\n"
- "import dbus\n"
- "import dbus.mainloop.glib\n"
- "loop = gobject.MainLoop()\n"
- "def catchTimingInformationChanged(*arg, **karg):\n"
- " print ('Caught signal (in catchTimingInformationChanged handler) ') \n"
- " print (arg[0])\n"
- " print (arg[1])\n"
- " f = open('/tmp/result.txt','w')\n"
- " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
- " f.close()\n"
- " loop.quit()\n"
- "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
- "bus = dbus.SessionBus()\n"
- "bus.add_signal_receiver(catchTimingInformationChanged, signal_name='TimingInformationChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
- "loop.run()\n",NULL);
- pthread_join(pythonloop,NULL);
-
- ifs.open("/tmp/result.txt");
- lineCounter=0;
- result=0;
- while(std::getline(ifs, line))
- {
- if(lineCounter==0)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,42);
- }
- else if (lineCounter==1)
- {
- std::stringstream(line) >> result;
- ASSERT_EQ(result,233);
- }
- lineCounter++;
- }
- ifs.close();
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_t pythonloop;
+ pthread_create(&pythonloop, NULL, NumberOfMainConnectionsChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchsignal(*arg, **kwarg):\n"
+ " print ('Caught NumberOfMainConnectionsChanged') \n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchsignal, signal_name='NumberOfMainConnectionsChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ pthread_create(&pythonloop, NULL, cbSinkAdded, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSinkAdded(*arg, **karg):\n"
+ " print ('Caught signal (in SinkAdded handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSinkAdded, signal_name='SinkAdded', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ std::ifstream ifs("/tmp/result.txt");
+ std::string line;
+ int lineCounter = 0, result = 0;
+ while (std::getline(ifs, line))
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(23), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.Int16(234), dbus.Int16(0), dbus.UInt16(3)), signature=None)"), 0);
+ }
+ ifs.close();
+
+ pthread_create(&pythonloop, NULL, cbSinkRemoved, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSinkRemoved(*arg, **karg):\n"
+ " print ('Caught signal (in SinkRemoved handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSinkRemoved, signal_name='SinkRemoved', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 23);
+ }
+ ifs.close();
+
+ pthread_create(&pythonloop, NULL, cbSourceAdded, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSourceAdded(*arg, **karg):\n"
+ " print ('Caught signal (in SourceAdded handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSourceAdded, signal_name='SourceAdded', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.UInt16(42), dbus.String(u'MySink'), dbus.Struct((dbus.Int16(3), dbus.Int16(0)), signature=None), dbus.UInt16(15)), signature=None)"), 0);
+ }
+ ifs.close();
+
+ pthread_create(&pythonloop, NULL, cbSourceRemoved, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSourceRemoved(*arg, **karg):\n"
+ " print ('Caught signal (in SinkRemoved handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSourceRemoved, signal_name='SourceRemoved', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 42);
+ }
+ ifs.close();
+
+ pthread_create(&pythonloop, NULL, NumberOfSinkClassesChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchNumberOfSinkClassesChanged(*arg, **kwarg):\n"
+ " print ('Caught catchNumberOfSinkClassesChanged') \n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchNumberOfSinkClassesChanged, signal_name='NumberOfSinkClassesChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ pthread_create(&pythonloop, NULL, NumberOfSourceClassesChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def CatchNumberOfSourceClassesChanged(*arg, **kwarg):\n"
+ " print ('Caught CatchNumberOfSourceClassesChanged') \n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(CatchNumberOfSourceClassesChanged, signal_name='NumberOfSourceClassesChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, MainConnectionStateChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchMainConnectionStateChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchMainConnectionStateChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchMainConnectionStateChanged, signal_name='MainConnectionStateChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 4);
+ }
+ else if (lineCounter == 1)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, CS_CONNECTING);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, MainSinkSoundPropertyChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchMainSinkSoundPropertyChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchMainSinkSoundPropertyChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchMainSinkSoundPropertyChanged, signal_name='MainSinkSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 3);
+ }
+ else if (lineCounter == 1)
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(23)), signature=None)"), 0);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, MainSourceSoundPropertyChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchMainSourceSoundPropertyChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchMainSourceSoundPropertyChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchMainSourceSoundPropertyChanged, signal_name='MainSourceSoundPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 35);
+ }
+ else if (lineCounter == 1)
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(1), dbus.Int16(233)), signature=None)"), 0);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, cbSinkAvailabilityChangedLoop, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSinkAvailabilityChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchSinkAvailabilityChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSinkAvailabilityChanged, signal_name='SinkAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 4);
+ }
+ else if (lineCounter == 1)
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"), 0);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, cbSourceAvailabilityChangedLoop, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSourceAvailability(*arg, **karg):\n"
+ " print ('Caught signal (in catchSourceAvailability handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSourceAvailability, signal_name='SourceAvailabilityChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 2);
+ }
+ else if (lineCounter == 1)
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(3)), signature=None)"), 0);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, VolumeChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchVolumeChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchVolumeChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchVolumeChanged, signal_name='VolumeChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 23);
+ }
+ else if (lineCounter == 1)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 344);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, SinkMuteStateChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSinkMuteStateChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchSinkMuteStateChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSinkMuteStateChanged, signal_name='SinkMuteStateChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 42);
+ }
+ else if (lineCounter == 1)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, MS_MUTED);
+ }
+ lineCounter++;
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, SystemPropertyChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchSystemPropertyChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchSystemPropertyChanged handler) ') \n"
+ " print (arg[0])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchSystemPropertyChanged, signal_name='SystemPropertyChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ ASSERT_EQ(line.compare("dbus.Struct((dbus.Int16(0), dbus.Int16(355)), signature=None)"), 0);
+ }
+ ifs.close();
+
+ //ok, now we want to test the signals. It did not work out that the python receiver worked in an own thread (as originally intended)
+ //so it is running in the main context and the signals are send from threads...
+ pthread_create(&pythonloop, NULL, TimingInformationChanged, (void*) NULL);
+ PyRun_SimpleStringFlags("import sys\n"
+ "import traceback\n"
+ "import gobject\n"
+ "import dbus\n"
+ "import dbus.mainloop.glib\n"
+ "loop = gobject.MainLoop()\n"
+ "def catchTimingInformationChanged(*arg, **karg):\n"
+ " print ('Caught signal (in catchTimingInformationChanged handler) ') \n"
+ " print (arg[0])\n"
+ " print (arg[1])\n"
+ " f = open('/tmp/result.txt','w')\n"
+ " f.write(str(arg[0]) + '\\n' + str (arg[1]));\n"
+ " f.close()\n"
+ " loop.quit()\n"
+ "dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n"
+ "bus = dbus.SessionBus()\n"
+ "bus.add_signal_receiver(catchTimingInformationChanged, signal_name='TimingInformationChanged', dbus_interface = 'org.genivi.audiomanager', message_keyword='dbus_message')\n"
+ "loop.run()\n", NULL);
+ pthread_join(pythonloop, NULL);
+
+ ifs.open("/tmp/result.txt");
+ lineCounter = 0;
+ result = 0;
+ while (std::getline(ifs, line))
+ {
+ if (lineCounter == 0)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 42);
+ }
+ else if (lineCounter == 1)
+ {
+ std::stringstream(line) >> result;
+ ASSERT_EQ(result, 233);
+ }
+ lineCounter++;
+ }
+ ifs.close();
}
-
-
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
void dbuscommaninterfacesignalsTest::SetUp()
{
- Py_Initialize();
+ Py_Initialize();
}
-
-
void dbuscommaninterfacesignalsTest::TearDown()
{
- Py_Finalize();
+ Py_Finalize();
}
-
-
-
-
-
am_Error_e ControlSenderPlugin::startupController(ControlReceiveInterface *controlreceiveinterface)
{
+ (void) controlreceiveinterface;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
+ (void) sourceID;
+ (void) sinkID;
+ (void) mainConnectionID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
{
+ (void) connectionID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
{
+ (void) sinkID;
+ (void) soundProperty;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
{
+ (void) sourceID;
+ (void) soundProperty;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookUserSetSystemProperty(const am_SystemProperty_s & property)
{
+ (void) property;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume)
{
+ (void) SinkID;
+ (void) newVolume;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment)
{
+ (void) SinkID;
+ (void) increment;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
+ (void) sinkID;
+ (void) muteState;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
+ (void) domainData;
+ (void) domainID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemDeregisterDomain(const am_domainID_t domainID)
{
+ (void) domainID;
return E_NOT_USED;
}
void ControlSenderPlugin::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
{
+ (void) domainID;
}
am_Error_e ControlSenderPlugin::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
+ (void) sinkID;
+ (void) sinkData;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemDeregisterSink(const am_sinkID_t sinkID)
{
+ (void) sinkID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
+ (void) sourceData;
+ (void) sourceID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemDeregisterSource(const am_sourceID_t sourceID)
{
+ (void) sourceID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
+ (void) gatewayData;
+ (void) gatewayID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
{
+ (void) gatewayID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
+ (void) crossfaderData;
+ (void) crossfaderID;
return E_NOT_USED;
}
am_Error_e ControlSenderPlugin::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
+ (void) crossfaderID;
return E_NOT_USED;
}
void ControlSenderPlugin::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
+ (void) handle;
+ (void) sinkID;
+ (void) volume;
}
void ControlSenderPlugin::hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
+ (void) handle;
+ (void) sourceID;
+ (void) volume;
}
void ControlSenderPlugin::hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
+ (void) sourceID;
+ (void) interruptState;
}
void ControlSenderPlugin::hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
+ (void) sinkID;
+ (void) availability;
}
void ControlSenderPlugin::hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
+ (void) sourceID;
+ (void) availability;
}
void ControlSenderPlugin::hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
{
+ (void) domainID;
+ (void) state;
}
void ControlSenderPlugin::hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> & data)
{
+ (void) data;
}
void ControlSenderPlugin::hookSystemSpeedChange(const am_speed_t speed)
{
-
+ (void) speed;
}
void ControlSenderPlugin::hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
{
-
+ (void) mainConnectionID;
+ (void) time;
}
void ControlSenderPlugin::cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
{
+ (void) handle;
+ (void) errorID;
}
void ControlSenderPlugin::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
{
+ (void) handle;
+ (void) errorID;
}
void ControlSenderPlugin::cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
{
+ (void) handle;
+ (void) hostsink;
+ (void) error;
}
void ControlSenderPlugin::cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
+ (void) error;
+ (void) volume;
+ (void) handle;
}
void ControlSenderPlugin::cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error)
{
+ (void) error;
+ (void) voulme;
+ (void) handle;
}
void ControlSenderPlugin::cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
+ (void) error;
+ (void) handle;
}
void ControlSenderPlugin::cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
+ (void) error;
+ (void) handle;
}
void ControlSenderPlugin::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
+ (void) error;
+ (void) handle;
}
void ControlSenderPlugin::cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
+ (void) error;
+ (void) handle;
}
void ControlSenderPlugin::cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
+ (void) error;
+ (void) handle;
}
am_Error_e ControlSenderPlugin::getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats)
{
+ (void) sourceID;
+ (void) sinkID;
listPrioConnectionFormats = listPossibleConnectionFormats;
return (E_OK);
}
Worker *worker;
};
std::vector<threadInfo_s> mListWorkers; //<! list of all workers
- static pthread_mutex_t mBlockingMutex; //<! mutex to block the acces of the list
+ static pthread_mutex_t mBlockingMutex; //<! mutex to block the acces of the list
};
class AsyncRoutingSender: public RoutingSendInterface
am_Error_e asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
am_Error_e asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
am_Error_e asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state);
- am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID);
- am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sinkID_t sinkID);
- am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID);
- am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID);
+ am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty);
+ am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties);
+ am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty);
+ am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties);
am_Error_e asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time);
am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState);
am_Error_e returnBusName(std::string& BusName) const;
private:
/**
* Extra thread that handles dbus stimulation for interrupt tests
+ * This is a very very very basic implementation of the dbus interface
+ * there is not failure handling, nothing.
+ * it is used just for testing, not intended to be used otherwise...
* @param data
*/
static void* InterruptEvents(void* data);
RoutingReceiverAsyncShadow::RoutingReceiverAsyncShadow():
asyncMsgReceive(this, &RoutingReceiverAsyncShadow::asyncMsgReceiver), //
-asyncDispatch(this, &RoutingReceiverAsyncShadow::asyncDispatcher),//
-asyncCheck(this, &RoutingReceiverAsyncShadow::asyncChecker), //
-mSocketHandler(), //
-mRoutingReceiveInterface(),//
-mHandle (),//
+ asyncDispatch(this, &RoutingReceiverAsyncShadow::asyncDispatcher), //
+ asyncCheck(this, &RoutingReceiverAsyncShadow::asyncChecker), //
+ mSocketHandler(), //
+ mRoutingReceiveInterface(), //
+mHandle (), //
mPipe()
{
bool retVal = false;
pthread_mutex_lock(&mMutex);
- if (mQueue.size() > 0) retVal = true;
+ if (mQueue.size() > 0)
+ retVal = true;
pthread_mutex_unlock(&mMutex);
return (retVal);
(void) userData;
bool returnVal = false;
pthread_mutex_lock(&mMutex);
- if (mQueue.size() > 0) returnVal = true;
+ if (mQueue.size() > 0)
+ returnVal = true;
pthread_mutex_unlock(&mMutex);
return (returnVal);
}
void* AsyncRoutingSender::InterruptEvents(void *data)
{
- //This is a very very very basic implementation of the dbus interface
- //there is not failure handling, nothing.
- //it is used just for testing, not intended to be used otherwise...
RoutingReceiverAsyncShadow *shadow=(RoutingReceiverAsyncShadow *)data;
DBusError err;
DBusMessage* msg;
dbus_uint32_t serial = 0;
DBusMessage* reply;
DBusMessageIter args;
- int answer = dbus_bus_request_name(conn, "org.genivi.test",DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
+ dbus_bus_request_name(conn, "org.genivi.test",DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
while (dbus_connection_read_write_dispatch(conn, -1))
{
else if (dbus_message_is_method_call(msg, "org.genivi.test", "SinkAvailablityStatusChange"))
{
am_sinkID_t sinkID;
- am_timeSync_t delay;
am_Availability_s availability;
dbus_message_iter_init(msg, &args);
dbus_message_iter_get_basic(&args,(void*) &sinkID);
else if (dbus_message_is_method_call(msg, "org.genivi.test", "SourceAvailablityStatusChange"))
{
am_sourceID_t sourceID;
- am_timeSync_t delay;
am_Availability_s availability;
dbus_message_iter_init(msg, &args);
dbus_message_iter_get_basic(&args,(void*) &sourceID);
{
am_sourceID_t sourceID;
- am_InterruptState_e state;
+ am_InterruptState_e state=IS_MIN;
dbus_message_iter_init(msg, &args);
dbus_message_iter_get_basic(&args,(void*) &sourceID);
reply = dbus_message_new_method_return(msg);
}
dbus_connection_flush(conn);
}
+ return NULL;
}
void *WorkerThreadPool::WorkerThread(void* data)
actWorker->start2work();
actWorker->pPool->finishedWork(myInfo->threadID);
}
+ return NULL;
}
WorkerThreadPool::WorkerThreadPool(int numThreads):
- mNumThreads(numThreads)
+mNumThreads(numThreads)
{
int workerID=0;
mListWorkers.resize(mNumThreads);
{
pthread_cancel(mListWorkers[i].threadID);
}
- }
-
-Worker::Worker(WorkerThreadPool *pool):
- pPool(pool), //
- mCancelSem()
-{
}
-void Worker::setCancelSempaphore(sem_t* cancel)
-{
- mCancelSem=cancel;
-}
+Worker::Worker(WorkerThreadPool *pool):
+pPool(pool), //
+ mCancelSem()
+ {
+ }
-bool Worker::timedWait(timespec timer)
-{
- timespec temp;
- if(clock_gettime(0, &temp)==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("Worker::timedWait error on getting time"));
- }
- temp.tv_nsec+=timer.tv_nsec;
- temp.tv_sec+=timer.tv_sec;
- //if(sem_wait(mCancelSem)==-1)
- if (sem_timedwait(mCancelSem,&temp)==-1)
- {
- //a timeout happened
- if(errno == ETIMEDOUT)
+ void Worker::setCancelSempaphore(sem_t* cancel)
{
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("Worker::timedWait timeout waiting error"));
- return (false);
+ mCancelSem=cancel;
}
- else //failure in waiting, nevertheless, we quit the thread...
+
+ bool Worker::timedWait(timespec timer)
{
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("Worker::timedWait semaphore waiting error"));
- return (true);
+ timespec temp;
+ if(clock_gettime(0, &temp)==-1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("Worker::timedWait error on getting time"));
+ }
+ temp.tv_nsec+=timer.tv_nsec;
+ temp.tv_sec+=timer.tv_sec;
+ //if(sem_wait(mCancelSem)==-1)
+ if (sem_timedwait(mCancelSem,&temp)==-1)
+ {
+ //a timeout happened
+ if(errno == ETIMEDOUT)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("Worker::timedWait timeout waiting error"));
+ return (false);
+ }
+ else //failure in waiting, nevertheless, we quit the thread...
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("Worker::timedWait semaphore waiting error"));
+ return (true);
+ }
}
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("Worker::timedWait semaphore waiting error"));
+ this->cancelWork();
+ return (true);
}
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("Worker::timedWait semaphore waiting error"));
- this->cancelWork();
- return (true);
-}
-AsyncRoutingSender::AsyncRoutingSender():
+ AsyncRoutingSender::AsyncRoutingSender():
mShadow(), //
mReceiveInterface(0), //
- mDomains(createDomainTable()), //
- mSinks(createSinkTable()), //
- mSources ( createSourceTable ( ) ), //
- mGateways ( createGatewayTable ( ) ) , //
- mMapHandleWorker ( ), //
- mMapConnectionIDRoute(),//
- mPool(10)
+ mDomains(createDomainTable()), //
+ mSinks(createSinkTable()), //
+mSources ( createSourceTable ( ) ), //
+mGateways ( createGatewayTable ( ) ) , //
+mMapHandleWorker ( ), //
+mMapConnectionIDRoute(),//
+mPool(10)
{
DLT_REGISTER_CONTEXT(PluginRoutingAsync,"ASY","Async Plugin");
DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("AsyncRoutingSender constructed"));
pthread_mutex_unlock(&mMapHandleWorkerMutex);
//ok, cancel the action:
- if (mPool.cancelWork(iter->second)) return (E_OK);
+ if (mPool.cancelWork(iter->second))
+ return (E_OK);
return (E_UNKNOWN);
}
break;
}
}
- if (sinkIter == mSinks.end()) return (E_NON_EXISTENT); //not found!
+ if (sinkIter == mSinks.end())
+ return (E_NON_EXISTENT); //not found!
//find the source
std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
break;
}
}
- if (sourceIter == mSources.end()) return (E_NON_EXISTENT); //not found!
+ if (sourceIter == mSources.end())
+ return (E_NON_EXISTENT); //not found!
//check the format
- if (std::find(source.listConnectionFormats.begin(), source.listConnectionFormats.end(), connectionFormat) == source.listConnectionFormats.end()) return (E_WRONG_FORMAT);
- if (std::find(sink.listConnectionFormats.begin(), sink.listConnectionFormats.end(), connectionFormat) == sink.listConnectionFormats.end()) return (E_WRONG_FORMAT);
+ if (std::find(source.listConnectionFormats.begin(), source.listConnectionFormats.end(), connectionFormat) == source.listConnectionFormats.end())
+ return (E_WRONG_FORMAT);
+ if (std::find(sink.listConnectionFormats.begin(), sink.listConnectionFormats.end(), connectionFormat) == sink.listConnectionFormats.end())
+ 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);
}
}
pthread_mutex_unlock(&mSinksMutex);
- if (sinkIter == mSinks.end()) return (E_NON_EXISTENT); //not found!
+ if (sinkIter == mSinks.end())
+ return (E_NON_EXISTENT); //not found!
asyncSetSinkVolumeWorker *worker = new asyncSetSinkVolumeWorker(this, &mPool, &mShadow, sinkIter->volume, handle, sinkID, volume, ramp, time);
if ((work = mPool.startWork(worker)) == -1)
}
}
pthread_mutex_unlock(&mSourcesMutex);
- if (sourceIter == mSources.end()) return (E_NON_EXISTENT); //not found!
+ if (sourceIter == mSources.end())
+ return (E_NON_EXISTENT); //not found!
asyncSetSourceVolumeWorker *worker = new asyncSetSourceVolumeWorker(this, &mPool, &mShadow, sourceIter->volume, handle, sourceID, volume, ramp, time);
if ((work = mPool.startWork(worker)) == -1)
}
}
pthread_mutex_unlock(&mSourcesMutex);
- if (sourceIter == mSources.end()) return (E_NON_EXISTENT); //not found!
+ if (sourceIter == mSources.end())
+ return (E_NON_EXISTENT); //not found!
asyncSetSourceStateWorker *worker = new asyncSetSourceStateWorker(this, &mPool, &mShadow, handle, sourceID, state);
if ((work = mPool.startWork(worker)) == -1)
return (E_OK);
}
-am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID)
+am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
}
}
pthread_mutex_unlock(&mSinksMutex);
- if (sinkIter == mSinks.end()) return (E_NON_EXISTENT); //not found!
+ if (sinkIter == mSinks.end())
+ return (E_NON_EXISTENT); //not found!
asyncSetSinkSoundPropertyWorker *worker = new asyncSetSinkSoundPropertyWorker(this, &mPool, &mShadow, handle, soundProperty, sinkID);
if ((work = mPool.startWork(worker)) == -1)
am_Error_e AsyncRoutingSender::asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
{
//todo: implement crossfader
+ (void) handle;
+ (void) crossfaderID;
+ (void) hotSink;
+ (void) rampType;
+ (void) time;
return E_NOT_USED;
}
}
}
pthread_mutex_unlock(&mDomainsMutex);
- if (domainIter == mDomains.end()) return (E_NON_EXISTENT); //not found!
+ if (domainIter == mDomains.end())
+ return (E_NON_EXISTENT); //not found!
asyncDomainStateChangeWorker *worker = new asyncDomainStateChangeWorker(this, &mPool, &mShadow, domainID, domainState);
if ((work = mPool.startWork(worker)) == -1)
}
-am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
+am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
{
assert(mReceiveInterface!=0);
assert(handle.handle!=0);
}
}
pthread_mutex_unlock(&mSourcesMutex);
- if (sourceIter == mSources.end()) return (E_NON_EXISTENT); //not found!
+ if (sourceIter == mSources.end())
+ return (E_NON_EXISTENT); //not found!
asyncSetSourceSoundPropertyWorker *worker = new asyncSetSourceSoundPropertyWorker(this, &mPool, &mShadow, handle, soundProperty, sourceID);
if ((work = mPool.startWork(worker)) == -1)
{
std::stringstream temp;
temp << i;
- item.domainID = 0; //we cannot know this when the table is created !
+ item.domainID = 0; //we cannot know this when the table is created !
item.name = "mySink" + temp.str();
- item.sinkID = i; //take fixed ids to make thins easy
+ item.sinkID = i; //take fixed ids to make thins easy
item.sinkClassID = 1;
item.volume = 0;
item.listSoundProperties.push_back(sp);
{
std::stringstream temp;
temp << i;
- item.domainID = 0; //we cannot know this when the table is created !
+ item.domainID = 0; //we cannot know this when the table is created !
item.name = "mySource" + temp.str();
- item.sourceID = i; //take fixed ids to make thins easy
+ item.sourceID = i; //take fixed ids to make thins easy
item.sourceClassID = 1;
item.volume = 0;
item.visible = true;
return (RoutingSendVersion);
}
-am_Error_e am::AsyncRoutingSender::asyncSetSinkSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sinkID_t sinkID)
+am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
//todo: implement
+ (void) handle;
+ (void) sourceID;
+ (void) listSoundProperties;
+ return (E_NOT_USED);
}
-am_Error_e am::AsyncRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sourceID_t sourceID)
+am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
//todo: implement
+ (void) handle;
+ (void) sinkID;
+ (void) listSoundProperties;
+ return (E_NOT_USED);
}
std::vector<am_Gateway_s> AsyncRoutingSender::createGatewayTable()
}
asycConnectWorker::asycConnectWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat) :
- Worker(pool), mAsyncSender(asyncSender), mShadow(shadow), mHandle(handle), mConnectionID(connectionID), mSourceID(sourceID), mSinkID(sinkID), mConnectionFormat(connectionFormat)
+ Worker(pool), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mHandle(handle), //
+ mConnectionID(connectionID), //
+ mSourceID(sourceID), //
+ mSinkID(sinkID), //
+ mConnectionFormat(connectionFormat)
{
}
t.tv_sec = 1;
//do something for one second
- if (timedWait(t)) return;
+ if (timedWait(t))
+ return;
am_RoutingElement_s route;
route.sinkID = mSinkID;
route.sourceID = mSourceID;
}
asycDisConnectWorker::asycDisConnectWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_connectionID_t connectionID) :
- Worker(pool), mAsyncSender(asyncSender), mShadow(shadow), mHandle(handle), mConnectionID(connectionID)
+ Worker(pool), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mHandle(handle), //
+ mConnectionID(connectionID)
{
}
t.tv_sec = 1;
//do something for one second
- if (timedWait(t)) return;
+ if (timedWait(t))
+ return;
am_RoutingElement_s route;
//enter new connectionID into the list
}
asyncSetSinkVolumeWorker::asyncSetSinkVolumeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) :
- Worker(pool), mAsyncSender(asyncSender), mShadow(shadow), mCurrentVolume(currentVolume), mHandle(handle), mSinkID(sinkID), mVolume(volume), mRamp(ramp), mTime(time)
+ Worker(pool), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mCurrentVolume(currentVolume), //
+ mHandle(handle), //
+ mSinkID(sinkID), //
+ mVolume(volume), //
+ mRamp(ramp), //
+ mTime(time)
{
}
else
mCurrentVolume--;
mShadow->ackSinkVolumeTick(mHandle, mSinkID, mCurrentVolume);
- if (timedWait(t)) return;
+ if (timedWait(t))
+ return;
}
//enter new connectionID into the list
mShadow->ackSetSinkVolumeChange(mHandle, mCurrentVolume, E_ABORTED);
}
-am::asyncSetSourceVolumeWorker::asyncSetSourceVolumeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sourceID_t SourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) :
- Worker(pool), mAsyncSender(asyncSender), mShadow(shadow), mCurrentVolume(currentVolume), mHandle(handle), mSourceID(SourceID), mVolume(volume), mRamp(ramp), mTime(time)
+asyncSetSourceVolumeWorker::asyncSetSourceVolumeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sourceID_t SourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) :
+ Worker(pool), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mCurrentVolume(currentVolume), //
+ mHandle(handle), //
+ mSourceID(SourceID), //
+ mVolume(volume), //
+ mRamp(ramp), //
+ mTime(time)
{
}
-void am::asyncSetSourceVolumeWorker::start2work()
+void asyncSetSourceVolumeWorker::start2work()
{
//todo: this implementation does not respect time and ramp....
DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting source volume"));
else
mCurrentVolume--;
mShadow->ackSourceVolumeTick(mHandle, mSourceID, mCurrentVolume);
- if (timedWait(t)) return;
+ if (timedWait(t))
+ return;
}
//enter new connectionID into the list
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-void am::asyncSetSourceVolumeWorker::cancelWork()
+void asyncSetSourceVolumeWorker::cancelWork()
{
mAsyncSender->updateSourceVolumeSafe(mSourceID, mCurrentVolume);
mAsyncSender->removeHandleSafe(mHandle.handle);
mShadow->ackSetSourceVolumeChange(mHandle, mCurrentVolume, E_ABORTED);
}
-am::asyncSetSourceStateWorker::asyncSetSourceStateWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) :
- Worker(pool), mAsyncSender(asyncSender), mShadow(shadow), mHandle(handle), mSourceID(sourceID), mSourcestate(state)
+asyncSetSourceStateWorker::asyncSetSourceStateWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state) :
+ Worker(pool), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mHandle(handle), //
+ mSourceID(sourceID), //
+ mSourcestate(state)
{
}
-void am::asyncSetSourceStateWorker::start2work()
+void asyncSetSourceStateWorker::start2work()
{
DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting source state"));
timespec t;
t.tv_sec = 1;
//do something for one second
- if (timedWait(t)) return;
+ if (timedWait(t))
+ return;
//enter new connectionID into the list
mAsyncSender->updateSourceStateSafe(mSourceID, mSourcestate);
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-void am::asyncSetSourceStateWorker::cancelWork()
+void asyncSetSourceStateWorker::cancelWork()
{
//send the ack
mShadow->ackSetSourceState(mHandle, E_ABORTED);
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-am::asyncSetSinkSoundPropertyWorker::asyncSetSinkSoundPropertyWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID) :
- Worker(pool), mAsyncSender(asyncSender), mShadow(shadow), mHandle(), mSinkID(sinkID), mSoundProperty(soundProperty)
+asyncSetSinkSoundPropertyWorker::asyncSetSinkSoundPropertyWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID) :
+ Worker(pool), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mHandle(handle), //
+ mSinkID(sinkID), //
+ mSoundProperty(soundProperty)
{
}
-void am::asyncSetSinkSoundPropertyWorker::start2work()
+void asyncSetSinkSoundPropertyWorker::start2work()
{
DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting sink sound property"));
timespec t;
t.tv_sec = 1;
//do something for one second
- if (timedWait(t)) return;
+ if (timedWait(t))
+ return;
//enter new connectionID into the list
mAsyncSender->updateSinkSoundPropertySafe(mSinkID, mSoundProperty);
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-void am::asyncSetSinkSoundPropertyWorker::cancelWork()
+void asyncSetSinkSoundPropertyWorker::cancelWork()
{
//send the ack
mShadow->ackSetSinkSoundProperty(mHandle, E_OK);
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-am::asyncSetSourceSoundPropertyWorker::asyncSetSourceSoundPropertyWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID) :
- Worker(pool), mAsyncSender(asyncSender), mShadow(shadow), mHandle(), mSourceID(sourceID), mSoundProperty(soundProperty)
+asyncSetSourceSoundPropertyWorker::asyncSetSourceSoundPropertyWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID) :
+ Worker(pool), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mHandle(handle), //
+ mSourceID(sourceID), //
+ mSoundProperty(soundProperty)
{
}
-void am::asyncSetSourceSoundPropertyWorker::start2work()
+void asyncSetSourceSoundPropertyWorker::start2work()
{
DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting source sound property"));
timespec t;
t.tv_sec = 1;
//do something for one second
- if (timedWait(t)) return;
+ if (timedWait(t))
+ return;
//enter new connectionID into the list
mAsyncSender->updateSourceSoundPropertySafe(mSourceID, mSoundProperty);
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-void am::asyncSetSourceSoundPropertyWorker::cancelWork()
+void asyncSetSourceSoundPropertyWorker::cancelWork()
{
//send the ack
mShadow->ackSetSourceSoundProperty(mHandle, E_OK);
mAsyncSender->removeHandleSafe(mHandle.handle);
}
-am::asyncDomainStateChangeWorker::asyncDomainStateChangeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_domainID_t domainID, const am_DomainState_e domainState) :
- Worker(pool), mAsyncSender(asyncSender), mShadow(shadow), mDomainID(domainID), mDomainState(domainState)
+asyncDomainStateChangeWorker::asyncDomainStateChangeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_domainID_t domainID, const am_DomainState_e domainState) :
+ Worker(pool), //
+ mAsyncSender(asyncSender), //
+ mShadow(shadow), //
+ mDomainID(domainID), //
+ mDomainState(domainState)
{
}
-void am::asyncDomainStateChangeWorker::start2work()
+void asyncDomainStateChangeWorker::start2work()
{
//todo: sendchanged data must be in here !
DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting source sound property"));
t.tv_sec = 1;
//do something for one second
- if (timedWait(t)) return;
+ if (timedWait(t))
+ return;
//enter new connectionID into the list
mAsyncSender->updateDomainstateSafe(mDomainID, mDomainState);
void am::testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
pSocketHandler.stop_listening();
}
handle.handleType = H_CONNECT;
am_connectionID_t connectionID = 4;
- am_sourceID_t sourceID = 2;
- am_sinkID_t sinkID = 1;
- am_ConnectionFormat_e format = CF_ANALOG;
EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
EXPECT_CALL(pReceiveInterface,ackDisconnect(_,connectionID,E_OK)).Times(0);
return (E_OK);
}
-void am::testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
+void testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
pSocketHandler.stop_listening();
}
am_Error_e asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
am_Error_e asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
am_Error_e asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state);
- am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID);
- am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sinkID_t sinkID);
- am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID);
- am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID);
+ am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty);
+ am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties);
+ am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty);
+ am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties);
am_Error_e asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time);
am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState);
am_Error_e returnBusName(std::string& BusName) const;
void DbusRoutingSender::startupRoutingInterface(RoutingReceiveInterface *routingreceiveinterface)
{
+ (void)routingreceiveinterface;
}
void DbusRoutingSender::routingInterfacesReady()
am_Error_e DbusRoutingSender::asyncAbort(const am_Handle_s handle)
{
+ (void) handle;
+ return (E_NOT_USED);
}
am_Error_e DbusRoutingSender::asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
{
+ (void) handle;
+ (void) connectionID;
+ (void) sourceID;
+ (void) sinkID;
+ (void) connectionFormat;
+ return (E_NOT_USED);
}
am_Error_e DbusRoutingSender::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID)
{
+ (void) handle;
+ (void) connectionID;
+ return (E_NOT_USED);
}
am_Error_e DbusRoutingSender::asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
+ (void) handle;
+ (void) sinkID;
+ (void) volume;
+ (void) ramp;
+ (void) time;
+ return (E_NOT_USED);
}
am_Error_e DbusRoutingSender::asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
+ (void) handle;
+ (void) sourceID;
+ (void) volume;
+ (void) ramp;
+ (void) time;
+ return (E_NOT_USED);
}
am_Error_e DbusRoutingSender::asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
-}
-
-am_Error_e DbusRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID)
-{
+ (void) handle;
+ (void) sourceID;
+ (void) state;
+ return (E_NOT_USED);
}
am_Error_e DbusRoutingSender::asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
{
+ (void) handle;
+ (void) crossfaderID;
+ (void) hotSink;
+ (void) rampType;
+ (void) time;
+ return (E_NOT_USED);
}
am_Error_e DbusRoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
-}
-
-am_Error_e DbusRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
-{
+ (void) domainID;
+ (void) domainState;
+ return (E_NOT_USED);
}
am_Error_e DbusRoutingSender::returnBusName(std::string & BusName) const
return (E_OK);
}
-am_Error_e DbusRoutingSender::asyncSetSinkSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sinkID_t sinkID)
+am_Error_e DbusRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
+ (void) handle;
+ (void) sinkID;
+ (void) soundProperty;
+ return (E_NOT_USED);
+}
+am_Error_e DbusRoutingSender::asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
+{
+ (void) handle;
+ (void) sinkID;
+ (void) listSoundProperties;
+ return (E_NOT_USED);
}
-am_Error_e DbusRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sourceID_t sourceID)
+am_Error_e DbusRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
{
+ (void) handle;
+ (void) sourceID;
+ (void) soundProperty;
+ return (E_NOT_USED);
+}
+am_Error_e DbusRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
+{
+ (void) handle;
+ (void) sourceID;
+ (void) listSoundProperties;
+ return (E_NOT_USED);
}
uint16_t DbusRoutingSender::getInterfaceVersion() const
sh_timerHandle_t mNextTimer;
sh_timerHandle_t mLastInsertedHandle;
sh_pollHandle_t mLastInsertedPollHandle;
- timespec mTimeout;
bool mRecreatePollfds;
+ timespec mTimeout;
};
/**
*\r
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
*/\r
-#if !defined(EA_3B272E4F_E824_49e3_862F_3C86FD59D14B__INCLUDED_)\r
-#define EA_3B272E4F_E824_49e3_862F_3C86FD59D14B__INCLUDED_\r
+#if !defined(EA_C4520781_52CF_4636_BE82_37A28F483C93__INCLUDED_)\r
+#define EA_C4520781_52CF_4636_BE82_37A28F483C93__INCLUDED_\r
\r
#include <stdint.h>\r
#include "projecttypes.h"\r
* After the buildup of a connection the first timing information needs to be sent within 5 seconds, the timing information from the routing adaptors need to be sent via 4 seconds. If the latency for a connection is variable and changes over lifetime of the connection, the routing adaptors shall resend the value and the audiomanger will correct the over all latency.\n
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:47 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_domainID_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:47 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_sourceID_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:48 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_sinkID_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:48 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_gatewayID_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:48 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_crossfaderID_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:48 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_connectionID_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:49 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_mainConnectionID_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:49 PM
+ * @created 26-Jan-2012 6:00:48 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
* @version 1.0
- * @created 19-Jan-2012 4:31:49 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef int16_t am_volume_t;
* The range of this type is customer specific.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:49 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef int16_t am_mainVolume_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:50 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_sourceClass_t;
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:50 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_sinkClass_t;
* time in ms!
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:50 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef uint16_t am_time_t;
* offset time that is introduced in milli seconds.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:50 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
typedef int16_t am_timeSync_t;
* with the help of this enum, sinks and sources can report their availability state
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:50 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_Availablility_e
{
* represents the connection state
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:50 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_ConnectionState_e
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:51 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_DomainState_e
{
* This enum characterizes the data of the EarlyData_t
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:51 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_EarlyDataType_e
{
* the errors of the audiomanager. All possible errors are in here. This enum is used widely as return parameter.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:51 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_Error_e
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:51 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_MuteState_e
{
* The source state reflects the state of the source
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:52 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_SourceState_e
{
* This enumeration is used to define the type of the action that is correlated to a handle.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:52 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_Handle_e
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:52 PM
+ * @created 26-Jan-2012 6:00:48 PM
*/
enum am_InterruptState_e
{
* describes the active sink of a crossfader.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:52 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
enum am_HotSink_e
{
* this describes the availability of a sink or a source together with the latest change
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:52 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
struct am_Availability_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:53 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
struct am_ClassProperty_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:53 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
struct am_Crossfader_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:53 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
struct am_Gateway_s
{
* This represents one "hopp" in a route
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:54 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
struct am_RoutingElement_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:54 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
struct am_Route_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:54 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
struct am_SoundProperty_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:55 PM
+ * @created 26-Jan-2012 6:00:49 PM
*/
struct am_SystemProperty_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:55 PM
+ * @created 26-Jan-2012 6:00:50 PM
*/
struct am_SinkClass_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:55 PM
+ * @created 26-Jan-2012 6:00:50 PM
*/
struct am_SourceClass_s
{
* this type holds all information of sources relevant to the HMI
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:55 PM
+ * @created 26-Jan-2012 6:00:50 PM
*/
struct am_SourceType_s
{
* this type holds all information of sinks relevant to the HMI
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:56 PM
+ * @created 26-Jan-2012 6:00:50 PM
*/
struct am_SinkType_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:56 PM
+ * @created 26-Jan-2012 6:00:50 PM
*/
struct am_Handle_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:56 PM
+ * @created 26-Jan-2012 6:00:50 PM
*/
struct am_MainSoundProperty_s
{
* this type holds all information of connections relevant to the HMI
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:57 PM
+ * @created 26-Jan-2012 6:00:50 PM
*/
struct am_MainConnectionType_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:57 PM
+ * @created 26-Jan-2012 6:00:50 PM
*/
struct am_MainConnection_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:57 PM
+ * @created 26-Jan-2012 6:00:51 PM
*/
struct am_Sink_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:58 PM
+ * @created 26-Jan-2012 6:00:51 PM
*/
struct am_Source_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:58 PM
+ * @created 26-Jan-2012 6:00:51 PM
*/
struct am_Domain_s
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:59 PM
+ * @created 26-Jan-2012 6:00:51 PM
*/
struct am_Connection_s
{
* soundProperty_t in case of ED_SOURCE_PROPERTY, ED_SINK_PROPERTY
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:59 PM
+ * @created 26-Jan-2012 6:00:51 PM
*/
union am_EarlyData_u
{
* sinkID in case of ED_SINK_VOLUME, ED_SINK_PROPERTY
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:59 PM
+ * @created 26-Jan-2012 6:00:51 PM
*/
union am_DataType_u
{
/**
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:59 PM
+ * @created 26-Jan-2012 6:00:51 PM
*/
struct am_EarlyData_s
{
};
}
-#endif // !defined(EA_3B272E4F_E824_49e3_862F_3C86FD59D14B__INCLUDED_)
+#endif // !defined(EA_C4520781_52CF_4636_BE82_37A28F483C93__INCLUDED_)
*\r
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
*/\r
-#if !defined(EA_434BDFE9_DDA7_4273_AF1E_77AE60CB055D__INCLUDED_)\r
-#define EA_434BDFE9_DDA7_4273_AF1E_77AE60CB055D__INCLUDED_\r
+#if !defined(EA_6FE1E594_3CEA_4eaa_BAD0_7BB39D3150D2__INCLUDED_)\r
+#define EA_6FE1E594_3CEA_4eaa_BAD0_7BB39D3150D2__INCLUDED_\r
\r
#include <vector>\r
#include <string>\r
-#include "../audiomanagertypes.h"\r
+#include "audiomanagertypes.h"\r
namespace am {\r
class DBusWrapper;\r
class SocketHandler;\r
* The interface towards the Controlling Instance (e.g HMI). It handles the communication towards the HMI and other system components who need to interact with the audiomanagement.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:32:00 PM
+ * @created 26-Jan-2012 6:00:52 PM
*/
class CommandReceiveInterface
{
public:
+ CommandReceiveInterface() {
+
+ }
+
+ virtual ~CommandReceiveInterface() {
+
+ }
+
/**
* connects a source to sink\r
* @return E_OK on success, E_NOT_POSSIBLE on failure, E_ALREADY_EXISTS if the connection does already exists
};
}
-#endif // !defined(EA_434BDFE9_DDA7_4273_AF1E_77AE60CB055D__INCLUDED_)
+#endif // !defined(EA_6FE1E594_3CEA_4eaa_BAD0_7BB39D3150D2__INCLUDED_)
*\r
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
*/\r
-#if !defined(EA_55B59518_08CD_47c3_91EC_B59681773D46__INCLUDED_)\r
-#define EA_55B59518_08CD_47c3_91EC_B59681773D46__INCLUDED_\r
+#if !defined(EA_B298DDFD_7AC9_4a18_BB8C_595921C525B6__INCLUDED_)\r
+#define EA_B298DDFD_7AC9_4a18_BB8C_595921C525B6__INCLUDED_\r
\r
#include <vector>\r
#include <string>\r
-#include "../audiomanagertypes.h"\r
+#include "audiomanagertypes.h"\r
\r
namespace am {\r
class CommandReceiveInterface;\r
* This interface handles all communication from the AudioManagerDaemon towards the system. It is designed in such a way that only callbacks with no return types are implemented. So when the CommandInterfacePlugins are designed in such a way that they broadcast signals to any node who is interested in the particular information (like signals on Dbus for example), more information can be retrieved via the CommandReceiveInterface.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:32:00 PM
+ * @created 26-Jan-2012 6:00:52 PM
*/
class CommandSendInterface
{
public:
+ CommandSendInterface() {
+
+ }
+
+ virtual ~CommandSendInterface() {
+
+ }
+
/**
* This command starts the interface, the plugin itself. This is not meant to start communication with the HMI itself. It is a good idea to implement here everything that sets up the basic communication like DbusCommunication etc...\r
* @return E_OK on success, E_UNKNOWN on error
/**
* CommandReceiveVer_0.0.9.
*
- * @param time
* @param mainConnectionID
+ * @param time
*/
- virtual void cbTimingInformationChanged(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID) =0;
+ virtual void cbTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) =0;
/**
* This function returns the version of the interface\r
* returns E_OK, E_UNKOWN if version is unknown.
};
}
-#endif // !defined(EA_55B59518_08CD_47c3_91EC_B59681773D46__INCLUDED_)
+#endif // !defined(EA_B298DDFD_7AC9_4a18_BB8C_595921C525B6__INCLUDED_)
#ifndef _CONFIG_H
#define _CONFIG_H
-#define DAEMONVERSION "ver-0.0.1-14-gaf0ba5b"
+#define DAEMONVERSION "ver-0.0.1-16-g002295b"
#define WITH_DBUS_WRAPPER
#define WITH_SOCKETHANDLER_LOOP
*\r
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
*/\r
-#if !defined(EA_E6AC61AD_E107_4b3d_8E11_9A434157C19F__INCLUDED_)\r
-#define EA_E6AC61AD_E107_4b3d_8E11_9A434157C19F__INCLUDED_\r
+#if !defined(EA_9550F257_23AE_4781_B149_0E4B3A9889AC__INCLUDED_)\r
+#define EA_9550F257_23AE_4781_B149_0E4B3A9889AC__INCLUDED_\r
\r
#include <vector>\r
#include <string>\r
-#include "../audiomanagertypes.h"\r
+#include "audiomanagertypes.h"\r
namespace am {\r
class SocketHandler;\r
}\r
* This interface gives access to all important functions of the audiomanager that are used by the AudioManagerController to control the system.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:32:00 PM
+ * @created 26-Jan-2012 6:00:52 PM
*/
class ControlReceiveInterface
{
public:
+ ControlReceiveInterface() {
+
+ }
+
+ virtual ~ControlReceiveInterface() {
+
+ }
+
/**
* calculates a route from source to sink.\r
* @return E_OK on success, E_UNKNOWN on error
};
}
-#endif // !defined(EA_E6AC61AD_E107_4b3d_8E11_9A434157C19F__INCLUDED_)
+#endif // !defined(EA_9550F257_23AE_4781_B149_0E4B3A9889AC__INCLUDED_)
*\r
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
*/\r
-#if !defined(EA_7E13E25E_46FA_4211_BD7C_7169D8F7D065__INCLUDED_)\r
-#define EA_7E13E25E_46FA_4211_BD7C_7169D8F7D065__INCLUDED_\r
+#if !defined(EA_7C94464D_AE95_434a_A108_201C19F97A85__INCLUDED_)\r
+#define EA_7C94464D_AE95_434a_A108_201C19F97A85__INCLUDED_\r
\r
#include <vector>\r
#include <string>\r
-#include "../audiomanagertypes.h"\r
+#include "audiomanagertypes.h"\r
\r
namespace am {\r
class ControlReceiveInterface;\r
* All the hooks represent system events that need to be handled. The callback functions are used to handle for example answers to function calls on the AudioManagerCoreInterface.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:32:01 PM
+ * @created 26-Jan-2012 6:00:53 PM
*/
class ControlSendInterface
{
public:
+ ControlSendInterface() {
+
+ }
+
+ virtual ~ControlSendInterface() {
+
+ }
+
/**
* Starts up the controller.
*
};
}
-#endif // !defined(EA_7E13E25E_46FA_4211_BD7C_7169D8F7D065__INCLUDED_)
+#endif // !defined(EA_7C94464D_AE95_434a_A108_201C19F97A85__INCLUDED_)
bool dbusDispatchCallback(const sh_pollHandle_t handle, void* userData);
shPollDispatch_T<DBusWrapper> pDbusDispatchCallback;
- bool dbusCheckCallback(const sh_pollHandle_t handle, void* userData);
- shPollCheck_T<DBusWrapper> pDbusCheckCallback;
-
void dbusFireCallback(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
shPollFired_T<DBusWrapper> pDbusFireCallback;
+ bool dbusCheckCallback(const sh_pollHandle_t handle, void* userData);
+ shPollCheck_T<DBusWrapper> pDbusCheckCallback;
+
void dbusTimerCallback(sh_timerHandle_t handle, void* userData);
shTimerCallBack_T<DBusWrapper> pDbusTimerCallback;
*\r
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
*/\r
-#if !defined(EA_D441AD1F_B077_485c_AE04_AF1567A1359F__INCLUDED_)\r
-#define EA_D441AD1F_B077_485c_AE04_AF1567A1359F__INCLUDED_\r
+#if !defined(EA_9A582C38_7B95_4ebf_B316_F765C90F29C5__INCLUDED_)\r
+#define EA_9A582C38_7B95_4ebf_B316_F765C90F29C5__INCLUDED_\r
\r
namespace am {\r
/**\r
* 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.\r
* @author christian\r
* @version 1.0\r
- * @created 19-Jan-2012 4:31:59 PM\r
+ * @created 26-Jan-2012 6:00:52 PM\r
*/\r
enum am_ConnectionFormat_e\r
{\r
* This enum gives the information about reason for reason for Source/Sink change\r
* @author christian\r
* @version 1.0\r
- * @created 19-Jan-2012 4:31:59 PM\r
+ * @created 26-Jan-2012 6:00:52 PM\r
*/\r
enum am_AvailabilityReason_e\r
{\r
* product specific identifier of property\r
* @author christian\r
* @version 1.0\r
- * @created 19-Jan-2012 4:31:59 PM\r
+ * @created 26-Jan-2012 6:00:52 PM\r
*/\r
enum am_ClassProperty_e\r
{\r
* It is in the responsibility of the product to make sure that the routing plugins are aware of the ramp types used.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:59 PM
+ * @created 26-Jan-2012 6:00:52 PM
*/
enum am_RampType_e
{
* sound properties. Within genivi only the standard properties are defined, for products these need to be extended.
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:59 PM
+ * @created 26-Jan-2012 6:00:52 PM
*/
enum am_SoundPropertyType_e
{
* Here are all SoundProperties that can be set via the CommandInterface. Product specific
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:59 PM
+ * @created 26-Jan-2012 6:00:52 PM
*/
enum am_MainSoundPropertyType_e
{
* describes the different system properties. Project specific
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:31:59 PM
+ * @created 26-Jan-2012 6:00:52 PM
*/
enum am_SystemPropertyType_e
{
SYP_MIN = SYP_TEST
};
}
-#endif // !defined(EA_D441AD1F_B077_485c_AE04_AF1567A1359F__INCLUDED_)
+#endif // !defined(EA_9A582C38_7B95_4ebf_B316_F765C90F29C5__INCLUDED_)
*\r
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
*/\r
-#if !defined(EA_5AC7DCDD_B4FD_44d2_8783_CC96D8595F43__INCLUDED_)\r
-#define EA_5AC7DCDD_B4FD_44d2_8783_CC96D8595F43__INCLUDED_\r
+#if !defined(EA_6B4A81F5_2BD8_4604_859D_4539E7E95638__INCLUDED_)\r
+#define EA_6B4A81F5_2BD8_4604_859D_4539E7E95638__INCLUDED_\r
\r
#include <vector>\r
#include <string>\r
-#include "../audiomanagertypes.h"\r
+#include "audiomanagertypes.h"\r
\r
namespace am {\r
class DBusWrapper;\r
* Routing Receive sendInterface description. This class implements everything from RoutingAdapter -> Audiomanager
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:32:01 PM
+ * @created 26-Jan-2012 6:00:53 PM
*/
class RoutingReceiveInterface
{
public:
+ RoutingReceiveInterface() {
+
+ }
+
+ virtual ~RoutingReceiveInterface() {
+
+ }
+
/**
* acknowledges a asyncConnect
*
};
}
-#endif // !defined(EA_5AC7DCDD_B4FD_44d2_8783_CC96D8595F43__INCLUDED_)
+#endif // !defined(EA_6B4A81F5_2BD8_4604_859D_4539E7E95638__INCLUDED_)
*\r
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN\r
*/\r
-#if !defined(EA_D17051E6_21F6_42a8_A7D0_F996E885E15F__INCLUDED_)\r
-#define EA_D17051E6_21F6_42a8_A7D0_F996E885E15F__INCLUDED_\r
+#if !defined(EA_E9CE2BB6_7523_49e4_9B57_31E776765683__INCLUDED_)\r
+#define EA_E9CE2BB6_7523_49e4_9B57_31E776765683__INCLUDED_\r
\r
#include <vector>\r
#include <string>\r
-#include "../audiomanagertypes.h"\r
+#include "audiomanagertypes.h"\r
\r
namespace am {\r
class RoutingReceiveInterface;\r
* This class implements everything from Audiomanager -> RoutingAdapter
* @author christian
* @version 1.0
- * @created 19-Jan-2012 4:32:02 PM
+ * @created 26-Jan-2012 6:00:54 PM
*/
class RoutingSendInterface
{
public:
+ RoutingSendInterface() {
+
+ }
+
+ virtual ~RoutingSendInterface() {
+
+ }
+
/**
* starts up the interface. In the implementations, here is the best place for init routines.
*
* @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery value is out of range
*
* @param handle
- * @param listSoundProperties
* @param sinkID
+ * @param listSoundProperties
*/
- virtual am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sinkID_t sinkID) =0;
+ virtual am_Error_e asyncSetSinkSoundProperties(const am_Handle_s handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& listSoundProperties) =0;
/**
* this function sets the sinksoundproperty.\r
* @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery value is out of range
*
* @param handle
- * @param soundProperty
* @param sinkID
+ * @param soundProperty
*/
- virtual am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID) =0;
+ virtual am_Error_e asyncSetSinkSoundProperty(const am_Handle_s handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) =0;
/**
* this function sets the sourcesoundproperty.\r
* @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery value is out of range
*
* @param handle
- * @param listSoundProperties
* @param sourceID
+ * @param listSoundProperties
*/
- virtual am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID) =0;
+ virtual am_Error_e asyncSetSourceSoundProperties(const am_Handle_s handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& listSoundProperties) =0;
/**
* this function sets the sourcesoundproperty.\r
* @return E_OK on success, E_UNKNOWN on error, E_OUT_OF_RANGE in case the propery value is out of range
*
* @param handle
- * @param soundProperty
* @param sourceID
+ * @param soundProperty
*/
- virtual am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID) =0;
+ virtual am_Error_e asyncSetSourceSoundProperty(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) =0;
/**
* this function triggers crossfading.\r
* @return E_OK on success, E_UNKNOWN on error
};
}
-#endif // !defined(EA_D17051E6_21F6_42a8_A7D0_F996E885E15F__INCLUDED_)
+#endif // !defined(EA_E9CE2BB6_7523_49e4_9B57_31E776765683__INCLUDED_)