diff options
author | christian mueller <christian.ei.mueller@bmw.de> | 2012-01-10 15:58:38 +0100 |
---|---|---|
committer | christian mueller <christian.ei.mueller@bmw.de> | 2012-01-12 00:09:34 +0100 |
commit | 472d0762b68ce0f2a755b4215515a3e031831495 (patch) | |
tree | 276e811f00dfe17cba15c56092b33d67ba2793f6 /AudioManagerDaemon | |
parent | 6ebae8c4d3a340c135ed2f5f611a0e1c31994164 (diff) | |
download | audiomanager-472d0762b68ce0f2a755b4215515a3e031831495.tar.gz |
* recreated the header files out of the model. Added versioning support in the headerfiles generated
* ensured compatibility with 64 bit systems while compiling dbus [ changed FindDBUS.cmake]
* updated the README to better support building
* updated typo in introspectable string of DBusWrapper
* reworked including strategie
* added getInterfafeVersion method on all interfaces
* added Interface Versioning support
* added version as part of .so ending
* it is no possible to set a vector of source and sink sound properties at a time
* added interface to ask for all loaded plugins on RoutingSender
* added first version of telnet server (not yet productive) - set to not active in CMakeLists.txt
* added changelog (created out of git commit log)
* added default values for all enum types to be save even on other if communication is on other domain
Diffstat (limited to 'AudioManagerDaemon')
27 files changed, 790 insertions, 112 deletions
diff --git a/AudioManagerDaemon/CMakeLists.txt b/AudioManagerDaemon/CMakeLists.txt index c1e09eb..69d9b81 100644 --- a/AudioManagerDaemon/CMakeLists.txt +++ b/AudioManagerDaemon/CMakeLists.txt @@ -26,16 +26,17 @@ IF(WITH_DBUS_WRAPPER) ENDIF(WITH_DBUS_WRAPPER) SET(AUDIOMAN_SRCS_CXX + src/main.cpp src/CommandReceiver.cpp src/CommandSender.cpp src/ControlReceiver.cpp src/ControlSender.cpp src/DatabaseHandler.cpp src/DatabaseObserver.cpp - src/main.cpp src/RoutingReceiver.cpp src/RoutingSender.cpp src/SocketHandler.cpp + src/TelnetServer.cpp ) IF(WITH_DBUS_WRAPPER) diff --git a/AudioManagerDaemon/include/CommandReceiver.h b/AudioManagerDaemon/include/CommandReceiver.h index 6d9201f..114d075 100644 --- a/AudioManagerDaemon/include/CommandReceiver.h +++ b/AudioManagerDaemon/include/CommandReceiver.h @@ -27,15 +27,14 @@ #include <command/CommandReceiveInterface.h> #include <config.h> -#ifdef WITH_DBUS_WRAPPER -#include <dbus/DBusWrapper.h> -#endif -#include <SocketHandler.h> -#include "DatabaseHandler.h" -#include "ControlSender.h" namespace am { +class DatabaseHandler; +class ControlSender; +class DBusWrapper; +class SocketHandler; + /** * This class realizes the command Interface */ @@ -64,11 +63,12 @@ public: am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const ; am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const ; am_Error_e getSocketHandler(SocketHandler*& socketHandler) const; + uint16_t getInterfaceVersion() const; private: DatabaseHandler* mDatabaseHandler; //!< pointer to the databasehandler - DBusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper ControlSender* mControlSender; //!< pointer to the control sender + DBusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper SocketHandler* mSocketHandler; //!< pointer to the SocketHandler }; diff --git a/AudioManagerDaemon/include/CommandSender.h b/AudioManagerDaemon/include/CommandSender.h index df83e7c..5a412f3 100644 --- a/AudioManagerDaemon/include/CommandSender.h +++ b/AudioManagerDaemon/include/CommandSender.h @@ -59,6 +59,7 @@ public: void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState) ; void cbSystemPropertyChanged(const am_SystemProperty_s& SystemProperty) ; void cbTimingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time) ; + uint16_t getInterfaceVersion() const; #ifdef UNIT_TEST friend class CommandInterfaceBackdoor; //this is to get access to the loaded plugins and be able to exchange the interfaces #endif diff --git a/AudioManagerDaemon/include/ControlReceiver.h b/AudioManagerDaemon/include/ControlReceiver.h index 303d675..a8afb79 100644 --- a/AudioManagerDaemon/include/ControlReceiver.h +++ b/AudioManagerDaemon/include/ControlReceiver.h @@ -26,17 +26,16 @@ #define CONTRONLRECEIVER_H_ #include <control/ControlReceiveInterface.h> -#include <SocketHandler.h> #include <config.h> -#ifdef WITH_DBUS_WRAPPER -#include <dbus/DBusWrapper.h> -#endif -#include "DatabaseHandler.h" -#include "RoutingSender.h" -#include "CommandSender.h" + namespace am { +class SocketHandler; +class DatabaseHandler; +class RoutingSender; +class CommandSender; + /** * This class is used to receive all commands from the control interface */ @@ -53,7 +52,9 @@ public: am_Error_e setSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) ; am_Error_e setSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e rampType, const am_time_t time) ; am_Error_e setSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) ; + am_Error_e setSinkSoundProperties(am_Handle_s& handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s>& soundProperty) ; am_Error_e setSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) ; + am_Error_e setSourceSoundProperties(am_Handle_s& handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s>& soundProperty) ; am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) ; am_Error_e abortAction(const am_Handle_s handle) ; am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID) ; @@ -107,6 +108,7 @@ public: void setRoutingReady() ; void setCommandReady() ; am_Error_e getSocketHandler(SocketHandler*& socketHandler); + uint16_t getInterfaceVersion() const; private: DatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler diff --git a/AudioManagerDaemon/include/ControlSender.h b/AudioManagerDaemon/include/ControlSender.h index 9550595..2134fa6 100644 --- a/AudioManagerDaemon/include/ControlSender.h +++ b/AudioManagerDaemon/include/ControlSender.h @@ -78,7 +78,10 @@ public: void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ; void cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error) ; void cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) ; + void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) ; void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) ; + void cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) ; + uint16_t getInterfaceVersion() const; #ifdef UNIT_TEST friend class ControlInterfaceBackdoor; diff --git a/AudioManagerDaemon/include/DatabaseHandler.h b/AudioManagerDaemon/include/DatabaseHandler.h index c4b6dd4..05fd237 100644 --- a/AudioManagerDaemon/include/DatabaseHandler.h +++ b/AudioManagerDaemon/include/DatabaseHandler.h @@ -26,11 +26,13 @@ #define DATABASEHANDLER_H_ #include "audiomanagertypes.h" -#include "DatabaseObserver.h" #include <sqlite3.h> +#include <map> namespace am { +class DatabaseObserver; + #define DYNAMIC_ID_BOUNDARY 100 //!< the value below is reserved for staticIDs, the value above will be assigned to dynamically registered items //todo: we do not have to create MainSoundProperty tables if visible = false. diff --git a/AudioManagerDaemon/include/DatabaseObserver.h b/AudioManagerDaemon/include/DatabaseObserver.h index 21959a8..f35defe 100644 --- a/AudioManagerDaemon/include/DatabaseObserver.h +++ b/AudioManagerDaemon/include/DatabaseObserver.h @@ -25,17 +25,20 @@ #ifndef DATABASEOBSERVER_H_ #define DATABASEOBSERVER_H_ -#include "CommandSender.h" -#include "RoutingSender.h" +#include <audiomanagertypes.h> namespace am { +class TelnetServer; +class CommandSender; +class RoutingSender; /** * This class observes the Database and notifies other classes about important events, mainly the CommandSender. */ class DatabaseObserver { public: DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender); + DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender,TelnetServer *iTelnetServer); virtual ~DatabaseObserver(); void numberOfMainConnectionsChanged() ; void numberOfSinkClassesChanged() ; @@ -62,6 +65,7 @@ public: private: CommandSender *mCommandSender; //!< pointer to the comandSender RoutingSender* mRoutingSender; //!< pointer to the routingSender + TelnetServer* mTelnetServer; //!< pointer to the telnetserver }; } diff --git a/AudioManagerDaemon/include/RoutingReceiver.h b/AudioManagerDaemon/include/RoutingReceiver.h index f3ba2fe..a53a4ea 100644 --- a/AudioManagerDaemon/include/RoutingReceiver.h +++ b/AudioManagerDaemon/include/RoutingReceiver.h @@ -26,17 +26,16 @@ #define ROUTINGRECEIVER_H_ #include <routing/RoutingReceiveInterface.h> -#include <SocketHandler.h> #include <config.h> -#ifdef WITH_DBUS_WRAPPER -#include <dbus/DBusWrapper.h> -#endif -#include "DatabaseHandler.h" -#include "RoutingSender.h" -#include "ControlSender.h" namespace am { +class SocketHandler; +class DBusWrapper; +class DatabaseHandler; +class RoutingSender; +class ControlSender; + /** * Implements the Receiving side of the RoutingPlugins. */ @@ -52,7 +51,9 @@ public: void ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ; void ackSetSourceState(const am_Handle_s handle, const am_Error_e error) ; void ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) ; + void ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) ; void ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) ; + void ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) ; void ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error) ; void ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) ; void ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) ; @@ -80,13 +81,14 @@ public: am_Error_e sendChangedData(const std::vector<am_EarlyData_s>& earlyData) ; am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const ; am_Error_e getSocketHandler(SocketHandler*& socketHandler) const; + uint16_t getInterfaceVersion() const; private: DatabaseHandler *mDatabaseHandler; //!< pointer to the databaseHandler RoutingSender *mRoutingSender; //!< pointer to the routingSender ControlSender *mControlSender; //!< pointer to the controlSender - DBusWrapper *mDBusWrapper; //!< pointer to dbuswrapper SocketHandler *mSocketHandler; //!< pointer to sockethandler + DBusWrapper *mDBusWrapper; //!< pointer to dbuswrapper }; diff --git a/AudioManagerDaemon/include/RoutingSender.h b/AudioManagerDaemon/include/RoutingSender.h index 5f5967e..459fe84 100644 --- a/AudioManagerDaemon/include/RoutingSender.h +++ b/AudioManagerDaemon/include/RoutingSender.h @@ -103,10 +103,14 @@ public: am_Error_e asyncSetSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) ; am_Error_e asyncSetSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state) ; am_Error_e asyncSetSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s& soundProperty) ; + am_Error_e asyncSetSourceSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID) ; + am_Error_e asyncSetSinkSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sinkID_t sinkID) ; am_Error_e asyncSetSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s& soundProperty) ; am_Error_e asyncCrossFade(am_Handle_s& handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time) ; am_Error_e setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) ; am_Error_e getListHandles(std::vector<am_Handle_s> & listHandles) const ; + am_Error_e getListPlugins(std::vector<std::string>& interfaces) const; + uint16_t getInterfaceVersion() const; //!< is used to pair interfaces with busnames struct InterfaceNamePairs @@ -132,6 +136,7 @@ public: am_SourceState_e sourceState; am_volume_t volume; am_HotSink_e hotSink; + std::vector<am_SoundProperty_s>* soundProperties; }; }; @@ -146,7 +151,7 @@ public: * @param handle the handle * @return a class holding the handle data */ - am_handleData_c returnHandleData(am_Handle_s handle); + am_handleData_c returnHandleData(const am_Handle_s handle) const; private: diff --git a/AudioManagerDaemon/include/TelnetServer.h b/AudioManagerDaemon/include/TelnetServer.h new file mode 100644 index 0000000..9b7d097 --- /dev/null +++ b/AudioManagerDaemon/include/TelnetServer.h @@ -0,0 +1,89 @@ +/** +* Copyright (C) 2011, BMW AG +* +* GeniviAudioMananger AudioManagerDaemon +* +* \file TelnetServer.h +* +* \date 20-Oct-2011 3:42:04 PM +* \author Christian Mueller (christian.ei.mueller@bmw.de) +* +* \section License +* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause) +* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de +* +* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation. +* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details. +* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>. +* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense. +* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception. +* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned. +* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception. +* +*/ + + +#ifndef TELNETSERVER_H_ +#define TELNETSERVER_H_ + +#include "SocketHandler.h" +#include <queue> +#include <map> + +namespace am { + +class DatabaseHandler; +class CommandSender; +class RoutingSender; +class ControlSender; +class CommandReceiver; +class RoutingReceiver; +class ControlReceiver; + +class TelnetServer +{ +public: + TelnetServer(SocketHandler *iSocketHandler,CommandSender *iCommandSender,CommandReceiver *iCommandReceiver, RoutingSender *iRoutingSender,RoutingReceiver *iRoutingReceiver,ControlSender *iControlSender, ControlReceiver *iControlReceiver,DatabaseHandler *iDatabasehandler,unsigned int servPort, unsigned int maxConnections); + virtual ~TelnetServer(); + void connectSocket(const pollfd pfd,const sh_pollHandle_t handle, void* userData); + void receiveData(const pollfd pfd,const sh_pollHandle_t handle, void* userData); + bool dispatchData(const sh_pollHandle_t handle, void* userData); + bool check(const sh_pollHandle_t handle, void* userData); + shPollFired_T<TelnetServer> telnetConnectFiredCB; + shPollFired_T<TelnetServer> telnetReceiveFiredCB; + shPollDispatch_T<TelnetServer> telnetDispatchCB; + shPollCheck_T<TelnetServer> telnetCheckCB; +private: + typedef void (*CommandPrototype)(std::vector<std::string>& msg,int filedescriptor); + typedef std::map<std::string,CommandPrototype> mMapCommand_t; + static void listCommand(std::vector<std::string>& msg,int filedescriptor); + void listCommandShadow(std::vector<std::string>& msg,int filedescriptor); + void sliceCommand(const std::string& string,std::string& command,std::vector<std::string>& msg); + mMapCommand_t createCommandMap(); + struct connection_s + { + int filedescriptor; + sh_pollHandle_t handle; + }; + + static TelnetServer* instance; + SocketHandler *mSocketHandler; + CommandSender *mCommandSender; + CommandReceiver *mCommandReceiver; + RoutingSender *mRoutingSender; + RoutingReceiver *mRoutingReceiver; + ControlSender *mControlSender; + ControlReceiver *mControlReceiver; + DatabaseHandler *mDatabasehandler; + sh_pollHandle_t mConnecthandle; + std::queue<std::string> msgList; + std::vector<connection_s> mListConnections; + int mConnectFD; + unsigned int mServerPort; + unsigned int mMaxConnections; + mMapCommand_t mMapCommands; + +}; + +} /* namespace am */ +#endif /* TELNETSERVER_H_ */ diff --git a/AudioManagerDaemon/src/CommandReceiver.cpp b/AudioManagerDaemon/src/CommandReceiver.cpp index 6cee4ad..15d2430 100644 --- a/AudioManagerDaemon/src/CommandReceiver.cpp +++ b/AudioManagerDaemon/src/CommandReceiver.cpp @@ -23,6 +23,8 @@ */ #include "CommandReceiver.h" +#include "DatabaseHandler.h" +#include "ControlSender.h" #include <SocketHandler.h> #include <config.h> #include <assert.h> @@ -204,7 +206,7 @@ am_Error_e CommandReceiver::getDBusConnectionWrapper(DBusWrapper*& dbusConnectio #endif /*WITH_DBUS_WRAPPER*/ } -am_Error_e am::CommandReceiver::getSocketHandler(SocketHandler *& socketHandler) const +am_Error_e CommandReceiver::getSocketHandler(SocketHandler *& socketHandler) const { #ifdef WITH_SOCKETHANDLER_LOOP socketHandler=mSocketHandler; @@ -214,6 +216,13 @@ am_Error_e am::CommandReceiver::getSocketHandler(SocketHandler *& socketHandler) #endif /*WITH_SOCKETHANDLER_LOOP*/ } +uint16_t CommandReceiver::getInterfaceVersion() const +{ + return CommandReceiveVersion; +} + + + diff --git a/AudioManagerDaemon/src/CommandSender.cpp b/AudioManagerDaemon/src/CommandSender.cpp index 7ea9ee8..92734c4 100644 --- a/AudioManagerDaemon/src/CommandSender.cpp +++ b/AudioManagerDaemon/src/CommandSender.cpp @@ -24,11 +24,14 @@ #include "CommandSender.h" +#include "command/CommandReceiveInterface.h" #include <dirent.h> #include <dlt/dlt.h> #include "PluginTemplate.h" using namespace am; +#define REQUIRED_INTERFACE_VERSION 1 + DLT_IMPORT_CONTEXT(AudioManager) //!< macro to call all interfaces @@ -67,7 +70,7 @@ CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirecto unsigned char entryType = itemInDirectory->d_type; std::string entryName = itemInDirectory->d_name; - bool regularFile = (entryType == DT_REG); + bool regularFile = (entryType == DT_REG || entryType== DT_LNK); bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1)); if (regularFile && sharedLibExtension) @@ -104,6 +107,13 @@ CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirecto continue; } + //check libversion + if (commander->getInterfaceVersion()<REQUIRED_INTERFACE_VERSION) + { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingPlugin initialization failed. Version of Interface to old")); + continue; + } + mListInterfaces.push_back(commander); mListLibraryHandles.push_back(tempLibHandle); } @@ -258,6 +268,13 @@ void CommandSender::unloadLibraries(void) mListLibraryHandles.clear(); } +uint16_t CommandSender::getInterfaceVersion() const +{ + return CommandSendVersion; +} + + + diff --git a/AudioManagerDaemon/src/ControlReceiver.cpp b/AudioManagerDaemon/src/ControlReceiver.cpp index 3a88c84..763bf2c 100644 --- a/AudioManagerDaemon/src/ControlReceiver.cpp +++ b/AudioManagerDaemon/src/ControlReceiver.cpp @@ -23,7 +23,11 @@ */ #include <config.h> +#include <SocketHandler.h> #include "ControlReceiver.h" +#include "DatabaseHandler.h" +#include "RoutingSender.h" +#include "CommandSender.h" #include <assert.h> #include <dlt/dlt.h> @@ -151,7 +155,21 @@ am_Error_e ControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_ return mRoutingSender->asyncSetSinkSoundProperty(handle,sinkID,soundProperty); } +am_Error_e am::ControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties) +{ + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSinkSoundProperties got called, sinkID="),DLT_INT(sinkID)); + uint16_t value; + bool noChange=true; + std::vector<am_SoundProperty_s>::const_iterator it=listSoundProperties.begin(); + for(;it!=listSoundProperties.end();++it) + { + if(mDatabaseHandler->getSinkSoundPropertyValue(sinkID,it->type,value)!=E_OK) return (E_UNKNOWN); + if(value!=it->value) noChange=false; + } + if (noChange) return (E_NO_CHANGE); + return (mRoutingSender->asyncSetSinkSoundProperties(handle,listSoundProperties,sinkID)); +} am_Error_e ControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty) { @@ -163,6 +181,21 @@ am_Error_e ControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const a return mRoutingSender->asyncSetSourceSoundProperty(handle,sourceID,soundProperty); } +am_Error_e am::ControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties) +{ + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSourceSoundProperties got called, sourceID="),DLT_INT(sourceID)); + + uint16_t value; + bool noChange=true; + std::vector<am_SoundProperty_s>::const_iterator it=listSoundProperties.begin(); + for(;it!=listSoundProperties.end();++it) + { + if(mDatabaseHandler->getSourceSoundPropertyValue(sourceID,it->type,value)!=E_OK) return (E_UNKNOWN); + if(value!=it->value) noChange=false; + } + if (noChange) return (E_NO_CHANGE); + return (mRoutingSender->asyncSetSourceSoundProperties(handle,listSoundProperties,sourceID)); +} am_Error_e ControlReceiver::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState) @@ -528,6 +561,14 @@ am_Error_e am::ControlReceiver::getSocketHandler(SocketHandler *& socketHandler) } +uint16_t ControlReceiver::getInterfaceVersion() const +{ + return ControlReceiveVersion; +} + + + + diff --git a/AudioManagerDaemon/src/ControlSender.cpp b/AudioManagerDaemon/src/ControlSender.cpp index cc0c6bb..a9e9220 100644 --- a/AudioManagerDaemon/src/ControlSender.cpp +++ b/AudioManagerDaemon/src/ControlSender.cpp @@ -1,9 +1,26 @@ -/* - * ControlSender.cpp - * - * Created on: Dec 9, 2011 - * Author: christian - */ +/** +* Copyright (C) 2011, BMW AG +* +* GeniviAudioMananger AudioManagerDaemon +* +* \file ControlSender.cpp +* +* \date 20-Oct-2011 3:42:04 PM +* \author Christian Mueller (christian.ei.mueller@bmw.de) +* +* \section License +* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause) +* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de +* +* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation. +* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details. +* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>. +* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense. +* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception. +* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned. +* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception. +* +*/ #include "ControlSender.h" #include <assert.h> @@ -14,6 +31,8 @@ DLT_IMPORT_CONTEXT(AudioManager) using namespace am; +#define REQUIRED_MIN_INTERFACE_VERSION 1 + ControlSender::ControlSender(std::string controlPluginFile) :mlibHandle(NULL), mController(NULL) @@ -24,6 +43,9 @@ ControlSender::ControlSender(std::string controlPluginFile) createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile,mlibHandle); assert(createFunc!=NULL); mController = createFunc(); + + //check libversion + assert(REQUIRED_MIN_INTERFACE_VERSION<=mController->getInterfaceVersion()); } else { @@ -303,5 +325,22 @@ void ControlSender::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am return mController->cbAckSetSinkSoundProperty(handle,error); } +void ControlSender::cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) +{ + return mController->cbAckSetSinkSoundProperties(handle,error); +} + +void ControlSender::cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) +{ + return mController->cbAckSetSourceSoundProperties(handle,error); +} + +uint16_t ControlSender::getInterfaceVersion() const +{ + return ControlSendVersion; +} + + + diff --git a/AudioManagerDaemon/src/DBusWrapper.cpp b/AudioManagerDaemon/src/DBusWrapper.cpp index 66a135a..cb332ef 100644 --- a/AudioManagerDaemon/src/DBusWrapper.cpp +++ b/AudioManagerDaemon/src/DBusWrapper.cpp @@ -39,7 +39,7 @@ DLT_IMPORT_CONTEXT(AudioManager) #define ROOT_INTROSPECT_XML \ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ "<node>" \ -"<interface name='orAudioManagerg.freedesktop.DBus.Introspectable'>" \ +"<interface name='org.AudioManager.freedesktop.DBus.Introspectable'>" \ "<method name='Introspect'>" \ " <arg name='xml_data' type='s' direction='out'/>" \ "</method>" \ diff --git a/AudioManagerDaemon/src/DatabaseHandler.cpp b/AudioManagerDaemon/src/DatabaseHandler.cpp index 021868c..76aadf8 100644 --- a/AudioManagerDaemon/src/DatabaseHandler.cpp +++ b/AudioManagerDaemon/src/DatabaseHandler.cpp @@ -23,6 +23,7 @@ */ #include "DatabaseHandler.h" +#include "DatabaseObserver.h" #include <assert.h> #include <vector> #include <fstream> diff --git a/AudioManagerDaemon/src/DatabaseObserver.cpp b/AudioManagerDaemon/src/DatabaseObserver.cpp index f6b1930..63f3b02 100644 --- a/AudioManagerDaemon/src/DatabaseObserver.cpp +++ b/AudioManagerDaemon/src/DatabaseObserver.cpp @@ -23,9 +23,10 @@ */ #include "DatabaseObserver.h" -#include <assert.h> #include "CommandSender.h" #include "RoutingSender.h" +#include "TelnetServer.h" +#include <assert.h> using namespace am; @@ -37,6 +38,16 @@ DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender assert(mRoutingSender!=0); } +DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, TelnetServer *iTelnetServer) + :mCommandSender(iCommandSender), + mRoutingSender(iRoutingSender), + mTelnetServer(iTelnetServer) +{ + assert(mCommandSender!=0); + assert(mRoutingSender!=0); + assert(mTelnetServer!=0); +} + DatabaseObserver::~DatabaseObserver() { // TODO Auto-generated destructor stub } @@ -206,3 +217,6 @@ void DatabaseObserver::timingInformationChanged(const am_mainConnectionID_t main + + + diff --git a/AudioManagerDaemon/src/RoutingReceiver.cpp b/AudioManagerDaemon/src/RoutingReceiver.cpp index 5629e67..93fd925 100644 --- a/AudioManagerDaemon/src/RoutingReceiver.cpp +++ b/AudioManagerDaemon/src/RoutingReceiver.cpp @@ -24,6 +24,13 @@ */ #include "RoutingReceiver.h" +#include <SocketHandler.h> +#ifdef WITH_DBUS_WRAPPER +#include <dbus/DBusWrapper.h> +#endif +#include "DatabaseHandler.h" +#include "RoutingSender.h" +#include "ControlSender.h" #include <assert.h> using namespace am; @@ -149,7 +156,6 @@ void RoutingReceiver::ackSetSinkSoundProperty(const am_Handle_s handle, const am RoutingSender::am_handleData_c handleData=mRoutingSender->returnHandleData(handle); if(error==E_OK && handleData.sinkID!=0) { - //todo: check if volume in handleData is same than volume. React to it. mDatabaseHandler->changeSinkSoundPropertyDB(handleData.soundPropery,handleData.sinkID); } mRoutingSender->removeHandle(handle); @@ -157,6 +163,21 @@ void RoutingReceiver::ackSetSinkSoundProperty(const am_Handle_s handle, const am } +void am::RoutingReceiver::ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) +{ + RoutingSender::am_handleData_c handleData=mRoutingSender->returnHandleData(handle); + if(error==E_OK && handleData.sinkID!=0) + { + std::vector<am_SoundProperty_s>::const_iterator it=handleData.soundProperties->begin(); + for(;it!=handleData.soundProperties->end();++it) + { + mDatabaseHandler->changeSinkSoundPropertyDB(*it,handleData.sinkID); + } + delete handleData.soundProperties; + } + mRoutingSender->removeHandle(handle); + mControlSender->cbAckSetSinkSoundProperties(handle,error); +} void RoutingReceiver::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error) @@ -164,7 +185,6 @@ void RoutingReceiver::ackSetSourceSoundProperty(const am_Handle_s handle, const RoutingSender::am_handleData_c handleData=mRoutingSender->returnHandleData(handle); if(error==E_OK && handleData.sourceID!=0) { - //todo: check if volume in handleData is same than volume. React to it. mDatabaseHandler->changeSourceSoundPropertyDB(handleData.soundPropery,handleData.sourceID); } mRoutingSender->removeHandle(handle); @@ -172,6 +192,21 @@ void RoutingReceiver::ackSetSourceSoundProperty(const am_Handle_s handle, const } +void am::RoutingReceiver::ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) +{ + RoutingSender::am_handleData_c handleData=mRoutingSender->returnHandleData(handle); + if(error==E_OK && handleData.sourceID!=0) + { + std::vector<am_SoundProperty_s>::const_iterator it=handleData.soundProperties->begin(); + for(;it!=handleData.soundProperties->end();++it) + { + mDatabaseHandler->changeSourceSoundPropertyDB(*it,handleData.sourceID); + } + delete handleData.soundProperties; + } + mRoutingSender->removeHandle(handle); + mControlSender->cbAckSetSourceSoundProperties(handle,error); +} void RoutingReceiver::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error) { @@ -355,7 +390,7 @@ am_Error_e RoutingReceiver::peekSourceClassID(const std::string name, const am_s return E_NOT_USED; } -am_Error_e am::RoutingReceiver::getDBusConnectionWrapper(DBusWrapper *& dbusConnectionWrapper) const +am_Error_e RoutingReceiver::getDBusConnectionWrapper(DBusWrapper *& dbusConnectionWrapper) const { #ifdef WITH_DBUS_WRAPPER dbusConnectionWrapper=mDBusWrapper; @@ -366,7 +401,7 @@ am_Error_e am::RoutingReceiver::getDBusConnectionWrapper(DBusWrapper *& dbusConn } -am_Error_e am::RoutingReceiver::getSocketHandler(SocketHandler *& socketHandler) const +am_Error_e RoutingReceiver::getSocketHandler(SocketHandler *& socketHandler) const { #ifdef WITH_SOCKETHANDLER_LOOP socketHandler=mSocketHandler; @@ -376,5 +411,12 @@ am_Error_e am::RoutingReceiver::getSocketHandler(SocketHandler *& socketHandler) #endif } +uint16_t RoutingReceiver::getInterfaceVersion() const +{ + return RoutingReceiveVersion; +} + + + diff --git a/AudioManagerDaemon/src/RoutingSender.cpp b/AudioManagerDaemon/src/RoutingSender.cpp index 3b5bdad..2b2adb5 100644 --- a/AudioManagerDaemon/src/RoutingSender.cpp +++ b/AudioManagerDaemon/src/RoutingSender.cpp @@ -32,6 +32,8 @@ using namespace am; +#define REQUIRED_INTERFACE_VERSION 1 + #define CALL_ALL_INTERFACES(...) \ std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin(); \ std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end(); \ @@ -99,7 +101,7 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto for (; iter != iterEnd; ++iter) { - //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Loading Hook plugin"),DLT_STRING(iter->c_str())); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingPlugin: "),DLT_STRING(iter->c_str())); RoutingSendInterface* (*createFunc)(); void* tempLibHandle=NULL; @@ -107,7 +109,7 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto if (!createFunc) { - // DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Entry point of Communicator not found")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Entry point of RoutingPlugin not found")); continue; } @@ -115,13 +117,21 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto if (!router) { - //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("HookPlugin initialization failed. Entry Function not callable")); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingPlugin initialization failed. Entry Function not callable")); continue; } InterfaceNamePairs routerInterface; routerInterface.routingInterface = router; + //check libversion + if (router->getInterfaceVersion()<REQUIRED_INTERFACE_VERSION) + { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingPlugin initialization failed. Version of Interface to old")); + continue; + } + + //here, the busname is saved together with the interface. Later The domains will register with the name and sinks, sources etc with the domain.... router->returnBusName(routerInterface.busName); assert(!routerInterface.busName.empty()); @@ -134,6 +144,16 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto RoutingSender::~RoutingSender() { unloadLibraries(); + HandlesMap::iterator it=mlistActiveHandles.begin(); + + //clean up heap if existent + for(;it!=mlistActiveHandles.end();++it) + { + if (it->first.handleType==H_SETSINKSOUNDPROPERTIES || it->first.handleType==H_SETSOURCESOUNDPROPERTIES) + { + delete it->second.soundProperties; + } + } } void RoutingSender::routingInterfacesReady() @@ -263,11 +283,10 @@ am_Error_e RoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, const a handle=createHandle(handleData,H_SETSINKSOUNDPROPERTY); mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second)); return iter->second->asyncSetSinkSoundProperty(handle,soundProperty,sinkID); - return E_NON_EXISTENT; + return (E_NON_EXISTENT); } - am_Error_e RoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty) { am_handleData_c handleData; @@ -279,11 +298,39 @@ am_Error_e RoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, const handle=createHandle(handleData,H_SETSOURCESOUNDPROPERTY); mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second)); return iter->second->asyncSetSourceSoundProperty(handle,soundProperty,sourceID); - return E_NON_EXISTENT; + return (E_NON_EXISTENT); } +am_Error_e am::RoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sourceID_t sourceID) +{ + am_handleData_c handleData; + SourceInterfaceMap::iterator iter = mMapSourceInterface.begin(); + iter=mMapSourceInterface.find(sourceID); + if (iter != mMapSourceInterface.end()) + handleData.sourceID=sourceID; + handleData.soundProperties=new std::vector<am_SoundProperty_s>(listSoundProperties); + handle=createHandle(handleData,H_SETSOURCESOUNDPROPERTIES); + mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second)); + return iter->second->asyncSetSourceSoundProperties(handle,listSoundProperties,sourceID); + return (E_NON_EXISTENT); +} +am_Error_e am::RoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sinkID_t sinkID) +{ + am_handleData_c handleData; + SinkInterfaceMap::iterator iter = mMapSinkInterface.begin(); + iter=mMapSinkInterface.find(sinkID); + if (iter != mMapSinkInterface.end()) + handleData.sinkID=sinkID; + handleData.soundProperties=new std::vector<am_SoundProperty_s>(listSoundProperties); + handle=createHandle(handleData,H_SETSINKSOUNDPROPERTIES); + mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second)); + return iter->second->asyncSetSinkSoundProperties(handle,listSoundProperties,sinkID); + return (E_NON_EXISTENT); + +} + am_Error_e RoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time) { am_handleData_c handleData; @@ -455,9 +502,9 @@ am_Handle_s RoutingSender::createHandle(const am_handleData_c& handleData, const return handle; } -RoutingSender::am_handleData_c RoutingSender::returnHandleData(am_Handle_s handle) +RoutingSender::am_handleData_c RoutingSender::returnHandleData(const am_Handle_s handle) const { - HandlesMap::iterator it=mlistActiveHandles.begin(); + HandlesMap::const_iterator it=mlistActiveHandles.begin(); it=mlistActiveHandles.find(handle); return (it->second); } @@ -472,6 +519,26 @@ void RoutingSender::unloadLibraries(void) mListLibraryHandles.clear(); } +am_Error_e am::RoutingSender::getListPlugins(std::vector<std::string>& interfaces) const +{ + std::vector<InterfaceNamePairs>::const_iterator it=mListInterfaces.begin(); + for(;it!=mListInterfaces.end();++it) + { + interfaces.push_back(it->busName); + } + return E_OK; +} + + +uint16_t RoutingSender::getInterfaceVersion() const +{ + return (RoutingSendVersion); +} + + + + + diff --git a/AudioManagerDaemon/src/TelnetServer.cpp b/AudioManagerDaemon/src/TelnetServer.cpp new file mode 100644 index 0000000..3e77b0b --- /dev/null +++ b/AudioManagerDaemon/src/TelnetServer.cpp @@ -0,0 +1,270 @@ +/** +* Copyright (C) 2011, BMW AG +* +* GeniviAudioMananger AudioManagerDaemon +* +* \file TelnetServer.cpp +* +* \date 20-Oct-2011 3:42:04 PM +* \author Christian Mueller (christian.ei.mueller@bmw.de) +* +* \section License +* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause) +* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de +* +* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation. +* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details. +* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>. +* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense. +* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception. +* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned. +* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception. +* +*/ + +#include "TelnetServer.h" +#include <assert.h> +#include <sys/socket.h> /* for socket(), connect(), (), and recv() */ +#include <arpa/inet.h> /* for sockaddr_in and inet_addr() */ +#include <sys/ioctl.h> +#include <string.h> +#include <netdb.h> +#include <dlt/dlt.h> +#include <config.h> +#include <errno.h> +#include <sstream> +#include <istream> +#include <iostream> +#include <iterator> +#include "DatabaseHandler.h" +#include "RoutingSender.h" + +using namespace am; + +DLT_IMPORT_CONTEXT(AudioManager) + +TelnetServer* TelnetServer::instance=NULL; + +#define PRINT_BOOL(var) var ? output+="true\t\t" : output+="false\t\t"; + +TelnetServer::TelnetServer(SocketHandler *iSocketHandler, CommandSender *iCommandSender, CommandReceiver *iCommandReceiver, RoutingSender *iRoutingSender, RoutingReceiver *iRoutingReceiver, ControlSender *iControlSender, ControlReceiver *iControlReceiver, DatabaseHandler *iDatabasehandler, unsigned int servPort, unsigned int maxConnections) + :telnetConnectFiredCB(this,&TelnetServer::connectSocket), + telnetReceiveFiredCB(this,&TelnetServer::receiveData), + telnetDispatchCB(this,&TelnetServer::dispatchData), + telnetCheckCB(this,&TelnetServer::check), + mSocketHandler(iSocketHandler), + mCommandSender(iCommandSender), + mCommandReceiver(iCommandReceiver), + mRoutingSender(iRoutingSender), + mRoutingReceiver(iRoutingReceiver), + mControlSender(iControlSender), + mControlReceiver(iControlReceiver), + mDatabasehandler(iDatabasehandler), + mConnecthandle(), + msgList(), + mListConnections(), + mConnectFD(NULL), + mServerPort(servPort), + mMaxConnections(maxConnections), + mMapCommands(createCommandMap()) +{ + assert(mSocketHandler!=NULL); + assert(mCommandReceiver!=NULL); + assert(mCommandSender!=NULL); + assert(mControlSender!=NULL); + assert(mControlReceiver!=NULL); + assert(mRoutingSender!=NULL); + assert(mRoutingReceiver!=NULL); + assert(mDatabasehandler!=NULL); + assert(servPort!=0); + assert(mMaxConnections!=0); + + instance=this; + + int yes =1; + struct sockaddr_in servAddr; + + //setup the port Listener + mConnectFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + setsockopt(mConnectFD, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)); + memset(&servAddr, 0, sizeof(servAddr)); + servAddr.sin_family = AF_INET; + servAddr.sin_addr.s_addr = INADDR_ANY; + servAddr.sin_port = htons(servPort); + bind(mConnectFD, (struct sockaddr *) &servAddr, sizeof(servAddr)); + + if (listen(mConnectFD,mMaxConnections) < 0) + { + DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("TelnetServer::TelnetServerk cannot listen "),DLT_INT(errno)); + } + DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("TelnetServer::TelnetServerk started listening on port"),DLT_INT(mServerPort)); + + int a=1; + ioctl (mConnectFD, FIONBIO, (char *) &a); + setsockopt (mConnectFD, SOL_SOCKET, SO_KEEPALIVE, (char *) &a, sizeof (a)); + + short events=0; + events |= POLLIN; + mSocketHandler->addFDPoll(mConnectFD,events,NULL,&telnetConnectFiredCB,NULL,NULL,NULL,mConnecthandle); +} + +TelnetServer::~TelnetServer() +{ +} + +void TelnetServer::connectSocket(const pollfd pfd, const sh_pollHandle_t handle, void *userData) +{ + //first, accept the connection, create a new filedescriptor + struct sockaddr answer; + socklen_t len=sizeof(answer); + connection_s connection; + connection.filedescriptor = accept(pfd.fd, (struct sockaddr*)&answer, &len); + + mListConnections.push_back(connection); + + //set the correct event: + short event = 0; + event |=POLLIN; + + //aded the filedescriptor to the sockethandler and register the callbacks for receiving the data + mSocketHandler->addFDPoll(mListConnections.back().filedescriptor,event,NULL,&telnetReceiveFiredCB,&telnetCheckCB,&telnetDispatchCB,NULL,mListConnections.back().handle); +} + + + +void TelnetServer::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData) +{ + //initialize buffer + char buffer[100]; + //read until buffer is full or no more data is there + int read=recv(pollfd.fd,buffer,100,NULL); + if (read>1) + { + //read the message and store it in a queue - its a telnet connection so data will be sent on enter ! + std::string msg=std::string(buffer,read); + msgList.push(msg); + } +} + + + +bool TelnetServer::dispatchData(const sh_pollHandle_t handle, void *userData) +{ + std::vector<connection_s>::iterator iterator=mListConnections.begin(); + for(;iterator!=mListConnections.end();++iterator) + { + if(iterator->handle==handle) break; + } + if (iterator==mListConnections.end()) return false; + + std::string command; + std::vector<std::string> msg; + sliceCommand(msgList.front(),command,msg); + msgList.pop(); + mMapCommand_t::iterator commandIter=mMapCommands.find(command); + if (commandIter==mMapCommands.end()) + { + send(iterator->filedescriptor,"Command not found!\n",20,0); + } + else + { + (*commandIter).second(msg,iterator->filedescriptor); + } + + //remove the message from the queue and return false if there is no more message to read. + if (msgList.size()!=0) return true; + return false; +} + + + + +bool TelnetServer::check(const sh_pollHandle_t handle, void *userData) +{ + if (msgList.size()!=0) return true; + return false; +} + +void TelnetServer::listCommand(std::vector<std::string>& msg, int filedescriptor) +{ + instance->listCommandShadow(msg,filedescriptor); +} + +void am::TelnetServer::listCommandShadow(std::vector<std::string> & msg, int filedescriptor) +{ + std::string output; + if(msg.empty()) + { + output+="No second parameter given after list, please enter\n"; + } + else if(msg.front().compare("plugins")==0) + { + std::vector<std::string> plugins; + mRoutingSender->getListPlugins(plugins); + std::vector<std::string>::iterator it=plugins.begin(); + output="\n\nrouting plugins:\n-------------------------\n"; + for(;it!=plugins.end();++it) + { + output+=*it+"\n"; + } + } + else if(msg.front().compare("domains")==0) + { + output="domainID\t\tdomainName\t\tbusName\t\tnodeName\t\tearly\t\tstate\t\tcomplete\n"; + output+="-------------------------------------------------------------------------------------\n"; + std::vector<am_Domain_s> domainList; + mDatabasehandler->getListDomains(domainList); + std::vector<am_Domain_s>::iterator it=domainList.begin(); + for(;it!=domainList.end();++it) + { + output+=it->domainID + "\t\t"; + output+=it->name + "\t\t"; + output+=it->busname + "\t\t"; + output+=it->nodename + "\t\t"; + PRINT_BOOL(it->early); + switch (it->state) + { + case DS_CONTROLLED: + output+="DS_CONTROLLED\t\t"; + break; + case DS_INDEPENDENT_STARTUP: + output+="DS_INDEPENDENT_STARTUP\t\t"; + break; + case DS_INDEPENDENT_RUNDOWN: + output+="DS_INDEPENDENT_RUNDOWN\t\t"; + break; + default: + output+="undefined\t\t"; + break; + } + PRINT_BOOL(it->complete); + } + } + else + { + output="did not recognize parameter: " + msg.front()+"\n"; + } + send(filedescriptor,output.c_str(),output.size(),0); +} + + +void am::TelnetServer::sliceCommand(const std::string & string, std::string & command, std::vector<std::string> & msg) +{ + std::stringstream stream(string); + std::istream_iterator<std::string> begin(stream); + std::istream_iterator<std::string> end; + command=*begin++; + msg=std::vector<std::string>(begin, end); +} + +TelnetServer::mMapCommand_t TelnetServer::createCommandMap() +{ + mMapCommand_t commands; + commands.insert(std::make_pair("list",&TelnetServer::listCommand)); + return commands; +} + + + + + diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp index 5d840a9..d5c447d 100644 --- a/AudioManagerDaemon/src/main.cpp +++ b/AudioManagerDaemon/src/main.cpp @@ -36,19 +36,21 @@ //todo: make sure all configurations are tested #include <config.h> +#include <SocketHandler.h> #ifdef WITH_DBUS_WRAPPER #include <dbus/DBusWrapper.h> #endif #include "DatabaseHandler.h" -#include "DatabaseObserver.h" -#include "RoutingReceiver.h" -#include "CommandReceiver.h" -#include "ControlReceiver.h" #include "ControlSender.h" #include "CommandSender.h" #include "RoutingSender.h" -#include <SocketHandler.h> +#include "RoutingReceiver.h" +#include "CommandReceiver.h" +#include "ControlReceiver.h" +#include "DatabaseObserver.h" +#include "TelnetServer.h" #include <sys/resource.h> +#include <sys/stat.h> #include <unistd.h> #include <stdlib.h> #include <cstdlib> @@ -58,8 +60,6 @@ #include <string.h> #include <stdio.h> - - #include <dlt/dlt.h> DLT_DECLARE_CONTEXT(AudioManager) @@ -69,19 +69,24 @@ using namespace am; const char* USAGE_DESCRIPTION = "Usage:\tAudioManagerDaemon [options]\n" "options:\t\n" "\t-h: print this message\t\n" + "\t-i: info about current settings \t\n" "\t-v: print version\t\n" "\t-d: daemonize AudioManager \t\n" - "\t-p: path for sqlite database (default is in memory)\t\n" - "\t-c: <Name> use controllerPlugin <Name> (full path with .so ending)\t\n" - "\t-l: <Name> replace command plugin directory with <Name> (full path)\t\n" - "\t-r: <Name> replace routing plugin directory with <Name> (full path)\t\n" - "\t-L: <Name> add command plugin directory with <Name> (full path)\t\n" - "\t-R: <Name> add routing plugin directory with <Name> (full path)\t\n"; + "\t-p<path> path for sqlite database (default is in memory)\t\n" + "\t-t<port> port for telnetconnection\t\n" + "\t-m<max> number of max telnetconnections\t\n" + "\t-c<Name> use controllerPlugin <Name> (full path with .so ending)\t\n" + "\t-l<Name> replace command plugin directory with <Name> (full path)\t\n" + "\t-r<Name> replace routing plugin directory with <Name> (full path)\t\n" + "\t-L<Name> add command plugin directory with <Name> (full path)\t\n" + "\t-R<Name> add routing plugin directory with <Name> (full path)\t\n"; std::string controllerPlugin=std::string(CONTROLLER_PLUGIN); std::vector<std::string> listCommandPluginDirs; std::vector<std::string> listRoutingPluginDirs; std::string databasePath=std::string(":memory:"); +unsigned int telnetport=DEFAULT_TELNETPORT; +unsigned int maxConnections=MAX_TELNETCONNECTIONS; void daemonize () { @@ -136,10 +141,29 @@ void parseCommandLine(int argc, char **argv) { while (optind < argc) { - int option = getopt (argc, argv, "h::v::c::l::r::L::R::d"); + int option = getopt (argc, argv, "h::v::c::l::r::L::R::d::t::m::i::"); switch (option) { + case 'i': + printf("Current settings:\n"); + printf("\tAudioManagerDaemon Version:\t\t%s\n",DAEMONVERSION); + printf("\tTelnet portNumber:\t\t\t%i\n",telnetport); + printf("\tTelnet maxConnections:\t\t\t%i\n",maxConnections); + printf("\tSqlite Database path:\t\t\t%s\n",databasePath.c_str()); + printf("\tControllerPlugin: \t\t\t%s\n",controllerPlugin.c_str()); + printf("\tDirectory of CommandPlugins: \t\t%s\n",listCommandPluginDirs.front().c_str()); + printf("\tDirectory of RoutingPlugins: \t\t%s\n",listRoutingPluginDirs.front().c_str()); + exit(0); + break; + case 't': + assert(atoi(optarg)!=0); + telnetport=atoi(optarg); + break; + case 'm': + assert(atoi(optarg)!=0); + maxConnections=atoi(optarg); + break; case 'p': assert(!controllerPlugin.empty()); databasePath=std::string(optarg); @@ -215,7 +239,6 @@ int main(int argc, char *argv[]) signalChildAction.sa_flags = SA_NOCLDWAIT; sigaction (SIGCHLD, &signalChildAction, NULL); - //Instantiate all classes. Keep in same order ! #ifdef WITH_SOCKETHANDLER_LOOP SocketHandler iSocketHandler; @@ -233,13 +256,15 @@ int main(int argc, char *argv[]) RoutingSender iRoutingSender(listRoutingPluginDirs); CommandSender iCommandSender(listCommandPluginDirs); ControlSender iControlSender(controllerPlugin); - DatabaseObserver iObserver(&iCommandSender, &iRoutingSender); #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); +#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); @@ -249,8 +274,18 @@ int main(int argc, char *argv[]) CommandReceiver iCommandReceiver(&iDatabaseHandler,&iControlSender,&iSocketHandler); RoutingReceiver iRoutingReceiver(&iDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler); ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler); +#ifdef WITH_TELNET + TelnetServer iTelnetServer(&iSocketHandler,telnetport,maxConnections); +#endif #endif /*WITH_DBUS_WRAPPER*/ +#ifdef WITH_TELNET + DatabaseObserver iObserver(&iCommandSender, &iRoutingSender,&iTelnetServer); +#else + DatabaseObserver iObserver(&iCommandSender, &iRoutingSender); +#endif + + //since the plugins have been loaded by the *Senders before, we can tell the Controller this: iControlSender.hookAllPluginsLoaded(); diff --git a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h index 2e6122b..b4a4eec 100644 --- a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h +++ b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h @@ -35,33 +35,39 @@ namespace am { class MockRoutingSendInterface : public RoutingSendInterface { public: MOCK_METHOD1(startupRoutingInterface, - void(RoutingReceiveInterface* routingreceiveinterface)); + void(RoutingReceiveInterface* routingreceiveinterface)); MOCK_METHOD0(routingInterfacesReady, - void()); + void()); MOCK_METHOD0(routingInterfacesRundown, - void()); + void()); MOCK_METHOD1(asyncAbort, - am_Error_e(const am_Handle_s handle)); + am_Error_e(const am_Handle_s handle)); MOCK_METHOD5(asyncConnect, - am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)); + am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)); MOCK_METHOD2(asyncDisconnect, - am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID)); + am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID)); MOCK_METHOD5(asyncSetSinkVolume, - am_Error_e(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)); + am_Error_e(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)); MOCK_METHOD5(asyncSetSourceVolume, - am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)); + am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)); MOCK_METHOD3(asyncSetSourceState, - am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)); + 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)); 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_SoundProperty_s& soundProperty, const am_sinkID_t sinkID)); + MOCK_METHOD3(asyncSetSourceSoundProperties, + am_Error_e(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID)); 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_SoundProperty_s& soundProperty, const am_sourceID_t sourceID)); 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)); + am_Error_e(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)); MOCK_METHOD2(setDomainState, - am_Error_e(const am_domainID_t domainID, const am_DomainState_e domainState)); + am_Error_e(const am_domainID_t domainID, const am_DomainState_e domainState)); MOCK_CONST_METHOD1(returnBusName, - am_Error_e(std::string& BusName)); + am_Error_e(std::string& BusName)); + MOCK_CONST_METHOD0(getInterfaceVersion, + uint16_t()); }; @@ -141,12 +147,20 @@ class MockControlSendInterface : public ControlSendInterface { void(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error)); MOCK_METHOD2(cbAckSetSourceState, void(const am_Handle_s handle, const am_Error_e error)); + MOCK_METHOD2(cbAckSetSourceSoundProperties, + void(const am_Handle_s handle, const am_Error_e error)); MOCK_METHOD2(cbAckSetSourceSoundProperty, void(const am_Handle_s handle, const am_Error_e error)); + MOCK_METHOD2(cbAckSetSinkSoundProperties, + void(const am_Handle_s handle, const am_Error_e error)); MOCK_METHOD2(cbAckSetSinkSoundProperty, void(const am_Handle_s handle, const am_Error_e error)); + MOCK_CONST_METHOD0(getInterfaceVersion, + uint16_t()); }; + + } // namespace am diff --git a/AudioManagerDaemon/test/database/MockInterfaces.h b/AudioManagerDaemon/test/database/MockInterfaces.h index e774c32..514c7cf 100644 --- a/AudioManagerDaemon/test/database/MockInterfaces.h +++ b/AudioManagerDaemon/test/database/MockInterfaces.h @@ -70,11 +70,15 @@ class MockCommandSendInterface : public CommandSendInterface { MOCK_METHOD1(cbSystemPropertyChanged, void(const am_SystemProperty_s& systemProperty)); MOCK_METHOD2(cbTimingInformationChanged, - void(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)); + void (const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID)); + MOCK_CONST_METHOD0(getInterfaceVersion, + uint16_t()); + }; + class MockControlSendInterface : public ControlSendInterface { public: MOCK_METHOD1(startupController, diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp index fc74f89..1a0075c 100644 --- a/AudioManagerDaemon/test/database/databaseTest.cpp +++ b/AudioManagerDaemon/test/database/databaseTest.cpp @@ -24,6 +24,14 @@ */ #include "databaseTest.h" +#include "MockInterfaces.h" +#include "DatabaseHandler.h" +#include "ControlReceiver.h" +#include "ControlSender.h" +#include "DatabaseObserver.h" +#include "../ControlInterfaceBackdoor.h" +#include "../CommandInterfaceBackdoor.h" +#include "../CommonFunctions.h" using namespace am; using namespace testing; diff --git a/AudioManagerDaemon/test/database/databaseTest.h b/AudioManagerDaemon/test/database/databaseTest.h index fd91487..4098dc0 100644 --- a/AudioManagerDaemon/test/database/databaseTest.h +++ b/AudioManagerDaemon/test/database/databaseTest.h @@ -40,12 +40,14 @@ #include "ControlReceiver.h" #include "ControlSender.h" #include "DatabaseObserver.h" +#include "RoutingSender.h" #include "../ControlInterfaceBackdoor.h" #include "../CommandInterfaceBackdoor.h" #include "../CommonFunctions.h" namespace am { + class databaseTest : public ::testing::Test { public: databaseTest(); diff --git a/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h b/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h index c0eada7..850d90c 100644 --- a/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h +++ b/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h @@ -32,37 +32,43 @@ namespace am { - class MockRoutingSendInterface : public RoutingSendInterface { - public: - MOCK_METHOD1(startupRoutingInterface, - void(RoutingReceiveInterface* routingreceiveinterface)); - MOCK_METHOD0(routingInterfacesReady, - void()); - MOCK_METHOD0(routingInterfacesRundown, - void()); - MOCK_METHOD1(asyncAbort, - am_Error_e(const am_Handle_s handle)); - MOCK_METHOD5(asyncConnect, - am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)); - MOCK_METHOD2(asyncDisconnect, - am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID)); - MOCK_METHOD5(asyncSetSinkVolume, - am_Error_e(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)); - MOCK_METHOD5(asyncSetSourceVolume, - am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)); - MOCK_METHOD3(asyncSetSourceState, - am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)); - MOCK_METHOD3(asyncSetSinkSoundProperty, - am_Error_e(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID)); - MOCK_METHOD3(asyncSetSourceSoundProperty, - am_Error_e(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID)); - MOCK_METHOD5(asyncCrossFade, - am_Error_e(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)); - MOCK_METHOD2(setDomainState, - am_Error_e(const am_domainID_t domainID, const am_DomainState_e domainState)); - MOCK_CONST_METHOD1(returnBusName, - am_Error_e(std::string& BusName)); - }; +class MockRoutingSendInterface : public RoutingSendInterface { + public: + MOCK_METHOD1(startupRoutingInterface, + void(RoutingReceiveInterface* routingreceiveinterface)); + MOCK_METHOD0(routingInterfacesReady, + void()); + MOCK_METHOD0(routingInterfacesRundown, + void()); + MOCK_METHOD1(asyncAbort, + am_Error_e(const am_Handle_s handle)); + MOCK_METHOD5(asyncConnect, + am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)); + MOCK_METHOD2(asyncDisconnect, + am_Error_e(const am_Handle_s handle, const am_connectionID_t connectionID)); + MOCK_METHOD5(asyncSetSinkVolume, + am_Error_e(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)); + MOCK_METHOD5(asyncSetSourceVolume, + am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)); + MOCK_METHOD3(asyncSetSourceState, + am_Error_e(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)); + MOCK_METHOD3(asyncSetSinkSoundProperties, + am_Error_e(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sinkID_t sinkID)); + MOCK_METHOD3(asyncSetSinkSoundProperty, + am_Error_e(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID)); + MOCK_METHOD3(asyncSetSourceSoundProperties, + am_Error_e(const am_Handle_s handle, const std::vector<am_SoundProperty_s>& listSoundProperties, const am_sourceID_t sourceID)); + MOCK_METHOD3(asyncSetSourceSoundProperty, + am_Error_e(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID)); + MOCK_METHOD5(asyncCrossFade, + am_Error_e(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)); + MOCK_METHOD2(setDomainState, + am_Error_e(const am_domainID_t domainID, const am_DomainState_e domainState)); + MOCK_CONST_METHOD1(returnBusName, + am_Error_e(std::string& BusName)); + MOCK_CONST_METHOD0(getInterfaceVersion, + uint16_t()); +}; } // namespace am diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp index ff67912..8a66d57 100644 --- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp +++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp @@ -28,7 +28,7 @@ using namespace am; using namespace testing; -DLT_DECLARE_CONTEXT(DLT_CONTEXT) +DLT_DECLARE_CONTEXT(DLT_CONTEXT); routingInterfaceTest::routingInterfaceTest() :plistRoutingPluginDirs(), |