summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AudioManagerDaemon/include/CommandReceiver.h106
-rw-r--r--AudioManagerDaemon/include/CommandSender.h100
-rw-r--r--AudioManagerDaemon/include/ControlReceiver.h195
-rw-r--r--AudioManagerDaemon/include/ControlSender.h145
-rw-r--r--AudioManagerDaemon/include/DatabaseHandler.h449
-rw-r--r--AudioManagerDaemon/include/DatabaseObserver.h106
-rw-r--r--AudioManagerDaemon/include/PluginTemplate.h142
-rw-r--r--AudioManagerDaemon/include/RoutingReceiver.h142
-rw-r--r--AudioManagerDaemon/include/RoutingSender.h307
-rw-r--r--AudioManagerDaemon/include/TelnetServer.h122
-rw-r--r--AudioManagerDaemon/src/CommandReceiver.cpp196
-rw-r--r--AudioManagerDaemon/src/CommandSender.cpp233
-rw-r--r--AudioManagerDaemon/src/ControlReceiver.cpp444
-rw-r--r--AudioManagerDaemon/src/ControlSender.cpp251
-rw-r--r--AudioManagerDaemon/src/DBusWrapper.cpp517
-rw-r--r--AudioManagerDaemon/src/DatabaseHandler.cpp6494
-rw-r--r--AudioManagerDaemon/src/DatabaseObserver.cpp180
-rw-r--r--AudioManagerDaemon/src/RoutingReceiver.cpp412
-rw-r--r--AudioManagerDaemon/src/RoutingSender.cpp525
-rw-r--r--AudioManagerDaemon/src/SocketHandler.cpp679
-rw-r--r--AudioManagerDaemon/src/TelnetServer.cpp388
-rw-r--r--AudioManagerDaemon/src/main.cpp425
-rw-r--r--AudioManagerDaemon/test/CommandInterfaceBackdoor.h60
-rw-r--r--AudioManagerDaemon/test/CommonFunctions.cpp636
-rw-r--r--AudioManagerDaemon/test/CommonFunctions.h141
-rw-r--r--AudioManagerDaemon/test/ControlInterfaceBackdoor.h58
-rw-r--r--AudioManagerDaemon/test/RoutingInterfaceBackdoor.h60
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp857
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h91
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.cpp2920
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.h85
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp584
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h83
-rw-r--r--AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp377
-rw-r--r--AudioManagerDaemon/test/sockethandler/sockethandlerTest.h72
-rw-r--r--PluginCommandInterfaceDbus/include/CommandReceiverShadow.h156
-rw-r--r--PluginCommandInterfaceDbus/include/DBusCommandSender.h161
-rw-r--r--PluginCommandInterfaceDbus/include/DBusMessageHandler.h53
-rw-r--r--PluginCommandInterfaceDbus/include/mainpage.h1
-rw-r--r--PluginCommandInterfaceDbus/src/CommandReceiverShadow.cpp617
-rw-r--r--PluginCommandInterfaceDbus/src/DBusCommandSender.cpp366
-rw-r--r--PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp577
-rw-r--r--PluginCommandInterfaceDbus/test/config.h17
-rw-r--r--PluginControlInterface/include/ControlSender.h139
-rw-r--r--PluginControlInterface/src/ControlSender.cpp185
-rw-r--r--PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h319
-rw-r--r--PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h552
-rw-r--r--PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp848
-rw-r--r--PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp1925
-rw-r--r--PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp527
-rw-r--r--PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h79
-rw-r--r--PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp172
-rw-r--r--PluginRoutingInterfaceDbus/include/RoutingSender.h87
-rw-r--r--PluginRoutingInterfaceDbus/src/RoutingSender.cpp95
-rw-r--r--README3
-rw-r--r--cmake/AudioManager_Codestyle.xml155
-rw-r--r--includes/SocketHandler.h336
-rw-r--r--includes/audiomanagertypes.cpp0
-rw-r--r--includes/audiomanagertypes.h100
-rw-r--r--includes/command/CommandReceiveInterface.h8
-rw-r--r--includes/command/CommandSendInterface.h10
-rw-r--r--includes/config.h4
-rw-r--r--includes/control/ControlReceiveInterface.h8
-rw-r--r--includes/dbus/DBusWrapper.h157
-rw-r--r--includes/projecttypes.h20
-rw-r--r--includes/routing/RoutingReceiveInterface.h8
-rw-r--r--includes/routing/RoutingSendInterface.h8
67 files changed, 12731 insertions, 13544 deletions
diff --git a/AudioManagerDaemon/include/CommandReceiver.h b/AudioManagerDaemon/include/CommandReceiver.h
index 114d075..1d00216 100644
--- a/AudioManagerDaemon/include/CommandReceiver.h
+++ b/AudioManagerDaemon/include/CommandReceiver.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file CommandReveiver.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file CommandReveiver.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 COMMANDRECEIVER_H_
#define COMMANDRECEIVER_H_
@@ -28,7 +28,8 @@
#include <command/CommandReceiveInterface.h>
#include <config.h>
-namespace am {
+namespace am
+{
class DatabaseHandler;
class ControlSender;
@@ -38,38 +39,39 @@ class SocketHandler;
/**
* This class realizes the command Interface
*/
-class CommandReceiver: public CommandReceiveInterface {
+class CommandReceiver: public CommandReceiveInterface
+{
public:
- CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender,DBusWrapper* iDBusWrapper);
- CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender,SocketHandler* iSocketHandler);
- CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender,SocketHandler* iSocketHandler,DBusWrapper* iDBusWrapper);
- virtual ~CommandReceiver();
- am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) ;
- am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID) ;
- am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume) ;
- am_Error_e volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep) ;
- am_Error_e setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
- am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) ;
- am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) ;
- am_Error_e setSystemProperty(const am_SystemProperty_s& property) ;
- am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const ;
- am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const ;
- am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const ;
- am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const ;
- am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const ;
- am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const ;
- am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const ;
- am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const ;
- am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const ;
- am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const ;
- am_Error_e getSocketHandler(SocketHandler*& socketHandler) const;
- uint16_t getInterfaceVersion() const;
+ CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, DBusWrapper* iDBusWrapper);
+ CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, SocketHandler* iSocketHandler);
+ CommandReceiver(DatabaseHandler* iDatabaseHandler, ControlSender* iControlSender, SocketHandler* iSocketHandler, DBusWrapper* iDBusWrapper);
+ virtual ~CommandReceiver();
+ am_Error_e connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID);
+ am_Error_e disconnect(const am_mainConnectionID_t mainConnectionID);
+ am_Error_e setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume);
+ am_Error_e volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep);
+ am_Error_e setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState);
+ am_Error_e setMainSinkSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
+ am_Error_e setMainSourceSoundProperty(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
+ am_Error_e setSystemProperty(const am_SystemProperty_s& property);
+ am_Error_e getListMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const;
+ am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const;
+ am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const;
+ am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const;
+ am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const;
+ am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
+ am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
+ am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
+ am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const;
+ am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const;
+ am_Error_e getSocketHandler(SocketHandler*& socketHandler) const;
+ uint16_t getInterfaceVersion() const;
private:
- DatabaseHandler* mDatabaseHandler; //!< pointer to the databasehandler
- ControlSender* mControlSender; //!< pointer to the control sender
- DBusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper
- SocketHandler* mSocketHandler; //!< pointer to the SocketHandler
+ DatabaseHandler* mDatabaseHandler; //!< pointer to the databasehandler
+ ControlSender* mControlSender; //!< pointer to the control sender
+ DBusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper
+ SocketHandler* mSocketHandler; //!< pointer to the SocketHandler
};
}
diff --git a/AudioManagerDaemon/include/CommandSender.h b/AudioManagerDaemon/include/CommandSender.h
index 5a412f3..a3898dc 100644
--- a/AudioManagerDaemon/include/CommandSender.h
+++ b/AudioManagerDaemon/include/CommandSender.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file CommandSender.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file CommandSender.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 COMMANDSENDER_H_
#define COMMANDSENDER_H_
@@ -31,42 +31,44 @@
#include "command/CommandSendInterface.h"
-namespace am {
+namespace am
+{
/**
* This class is used to send data to the CommandInterface.
* All loaded plugins will be called when a callback is invoked.
*/
-class CommandSender {
+class CommandSender
+{
public:
- CommandSender(const std::vector<std::string>& listOfPluginDirectories);
- virtual ~CommandSender();
- am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface) ;
- am_Error_e stopInterface() ;
- void cbCommunicationReady() ;
- void cbCommunicationRundown() ;
- void cbNumberOfMainConnectionsChanged() ;
- void cbNumberOfSinksChanged() ;
- void cbNumberOfSourcesChanged() ;
- void cbNumberOfSinkClassesChanged() ;
- void cbNumberOfSourceClassesChanged() ;
- void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) ;
- void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty) ;
- void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty) ;
- void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
- void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
- void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume) ;
- void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
- void cbSystemPropertyChanged(const am_SystemProperty_s& SystemProperty) ;
- void cbTimingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time) ;
- uint16_t getInterfaceVersion() const;
+ CommandSender(const std::vector<std::string>& listOfPluginDirectories);
+ virtual ~CommandSender();
+ am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface);
+ am_Error_e stopInterface();
+ void cbCommunicationReady();
+ void cbCommunicationRundown();
+ void cbNumberOfMainConnectionsChanged();
+ void cbNumberOfSinksChanged();
+ void cbNumberOfSourcesChanged();
+ void cbNumberOfSinkClassesChanged();
+ void cbNumberOfSourceClassesChanged();
+ void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState);
+ void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty);
+ void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty);
+ void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability);
+ void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume);
+ void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
+ void cbSystemPropertyChanged(const am_SystemProperty_s& SystemProperty);
+ void cbTimingInformationChanged(const am_mainConnectionID_t 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
+ friend class CommandInterfaceBackdoor; //this is to get access to the loaded plugins and be able to exchange the interfaces
#endif
private:
- void unloadLibraries(void); //!< unload the shared libraries
- std::vector<CommandSendInterface*> mListInterfaces; //!< list of all interfaces
- std::vector<void*> mListLibraryHandles; //!< list of all library handles. This information is used to unload the plugins correctly.
+ void unloadLibraries(void); //!< unload the shared libraries
+ std::vector<CommandSendInterface*> mListInterfaces; //!< list of all interfaces
+ std::vector<void*> mListLibraryHandles; //!< list of all library handles. This information is used to unload the plugins correctly.
};
}
diff --git a/AudioManagerDaemon/include/ControlReceiver.h b/AudioManagerDaemon/include/ControlReceiver.h
index a8afb79..ac2168c 100644
--- a/AudioManagerDaemon/include/ControlReceiver.h
+++ b/AudioManagerDaemon/include/ControlReceiver.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file ControlReceiver.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file ControlReceiver.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 CONTRONLRECEIVER_H_
#define CONTRONLRECEIVER_H_
@@ -28,8 +28,8 @@
#include <control/ControlReceiveInterface.h>
#include <config.h>
-
-namespace am {
+namespace am
+{
class SocketHandler;
class DatabaseHandler;
@@ -39,82 +39,83 @@ class CommandSender;
/**
* This class is used to receive all commands from the control interface
*/
-class ControlReceiver: public ControlReceiveInterface {
+class ControlReceiver: public ControlReceiveInterface
+{
public:
- ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler);
- ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender);
- 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) ;
- am_Error_e disconnect(am_Handle_s& handle, const am_connectionID_t connectionID) ;
- am_Error_e crossfade(am_Handle_s& handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime) ;
- am_Error_e setSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state) ;
- 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) ;
- am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID) ;
- am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID) ;
- am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
- am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
- am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID) ;
- am_Error_e enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID) ;
- am_Error_e enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass) ;
- am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties) ;
- am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s& route) ;
- am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState) ;
- am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID) ;
- am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID) ;
- am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID) ;
- am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID) ;
- am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) ;
- am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) ;
- am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID) ;
- am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property) ;
- am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& classInfo) ;
- am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& classInfo) ;
- am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID) ;
- am_Error_e removeSinkDB(const am_sinkID_t sinkID) ;
- am_Error_e removeSourceDB(const am_sourceID_t sourceID) ;
- am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID) ;
- am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID) ;
- am_Error_e removeDomainDB(const am_domainID_t domainID) ;
- am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID) ;
- am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID) ;
- am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const ;
- am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const ;
- am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const ;
- am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const ;
- am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const ;
- am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const ;
- am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listGatewaysID) const ;
- am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const ;
- am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const ;
- am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const ;
- am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const ;
- am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const ;
- am_Error_e getListSources(std::vector<am_Source_s>& lisSources) const ;
- am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const ;
- am_Error_e getListHandles(std::vector<am_Handle_s>& listHandles) const ;
- am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const ;
- am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const ;
- am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const ;
- am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const ;
- void setRoutingReady() ;
- void setCommandReady() ;
- am_Error_e getSocketHandler(SocketHandler*& socketHandler);
- uint16_t getInterfaceVersion() const;
+ ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler);
+ ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender);
+ 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);
+ am_Error_e disconnect(am_Handle_s& handle, const am_connectionID_t connectionID);
+ am_Error_e crossfade(am_Handle_s& handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime);
+ am_Error_e setSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state);
+ 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);
+ am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID);
+ am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
+ am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
+ am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID);
+ am_Error_e enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID);
+ am_Error_e enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass);
+ am_Error_e enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s>& listSystemProperties);
+ am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s& route);
+ am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState);
+ am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID);
+ am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID);
+ am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID);
+ am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID);
+ am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
+ am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
+ am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID);
+ am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property);
+ am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& classInfo);
+ am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& classInfo);
+ am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID);
+ am_Error_e removeSinkDB(const am_sinkID_t sinkID);
+ am_Error_e removeSourceDB(const am_sourceID_t sourceID);
+ am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID);
+ am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID);
+ am_Error_e removeDomainDB(const am_domainID_t domainID);
+ am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
+ am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID);
+ am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const;
+ am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const;
+ am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const;
+ am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const;
+ am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const;
+ am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const;
+ am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listGatewaysID) const;
+ am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const;
+ am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const;
+ am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const;
+ am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const;
+ am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const;
+ am_Error_e getListSources(std::vector<am_Source_s>& lisSources) const;
+ am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
+ am_Error_e getListHandles(std::vector<am_Handle_s>& listHandles) const;
+ am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const;
+ am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const;
+ am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
+ am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
+ void setRoutingReady();
+ void setCommandReady();
+ am_Error_e getSocketHandler(SocketHandler*& socketHandler);
+ uint16_t getInterfaceVersion() const;
private:
- DatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler
- RoutingSender* mRoutingSender; //!< pointer to the routing send interface.
- CommandSender* mCommandSender; //!< pointer to the command send interface
- SocketHandler* mSocketHandler; //!< pointer to the socketHandler
+ DatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler
+ RoutingSender* mRoutingSender; //!< pointer to the routing send interface.
+ CommandSender* mCommandSender; //!< pointer to the command send interface
+ SocketHandler* mSocketHandler; //!< pointer to the socketHandler
};
}
diff --git a/AudioManagerDaemon/include/ControlSender.h b/AudioManagerDaemon/include/ControlSender.h
index 2134fa6..3021c3c 100644
--- a/AudioManagerDaemon/include/ControlSender.h
+++ b/AudioManagerDaemon/include/ControlSender.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file ControlSender.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file ControlSender.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 CONTROLSENDER_H_
#define CONTROLSENDER_H_
@@ -31,64 +31,67 @@
#include "control/ControlSendInterface.h"
-namespace am {
+namespace am
+{
/**
* sends data to the commandInterface, takes the file of the library that needs to be loaded
*/
-class ControlSender {
+class ControlSender
+{
public:
- ControlSender(std::string controlPluginFile);
- virtual ~ControlSender();
- am_Error_e startupController(ControlReceiveInterface* controlreceiveinterface) ;
- am_Error_e stopController() ;
- am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) ;
- am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID) ;
- am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) ;
- am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) ;
- am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property) ;
- am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume) ;
- am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment) ;
- am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
- am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID) ;
- am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID) ;
- am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) ;
- am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID) ;
- am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) ;
- am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID) ;
- am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
- am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID) ;
- am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
- am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID) ;
- void hookAllPluginsLoaded() ;
- void hookSystemDomainRegistrationComplete(const am_domainID_t domainID) ;
- void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) ;
- void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) ;
- void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) ;
- void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
- void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
- void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state) ;
- void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data) ;
- void hookSystemSpeedChange(const am_speed_t speed) ;
- void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) ;
- void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID) ;
- void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) ;
- void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error) ;
- void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ;
- 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;
+ ControlSender(std::string controlPluginFile);
+ virtual ~ControlSender();
+ am_Error_e startupController(ControlReceiveInterface* controlreceiveinterface);
+ am_Error_e stopController();
+ am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID);
+ am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID);
+ am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty);
+ am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty);
+ am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property);
+ am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume);
+ am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment);
+ am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState);
+ am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID);
+ am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID);
+ am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
+ am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID);
+ am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID);
+ am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID);
+ am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID);
+ am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
+ am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID);
+ void hookAllPluginsLoaded();
+ void hookSystemDomainRegistrationComplete(const am_domainID_t domainID);
+ void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume);
+ void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume);
+ void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState);
+ void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability);
+ void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state);
+ void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data);
+ void hookSystemSpeedChange(const am_speed_t speed);
+ void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
+ void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID);
+ void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID);
+ void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error);
+ void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
+ 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);
+ am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats);
+ uint16_t getInterfaceVersion() const;
#ifdef UNIT_TEST
- friend class ControlInterfaceBackdoor;
+ friend class ControlInterfaceBackdoor;
#endif
private:
- void* mlibHandle; //!< pointer to the loaded control plugin interface
- ControlSendInterface* mController; //!< pointer to the ControlSend interface
+ void* mlibHandle; //!< pointer to the loaded control plugin interface
+ ControlSendInterface* mController; //!< pointer to the ControlSend interface
};
}
diff --git a/AudioManagerDaemon/include/DatabaseHandler.h b/AudioManagerDaemon/include/DatabaseHandler.h
index 65f4a64..5d1cac7 100644
--- a/AudioManagerDaemon/include/DatabaseHandler.h
+++ b/AudioManagerDaemon/include/DatabaseHandler.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file Databasehandler.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file Databasehandler.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 DATABASEHANDLER_H_
#define DATABASEHANDLER_H_
@@ -29,14 +29,14 @@
#include <sqlite3.h>
#include <map>
-namespace am {
+namespace am
+{
class DatabaseObserver;
class RoutingTree;
class RoutingTreeItem;
#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.
//todo: check the enum values before entering & changing in the database.
//todo: change asserts for dynamic boundary checks into failure answers.#
@@ -50,223 +50,224 @@ class RoutingTreeItem;
/**
* This class handles and abstracts the database
*/
-class DatabaseHandler {
+class DatabaseHandler
+{
public:
- DatabaseHandler(std::string databasePath);
- virtual ~DatabaseHandler();
- am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID) ;
- am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID) ;
- am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID) ;
- am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
- am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
- am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID) ;
- am_Error_e enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID);
- am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID) ;
- am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass) ;
- am_Error_e enterSystemProperties(const std::vector<am_SystemProperty_s>& listSystemProperties) ;
- am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s& route) ;
- am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState) ;
- am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID) ;
- am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID) ;
- am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID) ;
- am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID) ;
- am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID) ;
- am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID) ;
- am_Error_e changeSourceSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID) ;
- am_Error_e changeSinkSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID) ;
- am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID) ;
- am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property) ;
- am_Error_e changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID) ;
- am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass) ;
- am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass) ;
- am_Error_e changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay) ;
- am_Error_e changeConnectionFinal(const am_connectionID_t connectionID) ;
- am_Error_e changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState);
- am_Error_e changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume);
- am_Error_e changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume);
- am_Error_e changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID,const am_HotSink_e hotsink);
- am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID) ;
- am_Error_e removeSinkDB(const am_sinkID_t sinkID) ;
- am_Error_e removeSourceDB(const am_sourceID_t sourceID) ;
- am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID) ;
- am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID) ;
- am_Error_e removeDomainDB(const am_domainID_t domainID) ;
- am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID) ;
- am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID) ;
- am_Error_e removeConnection(const am_connectionID_t connectionID) ;
- am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const ;
- am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const ;
- am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const ;
- am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const ;
- am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t& volume) const;
- am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t& volume) const;
- am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t& value) const ;
- am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, uint16_t& value) const ;
- am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const ;
- am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const ;
- am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listGatewaysID) const ;
- am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const ;
- am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const ;
- am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const ;
- am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const ;
- am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const ;
- am_Error_e getListSources(std::vector<am_Source_s>& lisSources) const ;
- am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const ;
- am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const ;
- am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const ;
- am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const ;
- am_Error_e getListVisibleMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const ;
- am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const ;
- am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const ;
- am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const ;
- am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const ;
- am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const ;
- am_Error_e getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const ;
- am_Error_e getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const ;
- am_Error_e getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const;
- am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const ;
- am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t& domainID) const;
- am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const;
- am_Error_e getSoureState(const am_sourceID_t sourceID, am_SourceState_e& sourceState) const;
- am_Error_e getDomainState(const am_domainID_t domainID, am_DomainState_e state) const;
- am_Error_e getRoutingTree(bool onlyfree, RoutingTree* tree, std::vector<RoutingTreeItem*>* flatTree);
- am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
- am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
- am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
- /**
- * checks for a certain mainConnection
- * @param mainConnectionID to be checked for
- * @return true if it exists
- */
- bool existMainConnection(const am_mainConnectionID_t mainConnectionID) const;
+ DatabaseHandler(std::string databasePath);
+ virtual ~DatabaseHandler();
+ am_Error_e enterDomainDB(const am_Domain_s& domainData, am_domainID_t& domainID);
+ am_Error_e enterMainConnectionDB(const am_MainConnection_s& mainConnectionData, am_mainConnectionID_t& connectionID);
+ am_Error_e enterSinkDB(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
+ am_Error_e enterCrossfaderDB(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
+ am_Error_e enterGatewayDB(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e enterSourceDB(const am_Source_s& sourceData, am_sourceID_t& sourceID);
+ am_Error_e enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID);
+ am_Error_e enterSinkClassDB(const am_SinkClass_s& sinkClass, am_sinkClass_t& sinkClassID);
+ am_Error_e enterSourceClassDB(am_sourceClass_t& sourceClassID, const am_SourceClass_s& sourceClass);
+ am_Error_e enterSystemProperties(const std::vector<am_SystemProperty_s>& listSystemProperties);
+ am_Error_e changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s& route);
+ am_Error_e changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState);
+ am_Error_e changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID);
+ am_Error_e changeSinkAvailabilityDB(const am_Availability_s& availability, const am_sinkID_t sinkID);
+ am_Error_e changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID);
+ am_Error_e changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID);
+ am_Error_e changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sinkID_t sinkID);
+ am_Error_e changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s& soundProperty, const am_sourceID_t sourceID);
+ am_Error_e changeSourceSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sourceID_t sourceID);
+ am_Error_e changeSinkSoundPropertyDB(const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID);
+ am_Error_e changeSourceAvailabilityDB(const am_Availability_s& availability, const am_sourceID_t sourceID);
+ am_Error_e changeSystemPropertyDB(const am_SystemProperty_s& property);
+ am_Error_e changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID);
+ am_Error_e changeSinkClassInfoDB(const am_SinkClass_s& sinkClass);
+ am_Error_e changeSourceClassInfoDB(const am_SourceClass_s& sourceClass);
+ am_Error_e changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay);
+ am_Error_e changeConnectionFinal(const am_connectionID_t connectionID);
+ am_Error_e changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState);
+ am_Error_e changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume);
+ am_Error_e changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume);
+ am_Error_e changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink);
+ am_Error_e removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID);
+ am_Error_e removeSinkDB(const am_sinkID_t sinkID);
+ am_Error_e removeSourceDB(const am_sourceID_t sourceID);
+ am_Error_e removeGatewayDB(const am_gatewayID_t gatewayID);
+ am_Error_e removeCrossfaderDB(const am_crossfaderID_t crossfaderID);
+ am_Error_e removeDomainDB(const am_domainID_t domainID);
+ am_Error_e removeSinkClassDB(const am_sinkClass_t sinkClassID);
+ am_Error_e removeSourceClassDB(const am_sourceClass_t sourceClassID);
+ am_Error_e removeConnection(const am_connectionID_t connectionID);
+ am_Error_e getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s& classInfo) const;
+ am_Error_e getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s& sinkClass) const;
+ am_Error_e getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s& gatewayData) const;
+ am_Error_e getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s& crossfaderData) const;
+ am_Error_e getSinkVolume(const am_sinkID_t sinkID, am_volume_t& volume) const;
+ am_Error_e getSourceVolume(const am_sourceID_t sourceID, am_volume_t& volume) const;
+ am_Error_e getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t& value) const;
+ am_Error_e getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, uint16_t& value) const;
+ am_Error_e getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t>& listSinkID) const;
+ am_Error_e getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t>& listSourceID) const;
+ am_Error_e getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t>& listGatewaysID) const;
+ am_Error_e getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t>& listGatewaysID) const;
+ am_Error_e getListMainConnections(std::vector<am_MainConnection_s>& listMainConnections) const;
+ am_Error_e getListDomains(std::vector<am_Domain_s>& listDomains) const;
+ am_Error_e getListConnections(std::vector<am_Connection_s>& listConnections) const;
+ am_Error_e getListSinks(std::vector<am_Sink_s>& listSinks) const;
+ am_Error_e getListSources(std::vector<am_Source_s>& lisSources) const;
+ am_Error_e getListSourceClasses(std::vector<am_SourceClass_s>& listSourceClasses) const;
+ am_Error_e getListCrossfaders(std::vector<am_Crossfader_s>& listCrossfaders) const;
+ am_Error_e getListGateways(std::vector<am_Gateway_s>& listGateways) const;
+ am_Error_e getListSinkClasses(std::vector<am_SinkClass_s>& listSinkClasses) const;
+ am_Error_e getListVisibleMainConnections(std::vector<am_MainConnectionType_s>& listConnections) const;
+ am_Error_e getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const;
+ am_Error_e getListMainSources(std::vector<am_SourceType_s>& listMainSources) const;
+ am_Error_e getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundProperties) const;
+ am_Error_e getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSourceProperties) const;
+ am_Error_e getListSystemProperties(std::vector<am_SystemProperty_s>& listSystemProperties) const;
+ am_Error_e getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const;
+ am_Error_e getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const;
+ am_Error_e getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const;
+ am_Error_e getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t& delay) const;
+ am_Error_e getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t& domainID) const;
+ am_Error_e getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t& domainID) const;
+ am_Error_e getSoureState(const am_sourceID_t sourceID, am_SourceState_e& sourceState) const;
+ am_Error_e getDomainState(const am_domainID_t domainID, am_DomainState_e state) const;
+ am_Error_e getRoutingTree(bool onlyfree, RoutingTree* tree, std::vector<RoutingTreeItem*>* flatTree);
+ am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
+ am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
+ am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
+ /**
+ * checks for a certain mainConnection
+ * @param mainConnectionID to be checked for
+ * @return true if it exists
+ */
+ bool existMainConnection(const am_mainConnectionID_t mainConnectionID) const;
- /**
- * checks if a CrossFader exists
- * @param crossfaderID the ID of the crossfader to be checked
- * @return true if exists
- */
- bool existcrossFader(const am_crossfaderID_t crossfaderID) const;
+ /**
+ * checks if a CrossFader exists
+ * @param crossfaderID the ID of the crossfader to be checked
+ * @return true if exists
+ */
+ bool existcrossFader(const am_crossfaderID_t crossfaderID) const;
- /**
- * checks if a connection already exists.
- * Only takes sink, source and format information for search!
- * @param connection the connection to be checked
- * @return true if connections exists
- */
- bool existConnection(const am_Connection_s connection);
+ /**
+ * checks if a connection already exists.
+ * Only takes sink, source and format information for search!
+ * @param connection the connection to be checked
+ * @return true if connections exists
+ */
+ bool existConnection(const am_Connection_s connection);
- /**
- * checks if a connection with the given ID exists
- * @param connectionID
- * @return true if connection exits
- */
- bool existConnectionID(const am_connectionID_t connectionID);
- /**
- * checks for a certain Source
- * @param sourceID to be checked for
- * @return true if it exists
- */
- bool existSource(const am_sourceID_t sourceID) const;
+ /**
+ * checks if a connection with the given ID exists
+ * @param connectionID
+ * @return true if connection exits
+ */
+ bool existConnectionID(const am_connectionID_t connectionID);
+ /**
+ * checks for a certain Source
+ * @param sourceID to be checked for
+ * @return true if it exists
+ */
+ bool existSource(const am_sourceID_t sourceID) const;
- /**
- * checks if a source name or ID exists
- * @param sourceID the sourceID
- * @param name the name
- * @return true if it exits
- */
- bool existSourceNameOrID(const am_sourceID_t sourceID, const std::string& name) const;
+ /**
+ * checks if a source name or ID exists
+ * @param sourceID the sourceID
+ * @param name the name
+ * @return true if it exits
+ */
+ bool existSourceNameOrID(const am_sourceID_t sourceID, const std::string& name) const;
- /**
- * checks if a name exits
- * @param name the name
- * @return true if it exits
- */
- bool existSourceName(const std::string& name) const;
- /**
- * checks for a certain Sink
- * @param sinkID to be checked for
- * @return true if it exists
- */
- bool existSink(const am_sinkID_t sinkID) const;
+ /**
+ * checks if a name exits
+ * @param name the name
+ * @return true if it exits
+ */
+ bool existSourceName(const std::string& name) const;
+ /**
+ * checks for a certain Sink
+ * @param sinkID to be checked for
+ * @return true if it exists
+ */
+ bool existSink(const am_sinkID_t sinkID) const;
- /**
- * checks if a sink with the ID or the name exists
- * @param sinkID the ID
- * @param name the name
- * @return true if it exists.
- */
- bool existSinkNameOrID(const am_sinkID_t sinkID, const std::string& name) const;
+ /**
+ * checks if a sink with the ID or the name exists
+ * @param sinkID the ID
+ * @param name the name
+ * @return true if it exists.
+ */
+ bool existSinkNameOrID(const am_sinkID_t sinkID, const std::string& name) const;
- /**
- * checks if a sink with the name exists
- * @param name the name
- * @return true if it exists
- */
- bool existSinkName(const std::string& name) const;
+ /**
+ * checks if a sink with the name exists
+ * @param name the name
+ * @return true if it exists
+ */
+ bool existSinkName(const std::string& name) const;
- /**
- * checks for a certain domain
- * @param domainID to be checked for
- * @return true if it exists
- */
- bool existDomain(const am_domainID_t domainID) const;
+ /**
+ * checks for a certain domain
+ * @param domainID to be checked for
+ * @return true if it exists
+ */
+ bool existDomain(const am_domainID_t domainID) const;
- /**
- * checks for certain gateway
- * @param gatewayID to be checked for
- * @return true if it exists
- */
- bool existGateway(const am_gatewayID_t gatewayID) const;
+ /**
+ * checks for certain gateway
+ * @param gatewayID to be checked for
+ * @return true if it exists
+ */
+ bool existGateway(const am_gatewayID_t gatewayID) const;
- /**
- * checks for certain SinkClass
- * @param sinkClassID
- * @return true if it exists
- */
- bool existSinkClass(const am_sinkClass_t sinkClassID) const;
+ /**
+ * checks for certain SinkClass
+ * @param sinkClassID
+ * @return true if it exists
+ */
+ bool existSinkClass(const am_sinkClass_t sinkClassID) const;
- /**
- * checks for certain sourceClass
- * @param sourceClassID
- * @return true if it exists
- */
- bool existSourceClass(const am_sourceClass_t sourceClassID) const;
+ /**
+ * checks for certain sourceClass
+ * @param sourceClassID
+ * @return true if it exists
+ */
+ bool existSourceClass(const am_sourceClass_t sourceClassID) const;
- /**
- * registers the Observer at the Database
- * @param iObserver pointer to the observer
- */
- void registerObserver(DatabaseObserver *iObserver);
+ /**
+ * registers the Observer at the Database
+ * @param iObserver pointer to the observer
+ */
+ void registerObserver(DatabaseObserver *iObserver);
- /**
- * gives information about the visibility of a source
- * @param sourceID the sourceID
- * @return true if source is visible
- */
- bool sourceVisible(const am_sourceID_t sourceID) const;
+ /**
+ * gives information about the visibility of a source
+ * @param sourceID the sourceID
+ * @return true if source is visible
+ */
+ bool sourceVisible(const am_sourceID_t sourceID) const;
- /**
- * gives information about the visibility of a sink
- * @param sinkID the sinkID
- * @return true if source is visible
- */
- bool sinkVisible(const am_sinkID_t sinkID) const;
+ /**
+ * gives information about the visibility of a sink
+ * @param sinkID the sinkID
+ * @return true if source is visible
+ */
+ bool sinkVisible(const am_sinkID_t sinkID) const;
private:
- am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const;
- bool sqQuery(const std::string& query);
- bool openDatabase(); //!< opens the database
- void createTables(); //!< creates all tables from the static table
- sqlite3 *mDatabase; //!< pointer to the database
- std::string mPath; //!< path to the database
- DatabaseObserver *mDatabaseObserver; //!< pointer to the Observer
- bool mFirstStaticSink;
- bool mFirstStaticSource;
- bool mFirstStaticGateway;
- bool mFirstStaticSinkClass;
- bool mFirstStaticSourceClass;
- typedef std::map<am_gatewayID_t,std::vector<bool> > ListConnectionFormat; //!< type for list of connection formats
- ListConnectionFormat mListConnectionFormat; //!< list of connection formats
+ am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const;
+ bool sqQuery(const std::string& query);
+ bool openDatabase(); //!< opens the database
+ void createTables(); //!< creates all tables from the static table
+ sqlite3 *mDatabase; //!< pointer to the database
+ std::string mPath; //!< path to the database
+ DatabaseObserver *mDatabaseObserver; //!< pointer to the Observer
+ bool mFirstStaticSink;
+ bool mFirstStaticSource;
+ bool mFirstStaticGateway;
+ bool mFirstStaticSinkClass;
+ bool mFirstStaticSourceClass;
+ typedef std::map<am_gatewayID_t, std::vector<bool> > ListConnectionFormat; //!< type for list of connection formats
+ ListConnectionFormat mListConnectionFormat; //!< list of connection formats
};
}
diff --git a/AudioManagerDaemon/include/DatabaseObserver.h b/AudioManagerDaemon/include/DatabaseObserver.h
index f35defe..3ccdc0d 100644
--- a/AudioManagerDaemon/include/DatabaseObserver.h
+++ b/AudioManagerDaemon/include/DatabaseObserver.h
@@ -1,33 +1,34 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file DatabaseObserver.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file DatabaseObserver.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 DATABASEOBSERVER_H_
#define DATABASEOBSERVER_H_
#include <audiomanagertypes.h>
-namespace am {
+namespace am
+{
class TelnetServer;
class CommandSender;
@@ -35,37 +36,38 @@ class RoutingSender;
/**
* This class observes the Database and notifies other classes about important events, mainly the CommandSender.
*/
-class DatabaseObserver {
+class DatabaseObserver
+{
public:
- DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender);
- DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender,TelnetServer *iTelnetServer);
- virtual ~DatabaseObserver();
- void numberOfMainConnectionsChanged() ;
- void numberOfSinkClassesChanged() ;
- void numberOfSourceClassesChanged() ;
- void newSink(am_Sink_s sink);
- void newSource(am_Source_s source);
- void newDomain(am_Domain_s domain);
- void newGateway(am_Gateway_s gateway);
- void newCrossfader(am_Crossfader_s crossfader);
- void removedSink(am_sinkID_t sinkID);
- void removedSource(am_sourceID_t sourceID);
- void removeDomain(am_domainID_t domainID);
- void removeGateway(am_gatewayID_t gatewayID);
- void removeCrossfader(am_crossfaderID_t crossfaderID);
- void mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) ;
- void mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty) ;
- void mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty) ;
- void sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
- void sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
- void volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume) ;
- void sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
- void systemPropertyChanged(const am_SystemProperty_s& SystemProperty) ;
- void timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time) ;
+ DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender);
+ DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, TelnetServer *iTelnetServer);
+ virtual ~DatabaseObserver();
+ void numberOfMainConnectionsChanged();
+ void numberOfSinkClassesChanged();
+ void numberOfSourceClassesChanged();
+ void newSink(am_Sink_s sink);
+ void newSource(am_Source_s source);
+ void newDomain(am_Domain_s domain);
+ void newGateway(am_Gateway_s gateway);
+ void newCrossfader(am_Crossfader_s crossfader);
+ void removedSink(am_sinkID_t sinkID);
+ void removedSource(am_sourceID_t sourceID);
+ void removeDomain(am_domainID_t domainID);
+ void removeGateway(am_gatewayID_t gatewayID);
+ void removeCrossfader(am_crossfaderID_t crossfaderID);
+ void mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState);
+ void mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty);
+ void mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty);
+ void sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability);
+ void sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume);
+ void sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
+ void systemPropertyChanged(const am_SystemProperty_s& SystemProperty);
+ void timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time);
private:
- CommandSender *mCommandSender; //!< pointer to the comandSender
- RoutingSender* mRoutingSender; //!< pointer to the routingSender
- TelnetServer* mTelnetServer; //!< pointer to the telnetserver
+ CommandSender *mCommandSender; //!< pointer to the comandSender
+ RoutingSender* mRoutingSender; //!< pointer to the routingSender
+ TelnetServer* mTelnetServer; //!< pointer to the telnetserver
};
}
diff --git a/AudioManagerDaemon/include/PluginTemplate.h b/AudioManagerDaemon/include/PluginTemplate.h
index cb5aa06..e677acf 100644
--- a/AudioManagerDaemon/include/PluginTemplate.h
+++ b/AudioManagerDaemon/include/PluginTemplate.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file pluginTemplate.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file pluginTemplate.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 PLUGINTEMPLATE_H_
#define PLUGINTEMPLATE_H_
@@ -31,60 +31,62 @@
DLT_IMPORT_CONTEXT(AudioManager)
-namespace am {
+namespace am
+{
/**
* This template tries to load a library and cast ot to a class
* @param libname the full path to the library to be loaded
* @return returns the pointer to the class to be loaded
*/
-template<class T>T* getCreateFunction(const std::string& libname, void*& libraryHandle) {
-
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Trying to load libray with name: "),DLT_STRING(libname.c_str()));
-
- // cut off directories
- char* fileWithPath = const_cast<char*>(libname.c_str());
- std::string libFileName = basename(fileWithPath);
-
- // cut off "lib" in front and cut off .so end"
- std::string createFunctionName = libFileName.substr(3, libFileName.length() - 6) + "Factory";
-
- // open library
- dlerror(); // Clear any existing error
- libraryHandle = dlopen(libname.c_str(), RTLD_LAZY);
- const char* dlopen_error = dlerror();
- if (!libraryHandle || dlopen_error)
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("dlopen failed"),DLT_STRING(dlopen_error));
- return 0;
- }
-
- // get entry point from shared lib
- dlerror(); // Clear any existing error
-
- union
- {
- void* voidPointer;
- T* typedPointer;
- } functionPointer;
-
- // Note: direct cast is not allowed by ISO C++. e.g.
- // T* createFunction = reinterpret_cast<T*>(dlsym(libraryHandle, createFunctionName.c_str()));
- // compiler warning: "forbids casting between pointer-to-function and pointer-to-object"
-
- functionPointer.voidPointer = dlsym(libraryHandle, createFunctionName.c_str());
- T* createFunction = functionPointer.typedPointer;
-
- const char* dlsym_error = dlerror();
- if (!createFunction || dlsym_error)
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Failed to load shared lib entry point"),DLT_STRING(dlsym_error));
- }
- else
- {
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("loaded successfully plugin"),DLT_STRING(createFunctionName.c_str()));
- }
- return createFunction;
+template<class T> T* getCreateFunction(const std::string& libname, void*& libraryHandle)
+{
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("Trying to load libray with name: "), DLT_STRING(libname.c_str()));
+
+ // cut off directories
+ char* fileWithPath = const_cast<char*>(libname.c_str());
+ std::string libFileName = basename(fileWithPath);
+
+ // cut off "lib" in front and cut off .so end"
+ std::string createFunctionName = libFileName.substr(3, libFileName.length() - 6) + "Factory";
+
+ // open library
+ dlerror(); // Clear any existing error
+ libraryHandle = dlopen(libname.c_str(), RTLD_LAZY);
+ const char* dlopen_error = dlerror();
+ if (!libraryHandle || dlopen_error)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("dlopen failed"), DLT_STRING(dlopen_error));
+ return 0;
+ }
+
+ // get entry point from shared lib
+ dlerror(); // Clear any existing error
+
+ union
+ {
+ void* voidPointer;
+ T* typedPointer;
+ } functionPointer;
+
+ // Note: direct cast is not allowed by ISO C++. e.g.
+ // T* createFunction = reinterpret_cast<T*>(dlsym(libraryHandle, createFunctionName.c_str()));
+ // compiler warning: "forbids casting between pointer-to-function and pointer-to-object"
+
+ functionPointer.voidPointer = dlsym(libraryHandle, createFunctionName.c_str());
+ T* createFunction = functionPointer.typedPointer;
+
+ const char* dlsym_error = dlerror();
+ if (!createFunction || dlsym_error)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("Failed to load shared lib entry point"), DLT_STRING(dlsym_error));
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("loaded successfully plugin"), DLT_STRING(createFunctionName.c_str()));
+ }
+ return createFunction;
}
}
diff --git a/AudioManagerDaemon/include/RoutingReceiver.h b/AudioManagerDaemon/include/RoutingReceiver.h
index a53a4ea..7c59978 100644
--- a/AudioManagerDaemon/include/RoutingReceiver.h
+++ b/AudioManagerDaemon/include/RoutingReceiver.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file RoutingReceiver.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file RoutingReceiver.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 ROUTINGRECEIVER_H_
#define ROUTINGRECEIVER_H_
@@ -28,7 +28,8 @@
#include <routing/RoutingReceiveInterface.h>
#include <config.h>
-namespace am {
+namespace am
+{
class SocketHandler;
class DBusWrapper;
@@ -39,56 +40,57 @@ class ControlSender;
/**
* Implements the Receiving side of the RoutingPlugins.
*/
-class RoutingReceiver : public RoutingReceiveInterface {
+class RoutingReceiver: public RoutingReceiveInterface
+{
public:
- RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler);
- RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, DBusWrapper *iDBusWrapper);
- RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender,SocketHandler *iSocketHandler,DBusWrapper *iDBusWrapper);
- virtual ~RoutingReceiver();
- void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) ;
- void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) ;
- void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ;
- 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) ;
- am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID) ;
- am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID) ;
- am_Error_e deregisterDomain(const am_domainID_t domainID) ;
- am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
- am_Error_e deregisterGateway(const am_gatewayID_t gatewayID) ;
- am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID) ;
- am_Error_e registerSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) ;
- am_Error_e deregisterSink(const am_sinkID_t sinkID) ;
- am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID) ;
- am_Error_e registerSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) ;
- am_Error_e deregisterSource(const am_sourceID_t sourceID) ;
- am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
- am_Error_e deregisterCrossfader(const am_crossfaderID_t crossfaderID) ;
- am_Error_e peekSinkClassID(const std::string name, const am_sinkClass_t& sinkClassID) ;
- am_Error_e peekSourceClassID(const std::string name, const am_sourceClass_t& sourceClassID) ;
- void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) ;
- void hookDomainRegistrationComplete(const am_domainID_t domainID) ;
- void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
- void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
- void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState) ;
- void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay) ;
- am_Error_e 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;
+ RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler);
+ RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, DBusWrapper *iDBusWrapper);
+ RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper);
+ virtual ~RoutingReceiver();
+ void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
+ void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
+ void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
+ 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);
+ am_Error_e peekDomain(const std::string& name, am_domainID_t& domainID);
+ am_Error_e registerDomain(const am_Domain_s& domainData, am_domainID_t& domainID);
+ am_Error_e deregisterDomain(const am_domainID_t domainID);
+ am_Error_e registerGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e deregisterGateway(const am_gatewayID_t gatewayID);
+ am_Error_e peekSink(const std::string& name, am_sinkID_t& sinkID);
+ am_Error_e registerSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
+ am_Error_e deregisterSink(const am_sinkID_t sinkID);
+ am_Error_e peekSource(const std::string& name, am_sourceID_t& sourceID);
+ am_Error_e registerSource(const am_Source_s& sourceData, am_sourceID_t& sourceID);
+ am_Error_e deregisterSource(const am_sourceID_t sourceID);
+ am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
+ am_Error_e deregisterCrossfader(const am_crossfaderID_t crossfaderID);
+ am_Error_e peekSinkClassID(const std::string name, const am_sinkClass_t& sinkClassID);
+ am_Error_e peekSourceClassID(const std::string name, const am_sourceClass_t& sourceClassID);
+ void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState);
+ void hookDomainRegistrationComplete(const am_domainID_t domainID);
+ void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability);
+ void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState);
+ void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay);
+ am_Error_e 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
- SocketHandler *mSocketHandler; //!< pointer to sockethandler
- DBusWrapper *mDBusWrapper; //!< pointer to dbuswrapper
+ DatabaseHandler *mDatabaseHandler; //!< pointer to the databaseHandler
+ RoutingSender *mRoutingSender; //!< pointer to the routingSender
+ ControlSender *mControlSender; //!< pointer to the controlSender
+ SocketHandler *mSocketHandler; //!< pointer to sockethandler
+ DBusWrapper *mDBusWrapper; //!< pointer to dbuswrapper
};
diff --git a/AudioManagerDaemon/include/RoutingSender.h b/AudioManagerDaemon/include/RoutingSender.h
index 459fe84..0888b6a 100644
--- a/AudioManagerDaemon/include/RoutingSender.h
+++ b/AudioManagerDaemon/include/RoutingSender.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file RoutingSender.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file RoutingSender.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 ROUTINGSENDER_H_
#define ROUTINGSENDER_H_
@@ -32,146 +32,147 @@
#include "../test/RoutingInterfaceBackdoor.h"
#endif
-namespace am {
+namespace am
+{
/**
* Implements the RoutingSendInterface. Loads all plugins and dispatches calls to the plugins
*/
-class RoutingSender {
+class RoutingSender
+{
public:
- RoutingSender(const std::vector<std::string>& listOfPluginDirectories);
- virtual ~RoutingSender();
-
- /**
- * removes a handle from the list
- * @param handle to be removed
- * @return E_OK in case of success
- */
- am_Error_e removeHandle(const am_Handle_s& handle);
-
- /**
- * @author Christian
- * this adds the domain to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
- * This must be done whenever a domain is registered.
- */
- am_Error_e addDomainLookup(const am_Domain_s& domainData);
- /**
- * @author Christian
- * this adds the Source to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
- * This must be done whenever a Source is registered.
- */
- am_Error_e addSourceLookup(const am_Source_s& sourceData);
- /**
- * @author Christian
- * this adds the Sink to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
- * This must be done whenever a Sink is registered.
- */
- am_Error_e addSinkLookup(const am_Sink_s& sinkData);
- /**
- * @author Christian
- * this adds the Crossfader to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
- * This must be done whenever a Crossfader is registered.
- */
- am_Error_e addCrossfaderLookup(const am_Crossfader_s& crossfaderData);
- /**
- * @author Christian
- * this removes the Domain to the lookup table of the Router. This must be done everytime a domain is deregistered.
- */
- am_Error_e removeDomainLookup(const am_domainID_t domainID);
- /**
- * @author Christian
- * this removes the Source to the lookup table of the Router. This must be done everytime a source is deregistered.
- */
- am_Error_e removeSourceLookup(const am_sourceID_t sourceID);
- /**
- * @author Christian
- * this removes the Sink to the lookup table of the Router. This must be done everytime a sink is deregistered.
- */
- am_Error_e removeSinkLookup(const am_sinkID_t sinkID);
- /**
- * @author Christian
- * this removes the Crossfader to the lookup table of the Router. This must be done everytime a crossfader is deregistered.
- */
- am_Error_e removeCrossfaderLookup(const am_crossfaderID_t crossfaderID);
- void startupRoutingInterface(RoutingReceiveInterface* routingreceiveinterface) ;
- void routingInterfacesReady() ;
- void routingInterfacesRundown() ;
- am_Error_e asyncAbort(const am_Handle_s& handle) ;
- am_Error_e asyncConnect(am_Handle_s& handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat) ;
- am_Error_e asyncDisconnect(am_Handle_s& handle, const am_connectionID_t connectionID) ;
- am_Error_e asyncSetSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time) ;
- am_Error_e 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
- {
- RoutingSendInterface* routingInterface;
- std::string busName;
- };
-
- //!< is used to store data related to handles
- class am_handleData_c
- {
- public:
- union
- {
- am_sinkID_t sinkID;
- am_sourceID_t sourceID;
- am_crossfaderID_t crossfaderID;
- am_connectionID_t connectionID;
- };
- union
- {
- am_SoundProperty_s soundPropery;
- am_SourceState_e sourceState;
- am_volume_t volume;
- am_HotSink_e hotSink;
- std::vector<am_SoundProperty_s>* soundProperties;
- };
-
- };
-
+ RoutingSender(const std::vector<std::string>& listOfPluginDirectories);
+ virtual ~RoutingSender();
+
+ /**
+ * removes a handle from the list
+ * @param handle to be removed
+ * @return E_OK in case of success
+ */
+ am_Error_e removeHandle(const am_Handle_s& handle);
+
+ /**
+ * @author Christian
+ * this adds the domain to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a domain is registered.
+ */
+ am_Error_e addDomainLookup(const am_Domain_s& domainData);
+ /**
+ * @author Christian
+ * this adds the Source to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Source is registered.
+ */
+ am_Error_e addSourceLookup(const am_Source_s& sourceData);
+ /**
+ * @author Christian
+ * this adds the Sink to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Sink is registered.
+ */
+ am_Error_e addSinkLookup(const am_Sink_s& sinkData);
+ /**
+ * @author Christian
+ * this adds the Crossfader to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Crossfader is registered.
+ */
+ am_Error_e addCrossfaderLookup(const am_Crossfader_s& crossfaderData);
+ /**
+ * @author Christian
+ * this removes the Domain to the lookup table of the Router. This must be done everytime a domain is deregistered.
+ */
+ am_Error_e removeDomainLookup(const am_domainID_t domainID);
+ /**
+ * @author Christian
+ * this removes the Source to the lookup table of the Router. This must be done everytime a source is deregistered.
+ */
+ am_Error_e removeSourceLookup(const am_sourceID_t sourceID);
+ /**
+ * @author Christian
+ * this removes the Sink to the lookup table of the Router. This must be done everytime a sink is deregistered.
+ */
+ am_Error_e removeSinkLookup(const am_sinkID_t sinkID);
+ /**
+ * @author Christian
+ * this removes the Crossfader to the lookup table of the Router. This must be done everytime a crossfader is deregistered.
+ */
+ am_Error_e removeCrossfaderLookup(const am_crossfaderID_t crossfaderID);
+ void startupRoutingInterface(RoutingReceiveInterface* routingreceiveinterface);
+ void routingInterfacesReady();
+ void routingInterfacesRundown();
+ am_Error_e asyncAbort(const am_Handle_s& handle);
+ am_Error_e asyncConnect(am_Handle_s& handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat);
+ am_Error_e asyncDisconnect(am_Handle_s& handle, const am_connectionID_t connectionID);
+ am_Error_e asyncSetSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
+ am_Error_e 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
+ {
+ RoutingSendInterface* routingInterface;
+ std::string busName;
+ };
+
+ //!< is used to store data related to handles
+ class am_handleData_c
+ {
+ public:
+ union
+ {
+ am_sinkID_t sinkID;
+ am_sourceID_t sourceID;
+ am_crossfaderID_t crossfaderID;
+ am_connectionID_t connectionID;
+ };
+ union
+ {
+ am_SoundProperty_s soundPropery;
+ am_SourceState_e sourceState;
+ am_volume_t volume;
+ am_HotSink_e hotSink;
+ std::vector<am_SoundProperty_s>* soundProperties;
+ };
+
+ };
#ifdef UNIT_TEST //this is needed to test RoutingSender
- friend class RoutingInterfaceBackdoor;
+ friend class RoutingInterfaceBackdoor;
#endif
- /**
- * returns the data that belong to handles
- * @param handle the handle
- * @return a class holding the handle data
- */
- am_handleData_c returnHandleData(const am_Handle_s handle) const;
+ /**
+ * returns the data that belong to handles
+ * @param handle the handle
+ * @return a class holding the handle data
+ */
+ am_handleData_c returnHandleData(const am_Handle_s handle) const;
private:
- //!< is needed to sort the handles in the map
- struct comparator
- {
- bool operator()(const am_Handle_s& a, const am_Handle_s& b) const
- {
- return (a.handle < b.handle);
- }
- };
-
- /**
- * creates a handle and adds it to the list of handles
- * @param handleData the data that should be saves together with the handle
- * @param type the type of handle to be created
- * @return the handle
- */
- am_Handle_s createHandle(const am_handleData_c& handleData, const am_Handle_e type);
- void unloadLibraries(void); //!< unloads all loaded plugins
+ //!< is needed to sort the handles in the map
+ struct comparator
+ {
+ bool operator()(const am_Handle_s& a, const am_Handle_s& b) const
+ {
+ return (a.handle < b.handle);
+ }
+ };
+
+ /**
+ * creates a handle and adds it to the list of handles
+ * @param handleData the data that should be saves together with the handle
+ * @param type the type of handle to be created
+ * @return the handle
+ */
+ am_Handle_s createHandle(const am_handleData_c& handleData, const am_Handle_e type);
+ void unloadLibraries(void); //!< unloads all loaded plugins
typedef std::map<am_domainID_t, RoutingSendInterface*> DomainInterfaceMap; //!< maps domains to interfaces
typedef std::map<am_sinkID_t, RoutingSendInterface*> SinkInterfaceMap; //!< maps sinks to interfaces
@@ -179,12 +180,12 @@ private:
typedef std::map<am_crossfaderID_t, RoutingSendInterface*> CrossfaderInterfaceMap; //!< maps crossfaders to interfaces
typedef std::map<am_connectionID_t, RoutingSendInterface*> ConnectionInterfaceMap; //!< maps connections to interfaces
typedef std::map<uint16_t, RoutingSendInterface*> HandleInterfaceMap; //!< maps handles to interfaces
- typedef std::map<am_Handle_s,am_handleData_c,comparator> HandlesMap; //!< maps handleData to handles
+ typedef std::map<am_Handle_s, am_handleData_c, comparator> HandlesMap; //!< maps handleData to handles
int16_t mHandleCount; //!< is used to create handles
HandlesMap mlistActiveHandles; //!< list of all currently "running" handles.
- std::vector<void*> mListLibraryHandles; //!< list of all loaded pluginInterfaces
- std::vector<InterfaceNamePairs> mListInterfaces; //!< list of busname/interface relation
+ std::vector<void*> mListLibraryHandles; //!< list of all loaded pluginInterfaces
+ std::vector<InterfaceNamePairs> mListInterfaces; //!< list of busname/interface relation
ConnectionInterfaceMap mMapConnectionInterface; //!< map of connection to interfaces
CrossfaderInterfaceMap mMapCrossfaderInterface; //!< map of crossfaders to interface
DomainInterfaceMap mMapDomainInterface; //!< map of domains to interfaces
diff --git a/AudioManagerDaemon/include/TelnetServer.h b/AudioManagerDaemon/include/TelnetServer.h
index 9b7d097..b4ea078 100644
--- a/AudioManagerDaemon/include/TelnetServer.h
+++ b/AudioManagerDaemon/include/TelnetServer.h
@@ -1,27 +1,26 @@
/**
-* 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.
-*
-*/
-
+ * 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_
@@ -30,7 +29,8 @@
#include <queue>
#include <map>
-namespace am {
+namespace am
+{
class DatabaseHandler;
class CommandSender;
@@ -43,45 +43,45 @@ 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;
+ 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;
- };
+ 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;
+ 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;
};
diff --git a/AudioManagerDaemon/src/CommandReceiver.cpp b/AudioManagerDaemon/src/CommandReceiver.cpp
index 15d2430..46d1714 100644
--- a/AudioManagerDaemon/src/CommandReceiver.cpp
+++ b/AudioManagerDaemon/src/CommandReceiver.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file CommandReveiver.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file CommandReveiver.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 "CommandReceiver.h"
#include "DatabaseHandler.h"
@@ -34,36 +34,36 @@ DLT_IMPORT_CONTEXT(AudioManager)
using namespace am;
-am::CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSender *iControlSender, DBusWrapper *iDBusWrapper)
-: mDatabaseHandler(iDatabaseHandler),
- mControlSender(iControlSender),
- mDBusWrapper(iDBusWrapper)
+CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSender *iControlSender, DBusWrapper *iDBusWrapper) :
+ mDatabaseHandler(iDatabaseHandler), //
+ mControlSender(iControlSender), //
+ mDBusWrapper(iDBusWrapper)
{
-assert(mDatabaseHandler!=NULL);
-assert(mDBusWrapper!=NULL);
-assert(mControlSender!=NULL);
+ assert(mDatabaseHandler!=NULL);
+ assert(mDBusWrapper!=NULL);
+ assert(mControlSender!=NULL);
}
-am::CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSender *iControlSender, SocketHandler *iSocketHandler)
-: mDatabaseHandler(iDatabaseHandler),
- mControlSender(iControlSender),
- mSocketHandler(iSocketHandler)
+CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSender *iControlSender, SocketHandler *iSocketHandler) :
+ mDatabaseHandler(iDatabaseHandler), //
+ mControlSender(iControlSender), //
+ mSocketHandler(iSocketHandler)
{
-assert(mDatabaseHandler!=NULL);
-assert(mSocketHandler!=NULL);
-assert(mControlSender!=NULL);
+ assert(mDatabaseHandler!=NULL);
+ assert(mSocketHandler!=NULL);
+ assert(mControlSender!=NULL);
}
-am::CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper)
-: mDatabaseHandler(iDatabaseHandler),
- mControlSender(iControlSender),
- mDBusWrapper(iDBusWrapper),
- mSocketHandler(iSocketHandler)
+CommandReceiver::CommandReceiver(DatabaseHandler *iDatabaseHandler, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper) :
+ mDatabaseHandler(iDatabaseHandler), //
+ mControlSender(iControlSender), //
+ mDBusWrapper(iDBusWrapper), //
+ mSocketHandler(iSocketHandler)
{
-assert(mDatabaseHandler!=NULL);
-assert(mSocketHandler!=NULL);
-assert(mControlSender!=NULL);
-assert(mDBusWrapper!=NULL);
+ assert(mDatabaseHandler!=NULL);
+ assert(mSocketHandler!=NULL);
+ assert(mControlSender!=NULL);
+ assert(mDBusWrapper!=NULL);
}
CommandReceiver::~CommandReceiver()
@@ -72,162 +72,120 @@ CommandReceiver::~CommandReceiver()
am_Error_e CommandReceiver::connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::connect got called:"),DLT_STRING("sourceID"),DLT_INT(sourceID), DLT_STRING("sinkID"), DLT_INT(sinkID));
- return mControlSender->hookUserConnectionRequest(sourceID,sinkID,mainConnectionID);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandReceiver::connect got called:"), DLT_STRING("sourceID"), DLT_INT(sourceID), DLT_STRING("sinkID"), DLT_INT(sinkID));
+ return mControlSender->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID);
}
-
-
am_Error_e CommandReceiver::disconnect(const am_mainConnectionID_t mainConnectionID)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::disconnect got called, mainConnectionID="),DLT_INT(mainConnectionID));
- return mControlSender->hookUserDisconnectionRequest(mainConnectionID);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandReceiver::disconnect got called, mainConnectionID="), DLT_INT(mainConnectionID));
+ return mControlSender->hookUserDisconnectionRequest(mainConnectionID);
}
-
-
am_Error_e CommandReceiver::setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setVolume got called, sinkID="),DLT_INT(sinkID),DLT_STRING("volume="),DLT_INT(volume));
- return mControlSender->hookUserVolumeChange(sinkID,volume);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandReceiver::setVolume got called, sinkID="), DLT_INT(sinkID), DLT_STRING("volume="), DLT_INT(volume));
+ return mControlSender->hookUserVolumeChange(sinkID, volume);
}
-
-
am_Error_e CommandReceiver::volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::volumeStep got called, sinkID="),DLT_INT(sinkID),DLT_STRING("volumeStep="),DLT_INT(volumeStep));
- return mControlSender->hookUserVolumeStep(sinkID,volumeStep);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandReceiver::volumeStep got called, sinkID="), DLT_INT(sinkID), DLT_STRING("volumeStep="), DLT_INT(volumeStep));
+ return mControlSender->hookUserVolumeStep(sinkID, volumeStep);
}
-
-
am_Error_e CommandReceiver::setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setSinkMuteState got called, sinkID="),DLT_INT(sinkID),DLT_STRING("muteState="),DLT_INT(muteState));
- return mControlSender->hookUserSetSinkMuteState(sinkID,muteState);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandReceiver::setSinkMuteState got called, sinkID="), DLT_INT(sinkID), DLT_STRING("muteState="), DLT_INT(muteState));
+ return mControlSender->hookUserSetSinkMuteState(sinkID, muteState);
}
-
-
am_Error_e CommandReceiver::setMainSinkSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setMainSinkSoundProperty got called, sinkID="),DLT_INT(sinkID),DLT_STRING("soundPropertyType="),DLT_INT(soundProperty.type),DLT_STRING("soundPropertyValue="),DLT_INT(soundProperty.value));
- return mControlSender->hookUserSetMainSinkSoundProperty(sinkID,soundProperty);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandReceiver::setMainSinkSoundProperty got called, sinkID="), DLT_INT(sinkID), DLT_STRING("soundPropertyType="), DLT_INT(soundProperty.type), DLT_STRING("soundPropertyValue="), DLT_INT(soundProperty.value));
+ return mControlSender->hookUserSetMainSinkSoundProperty(sinkID, soundProperty);
}
-
-
am_Error_e CommandReceiver::setMainSourceSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setMainSourceSoundProperty got called, sourceID="),DLT_INT(sourceID),DLT_STRING("soundPropertyType="),DLT_INT(soundProperty.type),DLT_STRING("soundPropertyValue="),DLT_INT(soundProperty.value));
- return mControlSender->hookUserSetMainSourceSoundProperty(sourceID,soundProperty);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandReceiver::setMainSourceSoundProperty got called, sourceID="), DLT_INT(sourceID), DLT_STRING("soundPropertyType="), DLT_INT(soundProperty.type), DLT_STRING("soundPropertyValue="), DLT_INT(soundProperty.value));
+ return mControlSender->hookUserSetMainSourceSoundProperty(sourceID, soundProperty);
}
-
-
am_Error_e CommandReceiver::setSystemProperty(const am_SystemProperty_s & property)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandReceiver::setSystemProperty got called"),DLT_STRING("type="),DLT_INT(property.type),DLT_STRING("soundPropertyValue="),DLT_INT(property.value));
- return mControlSender->hookUserSetSystemProperty(property);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandReceiver::setSystemProperty got called"), DLT_STRING("type="), DLT_INT(property.type), DLT_STRING("soundPropertyValue="), DLT_INT(property.value));
+ return mControlSender->hookUserSetSystemProperty(property);
}
-
-
am_Error_e CommandReceiver::getListMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
- return mDatabaseHandler->getListVisibleMainConnections(listConnections);
+ return mDatabaseHandler->getListVisibleMainConnections(listConnections);
}
-
-
am_Error_e CommandReceiver::getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const
{
- return mDatabaseHandler->getListMainSinks(listMainSinks);
+ return mDatabaseHandler->getListMainSinks(listMainSinks);
}
-
-
am_Error_e CommandReceiver::getListMainSources(std::vector<am_SourceType_s>& listMainSources) const
{
- return mDatabaseHandler->getListMainSources(listMainSources);
+ return mDatabaseHandler->getListMainSources(listMainSources);
}
-
-
am_Error_e CommandReceiver::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
{
- return mDatabaseHandler->getListMainSinkSoundProperties(sinkID,listSoundProperties);
+ return mDatabaseHandler->getListMainSinkSoundProperties(sinkID, listSoundProperties);
}
-
-
am_Error_e CommandReceiver::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
{
- return mDatabaseHandler->getListMainSourceSoundProperties(sourceID,listSourceProperties);
+ return mDatabaseHandler->getListMainSourceSoundProperties(sourceID, listSourceProperties);
}
-
-
am_Error_e CommandReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
- return mDatabaseHandler->getListSourceClasses(listSourceClasses);
+ return mDatabaseHandler->getListSourceClasses(listSourceClasses);
}
-
-
am_Error_e CommandReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
- return mDatabaseHandler->getListSinkClasses(listSinkClasses);
+ return mDatabaseHandler->getListSinkClasses(listSinkClasses);
}
-
-
am_Error_e CommandReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
- return mDatabaseHandler->getListSystemProperties(listSystemProperties);
+ return mDatabaseHandler->getListSystemProperties(listSystemProperties);
}
-
-
am_Error_e CommandReceiver::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
{
- return mDatabaseHandler->getTimingInformation(mainConnectionID,delay);
+ return mDatabaseHandler->getTimingInformation(mainConnectionID, delay);
}
am_Error_e CommandReceiver::getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const
{
#ifdef WITH_DBUS_WRAPPER
- dbusConnectionWrapper=mDBusWrapper;
- return E_OK;
+ dbusConnectionWrapper = mDBusWrapper;
+ return E_OK;
#else
- return E_UNKNOWN;
+ return E_UNKNOWN;
#endif /*WITH_DBUS_WRAPPER*/
}
am_Error_e CommandReceiver::getSocketHandler(SocketHandler *& socketHandler) const
{
#ifdef WITH_SOCKETHANDLER_LOOP
- socketHandler=mSocketHandler;
- return E_OK;
+ socketHandler = mSocketHandler;
+ return E_OK;
#else
- return E_UNKNOWN;
+ return E_UNKNOWN;
#endif /*WITH_SOCKETHANDLER_LOOP*/
}
uint16_t CommandReceiver::getInterfaceVersion() const
{
- return CommandReceiveVersion;
+ return CommandReceiveVersion;
}
-
-
-
-
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/CommandSender.cpp b/AudioManagerDaemon/src/CommandSender.cpp
index a481317..a02d3f8 100644
--- a/AudioManagerDaemon/src/CommandSender.cpp
+++ b/AudioManagerDaemon/src/CommandSender.cpp
@@ -1,27 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file CommandSender.cpp
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-*/
-
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file CommandSender.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ */
#include "CommandSender.h"
#include "command/CommandReceiveInterface.h"
@@ -43,44 +42,44 @@ DLT_IMPORT_CONTEXT(AudioManager)
(*iter)->__VA_ARGS__; \
}
-CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirectories)
- :mListInterfaces(),
- mListLibraryHandles()
+CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirectories) :
+ mListInterfaces(), //
+ mListLibraryHandles()
{
- std::vector<std::string> sharedLibraryNameList;
+ std::vector<std::string> sharedLibraryNameList;
std::vector<std::string>::const_iterator dirIter = listOfPluginDirectories.begin();
std::vector<std::string>::const_iterator dirIterEnd = listOfPluginDirectories.end();
// search communicator plugins in configured directories
for (; dirIter < dirIterEnd; ++dirIter)
{
- const char* directoryName = dirIter->c_str();
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Searching for CommandPlugins in"),DLT_STRING(directoryName));
- DIR *directory = opendir(directoryName);
-
- if (!directory)
- {
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Error opening directory "),DLT_STRING(directoryName));
- continue;
- }
+ const char* directoryName = dirIter->c_str();
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("Searching for CommandPlugins in"), DLT_STRING(directoryName));
+ DIR *directory = opendir(directoryName);
+
+ if (!directory)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("Error opening directory "), DLT_STRING(directoryName));
+ continue;
+ }
// iterate content of directory
struct dirent *itemInDirectory = 0;
while ((itemInDirectory = readdir(directory)))
{
- unsigned char entryType = itemInDirectory->d_type;
- std::string entryName = itemInDirectory->d_name;
+ unsigned char entryType = itemInDirectory->d_type;
+ std::string entryName = itemInDirectory->d_name;
- bool regularFile = (entryType == DT_REG || entryType== DT_LNK);
- bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1));
+ bool regularFile = (entryType == DT_REG || entryType == DT_LNK);
+ bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1));
- if (regularFile && sharedLibExtension)
- {
- std::string name(directoryName);
- sharedLibraryNameList.push_back(name + "/" + entryName);
- }
+ if (regularFile && sharedLibExtension)
+ {
+ std::string name(directoryName);
+ sharedLibraryNameList.push_back(name + "/" + entryName);
+ }
}
- closedir(directory);
+ closedir(directory);
}
// iterate all communicator plugins and start them
@@ -89,14 +88,14 @@ CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirecto
for (; iter < iterEnd; ++iter)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Loading CommandSender plugin"),DLT_STRING(iter->c_str()));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("Loading CommandSender plugin"), DLT_STRING(iter->c_str()));
CommandSendInterface* (*createFunc)();
- void* tempLibHandle=NULL;
- createFunc = getCreateFunction<CommandSendInterface*()>(*iter,tempLibHandle);
+ void* tempLibHandle = NULL;
+ createFunc = getCreateFunction<CommandSendInterface*()>(*iter, tempLibHandle);
if (!createFunc)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Entry point of CommandPlugin not found"),DLT_STRING(iter->c_str()));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("Entry point of CommandPlugin not found"), DLT_STRING(iter->c_str()));
continue;
}
@@ -104,15 +103,15 @@ CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirecto
if (!commander)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandPlugin initialization failed. Entry Function not callable"));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("CommandPlugin initialization failed. Entry Function not callable"));
continue;
}
//check libversion
- if (commander->getInterfaceVersion()<REQUIRED_INTERFACE_VERSION)
+ if (commander->getInterfaceVersion() < REQUIRED_INTERFACE_VERSION)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingPlugin initialization failed. Version of Interface to old"));
- continue;
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("RoutingPlugin initialization failed. Version of Interface to old"));
+ continue;
}
mListInterfaces.push_back(commander);
@@ -122,161 +121,135 @@ CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirecto
CommandSender::~CommandSender()
{
- unloadLibraries();
+ unloadLibraries();
}
-
am_Error_e CommandSender::stopInterface()
{
- am_Error_e returnError=E_OK;
-
- std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin();
- std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end();
- for (; iter<iterEnd;++iter)
- {
- am_Error_e error=(*iter)->stopInterface();
- if (error!= E_OK)
- {
- returnError=error;
- }
- }
- return returnError;
-}
+ am_Error_e returnError = E_OK;
+ std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin();
+ std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end();
+ for (; iter < iterEnd; ++iter)
+ {
+ am_Error_e error = (*iter)->stopInterface();
+ if (error != E_OK)
+ {
+ returnError = error;
+ }
+ }
+ return returnError;
+}
am_Error_e CommandSender::startupInterface(CommandReceiveInterface *commandreceiveinterface)
{
- am_Error_e returnError=E_OK;
-
- std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin();
- std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end();
- for (; iter<iterEnd;++iter)
- {
- am_Error_e error=(*iter)->startupInterface(commandreceiveinterface);
- if (error!= E_OK)
- {
- returnError=error;
- }
- }
- return returnError;
-}
+ am_Error_e returnError = E_OK;
+ std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin();
+ std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end();
+ for (; iter < iterEnd; ++iter)
+ {
+ am_Error_e error = (*iter)->startupInterface(commandreceiveinterface);
+ if (error != E_OK)
+ {
+ returnError = error;
+ }
+ }
+ return returnError;
+}
void CommandSender::cbCommunicationReady()
{
- CALL_ALL_INTERFACES(cbCommunicationReady())
+ CALL_ALL_INTERFACES(cbCommunicationReady())
}
void CommandSender::cbCommunicationRundown()
{
- CALL_ALL_INTERFACES(cbCommunicationRundown())
+ CALL_ALL_INTERFACES(cbCommunicationRundown())
}
void CommandSender::cbNumberOfMainConnectionsChanged()
{
- CALL_ALL_INTERFACES(cbNumberOfMainConnectionsChanged())
+ CALL_ALL_INTERFACES(cbNumberOfMainConnectionsChanged())
}
void CommandSender::cbNumberOfSinksChanged()
{
- CALL_ALL_INTERFACES(cbNumberOfSinksChanged())
+ CALL_ALL_INTERFACES(cbNumberOfSinksChanged())
}
void CommandSender::cbNumberOfSourcesChanged()
{
- CALL_ALL_INTERFACES(cbNumberOfSourcesChanged())
+ CALL_ALL_INTERFACES(cbNumberOfSourcesChanged())
}
void CommandSender::cbNumberOfSinkClassesChanged()
{
- CALL_ALL_INTERFACES(cbNumberOfSinkClassesChanged())
+ CALL_ALL_INTERFACES(cbNumberOfSinkClassesChanged())
}
void CommandSender::cbNumberOfSourceClassesChanged()
{
- CALL_ALL_INTERFACES(cbNumberOfSourceClassesChanged())
+ CALL_ALL_INTERFACES(cbNumberOfSourceClassesChanged())
}
-
void CommandSender::cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
{
- CALL_ALL_INTERFACES(cbMainConnectionStateChanged(connectionID,connectionState))
+ CALL_ALL_INTERFACES(cbMainConnectionStateChanged(connectionID,connectionState))
}
-
-
void CommandSender::cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty)
{
- CALL_ALL_INTERFACES(cbMainSinkSoundPropertyChanged(sinkID,SoundProperty))
+ CALL_ALL_INTERFACES(cbMainSinkSoundPropertyChanged(sinkID,SoundProperty))
}
-
-
void CommandSender::cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
{
- CALL_ALL_INTERFACES(cbMainSourceSoundPropertyChanged(sourceID,SoundProperty))
+ CALL_ALL_INTERFACES(cbMainSourceSoundPropertyChanged(sourceID,SoundProperty))
}
-
-
void CommandSender::cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
- CALL_ALL_INTERFACES(cbSinkAvailabilityChanged(sinkID,availability))
+ CALL_ALL_INTERFACES(cbSinkAvailabilityChanged(sinkID,availability))
}
-
-
void CommandSender::cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
- CALL_ALL_INTERFACES(cbSourceAvailabilityChanged(sourceID,availability))
+ CALL_ALL_INTERFACES(cbSourceAvailabilityChanged(sourceID,availability))
}
-
-
void CommandSender::cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
- CALL_ALL_INTERFACES(cbVolumeChanged(sinkID,volume))
+ CALL_ALL_INTERFACES(cbVolumeChanged(sinkID,volume))
}
-
-
void CommandSender::cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
- CALL_ALL_INTERFACES(cbSinkMuteStateChanged(sinkID,muteState))
+ CALL_ALL_INTERFACES(cbSinkMuteStateChanged(sinkID,muteState))
}
-
-
void CommandSender::cbSystemPropertyChanged(const am_SystemProperty_s & SystemProperty)
{
- CALL_ALL_INTERFACES(cbSystemPropertyChanged(SystemProperty))
+ CALL_ALL_INTERFACES(cbSystemPropertyChanged(SystemProperty))
}
-
-
void CommandSender::cbTimingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
{
- CALL_ALL_INTERFACES(cbTimingInformationChanged(mainConnection,time))
+ CALL_ALL_INTERFACES(cbTimingInformationChanged(mainConnection,time))
}
void CommandSender::unloadLibraries(void)
{
- std::vector<void*>::iterator iterator=mListLibraryHandles.begin();
- for(;iterator<mListLibraryHandles.end();++iterator)
- {
- dlclose(*iterator);
- }
- mListLibraryHandles.clear();
+ std::vector<void*>::iterator iterator = mListLibraryHandles.begin();
+ for (; iterator < mListLibraryHandles.end(); ++iterator)
+ {
+ dlclose(*iterator);
+ }
+ mListLibraryHandles.clear();
}
uint16_t CommandSender::getInterfaceVersion() const
{
- return CommandSendVersion;
+ return CommandSendVersion;
}
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/ControlReceiver.cpp b/AudioManagerDaemon/src/ControlReceiver.cpp
index 763bf2c..4900ce7 100644
--- a/AudioManagerDaemon/src/ControlReceiver.cpp
+++ b/AudioManagerDaemon/src/ControlReceiver.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file ControlReceiver.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file ControlReceiver.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 <config.h>
#include <SocketHandler.h>
@@ -35,540 +35,434 @@ DLT_IMPORT_CONTEXT(AudioManager)
using namespace am;
-ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler)
- : mDatabaseHandler(iDatabaseHandler),
- mRoutingSender(iRoutingSender),
- mCommandSender(iCommandSender),
- mSocketHandler(iSocketHandler)
+ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender, SocketHandler *iSocketHandler) :
+ mDatabaseHandler(iDatabaseHandler), //
+ mRoutingSender(iRoutingSender), //
+ mCommandSender(iCommandSender), //
+ mSocketHandler(iSocketHandler)
{
- assert(mDatabaseHandler!=NULL);
- assert(mRoutingSender!=NULL);
- assert(mCommandSender!=NULL);
- assert(mSocketHandler!=NULL);
+ assert(mDatabaseHandler!=NULL);
+ assert(mRoutingSender!=NULL);
+ assert(mCommandSender!=NULL);
+ assert(mSocketHandler!=NULL);
}
-ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender)
- : mDatabaseHandler(iDatabaseHandler),
- mRoutingSender(iRoutingSender),
- mCommandSender(iCommandSender)
+ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender) :
+ mDatabaseHandler(iDatabaseHandler), //
+ mRoutingSender(iRoutingSender), //
+ mCommandSender(iCommandSender)
{
-assert(mDatabaseHandler!=NULL);
-assert(mRoutingSender!=NULL);
-assert(mCommandSender!=NULL);
+ assert(mDatabaseHandler!=NULL);
+ assert(mRoutingSender!=NULL);
+ assert(mCommandSender!=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
- return E_NOT_USED;
+ //todo: implement routing algorithm
+ return E_NOT_USED;
}
-
-
am_Error_e ControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & connectionID, const am_ConnectionFormat_e format, const am_sourceID_t sourceID, const am_sinkID_t sinkID)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::connect got called, connectionFormat"),DLT_INT(format),DLT_STRING("sourceID"),DLT_INT(sourceID),DLT_STRING("sinkID"),DLT_INT(sinkID));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::connect got called, connectionFormat"), DLT_INT(format), DLT_STRING("sourceID"), DLT_INT(sourceID), DLT_STRING("sinkID"), DLT_INT(sinkID));
- am_Connection_s tempConnection;
- tempConnection.sinkID=sinkID;
- tempConnection.sourceID=sourceID;
- tempConnection.connectionFormat=format;
- tempConnection.connectionID=0;
+ am_Connection_s tempConnection;
+ tempConnection.sinkID = sinkID;
+ tempConnection.sourceID = sourceID;
+ tempConnection.connectionFormat = format;
+ tempConnection.connectionID = 0;
- //todo: enter function to find out what happends if the same connection is in the course of being build up.
- if (mDatabaseHandler->existConnection(tempConnection)) return E_ALREADY_EXISTS; //todo:enter the correct connectionID here?
+ //todo: enter function to find out what happends if the same connection is in the course of being build up.
+ if (mDatabaseHandler->existConnection(tempConnection)) return E_ALREADY_EXISTS; //todo:enter the correct connectionID here?
- mDatabaseHandler->enterConnectionDB(tempConnection,connectionID);
- return mRoutingSender->asyncConnect(handle,connectionID,sourceID,sinkID,format);
+ mDatabaseHandler->enterConnectionDB(tempConnection, connectionID);
+ return mRoutingSender->asyncConnect(handle, connectionID, sourceID, sinkID, format);
}
-
-
am_Error_e ControlReceiver::disconnect(am_Handle_s & handle, const am_connectionID_t connectionID)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::disconnect got called, connectionID="),DLT_INT(connectionID));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::disconnect got called, connectionID="), DLT_INT(connectionID));
- if (!mDatabaseHandler->existConnectionID(connectionID)) return E_NON_EXISTENT; //todo: check with EA model and correct
- return mRoutingSender->asyncDisconnect(handle,connectionID);
+ if (!mDatabaseHandler->existConnectionID(connectionID)) return E_NON_EXISTENT; //todo: check with EA model and correct
+ return mRoutingSender->asyncDisconnect(handle, connectionID);
}
-
-
am_Error_e ControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::crossfade got called, hotSource="),DLT_INT(hotSource),DLT_STRING("crossfaderID="),DLT_INT(crossfaderID),DLT_STRING("rampType="),DLT_INT(rampType),DLT_STRING("rampTime="),DLT_INT(rampTime));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::crossfade got called, hotSource="), DLT_INT(hotSource), DLT_STRING("crossfaderID="), DLT_INT(crossfaderID), DLT_STRING("rampType="), DLT_INT(rampType), DLT_STRING("rampTime="), DLT_INT(rampTime));
- if (!mDatabaseHandler->existcrossFader(crossfaderID)) return E_NON_EXISTENT;
- return mRoutingSender->asyncCrossFade(handle,crossfaderID,hotSource,rampType,rampTime);
+ if (!mDatabaseHandler->existcrossFader(crossfaderID)) return E_NON_EXISTENT;
+ return mRoutingSender->asyncCrossFade(handle, crossfaderID, hotSource, rampType, rampTime);
}
-
-
am_Error_e ControlReceiver::setSourceState(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSourceState got called, sourceID="),DLT_INT(sourceID),DLT_STRING("state="),DLT_INT(state));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSourceState got called, sourceID="), DLT_INT(sourceID), DLT_STRING("state="), DLT_INT(state));
- am_SourceState_e sourceState;
- if(mDatabaseHandler->getSoureState(sourceID,sourceState)!=E_OK) return E_UNKNOWN;
- if(sourceState==state) return E_NO_CHANGE;
- return mRoutingSender->asyncSetSourceState(handle,sourceID,state);
+ am_SourceState_e sourceState;
+ if (mDatabaseHandler->getSoureState(sourceID, sourceState) != E_OK) return E_UNKNOWN;
+ if (sourceState == state) return E_NO_CHANGE;
+ return mRoutingSender->asyncSetSourceState(handle, sourceID, state);
}
-
-
am_Error_e ControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSinkVolume got called, sinkID="),DLT_INT(sinkID),DLT_STRING("volume="),DLT_INT(volume),DLT_STRING("ramp="),DLT_INT(ramp),DLT_STRING("time="),DLT_INT(time));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSinkVolume got called, sinkID="), DLT_INT(sinkID), DLT_STRING("volume="), DLT_INT(volume), DLT_STRING("ramp="), DLT_INT(ramp), DLT_STRING("time="), DLT_INT(time));
- am_volume_t tempVolume;
- if(mDatabaseHandler->getSinkVolume(sinkID,tempVolume)!=E_OK) return E_UNKNOWN;
- if(tempVolume==volume) return E_NO_CHANGE;
- return mRoutingSender->asyncSetSinkVolume(handle,sinkID,volume,ramp,time);
+ am_volume_t tempVolume;
+ if (mDatabaseHandler->getSinkVolume(sinkID, tempVolume) != E_OK) return E_UNKNOWN;
+ if (tempVolume == volume) return E_NO_CHANGE;
+ return mRoutingSender->asyncSetSinkVolume(handle, sinkID, volume, ramp, time);
}
-
-
am_Error_e ControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e rampType, const am_time_t time)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSourceVolume got called, sourceID="),DLT_INT(sourceID),DLT_STRING("volume="),DLT_INT(volume),DLT_STRING("ramp="),DLT_INT(rampType),DLT_STRING("time="),DLT_INT(time));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSourceVolume got called, sourceID="), DLT_INT(sourceID), DLT_STRING("volume="), DLT_INT(volume), DLT_STRING("ramp="), DLT_INT(rampType), DLT_STRING("time="), DLT_INT(time));
- am_volume_t tempVolume;
- if(mDatabaseHandler->getSourceVolume(sourceID,tempVolume)!=E_OK) return E_UNKNOWN;
- if(tempVolume==volume) return E_NO_CHANGE;
- return mRoutingSender->asyncSetSourceVolume(handle,sourceID,volume,rampType,time);
+ am_volume_t tempVolume;
+ if (mDatabaseHandler->getSourceVolume(sourceID, tempVolume) != E_OK) return E_UNKNOWN;
+ if (tempVolume == volume) return E_NO_CHANGE;
+ return mRoutingSender->asyncSetSourceVolume(handle, sourceID, volume, rampType, time);
}
-
-
am_Error_e ControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSinkSoundProperty got called, sinkID="),DLT_INT(sinkID),DLT_STRING("soundProperty.Type="),DLT_INT(soundProperty.type),DLT_STRING("soundProperty.value="),DLT_INT(soundProperty.value));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSinkSoundProperty got called, sinkID="), DLT_INT(sinkID), DLT_STRING("soundProperty.Type="), DLT_INT(soundProperty.type), DLT_STRING("soundProperty.value="), DLT_INT(soundProperty.value));
- uint16_t value;
- if(mDatabaseHandler->getSinkSoundPropertyValue(sinkID,soundProperty.type,value)!=E_OK) return E_UNKNOWN;
- if(value==soundProperty.value) return E_NO_CHANGE;
- return mRoutingSender->asyncSetSinkSoundProperty(handle,sinkID,soundProperty);
+ uint16_t value;
+ if (mDatabaseHandler->getSinkSoundPropertyValue(sinkID, soundProperty.type, value) != E_OK) return E_UNKNOWN;
+ if (value == soundProperty.value) return E_NO_CHANGE;
+ 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)
+am_Error_e 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));
+ 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));
+ 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)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSourceSoundProperty got called, sourceID="),DLT_INT(sourceID),DLT_STRING("soundProperty.Type="),DLT_INT(soundProperty.type),DLT_STRING("soundProperty.value="),DLT_INT(soundProperty.value));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::setSourceSoundProperty got called, sourceID="), DLT_INT(sourceID), DLT_STRING("soundProperty.Type="), DLT_INT(soundProperty.type), DLT_STRING("soundProperty.value="), DLT_INT(soundProperty.value));
- uint16_t value;
- if(mDatabaseHandler->getSourceSoundPropertyValue(sourceID,soundProperty.type,value)!=E_OK) return E_UNKNOWN;
- if(value==soundProperty.value) return E_NO_CHANGE;
- return mRoutingSender->asyncSetSourceSoundProperty(handle,sourceID,soundProperty);
+ uint16_t value;
+ if (mDatabaseHandler->getSourceSoundPropertyValue(sourceID, soundProperty.type, value) != E_OK) return E_UNKNOWN;
+ if (value == soundProperty.value) return E_NO_CHANGE;
+ 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)
+am_Error_e 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));
+ 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));
+ 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)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setDomainState got called, domainID="),DLT_INT(domainID),DLT_STRING("domainState="),DLT_INT(domainState));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::setDomainState got called, domainID="), DLT_INT(domainID), DLT_STRING("domainState="), DLT_INT(domainState));
- am_DomainState_e tempState=DS_MIN;
- if(mDatabaseHandler->getDomainState(domainID,tempState)!=E_OK) return E_UNKNOWN;
- if(tempState==domainState) return E_NO_CHANGE;
- return mRoutingSender->setDomainState(domainID,domainState);
+ am_DomainState_e tempState = DS_MIN;
+ if (mDatabaseHandler->getDomainState(domainID, tempState) != E_OK) return E_UNKNOWN;
+ if (tempState == domainState) return E_NO_CHANGE;
+ return mRoutingSender->setDomainState(domainID, domainState);
}
-
-
am_Error_e ControlReceiver::abortAction(const am_Handle_s handle)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::abortAction got called, handle.type="),DLT_INT(handle.handle),DLT_STRING("handle.handleType="),DLT_INT(handle.handleType));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::abortAction got called, handle.type="), DLT_INT(handle.handle), DLT_STRING("handle.handleType="), DLT_INT(handle.handleType));
- return mRoutingSender->asyncAbort(handle);
+ return mRoutingSender->asyncAbort(handle);
}
-
-
am_Error_e ControlReceiver::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- return mDatabaseHandler->enterDomainDB(domainData,domainID);
+ return mDatabaseHandler->enterDomainDB(domainData, domainID);
}
-
-
am_Error_e ControlReceiver::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
{
- return mDatabaseHandler->enterMainConnectionDB(mainConnectionData,connectionID);
+ return mDatabaseHandler->enterMainConnectionDB(mainConnectionData, connectionID);
}
-
-
am_Error_e ControlReceiver::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- return mDatabaseHandler->enterSinkDB(sinkData,sinkID);
+ return mDatabaseHandler->enterSinkDB(sinkData, sinkID);
}
-
-
am_Error_e ControlReceiver::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- return mDatabaseHandler->enterCrossfaderDB(crossfaderData,crossfaderID);
+ return mDatabaseHandler->enterCrossfaderDB(crossfaderData, crossfaderID);
}
-
-
am_Error_e ControlReceiver::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- return mDatabaseHandler->enterGatewayDB(gatewayData,gatewayID);
+ return mDatabaseHandler->enterGatewayDB(gatewayData, gatewayID);
}
-
-
am_Error_e ControlReceiver::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- return mDatabaseHandler->enterSourceDB(sourceData,sourceID);
+ return mDatabaseHandler->enterSourceDB(sourceData, sourceID);
}
am_Error_e ControlReceiver::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
{
- return mDatabaseHandler->enterSinkClassDB(sinkClass,sinkClassID);
+ return mDatabaseHandler->enterSinkClassDB(sinkClass, sinkClassID);
}
am_Error_e ControlReceiver::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
{
- return mDatabaseHandler->enterSourceClassDB(sourceClassID,sourceClass);
+ return mDatabaseHandler->enterSourceClassDB(sourceClassID, sourceClass);
}
-
am_Error_e ControlReceiver::enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s> & listSystemProperties)
{
- return mDatabaseHandler->enterSystemProperties(listSystemProperties);
+ return mDatabaseHandler->enterSystemProperties(listSystemProperties);
}
-
am_Error_e ControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s & route)
{
- return mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID,route);
+ return mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, route);
}
-
-
am_Error_e ControlReceiver::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
{
- return mDatabaseHandler->changeMainConnectionStateDB(mainconnectionID,connectionState);
+ return mDatabaseHandler->changeMainConnectionStateDB(mainconnectionID, connectionState);
}
-
-
am_Error_e ControlReceiver::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
{
- return mDatabaseHandler->changeSinkMainVolumeDB(mainVolume,sinkID);
+ return mDatabaseHandler->changeSinkMainVolumeDB(mainVolume, sinkID);
}
-
-
am_Error_e ControlReceiver::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
{
- return mDatabaseHandler->changeSinkAvailabilityDB(availability,sinkID);
+ return mDatabaseHandler->changeSinkAvailabilityDB(availability, sinkID);
}
-
-
am_Error_e ControlReceiver::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
{
- return mDatabaseHandler->changDomainStateDB(domainState,domainID);
+ return mDatabaseHandler->changDomainStateDB(domainState, domainID);
}
-
-
am_Error_e ControlReceiver::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
{
- return mDatabaseHandler->changeSinkMuteStateDB(muteState,sinkID);
+ return mDatabaseHandler->changeSinkMuteStateDB(muteState, sinkID);
}
-
-
am_Error_e ControlReceiver::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
- return mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty,sinkID);
+ return mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sinkID);
}
-
-
am_Error_e ControlReceiver::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
- return mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty,sourceID);
+ return mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sourceID);
}
-
-
am_Error_e ControlReceiver::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
{
- return mDatabaseHandler->changeSourceAvailabilityDB(availability,sourceID);
+ return mDatabaseHandler->changeSourceAvailabilityDB(availability, sourceID);
}
-
-
am_Error_e ControlReceiver::changeSystemPropertyDB(const am_SystemProperty_s & property)
{
- return mDatabaseHandler->changeSystemPropertyDB(property);
+ return mDatabaseHandler->changeSystemPropertyDB(property);
}
-
-
am_Error_e ControlReceiver::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
{
- return mDatabaseHandler->removeMainConnectionDB(mainConnectionID);
+ return mDatabaseHandler->removeMainConnectionDB(mainConnectionID);
}
-
-
am_Error_e ControlReceiver::removeSinkDB(const am_sinkID_t sinkID)
{
- return mDatabaseHandler->removeSinkDB(sinkID);
+ return mDatabaseHandler->removeSinkDB(sinkID);
}
-
-
am_Error_e ControlReceiver::removeSourceDB(const am_sourceID_t sourceID)
{
- return mDatabaseHandler->removeSourceDB(sourceID);
+ return mDatabaseHandler->removeSourceDB(sourceID);
}
-
-
am_Error_e ControlReceiver::removeGatewayDB(const am_gatewayID_t gatewayID)
{
- return mDatabaseHandler->removeGatewayDB(gatewayID);
+ return mDatabaseHandler->removeGatewayDB(gatewayID);
}
-
-
am_Error_e ControlReceiver::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
- return mDatabaseHandler->removeCrossfaderDB(crossfaderID);
+ return mDatabaseHandler->removeCrossfaderDB(crossfaderID);
}
-
-
am_Error_e ControlReceiver::removeDomainDB(const am_domainID_t domainID)
{
- return mDatabaseHandler->removeDomainDB(domainID);
+ return mDatabaseHandler->removeDomainDB(domainID);
}
-
-
am_Error_e ControlReceiver::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
{
- return mDatabaseHandler->getSourceClassInfoDB(sourceID,classInfo);
+ return mDatabaseHandler->getSourceClassInfoDB(sourceID, classInfo);
}
-
am_Error_e ControlReceiver::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
{
- return mDatabaseHandler->getSinkClassInfoDB(sinkID,sinkClass);
+ return mDatabaseHandler->getSinkClassInfoDB(sinkID, sinkClass);
}
-
-
am_Error_e ControlReceiver::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
{
- return mDatabaseHandler->getGatewayInfoDB(gatewayID,gatewayData);
+ return mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData);
}
-
-
am_Error_e ControlReceiver::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
- return mDatabaseHandler->getCrossfaderInfoDB(crossfaderID,crossfaderData);
+ return mDatabaseHandler->getCrossfaderInfoDB(crossfaderID, crossfaderData);
}
-
-
am_Error_e ControlReceiver::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
{
- return mDatabaseHandler->getListSinksOfDomain(domainID,listSinkID);
+ return mDatabaseHandler->getListSinksOfDomain(domainID, listSinkID);
}
-
-
am_Error_e ControlReceiver::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
{
- return mDatabaseHandler->getListSourcesOfDomain(domainID,listSourceID);
+ return mDatabaseHandler->getListSourcesOfDomain(domainID, listSourceID);
}
-
-
am_Error_e ControlReceiver::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listGatewaysID) const
{
- return mDatabaseHandler->getListCrossfadersOfDomain(domainID,listGatewaysID);
+ return mDatabaseHandler->getListCrossfadersOfDomain(domainID, listGatewaysID);
}
-
-
am_Error_e ControlReceiver::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
{
- return mDatabaseHandler->getListGatewaysOfDomain(domainID,listGatewaysID);
+ return mDatabaseHandler->getListGatewaysOfDomain(domainID, listGatewaysID);
}
-
-
am_Error_e ControlReceiver::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
- return mDatabaseHandler->getListMainConnections(listMainConnections);
+ return mDatabaseHandler->getListMainConnections(listMainConnections);
}
-
-
am_Error_e ControlReceiver::getListDomains(std::vector<am_Domain_s> & listDomains) const
{
- return mDatabaseHandler->getListDomains(listDomains);
+ return mDatabaseHandler->getListDomains(listDomains);
}
-
-
am_Error_e ControlReceiver::getListConnections(std::vector<am_Connection_s> & listConnections) const
{
- return mDatabaseHandler->getListConnections(listConnections);
+ return mDatabaseHandler->getListConnections(listConnections);
}
-
-
am_Error_e ControlReceiver::getListSinks(std::vector<am_Sink_s> & listSinks) const
{
- return mDatabaseHandler->getListSinks(listSinks);
+ return mDatabaseHandler->getListSinks(listSinks);
}
-
-
am_Error_e ControlReceiver::getListSources(std::vector<am_Source_s> & listSources) const
{
- return mDatabaseHandler->getListSources(listSources);
+ return mDatabaseHandler->getListSources(listSources);
}
-
-
am_Error_e ControlReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
- return mDatabaseHandler->getListSourceClasses(listSourceClasses);
+ return mDatabaseHandler->getListSourceClasses(listSourceClasses);
}
-
-
am_Error_e ControlReceiver::getListHandles(std::vector<am_Handle_s> & listHandles) const
{
- return mRoutingSender->getListHandles(listHandles);
+ return mRoutingSender->getListHandles(listHandles);
}
-
-
am_Error_e ControlReceiver::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
{
- return mDatabaseHandler->getListCrossfaders(listCrossfaders);
+ return mDatabaseHandler->getListCrossfaders(listCrossfaders);
}
-
-
am_Error_e ControlReceiver::getListGateways(std::vector<am_Gateway_s> & listGateways) const
{
- return mDatabaseHandler->getListGateways(listGateways);
+ return mDatabaseHandler->getListGateways(listGateways);
}
-
-
am_Error_e ControlReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
- return mDatabaseHandler->getListSinkClasses(listSinkClasses);
+ return mDatabaseHandler->getListSinkClasses(listSinkClasses);
}
-
am_Error_e ControlReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
- return mDatabaseHandler->getListSystemProperties(listSystemProperties);
+ return mDatabaseHandler->getListSystemProperties(listSystemProperties);
}
-
am_Error_e ControlReceiver::changeSinkClassInfoDB(const am_SinkClass_s & classInfo)
{
- return mDatabaseHandler->changeSinkClassInfoDB(classInfo);
+ return mDatabaseHandler->changeSinkClassInfoDB(classInfo);
}
am_Error_e ControlReceiver::changeSourceClassInfoDB(const am_SourceClass_s & classInfo)
{
- return mDatabaseHandler->changeSourceClassInfoDB(classInfo);
+ return mDatabaseHandler->changeSourceClassInfoDB(classInfo);
}
am_Error_e ControlReceiver::removeSinkClassDB(const am_sinkClass_t sinkClassID)
{
- return mDatabaseHandler->removeSinkClassDB(sinkClassID);
+ return mDatabaseHandler->removeSinkClassDB(sinkClassID);
}
am_Error_e ControlReceiver::removeSourceClassDB(const am_sourceClass_t sourceClassID)
{
- return mDatabaseHandler->removeSourceClassDB(sourceClassID);
+ return mDatabaseHandler->removeSourceClassDB(sourceClassID);
}
void ControlReceiver::setCommandReady()
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setCommandReady got called"));
- mCommandSender->cbCommunicationReady();
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::setCommandReady got called"));
+ mCommandSender->cbCommunicationReady();
}
void ControlReceiver::setRoutingReady()
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("ControlReceiver::setRoutingReady got called"));
- mRoutingSender->routingInterfacesReady();
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("ControlReceiver::setRoutingReady got called"));
+ mRoutingSender->routingInterfacesReady();
}
-am_Error_e am::ControlReceiver::getSocketHandler(SocketHandler *& socketHandler)
+am_Error_e ControlReceiver::getSocketHandler(SocketHandler *& socketHandler)
{
#ifdef WITH_SOCKETHANDLER_LOOP
- socketHandler=mSocketHandler;
- return E_OK;
+ socketHandler = mSocketHandler;
+ return E_OK;
#else
- return E_UNKNOWN;
+ return E_UNKNOWN;
#endif
}
-
uint16_t ControlReceiver::getInterfaceVersion() const
{
- return ControlReceiveVersion;
+ return ControlReceiveVersion;
}
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/ControlSender.cpp b/AudioManagerDaemon/src/ControlSender.cpp
index 3371fb2..ca7ce3a 100644
--- a/AudioManagerDaemon/src/ControlSender.cpp
+++ b/AudioManagerDaemon/src/ControlSender.cpp
@@ -1,26 +1,26 @@
/**
-* 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.
-*
-*/
+ * 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>
@@ -34,319 +34,248 @@ using namespace am;
#define REQUIRED_MIN_INTERFACE_VERSION 1
-ControlSender::ControlSender(std::string controlPluginFile)
- :mlibHandle(NULL),
- mController(NULL)
-{
- std::ifstream isfile(controlPluginFile.c_str());
- if (!isfile)
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("ControlSender::ControlSender: Controller plugin not found:"),DLT_STRING(controlPluginFile.c_str()));
- }
- else if (!controlPluginFile.empty())
- {
- ControlSendInterface* (*createFunc)();
- createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile,mlibHandle);
- assert(createFunc!=NULL);
- mController = createFunc();
+ControlSender::ControlSender(std::string controlPluginFile) :
+ mlibHandle(NULL), //
+ mController(NULL)
+{
+ std::ifstream isfile(controlPluginFile.c_str());
+ if (!isfile)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("ControlSender::ControlSender: Controller plugin not found:"), DLT_STRING(controlPluginFile.c_str()));
+ }
+ else if (!controlPluginFile.empty())
+ {
+ ControlSendInterface* (*createFunc)();
+ createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile, mlibHandle);
+ assert(createFunc!=NULL);
+ mController = createFunc();
//check libversion
assert(REQUIRED_MIN_INTERFACE_VERSION<=mController->getInterfaceVersion());
- }
- else
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("ControlSender::ControlSender: No controller loaded !"));
- }
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("ControlSender::ControlSender: No controller loaded !"));
+ }
}
ControlSender::~ControlSender()
{
- if (mlibHandle) dlclose(mlibHandle);
+ if (mlibHandle) dlclose(mlibHandle);
}
void ControlSender::hookAllPluginsLoaded()
{
- mController->hookAllPluginsLoaded();
+ mController->hookAllPluginsLoaded();
}
-
-
am_Error_e ControlSender::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
- return mController->hookUserConnectionRequest(sourceID,sinkID,mainConnectionID);
+ return mController->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID);
}
-
-
am_Error_e ControlSender::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
{
- return mController->hookUserDisconnectionRequest(connectionID);
+ return mController->hookUserDisconnectionRequest(connectionID);
}
-
-
am_Error_e ControlSender::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
{
- return mController->hookUserSetMainSinkSoundProperty(sinkID,soundProperty);
+ return mController->hookUserSetMainSinkSoundProperty(sinkID, soundProperty);
}
-
-
am_Error_e ControlSender::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
{
- return mController->hookUserSetMainSourceSoundProperty(sourceID,soundProperty);
+ return mController->hookUserSetMainSourceSoundProperty(sourceID, soundProperty);
}
-
-
am_Error_e ControlSender::hookUserSetSystemProperty(const am_SystemProperty_s & property)
{
- return mController->hookUserSetSystemProperty(property);
+ return mController->hookUserSetSystemProperty(property);
}
-
-
am_Error_e ControlSender::hookUserVolumeChange(const am_sinkID_t sinkID, const am_mainVolume_t newVolume)
{
- return mController->hookUserVolumeChange(sinkID,newVolume);
+ return mController->hookUserVolumeChange(sinkID, newVolume);
}
-
-
am_Error_e ControlSender::hookUserVolumeStep(const am_sinkID_t sinkID, const int16_t increment)
{
- return mController->hookUserVolumeStep(sinkID,increment);
+ return mController->hookUserVolumeStep(sinkID, increment);
}
-
-
am_Error_e ControlSender::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
- return mController->hookUserSetSinkMuteState(sinkID,muteState);
+ return mController->hookUserSetSinkMuteState(sinkID, muteState);
}
-
-
am_Error_e ControlSender::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- return mController->hookSystemRegisterDomain(domainData,domainID);
+ return mController->hookSystemRegisterDomain(domainData, domainID);
}
-
-
am_Error_e ControlSender::hookSystemDeregisterDomain(const am_domainID_t domainID)
{
- return mController->hookSystemDeregisterDomain(domainID);
+ return mController->hookSystemDeregisterDomain(domainID);
}
-
-
void ControlSender::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
{
- return mController->hookSystemDomainRegistrationComplete(domainID);
+ return mController->hookSystemDomainRegistrationComplete(domainID);
}
-
-
am_Error_e ControlSender::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- return mController->hookSystemRegisterSink(sinkData,sinkID);
+ return mController->hookSystemRegisterSink(sinkData, sinkID);
}
-
-
am_Error_e ControlSender::hookSystemDeregisterSink(const am_sinkID_t sinkID)
{
- return mController->hookSystemDeregisterSink(sinkID);
+ return mController->hookSystemDeregisterSink(sinkID);
}
-
-
am_Error_e ControlSender::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- return mController->hookSystemRegisterSource(sourceData,sourceID);
+ return mController->hookSystemRegisterSource(sourceData, sourceID);
}
-
-
am_Error_e ControlSender::hookSystemDeregisterSource(const am_sourceID_t sourceID)
{
- return mController->hookSystemDeregisterSource(sourceID);
+ return mController->hookSystemDeregisterSource(sourceID);
}
-
-
am_Error_e ControlSender::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- return mController->hookSystemRegisterGateway(gatewayData,gatewayID);
+ return mController->hookSystemRegisterGateway(gatewayData, gatewayID);
}
-
-
am_Error_e ControlSender::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
{
- return mController->hookSystemDeregisterGateway(gatewayID);
+ return mController->hookSystemDeregisterGateway(gatewayID);
}
-
-
am_Error_e ControlSender::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- return mController->hookSystemRegisterCrossfader(crossfaderData,crossfaderID);
+ return mController->hookSystemRegisterCrossfader(crossfaderData, crossfaderID);
}
-
-
am_Error_e ControlSender::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
- return mController->hookSystemDeregisterCrossfader(crossfaderID);
+ return mController->hookSystemDeregisterCrossfader(crossfaderID);
}
-
-
void ControlSender::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
- return mController->hookSystemSinkVolumeTick(handle,sinkID,volume);
+ mController->hookSystemSinkVolumeTick(handle, sinkID, volume);
}
-
-
void ControlSender::hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
- return mController->hookSystemSourceVolumeTick(handle,sourceID,volume);
+ mController->hookSystemSourceVolumeTick(handle, sourceID, volume);
}
-
-
void ControlSender::hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
- return mController->hookSystemInterruptStateChange(sourceID,interruptState);
+ mController->hookSystemInterruptStateChange(sourceID, interruptState);
}
-
-
void ControlSender::hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
- return mController->hookSystemSinkAvailablityStateChange(sinkID,availability);
+ mController->hookSystemSinkAvailablityStateChange(sinkID, availability);
}
-
-
void ControlSender::hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
- return mController->hookSystemSourceAvailablityStateChange(sourceID,availability);
+ mController->hookSystemSourceAvailablityStateChange(sourceID, availability);
}
-
-
void ControlSender::hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
{
- return mController->hookSystemDomainStateChange(domainID,state);
+ mController->hookSystemDomainStateChange(domainID, state);
}
-
-
void ControlSender::hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> & data)
{
- return mController->hookSystemReceiveEarlyData(data);
+ mController->hookSystemReceiveEarlyData(data);
}
-
-
void ControlSender::hookSystemSpeedChange(const am_speed_t speed)
{
- return mController->hookSystemSpeedChange(speed);
+ mController->hookSystemSpeedChange(speed);
}
-
-
void ControlSender::hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
{
- return mController->hookSystemTimingInformationChanged(mainConnectionID,time);
+ mController->hookSystemTimingInformationChanged(mainConnectionID, time);
}
-
-
void ControlSender::cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
{
- return mController->cbAckConnect(handle,errorID);
+ mController->cbAckConnect(handle, errorID);
}
-
-
void ControlSender::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
{
- return mController->cbAckDisconnect(handle,errorID);
+ mController->cbAckDisconnect(handle, errorID);
}
-
-
void ControlSender::cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
{
- return mController->cbAckCrossFade(handle,hostsink,error);
+ mController->cbAckCrossFade(handle, hostsink, error);
}
-
-
void ControlSender::cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- return mController->cbAckSetSinkVolumeChange(handle,volume,error);
+ mController->cbAckSetSinkVolumeChange(handle, volume, error);
}
-
-
void ControlSender::cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- return mController->cbAckSetSourceVolumeChange(handle,volume,error);
+ mController->cbAckSetSourceVolumeChange(handle, volume, error);
}
-
-
void ControlSender::cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
- return mController->cbAckSetSourceState(handle,error);
+ mController->cbAckSetSourceState(handle, error);
}
-
-
void ControlSender::cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- return mController->cbAckSetSourceSoundProperty(handle,error);
+ mController->cbAckSetSourceSoundProperty(handle, error);
}
-
-
am_Error_e ControlSender::startupController(ControlReceiveInterface *controlreceiveinterface)
{
- return mController->startupController(controlreceiveinterface);
+ return mController->startupController(controlreceiveinterface);
}
am_Error_e ControlSender::stopController()
{
- return mController->stopController();
+ return mController->stopController();
}
void ControlSender::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- return mController->cbAckSetSinkSoundProperty(handle,error);
+ mController->cbAckSetSinkSoundProperty(handle, error);
}
void ControlSender::cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
- return mController->cbAckSetSinkSoundProperties(handle,error);
+ mController->cbAckSetSinkSoundProperties(handle, error);
}
void ControlSender::cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
- return mController->cbAckSetSourceSoundProperties(handle,error);
+ mController->cbAckSetSourceSoundProperties(handle, error);
}
-uint16_t ControlSender::getInterfaceVersion() const
+am_Error_e ControlSender::getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e> & listPrioConnectionFormats)
{
- return ControlSendVersion;
+ return mController->getConnectionFormatChoice(sourceID, sinkID, listPossibleConnectionFormats, listPrioConnectionFormats);
}
-
-
-
+uint16_t ControlSender::getInterfaceVersion() const
+{
+ return ControlSendVersion;
+}
diff --git a/AudioManagerDaemon/src/DBusWrapper.cpp b/AudioManagerDaemon/src/DBusWrapper.cpp
index cb332ef..5b81792 100644
--- a/AudioManagerDaemon/src/DBusWrapper.cpp
+++ b/AudioManagerDaemon/src/DBusWrapper.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file SocketHandler.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file SocketHandler.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 <dbus/DBusWrapper.h>
#include <SocketHandler.h>
@@ -47,71 +47,71 @@ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
DBusWrapper* DBusWrapper::mReference = NULL;
-DBusWrapper::DBusWrapper()
- : pDbusDispatchCallback(this,&DBusWrapper::dbusDispatchCallback),
- pDbusFireCallback(this,&DBusWrapper::dbusFireCallback),
- pDbusCheckCallback(this,&DBusWrapper::dbusCheckCallback),
- pDbusTimerCallback(this,&DBusWrapper::dbusTimerCallback),
- mDbusConnection(0),
- mDBusError(),
- mNodesList(),
- mListTimerhandlePointer()
+DBusWrapper::DBusWrapper() :
+ pDbusDispatchCallback(this, &DBusWrapper::dbusDispatchCallback), //
+ pDbusFireCallback(this, &DBusWrapper::dbusFireCallback), //
+ pDbusCheckCallback(this, &DBusWrapper::dbusCheckCallback), //
+ pDbusTimerCallback(this, &DBusWrapper::dbusTimerCallback), //
+ mDbusConnection(0), //
+ mDBusError(), //
+ mNodesList(), //
+ mListTimerhandlePointer()
{
- dbus_error_init(&mDBusError);
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::DBusWrapper Opening DBus connection"));
- mDbusConnection=dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
+ dbus_error_init(&mDBusError);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::DBusWrapper Opening DBus connection"));
+ mDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
if (dbus_error_is_set(&mDBusError))
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Error while getting the DBus"));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Error while getting the DBus"));
dbus_error_free(&mDBusError);
}
if (NULL == mDbusConnection)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper DBus Connection is null"));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper DBus Connection is null"));
}
//first, we are old enought to live longer then the connection:
dbus_connection_set_exit_on_disconnect(mDbusConnection, FALSE);
- mObjectPathVTable.message_function=DBusWrapper::cbRootIntrospection;
- dbus_connection_register_object_path(mDbusConnection,DBUS_SERVICE_OBJECT_PATH , &mObjectPathVTable, this);
- int ret = dbus_bus_request_name(mDbusConnection,DBUS_SERVICE_PREFIX,DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError);
+ mObjectPathVTable.message_function = DBusWrapper::cbRootIntrospection;
+ dbus_connection_register_object_path(mDbusConnection, DBUS_SERVICE_OBJECT_PATH, &mObjectPathVTable, this);
+ int ret = dbus_bus_request_name(mDbusConnection, DBUS_SERVICE_PREFIX, DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError);
if (dbus_error_is_set(&mDBusError))
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Name Error"),DLT_STRING(mDBusError.message));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Name Error"), DLT_STRING(mDBusError.message));
dbus_error_free(&mDBusError);
}
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner"), DLT_INT(ret));
- exit(1);
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner"), DLT_INT(ret));
+ exit(1);
}
}
-DBusWrapper::DBusWrapper(SocketHandler* socketHandler)
- : pDbusDispatchCallback(this,&DBusWrapper::dbusDispatchCallback),
- pDbusFireCallback(this,&DBusWrapper::dbusFireCallback),
- pDbusCheckCallback(this,&DBusWrapper::dbusCheckCallback),
- pDbusTimerCallback(this,&DBusWrapper::dbusTimerCallback),
- mDbusConnection(0),
- mDBusError(),
- mNodesList(),
- mListTimerhandlePointer(),
- mSocketHandler(socketHandler)
+DBusWrapper::DBusWrapper(SocketHandler* socketHandler) :
+ pDbusDispatchCallback(this, &DBusWrapper::dbusDispatchCallback), //
+ pDbusFireCallback(this, &DBusWrapper::dbusFireCallback), //
+ pDbusCheckCallback(this, &DBusWrapper::dbusCheckCallback), //
+ pDbusTimerCallback(this, &DBusWrapper::dbusTimerCallback), //
+ mDbusConnection(0), //
+ mDBusError(), //
+ mNodesList(), //
+ mListTimerhandlePointer(), //
+ mSocketHandler(socketHandler)
{
- assert(mSocketHandler!=0);
+ assert(mSocketHandler!=0);
- dbus_error_init(&mDBusError);
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::DBusWrapper Opening DBus connection"));
- mDbusConnection=dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
+ dbus_error_init(&mDBusError);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::DBusWrapper Opening DBus connection"));
+ mDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
if (dbus_error_is_set(&mDBusError))
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Error while getting the DBus"));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Error while getting the DBus"));
dbus_error_free(&mDBusError);
}
if (NULL == mDbusConnection)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper DBus Connection is null"));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper DBus Connection is null"));
}
//then we need to adopt the dbus to our mainloop:
@@ -122,351 +122,338 @@ DBusWrapper::DBusWrapper(SocketHandler* socketHandler)
//dbus_connection_set_dispatch_status_function
//add watch functions:
- dbus_bool_t watch=dbus_connection_set_watch_functions(mDbusConnection, addWatch, removeWatch, toogleWatch , this, NULL);
+ dbus_bool_t watch = dbus_connection_set_watch_functions(mDbusConnection, addWatch, removeWatch, toogleWatch, this, NULL);
if (!watch)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Registering of watch functions failed"));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Registering of watch functions failed"));
}
//add timer functions:
- dbus_bool_t timer=dbus_connection_set_timeout_functions(mDbusConnection, addTimeout, removeTimeout, toggleTimeout, this, NULL);
- if(!timer)
+ dbus_bool_t timer = dbus_connection_set_timeout_functions(mDbusConnection, addTimeout, removeTimeout, toggleTimeout, this, NULL);
+ if (!timer)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Registering of timer functions failed"));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Registering of timer functions failed"));
}
//register callback for Introspectio
- mObjectPathVTable.message_function=DBusWrapper::cbRootIntrospection;
- dbus_connection_register_object_path(mDbusConnection,DBUS_SERVICE_OBJECT_PATH , &mObjectPathVTable, this);
- int ret = dbus_bus_request_name(mDbusConnection,DBUS_SERVICE_PREFIX,DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError);
+ mObjectPathVTable.message_function = DBusWrapper::cbRootIntrospection;
+ dbus_connection_register_object_path(mDbusConnection, DBUS_SERVICE_OBJECT_PATH, &mObjectPathVTable, this);
+ int ret = dbus_bus_request_name(mDbusConnection, DBUS_SERVICE_PREFIX, DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError);
if (dbus_error_is_set(&mDBusError))
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Name Error"),DLT_STRING(mDBusError.message));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Name Error"), DLT_STRING(mDBusError.message));
dbus_error_free(&mDBusError);
}
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner"), DLT_INT(ret));
- exit(1);
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner"), DLT_INT(ret));
+ exit(1);
}
}
DBusWrapper::~DBusWrapper()
{
- //close the connection again
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~DBusWrapper Closing DBus connection"));
- dbus_connection_unref(mDbusConnection);
-
- //clean up all timerhandles we created but did not delete before
- std::vector<sh_timerHandle_t*>::iterator it=mListTimerhandlePointer.begin();
- for(;it!=mListTimerhandlePointer.end();++it)
- {
- delete *it;
- }
+ //close the connection again
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::~DBusWrapper Closing DBus connection"));
+ dbus_connection_unref(mDbusConnection);
+
+ //clean up all timerhandles we created but did not delete before
+ std::vector<sh_timerHandle_t*>::iterator it = mListTimerhandlePointer.begin();
+ for (; it != mListTimerhandlePointer.end(); ++it)
+ {
+ delete *it;
+ }
}
void DBusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~registerCallback register callback:"),DLT_STRING(path.c_str()));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::~registerCallback register callback:"), DLT_STRING(path.c_str()));
- std::string completePath=std::string(DBUS_SERVICE_OBJECT_PATH)+"/"+path;
- dbus_error_init(&mDBusError);
- mDbusConnection=dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
- dbus_connection_register_object_path(mDbusConnection,completePath.c_str(), vtable, userdata);
+ std::string completePath = std::string(DBUS_SERVICE_OBJECT_PATH) + "/" + path;
+ dbus_error_init(&mDBusError);
+ mDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
+ dbus_connection_register_object_path(mDbusConnection, completePath.c_str(), vtable, userdata);
if (dbus_error_is_set(&mDBusError))
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::registerCallack error: "),DLT_STRING(mDBusError.message));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::registerCallack error: "), DLT_STRING(mDBusError.message));
dbus_error_free(&mDBusError);
}
- mNodesList.push_back(path);
+ mNodesList.push_back(path);
}
DBusHandlerResult DBusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::~cbRootIntrospection called:"));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::~cbRootIntrospection called:"));
- mReference=(DBusWrapper*)reference;
- std::list<std::string>nodesList=mReference->mNodesList;
- DBusMessage * reply;
+ mReference = (DBusWrapper*) reference;
+ std::list<std::string> nodesList = mReference->mNodesList;
+ DBusMessage * reply;
DBusMessageIter args;
dbus_uint32_t serial = 0;
- if (dbus_message_is_method_call(msg, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- {
- std::list<std::string>::iterator nodeIter=nodesList.begin();
- const char *xml=ROOT_INTROSPECT_XML;
- std::stringstream introspect;
- introspect << std::string(xml);
- for(;nodeIter!=nodesList.end();++nodeIter)
- {
- introspect<<"<node name='"<<nodeIter->c_str()<<"'/>";
- }
- introspect<<"</node>";
-
- reply = dbus_message_new_method_return(msg);
- std::string s = introspect.str();
- const char* string=s.c_str();
-
- // add the arguments to the reply
- dbus_message_iter_init_append(reply, &args);
- if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &string))
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::~cbRootIntrospection DBUS Out Of Memory!"));
- }
-
- // send the reply && flush the connection
- if (!dbus_connection_send(conn, reply, &serial))
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::~cbRootIntrospection DBUS Out Of Memory!"));
- }
- dbus_connection_flush(conn);
- // free the reply
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- else
- {
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
+ if (dbus_message_is_method_call(msg, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
+ {
+ std::list<std::string>::iterator nodeIter = nodesList.begin();
+ const char *xml = ROOT_INTROSPECT_XML;
+ std::stringstream introspect;
+ introspect << std::string(xml);
+ for (; nodeIter != nodesList.end(); ++nodeIter)
+ {
+ introspect << "<node name='" << nodeIter->c_str() << "'/>";
+ }
+ introspect << "</node>";
+
+ reply = dbus_message_new_method_return(msg);
+ std::string s = introspect.str();
+ const char* string = s.c_str();
+
+ // add the arguments to the reply
+ dbus_message_iter_init_append(reply, &args);
+ if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &string))
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::~cbRootIntrospection DBUS Out Of Memory!"));
+ }
+
+ // send the reply && flush the connection
+ if (!dbus_connection_send(conn, reply, &serial))
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::~cbRootIntrospection DBUS Out Of Memory!"));
+ }
+ dbus_connection_flush(conn);
+ // free the reply
+ dbus_message_unref(reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ else
+ {
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
}
void DBusWrapper::dbusMainLoop()
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusMainLoop Entering MainLoop"));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusMainLoop Entering MainLoop"));
- while (dbus_connection_read_write_dispatch(mDbusConnection, -1))
- {
+ while (dbus_connection_read_write_dispatch(mDbusConnection, -1))
+ {
- }
+ }
}
void DBusWrapper::getDBusConnection(DBusConnection *& connection) const
{
- connection=mDbusConnection;
+ connection = mDbusConnection;
}
dbus_bool_t DBusWrapper::addWatch(DBusWatch *watch, void *userData)
{
- mReference=(DBusWrapper*)userData;
- assert(mReference!=0);
- return mReference->addWatchDelegate(watch,userData);
+ mReference = (DBusWrapper*) userData;
+ assert(mReference!=0);
+ return mReference->addWatchDelegate(watch, userData);
}
dbus_bool_t DBusWrapper::addWatchDelegate(DBusWatch * watch, void* userData)
{
- int16_t event=0;
- sh_pollHandle_t handle=0;
- uint flags=dbus_watch_get_flags(watch);
+ int16_t event = 0;
+ sh_pollHandle_t handle = 0;
+ uint flags = dbus_watch_get_flags(watch);
- /* no watch flags for disabled watches */
+ /* 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;
}
- 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));
- am_Error_e error=mSocketHandler->addFDPoll(dbus_watch_get_unix_fd(watch),event,NULL,&pDbusFireCallback,&pDbusCheckCallback,&pDbusDispatchCallback,watch,handle);
+ 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));
+ am_Error_e error = mSocketHandler->addFDPoll(dbus_watch_get_unix_fd(watch), event, NULL, &pDbusFireCallback, &pDbusCheckCallback, &pDbusDispatchCallback, watch, handle);
- //if everything is alright, add the watch and the handle to our map so we know this relationship
- if (error==E_OK && handle!=0)
- {
- mMapHandleWatch.insert(std::make_pair(watch,handle));
- return true;
- }
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("DBusWrapper::addWatchDelegate entering watch failed"));
+ //if everything is alright, add the watch and the handle to our map so we know this relationship
+ if (error == E_OK && handle != 0)
+ {
+ mMapHandleWatch.insert(std::make_pair(watch, handle));
+ return true;
+ }DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DBusWrapper::addWatchDelegate entering watch failed"));
}
void DBusWrapper::removeWatch(DBusWatch *watch, void *userData)
{
- mReference=(DBusWrapper*)userData;
- assert(mReference!=0);
- mReference->removeWatchDelegate(watch,userData);
+ mReference = (DBusWrapper*) userData;
+ assert(mReference!=0);
+ mReference->removeWatchDelegate(watch, userData);
}
void DBusWrapper::removeWatchDelegate(DBusWatch *watch, void *userData)
{
- std::map<DBusWatch*,sh_pollHandle_t>::iterator iterator=mMapHandleWatch.begin();
- iterator=mMapHandleWatch.find(watch);
- 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);
+ std::map<DBusWatch*, sh_pollHandle_t>::iterator iterator = mMapHandleWatch.begin();
+ iterator = mMapHandleWatch.find(watch);
+ 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::toogleWatch(DBusWatch *watch, void *userData)
{
- mReference=(DBusWrapper*)userData;
- assert(mReference!=0);
- mReference->toogleWatchDelegate(watch,userData);
+ mReference = (DBusWrapper*) userData;
+ assert(mReference!=0);
+ mReference->toogleWatchDelegate(watch, userData);
}
void DBusWrapper::toogleWatchDelegate(DBusWatch *watch, void *userData)
{
- int16_t event=0;
- int watchFD=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;
- }
- std::map<DBusWatch*,sh_pollHandle_t>::iterator iterator=mMapHandleWatch.begin();
- iterator=mMapHandleWatch.find(watch);
- if (iterator!=mMapHandleWatch.end()) mSocketHandler->updateEventFlags(iterator->second,event);
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::toogleWatchDelegate watch was toggeled"));
+ int16_t event = 0;
+ int watchFD = 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;
+ }
+ std::map<DBusWatch*, sh_pollHandle_t>::iterator iterator = mMapHandleWatch.begin();
+ iterator = mMapHandleWatch.find(watch);
+ 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::addTimeout(DBusTimeout *timeout, void* userData)
{
- mReference=(DBusWrapper*)userData;
- assert(mReference!=0);
- return mReference->addTimeoutDelegate(timeout,userData);
+ mReference = (DBusWrapper*) userData;
+ assert(mReference!=0);
+ return mReference->addTimeoutDelegate(timeout, userData);
}
-dbus_bool_t DBusWrapper::addTimeoutDelegate(DBusTimeout *timeout,void* userData)
+dbus_bool_t DBusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userData)
{
if (!dbus_timeout_get_enabled(timeout)) return false;
//calculate the timeout in timeval
timespec pollTimeout;
- int localTimeout=dbus_timeout_get_interval(timeout);
- pollTimeout.tv_sec=localTimeout/1000;
- pollTimeout.tv_nsec=(localTimeout%1000)*1000000;
+ int localTimeout = dbus_timeout_get_interval(timeout);
+ pollTimeout.tv_sec = localTimeout / 1000;
+ pollTimeout.tv_nsec = (localTimeout % 1000) * 1000000;
//prepare handle and callback. new is eval, but there is no other choice because we need the pointer!
- sh_timerHandle_t* handle=new sh_timerHandle_t;
+ sh_timerHandle_t* handle = new sh_timerHandle_t;
mListTimerhandlePointer.push_back(handle);
- shTimerCallBack* buffer=&pDbusTimerCallback;
+ shTimerCallBack* buffer = &pDbusTimerCallback;
//add the timer to the pollLoop
- mSocketHandler->addTimer(pollTimeout,buffer,*handle,timeout);
+ mSocketHandler->addTimer(pollTimeout, buffer, *handle, timeout);
//save the handle with dbus context
dbus_timeout_set_data(timeout, handle, NULL);
//save timeout in Socket context
- userData=timeout;
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::addTimeoutDelegate a timeout was added"));
+ userData = timeout;
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::addTimeoutDelegate a timeout was added"));
return true;
}
void DBusWrapper::removeTimeout(DBusTimeout *timeout, void* userData)
{
- mReference=(DBusWrapper*)userData;
- assert(mReference!=0);
- mReference->removeTimeoutDelegate(timeout,userData);
+ mReference = (DBusWrapper*) userData;
+ assert(mReference!=0);
+ mReference->removeTimeoutDelegate(timeout, userData);
}
void DBusWrapper::removeTimeoutDelegate(DBusTimeout *timeout, 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);
-
- //now go throught the timerlist and remove the pointer, free memory
- std::vector<sh_timerHandle_t*>::iterator it=mListTimerhandlePointer.begin();
- for(;it!=mListTimerhandlePointer.end();++it)
- {
- if (*it==handle)
- {
- mListTimerhandlePointer.erase(it);
- break;
- }
- }
- delete handle;
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::removeTimeoutDelegate a timeout was removed"));
+ //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);
+
+ //now go throught the timerlist and remove the pointer, free memory
+ std::vector<sh_timerHandle_t*>::iterator it = mListTimerhandlePointer.begin();
+ for (; it != mListTimerhandlePointer.end(); ++it)
+ {
+ if (*it == handle)
+ {
+ mListTimerhandlePointer.erase(it);
+ break;
+ }
+ }
+ delete handle;
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::removeTimeoutDelegate a timeout was removed"));
}
void DBusWrapper::toggleTimeout(DBusTimeout *timeout, void* userData)
{
- mReference=(DBusWrapper*)userData;
- assert(mReference!=0);
- mReference->toggleTimeoutDelegate(timeout,userData);
+ mReference = (DBusWrapper*) userData;
+ assert(mReference!=0);
+ mReference->toggleTimeoutDelegate(timeout, userData);
}
bool am::DBusWrapper::dbusDispatchCallback(const sh_pollHandle_t handle, void *userData)
{
- bool returnVal=true;
- dbus_connection_ref(mDbusConnection);
- if (dbus_connection_dispatch(mDbusConnection)==DBUS_DISPATCH_COMPLETE) returnVal=false;
+ bool returnVal = true;
+ dbus_connection_ref(mDbusConnection);
+ 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"));
+ 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)
{
- bool returnVal=false;
- dbus_connection_ref(mDbusConnection);
- if (dbus_connection_get_dispatch_status(mDbusConnection) == DBUS_DISPATCH_DATA_REMAINS) returnVal=true;
+ bool returnVal = false;
+ dbus_connection_ref(mDbusConnection);
+ 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"));
+ 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)
{
- assert(userData!=NULL);
- uint flags=0;
+ 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;
+ DBusWatch *watch = (DBusWatch*) userData;
- dbus_connection_ref(mDbusConnection);
- bool ok=dbus_watch_handle(watch, flags);
- dbus_connection_unref(mDbusConnection);
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusFireCallback was called"));
+ dbus_connection_ref(mDbusConnection);
+ bool ok = 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)
{
- //get the pointer to the handle and remove the timer
- sh_timerHandle_t* handle=(sh_timerHandle_t*)dbus_timeout_get_data(timeout);
-
- //stop or restart?
- if (dbus_timeout_get_enabled(timeout))
- {
- //calculate the timeout in timeval
- timespec pollTimeout;
- int localTimeout=dbus_timeout_get_interval(timeout);
- pollTimeout.tv_sec=localTimeout/1000;
- pollTimeout.tv_nsec=(localTimeout%1000)*1000000;
- mSocketHandler->restartTimer(*handle,pollTimeout);
- }
- else
- {
- mSocketHandler->stopTimer(*handle);
- }
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::toggleTimeoutDelegate was called"));
+ //get the pointer to the handle and remove the timer
+ sh_timerHandle_t* handle = (sh_timerHandle_t*) dbus_timeout_get_data(timeout);
+
+ //stop or restart?
+ if (dbus_timeout_get_enabled(timeout))
+ {
+ //calculate the timeout in timeval
+ timespec pollTimeout;
+ int localTimeout = dbus_timeout_get_interval(timeout);
+ pollTimeout.tv_sec = localTimeout / 1000;
+ pollTimeout.tv_nsec = (localTimeout % 1000) * 1000000;
+ mSocketHandler->restartTimer(*handle, pollTimeout);
+ }
+ else
+ {
+ mSocketHandler->stopTimer(*handle);
+ }DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::toggleTimeoutDelegate was called"));
}
void DBusWrapper::dbusTimerCallback(sh_timerHandle_t handle, void *userData)
{
- assert(userData!=NULL);
- if (dbus_timeout_get_enabled((DBusTimeout*)userData))
- {
- timespec ts;
- ts.tv_nsec=-1;
- ts.tv_sec=-1;
- mSocketHandler->restartTimer(handle,ts);
- }
- dbus_timeout_handle((DBusTimeout*)userData);
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusTimerCallback was called"));
+ assert(userData!=NULL);
+ if (dbus_timeout_get_enabled((DBusTimeout*) userData))
+ {
+ timespec ts;
+ ts.tv_nsec = -1;
+ ts.tv_sec = -1;
+ mSocketHandler->restartTimer(handle, ts);
+ }
+ dbus_timeout_handle((DBusTimeout*) userData);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DBusWrapper::dbusTimerCallback was called"));
}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/DatabaseHandler.cpp b/AudioManagerDaemon/src/DatabaseHandler.cpp
index c712fbd..6a17b2b 100644
--- a/AudioManagerDaemon/src/DatabaseHandler.cpp
+++ b/AudioManagerDaemon/src/DatabaseHandler.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file Databasehandler.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file Databasehandler.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 "DatabaseHandler.h"
#include "DatabaseObserver.h"
@@ -49,18 +49,13 @@ DLT_IMPORT_CONTEXT(AudioManager)
using namespace am;
-const std::string databaseTables[]={
- " Domains (domainID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), busname VARCHAR(50), nodename VARCHAR(50), early BOOL, complete BOOL, state INTEGER, reserved BOOL);",
- " SourceClasses (sourceClassID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50));",
- " SinkClasses (sinkClassID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50));",
- " Sources (sourceID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, domainID INTEGER, name VARCHAR(50), sourceClassID INTEGER, sourceState INTEGER, volume INTEGER, visible BOOL, availability INTEGER, availabilityReason INTEGER, interruptState INTEGER, reserved BOOL);",
- " Sinks (sinkID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), domainID INTEGER, sinkClassID INTEGER, volume INTEGER, visible BOOL, availability INTEGER, availabilityReason INTEGER, muteState INTEGER, mainVolume INTEGER, reserved BOOL);",
- " Gateways (gatewayID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID INTEGER, sourceID INTEGER, domainSinkID INTEGER, domainSourceID INTEGER, controlDomainID INTEGER, inUse BOOL);",
- " Crossfaders (crossfaderID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID_A INTEGER, sinkID_B INTEGER, sourceID INTEGER, hotSink INTEGER);",
- " Connections (connectionID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, sourceID INTEGER, sinkID INTEGER, delay INTEGER, connectionFormat INTEGER, reserved BOOL);",
- " MainConnections (mainConnectionID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, sourceID INTEGER, sinkID INTEGER, connectionState INTEGER, delay INTEGER);",
- " SystemProperties (type INTEGER PRIMARY KEY, value INTEGER);"
-};
+const std::string databaseTables[] =
+{ //
+ " Domains (domainID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), busname VARCHAR(50), nodename VARCHAR(50), early BOOL, complete BOOL, state INTEGER, reserved BOOL);", " SourceClasses (sourceClassID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50));", " SinkClasses (sinkClassID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50));",
+ " Sources (sourceID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, domainID INTEGER, name VARCHAR(50), sourceClassID INTEGER, sourceState INTEGER, volume INTEGER, visible BOOL, availability INTEGER, availabilityReason INTEGER, interruptState INTEGER, reserved BOOL);", //
+ " Sinks (sinkID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), domainID INTEGER, sinkClassID INTEGER, volume INTEGER, visible BOOL, availability INTEGER, availabilityReason INTEGER, muteState INTEGER, mainVolume INTEGER, reserved BOOL);", " Gateways (gatewayID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID INTEGER, sourceID INTEGER, domainSinkID INTEGER, domainSourceID INTEGER, controlDomainID INTEGER, inUse BOOL);", " Crossfaders (crossfaderID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), sinkID_A INTEGER, sinkID_B INTEGER, sourceID INTEGER, hotSink INTEGER);",
+ " Connections (connectionID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, sourceID INTEGER, sinkID INTEGER, delay INTEGER, connectionFormat INTEGER, reserved BOOL);", //
+ " MainConnections (mainConnectionID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, sourceID INTEGER, sinkID INTEGER, connectionState INTEGER, delay INTEGER);", " SystemProperties (type INTEGER PRIMARY KEY, value INTEGER);" };
/**
* template to converts T to std::string
@@ -70,3843 +65,3708 @@ const std::string databaseTables[]={
template<typename T>
inline std::string i2s(T const& x)
{
- std::ostringstream o;
- o << x;
- return o.str();
+ std::ostringstream o;
+ o << x;
+ return o.str();
}
-DatabaseHandler::DatabaseHandler(std::string databasePath)
- : mDatabase(NULL),
- mPath(databasePath),
- mDatabaseObserver(NULL),
- mFirstStaticSink(true),
- mFirstStaticSource(true),
- mFirstStaticGateway(true),
- mFirstStaticSinkClass(true),
- mFirstStaticSourceClass(true),
- mListConnectionFormat()
+DatabaseHandler::DatabaseHandler(std::string databasePath) :
+ mDatabase(NULL), //
+ mPath(databasePath), //
+ mDatabaseObserver(NULL), //
+ mFirstStaticSink(true), //
+ mFirstStaticSource(true), //
+ mFirstStaticGateway(true), //
+ mFirstStaticSinkClass(true), //
+ mFirstStaticSourceClass(true), //
+ mListConnectionFormat()
{
- /**
- *\todo: this erases the database. just for testing!
- */
- std::ifstream infile(mPath.c_str());
+ /**
+ *\todo: this erases the database. just for testing!
+ */
+ std::ifstream infile(mPath.c_str());
- if (infile)
- {
- remove(mPath.c_str());
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::DatabaseHandler Knocked down database"));
- }
+ if (infile)
+ {
+ remove(mPath.c_str());
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::DatabaseHandler Knocked down database"));
+ }
- bool dbOpen=openDatabase();
- if (!dbOpen)
- {
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::DatabaseHandler problems opening the database!"));
- assert(!dbOpen);
- }
+ bool dbOpen = openDatabase();
+ if (!dbOpen)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::DatabaseHandler problems opening the database!"));
+ assert(!dbOpen);
+ }
- createTables();
+ createTables();
}
-
-
DatabaseHandler::~DatabaseHandler()
{
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("Closed Database"));
- sqlite3_close(mDatabase);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("Closed Database"));
+ sqlite3_close(mDatabase);
}
am_Error_e DatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- assert(domainData.domainID==0);
- assert(!domainData.name.empty());
- assert(!domainData.busname.empty());
- assert(domainData.state>=DS_CONTROLLED && domainData.state<=DS_INDEPENDENT_RUNDOWN);
-
- //first check for a reserved domain
- sqlite3_stmt* query=NULL, *queryFinal;
- int eCode=0;
- std::string command="SELECT domainID FROM "+ std::string(DOMAIN_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1, domainData.name.c_str(),domainData.name.size(),SQLITE_STATIC);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- command= "UPDATE " + std::string(DOMAIN_TABLE) + " SET name=?, busname=?, nodename=?, early=?, complete=?, state=?, reserved=? WHERE domainID=" +i2s(sqlite3_column_int(query,0));
- }
- else if (eCode==SQLITE_DONE)
- {
-
- command= "INSERT INTO " + std::string(DOMAIN_TABLE) + " (name, busname, nodename, early, complete, state, reserved) VALUES (?,?,?,?,?,?,?)";
- }
- else
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterDomainDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterDomainDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryFinal,NULL);
- sqlite3_bind_text(queryFinal,1, domainData.name.c_str(),domainData.name.size(),SQLITE_STATIC);
- sqlite3_bind_text(queryFinal,2, domainData.busname.c_str(),domainData.busname.size(),SQLITE_STATIC);
- sqlite3_bind_text(queryFinal,3, domainData.nodename.c_str(),domainData.nodename.size(),SQLITE_STATIC);
- sqlite3_bind_int(queryFinal,4, domainData.early);
- sqlite3_bind_int(queryFinal,5, domainData.complete);
- sqlite3_bind_int(queryFinal,6, domainData.state);
- sqlite3_bind_int(queryFinal,7, 0);
-
- if((eCode=sqlite3_step(queryFinal))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterDomainDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(queryFinal))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterDomainDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- domainID=sqlite3_last_insert_rowid(mDatabase);
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterDomainDB entered new domain with name"), DLT_STRING(domainData.name.c_str()),
- DLT_STRING("busname:"),DLT_STRING(domainData.busname.c_str()),
- DLT_STRING("nodename:"),DLT_STRING(domainData.nodename.c_str()),
- DLT_STRING("early:"), DLT_BOOL(domainData.early),
- DLT_STRING("complete:"),DLT_BOOL(domainData.complete),
- DLT_STRING("state:"),DLT_INT(domainData.state),
- DLT_STRING("assigned ID:"),DLT_INT16(domainID));
-
- am_Domain_s domain=domainData;
- domain.domainID=domainID;
- if(mDatabaseObserver) mDatabaseObserver->newDomain(domain);
-
- return E_OK;
+ assert(domainData.domainID==0);
+ assert(!domainData.name.empty());
+ assert(!domainData.busname.empty());
+ assert(domainData.state>=DS_CONTROLLED && domainData.state<=DS_INDEPENDENT_RUNDOWN);
+
+ //first check for a reserved domain
+ sqlite3_stmt* query = NULL, *queryFinal;
+ int eCode = 0;
+ std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, domainData.name.c_str(), domainData.name.size(), SQLITE_STATIC);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ command = "UPDATE " + std::string(DOMAIN_TABLE) + " SET name=?, busname=?, nodename=?, early=?, complete=?, state=?, reserved=? WHERE domainID=" + i2s(sqlite3_column_int(query, 0));
+ }
+ else if (eCode == SQLITE_DONE)
+ {
+
+ command = "INSERT INTO " + std::string(DOMAIN_TABLE) + " (name, busname, nodename, early, complete, state, reserved) VALUES (?,?,?,?,?,?,?)";
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterDomainDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterDomainDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryFinal, NULL);
+ sqlite3_bind_text(queryFinal, 1, domainData.name.c_str(), domainData.name.size(), SQLITE_STATIC);
+ sqlite3_bind_text(queryFinal, 2, domainData.busname.c_str(), domainData.busname.size(), SQLITE_STATIC);
+ sqlite3_bind_text(queryFinal, 3, domainData.nodename.c_str(), domainData.nodename.size(), SQLITE_STATIC);
+ sqlite3_bind_int(queryFinal, 4, domainData.early);
+ sqlite3_bind_int(queryFinal, 5, domainData.complete);
+ sqlite3_bind_int(queryFinal, 6, domainData.state);
+ sqlite3_bind_int(queryFinal, 7, 0);
+
+ if ((eCode = sqlite3_step(queryFinal)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterDomainDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(queryFinal)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterDomainDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ domainID = sqlite3_last_insert_rowid(mDatabase);
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterDomainDB entered new domain with name"), DLT_STRING(domainData.name.c_str()), DLT_STRING("busname:"), DLT_STRING(domainData.busname.c_str()), DLT_STRING("nodename:"), DLT_STRING(domainData.nodename.c_str()), DLT_STRING("early:"), DLT_BOOL(domainData.early), DLT_STRING("complete:"), DLT_BOOL(domainData.complete), DLT_STRING("state:"), DLT_INT(domainData.state), DLT_STRING("assigned ID:"), DLT_INT16(domainID));
+
+ am_Domain_s domain = domainData;
+ domain.domainID = domainID;
+ if (mDatabaseObserver) mDatabaseObserver->newDomain(domain);
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
{
- assert(mainConnectionData.connectionID==0);
- assert(mainConnectionData.connectionState>=CS_CONNECTING && mainConnectionData.connectionState<=CS_SUSPENDED);
- assert(mainConnectionData.route.sinkID!=0);
- assert(mainConnectionData.route.sourceID!=0);
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command= "INSERT INTO " + std::string(MAINCONNECTION_TABLE) + "(sourceID, sinkID, connectionState, delay) VALUES (?,?,?,-1)";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, mainConnectionData.route.sourceID);
- sqlite3_bind_int(query,2, mainConnectionData.route.sinkID);
- sqlite3_bind_int(query,3, mainConnectionData.connectionState);
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- connectionID=sqlite3_last_insert_rowid(mDatabase);
-
- //now check the connectionTable for all connections in the route. IF a particular route is not found, we return with error
- std::vector<uint16_t> listOfConnections;
- int16_t delay=0;
- command="SELECT connectionID, delay FROM "+std::string(CONNECTION_TABLE)+(" WHERE sourceID=? AND sinkID=? AND connectionFormat=?");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_RoutingElement_s>::const_iterator elementIterator=mainConnectionData.route.route.begin();
- for (;elementIterator<mainConnectionData.route.route.end();++elementIterator)
- {
- sqlite3_bind_int(query,1, elementIterator->sourceID);
- sqlite3_bind_int(query,2, elementIterator->sinkID);
- sqlite3_bind_int(query,3, elementIterator->connectionFormat);
-
- if((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- listOfConnections.push_back(sqlite3_column_int(query,0));
- int16_t temp_delay=sqlite3_column_int(query,1);
- if (temp_delay!=-1 && delay!=-1) delay+=temp_delay;
- else delay=-1;
- }
- else
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB did not find route for MainConnection:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //now we create a table with references to the connections;
- command="CREATE TABLE MainConnectionRoute" + i2s(connectionID) + std::string("(connectionID INTEGER)");
- assert(this->sqQuery(command));
-
- command= "INSERT INTO MainConnectionRoute" + i2s(connectionID) + "(connectionID) VALUES (?)";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<uint16_t>::iterator listConnectionIterator=listOfConnections.begin();
- for(;listConnectionIterator<listOfConnections.end();++listConnectionIterator)
- {
- sqlite3_bind_int(query,1, *listConnectionIterator);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID"), DLT_INT(mainConnectionData.route.sourceID),
- DLT_STRING("sinkID:"),DLT_INT16(mainConnectionData.route.sinkID),
- DLT_STRING("delay:"),DLT_INT16(delay),
- DLT_STRING("assigned ID:"),DLT_INT16(connectionID));
-
- if (mDatabaseObserver)
- {
- mDatabaseObserver->numberOfMainConnectionsChanged();
- mDatabaseObserver->mainConnectionStateChanged(connectionID,mainConnectionData.connectionState);
- }
-
- //finally, we update the delay value for the maintable
- if (delay==0) delay=-1;
- return changeDelayMainConnection(delay,connectionID);
+ assert(mainConnectionData.connectionID==0);
+ assert(mainConnectionData.connectionState>=CS_CONNECTING && mainConnectionData.connectionState<=CS_SUSPENDED);
+ assert(mainConnectionData.route.sinkID!=0);
+ assert(mainConnectionData.route.sourceID!=0);
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command = "INSERT INTO " + std::string(MAINCONNECTION_TABLE) + "(sourceID, sinkID, connectionState, delay) VALUES (?,?,?,-1)";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, mainConnectionData.route.sourceID);
+ sqlite3_bind_int(query, 2, mainConnectionData.route.sinkID);
+ sqlite3_bind_int(query, 3, mainConnectionData.connectionState);
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ connectionID = sqlite3_last_insert_rowid(mDatabase);
+
+ //now check the connectionTable for all connections in the route. IF a particular route is not found, we return with error
+ std::vector<uint16_t> listOfConnections;
+ int16_t delay = 0;
+ command = "SELECT connectionID, delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE sourceID=? AND sinkID=? AND connectionFormat=?");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_RoutingElement_s>::const_iterator elementIterator = mainConnectionData.route.route.begin();
+ for (; elementIterator < mainConnectionData.route.route.end(); ++elementIterator)
+ {
+ sqlite3_bind_int(query, 1, elementIterator->sourceID);
+ sqlite3_bind_int(query, 2, elementIterator->sinkID);
+ sqlite3_bind_int(query, 3, elementIterator->connectionFormat);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ listOfConnections.push_back(sqlite3_column_int(query, 0));
+ int16_t temp_delay = sqlite3_column_int(query, 1);
+ if (temp_delay != -1 && delay != -1)
+ delay += temp_delay;
+ else
+ delay = -1;
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB did not find route for MainConnection:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //now we create a table with references to the connections;
+ command = "CREATE TABLE MainConnectionRoute" + i2s(connectionID) + std::string("(connectionID INTEGER)");
+ assert(this->sqQuery(command));
+
+ command = "INSERT INTO MainConnectionRoute" + i2s(connectionID) + "(connectionID) VALUES (?)";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<uint16_t>::iterator listConnectionIterator = listOfConnections.begin();
+ for (; listConnectionIterator < listOfConnections.end(); ++listConnectionIterator)
+ {
+ sqlite3_bind_int(query, 1, *listConnectionIterator);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID"), DLT_INT(mainConnectionData.route.sourceID), DLT_STRING("sinkID:"), DLT_INT16(mainConnectionData.route.sinkID), DLT_STRING("delay:"), DLT_INT16(delay), DLT_STRING("assigned ID:"), DLT_INT16(connectionID));
+
+ if (mDatabaseObserver)
+ {
+ mDatabaseObserver->numberOfMainConnectionsChanged();
+ mDatabaseObserver->mainConnectionStateChanged(connectionID, mainConnectionData.connectionState);
+ }
+
+ //finally, we update the delay value for the maintable
+ if (delay == 0) delay = -1;
+ return changeDelayMainConnection(delay, connectionID);
}
-
-
am_Error_e DatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- assert(sinkData.sinkID<DYNAMIC_ID_BOUNDARY);
- assert(sinkData.domainID!=0);
- assert(!sinkData.name.empty());
- assert(sinkData.sinkClassID!=0); // \todo: need to check if class exists?
- assert(!sinkData.listConnectionFormats.empty());
- assert(sinkData.muteState>=MS_MUTED && sinkData.muteState<=MS_UNMUTED);
-
- sqlite3_stmt *query=NULL, *queryFinal=NULL;
- int eCode=0;
- std::string command="SELECT sinkID FROM "+ std::string(SINK_TABLE) + " WHERE name=? AND reserved=1";
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1, sinkData.name.c_str(),sinkData.name.size(),SQLITE_STATIC);
-
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- command= "UPDATE " + std::string(SINK_TABLE) + " SET name=?, domainID=?, sinkClassID=?, volume=?, visible=?, availability=?, availabilityReason=?, muteState=?, mainVolume=?, reserved=? WHERE sinkID=" +i2s(sqlite3_column_int(query,0));
- }
- else if (eCode==SQLITE_DONE)
- {
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (sinkData.sinkID==0 && !mFirstStaticSink && !existSinkName(sinkData.name))
- {
- command= "INSERT INTO " + std::string(SINK_TABLE) + "(name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, reserved) VALUES (?,?,?,?,?,?,?,?,?,?)";
- }
- else
- {
- //check if the ID already exists
- if(existSinkNameOrID(sinkData.sinkID,sinkData.name))
- {
- sqlite3_finalize(query);
- return E_ALREADY_EXISTS;
- }
- command= "INSERT INTO " + std::string(SINK_TABLE) + "(name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, reserved, sinkID) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
- }
- }
- else
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryFinal,NULL);
- sqlite3_bind_text(queryFinal,1, sinkData.name.c_str(),sinkData.name.size(),SQLITE_STATIC);
- sqlite3_bind_int(queryFinal,2, sinkData.domainID);
- sqlite3_bind_int(queryFinal,3, sinkData.sinkClassID);
- sqlite3_bind_int(queryFinal,4, sinkData.volume);
- sqlite3_bind_int(queryFinal,5, sinkData.visible);
- sqlite3_bind_int(queryFinal,6, sinkData.available.availability);
- sqlite3_bind_int(queryFinal,7, sinkData.available.availabilityReason);
- sqlite3_bind_int(queryFinal,8, sinkData.muteState);
- sqlite3_bind_int(queryFinal,9, sinkData.mainVolume);
- sqlite3_bind_int(queryFinal,10, 0);
-
- //if the ID is not created, we add it to the query
- if(sinkData.sinkID!=0)
- {
- sqlite3_bind_int(queryFinal,11, sinkData.sinkID);
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if(mFirstStaticSink)
- {
- sqlite3_bind_int(queryFinal,11, DYNAMIC_ID_BOUNDARY);
- mFirstStaticSink=false;
- }
-
- if((eCode=sqlite3_step(queryFinal))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(queryFinal);
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(queryFinal))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //now read back the sinkID
- command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,sinkData.name.c_str(),sinkData.name.size(),SQLITE_STATIC);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- sinkID=sqlite3_column_int(query,0);
- }
- else
- {
- sinkID=0;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
- sqlite3_finalize(query);
-
- //now we need to create the additional tables:
- command="CREATE TABLE SinkConnectionFormat" + i2s(sinkID) + std::string("(soundFormat INTEGER)");
- assert(this->sqQuery(command));
- command="CREATE TABLE SinkMainSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
- assert(this->sqQuery(command));
- command="CREATE TABLE SinkSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
- assert(this->sqQuery(command));
-
- //fill ConnectionFormats
- command="INSERT INTO SinkConnectionFormat" + i2s(sinkID) + std::string("(soundFormat) VALUES (?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator=sinkData.listConnectionFormats.begin();
- for(;connectionFormatIterator<sinkData.listConnectionFormats.end();++connectionFormatIterator)
- {
- sqlite3_bind_int(query,1, *connectionFormatIterator);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- //Fill MainSinkSoundProperties
- command="INSERT INTO SinkMainSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator=sinkData.listMainSoundProperties.begin();
- for(;mainSoundPropertyIterator<sinkData.listMainSoundProperties.end();++mainSoundPropertyIterator)
- {
- sqlite3_bind_int(query,1, mainSoundPropertyIterator->type);
- sqlite3_bind_int(query,2, mainSoundPropertyIterator->value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- //Fill SinkSoundProperties
- command="INSERT INTO SinkSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator=sinkData.listSoundProperties.begin();
- for(;SoundPropertyIterator<sinkData.listSoundProperties.end();++SoundPropertyIterator)
- {
- sqlite3_bind_int(query,1, SoundPropertyIterator->type);
- sqlite3_bind_int(query,2, SoundPropertyIterator->value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSinkDB entered new sink with name"), DLT_STRING(sinkData.name.c_str()),
- DLT_STRING("domainID:"),DLT_INT(sinkData.domainID),
- DLT_STRING("classID:"),DLT_INT(sinkData.sinkClassID),
- DLT_STRING("volume:"),DLT_INT(sinkData.volume),
- DLT_STRING("visible:"),DLT_BOOL(sinkData.visible),
- DLT_STRING("available.availability:"),DLT_INT(sinkData.available.availability),
- DLT_STRING("available.availabilityReason:"),DLT_INT(sinkData.available.availabilityReason),
- DLT_STRING("muteState:"),DLT_INT(sinkData.muteState),
- DLT_STRING("mainVolume:"),DLT_INT(sinkData.mainVolume),
- DLT_STRING("assigned ID:"),DLT_INT16(sinkID));
-
- am_Sink_s sink=sinkData;
- sink.sinkID=sinkID;
- if (mDatabaseObserver!=NULL) mDatabaseObserver->newSink(sink);
-
- return E_OK;
+ assert(sinkData.sinkID<DYNAMIC_ID_BOUNDARY);
+ assert(sinkData.domainID!=0);
+ assert(!sinkData.name.empty());
+ assert(sinkData.sinkClassID!=0);
+ // \todo: need to check if class exists?
+ assert(!sinkData.listConnectionFormats.empty());
+ assert(sinkData.muteState>=MS_MUTED && sinkData.muteState<=MS_UNMUTED);
+
+ sqlite3_stmt *query = NULL, *queryFinal = NULL;
+ int eCode = 0;
+ std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=? AND reserved=1";
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ command = "UPDATE " + std::string(SINK_TABLE) + " SET name=?, domainID=?, sinkClassID=?, volume=?, visible=?, availability=?, availabilityReason=?, muteState=?, mainVolume=?, reserved=? WHERE sinkID=" + i2s(sqlite3_column_int(query, 0));
+ }
+ else if (eCode == SQLITE_DONE)
+ {
+ //if sinkID is zero and the first Static Sink was already entered, the ID is created
+ if (sinkData.sinkID == 0 && !mFirstStaticSink && !existSinkName(sinkData.name))
+ {
+ command = "INSERT INTO " + std::string(SINK_TABLE) + "(name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, reserved) VALUES (?,?,?,?,?,?,?,?,?,?)";
+ }
+ else
+ {
+ //check if the ID already exists
+ if (existSinkNameOrID(sinkData.sinkID, sinkData.name))
+ {
+ sqlite3_finalize(query);
+ return E_ALREADY_EXISTS;
+ }
+ command = "INSERT INTO " + std::string(SINK_TABLE) + "(name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, reserved, sinkID) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+ }
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryFinal, NULL);
+ sqlite3_bind_text(queryFinal, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC);
+ sqlite3_bind_int(queryFinal, 2, sinkData.domainID);
+ sqlite3_bind_int(queryFinal, 3, sinkData.sinkClassID);
+ sqlite3_bind_int(queryFinal, 4, sinkData.volume);
+ sqlite3_bind_int(queryFinal, 5, sinkData.visible);
+ sqlite3_bind_int(queryFinal, 6, sinkData.available.availability);
+ sqlite3_bind_int(queryFinal, 7, sinkData.available.availabilityReason);
+ sqlite3_bind_int(queryFinal, 8, sinkData.muteState);
+ sqlite3_bind_int(queryFinal, 9, sinkData.mainVolume);
+ sqlite3_bind_int(queryFinal, 10, 0);
+
+ //if the ID is not created, we add it to the query
+ if (sinkData.sinkID != 0)
+ {
+ sqlite3_bind_int(queryFinal, 11, sinkData.sinkID);
+ }
+
+ //if the first static sink is entered, we need to set it onto the boundary
+ else if (mFirstStaticSink)
+ {
+ sqlite3_bind_int(queryFinal, 11, DYNAMIC_ID_BOUNDARY);
+ mFirstStaticSink = false;
+ }
+
+ if ((eCode = sqlite3_step(queryFinal)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(queryFinal);
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(queryFinal)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //now read back the sinkID
+ command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sinkID = sqlite3_column_int(query, 0);
+ }
+ else
+ {
+ sinkID = 0;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_finalize(query);
+
+ //now we need to create the additional tables:
+ command = "CREATE TABLE SinkConnectionFormat" + i2s(sinkID) + std::string("(soundFormat INTEGER)");
+ assert(this->sqQuery(command));
+ command = "CREATE TABLE SinkMainSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
+ assert(this->sqQuery(command));
+ command = "CREATE TABLE SinkSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
+ assert(this->sqQuery(command));
+
+ //fill ConnectionFormats
+ command = "INSERT INTO SinkConnectionFormat" + i2s(sinkID) + std::string("(soundFormat) VALUES (?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator = sinkData.listConnectionFormats.begin();
+ for (; connectionFormatIterator < sinkData.listConnectionFormats.end(); ++connectionFormatIterator)
+ {
+ sqlite3_bind_int(query, 1, *connectionFormatIterator);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ //Fill MainSinkSoundProperties
+ command = "INSERT INTO SinkMainSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator = sinkData.listMainSoundProperties.begin();
+ for (; mainSoundPropertyIterator < sinkData.listMainSoundProperties.end(); ++mainSoundPropertyIterator)
+ {
+ sqlite3_bind_int(query, 1, mainSoundPropertyIterator->type);
+ sqlite3_bind_int(query, 2, mainSoundPropertyIterator->value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ //Fill SinkSoundProperties
+ command = "INSERT INTO SinkSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator = sinkData.listSoundProperties.begin();
+ for (; SoundPropertyIterator < sinkData.listSoundProperties.end(); ++SoundPropertyIterator)
+ {
+ sqlite3_bind_int(query, 1, SoundPropertyIterator->type);
+ sqlite3_bind_int(query, 2, SoundPropertyIterator->value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSinkDB entered new sink with name"), DLT_STRING(sinkData.name.c_str()), DLT_STRING("domainID:"), DLT_INT(sinkData.domainID), DLT_STRING("classID:"), DLT_INT(sinkData.sinkClassID), DLT_STRING("volume:"), DLT_INT(sinkData.volume), DLT_STRING("visible:"), DLT_BOOL(sinkData.visible), DLT_STRING("available.availability:"), DLT_INT(sinkData.available.availability), DLT_STRING("available.availabilityReason:"), DLT_INT(sinkData.available.availabilityReason), DLT_STRING("muteState:"), DLT_INT(sinkData.muteState), DLT_STRING("mainVolume:"), DLT_INT(sinkData.mainVolume), DLT_STRING("assigned ID:"), DLT_INT16(sinkID));
+
+ am_Sink_s sink = sinkData;
+ sink.sinkID = sinkID;
+ if (mDatabaseObserver != NULL) mDatabaseObserver->newSink(sink);
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- //todo: implement crossfader
- (void)crossfaderData;
- (void)crossfaderID;
- return E_UNKNOWN;
+ //todo: implement crossfader
+ (void) crossfaderData;
+ (void) crossfaderID;
+ return E_UNKNOWN;
}
-
-
am_Error_e DatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- assert(gatewayData.gatewayID<DYNAMIC_ID_BOUNDARY);
- assert(gatewayData.sinkID!=0);
- assert(gatewayData.sourceID!=0);
- assert(gatewayData.controlDomainID!=0);
- assert(gatewayData.domainSinkID!=0);
- assert(gatewayData.domainSourceID!=0);
- assert(!gatewayData.name.empty());
- assert(!gatewayData.convertionMatrix.empty());
- assert(!gatewayData.listSinkFormats.empty());
- assert(!gatewayData.listSourceFormats.empty());
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
-
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (gatewayData.gatewayID==0 && !mFirstStaticGateway)
- {
- command= "INSERT INTO " + std::string(GATEWAY_TABLE) + "(name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID) VALUES (?,?,?,?,?,?)";
- }
- else
- {
- //check if the ID already exists
- if (existGateway(gatewayData.gatewayID)) return E_ALREADY_EXISTS;
- command= "INSERT INTO " + std::string(GATEWAY_TABLE) + "(name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID) VALUES (?,?,?,?,?,?,?)";
- }
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1, gatewayData.name.c_str(),gatewayData.name.size(),SQLITE_STATIC);
- sqlite3_bind_int(query,2, gatewayData.sinkID);
- sqlite3_bind_int(query,3, gatewayData.sourceID);
- sqlite3_bind_int(query,4, gatewayData.domainSinkID);
- sqlite3_bind_int(query,5, gatewayData.domainSourceID);
- sqlite3_bind_int(query,6, gatewayData.controlDomainID);
-
- //if the ID is not created, we add it to the query
- if(gatewayData.gatewayID!=0)
- {
- sqlite3_bind_int(query,7, gatewayData.gatewayID);
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if(mFirstStaticGateway)
- {
- sqlite3_bind_int(query,7, DYNAMIC_ID_BOUNDARY);
- mFirstStaticGateway=false;
- }
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterGatewayDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterGatewayDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- gatewayID=sqlite3_last_insert_rowid(mDatabase);
-
- //now the convertion matrix todo: change the map implementation sometimes to blob in sqlite
- mListConnectionFormat.insert(std::make_pair(gatewayID,gatewayData.convertionMatrix));
-
- command="CREATE TABLE GatewaySourceFormat" + i2s(gatewayID) + std::string("(soundFormat INTEGER)");
- assert(this->sqQuery(command));
- command="CREATE TABLE GatewaySinkFormat" + i2s(gatewayID) + std::string("(soundFormat INTEGER)");
- assert(this->sqQuery(command));
-
- //fill ConnectionFormats
- command="INSERT INTO GatewaySourceFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator=gatewayData.listSourceFormats.begin();
- for(;connectionFormatIterator<gatewayData.listSourceFormats.end();++connectionFormatIterator)
- {
- sqlite3_bind_int(query,1, *connectionFormatIterator);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterGatewayDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- command="INSERT INTO GatewaySinkFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- connectionFormatIterator=gatewayData.listSinkFormats.begin();
- for(;connectionFormatIterator<gatewayData.listSinkFormats.end();++connectionFormatIterator)
- {
- sqlite3_bind_int(query,1, *connectionFormatIterator);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterGatewayDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterGatewayDB entered new gateway with name"), DLT_STRING(gatewayData.name.c_str()),
- DLT_STRING("sourceID:"),DLT_INT(gatewayData.sourceID),
- DLT_STRING("sinkID:"),DLT_INT(gatewayData.sinkID),
- DLT_STRING("domainSinkID:"),DLT_INT(gatewayData.domainSinkID),
- DLT_STRING("domainSourceID:"),DLT_BOOL(gatewayData.domainSourceID),
- DLT_STRING("controlDomainID:"),DLT_INT(gatewayData.controlDomainID),
- DLT_STRING("assigned ID:"),DLT_INT16(gatewayID));
-
- am_Gateway_s gateway=gatewayData;
- gateway.gatewayID=gatewayID;
- if(mDatabaseObserver) mDatabaseObserver->newGateway(gateway);
- return E_OK;
+ assert(gatewayData.gatewayID<DYNAMIC_ID_BOUNDARY);
+ assert(gatewayData.sinkID!=0);
+ assert(gatewayData.sourceID!=0);
+ assert(gatewayData.controlDomainID!=0);
+ assert(gatewayData.domainSinkID!=0);
+ assert(gatewayData.domainSourceID!=0);
+ assert(!gatewayData.name.empty());
+ assert(!gatewayData.convertionMatrix.empty());
+ assert(!gatewayData.listSinkFormats.empty());
+ assert(!gatewayData.listSourceFormats.empty());
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+
+ //if sinkID is zero and the first Static Sink was already entered, the ID is created
+ if (gatewayData.gatewayID == 0 && !mFirstStaticGateway)
+ {
+ command = "INSERT INTO " + std::string(GATEWAY_TABLE) + "(name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, inUse) VALUES (?,?,?,?,?,?,0)";
+ }
+ else
+ {
+ //check if the ID already exists
+ if (existGateway(gatewayData.gatewayID)) return E_ALREADY_EXISTS;
+ command = "INSERT INTO " + std::string(GATEWAY_TABLE) + "(name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID, inUse) VALUES (?,?,?,?,?,?,?,0)";
+ }
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, gatewayData.name.c_str(), gatewayData.name.size(), SQLITE_STATIC);
+ sqlite3_bind_int(query, 2, gatewayData.sinkID);
+ sqlite3_bind_int(query, 3, gatewayData.sourceID);
+ sqlite3_bind_int(query, 4, gatewayData.domainSinkID);
+ sqlite3_bind_int(query, 5, gatewayData.domainSourceID);
+ sqlite3_bind_int(query, 6, gatewayData.controlDomainID);
+
+ //if the ID is not created, we add it to the query
+ if (gatewayData.gatewayID != 0)
+ {
+ sqlite3_bind_int(query, 7, gatewayData.gatewayID);
+ }
+
+ //if the first static sink is entered, we need to set it onto the boundary
+ else if (mFirstStaticGateway)
+ {
+ sqlite3_bind_int(query, 7, DYNAMIC_ID_BOUNDARY);
+ mFirstStaticGateway = false;
+ }
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterGatewayDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterGatewayDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ gatewayID = sqlite3_last_insert_rowid(mDatabase);
+
+ //now the convertion matrix todo: change the map implementation sometimes to blob in sqlite
+ mListConnectionFormat.insert(std::make_pair(gatewayID, gatewayData.convertionMatrix));
+
+ command = "CREATE TABLE GatewaySourceFormat" + i2s(gatewayID) + std::string("(soundFormat INTEGER)");
+ assert(this->sqQuery(command));
+ command = "CREATE TABLE GatewaySinkFormat" + i2s(gatewayID) + std::string("(soundFormat INTEGER)");
+ assert(this->sqQuery(command));
+
+ //fill ConnectionFormats
+ command = "INSERT INTO GatewaySourceFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator = gatewayData.listSourceFormats.begin();
+ for (; connectionFormatIterator < gatewayData.listSourceFormats.end(); ++connectionFormatIterator)
+ {
+ sqlite3_bind_int(query, 1, *connectionFormatIterator);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterGatewayDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ command = "INSERT INTO GatewaySinkFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ connectionFormatIterator = gatewayData.listSinkFormats.begin();
+ for (; connectionFormatIterator < gatewayData.listSinkFormats.end(); ++connectionFormatIterator)
+ {
+ sqlite3_bind_int(query, 1, *connectionFormatIterator);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterGatewayDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterGatewayDB entered new gateway with name"), DLT_STRING(gatewayData.name.c_str()), DLT_STRING("sourceID:"), DLT_INT(gatewayData.sourceID), DLT_STRING("sinkID:"), DLT_INT(gatewayData.sinkID), DLT_STRING("domainSinkID:"), DLT_INT(gatewayData.domainSinkID), DLT_STRING("domainSourceID:"), DLT_BOOL(gatewayData.domainSourceID), DLT_STRING("controlDomainID:"), DLT_INT(gatewayData.controlDomainID), DLT_STRING("assigned ID:"), DLT_INT16(gatewayID));
+
+ am_Gateway_s gateway = gatewayData;
+ gateway.gatewayID = gatewayID;
+ if (mDatabaseObserver) mDatabaseObserver->newGateway(gateway);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- assert(sourceData.sourceID<DYNAMIC_ID_BOUNDARY);
- assert(sourceData.domainID!=0);
- assert(!sourceData.name.empty());
- assert(sourceData.sourceClassID!=0); // \todo: need to check if class exists?
- assert(!sourceData.listConnectionFormats.empty());
- assert(sourceData.sourceState>=SS_ON && sourceData.sourceState<=SS_PAUSED);
-
- sqlite3_stmt* query=NULL, *queryFinal=NULL;;
- int eCode=0;
- std::string command="SELECT sourceID FROM "+ std::string(SOURCE_TABLE) + " WHERE name=? AND reserved=1";
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1, sourceData.name.c_str(),sourceData.name.size(),SQLITE_STATIC);
-
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- command= "UPDATE " + std::string(SOURCE_TABLE) + " SET name=?, domainID=?, sourceClassID=?, sourceState=?, volume=?, visible=?, availability=?, availabilityReason=?, interruptState=?, reserved=? WHERE sourceID=" +i2s(sqlite3_column_int(query,0));
- }
- else if (eCode==SQLITE_DONE)
- {
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (sourceData.sourceID==0 && !mFirstStaticSource && !existSourceName(sourceData.name))
- {
- command= "INSERT INTO " + std::string(SOURCE_TABLE) + "(name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, reserved) VALUES (?,?,?,?,?,?,?,?,?,?)";
- }
- else
- {
- //check if the ID already exists
- if (existSourceNameOrID(sourceData.sourceID,sourceData.name))
- {
- sqlite3_finalize(query);
- return E_ALREADY_EXISTS;
- }
- command= "INSERT INTO " + std::string(SOURCE_TABLE) + "(name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, reserved, sourceID) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
- }
- }
- else
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryFinal,NULL);
- sqlite3_bind_text(queryFinal,1, sourceData.name.c_str(),sourceData.name.size(),SQLITE_STATIC);
- sqlite3_bind_int(queryFinal,2, sourceData.domainID);
- sqlite3_bind_int(queryFinal,3, sourceData.sourceClassID);
- sqlite3_bind_int(queryFinal,4, sourceData.sourceState);
- sqlite3_bind_int(queryFinal,5, sourceData.volume);
- sqlite3_bind_int(queryFinal,6, sourceData.visible);
- sqlite3_bind_int(queryFinal,7, sourceData.available.availability);
- sqlite3_bind_int(queryFinal,8, sourceData.available.availabilityReason);
- sqlite3_bind_int(queryFinal,9, sourceData.interruptState);
- sqlite3_bind_int(queryFinal,10, 0);
-
- //if the ID is not created, we add it to the query
- if(sourceData.sourceID!=0)
- {
- sqlite3_bind_int(queryFinal,11, sourceData.sourceID);
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if(mFirstStaticSource)
- {
- sqlite3_bind_int(queryFinal,11, DYNAMIC_ID_BOUNDARY);
- mFirstStaticSource=false;
- }
-
- if((eCode=sqlite3_step(queryFinal))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(queryFinal);
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(queryFinal))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Finalize error code:"),DLT_INT(eCode));
- sqlite3_finalize(queryFinal);
- return E_DATABASE_ERROR;
- }
-
- //now read back the sinkID
- command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,sourceData.name.c_str(),sourceData.name.size(),SQLITE_STATIC);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- sourceID=sqlite3_column_int(query,0);
- }
- else
- {
- sourceID=0;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
- sqlite3_finalize(query);
-
-
- //now we need to create the additional tables:
- command="CREATE TABLE SourceConnectionFormat" + i2s(sourceID) + std::string("(soundFormat INTEGER)");
- assert(this->sqQuery(command));
- command="CREATE TABLE SourceMainSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
- assert(this->sqQuery(command));
- command="CREATE TABLE SourceSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
- assert(this->sqQuery(command));
-
- //fill ConnectionFormats
- command="INSERT INTO SourceConnectionFormat" + i2s(sourceID) + std::string("(soundFormat) VALUES (?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator=sourceData.listConnectionFormats.begin();
- for(;connectionFormatIterator<sourceData.listConnectionFormats.end();++connectionFormatIterator)
- {
- sqlite3_bind_int(query,1, *connectionFormatIterator);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- //Fill MainSinkSoundProperties
- command="INSERT INTO SourceMainSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator=sourceData.listMainSoundProperties.begin();
- for(;mainSoundPropertyIterator<sourceData.listMainSoundProperties.end();++mainSoundPropertyIterator)
- {
- sqlite3_bind_int(query,1, mainSoundPropertyIterator->type);
- sqlite3_bind_int(query,2, mainSoundPropertyIterator->value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- //Fill SinkSoundProperties
- command="INSERT INTO SourceSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator=sourceData.listSoundProperties.begin();
- for(;SoundPropertyIterator<sourceData.listSoundProperties.end();++SoundPropertyIterator)
- {
- sqlite3_bind_int(query,1, SoundPropertyIterator->type);
- sqlite3_bind_int(query,2, SoundPropertyIterator->value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"),DLT_INT(eCode));
- sqlite3_finalize(query);
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSinkDB entered new source with name"), DLT_STRING(sourceData.name.c_str()),
- DLT_STRING("domainID:"),DLT_INT(sourceData.domainID),
- DLT_STRING("classID:"),DLT_INT(sourceData.sourceClassID),
- DLT_STRING("volume:"),DLT_INT(sourceData.volume),
- DLT_STRING("visible:"),DLT_BOOL(sourceData.visible),
- DLT_STRING("available.availability:"),DLT_INT(sourceData.available.availability),
- DLT_STRING("available.availabilityReason:"),DLT_INT(sourceData.available.availabilityReason),
- DLT_STRING("interruptState:"),DLT_INT(sourceData.interruptState),
- DLT_STRING("assigned ID:"),DLT_INT16(sourceID));
-
- am_Source_s source=sourceData;
- source.sourceID=sourceID;
- if(mDatabaseObserver) mDatabaseObserver->newSource(source);
- return E_OK;
+ assert(sourceData.sourceID<DYNAMIC_ID_BOUNDARY);
+ assert(sourceData.domainID!=0);
+ assert(!sourceData.name.empty());
+ assert(sourceData.sourceClassID!=0);
+ // \todo: need to check if class exists?
+ assert(!sourceData.listConnectionFormats.empty());
+ assert(sourceData.sourceState>=SS_ON && sourceData.sourceState<=SS_PAUSED);
+
+ sqlite3_stmt* query = NULL, *queryFinal = NULL;
+ ;
+ int eCode = 0;
+ std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=? AND reserved=1";
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ command = "UPDATE " + std::string(SOURCE_TABLE) + " SET name=?, domainID=?, sourceClassID=?, sourceState=?, volume=?, visible=?, availability=?, availabilityReason=?, interruptState=?, reserved=? WHERE sourceID=" + i2s(sqlite3_column_int(query, 0));
+ }
+ else if (eCode == SQLITE_DONE)
+ {
+ //if sinkID is zero and the first Static Sink was already entered, the ID is created
+ if (sourceData.sourceID == 0 && !mFirstStaticSource && !existSourceName(sourceData.name))
+ {
+ command = "INSERT INTO " + std::string(SOURCE_TABLE) + "(name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, reserved) VALUES (?,?,?,?,?,?,?,?,?,?)";
+ }
+ else
+ {
+ //check if the ID already exists
+ if (existSourceNameOrID(sourceData.sourceID, sourceData.name))
+ {
+ sqlite3_finalize(query);
+ return E_ALREADY_EXISTS;
+ }
+ command = "INSERT INTO " + std::string(SOURCE_TABLE) + "(name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, reserved, sourceID) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+ }
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryFinal, NULL);
+ sqlite3_bind_text(queryFinal, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC);
+ sqlite3_bind_int(queryFinal, 2, sourceData.domainID);
+ sqlite3_bind_int(queryFinal, 3, sourceData.sourceClassID);
+ sqlite3_bind_int(queryFinal, 4, sourceData.sourceState);
+ sqlite3_bind_int(queryFinal, 5, sourceData.volume);
+ sqlite3_bind_int(queryFinal, 6, sourceData.visible);
+ sqlite3_bind_int(queryFinal, 7, sourceData.available.availability);
+ sqlite3_bind_int(queryFinal, 8, sourceData.available.availabilityReason);
+ sqlite3_bind_int(queryFinal, 9, sourceData.interruptState);
+ sqlite3_bind_int(queryFinal, 10, 0);
+
+ //if the ID is not created, we add it to the query
+ if (sourceData.sourceID != 0)
+ {
+ sqlite3_bind_int(queryFinal, 11, sourceData.sourceID);
+ }
+
+ //if the first static sink is entered, we need to set it onto the boundary
+ else if (mFirstStaticSource)
+ {
+ sqlite3_bind_int(queryFinal, 11, DYNAMIC_ID_BOUNDARY);
+ mFirstStaticSource = false;
+ }
+
+ if ((eCode = sqlite3_step(queryFinal)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(queryFinal);
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(queryFinal)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ sqlite3_finalize(queryFinal);
+ return E_DATABASE_ERROR;
+ }
+
+ //now read back the sinkID
+ command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sourceID = sqlite3_column_int(query, 0);
+ }
+ else
+ {
+ sourceID = 0;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_finalize(query);
+
+ //now we need to create the additional tables:
+ command = "CREATE TABLE SourceConnectionFormat" + i2s(sourceID) + std::string("(soundFormat INTEGER)");
+ assert(this->sqQuery(command));
+ command = "CREATE TABLE SourceMainSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
+ assert(this->sqQuery(command));
+ command = "CREATE TABLE SourceSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType INTEGER, value INTEGER)");
+ assert(this->sqQuery(command));
+
+ //fill ConnectionFormats
+ command = "INSERT INTO SourceConnectionFormat" + i2s(sourceID) + std::string("(soundFormat) VALUES (?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator = sourceData.listConnectionFormats.begin();
+ for (; connectionFormatIterator < sourceData.listConnectionFormats.end(); ++connectionFormatIterator)
+ {
+ sqlite3_bind_int(query, 1, *connectionFormatIterator);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ //Fill MainSinkSoundProperties
+ command = "INSERT INTO SourceMainSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator = sourceData.listMainSoundProperties.begin();
+ for (; mainSoundPropertyIterator < sourceData.listMainSoundProperties.end(); ++mainSoundPropertyIterator)
+ {
+ sqlite3_bind_int(query, 1, mainSoundPropertyIterator->type);
+ sqlite3_bind_int(query, 2, mainSoundPropertyIterator->value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ //Fill SinkSoundProperties
+ command = "INSERT INTO SourceSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator = sourceData.listSoundProperties.begin();
+ for (; SoundPropertyIterator < sourceData.listSoundProperties.end(); ++SoundPropertyIterator)
+ {
+ sqlite3_bind_int(query, 1, SoundPropertyIterator->type);
+ sqlite3_bind_int(query, 2, SoundPropertyIterator->value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkDB SQLITE Step error code:"), DLT_INT(eCode));
+ sqlite3_finalize(query);
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSinkDB entered new source with name"), DLT_STRING(sourceData.name.c_str()), DLT_STRING("domainID:"), DLT_INT(sourceData.domainID), DLT_STRING("classID:"), DLT_INT(sourceData.sourceClassID), DLT_STRING("volume:"), DLT_INT(sourceData.volume), DLT_STRING("visible:"), DLT_BOOL(sourceData.visible), DLT_STRING("available.availability:"), DLT_INT(sourceData.available.availability), DLT_STRING("available.availabilityReason:"), DLT_INT(sourceData.available.availabilityReason), DLT_STRING("interruptState:"), DLT_INT(sourceData.interruptState), DLT_STRING("assigned ID:"), DLT_INT16(sourceID));
+
+ am_Source_s source = sourceData;
+ source.sourceID = sourceID;
+ if (mDatabaseObserver) mDatabaseObserver->newSource(source);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s & route)
{
- assert(mainconnectionID!=0);
- if(!existMainConnection(mainconnectionID))
- {
- return E_NON_EXISTENT;
- }
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
-
- std::vector<uint16_t> listOfConnections;
- int16_t delay=0;
- command="SELECT connectionID, delay FROM "+std::string(CONNECTION_TABLE)+(" WHERE sourceID=? AND sinkID=? AND connectionFormat=?");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_RoutingElement_s>::const_iterator elementIterator=route.route.begin();
- for (;elementIterator<route.route.end();++elementIterator)
- {
- sqlite3_bind_int(query,1, elementIterator->sourceID);
- sqlite3_bind_int(query,2, elementIterator->sinkID);
- sqlite3_bind_int(query,3, elementIterator->connectionFormat);
-
- if((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- listOfConnections.push_back(sqlite3_column_int(query,0));
- int16_t temp_delay=sqlite3_column_int(query,1);
- if (temp_delay!=-1 && delay!=-1) delay+=temp_delay;
- else delay=-1;
- }
- else
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB did not find route for MainConnection:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //now we delete the data in the table
- command="DELETE from MainConnectionRoute" + i2s(mainconnectionID);
- assert(this->sqQuery(command));
-
- command= "INSERT INTO MainConnectionRoute" + i2s(mainconnectionID) + "(connectionID) VALUES (?)";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<uint16_t>::iterator listConnectionIterator=listOfConnections.begin();
- for(;listConnectionIterator<listOfConnections.end();++listConnectionIterator)
- {
- sqlite3_bind_int(query,1, *listConnectionIterator);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB entered new route:"),DLT_INT(mainconnectionID));
- return E_OK;
+ assert(mainconnectionID!=0);
+ if (!existMainConnection(mainconnectionID))
+ {
+ return E_NON_EXISTENT;
+ }
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+
+ std::vector<uint16_t> listOfConnections;
+ int16_t delay = 0;
+ command = "SELECT connectionID, delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE sourceID=? AND sinkID=? AND connectionFormat=?");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_RoutingElement_s>::const_iterator elementIterator = route.route.begin();
+ for (; elementIterator < route.route.end(); ++elementIterator)
+ {
+ sqlite3_bind_int(query, 1, elementIterator->sourceID);
+ sqlite3_bind_int(query, 2, elementIterator->sinkID);
+ sqlite3_bind_int(query, 3, elementIterator->connectionFormat);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ listOfConnections.push_back(sqlite3_column_int(query, 0));
+ int16_t temp_delay = sqlite3_column_int(query, 1);
+ if (temp_delay != -1 && delay != -1)
+ delay += temp_delay;
+ else
+ delay = -1;
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB did not find route for MainConnection:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //now we delete the data in the table
+ command = "DELETE from MainConnectionRoute" + i2s(mainconnectionID);
+ assert(this->sqQuery(command));
+
+ command = "INSERT INTO MainConnectionRoute" + i2s(mainconnectionID) + "(connectionID) VALUES (?)";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<uint16_t>::iterator listConnectionIterator = listOfConnections.begin();
+ for (; listConnectionIterator < listOfConnections.end(); ++listConnectionIterator)
+ {
+ sqlite3_bind_int(query, 1, *listConnectionIterator);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainConnectionRouteDB entered new route:"), DLT_INT(mainconnectionID));
+ return E_OK;
}
am_Error_e DatabaseHandler::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
{
- assert(mainconnectionID!=0);
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
-
- if (!existMainConnection(mainconnectionID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET connectionState=? WHERE mainConnectionID=" + i2s(mainconnectionID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, connectionState);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionStateDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionStateDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainConnectionStateDB changed mainConnectionState of MainConnection:"),DLT_INT(mainconnectionID),DLT_STRING("to:"),DLT_INT(connectionState));
-
- if (mDatabaseObserver) mDatabaseObserver->mainConnectionStateChanged(mainconnectionID,connectionState);
- return E_OK;
+ assert(mainconnectionID!=0);
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+
+ if (!existMainConnection(mainconnectionID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET connectionState=? WHERE mainConnectionID=" + i2s(mainconnectionID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, connectionState);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionStateDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainConnectionStateDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainConnectionStateDB changed mainConnectionState of MainConnection:"), DLT_INT(mainconnectionID), DLT_STRING("to:"), DLT_INT(connectionState));
+
+ if (mDatabaseObserver) mDatabaseObserver->mainConnectionStateChanged(mainconnectionID, connectionState);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
{
- assert(sinkID!=0);
+ assert(sinkID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSink(sinkID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(SINK_TABLE) + " SET mainVolume=? WHERE sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, mainVolume);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkMainVolumeDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkMainVolumeDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(SINK_TABLE) + " SET mainVolume=? WHERE sinkID=" + i2s(sinkID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, mainVolume);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkMainVolumeDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkMainVolumeDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkMainVolumeDB changed mainVolume of sink:"),DLT_INT(sinkID),DLT_STRING("to:"),DLT_INT(mainVolume));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkMainVolumeDB changed mainVolume of sink:"), DLT_INT(sinkID), DLT_STRING("to:"), DLT_INT(mainVolume));
- if(mDatabaseObserver) mDatabaseObserver->volumeChanged(sinkID,mainVolume);
+ if (mDatabaseObserver) mDatabaseObserver->volumeChanged(sinkID, mainVolume);
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
{
- assert(sinkID!=0);
+ assert(sinkID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSink(sinkID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(SINK_TABLE) + " SET availability=?, availabilityReason=? WHERE sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, availability.availability);
- sqlite3_bind_int(query,2, availability.availabilityReason);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkAvailabilityDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- } assert(sinkID!=0);
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(SINK_TABLE) + " SET availability=?, availabilityReason=? WHERE sinkID=" + i2s(sinkID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, availability.availability);
+ sqlite3_bind_int(query, 2, availability.availabilityReason);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkAvailabilityDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }assert(sinkID!=0);
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkAvailabilityDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkAvailabilityDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkAvailabilityDB changed sinkAvailability of sink:"),DLT_INT(sinkID),DLT_STRING("to:"),DLT_INT(availability.availability), DLT_STRING("Reason:"),DLT_INT(availability.availabilityReason));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkAvailabilityDB changed sinkAvailability of sink:"), DLT_INT(sinkID), DLT_STRING("to:"), DLT_INT(availability.availability), DLT_STRING("Reason:"), DLT_INT(availability.availabilityReason));
- if (mDatabaseObserver && sourceVisible(sinkID)) mDatabaseObserver->sinkAvailabilityChanged(sinkID,availability);
- return E_OK;
+ if (mDatabaseObserver && sourceVisible(sinkID)) mDatabaseObserver->sinkAvailabilityChanged(sinkID, availability);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
{
- assert(domainID!=0);
+ assert(domainID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existDomain(domainID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(DOMAIN_TABLE) + " SET state=? WHERE domainID=" + i2s(domainID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, domainState);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changDomainStateDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (!existDomain(domainID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(DOMAIN_TABLE) + " SET state=? WHERE domainID=" + i2s(domainID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, domainState);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changDomainStateDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changDomainStateDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changDomainStateDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changDomainStateDB changed domainState of domain:"),DLT_INT(domainID),DLT_STRING("to:"),DLT_INT(domainState));
- return E_OK;
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changDomainStateDB changed domainState of domain:"), DLT_INT(domainID), DLT_STRING("to:"), DLT_INT(domainState));
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
{
- assert(sinkID!=0);
+ assert(sinkID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSink(sinkID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(SINK_TABLE) + " SET muteState=? WHERE sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, muteState);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkMuteStateDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- } assert(sinkID!=0);
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(SINK_TABLE) + " SET muteState=? WHERE sinkID=" + i2s(sinkID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, muteState);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkMuteStateDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }assert(sinkID!=0);
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkMuteStateDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkMuteStateDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkMuteStateDB changed sinkMuteState of sink:"),DLT_INT(sinkID),DLT_STRING("to:"),DLT_INT(muteState));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkMuteStateDB changed sinkMuteState of sink:"), DLT_INT(sinkID), DLT_STRING("to:"), DLT_INT(muteState));
- if(mDatabaseObserver) mDatabaseObserver->sinkMuteStateChanged(sinkID,muteState);
+ if (mDatabaseObserver) mDatabaseObserver->sinkMuteStateChanged(sinkID, muteState);
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
- //todo: add checks if soundproperty exists!
- assert(sinkID!=0);
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
-
- if (!existSink(sinkID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE SinkMainSoundProperty" + i2s(sinkID)+ " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, soundProperty.value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainSinkSoundPropertyDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- } assert(sinkID!=0);
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainSinkSoundPropertyDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainSinkSoundPropertyDB changed MainSinkSoundProperty of sink:"),DLT_INT(sinkID),DLT_STRING("type:"),DLT_INT(soundProperty.type),DLT_STRING("to:"),DLT_INT(soundProperty.value));
- if (mDatabaseObserver) mDatabaseObserver->mainSinkSoundPropertyChanged(sinkID,soundProperty);
- return E_OK;
+ //todo: add checks if soundproperty exists!
+ assert(sinkID!=0);
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE SinkMainSoundProperty" + i2s(sinkID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, soundProperty.value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainSinkSoundPropertyDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }assert(sinkID!=0);
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainSinkSoundPropertyDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainSinkSoundPropertyDB changed MainSinkSoundProperty of sink:"), DLT_INT(sinkID), DLT_STRING("type:"), DLT_INT(soundProperty.type), DLT_STRING("to:"), DLT_INT(soundProperty.value));
+ if (mDatabaseObserver) mDatabaseObserver->mainSinkSoundPropertyChanged(sinkID, soundProperty);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
- //todo: add checks if soundproperty exists!
- assert(sourceID!=0);
+ //todo: add checks if soundproperty exists!
+ assert(sourceID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSource(sourceID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE SourceMainSoundProperty" + i2s(sourceID)+ " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, soundProperty.value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainSourceSoundPropertyDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (!existSource(sourceID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE SourceMainSoundProperty" + i2s(sourceID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, soundProperty.value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainSourceSoundPropertyDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainSourceSoundPropertyDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeMainSourceSoundPropertyDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainSourceSoundPropertyDB changed MainSinkSoundProperty of source:"),DLT_INT(sourceID),DLT_STRING("type:"),DLT_INT(soundProperty.type),DLT_STRING("to:"),DLT_INT(soundProperty.value));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainSourceSoundPropertyDB changed MainSinkSoundProperty of source:"), DLT_INT(sourceID), DLT_STRING("type:"), DLT_INT(soundProperty.type), DLT_STRING("to:"), DLT_INT(soundProperty.value));
- if(mDatabaseObserver) mDatabaseObserver->mainSourceSoundPropertyChanged(sourceID,soundProperty);
- return E_OK;
+ if (mDatabaseObserver) mDatabaseObserver->mainSourceSoundPropertyChanged(sourceID, soundProperty);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
{
- assert(sourceID!=0);
+ assert(sourceID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSource(sourceID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(SOURCE_TABLE) + " SET availability=?, availabilityReason=? WHERE sourceID=" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, availability.availability);
- sqlite3_bind_int(query,2, availability.availabilityReason);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceAvailabilityDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (!existSource(sourceID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(SOURCE_TABLE) + " SET availability=?, availabilityReason=? WHERE sourceID=" + i2s(sourceID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, availability.availability);
+ sqlite3_bind_int(query, 2, availability.availabilityReason);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceAvailabilityDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceAvailabilityDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceAvailabilityDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSourceAvailabilityDB changed changeSourceAvailabilityDB of source:"),DLT_INT(sourceID),DLT_STRING("to:"),DLT_INT(availability.availability), DLT_STRING("Reason:"),DLT_INT(availability.availabilityReason));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSourceAvailabilityDB changed changeSourceAvailabilityDB of source:"), DLT_INT(sourceID), DLT_STRING("to:"), DLT_INT(availability.availability), DLT_STRING("Reason:"), DLT_INT(availability.availabilityReason));
- if (mDatabaseObserver && sourceVisible(sourceID)) mDatabaseObserver->sourceAvailabilityChanged(sourceID,availability);
- return E_OK;
+ if (mDatabaseObserver && sourceVisible(sourceID)) mDatabaseObserver->sourceAvailabilityChanged(sourceID, availability);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeSystemPropertyDB(const am_SystemProperty_s & property)
{
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command="UPDATE " + std::string(SYSTEM_TABLE) + " set value=? WHERE type=?";
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command = "UPDATE " + std::string(SYSTEM_TABLE) + " set value=? WHERE type=?";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, property.value);
- sqlite3_bind_int(query,2, property.type);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, property.value);
+ sqlite3_bind_int(query, 2, property.type);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSystemPropertyDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSystemPropertyDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSystemPropertyDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSystemPropertyDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSystemPropertyDB changed system property"));
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSystemPropertyDB changed system property"));
+ if (mDatabaseObserver) mDatabaseObserver->systemPropertyChanged(property);
- if(mDatabaseObserver) mDatabaseObserver->systemPropertyChanged(property);
-
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
{
- assert(mainConnectionID!=0);
+ assert(mainConnectionID!=0);
- if (!existMainConnection(mainConnectionID))
- {
- return E_NON_EXISTENT;
- }
- std::string command = "DELETE from " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
- std::string command1 = "DROP table MainConnectionRoute" + i2s(mainConnectionID);
- if(!sqQuery(command)) return E_DATABASE_ERROR;
- if(!sqQuery(command1)) return E_DATABASE_ERROR;
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeMainConnectionDB removed:"),DLT_INT(mainConnectionID));
- if (mDatabaseObserver) {
- mDatabaseObserver->mainConnectionStateChanged(mainConnectionID,CS_DISCONNECTED);
- mDatabaseObserver->numberOfMainConnectionsChanged();
- }
- return E_OK;
+ if (!existMainConnection(mainConnectionID))
+ {
+ return E_NON_EXISTENT;
+ }
+ std::string command = "DELETE from " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
+ std::string command1 = "DROP table MainConnectionRoute" + i2s(mainConnectionID);
+ if (!sqQuery(command)) return E_DATABASE_ERROR;
+ if (!sqQuery(command1)) return E_DATABASE_ERROR;DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeMainConnectionDB removed:"), DLT_INT(mainConnectionID));
+ if (mDatabaseObserver)
+ {
+ mDatabaseObserver->mainConnectionStateChanged(mainConnectionID, CS_DISCONNECTED);
+ mDatabaseObserver->numberOfMainConnectionsChanged();
+ }
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
{
- assert(sinkID!=0);
+ assert(sinkID!=0);
- if (!existSink(sinkID))
- {
- return E_NON_EXISTENT;
- }
- std::string command = "DELETE from " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
- std::string command1 = "DROP table SinkConnectionFormat" + i2s(sinkID);
- std::string command2 = "DROP table SinkMainSoundProperty" + i2s(sinkID);
- std::string command3 = "DROP table SinkSoundProperty" + i2s(sinkID);
- if(!sqQuery(command)) return E_DATABASE_ERROR;
- if(!sqQuery(command1)) return E_DATABASE_ERROR;
- if(!sqQuery(command2)) return E_DATABASE_ERROR;
- if(!sqQuery(command3)) return E_DATABASE_ERROR;
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSinkDB removed:"),DLT_INT(sinkID));
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+ std::string command = "DELETE from " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
+ std::string command1 = "DROP table SinkConnectionFormat" + i2s(sinkID);
+ std::string command2 = "DROP table SinkMainSoundProperty" + i2s(sinkID);
+ std::string command3 = "DROP table SinkSoundProperty" + i2s(sinkID);
+ if (!sqQuery(command)) return E_DATABASE_ERROR;
+ if (!sqQuery(command1)) return E_DATABASE_ERROR;
+ if (!sqQuery(command2)) return E_DATABASE_ERROR;
+ if (!sqQuery(command3)) return E_DATABASE_ERROR;DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSinkDB removed:"), DLT_INT(sinkID));
- if (mDatabaseObserver!=NULL) mDatabaseObserver->removedSink(sinkID);
+ if (mDatabaseObserver != NULL) mDatabaseObserver->removedSink(sinkID);
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
{
- assert(sourceID!=0);
+ assert(sourceID!=0);
- if (!existSource(sourceID))
- {
- return E_NON_EXISTENT;
- }
- std::string command = "DELETE from " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
- std::string command1 = "DROP table SourceConnectionFormat" + i2s(sourceID);
- std::string command2 = "DROP table SourceMainSoundProperty" + i2s(sourceID);
- std::string command3 = "DROP table SourceSoundProperty" + i2s(sourceID);
- if(!sqQuery(command)) return E_DATABASE_ERROR;
- if(!sqQuery(command1)) return E_DATABASE_ERROR;
- if(!sqQuery(command2)) return E_DATABASE_ERROR;
- if(!sqQuery(command3)) return E_DATABASE_ERROR;
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSourceDB removed:"),DLT_INT(sourceID));
- if(mDatabaseObserver) mDatabaseObserver->removedSource(sourceID);
- return E_OK;
+ if (!existSource(sourceID))
+ {
+ return E_NON_EXISTENT;
+ }
+ std::string command = "DELETE from " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
+ std::string command1 = "DROP table SourceConnectionFormat" + i2s(sourceID);
+ std::string command2 = "DROP table SourceMainSoundProperty" + i2s(sourceID);
+ std::string command3 = "DROP table SourceSoundProperty" + i2s(sourceID);
+ if (!sqQuery(command)) return E_DATABASE_ERROR;
+ if (!sqQuery(command1)) return E_DATABASE_ERROR;
+ if (!sqQuery(command2)) return E_DATABASE_ERROR;
+ if (!sqQuery(command3)) return E_DATABASE_ERROR;DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSourceDB removed:"), DLT_INT(sourceID));
+ if (mDatabaseObserver) mDatabaseObserver->removedSource(sourceID);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
{
- assert(gatewayID!=0);
+ assert(gatewayID!=0);
- if (!existGateway(gatewayID))
- {
- return E_NON_EXISTENT;
- }
- std::string command = "DELETE from " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
- if(!sqQuery(command)) return E_DATABASE_ERROR;
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeGatewayDB removed:"),DLT_INT(gatewayID));
- if(mDatabaseObserver) mDatabaseObserver->removeGateway(gatewayID);
- return E_OK;
+ if (!existGateway(gatewayID))
+ {
+ return E_NON_EXISTENT;
+ }
+ std::string command = "DELETE from " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
+ if (!sqQuery(command)) return E_DATABASE_ERROR;DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeGatewayDB removed:"), DLT_INT(gatewayID));
+ if (mDatabaseObserver) mDatabaseObserver->removeGateway(gatewayID);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
- //todo: implement crossdfader
- (void)crossfaderID;
- return E_UNKNOWN;
+ //todo: implement crossdfader
+ (void) crossfaderID;
+ return E_UNKNOWN;
}
-
-
am_Error_e DatabaseHandler::removeDomainDB(const am_domainID_t domainID)
{
- assert(domainID!=0);
+ assert(domainID!=0);
- if (!existDomain(domainID))
- {
- return E_NON_EXISTENT;
- }
- std::string command = "DELETE from " + std::string(DOMAIN_TABLE) + " WHERE domainID=" + i2s(domainID);
- if(!sqQuery(command)) return E_DATABASE_ERROR;
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeDomainDB removed:"),DLT_INT(domainID));
- if(mDatabaseObserver) mDatabaseObserver->removeDomain(domainID);
- return E_OK;
+ if (!existDomain(domainID))
+ {
+ return E_NON_EXISTENT;
+ }
+ std::string command = "DELETE from " + std::string(DOMAIN_TABLE) + " WHERE domainID=" + i2s(domainID);
+ if (!sqQuery(command)) return E_DATABASE_ERROR;DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeDomainDB removed:"), DLT_INT(domainID));
+ if (mDatabaseObserver) mDatabaseObserver->removeDomain(domainID);
+ return E_OK;
}
am_Error_e DatabaseHandler::removeSinkClassDB(const am_sinkClass_t sinkClassID)
{
- assert(sinkClassID!=0);
+ assert(sinkClassID!=0);
- if (!existSinkClass(sinkClassID))
- {
- return E_NON_EXISTENT;
- }
- std::string command = "DELETE from " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
- std::string command1 = "DROP table SinkClassProperties" + i2s(sinkClassID);
- if(!sqQuery(command)) return E_DATABASE_ERROR;
- if(!sqQuery(command1)) return E_DATABASE_ERROR;
+ if (!existSinkClass(sinkClassID))
+ {
+ return E_NON_EXISTENT;
+ }
+ std::string command = "DELETE from " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
+ std::string command1 = "DROP table SinkClassProperties" + i2s(sinkClassID);
+ if (!sqQuery(command)) return E_DATABASE_ERROR;
+ if (!sqQuery(command1)) return E_DATABASE_ERROR;
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSinkClassDB removed:"),DLT_INT(sinkClassID));
- if (mDatabaseObserver) mDatabaseObserver->numberOfSinkClassesChanged();
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSinkClassDB removed:"), DLT_INT(sinkClassID));
+ if (mDatabaseObserver) mDatabaseObserver->numberOfSinkClassesChanged();
- return E_OK;
+ return E_OK;
}
am_Error_e DatabaseHandler::removeSourceClassDB(const am_sourceClass_t sourceClassID)
{
- assert(sourceClassID!=0);
+ assert(sourceClassID!=0);
- if (!existSourceClass(sourceClassID))
- {
- return E_NON_EXISTENT;
- }
- std::string command = "DELETE from " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
- std::string command1 = "DROP table SourceClassProperties" + i2s(sourceClassID);
- if(!sqQuery(command)) return E_DATABASE_ERROR;
- if(!sqQuery(command1)) return E_DATABASE_ERROR;
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSourceClassDB removed:"),DLT_INT(sourceClassID));
+ if (!existSourceClass(sourceClassID))
+ {
+ return E_NON_EXISTENT;
+ }
+ std::string command = "DELETE from " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
+ std::string command1 = "DROP table SourceClassProperties" + i2s(sourceClassID);
+ if (!sqQuery(command)) return E_DATABASE_ERROR;
+ if (!sqQuery(command1)) return E_DATABASE_ERROR;DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSourceClassDB removed:"), DLT_INT(sourceClassID));
- if (mDatabaseObserver) mDatabaseObserver->numberOfSourceClassesChanged();
- return E_OK;
+ if (mDatabaseObserver) mDatabaseObserver->numberOfSourceClassesChanged();
+ return E_OK;
}
am_Error_e DatabaseHandler::removeConnection(const am_connectionID_t connectionID)
{
- assert(connectionID!=0);
+ assert(connectionID!=0);
- std::string command = "DELETE from " + std::string(CONNECTION_TABLE) + " WHERE connectionID=" + i2s(connectionID);
- std::string command1 = "DROP table SourceClassProperties" + i2s(connectionID);
- if(!sqQuery(command)) return E_DATABASE_ERROR;
- if(!sqQuery(command1)) return E_DATABASE_ERROR;
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeConnection removed:"),DLT_INT(connectionID));
+ std::string command = "DELETE from " + std::string(CONNECTION_TABLE) + " WHERE connectionID=" + i2s(connectionID);
+ std::string command1 = "DROP table SourceClassProperties" + i2s(connectionID);
+ if (!sqQuery(command)) return E_DATABASE_ERROR;
+ if (!sqQuery(command1)) return E_DATABASE_ERROR;DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeConnection removed:"), DLT_INT(connectionID));
- return E_OK;
+ return E_OK;
}
-
am_Error_e DatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
{
- assert(sourceID!=0);
-
- if (!existSource(sourceID))
- {
- return E_NON_EXISTENT;
- }
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_ClassProperty_s propertyTemp;
- std::string command= "SELECT sourceClassID FROM " + std::string(SOURCE_TABLE)+ " WHERE sourceID=" + (i2s(sourceID));
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- if((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- classInfo.sourceClassID=sqlite3_column_int(query,0);
- }
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- command= "SELECT name FROM " + std::string(SOURCE_CLASS_TABLE)+ " WHERE sourceClassID=" + (i2s(classInfo.sourceClassID));
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- if((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- classInfo.name=std::string((const char*)sqlite3_column_text(query,0));
- }
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //read out Properties
- command= "SELECT classProperty, value FROM SourceClassProperties"+ i2s(classInfo.sourceClassID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- propertyTemp.classProperty=(am_ClassProperty_e)sqlite3_column_int(query,0);
- propertyTemp.value=sqlite3_column_int(query,1);
- classInfo.listClassProperties.push_back(propertyTemp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- return E_OK;
+ assert(sourceID!=0);
+
+ if (!existSource(sourceID))
+ {
+ return E_NON_EXISTENT;
+ }
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_ClassProperty_s propertyTemp;
+ std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + (i2s(sourceID));
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ classInfo.sourceClassID = sqlite3_column_int(query, 0);
+ }
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ command = "SELECT name FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + (i2s(classInfo.sourceClassID));
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ classInfo.name = std::string((const char*) sqlite3_column_text(query, 0));
+ }
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //read out Properties
+ command = "SELECT classProperty, value FROM SourceClassProperties" + i2s(classInfo.sourceClassID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ propertyTemp.classProperty = (am_ClassProperty_e) sqlite3_column_int(query, 0);
+ propertyTemp.value = sqlite3_column_int(query, 1);
+ classInfo.listClassProperties.push_back(propertyTemp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
{
- assert(sinkClass.sinkClassID!=0);
- assert(!sinkClass.listClassProperties.empty());
-
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
-
- //check if the ID already exists
- if(!existSinkClass(sinkClass.sinkClassID)) return E_NON_EXISTENT;
-
- //fill ConnectionFormats
- std::string command="UPDATE SinkClassProperties" + i2s(sinkClass.sinkClassID) + " set value=? WHERE classProperty=?;";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_ClassProperty_s>::const_iterator Iterator=sinkClass.listClassProperties.begin();
- for(;Iterator<sinkClass.listClassProperties.end();++Iterator)
- {
- sqlite3_bind_int(query,1, Iterator->value);
- sqlite3_bind_int(query,2, Iterator->classProperty);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::setSinkClassInfoDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::setSinkClassInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo"));
- return E_OK;
+ assert(sinkClass.sinkClassID!=0);
+ assert(!sinkClass.listClassProperties.empty());
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+
+ //check if the ID already exists
+ if (!existSinkClass(sinkClass.sinkClassID)) return E_NON_EXISTENT;
+
+ //fill ConnectionFormats
+ std::string command = "UPDATE SinkClassProperties" + i2s(sinkClass.sinkClassID) + " set value=? WHERE classProperty=?;";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_ClassProperty_s>::const_iterator Iterator = sinkClass.listClassProperties.begin();
+ for (; Iterator < sinkClass.listClassProperties.end(); ++Iterator)
+ {
+ sqlite3_bind_int(query, 1, Iterator->value);
+ sqlite3_bind_int(query, 2, Iterator->classProperty);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::setSinkClassInfoDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::setSinkClassInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo"));
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
{
- assert(sourceClass.sourceClassID!=0);
- assert(!sourceClass.listClassProperties.empty());
-
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
-
- //check if the ID already exists
- if(!existSourceClass(sourceClass.sourceClassID)) return E_NON_EXISTENT;
-
- //fill ConnectionFormats
- std::string command="UPDATE SourceClassProperties" + i2s(sourceClass.sourceClassID) + " set value=? WHERE classProperty=?;";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_ClassProperty_s>::const_iterator Iterator=sourceClass.listClassProperties.begin();
- for(;Iterator<sourceClass.listClassProperties.end();++Iterator)
- {
- sqlite3_bind_int(query,1, Iterator->value);
- sqlite3_bind_int(query,2, Iterator->classProperty);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::setSinkClassInfoDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::setSinkClassInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo"));
- return E_OK;
+ assert(sourceClass.sourceClassID!=0);
+ assert(!sourceClass.listClassProperties.empty());
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+
+ //check if the ID already exists
+ if (!existSourceClass(sourceClass.sourceClassID)) return E_NON_EXISTENT;
+
+ //fill ConnectionFormats
+ std::string command = "UPDATE SourceClassProperties" + i2s(sourceClass.sourceClassID) + " set value=? WHERE classProperty=?;";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_ClassProperty_s>::const_iterator Iterator = sourceClass.listClassProperties.begin();
+ for (; Iterator < sourceClass.listClassProperties.end(); ++Iterator)
+ {
+ sqlite3_bind_int(query, 1, Iterator->value);
+ sqlite3_bind_int(query, 2, Iterator->classProperty);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::setSinkClassInfoDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::setSinkClassInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo"));
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
{
- assert(sinkID!=0);
-
- if (!existSink(sinkID))
- {
- return E_NON_EXISTENT;
- }
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_ClassProperty_s propertyTemp;
- std::string command= "SELECT sinkClassID FROM " + std::string(SINK_TABLE)+ " WHERE sinkID=" + (i2s(sinkID));
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- if((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- sinkClass.sinkClassID=sqlite3_column_int(query,0);
- }
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- command= "SELECT name FROM " + std::string(SINK_CLASS_TABLE)+ " WHERE sinkClassID=" + (i2s(sinkClass.sinkClassID));
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- if((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- sinkClass.name=std::string((const char*)sqlite3_column_text(query,0));
- }
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //read out Properties
- command= "SELECT classProperty, value FROM SinkClassProperties"+ i2s(sinkClass.sinkClassID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- propertyTemp.classProperty=(am_ClassProperty_e)sqlite3_column_int(query,0);
- propertyTemp.value=sqlite3_column_int(query,1);
- sinkClass.listClassProperties.push_back(propertyTemp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- return E_OK;
+ assert(sinkID!=0);
+
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_ClassProperty_s propertyTemp;
+ std::string command = "SELECT sinkClassID FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + (i2s(sinkID));
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sinkClass.sinkClassID = sqlite3_column_int(query, 0);
+ }
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ command = "SELECT name FROM " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + (i2s(sinkClass.sinkClassID));
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sinkClass.name = std::string((const char*) sqlite3_column_text(query, 0));
+ }
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //read out Properties
+ command = "SELECT classProperty, value FROM SinkClassProperties" + i2s(sinkClass.sinkClassID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ propertyTemp.classProperty = (am_ClassProperty_e) sqlite3_column_int(query, 0);
+ propertyTemp.value = sqlite3_column_int(query, 1);
+ sinkClass.listClassProperties.push_back(propertyTemp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
{
- assert(gatewayID!=0);
- if (!existGateway(gatewayID))
- {
- return E_NON_EXISTENT;
- }
- sqlite3_stmt* query=NULL, *qSinkConnectionFormat=NULL, *qSourceConnectionFormat=NULL;
- int eCode=0;
- am_ConnectionFormat_e tempConnectionFormat;
- std::string command= "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID="+i2s(gatewayID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- gatewayData.name=std::string((const char*)sqlite3_column_text(query,0));
- gatewayData.sinkID=sqlite3_column_int(query,1);
- gatewayData.sourceID=sqlite3_column_int(query,2);
- gatewayData.domainSinkID=sqlite3_column_int(query,3);
- gatewayData.domainSourceID=sqlite3_column_int(query,4);
- gatewayData.controlDomainID=sqlite3_column_int(query,5);
- gatewayData.gatewayID=sqlite3_column_int(query,6);
-
- //convertionMatrix:
- ListConnectionFormat::const_iterator iter=mListConnectionFormat.begin();
- iter=mListConnectionFormat.find(gatewayData.gatewayID);
- if (iter == mListConnectionFormat.end())
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB database error with convertionFormat"));
- return E_DATABASE_ERROR;
- }
- gatewayData.convertionMatrix=iter->second;
-
- //read out the connectionFormats
- std::string commandConnectionFormat= "SELECT soundFormat FROM GatewaySourceFormat" + i2s(gatewayData.gatewayID);
- sqlite3_prepare_v2(mDatabase,commandConnectionFormat.c_str(),-1,&qSourceConnectionFormat,NULL);
- while((eCode=sqlite3_step(qSourceConnectionFormat))==SQLITE_ROW)
- {
- tempConnectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(qSourceConnectionFormat,0);
- gatewayData.listSourceFormats.push_back(tempConnectionFormat);
- }
-
- if((eCode=sqlite3_finalize(qSourceConnectionFormat))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //read out sound properties
- commandConnectionFormat= "SELECT soundFormat FROM GatewaySinkFormat" + i2s(gatewayData.gatewayID);
- sqlite3_prepare_v2(mDatabase,commandConnectionFormat.c_str(),-1,&qSinkConnectionFormat,NULL);
- while((eCode=sqlite3_step(qSinkConnectionFormat))==SQLITE_ROW)
- {
- tempConnectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(qSinkConnectionFormat,0);
- gatewayData.listSinkFormats.push_back(tempConnectionFormat);
- }
-
- if((eCode=sqlite3_finalize(qSinkConnectionFormat))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ assert(gatewayID!=0);
+ if (!existGateway(gatewayID))
+ {
+ return E_NON_EXISTENT;
+ }
+ sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
+ int eCode = 0;
+ am_ConnectionFormat_e tempConnectionFormat;
+ std::string command = "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ gatewayData.name = std::string((const char*) sqlite3_column_text(query, 0));
+ gatewayData.sinkID = sqlite3_column_int(query, 1);
+ gatewayData.sourceID = sqlite3_column_int(query, 2);
+ gatewayData.domainSinkID = sqlite3_column_int(query, 3);
+ gatewayData.domainSourceID = sqlite3_column_int(query, 4);
+ gatewayData.controlDomainID = sqlite3_column_int(query, 5);
+ gatewayData.gatewayID = sqlite3_column_int(query, 6);
+
+ //convertionMatrix:
+ ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
+ iter = mListConnectionFormat.find(gatewayData.gatewayID);
+ if (iter == mListConnectionFormat.end())
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB database error with convertionFormat"));
+ return E_DATABASE_ERROR;
+ }
+ gatewayData.convertionMatrix = iter->second;
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM GatewaySourceFormat" + i2s(gatewayData.gatewayID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qSourceConnectionFormat, 0);
+ gatewayData.listSourceFormats.push_back(tempConnectionFormat);
+ }
+
+ if ((eCode = sqlite3_finalize(qSourceConnectionFormat)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //read out sound properties
+ commandConnectionFormat = "SELECT soundFormat FROM GatewaySinkFormat" + i2s(gatewayData.gatewayID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qSinkConnectionFormat, 0);
+ gatewayData.listSinkFormats.push_back(tempConnectionFormat);
+ }
+
+ if ((eCode = sqlite3_finalize(qSinkConnectionFormat)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
- //todo: implement crossfader
- (void)crossfaderID;
- (void)crossfaderData;
- return E_UNKNOWN;
+ //todo: implement crossfader
+ (void) crossfaderID;
+ (void) crossfaderData;
+ return E_UNKNOWN;
}
-
-
am_Error_e DatabaseHandler::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
{
- assert(domainID!=0);
- listSinkID.clear();
- if (!existDomain(domainID))
- {
- return E_NON_EXISTENT;
- }
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_sinkID_t temp;
- std::string command= "SELECT sinkID FROM " + std::string(SINK_TABLE)+ " WHERE reserved=0 AND domainID=" + (i2s(domainID));
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp=sqlite3_column_int(query,0);
- listSinkID.push_back(temp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinksOfDomain SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinksOfDomain SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ assert(domainID!=0);
+ listSinkID.clear();
+ if (!existDomain(domainID))
+ {
+ return E_NON_EXISTENT;
+ }
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_sinkID_t temp;
+ std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND domainID=" + (i2s(domainID));
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp = sqlite3_column_int(query, 0);
+ listSinkID.push_back(temp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinksOfDomain SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinksOfDomain SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
{
- assert(domainID!=0);
- listSourceID.clear();
- if (!existDomain(domainID))
- {
- return E_NON_EXISTENT;
- }
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_sourceID_t temp;
- std::string command= "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
+ assert(domainID!=0);
+ listSourceID.clear();
+ if (!existDomain(domainID))
+ {
+ return E_NON_EXISTENT;
+ }
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_sourceID_t temp;
+ std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp=sqlite3_column_int(query,0);
- listSourceID.push_back(temp);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp = sqlite3_column_int(query, 0);
+ listSourceID.push_back(temp);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourcesOfDomain SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourcesOfDomain SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourcesOfDomain SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourcesOfDomain SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listGatewaysID) const
{
- //todo: implement crossfader
- (void)listGatewaysID;
- (void)domainID;
- return E_UNKNOWN;
+ //todo: implement crossfader
+ (void) listGatewaysID;
+ (void) domainID;
+ return E_UNKNOWN;
}
-
-
am_Error_e DatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
{
- assert(domainID!=0);
- listGatewaysID.clear();
- if (!existDomain(domainID))
- {
- return E_NON_EXISTENT;
- }
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_gatewayID_t temp;
+ assert(domainID!=0);
+ listGatewaysID.clear();
+ if (!existDomain(domainID))
+ {
+ return E_NON_EXISTENT;
+ }
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_gatewayID_t temp;
- std::string command= "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE controlDomainID=" +i2s(domainID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ std::string command = "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE controlDomainID=" + i2s(domainID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp=sqlite3_column_int(query,0);
- listGatewaysID.push_back(temp);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp = sqlite3_column_int(query, 0);
+ listGatewaysID.push_back(temp);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGatewaysOfDomain SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGatewaysOfDomain SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGatewaysOfDomain SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGatewaysOfDomain SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
- listMainConnections.clear();
- sqlite3_stmt *query=NULL, *query1=NULL, *query2=NULL;
- int eCode=0;
- am_MainConnection_s temp;
- am_RoutingElement_s tempRoute;
-
- std::string command= "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
- std::string command1= "SELECT connectionID FROM MainConnectionRoute";
- std::string command2= "SELECT sourceID, sinkID, connectionFormat FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=?";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_prepare_v2(mDatabase,command2.c_str(),-1,&query2,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.connectionID=sqlite3_column_int(query,0);
- temp.route.sourceID=sqlite3_column_int(query,1);
- temp.route.sinkID=sqlite3_column_int(query,2);
- temp.connectionState=(am_ConnectionState_e)sqlite3_column_int(query,3);
- temp.delay=sqlite3_column_int(query,4);
- std::string statement=command1 + i2s(temp.connectionID);
- sqlite3_prepare_v2(mDatabase,statement.c_str(),-1,&query1,NULL);
- while((eCode=sqlite3_step(query1))==SQLITE_ROW) //todo: check results of eCode1, eCode2
- {
- int k=sqlite3_column_int(query1,0);
- sqlite3_bind_int(query2,1,k);
- while((eCode=sqlite3_step(query2))==SQLITE_ROW)
- {
- tempRoute.sourceID=sqlite3_column_int(query2,0);
- tempRoute.sinkID=sqlite3_column_int(query2,1);
- tempRoute.connectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(query2,2);
- getDomainOfSource(tempRoute.sourceID,tempRoute.domainID);
- temp.route.route.push_back(tempRoute);
- }
- sqlite3_reset(query2);
- }
- listMainConnections.push_back(temp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainConnections SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainConnections SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listMainConnections.clear();
+ sqlite3_stmt *query = NULL, *query1 = NULL, *query2 = NULL;
+ int eCode = 0;
+ am_MainConnection_s temp;
+ am_RoutingElement_s tempRoute;
+
+ std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
+ std::string command1 = "SELECT connectionID FROM MainConnectionRoute";
+ std::string command2 = "SELECT sourceID, sinkID, connectionFormat FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=?";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &query2, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.connectionID = sqlite3_column_int(query, 0);
+ temp.route.sourceID = sqlite3_column_int(query, 1);
+ temp.route.sinkID = sqlite3_column_int(query, 2);
+ temp.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3);
+ temp.delay = sqlite3_column_int(query, 4);
+ std::string statement = command1 + i2s(temp.connectionID);
+ sqlite3_prepare_v2(mDatabase, statement.c_str(), -1, &query1, NULL);
+ while ((eCode = sqlite3_step(query1)) == SQLITE_ROW) //todo: check results of eCode1, eCode2
+ {
+ int k = sqlite3_column_int(query1, 0);
+ sqlite3_bind_int(query2, 1, k);
+ while ((eCode = sqlite3_step(query2)) == SQLITE_ROW)
+ {
+ tempRoute.sourceID = sqlite3_column_int(query2, 0);
+ tempRoute.sinkID = sqlite3_column_int(query2, 1);
+ tempRoute.connectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(query2, 2);
+ getDomainOfSource(tempRoute.sourceID, tempRoute.domainID);
+ temp.route.route.push_back(tempRoute);
+ }
+ sqlite3_reset(query2);
+ }
+ listMainConnections.push_back(temp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainConnections SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainConnections SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListDomains(std::vector<am_Domain_s> & listDomains) const
{
- listDomains.clear();
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_Domain_s temp;
- std::string command= "SELECT domainID, name, busname, nodename, early, complete, state FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.domainID=sqlite3_column_int(query,0);
- temp.name=std::string((const char*)sqlite3_column_text(query,1));
- temp.busname=std::string((const char*)sqlite3_column_text(query,2));
- temp.nodename=std::string((const char*)sqlite3_column_text(query,3));
- temp.early=sqlite3_column_int(query,4);
- temp.complete=sqlite3_column_int(query,5);
- temp.state=(am_DomainState_e)sqlite3_column_int(query,6);
- listDomains.push_back(temp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListDomains SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListDomains SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listDomains.clear();
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_Domain_s temp;
+ std::string command = "SELECT domainID, name, busname, nodename, early, complete, state FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.domainID = sqlite3_column_int(query, 0);
+ temp.name = std::string((const char*) sqlite3_column_text(query, 1));
+ temp.busname = std::string((const char*) sqlite3_column_text(query, 2));
+ temp.nodename = std::string((const char*) sqlite3_column_text(query, 3));
+ temp.early = sqlite3_column_int(query, 4);
+ temp.complete = sqlite3_column_int(query, 5);
+ temp.state = (am_DomainState_e) sqlite3_column_int(query, 6);
+ listDomains.push_back(temp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListDomains SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListDomains SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListConnections(std::vector<am_Connection_s> & listConnections) const
{
- listConnections.clear();
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_Connection_s temp;
- std::string command= "SELECT connectionID, sourceID, sinkID, delay, connectionFormat FROM " + std::string(CONNECTION_TABLE)+" WHERE reserved=0";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.connectionID=sqlite3_column_int(query,0);
- temp.sourceID=sqlite3_column_int(query,1);
- temp.sinkID=sqlite3_column_int(query,2);
- temp.delay=sqlite3_column_int(query,3);
- temp.connectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(query,4);
- listConnections.push_back(temp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListConnections SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListConnections SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listConnections.clear();
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_Connection_s temp;
+ std::string command = "SELECT connectionID, sourceID, sinkID, delay, connectionFormat FROM " + std::string(CONNECTION_TABLE) + " WHERE reserved=0";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.connectionID = sqlite3_column_int(query, 0);
+ temp.sourceID = sqlite3_column_int(query, 1);
+ temp.sinkID = sqlite3_column_int(query, 2);
+ temp.delay = sqlite3_column_int(query, 3);
+ temp.connectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(query, 4);
+ listConnections.push_back(temp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListConnections SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListConnections SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks) const
{
- listSinks.clear();
- sqlite3_stmt* query=NULL, *qConnectionFormat=NULL, *qSoundProperty=NULL, *qMAinSoundProperty=NULL;
- int eCode=0;
- am_Sink_s temp;
- am_ConnectionFormat_e tempConnectionFormat;
- am_SoundProperty_s tempSoundProperty;
- am_MainSoundProperty_s tempMainSoundProperty;
- std::string command= "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE)+ " WHERE reserved=0";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.name=std::string((const char*)sqlite3_column_text(query,0));
- temp.domainID=sqlite3_column_int(query,1);
- temp.sinkClassID=sqlite3_column_int(query,2);
- temp.volume=sqlite3_column_int(query,3);
- temp.visible=sqlite3_column_int(query,4);
- temp.available.availability=(am_Availablility_e)sqlite3_column_int(query,5);
- temp.available.availabilityReason=(am_AvailabilityReason_e)sqlite3_column_int(query,6);
- temp.muteState=(am_MuteState_e)sqlite3_column_int(query,7);
- temp.mainVolume=sqlite3_column_int(query,8);
- temp.sinkID=sqlite3_column_int(query,9);
-
- //read out the connectionFormats
- std::string commandConnectionFormat= "SELECT soundFormat FROM SinkConnectionFormat"+ i2s(temp.sinkID);
- sqlite3_prepare_v2(mDatabase,commandConnectionFormat.c_str(),-1,&qConnectionFormat,NULL);
- while((eCode=sqlite3_step(qConnectionFormat))==SQLITE_ROW)
- {
- tempConnectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(qConnectionFormat,0);
- temp.listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- if((eCode=sqlite3_finalize(qConnectionFormat))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //read out sound properties
- std::string commandSoundProperty= "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(temp.sinkID);
- sqlite3_prepare_v2(mDatabase,commandSoundProperty.c_str(),-1,&qSoundProperty,NULL);
- while((eCode=sqlite3_step(qSoundProperty))==SQLITE_ROW)
- {
- tempSoundProperty.type=(am_SoundPropertyType_e)sqlite3_column_int(qSoundProperty,0);
- tempSoundProperty.value=sqlite3_column_int(qSoundProperty,1);
- temp.listSoundProperties.push_back(tempSoundProperty);
- }
-
- if((eCode=sqlite3_finalize(qSoundProperty))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //read out MainSoundProperties
- std::string commandMainSoundProperty= "SELECT soundPropertyType, value FROM SinkMainSoundProperty"+ i2s(temp.sinkID);
- sqlite3_prepare_v2(mDatabase,commandMainSoundProperty.c_str(),-1,&qMAinSoundProperty,NULL);
- while((eCode=sqlite3_step(qMAinSoundProperty))==SQLITE_ROW)
- {
- tempMainSoundProperty.type=(am_MainSoundPropertyType_e)sqlite3_column_int(qMAinSoundProperty,0);
- tempMainSoundProperty.value=sqlite3_column_int(qMAinSoundProperty,1);
- temp.listMainSoundProperties.push_back(tempMainSoundProperty);
- }
-
- if((eCode=sqlite3_finalize(qMAinSoundProperty))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- listSinks.push_back(temp);
- temp.listConnectionFormats.clear();
- temp.listMainSoundProperties.clear();
- temp.listSoundProperties.clear();
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listSinks.clear();
+ sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
+ int eCode = 0;
+ am_Sink_s temp;
+ am_ConnectionFormat_e tempConnectionFormat;
+ am_SoundProperty_s tempSoundProperty;
+ am_MainSoundProperty_s tempMainSoundProperty;
+ std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.domainID = sqlite3_column_int(query, 1);
+ temp.sinkClassID = sqlite3_column_int(query, 2);
+ temp.volume = sqlite3_column_int(query, 3);
+ temp.visible = sqlite3_column_int(query, 4);
+ temp.available.availability = (am_Availablility_e) sqlite3_column_int(query, 5);
+ temp.available.availabilityReason = (am_AvailabilityReason_e) sqlite3_column_int(query, 6);
+ temp.muteState = (am_MuteState_e) sqlite3_column_int(query, 7);
+ temp.mainVolume = sqlite3_column_int(query, 8);
+ temp.sinkID = sqlite3_column_int(query, 9);
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(temp.sinkID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
+ temp.listConnectionFormats.push_back(tempConnectionFormat);
+ }
+
+ if ((eCode = sqlite3_finalize(qConnectionFormat)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //read out sound properties
+ std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(temp.sinkID);
+ sqlite3_prepare_v2(mDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
+ while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
+ {
+ tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0);
+ tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
+ temp.listSoundProperties.push_back(tempSoundProperty);
+ }
+
+ if ((eCode = sqlite3_finalize(qSoundProperty)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //read out MainSoundProperties
+ std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(temp.sinkID);
+ sqlite3_prepare_v2(mDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
+ while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
+ {
+ tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0);
+ tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
+ temp.listMainSoundProperties.push_back(tempMainSoundProperty);
+ }
+
+ if ((eCode = sqlite3_finalize(qMAinSoundProperty)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ listSinks.push_back(temp);
+ temp.listConnectionFormats.clear();
+ temp.listMainSoundProperties.clear();
+ temp.listSoundProperties.clear();
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListSources(std::vector<am_Source_s> & listSources) const
{
- listSources.clear();
- sqlite3_stmt* query=NULL, *qConnectionFormat=NULL, *qSoundProperty=NULL, *qMAinSoundProperty=NULL;
- int eCode=0;
- am_Source_s temp;
- am_ConnectionFormat_e tempConnectionFormat;
- am_SoundProperty_s tempSoundProperty;
- am_MainSoundProperty_s tempMainSoundProperty;
- std::string command= "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) +" WHERE reserved=0";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.name=std::string((const char*)sqlite3_column_text(query,0));
- temp.domainID=sqlite3_column_int(query,1);
- temp.sourceClassID=sqlite3_column_int(query,2);
- temp.sourceState=(am_SourceState_e)sqlite3_column_int(query,3);
- temp.volume=sqlite3_column_int(query,4);
- temp.visible=sqlite3_column_int(query,5);
- temp.available.availability=(am_Availablility_e)sqlite3_column_int(query,6);
- temp.available.availabilityReason=(am_AvailabilityReason_e)sqlite3_column_int(query,7);
- temp.interruptState=(am_InterruptState_e)sqlite3_column_int(query,8);
- temp.sourceID=sqlite3_column_int(query,9);
-
- //read out the connectionFormats
- std::string commandConnectionFormat= "SELECT soundFormat FROM SourceConnectionFormat"+ i2s(temp.sourceID);
- sqlite3_prepare_v2(mDatabase,commandConnectionFormat.c_str(),-1,&qConnectionFormat,NULL);
- while((eCode=sqlite3_step(qConnectionFormat))==SQLITE_ROW)
- {
- tempConnectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(qConnectionFormat,0);
- temp.listConnectionFormats.push_back(tempConnectionFormat);
- }
-
- if((eCode=sqlite3_finalize(qConnectionFormat))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //read out sound properties
- std::string commandSoundProperty= "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(temp.sourceID);
- sqlite3_prepare_v2(mDatabase,commandSoundProperty.c_str(),-1,&qSoundProperty,NULL);
- while((eCode=sqlite3_step(qSoundProperty))==SQLITE_ROW)
- {
- tempSoundProperty.type=(am_SoundPropertyType_e)sqlite3_column_int(qSoundProperty,0);
- tempSoundProperty.value=sqlite3_column_int(qSoundProperty,1);
- temp.listSoundProperties.push_back(tempSoundProperty);
- }
-
- if((eCode=sqlite3_finalize(qSoundProperty))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //read out MainSoundProperties
- std::string commandMainSoundProperty= "SELECT soundPropertyType, value FROM SourceMainSoundProperty"+ i2s(temp.sourceID);
- sqlite3_prepare_v2(mDatabase,commandMainSoundProperty.c_str(),-1,&qMAinSoundProperty,NULL);
- while((eCode=sqlite3_step(qMAinSoundProperty))==SQLITE_ROW)
- {
- tempMainSoundProperty.type=(am_MainSoundPropertyType_e)sqlite3_column_int(qMAinSoundProperty,0);
- tempMainSoundProperty.value=sqlite3_column_int(qMAinSoundProperty,1);
- temp.listMainSoundProperties.push_back(tempMainSoundProperty);
- }
-
- if((eCode=sqlite3_finalize(qMAinSoundProperty))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- listSources.push_back(temp);
- temp.listConnectionFormats.clear();
- temp.listMainSoundProperties.clear();
- temp.listSoundProperties.clear();
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listSources.clear();
+ sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
+ int eCode = 0;
+ am_Source_s temp;
+ am_ConnectionFormat_e tempConnectionFormat;
+ am_SoundProperty_s tempSoundProperty;
+ am_MainSoundProperty_s tempMainSoundProperty;
+ std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.domainID = sqlite3_column_int(query, 1);
+ temp.sourceClassID = sqlite3_column_int(query, 2);
+ temp.sourceState = (am_SourceState_e) sqlite3_column_int(query, 3);
+ temp.volume = sqlite3_column_int(query, 4);
+ temp.visible = sqlite3_column_int(query, 5);
+ temp.available.availability = (am_Availablility_e) sqlite3_column_int(query, 6);
+ temp.available.availabilityReason = (am_AvailabilityReason_e) sqlite3_column_int(query, 7);
+ temp.interruptState = (am_InterruptState_e) sqlite3_column_int(query, 8);
+ temp.sourceID = sqlite3_column_int(query, 9);
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(temp.sourceID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
+ temp.listConnectionFormats.push_back(tempConnectionFormat);
+ }
+
+ if ((eCode = sqlite3_finalize(qConnectionFormat)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //read out sound properties
+ std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(temp.sourceID);
+ sqlite3_prepare_v2(mDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
+ while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
+ {
+ tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0);
+ tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
+ temp.listSoundProperties.push_back(tempSoundProperty);
+ }
+
+ if ((eCode = sqlite3_finalize(qSoundProperty)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //read out MainSoundProperties
+ std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(temp.sourceID);
+ sqlite3_prepare_v2(mDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
+ while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
+ {
+ tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0);
+ tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
+ temp.listMainSoundProperties.push_back(tempMainSoundProperty);
+ }
+
+ if ((eCode = sqlite3_finalize(qMAinSoundProperty)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ listSources.push_back(temp);
+ temp.listConnectionFormats.clear();
+ temp.listMainSoundProperties.clear();
+ temp.listSoundProperties.clear();
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
- listSourceClasses.clear();
-
- sqlite3_stmt* query=NULL, *subQuery=NULL;
- int eCode=0, eCode1;
- am_SourceClass_s classTemp;
- am_ClassProperty_s propertyTemp;
-
- std::string command= "SELECT sourceClassID, name FROM " + std::string(SOURCE_CLASS_TABLE);
- std::string command2;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- classTemp.sourceClassID=sqlite3_column_int(query,0);
- classTemp.name=std::string((const char*)sqlite3_column_text(query,1));
-
- //read out Properties
- command2="SELECT classProperty, value FROM SourceClassProperties"+ i2s(classTemp.sourceClassID);
- sqlite3_prepare_v2(mDatabase,command2.c_str(),-1,&subQuery,NULL);
-
- while((eCode1=sqlite3_step(subQuery))==SQLITE_ROW)
- {
- propertyTemp.classProperty=(am_ClassProperty_e)sqlite3_column_int(subQuery,0);
- propertyTemp.value=sqlite3_column_int(subQuery,1);
- classTemp.listClassProperties.push_back(propertyTemp);
- }
-
- if(eCode1!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
-
- if((eCode1=sqlite3_finalize(subQuery))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
- listSourceClasses.push_back(classTemp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listSourceClasses.clear();
+
+ sqlite3_stmt* query = NULL, *subQuery = NULL;
+ int eCode = 0, eCode1;
+ am_SourceClass_s classTemp;
+ am_ClassProperty_s propertyTemp;
+
+ std::string command = "SELECT sourceClassID, name FROM " + std::string(SOURCE_CLASS_TABLE);
+ std::string command2;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ classTemp.sourceClassID = sqlite3_column_int(query, 0);
+ classTemp.name = std::string((const char*) sqlite3_column_text(query, 1));
+
+ //read out Properties
+ command2 = "SELECT classProperty, value FROM SourceClassProperties" + i2s(classTemp.sourceClassID);
+ sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &subQuery, NULL);
+
+ while ((eCode1 = sqlite3_step(subQuery)) == SQLITE_ROW)
+ {
+ propertyTemp.classProperty = (am_ClassProperty_e) sqlite3_column_int(subQuery, 0);
+ propertyTemp.value = sqlite3_column_int(subQuery, 1);
+ classTemp.listClassProperties.push_back(propertyTemp);
+ }
+
+ if (eCode1 != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode1 = sqlite3_finalize(subQuery)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+ listSourceClasses.push_back(classTemp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
{
- //todo: implement crossfaders
- (void)listCrossfaders;
- return E_UNKNOWN;
+ //todo: implement crossfaders
+ (void) listCrossfaders;
+ return E_UNKNOWN;
}
-
-
am_Error_e DatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listGateways) const
{
- listGateways.clear();
- sqlite3_stmt* query=NULL, *qSinkConnectionFormat=NULL, *qSourceConnectionFormat=NULL;
- int eCode=0;
- am_Gateway_s temp;
- am_ConnectionFormat_e tempConnectionFormat;
-
- std::string command= "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.name=std::string((const char*)sqlite3_column_text(query,0));
- temp.sinkID=sqlite3_column_int(query,1);
- temp.sourceID=sqlite3_column_int(query,2);
- temp.domainSinkID=sqlite3_column_int(query,3);
- temp.domainSourceID=sqlite3_column_int(query,4);
- temp.controlDomainID=sqlite3_column_int(query,5);
- temp.gatewayID=sqlite3_column_int(query,6);
-
- //convertionMatrix:
- ListConnectionFormat::const_iterator iter=mListConnectionFormat.begin();
- iter=mListConnectionFormat.find(temp.gatewayID);
- if (iter == mListConnectionFormat.end())
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways database error with convertionFormat"));
- return E_DATABASE_ERROR;
- }
- temp.convertionMatrix=iter->second;
-
- //read out the connectionFormats
- std::string commandConnectionFormat= "SELECT soundFormat FROM GatewaySourceFormat" + i2s(temp.gatewayID);
- sqlite3_prepare_v2(mDatabase,commandConnectionFormat.c_str(),-1,&qSourceConnectionFormat,NULL);
- while((eCode=sqlite3_step(qSourceConnectionFormat))==SQLITE_ROW)
- {
- tempConnectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(qSourceConnectionFormat,0);
- temp.listSourceFormats.push_back(tempConnectionFormat);
- }
-
- if((eCode=sqlite3_finalize(qSourceConnectionFormat))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //read out sound properties
- commandConnectionFormat= "SELECT soundFormat FROM GatewaySinkFormat" + i2s(temp.gatewayID);
- sqlite3_prepare_v2(mDatabase,commandConnectionFormat.c_str(),-1,&qSinkConnectionFormat,NULL);
- while((eCode=sqlite3_step(qSinkConnectionFormat))==SQLITE_ROW)
- {
- tempConnectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(qSinkConnectionFormat,0);
- temp.listSinkFormats.push_back(tempConnectionFormat);
- }
-
- if((eCode=sqlite3_finalize(qSinkConnectionFormat))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- listGateways.push_back(temp);
- temp.listSinkFormats.clear();
- temp.listSourceFormats.clear();
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listGateways.clear();
+ sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
+ int eCode = 0;
+ am_Gateway_s temp;
+ am_ConnectionFormat_e tempConnectionFormat;
+
+ std::string command = "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.sinkID = sqlite3_column_int(query, 1);
+ temp.sourceID = sqlite3_column_int(query, 2);
+ temp.domainSinkID = sqlite3_column_int(query, 3);
+ temp.domainSourceID = sqlite3_column_int(query, 4);
+ temp.controlDomainID = sqlite3_column_int(query, 5);
+ temp.gatewayID = sqlite3_column_int(query, 6);
+
+ //convertionMatrix:
+ ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
+ iter = mListConnectionFormat.find(temp.gatewayID);
+ if (iter == mListConnectionFormat.end())
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways database error with convertionFormat"));
+ return E_DATABASE_ERROR;
+ }
+ temp.convertionMatrix = iter->second;
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM GatewaySourceFormat" + i2s(temp.gatewayID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qSourceConnectionFormat, 0);
+ temp.listSourceFormats.push_back(tempConnectionFormat);
+ }
+
+ if ((eCode = sqlite3_finalize(qSourceConnectionFormat)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //read out sound properties
+ commandConnectionFormat = "SELECT soundFormat FROM GatewaySinkFormat" + i2s(temp.gatewayID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qSinkConnectionFormat, 0);
+ temp.listSinkFormats.push_back(tempConnectionFormat);
+ }
+
+ if ((eCode = sqlite3_finalize(qSinkConnectionFormat)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ listGateways.push_back(temp);
+ temp.listSinkFormats.clear();
+ temp.listSourceFormats.clear();
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGateways SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
- listSinkClasses.clear();
-
- sqlite3_stmt* query=NULL, *subQuery=NULL;
- int eCode=0;
- am_SinkClass_s classTemp;
- am_ClassProperty_s propertyTemp;
-
- std::string command= "SELECT sinkClassID, name FROM " + std::string(SINK_CLASS_TABLE);
- std::string command2;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- classTemp.sinkClassID=sqlite3_column_int(query,0);
- classTemp.name=std::string((const char*)sqlite3_column_text(query,1));
-
- //read out Properties
- command2="SELECT classProperty, value FROM SinkClassProperties"+ i2s(classTemp.sinkClassID);
- sqlite3_prepare_v2(mDatabase,command2.c_str(),-1,&subQuery,NULL);
-
- while((eCode=sqlite3_step(subQuery))==SQLITE_ROW)
- {
- propertyTemp.classProperty=(am_ClassProperty_e)sqlite3_column_int(subQuery,0);
- propertyTemp.value=sqlite3_column_int(subQuery,1);
- classTemp.listClassProperties.push_back(propertyTemp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(subQuery))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- listSinkClasses.push_back(classTemp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listSinkClasses.clear();
+
+ sqlite3_stmt* query = NULL, *subQuery = NULL;
+ int eCode = 0;
+ am_SinkClass_s classTemp;
+ am_ClassProperty_s propertyTemp;
+
+ std::string command = "SELECT sinkClassID, name FROM " + std::string(SINK_CLASS_TABLE);
+ std::string command2;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ classTemp.sinkClassID = sqlite3_column_int(query, 0);
+ classTemp.name = std::string((const char*) sqlite3_column_text(query, 1));
+
+ //read out Properties
+ command2 = "SELECT classProperty, value FROM SinkClassProperties" + i2s(classTemp.sinkClassID);
+ sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &subQuery, NULL);
+
+ while ((eCode = sqlite3_step(subQuery)) == SQLITE_ROW)
+ {
+ propertyTemp.classProperty = (am_ClassProperty_e) sqlite3_column_int(subQuery, 0);
+ propertyTemp.value = sqlite3_column_int(subQuery, 1);
+ classTemp.listClassProperties.push_back(propertyTemp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(subQuery)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ listSinkClasses.push_back(classTemp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
- listConnections.clear();
- sqlite3_stmt *query=NULL;
- int eCode=0;
- am_MainConnectionType_s temp;
+ listConnections.clear();
+ sqlite3_stmt *query = NULL;
+ int eCode = 0;
+ am_MainConnectionType_s temp;
- std::string command= "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.mainConnectionID=sqlite3_column_int(query,0);
- temp.sourceID=sqlite3_column_int(query,1);
- temp.sinkID=sqlite3_column_int(query,2);
- temp.connectionState=(am_ConnectionState_e)sqlite3_column_int(query,3);
- temp.delay=sqlite3_column_int(query,4);
- listConnections.push_back(temp);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.mainConnectionID = sqlite3_column_int(query, 0);
+ temp.sourceID = sqlite3_column_int(query, 1);
+ temp.sinkID = sqlite3_column_int(query, 2);
+ temp.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3);
+ temp.delay = sqlite3_column_int(query, 4);
+ listConnections.push_back(temp);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListVisibleMainConnections SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListVisibleMainConnections SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListVisibleMainConnections SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListVisibleMainConnections SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
{
- listMainSinks.clear();
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_SinkType_s temp;
-
- std::string command= "SELECT name, sinkID, availability, availabilityReason, muteState, mainVolume, sinkClassID FROM " + std::string(SINK_TABLE) + " WHERE visible=1 AND reserved=0";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
-
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.name=std::string((const char*)sqlite3_column_text(query,0));
- temp.sinkID=sqlite3_column_int(query,1);
- temp.availability.availability=(am_Availablility_e)sqlite3_column_int(query,2);
- temp.availability.availabilityReason=(am_AvailabilityReason_e)sqlite3_column_int(query,3);
- temp.muteState=(am_MuteState_e)sqlite3_column_int(query,4);
- temp.volume=sqlite3_column_int(query,5);
- temp.sinkClassID=sqlite3_column_int(query,6);
- listMainSinks.push_back(temp);
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ listMainSinks.clear();
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_SinkType_s temp;
+
+ std::string command = "SELECT name, sinkID, availability, availabilityReason, muteState, mainVolume, sinkClassID FROM " + std::string(SINK_TABLE) + " WHERE visible=1 AND reserved=0";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.sinkID = sqlite3_column_int(query, 1);
+ temp.availability.availability = (am_Availablility_e) sqlite3_column_int(query, 2);
+ temp.availability.availabilityReason = (am_AvailabilityReason_e) sqlite3_column_int(query, 3);
+ temp.muteState = (am_MuteState_e) sqlite3_column_int(query, 4);
+ temp.volume = sqlite3_column_int(query, 5);
+ temp.sinkClassID = sqlite3_column_int(query, 6);
+ listMainSinks.push_back(temp);
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinks SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
{
- listMainSources.clear();
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_SourceType_s temp;
- std::string command= "SELECT name, sourceClassID, availability, availabilityReason, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE visible=1";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ listMainSources.clear();
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_SourceType_s temp;
+ std::string command = "SELECT name, sourceClassID, availability, availabilityReason, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE visible=1";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.name=std::string((const char*)sqlite3_column_text(query,0));
- temp.sourceClassID=sqlite3_column_int(query,1);
- temp.availability.availability=(am_Availablility_e)sqlite3_column_int(query,2);
- temp.availability.availabilityReason=(am_AvailabilityReason_e)sqlite3_column_int(query,3);
- temp.sourceID=sqlite3_column_int(query,4);
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.name = std::string((const char*) sqlite3_column_text(query, 0));
+ temp.sourceClassID = sqlite3_column_int(query, 1);
+ temp.availability.availability = (am_Availablility_e) sqlite3_column_int(query, 2);
+ temp.availability.availabilityReason = (am_AvailabilityReason_e) sqlite3_column_int(query, 3);
+ temp.sourceID = sqlite3_column_int(query, 4);
- listMainSources.push_back(temp);
- }
+ listMainSources.push_back(temp);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
{
- assert(sinkID!=0);
- if (!existSink(sinkID)) return E_DATABASE_ERROR; // todo: here we could change to non existen, but not shown in sequences
- listSoundProperties.clear();
+ assert(sinkID!=0);
+ if (!existSink(sinkID)) return E_DATABASE_ERROR; // todo: here we could change to non existen, but not shown in sequences
+ listSoundProperties.clear();
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_MainSoundProperty_s temp;
- std::string command= "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_MainSoundProperty_s temp;
+ std::string command = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(sinkID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.type=(am_MainSoundPropertyType_e)sqlite3_column_int(query,0);
- temp.value=sqlite3_column_int(query,1);
- listSoundProperties.push_back(temp);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.type = (am_MainSoundPropertyType_e) sqlite3_column_int(query, 0);
+ temp.value = sqlite3_column_int(query, 1);
+ listSoundProperties.push_back(temp);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainSinkSoundProperties SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainSinkSoundProperties SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainSinkSoundProperties SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainSinkSoundProperties SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
{
- assert(sourceID!=0);
- if (!existSource(sourceID)) return E_DATABASE_ERROR; // todo: here we could change to non existen, but not shown in sequences
- listSourceProperties.clear();
+ assert(sourceID!=0);
+ if (!existSource(sourceID)) return E_DATABASE_ERROR; // todo: here we could change to non existen, but not shown in sequences
+ listSourceProperties.clear();
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_MainSoundProperty_s temp;
- std::string command= "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_MainSoundProperty_s temp;
+ std::string command = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(sourceID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.type=(am_MainSoundPropertyType_e)sqlite3_column_int(query,0);
- temp.value=sqlite3_column_int(query,1);
- listSourceProperties.push_back(temp);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.type = (am_MainSoundPropertyType_e) sqlite3_column_int(query, 0);
+ temp.value = sqlite3_column_int(query, 1);
+ listSourceProperties.push_back(temp);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainSinkSoundProperties SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainSinkSoundProperties SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainSinkSoundProperties SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListMainSinkSoundProperties SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
- listSystemProperties.clear();
+ listSystemProperties.clear();
- sqlite3_stmt* query=NULL;
- int eCode=0;
- am_SystemProperty_s temp;
- std::string command= "SELECT type, value FROM " + std::string(SYSTEM_TABLE);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ am_SystemProperty_s temp;
+ std::string command = "SELECT type, value FROM " + std::string(SYSTEM_TABLE);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- temp.type=(am_SystemPropertyType_e)sqlite3_column_int(query,0);
- temp.value=sqlite3_column_int(query,1);
- listSystemProperties.push_back(temp);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ temp.type = (am_SystemPropertyType_e) sqlite3_column_int(query, 0);
+ temp.value = sqlite3_column_int(query, 1);
+ listSystemProperties.push_back(temp);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSystemProperties SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSystemProperties SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSystemProperties SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSystemProperties SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
am_Error_e am::DatabaseHandler::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
{
- listConnectionFormats.clear();
- sqlite3_stmt *qConnectionFormat=NULL;
- int eCode=0;
- am_ConnectionFormat_e tempConnectionFormat;
- std::string commandConnectionFormat= "SELECT soundFormat FROM SinkConnectionFormat"+ i2s(sinkID);
- sqlite3_prepare_v2(mDatabase,commandConnectionFormat.c_str(),-1,&qConnectionFormat,NULL);
- while((eCode=sqlite3_step(qConnectionFormat))==SQLITE_ROW)
- {
- tempConnectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(qConnectionFormat,0);
- listConnectionFormats.push_back(tempConnectionFormat);
- }
+ listConnectionFormats.clear();
+ sqlite3_stmt *qConnectionFormat = NULL;
+ int eCode = 0;
+ am_ConnectionFormat_e tempConnectionFormat;
+ std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(sinkID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
+ listConnectionFormats.push_back(tempConnectionFormat);
+ }
- if((eCode=sqlite3_finalize(qConnectionFormat))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinkConnectionFormats SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(qConnectionFormat)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSinkConnectionFormats SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
-
-
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;
- int eCode=0;
- am_ConnectionFormat_e tempConnectionFormat;
+ listConnectionFormats.clear();
+ sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
+ int eCode = 0;
+ am_ConnectionFormat_e tempConnectionFormat;
- //read out the connectionFormats
- std::string commandConnectionFormat= "SELECT soundFormat FROM SourceConnectionFormat"+ i2s(sourceID);
- sqlite3_prepare_v2(mDatabase,commandConnectionFormat.c_str(),-1,&qConnectionFormat,NULL);
- while((eCode=sqlite3_step(qConnectionFormat))==SQLITE_ROW)
- {
- tempConnectionFormat=(am_ConnectionFormat_e)sqlite3_column_int(qConnectionFormat,0);
- listConnectionFormats.push_back(tempConnectionFormat);
- }
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(sourceID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
+ listConnectionFormats.push_back(tempConnectionFormat);
+ }
- if((eCode=sqlite3_finalize(qConnectionFormat))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(qConnectionFormat)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListSources SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
am_Error_e am::DatabaseHandler::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
{
- ListConnectionFormat::const_iterator iter=mListConnectionFormat.begin();
- iter=mListConnectionFormat.find(gatewayID);
- if (iter == mListConnectionFormat.end())
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGatewayConnectionFormats database error with convertionFormat"));
- return (E_DATABASE_ERROR);
- }
- listConnectionFormat=iter->second;
+ ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
+ iter = mListConnectionFormat.find(gatewayID);
+ if (iter == mListConnectionFormat.end())
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getListGatewayConnectionFormats database error with convertionFormat"));
+ return (E_DATABASE_ERROR);
+ }
+ listConnectionFormat = iter->second;
- return (E_OK);
+ return (E_OK);
}
-
-
am_Error_e DatabaseHandler::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
{
- assert(mainConnectionID!=0);
- delay=-1;
- sqlite3_stmt *query=NULL;
- int eCode=0;
+ assert(mainConnectionID!=0);
+ delay = -1;
+ sqlite3_stmt *query = NULL;
+ int eCode = 0;
- std::string command= "SELECT delay FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ std::string command = "SELECT delay FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- delay=sqlite3_column_int(query,0);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ delay = sqlite3_column_int(query, 0);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getTimingInformation SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getTimingInformation SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getTimingInformation SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getTimingInformation SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if (delay==-1) return E_NOT_POSSIBLE;
+ if (delay == -1) return E_NOT_POSSIBLE;
- return E_OK;
+ return E_OK;
}
bool DatabaseHandler::sqQuery(const std::string& query)
{
- sqlite3_stmt* statement;
- int eCode=0;
- if ((eCode=sqlite3_exec(mDatabase,query.c_str(),NULL,&statement,NULL))!= SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::sqQuery SQL Query failed:"), DLT_STRING(query.c_str()), DLT_STRING("error code:"),DLT_INT(eCode));
- return false;
- }
- return true;
+ sqlite3_stmt* statement;
+ int eCode = 0;
+ if ((eCode = sqlite3_exec(mDatabase, query.c_str(), NULL, &statement, NULL)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::sqQuery SQL Query failed:"), DLT_STRING(query.c_str()), DLT_STRING("error code:"), DLT_INT(eCode));
+ return false;
+ }
+ return true;
}
bool DatabaseHandler::openDatabase()
{
- if (sqlite3_open_v2(mPath.c_str(),&mDatabase,SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL) == SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::openDatabase opened database"));
- return true;
- }
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::openDatabase failed to open database"));
- return false;
+ if (sqlite3_open_v2(mPath.c_str(), &mDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL) == SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::openDatabase opened database"));
+ return true;
+ }DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::openDatabase failed to open database"));
+ return false;
}
am_Error_e DatabaseHandler::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
{
- assert(connectionID!=0);
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command ="SELECT mainConnectionID FROM "+ std::string(MAINCONNECTION_TABLE) +" WHERE delay=? AND mainConnectionID=?";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, delay);
- sqlite3_bind_int(query,2, connectionID);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- sqlite3_finalize(query);
- return E_OK;
- }
- command="UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET delay=? WHERE mainConnectionID=?;";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, delay);
- sqlite3_bind_int(query,2, connectionID);
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeDelayMainConnection SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeDelayMainConnection SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if(mDatabaseObserver) mDatabaseObserver->timingInformationChanged(connectionID,delay);
-
- return E_OK;
+ assert(connectionID!=0);
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command = "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE delay=? AND mainConnectionID=?";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, delay);
+ sqlite3_bind_int(query, 2, connectionID);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ sqlite3_finalize(query);
+ return E_OK;
+ }
+ command = "UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET delay=? WHERE mainConnectionID=?;";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, delay);
+ sqlite3_bind_int(query, 2, connectionID);
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeDelayMainConnection SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeDelayMainConnection SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if (mDatabaseObserver) mDatabaseObserver->timingInformationChanged(connectionID, delay);
+
+ return E_OK;
}
am_Error_e DatabaseHandler::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
{
- assert(connection.connectionID==0);
- assert(connection.sinkID!=0);
- assert(connection.sourceID!=0);
- //connection format is not checked, because it's project specific
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command= "INSERT INTO " + std::string(CONNECTION_TABLE) + "(sinkID, sourceID, delay, connectionFormat, reserved) VALUES (?,?,?,?,?)";
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, connection.sinkID);
- sqlite3_bind_int(query,2, connection.sourceID);
- sqlite3_bind_int(query,3, connection.delay);
- sqlite3_bind_int(query,4, connection.connectionFormat);
- sqlite3_bind_int(query,5, true);
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterConnectionDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterConnectionDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- connectionID=sqlite3_last_insert_rowid(mDatabase);
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterConnectionDB entered new connection sourceID:"), DLT_INT16(connection.sourceID),
- DLT_STRING("sinkID:"),DLT_INT16(connection.sinkID),
- DLT_STRING("sourceID:"),DLT_INT16(connection.sourceID),
- DLT_STRING("delay:"), DLT_INT16(connection.delay),
- DLT_STRING("connectionFormat:"),DLT_INT16(connection.connectionFormat),
- DLT_STRING("assigned ID:"),DLT_INT16(connectionID));
- return E_OK;
+ assert(connection.connectionID==0);
+ assert(connection.sinkID!=0);
+ assert(connection.sourceID!=0);
+ //connection format is not checked, because it's project specific
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command = "INSERT INTO " + std::string(CONNECTION_TABLE) + "(sinkID, sourceID, delay, connectionFormat, reserved) VALUES (?,?,?,?,?)";
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, connection.sinkID);
+ sqlite3_bind_int(query, 2, connection.sourceID);
+ sqlite3_bind_int(query, 3, connection.delay);
+ sqlite3_bind_int(query, 4, connection.connectionFormat);
+ sqlite3_bind_int(query, 5, true);
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterConnectionDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterConnectionDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ connectionID = sqlite3_last_insert_rowid(mDatabase);
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterConnectionDB entered new connection sourceID:"), DLT_INT16(connection.sourceID), DLT_STRING("sinkID:"), DLT_INT16(connection.sinkID), DLT_STRING("sourceID:"), DLT_INT16(connection.sourceID), DLT_STRING("delay:"), DLT_INT16(connection.delay), DLT_STRING("connectionFormat:"), DLT_INT16(connection.connectionFormat), DLT_STRING("assigned ID:"), DLT_INT16(connectionID));
+ return E_OK;
}
am_Error_e DatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
{
- assert(sinkClass.sinkClassID<DYNAMIC_ID_BOUNDARY);
- assert(!sinkClass.listClassProperties.empty());
- assert(!sinkClass.name.empty());
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
-
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (sinkClass.sinkClassID==0 && !mFirstStaticSinkClass)
- {
- command= "INSERT INTO " + std::string(SINK_CLASS_TABLE) + "(name) VALUES (?)";
- }
- else
- {
- //check if the ID already exists
- if(existSinkClass(sinkClass.sinkClassID)) return E_ALREADY_EXISTS;
- command= "INSERT INTO " + std::string(SINK_CLASS_TABLE) + "(name, sinkClassID) VALUES (?,?)";
- }
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1, sinkClass.name.c_str(),sinkClass.name.size(),SQLITE_STATIC);
-
- //if the ID is not created, we add it to the query
- if(sinkClass.sinkClassID!=0)
- {
- sqlite3_bind_int(query,2, sinkClass.sinkClassID);
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if(mFirstStaticSinkClass)
- {
- sqlite3_bind_int(query,2, DYNAMIC_ID_BOUNDARY);
- mFirstStaticSinkClass=false;
- }
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkClassDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkClassDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- sinkClassID=sqlite3_last_insert_rowid(mDatabase); //todo:change last_insert implementations for mulithread usage...
-
- //now we need to create the additional tables:
- command="CREATE TABLE SinkClassProperties" + i2s(sinkClassID) + std::string("(classProperty INTEGER, value INTEGER)");
- assert(this->sqQuery(command));
-
- //fill ConnectionFormats
- command="INSERT INTO SinkClassProperties" + i2s(sinkClassID) + std::string("(classProperty,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_ClassProperty_s>::const_iterator Iterator=sinkClass.listClassProperties.begin();
- for(;Iterator<sinkClass.listClassProperties.end();++Iterator)
- {
- sqlite3_bind_int(query,1, Iterator->classProperty);
- sqlite3_bind_int(query,2, Iterator->value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkClassDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkClassDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSinkClassDB entered new sinkClass"));
- if (mDatabaseObserver) mDatabaseObserver->numberOfSinkClassesChanged();
- return E_OK;
+ assert(sinkClass.sinkClassID<DYNAMIC_ID_BOUNDARY);
+ assert(!sinkClass.listClassProperties.empty());
+ assert(!sinkClass.name.empty());
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+
+ //if sinkID is zero and the first Static Sink was already entered, the ID is created
+ if (sinkClass.sinkClassID == 0 && !mFirstStaticSinkClass)
+ {
+ command = "INSERT INTO " + std::string(SINK_CLASS_TABLE) + "(name) VALUES (?)";
+ }
+ else
+ {
+ //check if the ID already exists
+ if (existSinkClass(sinkClass.sinkClassID)) return E_ALREADY_EXISTS;
+ command = "INSERT INTO " + std::string(SINK_CLASS_TABLE) + "(name, sinkClassID) VALUES (?,?)";
+ }
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, sinkClass.name.c_str(), sinkClass.name.size(), SQLITE_STATIC);
+
+ //if the ID is not created, we add it to the query
+ if (sinkClass.sinkClassID != 0)
+ {
+ sqlite3_bind_int(query, 2, sinkClass.sinkClassID);
+ }
+
+ //if the first static sink is entered, we need to set it onto the boundary
+ else if (mFirstStaticSinkClass)
+ {
+ sqlite3_bind_int(query, 2, DYNAMIC_ID_BOUNDARY);
+ mFirstStaticSinkClass = false;
+ }
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkClassDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkClassDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ sinkClassID = sqlite3_last_insert_rowid(mDatabase); //todo:change last_insert implementations for mulithread usage...
+
+ //now we need to create the additional tables:
+ command = "CREATE TABLE SinkClassProperties" + i2s(sinkClassID) + std::string("(classProperty INTEGER, value INTEGER)");
+ assert(this->sqQuery(command));
+
+ //fill ConnectionFormats
+ command = "INSERT INTO SinkClassProperties" + i2s(sinkClassID) + std::string("(classProperty,value) VALUES (?,?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_ClassProperty_s>::const_iterator Iterator = sinkClass.listClassProperties.begin();
+ for (; Iterator < sinkClass.listClassProperties.end(); ++Iterator)
+ {
+ sqlite3_bind_int(query, 1, Iterator->classProperty);
+ sqlite3_bind_int(query, 2, Iterator->value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkClassDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSinkClassDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSinkClassDB entered new sinkClass"));
+ if (mDatabaseObserver) mDatabaseObserver->numberOfSinkClassesChanged();
+ return E_OK;
}
am_Error_e DatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
{
- assert(sourceClass.sourceClassID<DYNAMIC_ID_BOUNDARY);
- assert(!sourceClass.listClassProperties.empty());
- assert(!sourceClass.name.empty());
-
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
-
- //if sinkID is zero and the first Static Sink was already entered, the ID is created
- if (sourceClass.sourceClassID==0 && !mFirstStaticSourceClass)
- {
- command= "INSERT INTO " + std::string(SOURCE_CLASS_TABLE) + "(name) VALUES (?)";
- }
- else
- {
- //check if the ID already exists
- if(existSourceClass(sourceClass.sourceClassID)) return E_ALREADY_EXISTS;
- command= "INSERT INTO " + std::string(SOURCE_CLASS_TABLE) + "(name, sourceClassID) VALUES (?,?)";
- }
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1, sourceClass.name.c_str(),sourceClass.name.size(),SQLITE_STATIC);
-
- //if the ID is not created, we add it to the query
- if(sourceClass.sourceClassID!=0)
- {
- sqlite3_bind_int(query,2, sourceClass.sourceClassID);
- }
-
- //if the first static sink is entered, we need to set it onto the boundary
- else if(mFirstStaticSourceClass)
- {
- sqlite3_bind_int(query,2, DYNAMIC_ID_BOUNDARY);
- mFirstStaticSourceClass=false;
- }
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceClassDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceClassDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- sourceClassID=sqlite3_last_insert_rowid(mDatabase); //todo:change last_insert implementations for mulithread usage...
-
- //now we need to create the additional tables:
- command="CREATE TABLE SourceClassProperties" + i2s(sourceClassID) + std::string("(classProperty INTEGER, value INTEGER)");
- assert(sqQuery(command));
-
- //fill ConnectionFormats
- command="INSERT INTO SourceClassProperties" + i2s(sourceClassID) + std::string("(classProperty,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- std::vector<am_ClassProperty_s>::const_iterator Iterator=sourceClass.listClassProperties.begin();
- for(;Iterator<sourceClass.listClassProperties.end();++Iterator)
- {
- sqlite3_bind_int(query,1, Iterator->classProperty);
- sqlite3_bind_int(query,2, Iterator->value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceClassDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- sqlite3_reset(query);
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceClassDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSourceClassDB entered new sourceClass"));
-
- if (mDatabaseObserver) mDatabaseObserver->numberOfSourceClassesChanged();
- return E_OK;
+ assert(sourceClass.sourceClassID<DYNAMIC_ID_BOUNDARY);
+ assert(!sourceClass.listClassProperties.empty());
+ assert(!sourceClass.name.empty());
+
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
+
+ //if sinkID is zero and the first Static Sink was already entered, the ID is created
+ if (sourceClass.sourceClassID == 0 && !mFirstStaticSourceClass)
+ {
+ command = "INSERT INTO " + std::string(SOURCE_CLASS_TABLE) + "(name) VALUES (?)";
+ }
+ else
+ {
+ //check if the ID already exists
+ if (existSourceClass(sourceClass.sourceClassID)) return E_ALREADY_EXISTS;
+ command = "INSERT INTO " + std::string(SOURCE_CLASS_TABLE) + "(name, sourceClassID) VALUES (?,?)";
+ }
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, sourceClass.name.c_str(), sourceClass.name.size(), SQLITE_STATIC);
+
+ //if the ID is not created, we add it to the query
+ if (sourceClass.sourceClassID != 0)
+ {
+ sqlite3_bind_int(query, 2, sourceClass.sourceClassID);
+ }
+
+ //if the first static sink is entered, we need to set it onto the boundary
+ else if (mFirstStaticSourceClass)
+ {
+ sqlite3_bind_int(query, 2, DYNAMIC_ID_BOUNDARY);
+ mFirstStaticSourceClass = false;
+ }
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceClassDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceClassDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ sourceClassID = sqlite3_last_insert_rowid(mDatabase); //todo:change last_insert implementations for mulithread usage...
+
+ //now we need to create the additional tables:
+ command = "CREATE TABLE SourceClassProperties" + i2s(sourceClassID) + std::string("(classProperty INTEGER, value INTEGER)");
+ assert(sqQuery(command));
+
+ //fill ConnectionFormats
+ command = "INSERT INTO SourceClassProperties" + i2s(sourceClassID) + std::string("(classProperty,value) VALUES (?,?)");
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ std::vector<am_ClassProperty_s>::const_iterator Iterator = sourceClass.listClassProperties.begin();
+ for (; Iterator < sourceClass.listClassProperties.end(); ++Iterator)
+ {
+ sqlite3_bind_int(query, 1, Iterator->classProperty);
+ sqlite3_bind_int(query, 2, Iterator->value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceClassDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ sqlite3_reset(query);
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSourceClassDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSourceClassDB entered new sourceClass"));
+
+ if (mDatabaseObserver) mDatabaseObserver->numberOfSourceClassesChanged();
+ return E_OK;
}
am_Error_e DatabaseHandler::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
{
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::vector<am_SystemProperty_s>::const_iterator listIterator =listSystemProperties.begin();
- std::string command= "DELETE * FROM " + std::string(SYSTEM_TABLE);
- sqQuery(command);
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::vector<am_SystemProperty_s>::const_iterator listIterator = listSystemProperties.begin();
+ std::string command = "DELETE * FROM " + std::string(SYSTEM_TABLE);
+ sqQuery(command);
- command="INSERT INTO " + std::string(SYSTEM_TABLE) + " (type, value) VALUES (?,?)";
+ command = "INSERT INTO " + std::string(SYSTEM_TABLE) + " (type, value) VALUES (?,?)";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- for(;listIterator<listSystemProperties.end();++listIterator)
- {
- sqlite3_bind_int(query,1, listIterator->type);
- sqlite3_bind_int(query,2, listIterator->value);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ for (; listIterator < listSystemProperties.end(); ++listIterator)
+ {
+ sqlite3_bind_int(query, 1, listIterator->type);
+ sqlite3_bind_int(query, 2, listIterator->value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSystemProperties SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSystemProperties SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- sqlite3_reset(query);
- }
+ sqlite3_reset(query);
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSystemProperties SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::enterSystemProperties SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSystemProperties entered system properties"));
- return E_OK;
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSystemProperties entered system properties"));
+ return E_OK;
}
bool DatabaseHandler::existMainConnection(const am_mainConnectionID_t mainConnectionID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existMainConnection database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existMainConnection database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existSource(const am_sourceID_t sourceID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID);
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSource database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID);
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSource database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND (name=? OR sourceID=?)";
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,name.c_str(),name.size(),SQLITE_STATIC);
- sqlite3_bind_int(query,2,sourceID);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSource database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND (name=? OR sourceID=?)";
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ sqlite3_bind_int(query, 2, sourceID);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSource database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existSourceName(const std::string & name) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND name=?";
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,name.c_str(),name.size(),SQLITE_STATIC);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSource database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND name=?";
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSource database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existSink(const am_sinkID_t sinkID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND (name=? OR sinkID=?)";
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,name.c_str(),name.size(),SQLITE_STATIC);
- sqlite3_bind_int(query,2,sinkID);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND (name=? OR sinkID=?)";
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ sqlite3_bind_int(query, 2, sinkID);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existSinkName(const std::string & name) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND name=?";
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,name.c_str(),name.size(),SQLITE_STATIC);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND name=?";
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSink database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existDomain(const am_domainID_t domainID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existDomain database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existDomain database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existGateway(const am_gatewayID_t gatewayID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existGateway database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existGateway database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
am_Error_e DatabaseHandler::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
{
- assert(sourceID!=0);
-
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT domainID FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
- int eCode=0;
- am_Error_e returnVal=E_DATABASE_ERROR;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- domainID=sqlite3_column_int(query,0);
- returnVal=E_OK;
- }
- else
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getDomainOfSource database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return (returnVal);
+ assert(sourceID!=0);
+
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT domainID FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
+ int eCode = 0;
+ am_Error_e returnVal = E_DATABASE_ERROR;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ domainID = sqlite3_column_int(query, 0);
+ returnVal = E_OK;
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getDomainOfSource database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return (returnVal);
}
am_Error_e am::DatabaseHandler::getDomainOfSink(const am_sinkID_t sinkID, am_domainID_t & domainID) const
{
- assert(sinkID!=0);
-
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT domainID FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
- int eCode=0;
- am_Error_e returnVal=E_DATABASE_ERROR;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- domainID=sqlite3_column_int(query,0);
- returnVal=E_OK;
- }
- else
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getDomainOfSink database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return (returnVal);
+ assert(sinkID!=0);
+
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT domainID FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
+ int eCode = 0;
+ am_Error_e returnVal = E_DATABASE_ERROR;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ domainID = sqlite3_column_int(query, 0);
+ returnVal = E_OK;
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getDomainOfSink database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return (returnVal);
}
-
bool DatabaseHandler::existSinkClass(const am_sinkClass_t sinkClassID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sinkClassID FROM " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSinkClass database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sinkClassID FROM " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSinkClass database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existSourceClass(const am_sourceClass_t sourceClassID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSinkClass database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existSinkClass database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
am_Error_e DatabaseHandler::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
- assert(connectionID!=0);
-
- sqlite3_stmt *query=NULL, *queryMainConnections, *queryMainConnectionSubIDs;
- int eCode=0, eCode1=0;
- std::string command= "UPDATE " + std::string(CONNECTION_TABLE) + " set delay=? WHERE connectionID=?";
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, delay);
- sqlite3_bind_int(query,2, connectionID);
-
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- //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
- command= "SELECT name FROM sqlite_master WHERE type ='table' and name LIKE 'MainConnectionRoute%'";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryMainConnections,NULL);
-
- while((eCode=sqlite3_step(queryMainConnections))==SQLITE_ROW)
- {
- //now check if the connection ID is in this table
- std::string tablename=std::string((const char*)sqlite3_column_text(queryMainConnections,0));
- std::string command2="SELECT connectionID FROM " + tablename + " WHERE connectionID="+i2s(connectionID);
- sqlite3_prepare_v2(mDatabase,command2.c_str(),-1,&queryMainConnectionSubIDs,NULL);
- if((eCode1=sqlite3_step(queryMainConnectionSubIDs))==SQLITE_ROW)
- {
- //if the connection ID is in, recalculate the mainconnection delay
- std::stringstream(tablename.substr(tablename.find_first_not_of("MainConnectionRoute"))) >> tempMainConnectionID;
- changeDelayMainConnection(calculateMainConnectionDelay(tempMainConnectionID),tempMainConnectionID);
- }
- else if(eCode1!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(queryMainConnections))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- return E_OK;
+ assert(connectionID!=0);
+
+ sqlite3_stmt *query = NULL, *queryMainConnections, *queryMainConnectionSubIDs;
+ int eCode = 0, eCode1 = 0;
+ std::string command = "UPDATE " + std::string(CONNECTION_TABLE) + " set delay=? WHERE connectionID=?";
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, delay);
+ sqlite3_bind_int(query, 2, connectionID);
+
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ //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
+ command = "SELECT name FROM sqlite_master WHERE type ='table' and name LIKE 'MainConnectionRoute%'";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryMainConnections, NULL);
+
+ while ((eCode = sqlite3_step(queryMainConnections)) == SQLITE_ROW)
+ {
+ //now check if the connection ID is in this table
+ std::string tablename = std::string((const char*) sqlite3_column_text(queryMainConnections, 0));
+ std::string command2 = "SELECT connectionID FROM " + tablename + " WHERE connectionID=" + i2s(connectionID);
+ sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &queryMainConnectionSubIDs, NULL);
+ if ((eCode1 = sqlite3_step(queryMainConnectionSubIDs)) == SQLITE_ROW)
+ {
+ //if the connection ID is in, recalculate the mainconnection delay
+ std::stringstream(tablename.substr(tablename.find_first_not_of("MainConnectionRoute"))) >> tempMainConnectionID;
+ changeDelayMainConnection(calculateMainConnectionDelay(tempMainConnectionID), tempMainConnectionID);
+ }
+ else if (eCode1 != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(queryMainConnections)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionTimingInformation SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ return E_OK;
}
am_Error_e DatabaseHandler::changeConnectionFinal(const am_connectionID_t connectionID)
{
- assert(connectionID!=0);
+ assert(connectionID!=0);
- sqlite3_stmt *query=NULL;
- int eCode=0;
- std::string command= "UPDATE " + std::string(CONNECTION_TABLE) + " set reserved=0 WHERE connectionID=?";
+ sqlite3_stmt *query = NULL;
+ int eCode = 0;
+ std::string command = "UPDATE " + std::string(CONNECTION_TABLE) + " set reserved=0 WHERE connectionID=?";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, connectionID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, connectionID);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionFinal SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionFinal SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionFinal SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- return E_OK;
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeConnectionFinal SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ return E_OK;
}
am_timeSync_t DatabaseHandler::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
{
- assert (mainConnectionID!=0);
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT sum(Connections.delay),min(Connections.delay) FROM "+ std::string(CONNECTION_TABLE)+",MainConnectionRoute"+ i2s(mainConnectionID)+" WHERE MainConnectionRoute"+ i2s(mainConnectionID)+".connectionID = Connections.connectionID" ;
- int eCode=0;
- am_timeSync_t delay=0;
- am_timeSync_t min=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- delay=sqlite3_column_int(query,0);
- min=sqlite3_column_int(query,1);
- }
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::calculateMainConnectionDelay SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::calculateMainConnectionDelay SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- if (min<0) delay=-1;
- return delay;
+ assert(mainConnectionID!=0);
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT sum(Connections.delay),min(Connections.delay) FROM " + std::string(CONNECTION_TABLE) + ",MainConnectionRoute" + i2s(mainConnectionID) + " WHERE MainConnectionRoute" + i2s(mainConnectionID) + ".connectionID = Connections.connectionID";
+ int eCode = 0;
+ am_timeSync_t delay = 0;
+ am_timeSync_t min = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ delay = sqlite3_column_int(query, 0);
+ min = sqlite3_column_int(query, 1);
+ }
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::calculateMainConnectionDelay SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::calculateMainConnectionDelay SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ if (min < 0) delay = -1;
+ return delay;
}
void DatabaseHandler::registerObserver(DatabaseObserver *iObserver)
{
- assert(iObserver!=NULL);
- mDatabaseObserver=iObserver;
+ assert(iObserver!=NULL);
+ mDatabaseObserver = iObserver;
}
bool DatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
{
- assert(sourceID!=0);
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT visible FROM "+ std::string(SOURCE_TABLE) +" WHERE sourceID="+ i2s(sourceID);
- int eCode=0;
- bool returnVal=false;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE)
- {
- returnVal=(bool)sqlite3_column_int(query,0);
- }
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::sourceVisible database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ assert(sourceID!=0);
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT visible FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
+ int eCode = 0;
+ bool returnVal = false;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ returnVal = (bool) sqlite3_column_int(query, 0);
+ }
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::sourceVisible database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::sinkVisible(const am_sinkID_t sinkID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT visible FROM "+ std::string(SINK_TABLE) +" WHERE reserved=0 AND sinkID="+ i2s(sinkID);
- int eCode=0;
- bool returnVal=false;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE)
- {
- returnVal=sqlite3_column_int(query,0);
- }
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::sinkVisible database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT visible FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
+ int eCode = 0;
+ bool returnVal = false;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ returnVal = sqlite3_column_int(query, 0);
+ }
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::sinkVisible database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existConnection(const am_Connection_s connection)
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE sinkID=? AND sourceID=? AND connectionFormat=? AND reserved=0";
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, connection.sinkID);
- sqlite3_bind_int(query,2, connection.sourceID);
- sqlite3_bind_int(query,3, connection.connectionFormat);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existMainConnection database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE sinkID=? AND sourceID=? AND connectionFormat=? AND reserved=0";
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, connection.sinkID);
+ sqlite3_bind_int(query, 2, connection.sourceID);
+ sqlite3_bind_int(query, 3, connection.connectionFormat);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existMainConnection database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
-
bool DatabaseHandler::existConnectionID(const am_connectionID_t connectionID)
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=? AND reserved=0";
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, connectionID);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existMainConnection database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=? AND reserved=0";
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, connectionID);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existMainConnection database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
bool DatabaseHandler::existcrossFader(const am_crossfaderID_t crossfaderID) const
{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=?";
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, crossfaderID);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existMainConnection database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
+ sqlite3_stmt* query = NULL;
+ std::string command = "SELECT crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=?";
+ int eCode = 0;
+ bool returnVal = true;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, crossfaderID);
+ if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ returnVal = false;
+ else if (eCode != SQLITE_ROW)
+ {
+ returnVal = false;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::existMainConnection database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return returnVal;
}
am_Error_e DatabaseHandler::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
{
- assert(sourceID!=0);
- sqlite3_stmt* query=NULL;
- sourceState=SS_MIN;
- std::string command = "SELECT sourceState FROM "+ std::string(SOURCE_TABLE) +" WHERE sourceID="+ i2s(sourceID);
- int eCode=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- sourceState=(am_SourceState_e)sqlite3_column_int(query,0);
- }
- else if ((eCode=sqlite3_step(query))==SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSoureState database error!:"), DLT_INT(eCode))
-
- }
- sqlite3_finalize(query);
- return E_OK;
+ assert(sourceID!=0);
+ sqlite3_stmt* query = NULL;
+ sourceState = SS_MIN;
+ std::string command = "SELECT sourceState FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
+ int eCode = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sourceState = (am_SourceState_e) sqlite3_column_int(query, 0);
+ }
+ else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSoureState database error!:"), DLT_INT(eCode))
+
+ }
+ sqlite3_finalize(query);
+ return E_OK;
}
am_Error_e DatabaseHandler::changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
{
- assert(sourceID!=0);
- sqlite3_stmt* query=NULL;
- std::string command = "UPDATE " + std::string(SOURCE_TABLE) +" SET sourceState=? WHERE sourceID="+ i2s(sourceID);
- int eCode=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1,sourceState);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceState SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceState SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- return E_OK;
+ assert(sourceID!=0);
+ sqlite3_stmt* query = NULL;
+ std::string command = "UPDATE " + std::string(SOURCE_TABLE) + " SET sourceState=? WHERE sourceID=" + i2s(sourceID);
+ int eCode = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, sourceState);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceState SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceState SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ return E_OK;
}
am_Error_e DatabaseHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
{
- assert(sinkID!=0);
- sqlite3_stmt* query=NULL;
- volume=-1;
- std::string command = "SELECT volume FROM "+ std::string(SINK_TABLE) +" WHERE sinkID="+ i2s(sinkID);
- int eCode=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- volume=sqlite3_column_int(query,0);
- }
- else if ((eCode=sqlite3_step(query))==SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkVolume database error!:"), DLT_INT(eCode))
-
- }
- sqlite3_finalize(query);
- return E_OK;
+ assert(sinkID!=0);
+ sqlite3_stmt* query = NULL;
+ volume = -1;
+ std::string command = "SELECT volume FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
+ int eCode = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ volume = sqlite3_column_int(query, 0);
+ }
+ else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkVolume database error!:"), DLT_INT(eCode))
+
+ }
+ sqlite3_finalize(query);
+ return E_OK;
}
am_Error_e DatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
{
- assert(sourceID!=0);
- sqlite3_stmt* query=NULL;
- volume=-1;
- std::string command = "SELECT volume FROM "+ std::string(SOURCE_TABLE) +" WHERE sourceID="+ i2s(sourceID);
- int eCode=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- volume=sqlite3_column_int(query,0);
- }
- else if ((eCode=sqlite3_step(query))==SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceVolume database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return E_OK;
+ assert(sourceID!=0);
+ sqlite3_stmt* query = NULL;
+ volume = -1;
+ std::string command = "SELECT volume FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
+ int eCode = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ volume = sqlite3_column_int(query, 0);
+ }
+ else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSourceVolume database error!:"), DLT_INT(eCode))
+ }
+ sqlite3_finalize(query);
+ return E_OK;
}
-
am_Error_e DatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t & value) const
{
- assert(sinkID!=0);
- if (!existSink(sinkID)) return E_DATABASE_ERROR; // todo: here we could change to non existent, but not shown in sequences
+ assert(sinkID!=0);
+ if (!existSink(sinkID)) return E_DATABASE_ERROR; // todo: here we could change to non existent, but not shown in sequences
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command= "SELECT value FROM SinkSoundProperty" + i2s(sinkID) +" WHERE soundPropertyType=" +i2s(propertyType);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command = "SELECT value FROM SinkSoundProperty" + i2s(sinkID) + " WHERE soundPropertyType=" + i2s(propertyType);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- value=sqlite3_column_int(query,0);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ value = sqlite3_column_int(query, 0);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkSoundPropertyValue SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkSoundPropertyValue SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
am_Error_e DatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, uint16_t & value) const
{
- assert(sourceID!=0);
- if (!existSource(sourceID)) return E_DATABASE_ERROR; // todo: here we could change to non existent, but not shown in sequences
+ assert(sourceID!=0);
+ if (!existSource(sourceID)) return E_DATABASE_ERROR; // todo: here we could change to non existent, but not shown in sequences
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command= "SELECT value FROM SourceSoundProperty" + i2s(sourceID) +" WHERE soundPropertyType=" +i2s(propertyType);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command = "SELECT value FROM SourceSoundProperty" + i2s(sourceID) + " WHERE soundPropertyType=" + i2s(propertyType);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- value=sqlite3_column_int(query,0);
- }
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ value = sqlite3_column_int(query, 0);
+ }
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkSoundPropertyValue SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getSinkSoundPropertyValue SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- return E_OK;
+ return E_OK;
}
am_Error_e DatabaseHandler::getDomainState(const am_domainID_t domainID, am_DomainState_e state) const
{
- assert(domainID!=0);
- sqlite3_stmt* query=NULL;
- state=DS_MIN;
- std::string command = "SELECT domainState FROM "+ std::string(DOMAIN_TABLE) +" WHERE domainID="+ i2s(domainID);
- int eCode=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- state=(am_DomainState_e)sqlite3_column_int(query,0);
- }
- else if ((eCode=sqlite3_step(query))==SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getDomainState database error!:"), DLT_INT(eCode))
+ assert(domainID!=0);
+ sqlite3_stmt* query = NULL;
+ state = DS_MIN;
+ std::string command = "SELECT domainState FROM " + std::string(DOMAIN_TABLE) + " WHERE domainID=" + i2s(domainID);
+ int eCode = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ state = (am_DomainState_e) sqlite3_column_int(query, 0);
+ }
+ else if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getDomainState database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return E_OK;
+ }
+ sqlite3_finalize(query);
+ return E_OK;
}
am_Error_e DatabaseHandler::peekDomain(const std::string & name, am_domainID_t & domainID)
{
- sqlite3_stmt* query=NULL, *queryInsert=NULL;
- std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
- int eCode=0, eCode1=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,name.c_str(),name.size(),SQLITE_STATIC);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- domainID=sqlite3_column_int(query,0);
- }
- else if (eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain database error!:"), DLT_INT(eCode))
- return E_DATABASE_ERROR;
- }
- else
- {
- command= "INSERT INTO " + std::string(DOMAIN_TABLE) + " (name,reserved) VALUES (?,?)";
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryInsert,NULL);
- sqlite3_bind_text(queryInsert,1,name.c_str(),name.size(),SQLITE_STATIC);
- sqlite3_bind_int(queryInsert,2,1); //reservation flag
- if((eCode1=sqlite3_step(queryInsert))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain SQLITE Step error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
-
- if((eCode1=sqlite3_finalize(queryInsert))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain SQLITE Finalize error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
- domainID=sqlite3_last_insert_rowid(mDatabase);
- }
- sqlite3_finalize(query);
- return E_OK;
+ sqlite3_stmt* query = NULL, *queryInsert = NULL;
+ std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
+ int eCode = 0, eCode1 = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ domainID = sqlite3_column_int(query, 0);
+ }
+ else if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain database error!:"), DLT_INT(eCode))
+ return E_DATABASE_ERROR;
+ }
+ else
+ {
+ command = "INSERT INTO " + std::string(DOMAIN_TABLE) + " (name,reserved) VALUES (?,?)";
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryInsert, NULL);
+ sqlite3_bind_text(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ sqlite3_bind_int(queryInsert, 2, 1); //reservation flag
+ if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain SQLITE Step error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode1 = sqlite3_finalize(queryInsert)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain SQLITE Finalize error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+ domainID = sqlite3_last_insert_rowid(mDatabase);
+ }
+ sqlite3_finalize(query);
+ return E_OK;
}
am_Error_e DatabaseHandler::peekSink(const std::string & name, am_sinkID_t & sinkID)
{
- sqlite3_stmt* query=NULL, *queryInsert=NULL;
- std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
- int eCode=0, eCode1=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,name.c_str(),name.size(),SQLITE_STATIC);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- sinkID=sqlite3_column_int(query,0);
- }
- else if (eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekSink database error!:"), DLT_INT(eCode))
- return E_DATABASE_ERROR;
- }
- else
- {
- if (mFirstStaticSink)
- {
- command= "INSERT INTO " + std::string(SINK_TABLE) + " (name,reserved,sinkID) VALUES (?,?," + i2s(DYNAMIC_ID_BOUNDARY) + ")";
- mFirstStaticSink=false;
- }
- else
- {
- command= "INSERT INTO " + std::string(SINK_TABLE) + " (name,reserved) VALUES (?,?)";
- }
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryInsert,NULL);
- sqlite3_bind_text(queryInsert,1,name.c_str(),name.size(),SQLITE_STATIC);
- sqlite3_bind_int(queryInsert,2,1); //reservation flag
- if((eCode1=sqlite3_step(queryInsert))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekSink SQLITE Step error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
-
- if((eCode1=sqlite3_finalize(queryInsert))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain SQLITE Finalize error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
- sinkID=sqlite3_last_insert_rowid(mDatabase);
- }
- sqlite3_finalize(query);
- return E_OK;
+ sqlite3_stmt* query = NULL, *queryInsert = NULL;
+ std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
+ int eCode = 0, eCode1 = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sinkID = sqlite3_column_int(query, 0);
+ }
+ else if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekSink database error!:"), DLT_INT(eCode))
+ return E_DATABASE_ERROR;
+ }
+ else
+ {
+ if (mFirstStaticSink)
+ {
+ command = "INSERT INTO " + std::string(SINK_TABLE) + " (name,reserved,sinkID) VALUES (?,?," + i2s(DYNAMIC_ID_BOUNDARY) + ")";
+ mFirstStaticSink = false;
+ }
+ else
+ {
+ command = "INSERT INTO " + std::string(SINK_TABLE) + " (name,reserved) VALUES (?,?)";
+ }
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryInsert, NULL);
+ sqlite3_bind_text(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ sqlite3_bind_int(queryInsert, 2, 1); //reservation flag
+ if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekSink SQLITE Step error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode1 = sqlite3_finalize(queryInsert)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain SQLITE Finalize error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+ sinkID = sqlite3_last_insert_rowid(mDatabase);
+ }
+ sqlite3_finalize(query);
+ return E_OK;
}
-
-
am_Error_e DatabaseHandler::peekSource(const std::string & name, am_sourceID_t & sourceID)
{
- sqlite3_stmt* query=NULL, *queryInsert=NULL;
- std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
- int eCode=0, eCode1=0;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_text(query,1,name.c_str(),name.size(),SQLITE_STATIC);
- if ((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- sourceID=sqlite3_column_int(query,0);
- }
- else if (eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekSink database error!:"), DLT_INT(eCode))
- return E_DATABASE_ERROR;
- }
- else
- {
- if (mFirstStaticSource)
- {
- command= "INSERT INTO " + std::string(SOURCE_TABLE) + " (name,reserved,sourceID) VALUES (?,?," + i2s(DYNAMIC_ID_BOUNDARY) + ")";
- mFirstStaticSource=false;
- }
- else
- {
- command= "INSERT INTO " + std::string(SOURCE_TABLE) + " (name,reserved) VALUES (?,?)";
- }
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryInsert,NULL);
- sqlite3_bind_text(queryInsert,1,name.c_str(),name.size(),SQLITE_STATIC);
- sqlite3_bind_int(queryInsert,2,1); //reservation flag
- if((eCode1=sqlite3_step(queryInsert))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekSink SQLITE Step error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
-
- if((eCode1=sqlite3_finalize(queryInsert))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain SQLITE Finalize error code:"),DLT_INT(eCode1));
- return E_DATABASE_ERROR;
- }
- sourceID=sqlite3_last_insert_rowid(mDatabase);
- }
- sqlite3_finalize(query);
- return E_OK;
+ sqlite3_stmt* query = NULL, *queryInsert = NULL;
+ std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
+ int eCode = 0, eCode1 = 0;
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sourceID = sqlite3_column_int(query, 0);
+ }
+ else if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekSink database error!:"), DLT_INT(eCode))
+ return E_DATABASE_ERROR;
+ }
+ else
+ {
+ if (mFirstStaticSource)
+ {
+ command = "INSERT INTO " + std::string(SOURCE_TABLE) + " (name,reserved,sourceID) VALUES (?,?," + i2s(DYNAMIC_ID_BOUNDARY) + ")";
+ mFirstStaticSource = false;
+ }
+ else
+ {
+ command = "INSERT INTO " + std::string(SOURCE_TABLE) + " (name,reserved) VALUES (?,?)";
+ }
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryInsert, NULL);
+ sqlite3_bind_text(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC);
+ sqlite3_bind_int(queryInsert, 2, 1); //reservation flag
+ if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekSink SQLITE Step error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+
+ if ((eCode1 = sqlite3_finalize(queryInsert)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::peekDomain SQLITE Finalize error code:"), DLT_INT(eCode1));
+ return E_DATABASE_ERROR;
+ }
+ sourceID = sqlite3_last_insert_rowid(mDatabase);
+ }
+ sqlite3_finalize(query);
+ return E_OK;
}
am_Error_e DatabaseHandler::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
{
- assert(sinkID!=0);
+ assert(sinkID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSink(sinkID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(SINK_TABLE) + " SET volume=? WHERE sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, volume);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkVolume SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkVolume SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(SINK_TABLE) + " SET volume=? WHERE sinkID=" + i2s(sinkID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, volume);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkVolume SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkVolume SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkVolume changed volume of sink:"),DLT_INT(sinkID),DLT_STRING("to:"),DLT_INT(volume));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkVolume changed volume of sink:"), DLT_INT(sinkID), DLT_STRING("to:"), DLT_INT(volume));
- return E_OK;
+ return E_OK;
}
am_Error_e DatabaseHandler::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
{
- assert(sourceID!=0);
+ assert(sourceID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSource(sourceID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(SOURCE_TABLE) + " SET volume=? WHERE sourceID=" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, volume);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceVolume SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceVolume SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (!existSource(sourceID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(SOURCE_TABLE) + " SET volume=? WHERE sourceID=" + i2s(sourceID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, volume);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceVolume SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceVolume SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSourceVolume changed volume of source=:"),DLT_INT(sourceID),DLT_STRING("to:"),DLT_INT(volume));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSourceVolume changed volume of source=:"), DLT_INT(sourceID), DLT_STRING("to:"), DLT_INT(volume));
- return E_OK;
+ return E_OK;
}
am_Error_e DatabaseHandler::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
- //todo: add checks if soundproperty exists!
- assert(sourceID!=0);
+ //todo: add checks if soundproperty exists!
+ assert(sourceID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSource(sourceID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE SourceSoundProperty" + i2s(sourceID)+ " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, soundProperty.value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceSoundPropertyDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (!existSource(sourceID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE SourceSoundProperty" + i2s(sourceID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, soundProperty.value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceSoundPropertyDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceSoundPropertyDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSourceSoundPropertyDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSourceSoundPropertyDB changed SourceSoundProperty of source:"),DLT_INT(sourceID),DLT_STRING("type:"),DLT_INT(soundProperty.type),DLT_STRING("to:"),DLT_INT(soundProperty.value));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSourceSoundPropertyDB changed SourceSoundProperty of source:"), DLT_INT(sourceID), DLT_STRING("type:"), DLT_INT(soundProperty.type), DLT_STRING("to:"), DLT_INT(soundProperty.value));
- return E_OK;
+ return E_OK;
}
am_Error_e DatabaseHandler::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
- //todo: add checks if soundproperty exists!
- assert(sinkID!=0);
+ //todo: add checks if soundproperty exists!
+ assert(sinkID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existSink(sinkID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE SinkSoundProperty" + i2s(sinkID)+ " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, soundProperty.value);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkSoundPropertyDB SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- } assert(sinkID!=0);
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE SinkSoundProperty" + i2s(sinkID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, soundProperty.value);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkSoundPropertyDB SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }assert(sinkID!=0);
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkSoundPropertyDB SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeSinkSoundPropertyDB SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkSoundPropertyDB changed MainSinkSoundProperty of sink:"),DLT_INT(sinkID),DLT_STRING("type:"),DLT_INT(soundProperty.type),DLT_STRING("to:"),DLT_INT(soundProperty.value));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkSoundPropertyDB changed MainSinkSoundProperty of sink:"), DLT_INT(sinkID), DLT_STRING("type:"), DLT_INT(soundProperty.type), DLT_STRING("to:"), DLT_INT(soundProperty.value));
- return E_OK;
+ return E_OK;
}
am_Error_e DatabaseHandler::changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
{
- assert(crossfaderID!=0);
+ assert(crossfaderID!=0);
- sqlite3_stmt* query=NULL;
- int eCode=0;
- std::string command;
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ std::string command;
- if (!existcrossFader(crossfaderID))
- {
- return E_NON_EXISTENT;
- }
- command = "UPDATE " + std::string(CROSSFADER_TABLE) + " SET hotsink=? WHERE crossfaderID=" + i2s(crossfaderID);
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- sqlite3_bind_int(query,1, hotsink);
- if((eCode=sqlite3_step(query))!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeCrossFaderHotSink SQLITE Step error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeCrossFaderHotSink SQLITE Finalize error code:"),DLT_INT(eCode));
- return E_DATABASE_ERROR;
- }
+ if (!existcrossFader(crossfaderID))
+ {
+ return E_NON_EXISTENT;
+ }
+ command = "UPDATE " + std::string(CROSSFADER_TABLE) + " SET hotsink=? WHERE crossfaderID=" + i2s(crossfaderID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_bind_int(query, 1, hotsink);
+ if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeCrossFaderHotSink SQLITE Step error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::changeCrossFaderHotSink SQLITE Finalize error code:"), DLT_INT(eCode));
+ return E_DATABASE_ERROR;
+ }
- DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeCrossFaderHotSink changed hotsink of crossfader="),DLT_INT(crossfaderID),DLT_STRING("to:"),DLT_INT(hotsink));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeCrossFaderHotSink changed hotsink of crossfader="), DLT_INT(crossfaderID), DLT_STRING("to:"), DLT_INT(hotsink));
- return E_OK;
+ return E_OK;
}
am_Error_e am::DatabaseHandler::getRoutingTree(bool onlyfree, RoutingTree *tree, std::vector<RoutingTreeItem*> *flatTree)
{
- sqlite3_stmt* query=NULL;
- int eCode=0;
- size_t i=0;
- std::string command;
- am_domainID_t rootID = tree->returnRootDomainID();
- RoutingTreeItem *parent = tree->returnRootItem();
-
- command="SELECT domainSourceID,gatewayID FROM " + std::string(GATEWAY_TABLE)+ " WHERE domainSinkID=? AND IsBlocked=?";
-
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- do {
- sqlite3_bind_int(query,1, rootID);
- sqlite3_bind_int(query,2, onlyfree);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
- {
- flatTree->push_back(tree->insertItem(sqlite3_column_int(query,0),sqlite3_column_int(query,1),parent));
- }
-
- if(eCode!=SQLITE_DONE)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getRoutingTree SQLITE error code:"),DLT_INT(eCode));
- return (E_DATABASE_ERROR);
- }
- parent = flatTree->at(i);
- rootID = parent->returnDomainID();
- i++;
- } while (flatTree->size() > i);
-
- if((eCode=sqlite3_finalize(query))!=SQLITE_OK)
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getRoutingTree SQLITE Finalize error code:"),DLT_INT(eCode));
- return (E_DATABASE_ERROR);
- }
-
- return (E_OK);
+ sqlite3_stmt* query = NULL;
+ int eCode = 0;
+ size_t i = 0;
+ std::string command;
+ am_domainID_t rootID = tree->returnRootDomainID();
+ RoutingTreeItem *parent = tree->returnRootItem();
+
+ command = "SELECT domainSourceID,gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE domainSinkID=? AND inUse=?";
+
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ do
+ {
+ sqlite3_bind_int(query, 1, rootID);
+ sqlite3_bind_int(query, 2, onlyfree);
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ flatTree->push_back(tree->insertItem(sqlite3_column_int(query, 0), sqlite3_column_int(query, 1), parent));
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getRoutingTree SQLITE error code:"), DLT_INT(eCode));
+ return (E_DATABASE_ERROR);
+ }
+ parent = flatTree->at(i);
+ rootID = parent->returnDomainID();
+ i++;
+ } while (flatTree->size() > i);
+
+ if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::getRoutingTree SQLITE Finalize error code:"), DLT_INT(eCode));
+ return (E_DATABASE_ERROR);
+ }
+
+ return (E_OK);
}
void DatabaseHandler::createTables()
{
- for(uint16_t i=0;i<sizeof(databaseTables)/sizeof(databaseTables[0]);i++)
- {
- assert(sqQuery("CREATE TABLE " + databaseTables[i]));
- }
+ for (uint16_t i = 0; i < sizeof(databaseTables) / sizeof(databaseTables[0]); i++)
+ {
+ assert(sqQuery("CREATE TABLE " + databaseTables[i]));
+ }
}
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/DatabaseObserver.cpp b/AudioManagerDaemon/src/DatabaseObserver.cpp
index 63f3b02..b09aee8 100644
--- a/AudioManagerDaemon/src/DatabaseObserver.cpp
+++ b/AudioManagerDaemon/src/DatabaseObserver.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file DatabaseObserver.cpp
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager 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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file DatabaseObserver.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager 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 "DatabaseObserver.h"
#include "CommandSender.h"
@@ -30,193 +30,141 @@
using namespace am;
-DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender)
- :mCommandSender(iCommandSender),
- mRoutingSender(iRoutingSender)
+DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender) :
+ mCommandSender(iCommandSender), //
+ mRoutingSender(iRoutingSender)
{
- assert(mCommandSender!=0);
- assert(mRoutingSender!=0);
+ assert(mCommandSender!=0);
+ assert(mRoutingSender!=0);
}
-DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, TelnetServer *iTelnetServer)
- :mCommandSender(iCommandSender),
- mRoutingSender(iRoutingSender),
- mTelnetServer(iTelnetServer)
+DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender, TelnetServer *iTelnetServer) :
+ mCommandSender(iCommandSender), //
+ mRoutingSender(iRoutingSender), //
+ mTelnetServer(iTelnetServer)
{
- assert(mCommandSender!=0);
- assert(mRoutingSender!=0);
- assert(mTelnetServer!=0);
+ assert(mCommandSender!=0);
+ assert(mRoutingSender!=0);
+ assert(mTelnetServer!=0);
}
-DatabaseObserver::~DatabaseObserver() {
- // TODO Auto-generated destructor stub
+DatabaseObserver::~DatabaseObserver()
+{
+ // TODO Auto-generated destructor stub
}
void DatabaseObserver::newSink(am_Sink_s sink)
{
- mRoutingSender->addSinkLookup(sink);
- mCommandSender->cbNumberOfSinksChanged();
+ mRoutingSender->addSinkLookup(sink);
+ mCommandSender->cbNumberOfSinksChanged();
}
-
-
void DatabaseObserver::newSource(am_Source_s source)
{
- mRoutingSender->addSourceLookup(source);
- mCommandSender->cbNumberOfSourcesChanged();
+ mRoutingSender->addSourceLookup(source);
+ mCommandSender->cbNumberOfSourcesChanged();
}
-
-
void DatabaseObserver::newDomain(am_Domain_s domain)
{
- mRoutingSender->addDomainLookup(domain);
+ mRoutingSender->addDomainLookup(domain);
}
-
-
void DatabaseObserver::newGateway(am_Gateway_s gateway)
{
- //todo: implement something
+ //todo: implement something
}
-
-
void DatabaseObserver::newCrossfader(am_Crossfader_s crossfader)
{
- mRoutingSender->addCrossfaderLookup(crossfader);
+ mRoutingSender->addCrossfaderLookup(crossfader);
}
-
-
void DatabaseObserver::removedSink(am_sinkID_t sinkID)
{
- mRoutingSender->removeSinkLookup(sinkID);
- mCommandSender->cbNumberOfSinksChanged();
+ mRoutingSender->removeSinkLookup(sinkID);
+ mCommandSender->cbNumberOfSinksChanged();
}
-
-
void DatabaseObserver::removedSource(am_sourceID_t sourceID)
{
- mRoutingSender->removeSourceLookup(sourceID);
- mCommandSender->cbNumberOfSourcesChanged();
+ mRoutingSender->removeSourceLookup(sourceID);
+ mCommandSender->cbNumberOfSourcesChanged();
}
-
-
void DatabaseObserver::removeDomain(am_domainID_t domainID)
{
- mRoutingSender->removeDomainLookup(domainID);
+ mRoutingSender->removeDomainLookup(domainID);
}
-
-
void DatabaseObserver::removeGateway(am_gatewayID_t gatewayID)
{
- //todo: implement something
+ //todo: implement something
}
-
-
void DatabaseObserver::removeCrossfader(am_crossfaderID_t crossfaderID)
{
- mRoutingSender->removeCrossfaderLookup(crossfaderID);
+ mRoutingSender->removeCrossfaderLookup(crossfaderID);
}
-
void DatabaseObserver::numberOfMainConnectionsChanged()
{
- mCommandSender->cbNumberOfMainConnectionsChanged();
+ mCommandSender->cbNumberOfMainConnectionsChanged();
}
void DatabaseObserver::numberOfSinkClassesChanged()
{
- mCommandSender->cbNumberOfSinkClassesChanged();
+ mCommandSender->cbNumberOfSinkClassesChanged();
}
-
-
void DatabaseObserver::numberOfSourceClassesChanged()
{
- mCommandSender->cbNumberOfSourceClassesChanged();
+ mCommandSender->cbNumberOfSourceClassesChanged();
}
-
-
void DatabaseObserver::mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
{
- mCommandSender->cbMainConnectionStateChanged(connectionID,connectionState);
+ mCommandSender->cbMainConnectionStateChanged(connectionID, connectionState);
}
-
-
void DatabaseObserver::mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty)
{
- mCommandSender->cbMainSinkSoundPropertyChanged(sinkID,SoundProperty);
+ mCommandSender->cbMainSinkSoundPropertyChanged(sinkID, SoundProperty);
}
-
-
void DatabaseObserver::mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
{
- mCommandSender->cbMainSourceSoundPropertyChanged(sourceID,SoundProperty);
+ mCommandSender->cbMainSourceSoundPropertyChanged(sourceID, SoundProperty);
}
-
-
void DatabaseObserver::sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
- mCommandSender->cbSinkAvailabilityChanged(sinkID,availability);
+ mCommandSender->cbSinkAvailabilityChanged(sinkID, availability);
}
-
-
void DatabaseObserver::sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
- mCommandSender->cbSourceAvailabilityChanged(sourceID,availability);
+ mCommandSender->cbSourceAvailabilityChanged(sourceID, availability);
}
-
-
void DatabaseObserver::volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
- mCommandSender->cbVolumeChanged(sinkID,volume);
+ mCommandSender->cbVolumeChanged(sinkID, volume);
}
-
-
void DatabaseObserver::sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
- mCommandSender->cbSinkMuteStateChanged(sinkID,muteState);
+ mCommandSender->cbSinkMuteStateChanged(sinkID, muteState);
}
-
-
void DatabaseObserver::systemPropertyChanged(const am_SystemProperty_s & SystemProperty)
{
- mCommandSender->cbSystemPropertyChanged(SystemProperty);
+ mCommandSender->cbSystemPropertyChanged(SystemProperty);
}
-
-
void DatabaseObserver::timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
{
- mCommandSender->cbTimingInformationChanged(mainConnection,time);
- //todo:inform the controller via controlsender
+ mCommandSender->cbTimingInformationChanged(mainConnection, time);
+ //todo:inform the controller via controlsender
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/RoutingReceiver.cpp b/AudioManagerDaemon/src/RoutingReceiver.cpp
index 93fd925..9a7263d 100644
--- a/AudioManagerDaemon/src/RoutingReceiver.cpp
+++ b/AudioManagerDaemon/src/RoutingReceiver.cpp
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file RoutingReceiver.cpp
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section LicenseRoutingReceiver.h
-*
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* 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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file RoutingReceiver.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section LicenseRoutingReceiver.h
+ *
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * 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 "RoutingReceiver.h"
#include <SocketHandler.h>
@@ -35,388 +35,322 @@
using namespace am;
-am::RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler)
- :mDatabaseHandler(iDatabaseHandler),
- mRoutingSender(iRoutingSender),
- mControlSender(iControlSender),
- mSocketHandler(iSocketHandler)
+am::RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler) :
+ mDatabaseHandler(iDatabaseHandler), //
+ mRoutingSender(iRoutingSender), //
+ mControlSender(iControlSender), //
+ mSocketHandler(iSocketHandler) //
{
-assert(mDatabaseHandler!=NULL);
-assert(mRoutingSender!=NULL);
-assert(mControlSender!=NULL);
-assert(mSocketHandler!=NULL);
+ assert(mDatabaseHandler!=NULL);
+ assert(mRoutingSender!=NULL);
+ assert(mControlSender!=NULL);
+ assert(mSocketHandler!=NULL);
}
-am::RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, DBusWrapper *iDBusWrapper)
- :mDatabaseHandler(iDatabaseHandler),
- mRoutingSender(iRoutingSender),
- mControlSender(iControlSender),
- mDBusWrapper(iDBusWrapper)
+am::RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, DBusWrapper *iDBusWrapper) :
+ mDatabaseHandler(iDatabaseHandler), //
+ mRoutingSender(iRoutingSender), //
+ mControlSender(iControlSender), //
+ mDBusWrapper(iDBusWrapper) //
{
-assert(mDatabaseHandler!=NULL);
-assert(mRoutingSender!=NULL);
-assert(mControlSender!=NULL);
-assert(mDBusWrapper!=NULL);
+ assert(mDatabaseHandler!=NULL);
+ assert(mRoutingSender!=NULL);
+ assert(mControlSender!=NULL);
+ assert(mDBusWrapper!=NULL);
}
-am::RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper)
- :mDatabaseHandler(iDatabaseHandler),
- mRoutingSender(iRoutingSender),
- mControlSender(iControlSender),
- mSocketHandler(iSocketHandler),
- mDBusWrapper(iDBusWrapper)
+am::RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender, SocketHandler *iSocketHandler, DBusWrapper *iDBusWrapper) :
+ mDatabaseHandler(iDatabaseHandler), //
+ mRoutingSender(iRoutingSender), //
+ mControlSender(iControlSender), //
+ mSocketHandler(iSocketHandler), //
+ mDBusWrapper(iDBusWrapper) //
{
-assert(mDatabaseHandler!=NULL);
-assert(mRoutingSender!=NULL);
-assert(mControlSender!=NULL);
-assert(mSocketHandler!=NULL);
-assert(mDBusWrapper!=NULL);
+ assert(mDatabaseHandler!=NULL);
+ assert(mRoutingSender!=NULL);
+ assert(mControlSender!=NULL);
+ assert(mSocketHandler!=NULL);
+ assert(mDBusWrapper!=NULL);
}
-
-
RoutingReceiver::~RoutingReceiver()
{
}
-
-
void RoutingReceiver::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- mRoutingSender->removeHandle(handle);
- if (error==E_OK)
- {
- mDatabaseHandler->changeConnectionFinal(connectionID);
- }
- else
- {
- mDatabaseHandler->removeConnection(connectionID);
- }
- mControlSender->cbAckConnect(handle,error);
+ mRoutingSender->removeHandle(handle);
+ if (error == E_OK)
+ {
+ mDatabaseHandler->changeConnectionFinal(connectionID);
+ }
+ else
+ {
+ mDatabaseHandler->removeConnection(connectionID);
+ }
+ mControlSender->cbAckConnect(handle, error);
}
-
-
void RoutingReceiver::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- mRoutingSender->removeHandle(handle);
- if (error==E_OK)
- {
- mDatabaseHandler->removeConnection(connectionID);
- }
- mControlSender->cbAckDisconnect(handle,error);
+ mRoutingSender->removeHandle(handle);
+ if (error == E_OK)
+ {
+ mDatabaseHandler->removeConnection(connectionID);
+ }
+ mControlSender->cbAckDisconnect(handle, error);
}
-
-
void RoutingReceiver::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- 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->changeSinkVolume(handleData.sinkID,volume);
- }
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSinkVolumeChange(handle,volume,error);
+ 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->changeSinkVolume(handleData.sinkID, volume);
+ }
+ mRoutingSender->removeHandle(handle);
+ mControlSender->cbAckSetSinkVolumeChange(handle, volume, error);
}
-
-
void RoutingReceiver::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- 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->changeSourceVolume(handleData.sourceID,volume);
- }
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSourceVolumeChange(handle,volume,error);
+ 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->changeSourceVolume(handleData.sourceID, volume);
+ }
+ mRoutingSender->removeHandle(handle);
+ mControlSender->cbAckSetSourceVolumeChange(handle, volume, error);
}
-
-
void RoutingReceiver::ackSetSourceState(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)
- {
- //todo: check if volume in handleData is same than volume. React to it.
- mDatabaseHandler->changeSourceState(handleData.sourceID,handleData.sourceState);
- }
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSourceState(handle,error);
+ 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->changeSourceState(handleData.sourceID, handleData.sourceState);
+ }
+ mRoutingSender->removeHandle(handle);
+ mControlSender->cbAckSetSourceState(handle, error);
}
-
-
void RoutingReceiver::ackSetSinkSoundProperty(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)
- {
- mDatabaseHandler->changeSinkSoundPropertyDB(handleData.soundPropery,handleData.sinkID);
- }
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSinkSoundProperty(handle,error);
+ RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ if (error == E_OK && handleData.sinkID != 0)
+ {
+ mDatabaseHandler->changeSinkSoundPropertyDB(handleData.soundPropery, handleData.sinkID);
+ }
+ mRoutingSender->removeHandle(handle);
+ mControlSender->cbAckSetSinkSoundProperty(handle, error);
}
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);
+ 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)
{
- RoutingSender::am_handleData_c handleData=mRoutingSender->returnHandleData(handle);
- if(error==E_OK && handleData.sourceID!=0)
- {
- mDatabaseHandler->changeSourceSoundPropertyDB(handleData.soundPropery,handleData.sourceID);
- }
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSourceSoundProperty(handle,error);
+ RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ if (error == E_OK && handleData.sourceID != 0)
+ {
+ mDatabaseHandler->changeSourceSoundPropertyDB(handleData.soundPropery, handleData.sourceID);
+ }
+ mRoutingSender->removeHandle(handle);
+ mControlSender->cbAckSetSourceSoundProperty(handle, error);
}
-
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);
+ 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)
{
- RoutingSender::am_handleData_c handleData=mRoutingSender->returnHandleData(handle);
- if(error==E_OK && handleData.crossfaderID!=0)
- {
- //todo: check if volume in handleData is same than volume. React to it.
- mDatabaseHandler->changeCrossFaderHotSink(handleData.crossfaderID,hotSink);
- }
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckCrossFade(handle,hotSink,error);
+ RoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ if (error == E_OK && handleData.crossfaderID != 0)
+ {
+ //todo: check if volume in handleData is same than volume. React to it.
+ mDatabaseHandler->changeCrossFaderHotSink(handleData.crossfaderID, hotSink);
+ }
+ mRoutingSender->removeHandle(handle);
+ mControlSender->cbAckCrossFade(handle, hotSink, error);
}
-
-
void RoutingReceiver::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
- mControlSender->hookSystemSourceVolumeTick(handle,sourceID,volume);
+ mControlSender->hookSystemSourceVolumeTick(handle, sourceID, volume);
}
-
-
void RoutingReceiver::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
- mControlSender->hookSystemSinkVolumeTick(handle,sinkID,volume);
+ mControlSender->hookSystemSinkVolumeTick(handle, sinkID, volume);
}
-
-
am_Error_e RoutingReceiver::peekDomain(const std::string & name, am_domainID_t & domainID)
{
- return mDatabaseHandler->peekDomain(name,domainID);
+ return mDatabaseHandler->peekDomain(name, domainID);
}
-
am_Error_e RoutingReceiver::registerDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- return mControlSender->hookSystemRegisterDomain(domainData,domainID);
+ return mControlSender->hookSystemRegisterDomain(domainData, domainID);
}
-
-
am_Error_e RoutingReceiver::deregisterDomain(const am_domainID_t domainID)
{
- return mControlSender->hookSystemDeregisterDomain(domainID);
+ return mControlSender->hookSystemDeregisterDomain(domainID);
}
-
-
am_Error_e RoutingReceiver::registerGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- return mControlSender->hookSystemRegisterGateway(gatewayData,gatewayID);
+ return mControlSender->hookSystemRegisterGateway(gatewayData, gatewayID);
}
-
-
am_Error_e RoutingReceiver::deregisterGateway(const am_gatewayID_t gatewayID)
{
- return mControlSender->hookSystemDeregisterGateway(gatewayID);
+ return mControlSender->hookSystemDeregisterGateway(gatewayID);
}
-
-
am_Error_e RoutingReceiver::peekSink(const std::string& name, am_sinkID_t & sinkID)
{
- return mDatabaseHandler->peekSink(name,sinkID);
+ return mDatabaseHandler->peekSink(name, sinkID);
}
-
-
am_Error_e RoutingReceiver::registerSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- return mControlSender->hookSystemRegisterSink(sinkData,sinkID);
+ return mControlSender->hookSystemRegisterSink(sinkData, sinkID);
}
-
-
am_Error_e RoutingReceiver::deregisterSink(const am_sinkID_t sinkID)
{
- return mControlSender->hookSystemDeregisterSink(sinkID);
+ return mControlSender->hookSystemDeregisterSink(sinkID);
}
-
-
am_Error_e RoutingReceiver::peekSource(const std::string & name, am_sourceID_t & sourceID)
{
- return mDatabaseHandler->peekSource(name,sourceID);
+ return mDatabaseHandler->peekSource(name, sourceID);
}
-
-
am_Error_e RoutingReceiver::registerSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- return mControlSender->hookSystemRegisterSource(sourceData,sourceID);
+ return mControlSender->hookSystemRegisterSource(sourceData, sourceID);
}
-
-
am_Error_e RoutingReceiver::deregisterSource(const am_sourceID_t sourceID)
{
- return mControlSender->hookSystemDeregisterSource(sourceID);
+ return mControlSender->hookSystemDeregisterSource(sourceID);
}
-
-
am_Error_e RoutingReceiver::registerCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- return mControlSender->hookSystemRegisterCrossfader(crossfaderData,crossfaderID);
+ return mControlSender->hookSystemRegisterCrossfader(crossfaderData, crossfaderID);
}
-
-
am_Error_e RoutingReceiver::deregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
- return mControlSender->hookSystemDeregisterCrossfader(crossfaderID);
+ return mControlSender->hookSystemDeregisterCrossfader(crossfaderID);
}
-
-
void RoutingReceiver::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
- return mControlSender->hookSystemInterruptStateChange(sourceID,interruptState);
+ return mControlSender->hookSystemInterruptStateChange(sourceID, interruptState);
}
-
-
void RoutingReceiver::hookDomainRegistrationComplete(const am_domainID_t domainID)
{
- mControlSender->hookSystemDomainRegistrationComplete(domainID);
+ mControlSender->hookSystemDomainRegistrationComplete(domainID);
}
-
-
void RoutingReceiver::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
- mControlSender->hookSystemSinkAvailablityStateChange(sinkID,availability);
+ mControlSender->hookSystemSinkAvailablityStateChange(sinkID, availability);
}
-
-
void RoutingReceiver::hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
- mControlSender->hookSystemSourceAvailablityStateChange(sourceID,availability);
+ mControlSender->hookSystemSourceAvailablityStateChange(sourceID, availability);
}
-
-
void RoutingReceiver::hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- mControlSender->hookSystemDomainStateChange(domainID,domainState);
+ mControlSender->hookSystemDomainStateChange(domainID, domainState);
}
-
-
void RoutingReceiver::hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
- mDatabaseHandler->changeConnectionTimingInformation(connectionID,delay);
+ mDatabaseHandler->changeConnectionTimingInformation(connectionID, delay);
}
-
-
am_Error_e RoutingReceiver::sendChangedData(const std::vector<am_EarlyData_s> & earlyData)
{
- mControlSender->hookSystemReceiveEarlyData(earlyData);
- return E_OK;
- //todo: change return type to void in EA model
+ mControlSender->hookSystemReceiveEarlyData(earlyData);
+ return E_OK;
+//todo: change return type to void in EA model
}
-
-
am_Error_e RoutingReceiver::peekSinkClassID(const std::string name, const am_sinkClass_t& sinkClassID)
{
- //todo: implement
- return E_NOT_USED;
+//todo: implement
+ return E_NOT_USED;
}
am_Error_e RoutingReceiver::peekSourceClassID(const std::string name, const am_sourceClass_t& sourceClassID)
{
- //todo: implement
- return E_NOT_USED;
+//todo: implement
+ return E_NOT_USED;
}
am_Error_e RoutingReceiver::getDBusConnectionWrapper(DBusWrapper *& dbusConnectionWrapper) const
{
#ifdef WITH_DBUS_WRAPPER
- dbusConnectionWrapper=mDBusWrapper;
- return E_OK;
+ dbusConnectionWrapper = mDBusWrapper;
+ return E_OK;
#else
- return E_UNKNOWN;
+ return E_UNKNOWN;
#endif
}
-
am_Error_e RoutingReceiver::getSocketHandler(SocketHandler *& socketHandler) const
{
#ifdef WITH_SOCKETHANDLER_LOOP
- socketHandler=mSocketHandler;
- return E_OK;
+ socketHandler = mSocketHandler;
+ return E_OK;
#else
- return E_UNKNOWN;
+ return E_UNKNOWN;
#endif
}
uint16_t RoutingReceiver::getInterfaceVersion() const
{
- return RoutingReceiveVersion;
+ return RoutingReceiveVersion;
}
-
-
-
-
diff --git a/AudioManagerDaemon/src/RoutingSender.cpp b/AudioManagerDaemon/src/RoutingSender.cpp
index 46263ec..acdb32f 100644
--- a/AudioManagerDaemon/src/RoutingSender.cpp
+++ b/AudioManagerDaemon/src/RoutingSender.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file RoutingSender.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file RoutingSender.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.
+ *
+ */
#include "RoutingSender.h"
#include <utility>
@@ -37,63 +37,62 @@ using namespace am;
#define CALL_ALL_INTERFACES(...) \
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin(); \
std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end(); \
- for (; iter<iterEnd;++iter) \
+ for (; iter<iterEnd;++iter) \
{ \
(*iter).routingInterface->__VA_ARGS__; \
}
-RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirectories)
-
- :mHandleCount(0),
- mlistActiveHandles(),
- mListInterfaces(),
- mMapConnectionInterface(),
- mMapCrossfaderInterface(),
- mMapDomainInterface(),
- mMapSinkInterface(),
- mMapSourceInterface(),
- mMapHandleInterface()
-{
- std::vector<std::string> sharedLibraryNameList;
+RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirectories) :
+ mHandleCount(0), //
+ mlistActiveHandles(), //
+ mListInterfaces(), //
+ mMapConnectionInterface(), //
+ mMapCrossfaderInterface(), //
+ mMapDomainInterface(), //
+ mMapSinkInterface(), //
+ mMapSourceInterface(), //
+ mMapHandleInterface() //
+{
+ std::vector<std::string> sharedLibraryNameList;
std::vector<std::string>::const_iterator dirIter = listOfPluginDirectories.begin();
std::vector<std::string>::const_iterator dirIterEnd = listOfPluginDirectories.end();
// search communicator plugins in configured directories
for (; dirIter < dirIterEnd; ++dirIter)
{
- const char* directoryName = dirIter->c_str();
- //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Searching for HookPlugins in"),DLT_STRING(directoryName));
- DIR *directory = opendir(directoryName);
-
- if (!directory)
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("RoutingSender::RoutingSender Error opening directory "),DLT_STRING(directoryName));
- continue;
- }
+ const char* directoryName = dirIter->c_str();
+ //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Searching for HookPlugins in"),DLT_STRING(directoryName));
+ DIR *directory = opendir(directoryName);
+
+ if (!directory)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("RoutingSender::RoutingSender Error opening directory "), DLT_STRING(directoryName));
+ continue;
+ }
// iterate content of directory
struct dirent *itemInDirectory = 0;
while ((itemInDirectory = readdir(directory)))
{
- unsigned char entryType = itemInDirectory->d_type;
- std::string entryName = itemInDirectory->d_name;
-
- bool regularFile = (entryType == DT_REG || entryType == DT_LNK);
- bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1));
-
- if (regularFile && sharedLibExtension)
- {
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingSender::RoutingSender adding file "),DLT_STRING(entryName.c_str()));
- std::string name(directoryName);
- sharedLibraryNameList.push_back(name + "/" + entryName);
- }
- else
- {
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingSender::RoutingSender PluginSearch ignoring file "),DLT_STRING(entryName.c_str()));
- }
+ unsigned char entryType = itemInDirectory->d_type;
+ std::string entryName = itemInDirectory->d_name;
+
+ bool regularFile = (entryType == DT_REG || entryType == DT_LNK);
+ bool sharedLibExtension = ("so" == entryName.substr(entryName.find_last_of(".") + 1));
+
+ if (regularFile && sharedLibExtension)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("RoutingSender::RoutingSender adding file "), DLT_STRING(entryName.c_str()));
+ std::string name(directoryName);
+ sharedLibraryNameList.push_back(name + "/" + entryName);
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("RoutingSender::RoutingSender PluginSearch ignoring file "), DLT_STRING(entryName.c_str()));
+ }
}
- closedir(directory);
+ closedir(directory);
}
// iterate all communicator plugins and start them
@@ -102,15 +101,15 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
for (; iter != iterEnd; ++iter)
{
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingSender::RoutingSender try loading "),DLT_STRING(iter->c_str()));
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("RoutingSender::RoutingSender try loading "), DLT_STRING(iter->c_str()));
- RoutingSendInterface* (*createFunc)();
- void* tempLibHandle=NULL;
- createFunc = getCreateFunction<RoutingSendInterface*()>(*iter,tempLibHandle);
+ RoutingSendInterface* (*createFunc)();
+ void* tempLibHandle = NULL;
+ createFunc = getCreateFunction<RoutingSendInterface*()>(*iter, tempLibHandle);
if (!createFunc)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("RoutingSender::RoutingSender Entry point of RoutingPlugin not found"));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("RoutingSender::RoutingSender Entry point of RoutingPlugin not found"));
continue;
}
@@ -118,7 +117,7 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
if (!router)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("RoutingSender::RoutingSender RoutingPlugin initialization failed. Entry Function not callable"));
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("RoutingSender::RoutingSender RoutingPlugin initialization failed. Entry Function not callable"));
continue;
}
@@ -126,13 +125,12 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
routerInterface.routingInterface = router;
//check libversion
- if (router->getInterfaceVersion()<REQUIRED_INTERFACE_VERSION)
+ if (router->getInterfaceVersion() < REQUIRED_INTERFACE_VERSION)
{
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("RoutingSender::RoutingSender RoutingPlugin initialization failed. Version of Interface to old"));
- continue;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("RoutingSender::RoutingSender 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());
@@ -143,275 +141,253 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
RoutingSender::~RoutingSender()
{
- unloadLibraries();
- HandlesMap::iterator it=mlistActiveHandles.begin();
+ 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;
- }
- }
+ //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()
{
- CALL_ALL_INTERFACES(routingInterfacesReady())
+ CALL_ALL_INTERFACES(routingInterfacesReady())
}
void RoutingSender::routingInterfacesRundown()
{
- CALL_ALL_INTERFACES(routingInterfacesRundown())
+ CALL_ALL_INTERFACES(routingInterfacesRundown())
}
void RoutingSender::startupRoutingInterface(RoutingReceiveInterface *routingreceiveinterface)
{
- CALL_ALL_INTERFACES(startupRoutingInterface(routingreceiveinterface))
+ CALL_ALL_INTERFACES(startupRoutingInterface(routingreceiveinterface))
}
am_Error_e RoutingSender::asyncAbort(const am_Handle_s& handle)
{
- HandleInterfaceMap::iterator iter = mMapHandleInterface.begin();
- iter=mMapHandleInterface.find(handle.handle);
+ HandleInterfaceMap::iterator iter = mMapHandleInterface.begin();
+ iter = mMapHandleInterface.find(handle.handle);
if (iter != mMapHandleInterface.end())
{
- return iter->second->asyncAbort(handle);
+ return iter->second->asyncAbort(handle);
}
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::asyncConnect(am_Handle_s& handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
{
- am_handleData_c handleData;
- SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
- iter=mMapSinkInterface.find(sinkID);
+ am_handleData_c handleData;
+ SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
+ iter = mMapSinkInterface.find(sinkID);
if (iter != mMapSinkInterface.end())
{
- handleData.connectionID=connectionID;
- handle=createHandle(handleData,H_CONNECT);
- mMapConnectionInterface.insert(std::make_pair(connectionID,iter->second));
- mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
- return iter->second->asyncConnect(handle,connectionID,sourceID,sinkID,connectionFormat);
+ handleData.connectionID = connectionID;
+ handle = createHandle(handleData, H_CONNECT);
+ mMapConnectionInterface.insert(std::make_pair(connectionID, iter->second));
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncConnect(handle, connectionID, sourceID, sinkID, connectionFormat);
}
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::asyncDisconnect(am_Handle_s& handle, const am_connectionID_t connectionID)
{
- am_handleData_c handleData;
- ConnectionInterfaceMap::iterator iter = mMapConnectionInterface.begin();
- mMapConnectionInterface.find(connectionID);
+ am_handleData_c handleData;
+ ConnectionInterfaceMap::iterator iter = mMapConnectionInterface.begin();
+ mMapConnectionInterface.find(connectionID);
if (iter != mMapConnectionInterface.end())
{
- handleData.connectionID=connectionID;
- handle=createHandle(handleData,H_DISCONNECT);
- mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
- am_Error_e returnVal=iter->second->asyncDisconnect(handle,connectionID);
- mMapConnectionInterface.erase(iter);
- return returnVal;
+ handleData.connectionID = connectionID;
+ handle = createHandle(handleData, H_DISCONNECT);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ am_Error_e returnVal = iter->second->asyncDisconnect(handle, connectionID);
+ mMapConnectionInterface.erase(iter);
+ return returnVal;
}
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::asyncSetSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
- am_handleData_c handleData;
- SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
- iter=mMapSinkInterface.find(sinkID);
+ am_handleData_c handleData;
+ SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
+ iter = mMapSinkInterface.find(sinkID);
if (iter != mMapSinkInterface.end())
- handleData.sinkID=sinkID;
- handleData.volume=volume;
- handle=createHandle(handleData,H_SETSINKVOLUME);
- mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
- return iter->second->asyncSetSinkVolume(handle,sinkID,volume,ramp,time);
+ handleData.sinkID = sinkID;
+ handleData.volume = volume;
+ handle = createHandle(handleData, H_SETSINKVOLUME);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSinkVolume(handle, sinkID, volume, ramp, time);
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::asyncSetSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
- am_handleData_c handleData;
- SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
- iter=mMapSourceInterface.find(sourceID);
+ am_handleData_c handleData;
+ SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
+ iter = mMapSourceInterface.find(sourceID);
if (iter != mMapSourceInterface.end())
- handleData.sourceID=sourceID;
- handleData.volume=volume;
- handle=createHandle(handleData,H_SETSOURCEVOLUME);
- mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
- return iter->second->asyncSetSourceVolume(handle,sourceID,volume,ramp,time);
+ handleData.sourceID = sourceID;
+ handleData.volume = volume;
+ handle = createHandle(handleData, H_SETSOURCEVOLUME);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSourceVolume(handle, sourceID, volume, ramp, time);
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::asyncSetSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
- am_handleData_c handleData;
- SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
- iter=mMapSourceInterface.find(sourceID);
+ am_handleData_c handleData;
+ SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
+ iter = mMapSourceInterface.find(sourceID);
if (iter != mMapSourceInterface.end())
- handleData.sourceID=sourceID;
- handleData.sourceState=state;
- handle=createHandle(handleData,H_SETSOURCESTATE);
- mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
- return iter->second->asyncSetSourceState(handle,sourceID,state);
+ handleData.sourceID = sourceID;
+ handleData.sourceState = state;
+ handle = createHandle(handleData, H_SETSOURCESTATE);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSourceState(handle, sourceID, state);
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
- am_handleData_c handleData;
- SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
- iter=mMapSinkInterface.find(sinkID);
+ am_handleData_c handleData;
+ SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
+ iter = mMapSinkInterface.find(sinkID);
if (iter != mMapSinkInterface.end())
- handleData.sinkID=sinkID;
- handleData.soundPropery=soundProperty;
- handle=createHandle(handleData,H_SETSINKSOUNDPROPERTY);
- mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
- return iter->second->asyncSetSinkSoundProperty(handle,soundProperty,sinkID);
+ handleData.sinkID = sinkID;
+ handleData.soundPropery = soundProperty;
+ handle = createHandle(handleData, H_SETSINKSOUNDPROPERTY);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSinkSoundProperty(handle, soundProperty, sinkID);
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;
- SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
- iter=mMapSourceInterface.find(sourceID);
+ am_handleData_c handleData;
+ SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
+ iter = mMapSourceInterface.find(sourceID);
if (iter != mMapSourceInterface.end())
- handleData.sourceID=sourceID;
- handleData.soundPropery=soundProperty;
- handle=createHandle(handleData,H_SETSOURCESOUNDPROPERTY);
- mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
- return iter->second->asyncSetSourceSoundProperty(handle,soundProperty,sourceID);
+ handleData.sourceID = sourceID;
+ handleData.soundPropery = soundProperty;
+ handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTY);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncSetSourceSoundProperty(handle, soundProperty, sourceID);
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);
+ 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);
+ 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);
+ 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);
+ 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;
- CrossfaderInterfaceMap::iterator iter = mMapCrossfaderInterface.begin();
- iter=mMapCrossfaderInterface.find(crossfaderID);
+ am_handleData_c handleData;
+ CrossfaderInterfaceMap::iterator iter = mMapCrossfaderInterface.begin();
+ iter = mMapCrossfaderInterface.find(crossfaderID);
if (iter != mMapCrossfaderInterface.end())
- handleData.crossfaderID=crossfaderID;
- handleData.hotSink=hotSink;
- handle=createHandle(handleData,H_CROSSFADE);
- mMapHandleInterface.insert(std::make_pair(handle.handle,iter->second));
- return iter->second->asyncCrossFade(handle,crossfaderID,hotSink,rampType,time);
+ handleData.crossfaderID = crossfaderID;
+ handleData.hotSink = hotSink;
+ handle = createHandle(handleData, H_CROSSFADE);
+ mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
+ return iter->second->asyncCrossFade(handle, crossfaderID, hotSink, rampType, time);
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
- iter=mMapDomainInterface.find(domainID);
+ DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
+ iter = mMapDomainInterface.find(domainID);
if (iter != mMapDomainInterface.end())
- return iter->second->setDomainState(domainID,domainState);
+ return iter->second->setDomainState(domainID, domainState);
return E_NON_EXISTENT;
}
am_Error_e RoutingSender::addDomainLookup(const am_Domain_s& domainData)
{
- std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
- std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end();
- for (; iter<iterEnd;++iter)
- {
- if((*iter).busName.compare(domainData.busname) == 0)
- {
- mMapDomainInterface.insert(std::make_pair(domainData.domainID,(*iter).routingInterface));
- return E_OK;
- }
- }
+ std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
+ std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end();
+ for (; iter < iterEnd; ++iter)
+ {
+ if ((*iter).busName.compare(domainData.busname) == 0)
+ {
+ mMapDomainInterface.insert(std::make_pair(domainData.domainID, (*iter).routingInterface));
+ return E_OK;
+ }
+ }
- return E_UNKNOWN;
+ return E_UNKNOWN;
}
-
-
am_Error_e RoutingSender::addSourceLookup(const am_Source_s& sourceData)
{
- DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
- iter=mMapDomainInterface.find(sourceData.domainID);
+ DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
+ iter = mMapDomainInterface.find(sourceData.domainID);
if (iter != mMapDomainInterface.end())
{
- mMapSourceInterface.insert(std::make_pair(sourceData.sourceID,iter->second));
- return E_OK;
+ mMapSourceInterface.insert(std::make_pair(sourceData.sourceID, iter->second));
+ return E_OK;
}
return E_UNKNOWN;
}
-
-
am_Error_e RoutingSender::addSinkLookup(const am_Sink_s& sinkData)
{
- DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
- iter=mMapDomainInterface.find(sinkData.domainID);
+ DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
+ iter = mMapDomainInterface.find(sinkData.domainID);
if (iter != mMapDomainInterface.end())
{
- mMapSinkInterface.insert(std::make_pair(sinkData.sinkID,iter->second));
- return E_OK;
+ mMapSinkInterface.insert(std::make_pair(sinkData.sinkID, iter->second));
+ return E_OK;
}
return E_UNKNOWN;
}
-
-
am_Error_e RoutingSender::addCrossfaderLookup(const am_Crossfader_s& crossfaderData)
{
- DomainInterfaceMap::iterator iter = mMapSourceInterface.begin();
- iter=mMapSourceInterface.find(crossfaderData.sourceID);
+ DomainInterfaceMap::iterator iter = mMapSourceInterface.begin();
+ iter = mMapSourceInterface.find(crossfaderData.sourceID);
if (iter != mMapSourceInterface.end())
{
- mMapSourceInterface.insert(std::make_pair(crossfaderData.crossfaderID,iter->second));
- return E_OK;
+ mMapSourceInterface.insert(std::make_pair(crossfaderData.crossfaderID, iter->second));
+ return E_OK;
}
return E_UNKNOWN;
@@ -419,133 +395,112 @@ am_Error_e RoutingSender::addCrossfaderLookup(const am_Crossfader_s& crossfaderD
am_Error_e RoutingSender::removeDomainLookup(const am_domainID_t domainID)
{
- DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
- iter=mMapDomainInterface.find(domainID);
+ DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
+ iter = mMapDomainInterface.find(domainID);
if (iter != mMapDomainInterface.end())
{
- mMapDomainInterface.erase(iter);
- return E_OK;
+ mMapDomainInterface.erase(iter);
+ return E_OK;
}
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::removeSourceLookup(const am_sourceID_t sourceID)
{
- SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
- iter=mMapSourceInterface.find(sourceID);
+ SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
+ iter = mMapSourceInterface.find(sourceID);
if (iter != mMapSourceInterface.end())
{
- mMapSourceInterface.erase(iter);
- return E_OK;
+ mMapSourceInterface.erase(iter);
+ return E_OK;
}
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::removeSinkLookup(const am_sinkID_t sinkID)
{
- SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
- iter=mMapSinkInterface.find(sinkID);
+ SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
+ iter = mMapSinkInterface.find(sinkID);
if (iter != mMapSinkInterface.end())
{
- mMapSinkInterface.erase(iter);
- return E_OK;
+ mMapSinkInterface.erase(iter);
+ return E_OK;
}
return E_NON_EXISTENT;
}
-
-
am_Error_e RoutingSender::removeCrossfaderLookup(const am_crossfaderID_t crossfaderID)
{
- CrossfaderInterfaceMap::iterator iter = mMapCrossfaderInterface.begin();
- iter=mMapCrossfaderInterface.find(crossfaderID);
+ CrossfaderInterfaceMap::iterator iter = mMapCrossfaderInterface.begin();
+ iter = mMapCrossfaderInterface.find(crossfaderID);
if (iter != mMapCrossfaderInterface.end())
{
- mMapCrossfaderInterface.erase(iter);
- return E_OK;
+ mMapCrossfaderInterface.erase(iter);
+ return E_OK;
}
return E_NON_EXISTENT;
}
-
am_Error_e RoutingSender::removeHandle(const am_Handle_s& handle)
{
- if(mlistActiveHandles.erase(handle)) return E_OK;
- return E_UNKNOWN;
+ if (mlistActiveHandles.erase(handle))
+ return E_OK;
+ return E_UNKNOWN;
}
am_Error_e RoutingSender::getListHandles(std::vector<am_Handle_s> & listHandles) const
{
- listHandles.clear();
- HandlesMap::const_iterator it=mlistActiveHandles.begin();
- for(;it!=mlistActiveHandles.end();++it)
- {
- listHandles.push_back(it->first);
- }
- return E_OK;
+ listHandles.clear();
+ HandlesMap::const_iterator it = mlistActiveHandles.begin();
+ for (; it != mlistActiveHandles.end(); ++it)
+ {
+ listHandles.push_back(it->first);
+ }
+ return E_OK;
}
am_Handle_s RoutingSender::createHandle(const am_handleData_c& handleData, const am_Handle_e type)
{
- am_Handle_s handle;
- handle.handle=++mHandleCount; //todo: handle overflows here...
- handle.handleType=type;
- mlistActiveHandles.insert(std::make_pair(handle,handleData));
- return handle;
+ am_Handle_s handle;
+ handle.handle = ++mHandleCount; //todo: handle overflows here...
+ handle.handleType = type;
+ mlistActiveHandles.insert(std::make_pair(handle, handleData));
+ return handle;
}
RoutingSender::am_handleData_c RoutingSender::returnHandleData(const am_Handle_s handle) const
{
- HandlesMap::const_iterator it=mlistActiveHandles.begin();
- it=mlistActiveHandles.find(handle);
- return (it->second);
+ HandlesMap::const_iterator it = mlistActiveHandles.begin();
+ it = mlistActiveHandles.find(handle);
+ return (it->second);
}
void RoutingSender::unloadLibraries(void)
{
- std::vector<void*>::iterator iterator=mListLibraryHandles.begin();
- for(;iterator<mListLibraryHandles.end();++iterator)
- {
- dlclose(*iterator);
- }
- mListLibraryHandles.clear();
+ std::vector<void*>::iterator iterator = mListLibraryHandles.begin();
+ for (; iterator < mListLibraryHandles.end(); ++iterator)
+ {
+ dlclose(*iterator);
+ }
+ 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;
+ 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);
+ return (RoutingSendVersion);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/SocketHandler.cpp b/AudioManagerDaemon/src/SocketHandler.cpp
index b749fbb..dbff14c 100644
--- a/AudioManagerDaemon/src/SocketHandler.cpp
+++ b/AudioManagerDaemon/src/SocketHandler.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file DBusWrapper.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file DBusWrapper.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 "SocketHandler.h"
#include <config.h>
@@ -34,7 +34,6 @@
#include <dlt/dlt.h>
#include <signal.h>
-
#include <iostream>
//todo: implement time correction if timer was interrupted by call
@@ -42,164 +41,163 @@ DLT_IMPORT_CONTEXT(AudioManager)
using namespace am;
-SocketHandler::SocketHandler()
- :mListPoll(),
- mListTimer(),
- mListActiveTimer(),
- mNextTimer(),
- mLastInsertedHandle(0),
- mLastInsertedPollHandle(0),
- mRecreatePollfds(true),
- mTimeout()
+SocketHandler::SocketHandler() :
+ mListPoll(), //
+ mListTimer(), //
+ mListActiveTimer(), //
+ mNextTimer(), //
+ mLastInsertedHandle(0), //
+ mLastInsertedPollHandle(0), //
+ mRecreatePollfds(true), //
+ mTimeout()
{
- mTimeout.tv_nsec=-1;
- mTimeout.tv_sec=-1;
- gDispatchDone=0;
+ mTimeout.tv_nsec = -1;
+ mTimeout.tv_sec = -1;
+ gDispatchDone = 0;
}
SocketHandler::~SocketHandler()
{
}
-
//todo: maybe have some: give me more time returned?
/**
* start the block listening for filedescriptors. This is the mainloop.
*/
void SocketHandler::start_listenting()
{
- int16_t pollStatus;
- std::list<int16_t>hitList;
-
- //init the timer
- initTimer();
-
- //prepare the signalmask
- sigset_t sigmask;
- sigemptyset(&sigmask);
- sigaddset(&sigmask, SIGINT);
- sigaddset(&sigmask, SIGQUIT);
- sigaddset(&sigmask, SIGTERM);
- sigaddset(&sigmask, SIGHUP);
- sigaddset(&sigmask, SIGQUIT);
-
- while (!gDispatchDone)
- {
- //first we go through the registered filedescriptors and check if someone needs preparation:
- mListPoll_t::iterator prepIter=mListPoll.begin();
- shPollPrepare *prep=NULL;
- for(;prepIter!=mListPoll.end();++prepIter)
- {
- if((prep=prepIter->prepareCB)!=NULL) prep->Call(prepIter->handle,prepIter->userData);
- }
-
- if(mRecreatePollfds)
- {
- mfdPollingArray.clear();
- //there was a change in the setup, so we need to recreate the fdarray from the list
- std::for_each(mListPoll.begin(),mListPoll.end(),CopyPollfd(mfdPollingArray));
- mRecreatePollfds=false;
- }
-
- //block until something is on a filedescriptor
+ int16_t pollStatus;
+ std::list<int16_t> hitList;
+
+ //init the timer
+ initTimer();
+
+ //prepare the signalmask
+ sigset_t sigmask;
+ sigemptyset(&sigmask);
+ sigaddset(&sigmask, SIGINT);
+ sigaddset(&sigmask, SIGQUIT);
+ sigaddset(&sigmask, SIGTERM);
+ sigaddset(&sigmask, SIGHUP);
+ sigaddset(&sigmask, SIGQUIT);
+
+ while (!gDispatchDone)
+ {
+ //first we go through the registered filedescriptors and check if someone needs preparation:
+ mListPoll_t::iterator prepIter = mListPoll.begin();
+ shPollPrepare *prep = NULL;
+ for (; prepIter != mListPoll.end(); ++prepIter)
+ {
+ if ((prep = prepIter->prepareCB) != NULL) prep->Call(prepIter->handle, prepIter->userData);
+ }
+
+ if (mRecreatePollfds)
+ {
+ mfdPollingArray.clear();
+ //there was a change in the setup, so we need to recreate the fdarray from the list
+ std::for_each(mListPoll.begin(), mListPoll.end(), CopyPollfd(mfdPollingArray));
+ mRecreatePollfds = false;
+ }
+
+ //block until something is on a filedescriptor
#ifdef WITH_PPOLL
- timespec buffertime;
- if((pollStatus=ppoll(&mfdPollingArray.front(),mfdPollingArray.size(),insertTime(buffertime),&sigmask))<0)
- {
- if(errno==EINTR)
- {
- //a signal was received, that means it's time to go...
- pollStatus=0;
- }
- else
- {
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("SocketHandler::start_listenting ppoll returned with error"),DLT_INT(errno));
- exit(0);
- }
- }
+ timespec buffertime;
+ if ((pollStatus = ppoll(&mfdPollingArray.front(), mfdPollingArray.size(), insertTime(buffertime), &sigmask)) < 0)
+ {
+ if (errno == EINTR)
+ {
+ //a signal was received, that means it's time to go...
+ pollStatus = 0;
+ }
+ else
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("SocketHandler::start_listenting ppoll returned with error"), DLT_INT(errno));
+ exit(0);
+ }
+ }
#else
- //sigprocmask (SIG_SETMASK, &mask, &oldmask);
- if((pollStatus=poll(&mfdPollingArray.front(),mfdPollingArray.size(),timespec2ms(mTimeout)))<0)
- {
-
- if(errno==EINTR)
- {
- //a signal was received, that means it's time to go...
- //todo: add things to do here before going to sleep
- exit(0);
- }
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("SocketHandler::start_listenting poll returned with error"),DLT_INT(errno));
- exit(0);
- }
- //sigprocmask (SIG_SETMASK, &oldmask, NULL);
+ //sigprocmask (SIG_SETMASK, &mask, &oldmask);
+ if((pollStatus=poll(&mfdPollingArray.front(),mfdPollingArray.size(),timespec2ms(mTimeout)))<0)
+ {
+
+ if(errno==EINTR)
+ {
+ //a signal was received, that means it's time to go...
+ //todo: add things to do here before going to sleep
+ exit(0);
+ }
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("SocketHandler::start_listenting poll returned with error"),DLT_INT(errno));
+ exit(0);
+ }
+ //sigprocmask (SIG_SETMASK, &oldmask, NULL);
#endif
- if (pollStatus!=0) //only check filedescriptors if there was a change
- {
- //todo: here could be a timer that makes sure naughty plugins return!
-
- //get all indexes of the fired events and save them int hitList
- hitList.clear();
- std::vector<pollfd>::iterator it=mfdPollingArray.begin();
- do
- {
- it=std::find_if(it,mfdPollingArray.end(),onlyFiredEvents);
- if (it!=mfdPollingArray.end()) hitList.push_back(std::distance(mfdPollingArray.begin(), it++));
-
- } while (it!=mfdPollingArray.end());
-
- //stage 1, call firedCB for all matched events, but only if callback is not zero!
- std::list<int16_t>::iterator hListIt=hitList.begin();
- for(;hListIt!=hitList.end();++hListIt)
- {
- shPollFired* fire=NULL;
- if ((fire=mListPoll.at(*hListIt).firedCB)!=NULL) fire->Call(mfdPollingArray.at(*hListIt),mListPoll.at(*hListIt).handle,mListPoll.at(*hListIt).userData);
- }
-
- //stage 2, lets ask around if some dispatching is necessary, if not, they are taken from the hitlist
- hListIt=hitList.begin();
- for(;hListIt!=hitList.end();++hListIt)
- {
- shPollCheck* check=NULL;
- if ((check=mListPoll.at(*hListIt).checkCB)!=NULL)
- {
- if (!check->Call(mListPoll.at(*hListIt).handle,mListPoll.at(*hListIt).userData))
- {
- hListIt=hitList.erase(hListIt);
- }
- }
- }
-
- //stage 3, the ones left need to dispatch, we do this as long as there is something to dispatch..
- do
- {
- hListIt=hitList.begin();
- for(;hListIt!=hitList.end();++hListIt)
- {
- shPollDispatch *dispatch=NULL;
- if((dispatch=mListPoll.at(*hListIt).dispatchCB)!=NULL)
- {
- if (!dispatch->Call(mListPoll.at(*hListIt).handle,mListPoll.at(*hListIt).userData))
- {
- hListIt=hitList.erase(hListIt);
- }
- }
- else //there is no dispatch function, so we just remove the file from the list...
- {
- hListIt=hitList.erase(hListIt);
- }
- }
- } while (!hitList.empty());
-
- }
- else //Timerevent
- {
- //this was a timer event, we need to take care about the timers
- timerUp();
- }
- }
+ if (pollStatus != 0) //only check filedescriptors if there was a change
+ {
+ //todo: here could be a timer that makes sure naughty plugins return!
+
+ //get all indexes of the fired events and save them int hitList
+ hitList.clear();
+ std::vector<pollfd>::iterator it = mfdPollingArray.begin();
+ do
+ {
+ it = std::find_if(it, mfdPollingArray.end(), onlyFiredEvents);
+ if (it != mfdPollingArray.end()) hitList.push_back(std::distance(mfdPollingArray.begin(), it++));
+
+ } while (it != mfdPollingArray.end());
+
+ //stage 1, call firedCB for all matched events, but only if callback is not zero!
+ std::list<int16_t>::iterator hListIt = hitList.begin();
+ for (; hListIt != hitList.end(); ++hListIt)
+ {
+ shPollFired* fire = NULL;
+ if ((fire = mListPoll.at(*hListIt).firedCB) != NULL) fire->Call(mfdPollingArray.at(*hListIt), mListPoll.at(*hListIt).handle, mListPoll.at(*hListIt).userData);
+ }
+
+ //stage 2, lets ask around if some dispatching is necessary, if not, they are taken from the hitlist
+ hListIt = hitList.begin();
+ for (; hListIt != hitList.end(); ++hListIt)
+ {
+ shPollCheck* check = NULL;
+ if ((check = mListPoll.at(*hListIt).checkCB) != NULL)
+ {
+ if (!check->Call(mListPoll.at(*hListIt).handle, mListPoll.at(*hListIt).userData))
+ {
+ hListIt = hitList.erase(hListIt);
+ }
+ }
+ }
+
+ //stage 3, the ones left need to dispatch, we do this as long as there is something to dispatch..
+ do
+ {
+ hListIt = hitList.begin();
+ for (; hListIt != hitList.end(); ++hListIt)
+ {
+ shPollDispatch *dispatch = NULL;
+ if ((dispatch = mListPoll.at(*hListIt).dispatchCB) != NULL)
+ {
+ if (!dispatch->Call(mListPoll.at(*hListIt).handle, mListPoll.at(*hListIt).userData))
+ {
+ hListIt = hitList.erase(hListIt);
+ }
+ }
+ else //there is no dispatch function, so we just remove the file from the list...
+ {
+ hListIt = hitList.erase(hListIt);
+ }
+ }
+ } while (!hitList.empty());
+
+ }
+ else //Timerevent
+ {
+ //this was a timer event, we need to take care about the timers
+ timerUp();
+ }
+ }
}
/**
@@ -207,7 +205,7 @@ void SocketHandler::start_listenting()
*/
void SocketHandler::stop_listening()
{
- gDispatchDone=1;
+ gDispatchDone = 1;
}
/**
@@ -217,28 +215,28 @@ void SocketHandler::stop_listening()
* @param callback the callback that shall be called if the filedescriptor poll succeeded
* @return E_OK if the descriptor was added, E_NON_EXISTENT if the fd is not valid
*/
-am_Error_e SocketHandler::addFDPoll(const int fd,const int16_t event, shPollPrepare *prepare,shPollFired *fired,shPollCheck *check,shPollDispatch *dispatch, void* userData,sh_pollHandle_t& handle)
+am_Error_e SocketHandler::addFDPoll(const int fd, const int16_t event, shPollPrepare *prepare, shPollFired *fired, shPollCheck *check, shPollDispatch *dispatch, void* userData, sh_pollHandle_t& handle)
{
- if (!fdIsValid(fd)) return E_NON_EXISTENT;
-
- sh_poll_s pollData;
- pollData.pollfdValue.fd=fd;
- pollData.handle=++mLastInsertedPollHandle;
- pollData.pollfdValue.events=event;
- pollData.pollfdValue.revents=0;
- pollData.userData=userData;
- pollData.prepareCB=prepare;
- pollData.firedCB=fired;
- pollData.checkCB=check;
- pollData.dispatchCB=dispatch;
-
- //add new data to the list
- mListPoll.push_back(pollData);
-
- mRecreatePollfds=true;
-
- handle=pollData.handle;
- return E_OK;
+ if (!fdIsValid(fd)) return E_NON_EXISTENT;
+
+ sh_poll_s pollData;
+ pollData.pollfdValue.fd = fd;
+ pollData.handle = ++mLastInsertedPollHandle;
+ pollData.pollfdValue.events = event;
+ pollData.pollfdValue.revents = 0;
+ pollData.userData = userData;
+ pollData.prepareCB = prepare;
+ pollData.firedCB = fired;
+ pollData.checkCB = check;
+ pollData.dispatchCB = dispatch;
+
+ //add new data to the list
+ mListPoll.push_back(pollData);
+
+ mRecreatePollfds = true;
+
+ handle = pollData.handle;
+ return E_OK;
}
/**
@@ -248,18 +246,18 @@ am_Error_e SocketHandler::addFDPoll(const int fd,const int16_t event, shPollPrep
*/
am_Error_e SocketHandler::removeFDPoll(const sh_pollHandle_t handle)
{
- mListPoll_t::iterator iterator=mListPoll.begin();
-
- for (;iterator!=mListPoll.end();++iterator)
- {
- if(iterator->handle==handle)
- {
- iterator=mListPoll.erase(iterator);
- mRecreatePollfds=true;
- return E_OK;
- }
- }
- return E_UNKNOWN;
+ mListPoll_t::iterator iterator = mListPoll.begin();
+
+ for (; iterator != mListPoll.end(); ++iterator)
+ {
+ if (iterator->handle == handle)
+ {
+ iterator = mListPoll.erase(iterator);
+ mRecreatePollfds = true;
+ return E_OK;
+ }
+ }
+ return E_UNKNOWN;
}
/**
@@ -272,29 +270,29 @@ am_Error_e SocketHandler::removeFDPoll(const sh_pollHandle_t handle)
* @param handle the handle that is created for the timer is returned. Can be used to remove the timer
* @return E_OK in case of success
*/
-am_Error_e SocketHandler::addTimer(const timespec timeouts,shTimerCallBack*& callback,sh_timerHandle_t& handle, void * userData)
+am_Error_e SocketHandler::addTimer(const timespec timeouts, shTimerCallBack*& callback, sh_timerHandle_t& handle, void * userData)
{
- assert(!((timeouts.tv_sec==0) && (timeouts.tv_nsec==0)));
- assert(callback!=NULL);
-
- timer_s timerItem;
-
- //create a new handle for the timer
- handle=++mLastInsertedHandle; //todo: overflow ruling !
- timerItem.handle=handle;
- timerItem.countdown=timeouts;
- timerItem.timeout=timeouts;
- timerItem.callback=callback;
- timerItem.userData=userData;
-
- //add timer to the list
- mListActiveTimer.push_back(timerItem);
- mListTimer.push_back(timerItem);
-
- //very important: sort the list so that the smallest value is front
- mListActiveTimer.sort(compareCountdown);
- mTimeout=mListActiveTimer.front().countdown;
- return E_OK;
+ assert(!((timeouts.tv_sec==0) && (timeouts.tv_nsec==0)));
+ assert(callback!=NULL);
+
+ timer_s timerItem;
+
+ //create a new handle for the timer
+ handle = ++mLastInsertedHandle; //todo: overflow ruling !
+ timerItem.handle = handle;
+ timerItem.countdown = timeouts;
+ timerItem.timeout = timeouts;
+ timerItem.callback = callback;
+ timerItem.userData = userData;
+
+ //add timer to the list
+ mListActiveTimer.push_back(timerItem);
+ mListTimer.push_back(timerItem);
+
+ //very important: sort the list so that the smallest value is front
+ mListActiveTimer.sort(compareCountdown);
+ mTimeout = mListActiveTimer.front().countdown;
+ return E_OK;
}
/**
@@ -304,21 +302,21 @@ am_Error_e SocketHandler::addTimer(const timespec timeouts,shTimerCallBack*& cal
*/
am_Error_e SocketHandler::removeTimer(const sh_timerHandle_t handle)
{
- assert(handle!=0);
-
- //stop the current timer
- stopTimer(handle);
-
- std::list<timer_s>::iterator it=mListTimer.begin();
- for(;it!=mListTimer.end();++it)
- {
- if(it->handle==handle)
- {
- it=mListTimer.erase(it);
- return E_OK;
- }
- }
- return E_UNKNOWN;
+ assert(handle!=0);
+
+ //stop the current timer
+ stopTimer(handle);
+
+ std::list<timer_s>::iterator it = mListTimer.begin();
+ for (; it != mListTimer.end(); ++it)
+ {
+ if (it->handle == handle)
+ {
+ it = mListTimer.erase(it);
+ return E_OK;
+ }
+ }
+ return E_UNKNOWN;
}
/**
@@ -329,52 +327,52 @@ am_Error_e SocketHandler::removeTimer(const sh_timerHandle_t handle)
*/
am_Error_e SocketHandler::restartTimer(const sh_timerHandle_t handle, const timespec timeouts)
{
- timer_s timerItem;
- std::list<timer_s>::iterator it=mListTimer.begin();
- for(;it!=mListTimer.end();++it)
- {
- if (it->handle==handle)
- {
- timerItem=*it;
- break;
- }
- }
-
- if (timeouts.tv_nsec!=-1 && timeouts.tv_sec!=-1)
- {
- timerItem.timeout=timeouts;
- }
-
- mListActiveTimer.push_back(timerItem);
-
- //very important: sort the list so that the smallest value is front
- mListActiveTimer.sort(compareCountdown);
- mTimeout=mListActiveTimer.front().countdown;
- return E_OK;
+ timer_s timerItem;
+ std::list<timer_s>::iterator it = mListTimer.begin();
+ for (; it != mListTimer.end(); ++it)
+ {
+ if (it->handle == handle)
+ {
+ timerItem = *it;
+ break;
+ }
+ }
+
+ if (timeouts.tv_nsec != -1 && timeouts.tv_sec != -1)
+ {
+ timerItem.timeout = timeouts;
+ }
+
+ mListActiveTimer.push_back(timerItem);
+
+ //very important: sort the list so that the smallest value is front
+ mListActiveTimer.sort(compareCountdown);
+ mTimeout = mListActiveTimer.front().countdown;
+ return E_OK;
}
am_Error_e SocketHandler::stopTimer(const sh_timerHandle_t handle)
{
- //go through the list and remove the timer with the handle
- std::list<timer_s>::iterator it=mListActiveTimer.begin();
- for(;it!=mListActiveTimer.end();++it)
- {
- if(it->handle==handle)
- {
- it=mListActiveTimer.erase(it);
- if (!mListActiveTimer.empty())
- {
- mTimeout=mListActiveTimer.front().countdown;
- }
- else
- {
- mTimeout.tv_nsec=-1;
- mTimeout.tv_sec=-1;
- }
- return E_OK;
- }
- }
- return E_NON_EXISTENT;
+ //go through the list and remove the timer with the handle
+ std::list<timer_s>::iterator it = mListActiveTimer.begin();
+ for (; it != mListActiveTimer.end(); ++it)
+ {
+ if (it->handle == handle)
+ {
+ it = mListActiveTimer.erase(it);
+ if (!mListActiveTimer.empty())
+ {
+ mTimeout = mListActiveTimer.front().countdown;
+ }
+ else
+ {
+ mTimeout.tv_nsec = -1;
+ mTimeout.tv_sec = -1;
+ }
+ return E_OK;
+ }
+ }
+ return E_NON_EXISTENT;
}
/**
@@ -383,20 +381,20 @@ am_Error_e SocketHandler::stopTimer(const sh_timerHandle_t handle)
* @param event the event flags
* @return E_OK on succsess, E_NON_EXISTENT if fd was not found
*/
-am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const int16_t events)
+am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const int16_t events)
{
- mListPoll_t::iterator iterator=mListPoll.begin();
-
- for (;iterator!=mListPoll.end();++iterator)
- {
- if(iterator->handle==handle)
- {
- iterator->pollfdValue.events=events;
- mRecreatePollfds=true;
- return E_OK;
- }
- }
- return E_UNKNOWN;
+ mListPoll_t::iterator iterator = mListPoll.begin();
+
+ for (; iterator != mListPoll.end(); ++iterator)
+ {
+ if (iterator->handle == handle)
+ {
+ iterator->pollfdValue.events = events;
+ mRecreatePollfds = true;
+ return E_OK;
+ }
+ }
+ return E_UNKNOWN;
}
/**
@@ -406,7 +404,7 @@ am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const i
*/
bool SocketHandler::fdIsValid(const int fd) const
{
- return (fcntl(fd, F_GETFL) != -1 || errno != EBADF);
+ return (fcntl(fd, F_GETFL) != -1 || errno != EBADF);
}
/**
@@ -415,22 +413,22 @@ bool SocketHandler::fdIsValid(const int fd) const
*/
void SocketHandler::timerUp()
{
- //first fire the event
- mListActiveTimer.front().callback->Call(mListActiveTimer.front().handle,mListActiveTimer.front().userData);
-
- //then remove the first timer, the one who fired
- mListActiveTimer.pop_front();
- if(!mListActiveTimer.empty())
- {
- //substract the old value from all timers in the list
- std::for_each(mListActiveTimer.begin(),mListActiveTimer.end(),SubstractTime(mTimeout));
- mTimeout=mListActiveTimer.front().countdown;
- }
- else
- {
- mTimeout.tv_nsec=-1;
- mTimeout.tv_sec=-1;
- }
+ //first fire the event
+ mListActiveTimer.front().callback->Call(mListActiveTimer.front().handle, mListActiveTimer.front().userData);
+
+ //then remove the first timer, the one who fired
+ mListActiveTimer.pop_front();
+ if (!mListActiveTimer.empty())
+ {
+ //substract the old value from all timers in the list
+ std::for_each(mListActiveTimer.begin(), mListActiveTimer.end(), SubstractTime(mTimeout));
+ mTimeout = mListActiveTimer.front().countdown;
+ }
+ else
+ {
+ mTimeout.tv_nsec = -1;
+ mTimeout.tv_sec = -1;
+ }
}
/**
@@ -438,60 +436,57 @@ void SocketHandler::timerUp()
*/
void SocketHandler::initTimer()
{
- if(!mListActiveTimer.empty())
- {
- mTimeout=mListActiveTimer.front().countdown;
- }
- else
- {
- mTimeout.tv_nsec=-1;
- mTimeout.tv_sec=-1;
- }
+ if (!mListActiveTimer.empty())
+ {
+ mTimeout = mListActiveTimer.front().countdown;
+ }
+ else
+ {
+ mTimeout.tv_nsec = -1;
+ mTimeout.tv_sec = -1;
+ }
}
-
/**
-* convert timespec to milliseconds
-* @param time time in timespec
-* @return time in milliseconds
-*/
+ * convert timespec to milliseconds
+ * @param time time in timespec
+ * @return time in milliseconds
+ */
inline int SocketHandler::timespec2ms(const timespec & time)
{
- return (time.tv_nsec == -1 && time.tv_sec == -1) ? -1 : time.tv_sec * 1000 + time.tv_nsec / 1000000;
+ return (time.tv_nsec == -1 && time.tv_sec == -1) ? -1 : time.tv_sec * 1000 + time.tv_nsec / 1000000;
}
inline timespec* am::SocketHandler::insertTime(timespec& buffertime)
{
- buffertime.tv_nsec=mTimeout.tv_nsec;
- buffertime.tv_sec=mTimeout.tv_sec;
- return (mTimeout.tv_nsec == -1 && mTimeout.tv_sec == -1) ? NULL : &buffertime;
+ buffertime.tv_nsec = mTimeout.tv_nsec;
+ buffertime.tv_sec = mTimeout.tv_sec;
+ return (mTimeout.tv_nsec == -1 && mTimeout.tv_sec == -1) ? NULL : &buffertime;
}
/**
-* functor to easy substract from each countdown
-* @param t value to substract from
-*/
+ * functor to easy substract from each countdown
+ * @param t value to substract from
+ */
void SocketHandler::SubstractTime::operator ()(timer_s & t) const
{
- int val = 0;
- if((val = t.countdown.tv_nsec - param.tv_nsec) < 0){
- t.countdown.tv_nsec = 1000000000 + val;
- t.countdown.tv_sec--;
- }else{
- t.countdown.tv_nsec = val;
- }
- (t.countdown.tv_sec - param.tv_sec) < 0 ? 0 : (t.countdown.tv_sec -= param.tv_sec);
+ int val = 0;
+ if ((val = t.countdown.tv_nsec - param.tv_nsec) < 0)
+ {
+ t.countdown.tv_nsec = 1000000000 + val;
+ t.countdown.tv_sec--;
+ }
+ else
+ {
+ t.countdown.tv_nsec = val;
+ }
+ (t.countdown.tv_sec - param.tv_sec) < 0 ? 0 : (t.countdown.tv_sec -= param.tv_sec);
}
void SocketHandler::CopyPollfd::operator ()(const sh_poll_s & row)
{
- pollfd temp=row.pollfdValue;
- temp.revents=0;
- mArray.push_back(temp);
+ pollfd temp = row.pollfdValue;
+ temp.revents = 0;
+ mArray.push_back(temp);
}
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/TelnetServer.cpp b/AudioManagerDaemon/src/TelnetServer.cpp
index 3e77b0b..36eac28 100644
--- a/AudioManagerDaemon/src/TelnetServer.cpp
+++ b/AudioManagerDaemon/src/TelnetServer.cpp
@@ -1,31 +1,31 @@
/**
-* 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.
-*
-*/
+ * 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/socket.h>
+#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <string.h>
#include <netdb.h>
@@ -43,69 +43,68 @@ using namespace am;
DLT_IMPORT_CONTEXT(AudioManager)
-TelnetServer* TelnetServer::instance=NULL;
+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())
+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);
+ 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));
+ 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));
+ 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);
+ short events = 0;
+ events |= POLLIN;
+ mSocketHandler->addFDPoll(mConnectFD, events, NULL, &telnetConnectFiredCB, NULL, NULL, NULL, mConnecthandle);
}
TelnetServer::~TelnetServer()
@@ -114,157 +113,144 @@ 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);
+ //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);
+ mListConnections.push_back(connection);
- //set the correct event:
- short event = 0;
- event |=POLLIN;
+ //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);
+ //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);
- }
+ //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;
+ 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;
+ if (msgList.size() != 0) return true;
+ return false;
}
void TelnetServer::listCommand(std::vector<std::string>& msg, int filedescriptor)
{
- instance->listCommandShadow(msg,filedescriptor);
+ instance->listCommandShadow(msg, filedescriptor);
}
-void am::TelnetServer::listCommandShadow(std::vector<std::string> & msg, int filedescriptor)
+void 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);
+ 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);
+ 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;
+ 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 3d940f6..d2ff042 100644
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file main.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file main.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.
+ *
+ */
/**
* Please make sure to have read the documentation on genivi.org!
@@ -34,7 +34,6 @@
//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
-
#include <config.h>
#include <SocketHandler.h>
#ifdef WITH_DBUS_WRAPPER
@@ -67,252 +66,246 @@ DLT_DECLARE_CONTEXT(AudioManager)
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> 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);
+ "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> 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;
+std::string databasePath = std::string(":memory:");
+unsigned int telnetport = DEFAULT_TELNETPORT;
+unsigned int maxConnections = MAX_TELNETCONNECTIONS;
-void daemonize ()
+void daemonize()
{
- umask(0);
- std::string dir="/";
-
- rlimit rl;
- if (getrlimit(RLIMIT_NOFILE, &rl) < 0)
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("can't get file limit "));
- }
-
- pid_t pid;
- if ((pid = fork()) < 0)
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("cannot fork!"));
- }
- else if (pid != 0)
- {
- exit(0);
- }
-
- setsid();
-
- if (!dir.empty() && chdir(dir.c_str()) < 0)
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("couldn't chdir to the new directory"));
- }
-
- if (rl.rlim_max == RLIM_INFINITY)
- {
- rl.rlim_max = 1024;
- }
-
-
- for (unsigned int i = 0; i < rl.rlim_max; i++)
- {
- 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);
-
- if (fd0 != STDIN_FILENO || fd1 != STDOUT_FILENO || fd2 != STDERR_FILENO)
- {
- DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("new standard file descriptors were not opened"));
- }
+ umask(0);
+ std::string dir = "/";
+
+ rlimit rl;
+ if (getrlimit(RLIMIT_NOFILE, &rl) < 0)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("can't get file limit "));
+ }
+
+ pid_t pid;
+ if ((pid = fork()) < 0)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("cannot fork!"));
+ }
+ else if (pid != 0)
+ {
+ exit(0);
+ }
+
+ setsid();
+
+ if (!dir.empty() && chdir(dir.c_str()) < 0)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("couldn't chdir to the new directory"));
+ }
+
+ if (rl.rlim_max == RLIM_INFINITY)
+ {
+ rl.rlim_max = 1024;
+ }
+
+ for (unsigned int i = 0; i < rl.rlim_max; i++)
+ {
+ 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);
+
+ if (fd0 != STDIN_FILENO || fd1 != STDOUT_FILENO || fd2 != STDERR_FILENO)
+ {
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("new standard file descriptors were not opened"));
+ }
}
void parseCommandLine(int argc, char **argv)
{
- while (optind < argc)
- {
- int option = getopt (argc, argv, "h::v::c::l::r::L::R::d::t::m::i::p::");
-
- 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);
- break;
- case 'd':
- daemonize();
- break;
- case 'l':
- listCommandPluginDirs.clear();
- listCommandPluginDirs.push_back(std::string(optarg));
- break;
- case 'r':
- listRoutingPluginDirs.clear();
- listRoutingPluginDirs.push_back(std::string(optarg));
- break;
- case 'L':
- listCommandPluginDirs.push_back(std::string(optarg));
- break;
- case 'R':
- listRoutingPluginDirs.push_back(std::string(optarg));
- break;
- case 'c':
- controllerPlugin=std::string(optarg);
- assert(!controllerPlugin.empty());
- assert(controllerPlugin.find(".so")!=std::string::npos);
- break;
- case 'v':
- printf("AudioManagerDaemon Version: %s\n",DAEMONVERSION);
- exit(-1);
- break;
- case 'h':
+ while (optind < argc)
+ {
+ int option = getopt(argc, argv, "h::v::c::l::r::L::R::d::t::m::i::p::");
+
+ 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);
+ break;
+ case 'd':
+ daemonize();
+ break;
+ case 'l':
+ listCommandPluginDirs.clear();
+ listCommandPluginDirs.push_back(std::string(optarg));
+ break;
+ case 'r':
+ listRoutingPluginDirs.clear();
+ listRoutingPluginDirs.push_back(std::string(optarg));
+ break;
+ case 'L':
+ listCommandPluginDirs.push_back(std::string(optarg));
+ break;
+ case 'R':
+ listRoutingPluginDirs.push_back(std::string(optarg));
+ break;
+ case 'c':
+ controllerPlugin = std::string(optarg);
+ assert(!controllerPlugin.empty());
+ assert(controllerPlugin.find(".so")!=std::string::npos);
+ break;
+ case 'v':
+ printf("AudioManagerDaemon Version: %s\n", DAEMONVERSION);
+ exit(-1);
+ break;
+ case 'h':
default:
- printf("AudioManagerDaemon Version: %s\n",DAEMONVERSION);
+ printf("AudioManagerDaemon Version: %s\n", DAEMONVERSION);
puts(USAGE_DESCRIPTION);
exit(-1);
- }
- }
+ }
+ }
}
-static void signalHandler (int sig, siginfo_t *siginfo, void *context)
+static void signalHandler(int sig, siginfo_t *siginfo, void *context)
{
- (void)sig;
- (void)siginfo;
- (void)context;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("signal handler was called, exit now..."));
- gDispatchDone=1;
- //todo: maually fire the mainloop
- //todo: ifdef no sockethandler
- exit(1);
+ (void) sig;
+ (void) siginfo;
+ (void) context;
+ DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("signal handler was called, exit now..."));
+ gDispatchDone = 1;
+ //todo: maually fire the mainloop
+ //todo: ifdef no sockethandler
+ exit(1);
}
-
int main(int argc, char *argv[])
{
- DLT_REGISTER_APP("AudioManagerDeamon","AudioManagerDeamon");
- DLT_REGISTER_CONTEXT(AudioManager,"Main","Main Context");
- DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("The AudioManager is started, "), DLT_STRING(DAEMONVERSION));
-
- listCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
- listRoutingPluginDirs.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
-
- //parse the commandline options
- parseCommandLine(argc, (char**) argv);
-
- //now the signal handler:
- struct sigaction signalAction;
- memset (&signalAction, '\0', sizeof(signalAction));
- signalAction.sa_sigaction = &signalHandler;
- signalAction.sa_flags = SA_SIGINFO;
- sigaction(SIGINT, &signalAction, NULL);
- sigaction(SIGQUIT, &signalAction, NULL);
- sigaction(SIGTERM, &signalAction, NULL);
- sigaction(SIGHUP, &signalAction, NULL);
- sigaction(SIGQUIT, &signalAction, NULL);
-
- struct sigaction signalChildAction;
- memset (&signalChildAction, '\0', sizeof(signalChildAction));
- signalChildAction.sa_flags = SA_NOCLDWAIT;
- sigaction (SIGCHLD, &signalChildAction, NULL);
-
- //Instantiate all classes. Keep in same order !
+ DLT_REGISTER_APP("AudioManagerDeamon", "AudioManagerDeamon");
+ DLT_REGISTER_CONTEXT(AudioManager, "Main", "Main Context");
+ DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("The AudioManager is started, "), DLT_STRING(DAEMONVERSION));
+
+ listCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
+ listRoutingPluginDirs.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
+
+ //parse the commandline options
+ parseCommandLine(argc, (char**) argv);
+
+ //now the signal handler:
+ struct sigaction signalAction;
+ memset(&signalAction, '\0', sizeof(signalAction));
+ signalAction.sa_sigaction = &signalHandler;
+ signalAction.sa_flags = SA_SIGINFO;
+ sigaction(SIGINT, &signalAction, NULL);
+ sigaction(SIGQUIT, &signalAction, NULL);
+ sigaction(SIGTERM, &signalAction, NULL);
+ sigaction(SIGHUP, &signalAction, NULL);
+ sigaction(SIGQUIT, &signalAction, NULL);
+
+ struct sigaction signalChildAction;
+ memset(&signalChildAction, '\0', sizeof(signalChildAction));
+ signalChildAction.sa_flags = SA_NOCLDWAIT;
+ sigaction(SIGCHLD, &signalChildAction, NULL);
+
+ //Instantiate all classes. Keep in same order !
#ifdef WITH_SOCKETHANDLER_LOOP
- SocketHandler iSocketHandler;
+ SocketHandler iSocketHandler;
#endif
#ifdef WITH_DBUS_WRAPPER
#ifdef WITH_SOCKETHANDLER_LOOP
- DBusWrapper iDBusWrapper(&iSocketHandler);
+ DBusWrapper iDBusWrapper(&iSocketHandler);
#else /*WITH_SOCKETHANDLER_LOOP*/
- DBusWrapper iDBusWrapper;
+ DBusWrapper iDBusWrapper;
#endif /*WITH_SOCKETHANDLER_LOOP*/
#endif /*WITH_DBUS_WRAPPER */
- DatabaseHandler iDatabaseHandler(databasePath);
- RoutingSender iRoutingSender(listRoutingPluginDirs);
- CommandSender iCommandSender(listCommandPluginDirs);
- ControlSender iControlSender(controllerPlugin);
+ DatabaseHandler iDatabaseHandler(databasePath);
+ RoutingSender iRoutingSender(listRoutingPluginDirs);
+ CommandSender iCommandSender(listCommandPluginDirs);
+ ControlSender iControlSender(controllerPlugin);
#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);
+ 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);
+ 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);
+ CommandReceiver iCommandReceiver(&iDatabaseHandler,&iControlSender,&iDBusWrapper);
+ RoutingReceiver iRoutingReceiver(&iDatabaseHandler,&iRoutingSender,&iControlSender,&iDBusWrapper);
+ ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender);
#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);
+ 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);
+ TelnetServer iTelnetServer(&iSocketHandler,telnetport,maxConnections);
#endif
#endif /*WITH_DBUS_WRAPPER*/
#ifdef WITH_TELNET
- DatabaseObserver iObserver(&iCommandSender, &iRoutingSender,&iTelnetServer);
+ DatabaseObserver iObserver(&iCommandSender, &iRoutingSender,&iTelnetServer);
#else
- DatabaseObserver iObserver(&iCommandSender, &iRoutingSender);
+ DatabaseObserver iObserver(&iCommandSender, &iRoutingSender);
#endif
+ //since the plugins have been loaded by the *Senders before, we can tell the Controller this:
+ iControlSender.hookAllPluginsLoaded();
- //since the plugins have been loaded by the *Senders before, we can tell the Controller this:
- iControlSender.hookAllPluginsLoaded();
-
- //the controller should startup the interfaces - this is just for testing
- iCommandSender.startupInterface(&iCommandReceiver);
- iRoutingSender.startupRoutingInterface(&iRoutingReceiver);
- iRoutingSender.routingInterfacesReady();
+ //the controller should startup the interfaces - this is just for testing
+ iCommandSender.startupInterface(&iCommandReceiver);
+ iRoutingSender.startupRoutingInterface(&iRoutingReceiver);
+ iRoutingSender.routingInterfacesReady();
#ifdef WITH_SOCKETHANDLER_LOOP
- iSocketHandler.start_listenting();
+ iSocketHandler.start_listenting();
#endif /*WITH_SOCKETHANDLER_LOOP*/
#ifdef WITH_DBUS_WRAPPER
#ifdef WITH_SIMPLEDBUS_LOOP
- iDBusWrapper.dbusMainLoop();
+ iDBusWrapper.dbusMainLoop();
#endif/*WITH_SIMPLEDBUS_LOOP*/
#endif /*WITH_DBUS_WRAPPER*/
-exit(0);
+ exit(0);
}
-
-
-
diff --git a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h b/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
index ab57a62..5d06fb1 100644
--- a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file CommandInterfaceBackdoor.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file CommandInterfaceBackdoor.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef COMMANDINTERFACEBACKDOOR_H_
#define COMMANDINTERFACEBACKDOOR_H_
@@ -29,16 +29,18 @@
#include <command/CommandSendInterface.h>
#include "CommandSender.h"
-namespace am {
+namespace am
+{
class CommandSender;
-class CommandInterfaceBackdoor {
+class CommandInterfaceBackdoor
+{
public:
- CommandInterfaceBackdoor();
- virtual ~CommandInterfaceBackdoor();
- bool unloadPlugins(CommandSender *CommandSender);
- bool injectInterface(CommandSender* CommandSender, CommandSendInterface* CommandSendInterface);
+ CommandInterfaceBackdoor();
+ virtual ~CommandInterfaceBackdoor();
+ bool unloadPlugins(CommandSender *CommandSender);
+ bool injectInterface(CommandSender* CommandSender, CommandSendInterface* CommandSendInterface);
};
}
diff --git a/AudioManagerDaemon/test/CommonFunctions.cpp b/AudioManagerDaemon/test/CommonFunctions.cpp
index b62169e..2a5c8cf 100644
--- a/AudioManagerDaemon/test/CommonFunctions.cpp
+++ b/AudioManagerDaemon/test/CommonFunctions.cpp
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file CommonFunctions.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 CommonFunctions.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 "CommonFunctions.h"
#include "CommandInterfaceBackdoor.h"
@@ -32,359 +32,305 @@
using namespace am;
-CommandInterfaceBackdoor::CommandInterfaceBackdoor() {
+CommandInterfaceBackdoor::CommandInterfaceBackdoor()
+{
}
-CommandInterfaceBackdoor::~CommandInterfaceBackdoor() {
+CommandInterfaceBackdoor::~CommandInterfaceBackdoor()
+{
}
-bool CommandInterfaceBackdoor::unloadPlugins(CommandSender *CommandSender) {
- assert(CommandSender != NULL);
- CommandSender->unloadLibraries();
- CommandSender->mListInterfaces.clear();
- if (CommandSender->mListInterfaces.empty())
- return true;
- return false;
+bool CommandInterfaceBackdoor::unloadPlugins(CommandSender *CommandSender)
+{
+ assert(CommandSender != NULL);
+ CommandSender->unloadLibraries();
+ CommandSender->mListInterfaces.clear();
+ if (CommandSender->mListInterfaces.empty())
+ return true;
+ return false;
}
-bool CommandInterfaceBackdoor::injectInterface(CommandSender *CommandSender,
- CommandSendInterface *CommandSendInterface) {
- assert(CommandSender != NULL);
- assert(CommandSendInterface != NULL);
- CommandSender->mListInterfaces.push_back(CommandSendInterface);
- return true; //todo: check if it worked
+bool CommandInterfaceBackdoor::injectInterface(CommandSender *CommandSender, CommandSendInterface *CommandSendInterface)
+{
+ assert(CommandSender != NULL);
+ assert(CommandSendInterface != NULL);
+ CommandSender->mListInterfaces.push_back(CommandSendInterface);
+ return true; //todo: check if it worked
}
-RoutingInterfaceBackdoor::RoutingInterfaceBackdoor() {
+RoutingInterfaceBackdoor::RoutingInterfaceBackdoor()
+{
}
-RoutingInterfaceBackdoor::~RoutingInterfaceBackdoor() {
+RoutingInterfaceBackdoor::~RoutingInterfaceBackdoor()
+{
}
-bool RoutingInterfaceBackdoor::unloadPlugins(RoutingSender *RoutingSender) {
- assert(RoutingSender != NULL);
- RoutingSender->unloadLibraries();
- RoutingSender->mListInterfaces.clear();
- if (RoutingSender->mListInterfaces.empty())
- return true;
- return false;
+bool RoutingInterfaceBackdoor::unloadPlugins(RoutingSender *RoutingSender)
+{
+ assert(RoutingSender != NULL);
+ RoutingSender->unloadLibraries();
+ RoutingSender->mListInterfaces.clear();
+ if (RoutingSender->mListInterfaces.empty())
+ return true;
+ return false;
}
-bool RoutingInterfaceBackdoor::injectInterface(RoutingSender *RoutingSender,
- RoutingSendInterface *newInterface, const std::string& busname) {
- assert(RoutingSender != NULL);
- assert(newInterface != NULL);
-
- RoutingSender::InterfaceNamePairs newInterfacePair;
- newInterfacePair.routingInterface = newInterface;
- newInterfacePair.busName = busname;
- RoutingSender->mListInterfaces.push_back(newInterfacePair);
- return true; //todo: check if it worked
+bool RoutingInterfaceBackdoor::injectInterface(RoutingSender *RoutingSender, RoutingSendInterface *newInterface, const std::string& busname)
+{
+ assert(RoutingSender != NULL);
+ assert(newInterface != NULL);
+
+ RoutingSender::InterfaceNamePairs newInterfacePair;
+ newInterfacePair.routingInterface = newInterface;
+ newInterfacePair.busName = busname;
+ RoutingSender->mListInterfaces.push_back(newInterfacePair);
+ return true; //todo: check if it worked
}
-ControlInterfaceBackdoor::ControlInterfaceBackdoor() {}
+ControlInterfaceBackdoor::ControlInterfaceBackdoor()
+{
+}
-ControlInterfaceBackdoor::~ControlInterfaceBackdoor() {}
+ControlInterfaceBackdoor::~ControlInterfaceBackdoor()
+{
+}
bool ControlInterfaceBackdoor::replaceController(ControlSender *controlSender, ControlSendInterface *newController)
{
- controlSender->mController=newController;
- return true;
+ controlSender->mController = newController;
+ return true;
}
-
//int GetRandomNumber(int nLow, int nHigh) {
// return (rand() % (nHigh - nLow + 1)) + nLow;
//}
-bool equalSoundProperty(const am_SoundProperty_s a,
- const am_SoundProperty_s b) {
- return (a.type == b.type && a.value == b.value);
-}
-
-bool equalMainSoundProperty(const am_MainSoundProperty_s a,
- const am_MainSoundProperty_s b) {
- return (a.type == b.type && a.value == b.value);
-}
-
-bool equalRoutingElement(const am_RoutingElement_s a,
- const am_RoutingElement_s b) {
- return (a.connectionFormat == b.connectionFormat && a.domainID == b.domainID
- && a.sinkID == b.sinkID && a.sourceID == b.sourceID);
-}
-
-bool equalClassProperties(const am_ClassProperty_s a,
- const am_ClassProperty_s b) {
- return (a.classProperty == b.classProperty && a.value == b.value);
-}
-
-std::string int2string(int i) {
- std::stringstream out;
- out << i;
- return out.str();
-}
-
-bool CommonFunctions::compareSource(
- std::vector<am_Source_s>::iterator listIterator,
- const am_Source_s& sourceData) {
- return (listIterator->available.availability
- == sourceData.available.availability)
- && (listIterator->available.availabilityReason
- == sourceData.available.availabilityReason)
- && (listIterator->sourceClassID == sourceData.sourceClassID)
- && (listIterator->domainID == sourceData.domainID)
- && (listIterator->interruptState == sourceData.interruptState)
- && (listIterator->visible == sourceData.visible)
- && (listIterator->name.compare(sourceData.name) == 0)
- && (listIterator->volume == sourceData.volume)
- && std::equal(listIterator->listConnectionFormats.begin(),
- listIterator->listConnectionFormats.end(),
- sourceData.listConnectionFormats.begin())
- && std::equal(listIterator->listMainSoundProperties.begin(),
- listIterator->listMainSoundProperties.end(),
- sourceData.listMainSoundProperties.begin(),
- equalMainSoundProperty)
- && std::equal(listIterator->listSoundProperties.begin(),
- listIterator->listSoundProperties.end(),
- sourceData.listSoundProperties.begin(), equalSoundProperty);
-}
-
-bool CommonFunctions::compareSink(std::vector<am_Sink_s>::iterator listIterator,
- const am_Sink_s& sinkData) {
- return (listIterator->available.availability
- == sinkData.available.availability)
- && (listIterator->available.availabilityReason
- == sinkData.available.availabilityReason)
- && (listIterator->sinkClassID == sinkData.sinkClassID)
- && (listIterator->domainID == sinkData.domainID)
- && (listIterator->mainVolume == sinkData.mainVolume)
- && (listIterator->muteState == sinkData.muteState)
- && (listIterator->visible == sinkData.visible)
- && (listIterator->name.compare(sinkData.name) == 0)
- && (listIterator->volume == sinkData.volume)
- && std::equal(listIterator->listConnectionFormats.begin(),
- listIterator->listConnectionFormats.end(),
- sinkData.listConnectionFormats.begin())
- && std::equal(listIterator->listMainSoundProperties.begin(),
- listIterator->listMainSoundProperties.end(),
- sinkData.listMainSoundProperties.begin(),
- equalMainSoundProperty)
- && std::equal(listIterator->listSoundProperties.begin(),
- listIterator->listSoundProperties.end(),
- sinkData.listSoundProperties.begin(), equalSoundProperty);
-}
-
-bool CommonFunctions::compareGateway(
- std::vector<am_Gateway_s>::iterator listIterator,
- const am_Gateway_s& gatewayData) {
- return (listIterator->name.compare(gatewayData.name) == 0)
- && (listIterator->sinkID == gatewayData.sinkID)
- && (listIterator->sourceID == gatewayData.sourceID)
- && (listIterator->controlDomainID == gatewayData.controlDomainID)
- && (listIterator->domainSinkID == gatewayData.domainSinkID)
- && (listIterator->domainSourceID == gatewayData.domainSourceID)
- && std::equal(listIterator->convertionMatrix.begin(),
- listIterator->convertionMatrix.end(),
- gatewayData.convertionMatrix.begin())
- && std::equal(listIterator->listSourceFormats.begin(),
- listIterator->listSourceFormats.end(),
- gatewayData.listSourceFormats.begin())
- && std::equal(listIterator->listSinkFormats.begin(),
- listIterator->listSinkFormats.end(),
- gatewayData.listSinkFormats.begin());
-}
-
-bool CommonFunctions::compareGateway1(const am_Gateway_s gateway1,
- const am_Gateway_s gatewayData) {
- return (gateway1.name.compare(gatewayData.name) == 0)
- && (gateway1.sinkID == gatewayData.sinkID)
- && (gateway1.sourceID == gatewayData.sourceID)
- && (gateway1.controlDomainID == gatewayData.controlDomainID)
- && (gateway1.domainSinkID == gatewayData.domainSinkID)
- && (gateway1.domainSourceID == gatewayData.domainSourceID)
- && std::equal(gateway1.convertionMatrix.begin(),
- gateway1.convertionMatrix.end(),
- gatewayData.convertionMatrix.begin())
- && std::equal(gateway1.listSourceFormats.begin(),
- gateway1.listSourceFormats.end(),
- gatewayData.listSourceFormats.begin())
- && std::equal(gateway1.listSinkFormats.begin(),
- gateway1.listSinkFormats.end(),
- gatewayData.listSinkFormats.begin());
-}
-
-bool CommonFunctions::compareSinkMainSink(
- std::vector<am_SinkType_s>::iterator listIterator,
- const std::vector<am_Sink_s>& sinkList) {
- std::vector<am_Sink_s>::const_iterator sinkListIterator = sinkList.begin();
- for (; sinkListIterator < sinkList.end(); ++sinkListIterator) {
- if (listIterator->sinkID == sinkListIterator->sinkID) {
- return (listIterator->name.compare(sinkListIterator->name) == 0)
- && (listIterator->availability.availability
- == sinkListIterator->available.availability)
- && (listIterator->availability.availabilityReason
- == sinkListIterator->available.availabilityReason)
- && (listIterator->muteState == sinkListIterator->muteState)
- && (listIterator->volume == sinkListIterator->mainVolume)
- && (listIterator->sinkClassID
- == sinkListIterator->sinkClassID);
- }
- }
- return false;
-}
-
-bool CommonFunctions::compareSinkMainSource(
- std::vector<am_SourceType_s>::iterator listIterator,
- const std::vector<am_Source_s>& sourceList) {
- std::vector<am_Source_s>::const_iterator sinkListIterator =
- sourceList.begin();
- for (; sinkListIterator < sourceList.end(); ++sinkListIterator) {
- if (listIterator->sourceID == sinkListIterator->sourceID) {
- return (listIterator->name.compare(sinkListIterator->name) == 0)
- && (listIterator->availability.availability
- == sinkListIterator->available.availability)
- && (listIterator->availability.availabilityReason
- == sinkListIterator->available.availabilityReason)
- && (listIterator->sourceClassID
- == sinkListIterator->sourceClassID);
- }
- }
- return false;
-}
-
-std::vector<am_ConnectionFormat_e> CommonFunctions::getStandardConnectionFormatList() {
- std::vector < am_ConnectionFormat_e > list;
- list.push_back(CF_ANALOG);
- list.push_back(CF_STEREO);
- return list;
-}
-
-std::vector<am_SoundProperty_s> CommonFunctions::getStandardSoundPropertyList() {
- std::vector < am_SoundProperty_s > soundPropertyList;
- am_SoundProperty_s soundProperty;
- soundProperty.type = SP_BASS;
- soundProperty.value = 23;
- soundPropertyList.push_back(soundProperty);
- soundProperty.type = SP_MID;
- soundProperty.value = 2;
- soundPropertyList.push_back(soundProperty);
- return soundPropertyList;
-}
-
-std::vector<am_MainSoundProperty_s> CommonFunctions::getStandardMainSoundPropertyList() {
- std::vector < am_MainSoundProperty_s > mainSoundPropertyList;
- am_MainSoundProperty_s mainSoundProperty;
- mainSoundProperty.type = MSP_NAVIGATION_OFFSET;
- mainSoundProperty.value = 23;
- mainSoundPropertyList.push_back(mainSoundProperty);
- mainSoundProperty.type = MSP_TEST;
- mainSoundProperty.value = 3;
- mainSoundPropertyList.push_back(mainSoundProperty);
- return mainSoundPropertyList;
-}
-
-void CommonFunctions::createSink(am_Sink_s& sink) const {
- sink.name = "AnySink";
- sink.domainID = 4;
- sink.available.availability = A_AVAILABLE;
- sink.available.availabilityReason = AR_NEWMEDIA;
- sink.sinkClassID = 1;
- sink.listConnectionFormats = getStandardConnectionFormatList();
- sink.listSoundProperties = getStandardSoundPropertyList();
- sink.listMainSoundProperties = getStandardMainSoundPropertyList();
- sink.mainVolume = 12;
- sink.muteState = MS_UNMUTED;
- sink.visible = true;
- sink.volume = 23;
- sink.sinkID = 0;
-}
-
-void CommonFunctions::createSource(am_Source_s& source) const {
- source.name = "AnySource";
- source.domainID = 4;
- source.available.availability = A_AVAILABLE;
- source.available.availabilityReason = AR_NEWMEDIA;
- source.sourceClassID = 1;
- source.listConnectionFormats = getStandardConnectionFormatList();
- source.listSoundProperties = getStandardSoundPropertyList();
- source.listMainSoundProperties = getStandardMainSoundPropertyList();
- source.interruptState = IS_OFF;
- source.visible = true;
- source.volume = 23;
- source.sourceID = 0;
- source.sourceState = SS_ON;
-}
-
-void CommonFunctions::createDomain(am_Domain_s & domain) const {
-
- domain.domainID = 0;
- domain.name = "AnyDomain";
- domain.nodename = "AnyNode";
- domain.busname = "AnyBusname";
- domain.complete = true;
- domain.early = true;
- domain.state = DS_CONTROLLED;
-}
-
-void CommonFunctions::createGateway(am_Gateway_s & gateway) {
- gateway.name = "AnyGateway";
- gateway.sinkID = 1;
- gateway.sourceID = 2;
- gateway.controlDomainID = 1;
- gateway.domainSinkID = 3;
- gateway.domainSourceID = 4;
- gateway.convertionMatrix = getStandardConvertionMatrix();
- gateway.listSourceFormats = getStandardConnectionFormatList();
- gateway.listSinkFormats = getStandardConnectionFormatList();
- gateway.gatewayID = 0;
-
-}
-
-void CommonFunctions::createConnection(am_Connection_s & connection) const {
- connection.connectionID = 0;
- connection.sinkID = 1;
- connection.sourceID = 2;
- connection.delay = -1;
- connection.connectionFormat = CF_ANALOG;
-}
-
-void CommonFunctions::createMainConnection(am_MainConnection_s & mainConnection,
- am_Route_s route) const {
- mainConnection.connectionID = 0;
- mainConnection.connectionState = CS_CONNECTED;
- mainConnection.route = route;
- mainConnection.delay = -1;
-}
-
-std::vector<bool> CommonFunctions::getStandardConvertionMatrix() {
- std::vector<bool> convMatrix;
- convMatrix.push_back(true);
- convMatrix.push_back(false);
- convMatrix.push_back(true);
- convMatrix.push_back(false);
- convMatrix.push_back(true);
- convMatrix.push_back(true);
- return convMatrix;
-}
-
-void CommonFunctions::connectionList2RoutingList(
- std::vector<am_RoutingElement_s> & routingList,
- const std::vector<am_Connection_s>& connectionList) {
- am_RoutingElement_s routingElement;
- std::vector<am_Connection_s>::const_iterator cIterator =
- connectionList.begin();
- for (; cIterator < connectionList.end(); ++cIterator) {
- routingElement.sinkID = cIterator->sinkID;
- routingElement.sourceID = cIterator->sourceID;
- routingElement.connectionFormat = cIterator->connectionFormat;
- routingElement.domainID = 4; //todo: make this test read out the real value
- routingList.push_back(routingElement);
- }
+bool equalSoundProperty(const am_SoundProperty_s a, const am_SoundProperty_s b)
+{
+ return (a.type == b.type && a.value == b.value);
+}
+
+bool equalMainSoundProperty(const am_MainSoundProperty_s a, const am_MainSoundProperty_s b)
+{
+ return (a.type == b.type && a.value == b.value);
+}
+
+bool equalRoutingElement(const am_RoutingElement_s a, const am_RoutingElement_s b)
+{
+ return (a.connectionFormat == b.connectionFormat && a.domainID == b.domainID && a.sinkID == b.sinkID && a.sourceID == b.sourceID);
}
+bool equalClassProperties(const am_ClassProperty_s a, const am_ClassProperty_s b)
+{
+ return (a.classProperty == b.classProperty && a.value == b.value);
+}
+std::string int2string(int i)
+{
+ std::stringstream out;
+ out << i;
+ return out.str();
+}
+bool CommonFunctions::compareSource(std::vector<am_Source_s>::iterator listIterator, const am_Source_s& sourceData)
+{
+ return (listIterator->available.availability == sourceData.available.availability) && (listIterator->available.availabilityReason == sourceData.available.availabilityReason) && (listIterator->sourceClassID == sourceData.sourceClassID) && (listIterator->domainID == sourceData.domainID) && (listIterator->interruptState == sourceData.interruptState) && (listIterator->visible == sourceData.visible) && (listIterator->name.compare(sourceData.name) == 0) && (listIterator->volume == sourceData.volume) && std::equal(listIterator->listConnectionFormats.begin(), listIterator->listConnectionFormats.end(), sourceData.listConnectionFormats.begin())
+ && std::equal(listIterator->listMainSoundProperties.begin(), listIterator->listMainSoundProperties.end(), sourceData.listMainSoundProperties.begin(), equalMainSoundProperty) && std::equal(listIterator->listSoundProperties.begin(), listIterator->listSoundProperties.end(), sourceData.listSoundProperties.begin(), equalSoundProperty);
+}
+bool CommonFunctions::compareSink(std::vector<am_Sink_s>::iterator listIterator, const am_Sink_s& sinkData)
+{
+ return (listIterator->available.availability == sinkData.available.availability) && (listIterator->available.availabilityReason == sinkData.available.availabilityReason) && (listIterator->sinkClassID == sinkData.sinkClassID) && (listIterator->domainID == sinkData.domainID) && (listIterator->mainVolume == sinkData.mainVolume) && (listIterator->muteState == sinkData.muteState) && (listIterator->visible == sinkData.visible) && (listIterator->name.compare(sinkData.name) == 0) && (listIterator->volume == sinkData.volume) && std::equal(listIterator->listConnectionFormats.begin(), listIterator->listConnectionFormats.end(), sinkData.listConnectionFormats.begin())
+ && std::equal(listIterator->listMainSoundProperties.begin(), listIterator->listMainSoundProperties.end(), sinkData.listMainSoundProperties.begin(), equalMainSoundProperty) && std::equal(listIterator->listSoundProperties.begin(), listIterator->listSoundProperties.end(), sinkData.listSoundProperties.begin(), equalSoundProperty);
+}
+bool CommonFunctions::compareGateway(std::vector<am_Gateway_s>::iterator listIterator, const am_Gateway_s& gatewayData)
+{
+ return (listIterator->name.compare(gatewayData.name) == 0) && (listIterator->sinkID == gatewayData.sinkID) && (listIterator->sourceID == gatewayData.sourceID) && (listIterator->controlDomainID == gatewayData.controlDomainID) && (listIterator->domainSinkID == gatewayData.domainSinkID) && (listIterator->domainSourceID == gatewayData.domainSourceID) && std::equal(listIterator->convertionMatrix.begin(), listIterator->convertionMatrix.end(), gatewayData.convertionMatrix.begin()) && std::equal(listIterator->listSourceFormats.begin(), listIterator->listSourceFormats.end(), gatewayData.listSourceFormats.begin()) && std::equal(listIterator->listSinkFormats.begin(), listIterator->listSinkFormats.end(), gatewayData.listSinkFormats.begin());
+}
+bool CommonFunctions::compareGateway1(const am_Gateway_s gateway1, const am_Gateway_s gatewayData)
+{
+ return (gateway1.name.compare(gatewayData.name) == 0) && (gateway1.sinkID == gatewayData.sinkID) && (gateway1.sourceID == gatewayData.sourceID) && (gateway1.controlDomainID == gatewayData.controlDomainID) && (gateway1.domainSinkID == gatewayData.domainSinkID) && (gateway1.domainSourceID == gatewayData.domainSourceID) && std::equal(gateway1.convertionMatrix.begin(), gateway1.convertionMatrix.end(), gatewayData.convertionMatrix.begin()) && std::equal(gateway1.listSourceFormats.begin(), gateway1.listSourceFormats.end(), gatewayData.listSourceFormats.begin()) && std::equal(gateway1.listSinkFormats.begin(), gateway1.listSinkFormats.end(), gatewayData.listSinkFormats.begin());
+}
+bool CommonFunctions::compareSinkMainSink(std::vector<am_SinkType_s>::iterator listIterator, const std::vector<am_Sink_s>& sinkList)
+{
+ std::vector<am_Sink_s>::const_iterator sinkListIterator = sinkList.begin();
+ for (; sinkListIterator < sinkList.end(); ++sinkListIterator)
+ {
+ if (listIterator->sinkID == sinkListIterator->sinkID)
+ {
+ return (listIterator->name.compare(sinkListIterator->name) == 0) && (listIterator->availability.availability == sinkListIterator->available.availability) && (listIterator->availability.availabilityReason == sinkListIterator->available.availabilityReason) && (listIterator->muteState == sinkListIterator->muteState) && (listIterator->volume == sinkListIterator->mainVolume) && (listIterator->sinkClassID == sinkListIterator->sinkClassID);
+ }
+ }
+ return false;
+}
+
+bool CommonFunctions::compareSinkMainSource(std::vector<am_SourceType_s>::iterator listIterator, const std::vector<am_Source_s>& sourceList)
+{
+ std::vector<am_Source_s>::const_iterator sinkListIterator = sourceList.begin();
+ for (; sinkListIterator < sourceList.end(); ++sinkListIterator)
+ {
+ if (listIterator->sourceID == sinkListIterator->sourceID)
+ {
+ return (listIterator->name.compare(sinkListIterator->name) == 0) && (listIterator->availability.availability == sinkListIterator->available.availability) && (listIterator->availability.availabilityReason == sinkListIterator->available.availabilityReason) && (listIterator->sourceClassID == sinkListIterator->sourceClassID);
+ }
+ }
+ return false;
+}
+bool CommonFunctions::compareRoute(am_Route_s a, am_Route_s b)
+{
+ bool retVal = true;
+ std::vector<am_RoutingElement_s>::iterator itA = a.route.begin(), itB = b.route.begin();
+ retVal &= a.sourceID == b.sourceID;
+ retVal &= a.sinkID == b.sinkID;
+ for (; itA != a.route.end(); ++itA)
+ {
+ retVal &= itA->sinkID == itB->sinkID;
+ retVal &= itA->sourceID == itB->sourceID;
+ retVal &= itA->connectionFormat == itB->connectionFormat;
+ retVal &= itA->domainID == itB->domainID;
+ itB++;
+ }
+ return retVal;
+}
+
+std::vector<am_ConnectionFormat_e> CommonFunctions::getStandardConnectionFormatList()
+{
+ std::vector<am_ConnectionFormat_e> list;
+ list.push_back(CF_ANALOG);
+ list.push_back(CF_STEREO);
+ return list;
+}
+
+std::vector<am_SoundProperty_s> CommonFunctions::getStandardSoundPropertyList()
+{
+ std::vector<am_SoundProperty_s> soundPropertyList;
+ am_SoundProperty_s soundProperty;
+ soundProperty.type = SP_BASS;
+ soundProperty.value = 23;
+ soundPropertyList.push_back(soundProperty);
+ soundProperty.type = SP_MID;
+ soundProperty.value = 2;
+ soundPropertyList.push_back(soundProperty);
+ return soundPropertyList;
+}
+
+std::vector<am_MainSoundProperty_s> CommonFunctions::getStandardMainSoundPropertyList()
+{
+ std::vector<am_MainSoundProperty_s> mainSoundPropertyList;
+ am_MainSoundProperty_s mainSoundProperty;
+ mainSoundProperty.type = MSP_NAVIGATION_OFFSET;
+ mainSoundProperty.value = 23;
+ mainSoundPropertyList.push_back(mainSoundProperty);
+ mainSoundProperty.type = MSP_TEST;
+ mainSoundProperty.value = 3;
+ mainSoundPropertyList.push_back(mainSoundProperty);
+ return mainSoundPropertyList;
+}
+
+void CommonFunctions::createSink(am_Sink_s& sink) const
+{
+ sink.name = "AnySink";
+ sink.domainID = 4;
+ sink.available.availability = A_AVAILABLE;
+ sink.available.availabilityReason = AR_NEWMEDIA;
+ sink.sinkClassID = 1;
+ sink.listConnectionFormats = getStandardConnectionFormatList();
+ sink.listSoundProperties = getStandardSoundPropertyList();
+ sink.listMainSoundProperties = getStandardMainSoundPropertyList();
+ sink.mainVolume = 12;
+ sink.muteState = MS_UNMUTED;
+ sink.visible = true;
+ sink.volume = 23;
+ sink.sinkID = 0;
+}
+
+void CommonFunctions::createSource(am_Source_s& source) const
+{
+ source.name = "AnySource";
+ source.domainID = 4;
+ source.available.availability = A_AVAILABLE;
+ source.available.availabilityReason = AR_NEWMEDIA;
+ source.sourceClassID = 1;
+ source.listConnectionFormats = getStandardConnectionFormatList();
+ source.listSoundProperties = getStandardSoundPropertyList();
+ source.listMainSoundProperties = getStandardMainSoundPropertyList();
+ source.interruptState = IS_OFF;
+ source.visible = true;
+ source.volume = 23;
+ source.sourceID = 0;
+ source.sourceState = SS_ON;
+}
+
+void CommonFunctions::createDomain(am_Domain_s & domain) const
+{
+
+ domain.domainID = 0;
+ domain.name = "AnyDomain";
+ domain.nodename = "AnyNode";
+ domain.busname = "AnyBusname";
+ domain.complete = true;
+ domain.early = true;
+ domain.state = DS_CONTROLLED;
+}
+
+void CommonFunctions::createGateway(am_Gateway_s & gateway)
+{
+ gateway.name = "AnyGateway";
+ gateway.sinkID = 1;
+ gateway.sourceID = 2;
+ gateway.controlDomainID = 1;
+ gateway.domainSinkID = 3;
+ gateway.domainSourceID = 4;
+ gateway.convertionMatrix = getStandardConvertionMatrix();
+ gateway.listSourceFormats = getStandardConnectionFormatList();
+ gateway.listSinkFormats = getStandardConnectionFormatList();
+ gateway.gatewayID = 0;
+
+}
+
+void CommonFunctions::createConnection(am_Connection_s & connection) const
+{
+ connection.connectionID = 0;
+ connection.sinkID = 1;
+ connection.sourceID = 2;
+ connection.delay = -1;
+ connection.connectionFormat = CF_ANALOG;
+}
+
+void CommonFunctions::createMainConnection(am_MainConnection_s & mainConnection, am_Route_s route) const
+{
+ mainConnection.connectionID = 0;
+ mainConnection.connectionState = CS_CONNECTED;
+ mainConnection.route = route;
+ mainConnection.delay = -1;
+}
+
+std::vector<bool> CommonFunctions::getStandardConvertionMatrix()
+{
+ std::vector<bool> convMatrix;
+ convMatrix.push_back(true);
+ convMatrix.push_back(false);
+ convMatrix.push_back(true);
+ convMatrix.push_back(false);
+ convMatrix.push_back(true);
+ convMatrix.push_back(true);
+ return convMatrix;
+}
+
+void CommonFunctions::connectionList2RoutingList(std::vector<am_RoutingElement_s> & routingList, const std::vector<am_Connection_s>& connectionList)
+{
+ am_RoutingElement_s routingElement;
+ std::vector<am_Connection_s>::const_iterator cIterator = connectionList.begin();
+ for (; cIterator < connectionList.end(); ++cIterator)
+ {
+ routingElement.sinkID = cIterator->sinkID;
+ routingElement.sourceID = cIterator->sourceID;
+ routingElement.connectionFormat = cIterator->connectionFormat;
+ routingElement.domainID = 4; //todo: make this test read out the real value
+ routingList.push_back(routingElement);
+ }
+}
diff --git a/AudioManagerDaemon/test/CommonFunctions.h b/AudioManagerDaemon/test/CommonFunctions.h
index af6d43b..7bc7e04 100644
--- a/AudioManagerDaemon/test/CommonFunctions.h
+++ b/AudioManagerDaemon/test/CommonFunctions.h
@@ -1,91 +1,92 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file CommonFunctions.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file CommonFunctions.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef COMMONHEADERS_H_
#define COMMONHEADERS_H_
#include "audiomanagertypes.h"
-namespace am {
+namespace am
+{
class CommonFunctions
{
public:
- static std::vector<am_ConnectionFormat_e> getStandardConnectionFormatList();
- static std::vector<am_SoundProperty_s> getStandardSoundPropertyList();
- static std::vector<am_MainSoundProperty_s> getStandardMainSoundPropertyList();
- static std::vector<bool> getStandardConvertionMatrix();
- bool compareSource(std::vector<am_Source_s>::iterator listIterator, const am_Source_s& sourceData);
- bool compareSink(std::vector<am_Sink_s>::iterator listIterator, const am_Sink_s& sinkData);
- bool compareGateway(std::vector<am_Gateway_s>::iterator listIterator, const am_Gateway_s& gatewayData);
- bool compareGateway1(const am_Gateway_s gateway1, const am_Gateway_s gatewayData);
- bool compareSinkMainSink(std::vector<am_SinkType_s>::iterator listIterator, const std::vector<am_Sink_s>& sinkList);
- bool compareSinkMainSource(std::vector<am_SourceType_s>::iterator listIterator, const std::vector<am_Source_s>& sourceList);
- void createSink(am_Sink_s& sink) const;
- void createSource(am_Source_s& source) const ;
- void createDomain(am_Domain_s& domain) const;
- void createGateway(am_Gateway_s& gateway);
- void createConnection(am_Connection_s& connection) const ;
- void createMainConnection(am_MainConnection_s& mainConnection, am_Route_s route) const;
- void connectionList2RoutingList(std::vector<am_RoutingElement_s>& routingList, const std::vector<am_Connection_s>& connectionList);
+ static std::vector<am_ConnectionFormat_e> getStandardConnectionFormatList();
+ static std::vector<am_SoundProperty_s> getStandardSoundPropertyList();
+ static std::vector<am_MainSoundProperty_s> getStandardMainSoundPropertyList();
+ static std::vector<bool> getStandardConvertionMatrix();
+ bool compareSource(std::vector<am_Source_s>::iterator listIterator, const am_Source_s& sourceData);
+ bool compareSink(std::vector<am_Sink_s>::iterator listIterator, const am_Sink_s& sinkData);
+ bool compareGateway(std::vector<am_Gateway_s>::iterator listIterator, const am_Gateway_s& gatewayData);
+ bool compareGateway1(const am_Gateway_s gateway1, const am_Gateway_s gatewayData);
+ bool compareSinkMainSink(std::vector<am_SinkType_s>::iterator listIterator, const std::vector<am_Sink_s>& sinkList);
+ bool compareSinkMainSource(std::vector<am_SourceType_s>::iterator listIterator, const std::vector<am_Source_s>& sourceList);
+ bool compareRoute(am_Route_s a, am_Route_s b);
+ void createSink(am_Sink_s& sink) const;
+ void createSource(am_Source_s& source) const;
+ void createDomain(am_Domain_s& domain) const;
+ void createGateway(am_Gateway_s& gateway);
+ void createConnection(am_Connection_s& connection) const;
+ void createMainConnection(am_MainConnection_s& mainConnection, am_Route_s route) const;
+ void connectionList2RoutingList(std::vector<am_RoutingElement_s>& routingList, const std::vector<am_Connection_s>& connectionList);
- struct sortBySinkID
- {
- bool operator()(const am_RoutingElement_s & a, const am_RoutingElement_s & b) const
- {
- return (a.sinkID < b.sinkID);
- }
- };
+ struct sortBySinkID
+ {
+ bool operator()(const am_RoutingElement_s & a, const am_RoutingElement_s & b) const
+ {
+ return (a.sinkID < b.sinkID);
+ }
+ };
- struct sortByConnectionFormat
- {
- bool operator()(const am_ConnectionFormat_e & a, const am_ConnectionFormat_e & b) const
- {
- return (a < b);
- }
- };
+ struct sortByConnectionFormat
+ {
+ bool operator()(const am_ConnectionFormat_e & a, const am_ConnectionFormat_e & b) const
+ {
+ return (a < b);
+ }
+ };
- struct sortByMainSoundProperty
- {
- bool operator()(const am_MainSoundProperty_s & a, const am_MainSoundProperty_s & b) const
- {
- return (a.type > b.type);
- }
- };
+ struct sortByMainSoundProperty
+ {
+ bool operator()(const am_MainSoundProperty_s & a, const am_MainSoundProperty_s & b) const
+ {
+ return (a.type > b.type);
+ }
+ };
- struct sortBySoundProperty
- {
- bool operator()(const am_SoundProperty_s & a, const am_SoundProperty_s & b) const
- {
- return (a.type < b.type);
- }
- };
+ struct sortBySoundProperty
+ {
+ bool operator()(const am_SoundProperty_s & a, const am_SoundProperty_s & b) const
+ {
+ return (a.type < b.type);
+ }
+ };
};
}
-
#endif /* COMMONHEADERS_H_ */
diff --git a/AudioManagerDaemon/test/ControlInterfaceBackdoor.h b/AudioManagerDaemon/test/ControlInterfaceBackdoor.h
index b07f3ad..135bc48 100644
--- a/AudioManagerDaemon/test/ControlInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/ControlInterfaceBackdoor.h
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file ControlInterfaceBackdoor.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file ControlInterfaceBackdoor.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef CONTROLINTERFACEBACKDOOR_H_
#define CONTROLINTERFACEBACKDOOR_H_
@@ -29,15 +29,17 @@
#include "control/ControlSendInterface.h"
#include "ControlSender.h"
-namespace am {
+namespace am
+{
class ControlSender;
-class ControlInterfaceBackdoor {
+class ControlInterfaceBackdoor
+{
public:
- ControlInterfaceBackdoor();
- virtual ~ControlInterfaceBackdoor();
- bool replaceController(ControlSender *controlSender, ControlSendInterface *newController);
+ ControlInterfaceBackdoor();
+ virtual ~ControlInterfaceBackdoor();
+ bool replaceController(ControlSender *controlSender, ControlSendInterface *newController);
};
}
diff --git a/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h b/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h
index b7e7624..ff7ffdb 100644
--- a/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h
@@ -1,43 +1,45 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file RoutingInterfaceBackdoor.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file RoutingInterfaceBackdoor.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef ROUTINGINTERFACEBACKDOOR_H_
#define ROUTINGINTERFACEBACKDOOR_H_
#include "RoutingSender.h"
-namespace am {
+namespace am
+{
class RoutingSender;
-class RoutingInterfaceBackdoor {
+class RoutingInterfaceBackdoor
+{
public:
- RoutingInterfaceBackdoor();
- virtual ~RoutingInterfaceBackdoor();
- bool unloadPlugins(RoutingSender *RoutingSender);
- bool injectInterface(RoutingSender *RoutingSender, RoutingSendInterface *newInterface, const std::string& busname);
+ RoutingInterfaceBackdoor();
+ virtual ~RoutingInterfaceBackdoor();
+ bool unloadPlugins(RoutingSender *RoutingSender);
+ bool injectInterface(RoutingSender *RoutingSender, RoutingSendInterface *newInterface, const std::string& busname);
};
}
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
index 2efcc64..5d3a4f1 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file controlInterfaceTest.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file controlInterfaceTest.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 "controlInterfaceTest.h"
#include <algorithm>
@@ -33,26 +33,26 @@ using namespace testing;
DLT_DECLARE_CONTEXT(DLT_CONTEXT)
-controlInterfaceTest::controlInterfaceTest()
- :pDBusWrapper((DBusWrapper*)1), //to get rid of assert
- plistCommandPluginDirs(),
- plistRoutingPluginDirs(),
- pDatabaseHandler(std::string(":memory:")),
- pRoutingSender(plistRoutingPluginDirs),
- pCommandSender(plistCommandPluginDirs),
- pMockControlInterface(),
- pMockRoutingInterface(),
- pControlSender(std::string("")),
- pRoutingInterfaceBackdoor(),
- pCommandInterfaceBackdoor(),
- pControlInterfaceBackdoor(),
- pDatabaseObserver(&pCommandSender,&pRoutingSender),
- pControlReceiver(&pDatabaseHandler,&pRoutingSender,&pCommandSender),
- pRoutingReceiver(&pDatabaseHandler,&pRoutingSender,&pControlSender,pDBusWrapper)
+controlInterfaceTest::controlInterfaceTest() :
+ pDBusWrapper((DBusWrapper*) 1), //
+ plistCommandPluginDirs(), //
+ plistRoutingPluginDirs(), //
+ pDatabaseHandler(std::string(":memory:")), //
+ pRoutingSender(plistRoutingPluginDirs), //
+ pCommandSender(plistCommandPluginDirs), //
+ pMockControlInterface(), //
+ pMockRoutingInterface(), //
+ pControlSender(std::string("")), //
+ pRoutingInterfaceBackdoor(), //
+ pCommandInterfaceBackdoor(), //
+ pControlInterfaceBackdoor(), //
+ pDatabaseObserver(&pCommandSender, &pRoutingSender), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
+ pRoutingReceiver(&pDatabaseHandler, &pRoutingSender, &pControlSender, pDBusWrapper)
{
- pDatabaseHandler.registerObserver(&pDatabaseObserver);
- pControlInterfaceBackdoor.replaceController(&pControlSender,&pMockControlInterface);
- pRoutingInterfaceBackdoor.injectInterface(&pRoutingSender,&pMockRoutingInterface,"mock");
+ pDatabaseHandler.registerObserver(&pDatabaseObserver);
+ pControlInterfaceBackdoor.replaceController(&pControlSender, &pMockControlInterface);
+ pRoutingInterfaceBackdoor.injectInterface(&pRoutingSender, &pMockRoutingInterface, "mock");
}
@@ -62,473 +62,472 @@ controlInterfaceTest::~controlInterfaceTest()
void controlInterfaceTest::SetUp()
{
- DLT_REGISTER_APP("Rtest","RoutingInterfacetest");
- DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context");
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
+ DLT_REGISTER_APP("Rtest", "RoutingInterfacetest");
+ DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
}
void controlInterfaceTest::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
TEST_F(controlInterfaceTest,registerDomain)
{
- am_Domain_s domain;
- am_domainID_t domainID;
- pCF.createDomain(domain);
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ pCF.createDomain(domain);
- //When we run this test, we expect the call on the control interface
- EXPECT_CALL(pMockControlInterface,hookSystemRegisterDomain(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2),Return(E_OK)));
- ASSERT_EQ(E_OK,pRoutingReceiver.registerDomain(domain,domainID));
- ASSERT_EQ(domainID,2);
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemRegisterDomain(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2), Return(E_OK)));
+ ASSERT_EQ(E_OK, pRoutingReceiver.registerDomain(domain,domainID));
+ ASSERT_EQ(domainID, 2);
}
TEST_F(controlInterfaceTest,deregisterDomain)
{
- am_domainID_t domainID=34;
+ am_domainID_t domainID = 34;
- //When we run this test, we expect the call on the control interface
- EXPECT_CALL(pMockControlInterface,hookSystemDeregisterDomain(34)).WillRepeatedly(Return(E_OK));
- ASSERT_EQ(E_OK,pRoutingReceiver.deregisterDomain(domainID));
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemDeregisterDomain(34)).WillRepeatedly(Return(E_OK));
+ ASSERT_EQ(E_OK, pRoutingReceiver.deregisterDomain(domainID));
}
TEST_F(controlInterfaceTest,registerSink)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
-
- //When we run this test, we expect the call on the control interface
- EXPECT_CALL(pMockControlInterface,hookSystemRegisterSink(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2),Return(E_OK)));
- ASSERT_EQ(E_OK,pRoutingReceiver.registerSink(sink,sinkID));
- ASSERT_EQ(sinkID,2);
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ pCF.createSink(sink);
+
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemRegisterSink(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2), Return(E_OK)));
+ ASSERT_EQ(E_OK, pRoutingReceiver.registerSink(sink,sinkID));
+ ASSERT_EQ(sinkID, 2);
}
TEST_F(controlInterfaceTest,deregisterSink)
{
- am_sinkID_t sinkID=12;
+ am_sinkID_t sinkID = 12;
- //When we run this test, we expect the call on the control interface
- EXPECT_CALL(pMockControlInterface,hookSystemDeregisterSink(12)).WillRepeatedly(Return(E_OK));
- ASSERT_EQ(E_OK,pRoutingReceiver.deregisterSink(sinkID));
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemDeregisterSink(12)).WillRepeatedly(Return(E_OK));
+ ASSERT_EQ(E_OK, pRoutingReceiver.deregisterSink(sinkID));
}
TEST_F(controlInterfaceTest,registerSource)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- pCF.createSource(source);
-
- //When we run this test, we expect the call on the control interface
- EXPECT_CALL(pMockControlInterface,hookSystemRegisterSource(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2),Return(E_OK)));
- ASSERT_EQ(E_OK,pRoutingReceiver.registerSource(source,sourceID));
- ASSERT_EQ(sourceID,2);
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ pCF.createSource(source);
+
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemRegisterSource(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2), Return(E_OK)));
+ ASSERT_EQ(E_OK, pRoutingReceiver.registerSource(source,sourceID));
+ ASSERT_EQ(sourceID, 2);
}
TEST_F(controlInterfaceTest,deregisterSource)
{
- am_sourceID_t sourceID=12;
+ am_sourceID_t sourceID = 12;
- //When we run this test, we expect the call on the control interface
- EXPECT_CALL(pMockControlInterface,hookSystemDeregisterSource(12)).WillRepeatedly(Return(E_OK));
- ASSERT_EQ(E_OK,pRoutingReceiver.deregisterSource(sourceID));
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemDeregisterSource(12)).WillRepeatedly(Return(E_OK));
+ ASSERT_EQ(E_OK, pRoutingReceiver.deregisterSource(sourceID));
}
TEST_F(controlInterfaceTest,registerGateway)
{
- am_Gateway_s gateway;
- am_gatewayID_t gatewayID;
- pCF.createGateway(gateway);
-
- //When we run this test, we expect the call on the control interface
- EXPECT_CALL(pMockControlInterface,hookSystemRegisterGateway(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2),Return(E_OK)));
- ASSERT_EQ(E_OK,pRoutingReceiver.registerGateway(gateway,gatewayID));
- ASSERT_EQ(gatewayID,2);
+ am_Gateway_s gateway;
+ am_gatewayID_t gatewayID;
+ pCF.createGateway(gateway);
+
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemRegisterGateway(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2), Return(E_OK)));
+ ASSERT_EQ(E_OK, pRoutingReceiver.registerGateway(gateway,gatewayID));
+ ASSERT_EQ(gatewayID, 2);
}
TEST_F(controlInterfaceTest,deregisterGateway)
{
- am_gatewayID_t gatewayID=12;
+ am_gatewayID_t gatewayID = 12;
- //When we run this test, we expect the call on the control interface
- EXPECT_CALL(pMockControlInterface,hookSystemDeregisterGateway(12)).WillRepeatedly(Return(E_OK));
- ASSERT_EQ(E_OK,pRoutingReceiver.deregisterGateway(gatewayID));
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemDeregisterGateway(12)).WillRepeatedly(Return(E_OK));
+ ASSERT_EQ(E_OK, pRoutingReceiver.deregisterGateway(gatewayID));
}
-
TEST_F(controlInterfaceTest,ackConnect)
{
- am_connectionID_t connectionID;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
- std::vector<am_Connection_s> connectionList;
- std::vector<am_Handle_s> handlesList;
- am_Handle_s handle;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
-
- //prepare the stage
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- //when asyncConnect is called, we expect a call on the routingInterface
- EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_STEREO)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
-
- //The handle should have the correct type
- ASSERT_EQ(handle.handleType,H_CONNECT);
- ASSERT_EQ(handle.handle,1);
- ASSERT_EQ(connectionID,1);
-
- //The list of handles shall have the handle inside
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_EQ(handlesList[0].handle,handle.handle);
- ASSERT_EQ(handlesList[0].handleType,handle.handleType);
-
- //we check the list of connections - but it must be empty because the ack did not arrive yet
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(connectionList.empty());
-
- //finally we answer via the RoutingInterface and expect a call on the controlInterface
- EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
- pRoutingReceiver.ackConnect(handle,connectionID,E_OK);
-
- //the list of handles must be empty now
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_TRUE(handlesList.empty());
-
- //but the connection must be in the connectionlist
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(!connectionList.empty());
-
- //no we try the same, but do expect a no_change answer directly and no call because connection already exists
- ASSERT_EQ(E_ALREADY_EXISTS,pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
+ am_connectionID_t connectionID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ std::vector<am_Connection_s> connectionList;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+
+ //prepare the stage
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //when asyncConnect is called, we expect a call on the routingInterface
+ EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_STEREO)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
+
+ //The handle should have the correct type
+ ASSERT_EQ(handle.handleType, H_CONNECT);
+ ASSERT_EQ(handle.handle, 1);
+ ASSERT_EQ(connectionID, 1);
+
+ //The list of handles shall have the handle inside
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle, handle.handle);
+ ASSERT_EQ(handlesList[0].handleType, handle.handleType);
+
+ //we check the list of connections - but it must be empty because the ack did not arrive yet
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
+ ASSERT_TRUE(connectionList.empty());
+
+ //finally we answer via the RoutingInterface and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
+ pRoutingReceiver.ackConnect(handle, connectionID, E_OK);
+
+ //the list of handles must be empty now
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //but the connection must be in the connectionlist
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
+ ASSERT_TRUE(!connectionList.empty());
+
+ //no we try the same, but do expect a no_change answer directly and no call because connection already exists
+ ASSERT_EQ(E_ALREADY_EXISTS, pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
}
TEST_F(controlInterfaceTest,ackDisconnect)
{
- am_connectionID_t connectionID;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
- std::vector<am_Connection_s> connectionList;
- std::vector<am_Handle_s> handlesList;
- am_Handle_s handle;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
-
- //prepare the stage
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- //now we first need to connect, we expect a call on the routing interface
- EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_STEREO)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
-
- //answer with an ack to insert the connection in the database
- EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
- pRoutingReceiver.ackConnect(handle,connectionID,E_OK);
-
- //now we can start to disconnect and expect a call on the routing interface
- EXPECT_CALL(pMockRoutingInterface,asyncDisconnect(_,1)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.disconnect(handle,1));
-
- //during the disconnection, the connection is still in the list!
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(!connectionList.empty());
-
- //then we fire the ack and expect a call on the controlInterface
- EXPECT_CALL(pMockControlInterface,cbAckDisconnect(_,E_OK)).Times(1);
- pRoutingReceiver.ackDisconnect(handle,connectionID,E_OK);
-
- //make sure the handle is gone
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_TRUE(handlesList.empty());
-
- //make sure the connection is gone
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(connectionList.empty());
-
- //Now let's try to disconnect what is not existing...
- ASSERT_EQ(E_NON_EXISTENT,pControlReceiver.disconnect(handle,2));
+ am_connectionID_t connectionID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ std::vector<am_Connection_s> connectionList;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+
+ //prepare the stage
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //now we first need to connect, we expect a call on the routing interface
+ EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_STEREO)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
+
+ //answer with an ack to insert the connection in the database
+ EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
+ pRoutingReceiver.ackConnect(handle, connectionID, E_OK);
+
+ //now we can start to disconnect and expect a call on the routing interface
+ EXPECT_CALL(pMockRoutingInterface,asyncDisconnect(_,1)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK, pControlReceiver.disconnect(handle,1));
+
+ //during the disconnection, the connection is still in the list!
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
+ ASSERT_TRUE(!connectionList.empty());
+
+ //then we fire the ack and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckDisconnect(_,E_OK)).Times(1);
+ pRoutingReceiver.ackDisconnect(handle, connectionID, E_OK);
+
+ //make sure the handle is gone
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //make sure the connection is gone
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
+ ASSERT_TRUE(connectionList.empty());
+
+ //Now let's try to disconnect what is not existing...
+ ASSERT_EQ(E_NON_EXISTENT, pControlReceiver.disconnect(handle,2));
}
TEST_F(controlInterfaceTest,setSourceState)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- am_Domain_s domain;
- am_domainID_t domainID;
- std::vector<am_Handle_s> handlesList;
- am_Handle_s handle;
- am_SourceState_e state;
- pCF.createSource(source);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- source.sourceID=2;
- source.domainID=1;
-
- //prepare the stage
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
-
- //we set the sourcestate and expect a call on the routingInterface
- EXPECT_CALL(pMockRoutingInterface,asyncSetSourceState(_,2,SS_PAUSED)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
-
- //we want our handle in the list and let the type be the right one
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_EQ(handlesList[0].handle,handle.handle);
- ASSERT_EQ(handlesList[0].handleType,H_SETSOURCESTATE);
-
- //the state must be unchanged because did not get the ack
- ASSERT_EQ(E_OK,pDatabaseHandler.getSoureState(source.sourceID,state));
- ASSERT_EQ(state,SS_ON);
-
- //now we sent out the ack and expect a call on the controlInterface
- EXPECT_CALL(pMockControlInterface,cbAckSetSourceState(_,E_OK)).Times(1);
- pRoutingReceiver.ackSetSourceState(handle,E_OK);
-
- //finally we need the sourcestate to be changed
- ASSERT_EQ(E_OK,pDatabaseHandler.getSoureState(source.sourceID,state));
- ASSERT_EQ(state,SS_PAUSED);
-
- //make sure the handle is gone
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_TRUE(handlesList.empty());
-
- //we try again but expect a no change error
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ am_SourceState_e state;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ source.sourceID = 2;
+ source.domainID = 1;
+
+ //prepare the stage
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //we set the sourcestate and expect a call on the routingInterface
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSourceState(_,2,SS_PAUSED)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK, pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
+
+ //we want our handle in the list and let the type be the right one
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle, handle.handle);
+ ASSERT_EQ(handlesList[0].handleType, H_SETSOURCESTATE);
+
+ //the state must be unchanged because did not get the ack
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSoureState(source.sourceID,state));
+ ASSERT_EQ(state, SS_ON);
+
+ //now we sent out the ack and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSourceState(_,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSourceState(handle, E_OK);
+
+ //finally we need the sourcestate to be changed
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSoureState(source.sourceID,state));
+ ASSERT_EQ(state, SS_PAUSED);
+
+ //make sure the handle is gone
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //we try again but expect a no change error
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
}
TEST_F(controlInterfaceTest,SetSinkVolumeChange)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_volume_t volume;
- std::vector<am_Handle_s> handlesList;
- am_Handle_s handle;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- sink.volume=10;
-
- //setup environment, we need a domain and a sink
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- //set the volume and expect a call on the routing interface
- EXPECT_CALL(pMockRoutingInterface,asyncSetSinkVolume(_,2,11,RAMP_DIRECT,23)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_DIRECT,23));
-
- //check the list of handles. The handle must be in there and have the right type
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_EQ(handlesList[0].handle,handle.handle);
- ASSERT_EQ(handlesList[0].handleType,H_SETSINKVOLUME);
-
- //now we read out the volume, but we expect no change because the ack did not arrive yet
- ASSERT_EQ(E_OK,pDatabaseHandler.getSinkVolume(sinkID,volume));
- ASSERT_EQ(sink.volume,volume);
-
- //lets send the answer and expect a call on the controlInterface
- EXPECT_CALL(pMockControlInterface,cbAckSetSinkVolumeChange(_,11,E_OK)).Times(1);
- pRoutingReceiver.ackSetSinkVolumeChange(handle,11,E_OK);
-
- //finally, the new value must be in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.getSinkVolume(sinkID,volume));
- ASSERT_EQ(11,volume);
-
- //and the handle must be destroyed
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_TRUE(handlesList.empty());
-
- //Now we try again, but the value is unchanged
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_DIRECT,23));
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_volume_t volume;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+ sink.volume = 10;
+
+ //setup environment, we need a domain and a sink
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //set the volume and expect a call on the routing interface
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSinkVolume(_,2,11,RAMP_DIRECT,23)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK, pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_DIRECT,23));
+
+ //check the list of handles. The handle must be in there and have the right type
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle, handle.handle);
+ ASSERT_EQ(handlesList[0].handleType, H_SETSINKVOLUME);
+
+ //now we read out the volume, but we expect no change because the ack did not arrive yet
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSinkVolume(sinkID,volume));
+ ASSERT_EQ(sink.volume, volume);
+
+ //lets send the answer and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSinkVolumeChange(_,11,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSinkVolumeChange(handle, 11, E_OK);
+
+ //finally, the new value must be in the database
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSinkVolume(sinkID,volume));
+ ASSERT_EQ(11, volume);
+
+ //and the handle must be destroyed
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //Now we try again, but the value is unchanged
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_DIRECT,23));
}
TEST_F(controlInterfaceTest,ackSetSourceVolumeChange)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_volume_t volume;
- std::vector<am_Handle_s> handlesList;
- am_Handle_s handle;
- pCF.createSource(source);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- source.sourceID=2;
- source.domainID=1;
- source.volume=12;
-
- //prepare the scene
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
-
- //change the sinkVolume, expect a call on the routingInterface
- EXPECT_CALL(pMockRoutingInterface,asyncSetSourceVolume(_,2,11,RAMP_DIRECT,23)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_DIRECT,23));
-
- //check the list of handles. The handle must be in there and have the right type
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_EQ(handlesList[0].handle,handle.handle);
- ASSERT_EQ(handlesList[0].handleType,H_SETSOURCEVOLUME);
-
- //now we read out the volume, but we expect no change because the ack did not arrive yet
- ASSERT_EQ(E_OK,pDatabaseHandler.getSourceVolume(sourceID,volume));
- ASSERT_EQ(source.volume,volume);
-
- //lets send the answer and expect a call on the controlInterface
- EXPECT_CALL(pMockControlInterface,cbAckSetSourceVolumeChange(_,11,E_OK)).Times(1);
- pRoutingReceiver.ackSetSourceVolumeChange(handle,11,E_OK);
-
- //finally, the new value must be in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.getSourceVolume(sourceID,volume));
- ASSERT_EQ(11,volume);
-
- //and the handle must be destroyed
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_TRUE(handlesList.empty());
-
- //Now we try again, but the value is unchanged
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_DIRECT,23));
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_volume_t volume;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ source.sourceID = 2;
+ source.domainID = 1;
+ source.volume = 12;
+
+ //prepare the scene
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //change the sinkVolume, expect a call on the routingInterface
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSourceVolume(_,2,11,RAMP_DIRECT,23)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK, pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_DIRECT,23));
+
+ //check the list of handles. The handle must be in there and have the right type
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle, handle.handle);
+ ASSERT_EQ(handlesList[0].handleType, H_SETSOURCEVOLUME);
+
+ //now we read out the volume, but we expect no change because the ack did not arrive yet
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSourceVolume(sourceID,volume));
+ ASSERT_EQ(source.volume, volume);
+
+ //lets send the answer and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSourceVolumeChange(_,11,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSourceVolumeChange(handle, 11, E_OK);
+
+ //finally, the new value must be in the database
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSourceVolume(sourceID,volume));
+ ASSERT_EQ(11, volume);
+
+ //and the handle must be destroyed
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //Now we try again, but the value is unchanged
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_DIRECT,23));
}
TEST_F(controlInterfaceTest,ackSetSinkSoundProperty)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
- std::vector<am_Handle_s> handlesList;
- am_Handle_s handle;
- am_SoundProperty_s soundProperty;
- uint16_t oldvalue;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- soundProperty.type=SP_BASS;
- soundProperty.value=244;
-
- //setup environment, we need a domain and a sink
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- 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));
- 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,pControlReceiver.getListHandles(handlesList));
- ASSERT_EQ(handlesList[0].handle,handle.handle);
- ASSERT_EQ(handlesList[0].handleType,H_SETSINKSOUNDPROPERTY);
-
- //read out this property. There is no change, because the ack did not arrive yet.
- ASSERT_EQ(E_OK,pDatabaseHandler.getSinkSoundPropertyValue(2,SP_BASS,oldvalue));
- ASSERT_EQ(sink.listSoundProperties[0].value,oldvalue);
-
- //lets send the answer and expect a call on the controlInterface
- EXPECT_CALL(pMockControlInterface,cbAckSetSinkSoundProperty(_,E_OK)).Times(1);
- pRoutingReceiver.ackSetSinkSoundProperty(handle,E_OK);
-
- //finally, the new value must be in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.getSinkSoundPropertyValue(sinkID,SP_BASS,oldvalue));
- ASSERT_EQ(soundProperty.value,oldvalue);
-
- //and the handle must be destroyed
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_TRUE(handlesList.empty());
-
- //Now we try again, but the value is unchanged
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSinkSoundProperty(handle,sink.sinkID,soundProperty));
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ am_SoundProperty_s soundProperty;
+ uint16_t oldvalue;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+ soundProperty.type = SP_BASS;
+ soundProperty.value = 244;
+
+ //setup environment, we need a domain and a sink
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ 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));
+ 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, pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle, handle.handle);
+ ASSERT_EQ(handlesList[0].handleType, H_SETSINKSOUNDPROPERTY);
+
+ //read out this property. There is no change, because the ack did not arrive yet.
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSinkSoundPropertyValue(2,SP_BASS,oldvalue));
+ ASSERT_EQ(sink.listSoundProperties[0].value, oldvalue);
+
+ //lets send the answer and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSinkSoundProperty(_,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSinkSoundProperty(handle, E_OK);
+
+ //finally, the new value must be in the database
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSinkSoundPropertyValue(sinkID,SP_BASS,oldvalue));
+ ASSERT_EQ(soundProperty.value, oldvalue);
+
+ //and the handle must be destroyed
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //Now we try again, but the value is unchanged
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkSoundProperty(handle,sink.sinkID,soundProperty));
}
TEST_F(controlInterfaceTest,ackSetSourceSoundProperty)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- am_Domain_s domain;
- am_domainID_t domainID;
- std::vector<am_Handle_s> handlesList;
- am_Handle_s handle;
- am_SoundProperty_s soundProperty;
- uint16_t oldvalue;
- pCF.createSource(source);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- source.sourceID=2;
- source.domainID=1;
- soundProperty.type=SP_BASS;
- soundProperty.value=244;
-
- //prepare the scene
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- 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));
- 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
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_EQ(handlesList[0].handle,handle.handle);
- ASSERT_EQ(handlesList[0].handleType,H_SETSOURCESOUNDPROPERTY);
-
- //read out this property. There is no change, because the ack did not arrive yet.
- ASSERT_EQ(E_OK,pDatabaseHandler.getSourceSoundPropertyValue(2,SP_BASS,oldvalue));
- ASSERT_EQ(source.listSoundProperties[0].value,oldvalue);
-
- //lets send the answer and expect a call on the controlInterface
- EXPECT_CALL(pMockControlInterface,cbAckSetSourceSoundProperty(_,E_OK)).Times(1);
- pRoutingReceiver.ackSetSourceSoundProperty(handle,E_OK);
-
- //finally, the new value must be in the database
- ASSERT_EQ(E_OK,pDatabaseHandler.getSourceSoundPropertyValue(sourceID,SP_BASS,oldvalue));
- ASSERT_EQ(soundProperty.value,oldvalue);
-
- //and the handle must be destroyed
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
- ASSERT_TRUE(handlesList.empty());
-
- //Now we try again, but the value is unchanged
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSourceSoundProperty(handle,source.sourceID,soundProperty));
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ am_SoundProperty_s soundProperty;
+ uint16_t oldvalue;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ source.sourceID = 2;
+ source.domainID = 1;
+ soundProperty.type = SP_BASS;
+ soundProperty.value = 244;
+
+ //prepare the scene
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ 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));
+ 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
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle, handle.handle);
+ ASSERT_EQ(handlesList[0].handleType, H_SETSOURCESOUNDPROPERTY);
+
+ //read out this property. There is no change, because the ack did not arrive yet.
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSourceSoundPropertyValue(2,SP_BASS,oldvalue));
+ ASSERT_EQ(source.listSoundProperties[0].value, oldvalue);
+
+ //lets send the answer and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSourceSoundProperty(_,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSourceSoundProperty(handle, E_OK);
+
+ //finally, the new value must be in the database
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSourceSoundPropertyValue(sourceID,SP_BASS,oldvalue));
+ ASSERT_EQ(soundProperty.value, oldvalue);
+
+ //and the handle must be destroyed
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //Now we try again, but the value is unchanged
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceSoundProperty(handle,source.sourceID,soundProperty));
}
TEST_F(controlInterfaceTest,crossFading)
{
- //todo: implement crossfading test
+ //todo: implement crossfading test
}
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
index 5b1bd99..1bc3ce8 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file controlInterfaceTest.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file controlInterfaceTest.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 ROUTINGINTERFACETEST_H_
#define ROUTINGINTERFACETEST_H_
@@ -41,31 +41,32 @@
#include "../ControlInterfaceBackdoor.h"
#include "../CommonFunctions.h"
+namespace am
+{
-namespace am {
-
-class controlInterfaceTest : public ::testing::Test{
+class controlInterfaceTest: public ::testing::Test
+{
public:
- controlInterfaceTest();
- ~controlInterfaceTest();
- DBusWrapper* pDBusWrapper;
- std::vector<std::string> plistCommandPluginDirs;
- std::vector<std::string> plistRoutingPluginDirs;
- DatabaseHandler pDatabaseHandler;
- RoutingSender pRoutingSender;
- CommandSender pCommandSender;
- MockControlSendInterface pMockControlInterface;
- MockRoutingSendInterface pMockRoutingInterface;
- ControlSender pControlSender;
- RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
- CommandInterfaceBackdoor pCommandInterfaceBackdoor;
- ControlInterfaceBackdoor pControlInterfaceBackdoor;
- DatabaseObserver pDatabaseObserver;
- ControlReceiver pControlReceiver;
- RoutingReceiver pRoutingReceiver;
- CommonFunctions pCF;
- void SetUp();
- void TearDown();
+ controlInterfaceTest();
+ ~controlInterfaceTest();
+ DBusWrapper* pDBusWrapper;
+ std::vector<std::string> plistCommandPluginDirs;
+ std::vector<std::string> plistRoutingPluginDirs;
+ DatabaseHandler pDatabaseHandler;
+ RoutingSender pRoutingSender;
+ CommandSender pCommandSender;
+ MockControlSendInterface pMockControlInterface;
+ MockRoutingSendInterface pMockRoutingInterface;
+ ControlSender pControlSender;
+ RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
+ CommandInterfaceBackdoor pCommandInterfaceBackdoor;
+ ControlInterfaceBackdoor pControlInterfaceBackdoor;
+ DatabaseObserver pDatabaseObserver;
+ ControlReceiver pControlReceiver;
+ RoutingReceiver pRoutingReceiver;
+ CommonFunctions pCF;
+ void SetUp();
+ void TearDown();
};
}
diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp
index 1a0075c..5d53610 100644
--- a/AudioManagerDaemon/test/database/databaseTest.cpp
+++ b/AudioManagerDaemon/test/database/databaseTest.cpp
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file databasetest.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 databasetest.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 "databaseTest.h"
#include "MockInterfaces.h"
@@ -40,1493 +40,1546 @@ 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 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);
-databaseTest::databaseTest()
- :plistRoutingPluginDirs(),
- plistCommandPluginDirs(),
- pDatabaseHandler(std::string(":memory:")),
- pRoutingSender(plistRoutingPluginDirs),
- pCommandSender(plistCommandPluginDirs),
- pMockInterface(),
- pRoutingInterfaceBackdoor(),
- pCommandInterfaceBackdoor(),
- pControlReceiver(&pDatabaseHandler,&pRoutingSender,&pCommandSender),
- pObserver(&pCommandSender,&pRoutingSender)
-{
- pDatabaseHandler.registerObserver(&pObserver);
- pCommandInterfaceBackdoor.injectInterface(&pCommandSender,&pMockInterface);
-}
+routingTest::routingTest() :
+ plistRoutingPluginDirs(), //
+ plistCommandPluginDirs(), //
+ pDatabaseHandler(std::string(":memory:")), //
+ pRoutingSender(plistRoutingPluginDirs), //
+ pCommandSender(plistCommandPluginDirs), //
+ pMockInterface(), //
+ pRoutingInterfaceBackdoor(),//
+ pCommandInterfaceBackdoor(), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
+ pObserver(&pCommandSender, &pRoutingSender)
+{
+ pDatabaseHandler.registerObserver(&pObserver);
+ pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
+}
-databaseTest::~databaseTest()
+routingTest::~routingTest()
{
}
-void databaseTest::createMainConnectionSetup()
+void routingTest::createMainConnectionSetup()
{
- //fill the connection database
- am_Connection_s connection;
- am_Source_s source;
- am_Sink_s sink;
- std::vector<am_Connection_s> connectionList;
+ //fill the connection database
+ am_Connection_s connection;
+ am_Source_s source;
+ am_Sink_s sink;
+ std::vector<am_Connection_s> connectionList;
- //we create 9 sources and sinks:
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
+ //we create 9 sources and sinks:
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
- for (uint16_t i=1;i<10;i++)
- {
- am_sinkID_t forgetSink;
- am_sourceID_t forgetSource;
- am_connectionID_t forgetConnection;
+ for (uint16_t i = 1; i < 10; i++)
+ {
+ am_sinkID_t forgetSink;
+ am_sourceID_t forgetSource;
+ am_connectionID_t forgetConnection;
- pCF.createConnection(connection);
- connection.sinkID=i;
- connection.sourceID=i;
- connectionList.push_back(connection);
+ pCF.createConnection(connection);
+ connection.sinkID = i;
+ connection.sourceID = i;
+ connectionList.push_back(connection);
- pCF.createSink(sink);
- sink.sinkID=i;
- sink.name="sink" + int2string(i);
- sink.domainID=4;
- pCF.createSource(source);
- source.sourceID=i;
- source.name="source" + int2string(i);
- source.domainID=4;
+ pCF.createSink(sink);
+ sink.sinkID = i;
+ sink.name = "sink" + int2string(i);
+ sink.domainID = 4;
+ pCF.createSource(source);
+ source.sourceID = i;
+ source.name = "source" + int2string(i);
+ source.domainID = 4;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionFinal(forgetConnection));
- }
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(forgetConnection));
+ }
- //fill the route
- std::vector<am_RoutingElement_s> routingList;
- pCF.connectionList2RoutingList(routingList,connectionList);
+ //fill the route
+ std::vector<am_RoutingElement_s> routingList;
+ pCF.connectionList2RoutingList(routingList, connectionList);
- //create the Route
- am_Route_s route;
- route.route=routingList;
- route.sinkID=1;
- route.sourceID=1;
+ //create the Route
+ am_Route_s route;
+ route.route = routingList;
+ route.sinkID = 1;
+ route.sourceID = 1;
- //create a mainConnection
- am_MainConnection_s mainConnection;
- am_mainConnectionID_t mainConnectionID;
- std::vector<am_MainConnection_s> mainConnectionList;
- pCF.createMainConnection(mainConnection,route);
+ //create a mainConnection
+ am_MainConnection_s mainConnection;
+ am_mainConnectionID_t mainConnectionID;
+ std::vector<am_MainConnection_s> mainConnectionList;
+ pCF.createMainConnection(mainConnection, route);
- //enter mainconnection in database
- EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID))<< "ERROR: database error";
- ASSERT_NE(0,mainConnectionID)<< "ERROR: connectionID zero";
+ //enter mainconnection in database
+ EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
+ EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID))
+ << "ERROR: database error";
+ ASSERT_NE(0,mainConnectionID)
+ << "ERROR: connectionID zero";
- //read out the mainconnections and check if they are equal to the data written.
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(mainConnectionList));
- bool equal=true;
- std::vector<am_MainConnection_s>::iterator listIterator=mainConnectionList.begin();
- for(;listIterator<mainConnectionList.end();++listIterator)
- {
- if(listIterator->connectionID==mainConnectionID) {
- equal= equal && (listIterator->connectionState == mainConnection.connectionState)
- && (listIterator->route.sinkID == mainConnection.route.sinkID)
- && (listIterator->route.sourceID == mainConnection.route.sourceID)
- && (listIterator->delay == mainConnection.delay)
- && (std::equal(listIterator->route.route.begin(),listIterator->route.route.end(),routingList.begin(),equalRoutingElement));
- }
- }
- ASSERT_EQ(true,equal);
+ //read out the mainconnections and check if they are equal to the data written.
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(mainConnectionList));
+ bool equal = true;
+ std::vector<am_MainConnection_s>::iterator listIterator = mainConnectionList.begin();
+ for (; listIterator < mainConnectionList.end(); ++listIterator)
+ {
+ if (listIterator->connectionID == mainConnectionID)
+ {
+ equal = equal && (listIterator->connectionState == mainConnection.connectionState) && (listIterator->route.sinkID == mainConnection.route.sinkID) && (listIterator->route.sourceID == mainConnection.route.sourceID) && (listIterator->delay == mainConnection.delay) && (std::equal(listIterator->route.route.begin(), listIterator->route.route.end(), routingList.begin(), equalRoutingElement));
+ }
+ }
+ ASSERT_EQ(true, equal);
}
-void databaseTest::SetUp()
-{
- DLT_REGISTER_APP("Dtest","AudioManagerDeamon");
- DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context");
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("Database Test started "));
+void routingTest::SetUp()
+{
+ DLT_REGISTER_APP("Dtest", "AudioManagerDeamon");
+ DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("Database Test started "));
}
-void databaseTest::TearDown()
+void routingTest::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
-TEST_F(databaseTest,crossfaders)
+TEST_F(routingTest,crossfaders)
{
- //todo:implement crossfader tests
+ //todo:implement crossfader tests
}
-TEST_F(databaseTest,sourceState)
+TEST_F(routingTest,sourceState)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
- pCF.createSource(source);
- source.sourceState=SS_OFF;
-
- //prepare the test
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
-
- //change the source state
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSourceState(sourceID,SS_ON));
-
- //read out the changed values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(listSources[0].sourceState,SS_ON);
-}
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ std::vector<am_Source_s> listSources;
+ pCF.createSource(source);
+ source.sourceState = SS_OFF;
+
+ //prepare the test
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //change the source state
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceState(sourceID,SS_ON));
+
+ //read out the changed values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_EQ(listSources[0].sourceState, SS_ON);
+}
-TEST_F(databaseTest,sinkVolumeChange)
+TEST_F(routingTest,sinkVolumeChange)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
- pCF.createSink(sink);
- sink.volume=23;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ std::vector<am_Sink_s> listSinks;
+ pCF.createSink(sink);
+ sink.volume = 23;
+
+ //prepare the test
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
- //prepare the test
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- //change the volume and check the read out
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkVolume(sinkID,34));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(listSinks[0].volume,34);
+ //change the volume and check the read out
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkVolume(sinkID,34));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_EQ(listSinks[0].volume, 34);
}
-TEST_F(databaseTest,sourceVolumeChange)
+TEST_F(routingTest,sourceVolumeChange)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
- pCF.createSource(source);
- source.volume=23;
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ std::vector<am_Source_s> listSources;
+ pCF.createSource(source);
+ source.volume = 23;
- //prepare test
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+ //prepare test
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
- //change the volume and check the read out
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSourceVolume(sourceID,34));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(listSources[0].volume,34);
+ //change the volume and check the read out
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceVolume(sourceID,34));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_EQ(listSources[0].volume, 34);
}
-TEST_F(databaseTest, peekSource)
+TEST_F(routingTest, peekSource)
{
- std::vector<am_Source_s> listSources;
- am_sourceID_t sourceID, source2ID, source3ID;
- am_Source_s source;
- pCF.createSource(source);
-
- //peek a source that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
-
- //make sure it is not in the list
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_TRUE(listSources.empty());
- ASSERT_EQ(sourceID,100);
-
- //now enter the source with the same name and make sure it does not get a new ID
- source.name="newsource";
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,source2ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(sourceID,source2ID);
- ASSERT_TRUE(listSources[0].sourceID==sourceID);
-
- //now we peek again. This time, the source exists
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(source.name,source3ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_TRUE(listSources.size()==1);
- ASSERT_EQ(source3ID,source2ID);
-}
-
-TEST_F(databaseTest, peekSourceDouble)
-{
- std::vector<am_Source_s> listSources;
- am_sourceID_t sourceID;
- am_sourceID_t source2ID;
- am_sourceID_t source3ID;
- am_Source_s source;
- pCF.createSource(source);
-
- //peek a source that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
-
- //peek a second source that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(std::string("newsource2"),source2ID));
-
- //make sure they are is not in the list
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_TRUE(listSources.empty());
- ASSERT_EQ(sourceID,100);
- source.name="newsource";
-
- //now enter the source with the same name than the first peek and make sure it does not get a new ID
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,source3ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(sourceID,source3ID);
- ASSERT_TRUE(listSources[0].sourceID==sourceID);
-}
-
-TEST_F(databaseTest, peekSink)
-{
- std::vector<am_Sink_s> listSinks;
- am_sinkID_t sinkID,sink2ID, sink3ID;
- am_Sink_s sink;
- pCF.createSink(sink);
-
- //peek a sink that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
-
- //make sure it is not in the list
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_TRUE(listSinks.empty());
- ASSERT_EQ(sinkID,100);
- sink.name="newsink";
-
- //now enter the source with the same name and make sure it does not get a new ID
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sink2ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(sinkID,sink2ID);
- ASSERT_TRUE(listSinks[0].sinkID==sinkID);
-
- //now we peek again, this time, the sink exists
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(sink.name,sink3ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_TRUE(listSinks.size()==1);
- ASSERT_EQ(sink3ID,sink2ID);
-}
-
-TEST_F(databaseTest, peekSinkDouble)
-{
- std::vector<am_Sink_s> listSinks;
- am_sinkID_t sinkID;
- am_sinkID_t sink2ID;
- am_sinkID_t sink3ID;
- am_Sink_s sink;
- pCF.createSink(sink);
-
- //peek a sink that does not exits
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
-
- //peek again
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(std::string("nextsink"),sink2ID));
-
- //make sure they are is not in the list
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_TRUE(listSinks.empty());
- ASSERT_EQ(sinkID,100);
- sink.name="newsink";
-
- //now enter the sink with the same name than the first peek and make sure it does not get a new ID
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sink3ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(sinkID,sink3ID);
- ASSERT_TRUE(listSinks[0].sinkID==sinkID);
-}
-
-TEST_F(databaseTest,changeConnectionTimingInformationCheckMainConnection)
-{
- am_Connection_s connection;
- std::vector<am_Connection_s> connectionList;
- std::vector<am_MainConnectionType_s> mainList;
- pCF.createConnection(connection);
-
- //prepare the test, it is one mainconnection, so we expect one callback
- createMainConnectionSetup();
- EXPECT_CALL(pMockInterface,cbTimingInformationChanged(1,216)).Times(1);
-
- //first get all visible mainconnections and make sure, the delay is set to -1 for the first entry
- ASSERT_EQ(E_OK,pDatabaseHandler.getListVisibleMainConnections(mainList));
- ASSERT_EQ(mainList[0].delay,-1);
-
- //no go through all connections and set the delay time to 24 for each connection
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- std::vector<am_Connection_s>::iterator iteratorConnectionList=connectionList.begin();
- for(;iteratorConnectionList<connectionList.end();++iteratorConnectionList)
- {
- ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionTimingInformation(iteratorConnectionList->sinkID,24));
- }
-
- //we read the result again and expect that the value is now different from -1
- ASSERT_EQ(E_OK,pDatabaseHandler.getListVisibleMainConnections(mainList));
- ASSERT_EQ(mainList[0].delay,216);
-}
-
-TEST_F(databaseTest,changeConnectionTimingInformation)
-{
- am_Connection_s connection;
- am_connectionID_t connectionID;
- std::vector<am_Connection_s> connectionList;
- pCF.createConnection(connection);
-
- //enter a connection
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,connectionID));
- ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionFinal(connectionID));
-
- //change the timing and check it
- ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionTimingInformation(connectionID,24));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(connectionList[0].delay==24);
-}
-
-TEST_F(databaseTest,getSinkClassOfSink)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SinkClass_s sinkClass, returnClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sinkClass.name="test";
- sinkClass.sinkClassID=4;
- sinkClass.listClassProperties=classPropertyList;
- pCF.createSink(sink);
- sink.sinkClassID=4;
-
- //prepare test
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- //enter a new sinkclass, read out again and check
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID,4);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK,pDatabaseHandler.getSinkClassInfoDB(sinkID,returnClass));
- ASSERT_EQ(sinkClassList[0].name,returnClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID,returnClass.sinkClassID);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),returnClass.listClassProperties.begin(),equalClassProperties));
-}
-
-
-TEST_F(databaseTest,getSourceClassOfSource)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SourceClass_s sourceClass, sinkSourceClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- am_Source_s source;
- am_sourceID_t sourceID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sourceClass.name="test";
- sourceClass.sourceClassID=1;
- sourceClass.listClassProperties=classPropertyList;
- pCF.createSource(source);
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID,1);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK,pDatabaseHandler.getSourceClassInfoDB(sourceID,sinkSourceClass));
- ASSERT_EQ(sourceClassList[0].name,sinkSourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID,sinkSourceClass.sourceClassID);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),sinkSourceClass.listClassProperties.begin(),equalClassProperties));
-}
-
-
-TEST_F(databaseTest,removeSourceClass)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SourceClass_s sourceClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sourceClass.name="test";
- sourceClass.sourceClassID=3;
- sourceClass.listClassProperties=classPropertyList;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(2);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID,3);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceClassDB(3));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_TRUE(sourceClassList.empty());
-}
-
-TEST_F(databaseTest,updateSourceClass)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList,changedPropertyList;
- am_SourceClass_s sourceClass, changedClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sourceClass.name="test";
- sourceClass.sourceClassID=0;
- sourceClass.listClassProperties=classPropertyList;
- changedClass=sourceClass;
- changedClass.listClassProperties[1].value=6;
- changedPropertyList=changedClass.listClassProperties;
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- changedClass.sourceClassID=sourceClassID;
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID,100);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSourceClassInfoDB(changedClass));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID,100);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(databaseTest,enterSourceClass)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SourceClass_s sourceClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sourceClass.name="test";
- sourceClass.sourceClassID=0;
- sourceClass.listClassProperties=classPropertyList;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID,100);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(databaseTest,enterSourceClassStatic)
-{
- std::vector<am_SourceClass_s> sourceClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SourceClass_s sourceClass;
- am_ClassProperty_s classProperty;
- am_sourceClass_t sourceClassID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sourceClass.name="test";
- sourceClass.sourceClassID=3;
- sourceClass.listClassProperties=classPropertyList;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
- ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
- ASSERT_EQ(sourceClassList[0].sourceClassID,3);
- ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
-}
-
-
-TEST_F(databaseTest,removeSinkClass)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SinkClass_s sinkClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sinkClass.name="test";
- sinkClass.sinkClassID=0;
- sinkClass.listClassProperties=classPropertyList;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(2);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID,100);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkClassDB(sinkClassID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_TRUE(sinkClassList.empty());
-}
-
-TEST_F(databaseTest,updateSinkClass)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
- am_SinkClass_s sinkClass, changedClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sinkClass.name="test";
- sinkClass.sinkClassID=0;
- sinkClass.listClassProperties=classPropertyList;
- changedClass=sinkClass;
- changedClass.listClassProperties[1].value=6;
- changedPropertyList=changedClass.listClassProperties;
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- changedClass.sinkClassID=sinkClassID;
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID,100);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkClassInfoDB(changedClass));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID,100);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(databaseTest,enterSinkClass)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SinkClass_s sinkClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sinkClass.name="test";
- sinkClass.sinkClassID=0;
- sinkClass.listClassProperties=classPropertyList;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID,100);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
-}
-
-TEST_F(databaseTest,enterSinkClassStatic)
-{
- std::vector<am_SinkClass_s> sinkClassList;
- std::vector<am_ClassProperty_s> classPropertyList;
- am_SinkClass_s sinkClass;
- am_ClassProperty_s classProperty;
- am_sinkClass_t sinkClassID;
- classProperty.classProperty=CP_SINK_TYPE;
- classProperty.value=1;
- classPropertyList.push_back(classProperty);
- classProperty.classProperty=CP_SOURCE_TYPE;
- classProperty.value=4;
- classPropertyList.push_back(classProperty);
- sinkClass.name="test";
- sinkClass.sinkClassID=4;
- sinkClass.listClassProperties=classPropertyList;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
- ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
- ASSERT_EQ(sinkClassList[0].sinkClassID,4);
- ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
-}
-
-
-TEST_F(databaseTest, changeSystemProperty)
-{
- std::vector<am_SystemProperty_s> listSystemProperties,listReturn;
- am_SystemProperty_s systemProperty;
-
- systemProperty.type=SYP_TEST;
- systemProperty.value=33;
- listSystemProperties.push_back(systemProperty);
- EXPECT_CALL(pMockInterface,cbSystemPropertyChanged(_)).Times(1); //todo: check the exact value here
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSystemProperties(listSystemProperties));
- systemProperty.value=444;
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSystemPropertyDB(systemProperty));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSystemProperties(listReturn));
- ASSERT_EQ(listReturn[0].type,systemProperty.type);
- ASSERT_EQ(listReturn[0].value,systemProperty.value);
-}
-
-TEST_F(databaseTest, systemProperties)
-{
- std::vector<am_SystemProperty_s> listSystemProperties,listReturn;
- am_SystemProperty_s systemProperty;
-
- systemProperty.type=SYP_TEST;
- systemProperty.value=33;
- listSystemProperties.push_back(systemProperty);
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSystemProperties(listSystemProperties));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSystemProperties(listReturn));
- ASSERT_EQ(listReturn[0].type,systemProperty.type);
- ASSERT_EQ(listReturn[0].value,systemProperty.value);
-}
-
-
-TEST_F(databaseTest,enterSourcesCorrect)
-{
- //fill the connection database
- am_Source_s staticSource,firstDynamicSource,secondDynamicSource;
- am_sourceID_t staticSourceID,firstDynamicSourceID,secondDynamicSourceID;
- std::vector<am_Source_s> sourceList;
-
- pCF.createSource(staticSource);
- staticSource.sourceID=4;
- staticSource.name="Static";
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))<< "ERROR: database error";
- ASSERT_EQ(staticSource.sourceID,staticSourceID)<< "ERROR: ID not the one given in staticSource";
-
- pCF.createSource(firstDynamicSource);
- firstDynamicSource.name="firstDynamicSource";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(firstDynamicSource,firstDynamicSourceID))<< "ERROR: database error";
- ASSERT_EQ(firstDynamicSourceID,DYNAMIC_ID_BOUNDARY)<< "ERROR: ID not the one given in firstDynamicSink";
-
- pCF.createSource(secondDynamicSource);
- secondDynamicSource.name="secondDynamicSource";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(secondDynamicSource,secondDynamicSourceID))<< "ERROR: database error";
- ASSERT_NEAR(secondDynamicSourceID,DYNAMIC_ID_BOUNDARY,10)<< "ERROR: ID not the one given in secondDynamicSink";
-
- //now read back and check the returns agains the given values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(sourceList))<< "ERROR: database error";
- bool equal=true;
-
- std::vector<am_Source_s>::iterator listIterator=sourceList.begin();
- for(;listIterator<sourceList.end();++listIterator)
- {
- if(listIterator->sourceID==staticSourceID)
- {
- equal = equal && pCF.compareSource(listIterator,staticSource);
- }
-
- if(listIterator->sourceID==firstDynamicSourceID)
- {
- equal = equal && pCF.compareSource(listIterator,firstDynamicSource);
- }
-
- if(listIterator->sourceID==secondDynamicSourceID)
- {
- equal = equal && pCF.compareSource(listIterator,secondDynamicSource);
- }
-
- }
- ASSERT_EQ(true,equal);
-}
-
-
-TEST_F(databaseTest, changeSourceMainSoundProperty)
-{
- std::vector<am_Source_s> listSources;
- am_Source_s source;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- am_MainSoundProperty_s property;
- property.type=MSP_NAVIGATION_OFFSET;
- property.value=33;
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
-
- EXPECT_CALL(pMockInterface,cbMainSourceSoundPropertyChanged(sourceID,_)).Times(1); //todo: check in detail
- ASSERT_EQ(E_OK,pDatabaseHandler.changeMainSourceSoundPropertyDB(property,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- std::vector<am_MainSoundProperty_s>::iterator listIterator=listSources[0].listMainSoundProperties.begin();
- for(;listIterator<listSources[0].listMainSoundProperties.end();++listIterator)
- {
- if(listIterator->type==property.type)
- {
- ASSERT_EQ(listIterator->value,property.value);
- }
- }
-}
-
-TEST_F(databaseTest, changeSinkMuteState)
-{
- std::vector<am_Sink_s> listSinks;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- am_MuteState_e muteState=MS_MUTED;
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- EXPECT_CALL(pMockInterface,cbSinkMuteStateChanged(sinkID,muteState)).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkMuteStateDB(muteState,sinkID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(muteState,listSinks[0].muteState);
-}
-
-TEST_F(databaseTest, changeSinkMainSoundProperty)
-{
- std::vector<am_Sink_s> listSinks;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- am_MainSoundProperty_s property;
- property.type=MSP_NAVIGATION_OFFSET;
- property.value=33;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- EXPECT_CALL(pMockInterface,cbMainSinkSoundPropertyChanged(sinkID,_)).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.changeMainSinkSoundPropertyDB(property,sinkID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- std::vector<am_MainSoundProperty_s>::iterator listIterator=listSinks[0].listMainSoundProperties.begin();
- for(;listIterator<listSinks[0].listMainSoundProperties.end();++listIterator)
- {
- if(listIterator->type==property.type)
- {
- ASSERT_EQ(listIterator->value,property.value);
- }
- }
-}
-
-TEST_F(databaseTest, peekDomain)
-{
- std::vector<am_Domain_s> listDomains;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_domainID_t domain2ID;
- pCF.createDomain(domain);
- ASSERT_EQ(E_OK,pDatabaseHandler.peekDomain(std::string("newdomain"),domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains));
- ASSERT_TRUE(listDomains.empty());
- ASSERT_EQ(domainID,1);
- domain.name="newdomain";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domain2ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains));
- ASSERT_EQ(domainID,domain2ID);
- ASSERT_TRUE(listDomains[0].domainID==domainID);
-}
-
-TEST_F(databaseTest, peekDomainFirstEntered)
-{
- std::vector<am_Domain_s> listDomains;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_domainID_t domain2ID;
- pCF.createDomain(domain);
- domain.name="newdomain";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.peekDomain(std::string("newdomain"),domain2ID));
- ASSERT_EQ(domainID,domain2ID);
- ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains));
- ASSERT_TRUE(listDomains.size()==1);
-}
-
-TEST_F(databaseTest, changeDomainState)
-{
- std::vector<am_Domain_s> listDomains;
- am_Domain_s domain;
- am_domainID_t domainID;
- pCF.createDomain(domain);
- am_DomainState_e newState=DS_INDEPENDENT_STARTUP;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.changDomainStateDB(newState,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains));
- ASSERT_EQ(newState,listDomains[0].state);
-}
-
-
-TEST_F(databaseTest, changeMainConnectionState)
-{
- std::vector<am_MainConnection_s> listMainConnections;
- createMainConnectionSetup();
- EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.changeMainConnectionStateDB(1,CS_DISCONNECTING))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(listMainConnections));
- ASSERT_EQ(CS_DISCONNECTING,listMainConnections[0].connectionState);
-}
-
-TEST_F(databaseTest, changeSinkAvailability)
-{
- std::vector<am_Sink_s> listSinks;
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- am_Availability_s availability;
- availability.availability=A_UNKNOWN;
- availability.availabilityReason=AR_TEMPERATURE;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkAvailabilityDB(availability,sinkID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(availability.availability,listSinks[0].available.availability);
- ASSERT_EQ(availability.availabilityReason,listSinks[0].available.availabilityReason);
-}
-
-TEST_F(databaseTest, changeSourceAvailability)
-{
- std::vector<am_Source_s> listSources;
- am_Source_s source;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- am_Availability_s availability;
- availability.availability=A_UNKNOWN;
- availability.availabilityReason=AR_TEMPERATURE;
- source.visible=true;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSourceAvailabilityDB(availability,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_EQ(availability.availability,listSources[0].available.availability);
- ASSERT_EQ(availability.availabilityReason,listSources[0].available.availabilityReason);
-}
-
-
-TEST_F(databaseTest,changeMainConnectionRoute)
-{
- std::vector<am_MainConnection_s> originalList;
- std::vector<am_MainConnection_s> newList;
- createMainConnectionSetup();
- //fill the connection database
- am_Connection_s connection;
- am_Source_s source;
- am_Sink_s sink;
- std::vector<am_Connection_s> connectionList;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
- for (uint16_t i=1;i<10;i++)
- {
- am_sinkID_t forgetSink;
- am_sourceID_t forgetSource;
- am_connectionID_t forgetConnection;
-
- pCF.createConnection(connection);
- connection.sinkID=i+20;
- connection.sourceID=i+20;
- connection.delay=-1;
- connectionList.push_back(connection);
-
- pCF.createSink(sink);
- sink.sinkID=i+20;
- sink.name="sink" + int2string(i+20);
- sink.domainID=4;
- pCF.createSource(source);
- source.sourceID=i+20;
- source.name="source" + int2string(i+30);
- source.domainID=4;
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(originalList))<< "ERROR: database error";
-
- }
-
- //fill the route
- std::vector<am_RoutingElement_s> routingList;
- pCF.connectionList2RoutingList(routingList,connectionList);
-
- //create the Route
- am_Route_s route;
- route.route=routingList;
- route.sinkID=2;
- route.sourceID=2;
-
- ASSERT_EQ(E_OK,pDatabaseHandler.changeMainConnectionRouteDB(1,route));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(newList))<< "ERROR: database error";
- ASSERT_TRUE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),routingList.begin(),equalRoutingElement));
- ASSERT_FALSE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),originalList[0].route.route.begin(),equalRoutingElement));
-}
-
-TEST_F(databaseTest,changeMainSinkVolume)
-{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_mainVolume_t newVol=20;
- std::vector<am_Sink_s> listSinks;
- pCF.createSink(sink);
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
-
- EXPECT_CALL(pMockInterface,cbVolumeChanged(sinkID,newVol)).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkMainVolumeDB(newVol,sinkID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_EQ(listSinks[0].mainVolume,newVol);
-}
-
-TEST_F(databaseTest,getMainSourceSoundProperties)
-{
- am_Source_s source;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- std::vector<am_MainSoundProperty_s> mainSoundProperties=source.listMainSoundProperties;
- std::vector<am_MainSoundProperty_s> listMainSoundProperties;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSourceSoundProperties(sourceID,listMainSoundProperties));
- ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
-}
-
-TEST_F(databaseTest,getMainSinkSoundProperties)
- {
- am_Sink_s sink;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- std::vector<am_MainSoundProperty_s> mainSoundProperties=sink.listMainSoundProperties;
- std::vector<am_MainSoundProperty_s> listMainSoundProperties;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSinkSoundProperties(sinkID,listMainSoundProperties));
- ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
- }
-
-TEST_F(databaseTest,getMainSources)
-{
- am_Source_s source, source1,source2;
- am_sourceID_t sourceID;
- pCF.createSource(source);
- pCF.createSource(source1);
- pCF.createSource(source2);
- source1.name="source1";
- source2.name="source2";
- bool equal=true;
- source1.visible=false;
- std::vector<am_SourceType_s> listMainSources;
- std::vector<am_Source_s> listSources;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
- source.sourceID=sourceID;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source1,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source2,sourceID));
- source2.sourceID=sourceID;
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSources(listMainSources));
- listSources.push_back(source);
- listSources.push_back(source2);
- std::vector<am_SourceType_s>::iterator listIterator=listMainSources.begin();
- for(;listIterator<listMainSources.end();++listIterator)
- {
- equal = equal && pCF.compareSinkMainSource(listIterator,listSources);
- }
- ASSERT_TRUE(equal);
-}
-
-TEST_F(databaseTest,getMainSinks)
-{
- am_Sink_s sink, sink1,sink2;
- am_sinkID_t sinkID;
- pCF.createSink(sink);
- pCF.createSink(sink1);
- pCF.createSink(sink2);
- sink1.name="sink1";
- sink2.name="sink2";
- bool equal=true;
- sink1.visible=false;
- std::vector<am_SinkType_s> listMainSinks;
- std::vector<am_Sink_s> listSinks;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
- sink.sinkID=sinkID;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink1,sinkID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink2,sinkID));
- sink2.sinkID=sinkID;
- ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSinks(listMainSinks));
- listSinks.push_back(sink);
- listSinks.push_back(sink2);
- std::vector<am_SinkType_s>::iterator listIterator=listMainSinks.begin();
- for(;listIterator<listMainSinks.end();++listIterator)
- {
- equal = equal && pCF.compareSinkMainSink(listIterator,listSinks);
- }
- ASSERT_TRUE(equal);
-}
-
-TEST_F(databaseTest,getVisibleMainConnections)
-{
- createMainConnectionSetup();
- am_MainConnection_s mainConnection;
- am_Route_s route;
- pCF.createMainConnection(mainConnection,route);
- std::vector<am_MainConnectionType_s> visibleMainConnection;
- ASSERT_EQ(E_OK,pDatabaseHandler.getListVisibleMainConnections(visibleMainConnection));
- ASSERT_TRUE(1==visibleMainConnection[0].mainConnectionID);
- ASSERT_TRUE(mainConnection.connectionState==visibleMainConnection[0].connectionState);
- ASSERT_TRUE(mainConnection.delay==visibleMainConnection[0].delay);
- ASSERT_TRUE(1==visibleMainConnection[0].sinkID);
- ASSERT_TRUE(1==visibleMainConnection[0].sourceID);
-}
-
-TEST_F(databaseTest,getListSourcesOfDomain)
-{
- am_Source_s source, source2;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_sourceID_t sourceID;
- std::vector<am_sourceID_t> sourceList,sourceCheckList;
- pCF.createSource(source);
- source.sourceID=1;
- source.name="testSource";
- source.domainID=1;
- pCF.createSource(source2);
- source2.sourceID=0;
- source2.name="testSource2";
- source2.domainID=5;
- pCF.createDomain(domain);
- sourceCheckList.push_back(1);//sink.sinkID);
-
-
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source2,sourceID))<< "ERROR: database error";
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSourcesOfDomain(2,sourceList))<< "ERROR: database error";
- ASSERT_TRUE(sourceList.empty());
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSourcesOfDomain(1,sourceList))<< "ERROR: database error";
- ASSERT_TRUE(std::equal(sourceList.begin(),sourceList.end(),sourceCheckList.begin()) && !sourceList.empty());
-}
-
-TEST_F(databaseTest,getListSinksOfDomain)
-{
- am_Sink_s sink, sink2;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_sinkID_t sinkID;
- std::vector<am_sinkID_t> sinkList,sinkCheckList;
- pCF.createSink(sink);
- sink.sinkID=1;
- sink.domainID=1;
- pCF.createSink(sink2);
- sink2.domainID=5;
- sink2.name="sink2";
- pCF.createDomain(domain);
- sinkCheckList.push_back(1);//sink.sinkID);
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink2,sinkID))<< "ERROR: database error";
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSinksOfDomain(2,sinkList))<< "ERROR: database error";
- ASSERT_TRUE(sinkList.empty());
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinksOfDomain(1,sinkList))<< "ERROR: database error";
- ASSERT_TRUE(std::equal(sinkList.begin(),sinkList.end(),sinkCheckList.begin()) && !sinkList.empty());
-}
-
-TEST_F(databaseTest,getListGatewaysOfDomain)
-{
- am_Gateway_s gateway, gateway2;
- am_gatewayID_t gatewayID;
- am_domainID_t domainID;
- am_Domain_s domain;
- std::vector<am_gatewayID_t> gatewayList,gatewayCheckList;
- pCF.createGateway(gateway);
- gateway.gatewayID=1;
- gateway.name="testGateway";
- gateway.controlDomainID=1;
- gateway.sourceID=1;
- gateway.sinkID=1;
- gateway.domainSinkID=1;
- gateway.domainSourceID=1;
- pCF.createGateway(gateway2);
- gateway2.gatewayID=2;
- gateway2.name="testGateway2";
- gateway2.controlDomainID=4;
- gateway2.sourceID=1;
- gateway2.sinkID=1;
- gateway2.domainSinkID=1;
- gateway2.domainSourceID=1;
- pCF.createDomain(domain);
- gatewayCheckList.push_back(gateway.gatewayID);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID))<< "ERROR: database error";
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListGatewaysOfDomain(2,gatewayList))<< "ERROR: database error";
- ASSERT_TRUE(gatewayList.empty());
- ASSERT_EQ(E_OK,pDatabaseHandler.getListGatewaysOfDomain(1,gatewayList))<< "ERROR: database error";
- ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()) && !gatewayList.empty());
-}
-
-TEST_F(databaseTest,removeDomain)
-{
- am_Domain_s domain;
- am_domainID_t domainID;
- std::vector<am_Domain_s> listDomains;
- pCF.createDomain(domain);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeDomainDB(domainID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains))<< "ERROR: database error";
- ASSERT_TRUE(listDomains.empty());
-}
-
-TEST_F(databaseTest,removeGateway)
-{
- am_Gateway_s gateway;
- am_gatewayID_t gatewayID;
- std::vector<am_Gateway_s> listGateways;
- pCF.createGateway(gateway);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeGatewayDB(gatewayID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(listGateways))<< "ERROR: database error";
- ASSERT_TRUE(listGateways.empty());
-}
-
-TEST_F(databaseTest,removeSink)
-{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- std::vector<am_Sink_s> listSinks;
- pCF.createSink(sink);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkDB(sinkID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))<< "ERROR: database error";
- ASSERT_TRUE(listSinks.empty());
-}
+ std::vector<am_Source_s> listSources;
+ am_sourceID_t sourceID, source2ID, source3ID;
+ am_Source_s source;
+ pCF.createSource(source);
-TEST_F(databaseTest,removeSource)
-{
- //fill the connection database
- am_Source_s source;
- am_sourceID_t sourceID;
- std::vector<am_Source_s> listSources;
- pCF.createSource(source);
+ //peek a source that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceDB(sourceID))<< "ERROR: database error";
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources))<< "ERROR: database error";
- ASSERT_TRUE(listSources.empty());
-}
+ //make sure it is not in the list
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_TRUE(listSources.empty());
+ ASSERT_EQ(sourceID, 100);
-TEST_F(databaseTest, removeMainConnection)
-{
- createMainConnectionSetup();
- EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
- EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.removeMainConnectionDB(1))<< "ERROR: database error";
-}
+ //now enter the source with the same name and make sure it does not get a new ID
+ source.name = "newsource";
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source2ID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_EQ(sourceID, source2ID);
+ ASSERT_TRUE(listSources[0].sourceID==sourceID);
-TEST_F(databaseTest,removeNonexistentMainConnectionFail)
-{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeMainConnectionDB(34))<< "ERROR: database error";
+ //now we peek again. This time, the source exists
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(source.name,source3ID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_TRUE(listSources.size()==1);
+ ASSERT_EQ(source3ID, source2ID);
}
-TEST_F(databaseTest,removeNonexistentSource)
+TEST_F(routingTest, peekSourceDouble)
{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSourceDB(3))<< "ERROR: database error";
-}
+ std::vector<am_Source_s> listSources;
+ am_sourceID_t sourceID;
+ am_sourceID_t source2ID;
+ am_sourceID_t source3ID;
+ am_Source_s source;
+ pCF.createSource(source);
-TEST_F(databaseTest,removeNonexistentSink)
-{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSinkDB(2))<< "ERROR: database error";
-}
+ //peek a source that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
+
+ //peek a second source that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource2"),source2ID));
+
+ //make sure they are is not in the list
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_TRUE(listSources.empty());
+ ASSERT_EQ(sourceID, 100);
+ source.name = "newsource";
-TEST_F(databaseTest,removeNonexistentGateway)
-{
- ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeGatewayDB(12))<< "ERROR: database error";
+ //now enter the source with the same name than the first peek and make sure it does not get a new ID
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source3ID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_EQ(sourceID, source3ID);
+ ASSERT_TRUE(listSources[0].sourceID==sourceID);
+}
+
+TEST_F(routingTest, peekSink)
+{
+ std::vector<am_Sink_s> listSinks;
+ am_sinkID_t sinkID, sink2ID, sink3ID;
+ am_Sink_s sink;
+ pCF.createSink(sink);
+
+ //peek a sink that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
+
+ //make sure it is not in the list
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_TRUE(listSinks.empty());
+ ASSERT_EQ(sinkID, 100);
+ sink.name = "newsink";
+
+ //now enter the source with the same name and make sure it does not get a new ID
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink2ID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_EQ(sinkID, sink2ID);
+ ASSERT_TRUE(listSinks[0].sinkID==sinkID);
+
+ //now we peek again, this time, the sink exists
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(sink.name,sink3ID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_TRUE(listSinks.size()==1);
+ ASSERT_EQ(sink3ID, sink2ID);
+}
+
+TEST_F(routingTest, peekSinkDouble)
+{
+ std::vector<am_Sink_s> listSinks;
+ am_sinkID_t sinkID;
+ am_sinkID_t sink2ID;
+ am_sinkID_t sink3ID;
+ am_Sink_s sink;
+ pCF.createSink(sink);
+
+ //peek a sink that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
+
+ //peek again
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("nextsink"),sink2ID));
+
+ //make sure they are is not in the list
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_TRUE(listSinks.empty());
+ ASSERT_EQ(sinkID, 100);
+ sink.name = "newsink";
+
+ //now enter the sink with the same name than the first peek and make sure it does not get a new ID
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink3ID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_EQ(sinkID, sink3ID);
+ ASSERT_TRUE(listSinks[0].sinkID==sinkID);
+}
+
+TEST_F(routingTest,changeConnectionTimingInformationCheckMainConnection)
+{
+ am_Connection_s connection;
+ std::vector<am_Connection_s> connectionList;
+ std::vector<am_MainConnectionType_s> mainList;
+ pCF.createConnection(connection);
+
+ //prepare the test, it is one mainconnection, so we expect one callback
+ createMainConnectionSetup();
+ EXPECT_CALL(pMockInterface,cbTimingInformationChanged(1,216)).Times(1);
+
+ //first get all visible mainconnections and make sure, the delay is set to -1 for the first entry
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(mainList));
+ ASSERT_EQ(mainList[0].delay, -1);
+
+ //no go through all connections and set the delay time to 24 for each connection
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
+ std::vector<am_Connection_s>::iterator iteratorConnectionList = connectionList.begin();
+ for (; iteratorConnectionList < connectionList.end(); ++iteratorConnectionList)
+ {
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionTimingInformation(iteratorConnectionList->sinkID,24));
+ }
+
+ //we read the result again and expect that the value is now different from -1
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(mainList));
+ ASSERT_EQ(mainList[0].delay, 216);
+}
+
+TEST_F(routingTest,changeConnectionTimingInformation)
+{
+ am_Connection_s connection;
+ am_connectionID_t connectionID;
+ std::vector<am_Connection_s> connectionList;
+ pCF.createConnection(connection);
+
+ //enter a connection
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
+
+ //change the timing and check it
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionTimingInformation(connectionID,24));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
+ ASSERT_TRUE(connectionList[0].delay==24);
+}
+
+TEST_F(routingTest,getSinkClassOfSink)
+{
+ std::vector<am_SinkClass_s> sinkClassList;
+ std::vector<am_ClassProperty_s> classPropertyList;
+ am_SinkClass_s sinkClass, returnClass;
+ am_ClassProperty_s classProperty;
+ am_sinkClass_t sinkClassID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sinkClass.name = "test";
+ sinkClass.sinkClassID = 4;
+ sinkClass.listClassProperties = classPropertyList;
+ pCF.createSink(sink);
+ sink.sinkClassID = 4;
+
+ //prepare test
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //enter a new sinkclass, read out again and check
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
+ ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
+ ASSERT_EQ(sinkClassList[0].sinkClassID, 4);
+ ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSinkClassInfoDB(sinkID,returnClass));
+ ASSERT_EQ(sinkClassList[0].name, returnClass.name);
+ ASSERT_EQ(sinkClassList[0].sinkClassID, returnClass.sinkClassID);
+ ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),returnClass.listClassProperties.begin(),equalClassProperties));
+}
+
+TEST_F(routingTest,getSourceClassOfSource)
+{
+ std::vector<am_SourceClass_s> sourceClassList;
+ std::vector<am_ClassProperty_s> classPropertyList;
+ am_SourceClass_s sourceClass, sinkSourceClass;
+ am_ClassProperty_s classProperty;
+ am_sourceClass_t sourceClassID;
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sourceClass.name = "test";
+ sourceClass.sourceClassID = 1;
+ sourceClass.listClassProperties = classPropertyList;
+ pCF.createSource(source);
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
+ ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
+ ASSERT_EQ(sourceClassList[0].sourceClassID, 1);
+ ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getSourceClassInfoDB(sourceID,sinkSourceClass));
+ ASSERT_EQ(sourceClassList[0].name, sinkSourceClass.name);
+ ASSERT_EQ(sourceClassList[0].sourceClassID, sinkSourceClass.sourceClassID);
+ ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),sinkSourceClass.listClassProperties.begin(),equalClassProperties));
+}
+
+TEST_F(routingTest,removeSourceClass)
+{
+ std::vector<am_SourceClass_s> sourceClassList;
+ std::vector<am_ClassProperty_s> classPropertyList;
+ am_SourceClass_s sourceClass;
+ am_ClassProperty_s classProperty;
+ am_sourceClass_t sourceClassID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sourceClass.name = "test";
+ sourceClass.sourceClassID = 3;
+ sourceClass.listClassProperties = classPropertyList;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(2);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
+ ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
+ ASSERT_EQ(sourceClassList[0].sourceClassID, 3);
+ ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+ ASSERT_EQ(E_OK, pDatabaseHandler.removeSourceClassDB(3));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
+ ASSERT_TRUE(sourceClassList.empty());
+}
+
+TEST_F(routingTest,updateSourceClass)
+{
+ std::vector<am_SourceClass_s> sourceClassList;
+ std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
+ am_SourceClass_s sourceClass, changedClass;
+ am_ClassProperty_s classProperty;
+ am_sourceClass_t sourceClassID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sourceClass.name = "test";
+ sourceClass.sourceClassID = 0;
+ sourceClass.listClassProperties = classPropertyList;
+ changedClass = sourceClass;
+ changedClass.listClassProperties[1].value = 6;
+ changedPropertyList = changedClass.listClassProperties;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
+ changedClass.sourceClassID = sourceClassID;
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
+ ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
+ ASSERT_EQ(sourceClassList[0].sourceClassID, 100);
+ ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceClassInfoDB(changedClass));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
+ ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
+ ASSERT_EQ(sourceClassList[0].sourceClassID, 100);
+ ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
+}
+
+TEST_F(routingTest,enterSourceClass)
+{
+ std::vector<am_SourceClass_s> sourceClassList;
+ std::vector<am_ClassProperty_s> classPropertyList;
+ am_SourceClass_s sourceClass;
+ am_ClassProperty_s classProperty;
+ am_sourceClass_t sourceClassID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sourceClass.name = "test";
+ sourceClass.sourceClassID = 0;
+ sourceClass.listClassProperties = classPropertyList;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
+ ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
+ ASSERT_EQ(sourceClassList[0].sourceClassID, 100);
+ ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+}
+
+TEST_F(routingTest,enterSourceClassStatic)
+{
+ std::vector<am_SourceClass_s> sourceClassList;
+ std::vector<am_ClassProperty_s> classPropertyList;
+ am_SourceClass_s sourceClass;
+ am_ClassProperty_s classProperty;
+ am_sourceClass_t sourceClassID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sourceClass.name = "test";
+ sourceClass.sourceClassID = 3;
+ sourceClass.listClassProperties = classPropertyList;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
+ ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
+ ASSERT_EQ(sourceClassList[0].sourceClassID, 3);
+ ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+}
+
+TEST_F(routingTest,removeSinkClass)
+{
+ std::vector<am_SinkClass_s> sinkClassList;
+ std::vector<am_ClassProperty_s> classPropertyList;
+ am_SinkClass_s sinkClass;
+ am_ClassProperty_s classProperty;
+ am_sinkClass_t sinkClassID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sinkClass.name = "test";
+ sinkClass.sinkClassID = 0;
+ sinkClass.listClassProperties = classPropertyList;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(2);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
+ ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
+ ASSERT_EQ(sinkClassList[0].sinkClassID, 100);
+ ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+ ASSERT_EQ(E_OK, pDatabaseHandler.removeSinkClassDB(sinkClassID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
+ ASSERT_TRUE(sinkClassList.empty());
+}
+
+TEST_F(routingTest,updateSinkClass)
+{
+ std::vector<am_SinkClass_s> sinkClassList;
+ std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
+ am_SinkClass_s sinkClass, changedClass;
+ am_ClassProperty_s classProperty;
+ am_sinkClass_t sinkClassID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sinkClass.name = "test";
+ sinkClass.sinkClassID = 0;
+ sinkClass.listClassProperties = classPropertyList;
+ changedClass = sinkClass;
+ changedClass.listClassProperties[1].value = 6;
+ changedPropertyList = changedClass.listClassProperties;
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
+ changedClass.sinkClassID = sinkClassID;
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
+ ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
+ ASSERT_EQ(sinkClassList[0].sinkClassID, 100);
+ ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkClassInfoDB(changedClass));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
+ ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
+ ASSERT_EQ(sinkClassList[0].sinkClassID, 100);
+ ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
+}
+
+TEST_F(routingTest,enterSinkClass)
+{
+ std::vector<am_SinkClass_s> sinkClassList;
+ std::vector<am_ClassProperty_s> classPropertyList;
+ am_SinkClass_s sinkClass;
+ am_ClassProperty_s classProperty;
+ am_sinkClass_t sinkClassID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sinkClass.name = "test";
+ sinkClass.sinkClassID = 0;
+ sinkClass.listClassProperties = classPropertyList;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
+ ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
+ ASSERT_EQ(sinkClassList[0].sinkClassID, 100);
+ ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+}
+
+TEST_F(routingTest,enterSinkClassStatic)
+{
+ std::vector<am_SinkClass_s> sinkClassList;
+ std::vector<am_ClassProperty_s> classPropertyList;
+ am_SinkClass_s sinkClass;
+ am_ClassProperty_s classProperty;
+ am_sinkClass_t sinkClassID;
+ classProperty.classProperty = CP_SINK_TYPE;
+ classProperty.value = 1;
+ classPropertyList.push_back(classProperty);
+ classProperty.classProperty = CP_SOURCE_TYPE;
+ classProperty.value = 4;
+ classPropertyList.push_back(classProperty);
+ sinkClass.name = "test";
+ sinkClass.sinkClassID = 4;
+ sinkClass.listClassProperties = classPropertyList;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
+ ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
+ ASSERT_EQ(sinkClassList[0].sinkClassID, 4);
+ ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
+}
+
+TEST_F(routingTest, changeSystemProperty)
+{
+ std::vector<am_SystemProperty_s> listSystemProperties, listReturn;
+ am_SystemProperty_s systemProperty;
+
+ systemProperty.type = SYP_TEST;
+ systemProperty.value = 33;
+ listSystemProperties.push_back(systemProperty);
+ EXPECT_CALL(pMockInterface,cbSystemPropertyChanged(_)).Times(1); //todo: check the exact value here
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSystemProperties(listSystemProperties));
+ systemProperty.value = 444;
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSystemPropertyDB(systemProperty));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSystemProperties(listReturn));
+ ASSERT_EQ(listReturn[0].type, systemProperty.type);
+ ASSERT_EQ(listReturn[0].value, systemProperty.value);
+}
+
+TEST_F(routingTest, systemProperties)
+{
+ std::vector<am_SystemProperty_s> listSystemProperties, listReturn;
+ am_SystemProperty_s systemProperty;
+
+ systemProperty.type = SYP_TEST;
+ systemProperty.value = 33;
+ listSystemProperties.push_back(systemProperty);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSystemProperties(listSystemProperties));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSystemProperties(listReturn));
+ ASSERT_EQ(listReturn[0].type, systemProperty.type);
+ ASSERT_EQ(listReturn[0].value, systemProperty.value);
+}
+
+TEST_F(routingTest,enterSourcesCorrect)
+{
+ //fill the connection database
+ am_Source_s staticSource, firstDynamicSource, secondDynamicSource;
+ am_sourceID_t staticSourceID, firstDynamicSourceID, secondDynamicSourceID;
+ std::vector<am_Source_s> sourceList;
+
+ pCF.createSource(staticSource);
+ staticSource.sourceID = 4;
+ staticSource.name = "Static";
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
+ << "ERROR: database error";
+ ASSERT_EQ(staticSource.sourceID,staticSourceID)
+ << "ERROR: ID not the one given in staticSource";
+
+ pCF.createSource(firstDynamicSource);
+ firstDynamicSource.name = "firstDynamicSource";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(firstDynamicSource,firstDynamicSourceID))
+ << "ERROR: database error";
+ ASSERT_EQ(firstDynamicSourceID,DYNAMIC_ID_BOUNDARY)
+ << "ERROR: ID not the one given in firstDynamicSink";
+
+ pCF.createSource(secondDynamicSource);
+ secondDynamicSource.name = "secondDynamicSource";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(secondDynamicSource,secondDynamicSourceID))
+ << "ERROR: database error";
+ ASSERT_NEAR(secondDynamicSourceID,DYNAMIC_ID_BOUNDARY,10)
+ << "ERROR: ID not the one given in secondDynamicSink";
+
+ //now read back and check the returns agains the given values
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(sourceList))
+ << "ERROR: database error";
+ bool equal = true;
+
+ std::vector<am_Source_s>::iterator listIterator = sourceList.begin();
+ for (; listIterator < sourceList.end(); ++listIterator)
+ {
+ if (listIterator->sourceID == staticSourceID)
+ {
+ equal = equal && pCF.compareSource(listIterator, staticSource);
+ }
+
+ if (listIterator->sourceID == firstDynamicSourceID)
+ {
+ equal = equal && pCF.compareSource(listIterator, firstDynamicSource);
+ }
+
+ if (listIterator->sourceID == secondDynamicSourceID)
+ {
+ equal = equal && pCF.compareSource(listIterator, secondDynamicSource);
+ }
+
+ }
+ ASSERT_EQ(true, equal);
+}
+
+TEST_F(routingTest, changeSourceMainSoundProperty)
+{
+ std::vector<am_Source_s> listSources;
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ pCF.createSource(source);
+ am_MainSoundProperty_s property;
+ property.type = MSP_NAVIGATION_OFFSET;
+ property.value = 33;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ EXPECT_CALL(pMockInterface,cbMainSourceSoundPropertyChanged(sourceID,_)).Times(1); //todo: check in detail
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSourceSoundPropertyDB(property,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ std::vector<am_MainSoundProperty_s>::iterator listIterator = listSources[0].listMainSoundProperties.begin();
+ for (; listIterator < listSources[0].listMainSoundProperties.end(); ++listIterator)
+ {
+ if (listIterator->type == property.type)
+ {
+ ASSERT_EQ(listIterator->value, property.value);
+ }
+ }
+}
+
+TEST_F(routingTest, changeSinkMuteState)
+{
+ std::vector<am_Sink_s> listSinks;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ pCF.createSink(sink);
+ am_MuteState_e muteState = MS_MUTED;
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ EXPECT_CALL(pMockInterface,cbSinkMuteStateChanged(sinkID,muteState)).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkMuteStateDB(muteState,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_EQ(muteState, listSinks[0].muteState);
+}
+
+TEST_F(routingTest, changeSinkMainSoundProperty)
+{
+ std::vector<am_Sink_s> listSinks;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ pCF.createSink(sink);
+ am_MainSoundProperty_s property;
+ property.type = MSP_NAVIGATION_OFFSET;
+ property.value = 33;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ EXPECT_CALL(pMockInterface,cbMainSinkSoundPropertyChanged(sinkID,_)).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSinkSoundPropertyDB(property,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ std::vector<am_MainSoundProperty_s>::iterator listIterator = listSinks[0].listMainSoundProperties.begin();
+ for (; listIterator < listSinks[0].listMainSoundProperties.end(); ++listIterator)
+ {
+ if (listIterator->type == property.type)
+ {
+ ASSERT_EQ(listIterator->value, property.value);
+ }
+ }
+}
+
+TEST_F(routingTest, peekDomain)
+{
+ std::vector<am_Domain_s> listDomains;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_domainID_t domain2ID;
+ pCF.createDomain(domain);
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekDomain(std::string("newdomain"),domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
+ ASSERT_TRUE(listDomains.empty());
+ ASSERT_EQ(domainID, 1);
+ domain.name = "newdomain";
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
+ ASSERT_EQ(domainID, domain2ID);
+ ASSERT_TRUE(listDomains[0].domainID==domainID);
+}
+
+TEST_F(routingTest, peekDomainFirstEntered)
+{
+ std::vector<am_Domain_s> listDomains;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_domainID_t domain2ID;
+ pCF.createDomain(domain);
+ domain.name = "newdomain";
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.peekDomain(std::string("newdomain"),domain2ID));
+ ASSERT_EQ(domainID, domain2ID);
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
+ ASSERT_TRUE(listDomains.size()==1);
+}
+
+TEST_F(routingTest, changeDomainState)
+{
+ std::vector<am_Domain_s> listDomains;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ pCF.createDomain(domain);
+ am_DomainState_e newState = DS_INDEPENDENT_STARTUP;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.changDomainStateDB(newState,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
+ ASSERT_EQ(newState, listDomains[0].state);
+}
+
+TEST_F(routingTest, changeMainConnectionState)
+{
+ std::vector<am_MainConnection_s> listMainConnections;
+ createMainConnectionSetup();
+ EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.changeMainConnectionStateDB(1,CS_DISCONNECTING))
+ << "ERROR: database error";ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(listMainConnections));
+ ASSERT_EQ(CS_DISCONNECTING, listMainConnections[0].connectionState);
+}
+
+TEST_F(routingTest, changeSinkAvailability)
+{
+ std::vector<am_Sink_s> listSinks;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ pCF.createSink(sink);
+ am_Availability_s availability;
+ availability.availability = A_UNKNOWN;
+ availability.availabilityReason = AR_TEMPERATURE;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkAvailabilityDB(availability,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_EQ(availability.availability, listSinks[0].available.availability);
+ ASSERT_EQ(availability.availabilityReason, listSinks[0].available.availabilityReason);
+}
+
+TEST_F(routingTest, changeSourceAvailability)
+{
+ std::vector<am_Source_s> listSources;
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ pCF.createSource(source);
+ am_Availability_s availability;
+ availability.availability = A_UNKNOWN;
+ availability.availabilityReason = AR_TEMPERATURE;
+ source.visible = true;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceAvailabilityDB(availability,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_EQ(availability.availability, listSources[0].available.availability);
+ ASSERT_EQ(availability.availabilityReason, listSources[0].available.availabilityReason);
+}
+
+TEST_F(routingTest,changeMainConnectionRoute)
+{
+ std::vector<am_MainConnection_s> originalList;
+ std::vector<am_MainConnection_s> newList;
+ createMainConnectionSetup();
+ //fill the connection database
+ am_Connection_s connection;
+ am_Source_s source;
+ am_Sink_s sink;
+ std::vector<am_Connection_s> connectionList;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
+ for (uint16_t i = 1; i < 10; i++)
+ {
+ am_sinkID_t forgetSink;
+ am_sourceID_t forgetSource;
+ am_connectionID_t forgetConnection;
+
+ pCF.createConnection(connection);
+ connection.sinkID = i + 20;
+ connection.sourceID = i + 20;
+ connection.delay = -1;
+ connectionList.push_back(connection);
+
+ pCF.createSink(sink);
+ sink.sinkID = i + 20;
+ sink.name = "sink" + int2string(i + 20);
+ sink.domainID = 4;
+ pCF.createSource(source);
+ source.sourceID = i + 20;
+ source.name = "source" + int2string(i + 30);
+ source.domainID = 4;
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(originalList))
+ << "ERROR: database error";
+
+ }
+
+ //fill the route
+ std::vector<am_RoutingElement_s> routingList;
+ pCF.connectionList2RoutingList(routingList, connectionList);
+
+ //create the Route
+ am_Route_s route;
+ route.route = routingList;
+ route.sinkID = 2;
+ route.sourceID = 2;
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeMainConnectionRouteDB(1,route));
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(newList))
+ << "ERROR: database error";ASSERT_TRUE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),routingList.begin(),equalRoutingElement));
+ ASSERT_FALSE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),originalList[0].route.route.begin(),equalRoutingElement));
+}
+
+TEST_F(routingTest,changeMainSinkVolume)
+{
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_mainVolume_t newVol = 20;
+ std::vector<am_Sink_s> listSinks;
+ pCF.createSink(sink);
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ EXPECT_CALL(pMockInterface,cbVolumeChanged(sinkID,newVol)).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkMainVolumeDB(newVol,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_EQ(listSinks[0].mainVolume, newVol);
+}
+
+TEST_F(routingTest,getMainSourceSoundProperties)
+{
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ pCF.createSource(source);
+ std::vector<am_MainSoundProperty_s> mainSoundProperties = source.listMainSoundProperties;
+ std::vector<am_MainSoundProperty_s> listMainSoundProperties;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSourceSoundProperties(sourceID,listMainSoundProperties));
+ ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
+}
+
+TEST_F(routingTest,getMainSinkSoundProperties)
+{
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ pCF.createSink(sink);
+ std::vector<am_MainSoundProperty_s> mainSoundProperties = sink.listMainSoundProperties;
+ std::vector<am_MainSoundProperty_s> listMainSoundProperties;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinkSoundProperties(sinkID,listMainSoundProperties));
+ ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
+}
+
+TEST_F(routingTest,getMainSources)
+{
+ am_Source_s source, source1, source2;
+ am_sourceID_t sourceID;
+ pCF.createSource(source);
+ pCF.createSource(source1);
+ pCF.createSource(source2);
+ source1.name = "source1";
+ source2.name = "source2";
+ bool equal = true;
+ source1.visible = false;
+ std::vector<am_SourceType_s> listMainSources;
+ std::vector<am_Source_s> listSources;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ source.sourceID = sourceID;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source1,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source2,sourceID));
+ source2.sourceID = sourceID;
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSources(listMainSources));
+ listSources.push_back(source);
+ listSources.push_back(source2);
+ std::vector<am_SourceType_s>::iterator listIterator = listMainSources.begin();
+ for (; listIterator < listMainSources.end(); ++listIterator)
+ {
+ equal = equal && pCF.compareSinkMainSource(listIterator, listSources);
+ }
+ ASSERT_TRUE(equal);
+}
+
+TEST_F(routingTest,getMainSinks)
+{
+ am_Sink_s sink, sink1, sink2;
+ am_sinkID_t sinkID;
+ pCF.createSink(sink);
+ pCF.createSink(sink1);
+ pCF.createSink(sink2);
+ sink1.name = "sink1";
+ sink2.name = "sink2";
+ bool equal = true;
+ sink1.visible = false;
+ std::vector<am_SinkType_s> listMainSinks;
+ std::vector<am_Sink_s> listSinks;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ sink.sinkID = sinkID;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink1,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink2,sinkID));
+ sink2.sinkID = sinkID;
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinks(listMainSinks));
+ listSinks.push_back(sink);
+ listSinks.push_back(sink2);
+ std::vector<am_SinkType_s>::iterator listIterator = listMainSinks.begin();
+ for (; listIterator < listMainSinks.end(); ++listIterator)
+ {
+ equal = equal && pCF.compareSinkMainSink(listIterator, listSinks);
+ }
+ ASSERT_TRUE(equal);
+}
+
+TEST_F(routingTest,getVisibleMainConnections)
+{
+ createMainConnectionSetup();
+ am_MainConnection_s mainConnection;
+ am_Route_s route;
+ pCF.createMainConnection(mainConnection, route);
+ std::vector<am_MainConnectionType_s> visibleMainConnection;
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(visibleMainConnection));
+ ASSERT_TRUE(1==visibleMainConnection[0].mainConnectionID);
+ ASSERT_TRUE(mainConnection.connectionState==visibleMainConnection[0].connectionState);
+ ASSERT_TRUE(mainConnection.delay==visibleMainConnection[0].delay);
+ ASSERT_TRUE(1==visibleMainConnection[0].sinkID);
+ ASSERT_TRUE(1==visibleMainConnection[0].sourceID);
+}
+
+TEST_F(routingTest,getListSourcesOfDomain)
+{
+ am_Source_s source, source2;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_sourceID_t sourceID;
+ std::vector<am_sourceID_t> sourceList, sourceCheckList;
+ pCF.createSource(source);
+ source.sourceID = 1;
+ source.name = "testSource";
+ source.domainID = 1;
+ pCF.createSource(source2);
+ source2.sourceID = 0;
+ source2.name = "testSource2";
+ source2.domainID = 5;
+ pCF.createDomain(domain);
+ sourceCheckList.push_back(1); //sink.sinkID);
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source2,sourceID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSourcesOfDomain(2,sourceList))
+ << "ERROR: database error";ASSERT_TRUE(sourceList.empty());
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListSourcesOfDomain(1,sourceList))
+ << "ERROR: database error";
+ ASSERT_TRUE(std::equal(sourceList.begin(),sourceList.end(),sourceCheckList.begin()) && !sourceList.empty());
+}
+
+TEST_F(routingTest,getListSinksOfDomain)
+{
+ am_Sink_s sink, sink2;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_sinkID_t sinkID;
+ std::vector<am_sinkID_t> sinkList, sinkCheckList;
+ pCF.createSink(sink);
+ sink.sinkID = 1;
+ sink.domainID = 1;
+ pCF.createSink(sink2);
+ sink2.domainID = 5;
+ sink2.name = "sink2";
+ pCF.createDomain(domain);
+ sinkCheckList.push_back(1); //sink.sinkID);
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink2,sinkID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSinksOfDomain(2,sinkList))
+ << "ERROR: database error";ASSERT_TRUE(sinkList.empty());
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListSinksOfDomain(1,sinkList))
+ << "ERROR: database error";
+ ASSERT_TRUE(std::equal(sinkList.begin(),sinkList.end(),sinkCheckList.begin()) && !sinkList.empty());
+}
+
+TEST_F(routingTest,getListGatewaysOfDomain)
+{
+ am_Gateway_s gateway, gateway2;
+ am_gatewayID_t gatewayID;
+ am_domainID_t domainID;
+ am_Domain_s domain;
+ std::vector<am_gatewayID_t> gatewayList, gatewayCheckList;
+ pCF.createGateway(gateway);
+ gateway.gatewayID = 1;
+ gateway.name = "testGateway";
+ gateway.controlDomainID = 1;
+ gateway.sourceID = 1;
+ gateway.sinkID = 1;
+ gateway.domainSinkID = 1;
+ gateway.domainSourceID = 1;
+ pCF.createGateway(gateway2);
+ gateway2.gatewayID = 2;
+ gateway2.name = "testGateway2";
+ gateway2.controlDomainID = 4;
+ gateway2.sourceID = 1;
+ gateway2.sinkID = 1;
+ gateway2.domainSinkID = 1;
+ gateway2.domainSourceID = 1;
+ pCF.createDomain(domain);
+ gatewayCheckList.push_back(gateway.gatewayID);
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListGatewaysOfDomain(2,gatewayList))
+ << "ERROR: database error";ASSERT_TRUE(gatewayList.empty());
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListGatewaysOfDomain(1,gatewayList))
+ << "ERROR: database error";
+ ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()) && !gatewayList.empty());
+}
+
+TEST_F(routingTest,removeDomain)
+{
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ std::vector<am_Domain_s> listDomains;
+ pCF.createDomain(domain);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.removeDomainDB(domainID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains))
+ << "ERROR: database error";
+ ASSERT_TRUE(listDomains.empty());
+}
+
+TEST_F(routingTest,removeGateway)
+{
+ am_Gateway_s gateway;
+ am_gatewayID_t gatewayID;
+ std::vector<am_Gateway_s> listGateways;
+ pCF.createGateway(gateway);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.removeGatewayDB(gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(listGateways))
+ << "ERROR: database error";
+ ASSERT_TRUE(listGateways.empty());
+}
+
+TEST_F(routingTest,removeSink)
+{
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ std::vector<am_Sink_s> listSinks;
+ pCF.createSink(sink);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkDB(sinkID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))
+ << "ERROR: database error";
+ ASSERT_TRUE(listSinks.empty());
+}
+
+TEST_F(routingTest,removeSource)
+{
+ //fill the connection database
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ std::vector<am_Source_s> listSources;
+ pCF.createSource(source);
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceDB(sourceID))
+ << "ERROR: database error";
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources))
+ << "ERROR: database error";
+ ASSERT_TRUE(listSources.empty());
+}
+
+TEST_F(routingTest, removeMainConnection)
+{
+ createMainConnectionSetup();
+ EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
+ EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.removeMainConnectionDB(1))
+ << "ERROR: database error";
+}
+
+TEST_F(routingTest,removeNonexistentMainConnectionFail)
+{
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeMainConnectionDB(34))
+ << "ERROR: database error";
+}
+
+TEST_F(routingTest,removeNonexistentSource)
+{
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSourceDB(3))
+ << "ERROR: database error";
+}
+
+TEST_F(routingTest,removeNonexistentSink)
+{
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSinkDB(2))
+ << "ERROR: database error";
}
-TEST_F(databaseTest,registerGatewayCorrect)
+TEST_F(routingTest,removeNonexistentGateway)
{
- //initialize gateway
- std::vector<am_Gateway_s> returnList;
- am_Gateway_s gateway, gateway1, gateway2;
- am_gatewayID_t gatewayID=0,gatewayID1=0,gatewayID2=0;
-
- pCF.createGateway(gateway);
- pCF.createGateway(gateway1);
- gateway1.gatewayID=20;
- pCF.createGateway(gateway2);
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))<< "ERROR: database error";
- ASSERT_EQ(100,gatewayID)<< "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))<< "ERROR: database error";
- ASSERT_EQ(gateway1.gatewayID,gatewayID1)<< "ERROR: domainID zero";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))<< "ERROR: database error";
- ASSERT_EQ(101,gatewayID2)<< "ERROR: domainID zero";
-
- //now check if we read out the correct values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(returnList));
- bool equal=true;
- std::vector<am_Gateway_s>::iterator listIterator=returnList.begin();
-
- for(;listIterator<returnList.end();++listIterator)
- {
- if(listIterator->gatewayID==gatewayID)
- {
- equal= equal && pCF.compareGateway(listIterator,gateway);
- }
-
- if(listIterator->gatewayID==gatewayID1)
- {
- equal= equal && pCF.compareGateway(listIterator,gateway1);
- }
-
- if(listIterator->gatewayID==gatewayID2)
- {
- equal= equal && pCF.compareGateway(listIterator,gateway2);
- }
- }
-
- ASSERT_EQ(true,equal);
+ ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeGatewayDB(12))
+ << "ERROR: database error";
}
-TEST_F(databaseTest,getGatewayInfo)
+TEST_F(routingTest,registerGatewayCorrect)
{
- //initialize gateway
- std::vector<am_Gateway_s> returnList;
- am_Gateway_s gateway, gateway1, gateway2;
- am_gatewayID_t gatewayID=0,gatewayID1=0,gatewayID2=0;
-
- pCF.createGateway(gateway);
- pCF.createGateway(gateway1);
- gateway1.gatewayID=20;
- pCF.createGateway(gateway2);
+ //initialize gateway
+ std::vector<am_Gateway_s> returnList;
+ am_Gateway_s gateway, gateway1, gateway2;
+ am_gatewayID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))<< "ERROR: database error";
- ASSERT_EQ(100,gatewayID)<< "ERROR: domainID zero";
+ pCF.createGateway(gateway);
+ pCF.createGateway(gateway1);
+ gateway1.gatewayID = 20;
+ pCF.createGateway(gateway2);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))<< "ERROR: database error";
- ASSERT_EQ(gateway1.gatewayID,gatewayID1)<< "ERROR: domainID zero";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(100,gatewayID)
+ << "ERROR: domainID zero";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))<< "ERROR: database error";
- ASSERT_EQ(101,gatewayID2)<< "ERROR: domainID zero";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))
+ << "ERROR: database error";
+ ASSERT_EQ(gateway1.gatewayID,gatewayID1)
+ << "ERROR: domainID zero";
- //now check if we read out the correct values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(returnList));
- bool equal=true;
- std::vector<am_Gateway_s>::iterator listIterator=returnList.begin();
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))
+ << "ERROR: database error";
+ ASSERT_EQ(101,gatewayID2)
+ << "ERROR: domainID zero";
- for(;listIterator<returnList.end();++listIterator)
- {
- if(listIterator->gatewayID==gatewayID)
- {
- equal= equal && pCF.compareGateway(listIterator,gateway);
- }
+ //now check if we read out the correct values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListGateways(returnList));
+ bool equal = true;
+ std::vector<am_Gateway_s>::iterator listIterator = returnList.begin();
- if(listIterator->gatewayID==gatewayID1)
- {
- equal= equal && pCF.compareGateway(listIterator,gateway1);
- }
+ for (; listIterator < returnList.end(); ++listIterator)
+ {
+ if (listIterator->gatewayID == gatewayID)
+ {
+ equal = equal && pCF.compareGateway(listIterator, gateway);
+ }
- if(listIterator->gatewayID==gatewayID2)
- {
- equal= equal && pCF.compareGateway(listIterator,gateway2);
- }
- }
+ if (listIterator->gatewayID == gatewayID1)
+ {
+ equal = equal && pCF.compareGateway(listIterator, gateway1);
+ }
- ASSERT_EQ(true,equal);
-
- am_Gateway_s gatewayInfo;
- ASSERT_EQ(E_OK,pDatabaseHandler.getGatewayInfoDB(20,gatewayInfo));
- ASSERT_TRUE(pCF.compareGateway1(gateway1,gatewayInfo));
+ if (listIterator->gatewayID == gatewayID2)
+ {
+ equal = equal && pCF.compareGateway(listIterator, gateway2);
+ }
+ }
+ ASSERT_EQ(true, equal);
}
-TEST_F(databaseTest,enterSinkThatAlreadyExistFail)
+TEST_F(routingTest,getGatewayInfo)
{
- //fill the connection database
- am_Sink_s staticSink,SecondSink;
- am_sinkID_t staticSinkID,SecondSinkID;
+ //initialize gateway
+ std::vector<am_Gateway_s> returnList;
+ am_Gateway_s gateway, gateway1, gateway2;
+ am_gatewayID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
- pCF.createSink(staticSink);
- staticSink.sinkID=43;
- staticSink.name="Static";
+ pCF.createGateway(gateway);
+ pCF.createGateway(gateway1);
+ gateway1.gatewayID = 20;
+ pCF.createGateway(gateway2);
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))<< "ERROR: database error";
- ASSERT_EQ(staticSink.sinkID,staticSinkID)<< "ERROR: ID not the one given in staticSink";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
+ << "ERROR: database error";
+ ASSERT_EQ(100,gatewayID)
+ << "ERROR: domainID zero";
- pCF.createSink(SecondSink);
- SecondSink.sinkID=43;
- SecondSink.name="SecondSink";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))
+ << "ERROR: database error";
+ ASSERT_EQ(gateway1.gatewayID,gatewayID1)
+ << "ERROR: domainID zero";
- ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSinkDB(SecondSink,SecondSinkID))<< "ERROR: database error";
-}
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))
+ << "ERROR: database error";
+ ASSERT_EQ(101,gatewayID2)
+ << "ERROR: domainID zero";
-TEST_F(databaseTest,enterSourcesThatAlreadyExistFail)
-{
- //fill the connection database
- am_Source_s staticSource,SecondSource;
- am_sourceID_t staticSourceID,SecondSourceID;
- pCF.createSource(staticSource);
- staticSource.sourceID=4;
+ //now check if we read out the correct values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListGateways(returnList));
+ bool equal = true;
+ std::vector<am_Gateway_s>::iterator listIterator = returnList.begin();
- EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))<< "ERROR: database error";
- ASSERT_EQ(staticSource.sourceID,staticSourceID)<< "ERROR: ID not the one given in staticSource";
+ for (; listIterator < returnList.end(); ++listIterator)
+ {
+ if (listIterator->gatewayID == gatewayID)
+ {
+ equal = equal && pCF.compareGateway(listIterator, gateway);
+ }
- pCF.createSource(SecondSource);
- SecondSource.sourceID=4;
+ if (listIterator->gatewayID == gatewayID1)
+ {
+ equal = equal && pCF.compareGateway(listIterator, gateway1);
+ }
+
+ if (listIterator->gatewayID == gatewayID2)
+ {
+ equal = equal && pCF.compareGateway(listIterator, gateway2);
+ }
+ }
+
+ ASSERT_EQ(true, equal);
+
+ am_Gateway_s gatewayInfo;
+ ASSERT_EQ(E_OK, pDatabaseHandler.getGatewayInfoDB(20,gatewayInfo));
+ ASSERT_TRUE(pCF.compareGateway1(gateway1,gatewayInfo));
+
+}
+
+TEST_F(routingTest,enterSinkThatAlreadyExistFail)
+{
+ //fill the connection database
+ am_Sink_s staticSink, SecondSink;
+ am_sinkID_t staticSinkID, SecondSinkID;
- ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSourceDB(SecondSource,SecondSourceID))<< "ERROR: database error";
-}
+ pCF.createSink(staticSink);
+ staticSink.sinkID = 43;
+ staticSink.name = "Static";
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
+ << "ERROR: database error";
+ ASSERT_EQ(staticSink.sinkID,staticSinkID)
+ << "ERROR: ID not the one given in staticSink";
-TEST_F(databaseTest,registerDomainCorrect)
-{
- //initialize domain
- std::vector<am_Domain_s> returnList;
- am_Domain_s domain;
- am_domainID_t domainID=0;
- pCF.createDomain(domain);
+ pCF.createSink(SecondSink);
+ SecondSink.sinkID = 43;
+ SecondSink.name = "SecondSink";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))<< "ERROR: database error";
- ASSERT_NE(0,domainID)<< "ERROR: domainID zero";
+ ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSinkDB(SecondSink,SecondSinkID))
+ << "ERROR: database error";
+}
+
+TEST_F(routingTest,enterSourcesThatAlreadyExistFail)
+{
+ //fill the connection database
+ am_Source_s staticSource, SecondSource;
+ am_sourceID_t staticSourceID, SecondSourceID;
+ pCF.createSource(staticSource);
+ staticSource.sourceID = 4;
- //now check if we read out the correct values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(returnList));
- bool equal=true;
- std::vector<am_Domain_s>::iterator listIterator=returnList.begin();
- for(;listIterator<returnList.end();++listIterator)
- {
- if(listIterator->domainID==domainID) {
- equal= equal && (listIterator->name.compare(domain.name)==0)
- && (listIterator->busname.compare(domain.busname)==0)
- && (listIterator->complete == domain.complete)
- && (listIterator->early == domain.early)
- && (listIterator->state == domain.state);
- }
- }
- ASSERT_EQ(true,equal);
-}
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
+ << "ERROR: database error";
+ ASSERT_EQ(staticSource.sourceID,staticSourceID)
+ << "ERROR: ID not the one given in staticSource";
-TEST_F(databaseTest,registerConnectionCorrect)
-{
- am_Connection_s connection;
- am_connectionID_t connectionID;
- std::vector<am_Connection_s> returnList;
- pCF.createConnection(connection);
+ pCF.createSource(SecondSource);
+ SecondSource.sourceID = 4;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,connectionID))<< "ERROR: database error";;
- ASSERT_NE(0,connectionID)<< "ERROR: connectionID zero";
+ ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSourceDB(SecondSource,SecondSourceID))
+ << "ERROR: database error";
+}
+
+TEST_F(routingTest,registerDomainCorrect)
+{
+ //initialize domain
+ std::vector<am_Domain_s> returnList;
+ am_Domain_s domain;
+ am_domainID_t domainID = 0;
+ pCF.createDomain(domain);
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))
+ << "ERROR: database error";
+ ASSERT_NE(0,domainID)
+ << "ERROR: domainID zero";
+
+ //now check if we read out the correct values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(returnList));
+ bool equal = true;
+ std::vector<am_Domain_s>::iterator listIterator = returnList.begin();
+ for (; listIterator < returnList.end(); ++listIterator)
+ {
+ if (listIterator->domainID == domainID)
+ {
+ equal = equal && (listIterator->name.compare(domain.name) == 0) && (listIterator->busname.compare(domain.busname) == 0) && (listIterator->complete == domain.complete) && (listIterator->early == domain.early) && (listIterator->state == domain.state);
+ }
+ }
+ ASSERT_EQ(true, equal);
+}
+
+TEST_F(routingTest,registerConnectionCorrect)
+{
+ am_Connection_s connection;
+ am_connectionID_t connectionID;
+ std::vector<am_Connection_s> returnList;
+ pCF.createConnection(connection);
- //now check if we read out the correct values
- ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionFinal(connectionID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(returnList));
- bool equal=false;
- std::vector<am_Connection_s>::iterator listIterator=returnList.begin();
- for(;listIterator<returnList.end();++listIterator)
- {
- if(listIterator->connectionID==connectionID) {
- equal= (listIterator->sourceID == connection.sourceID)
- && (listIterator->sinkID == connection.sinkID)
- && (listIterator->delay == connection.delay)
- && (listIterator->connectionFormat = connection.connectionFormat);
- }
- }
- ASSERT_EQ(true,equal);
-}
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,connectionID))
+ << "ERROR: database error";;
+ ASSERT_NE(0,connectionID)
+ << "ERROR: connectionID zero";
-TEST_F(databaseTest,enterMainConnectionCorrect)
-{
- createMainConnectionSetup();
+ //now check if we read out the correct values
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(returnList));
+ bool equal = false;
+ std::vector<am_Connection_s>::iterator listIterator = returnList.begin();
+ for (; listIterator < returnList.end(); ++listIterator)
+ {
+ if (listIterator->connectionID == connectionID)
+ {
+ equal = (listIterator->sourceID == connection.sourceID) && (listIterator->sinkID == connection.sinkID) && (listIterator->delay == connection.delay) && (listIterator->connectionFormat = connection.connectionFormat);
+ }
+ }
+ ASSERT_EQ(true, equal);
}
-TEST_F(databaseTest,enterSinksCorrect)
-{
- //fill the connection database
- am_Sink_s staticSink,firstDynamicSink,secondDynamicSink;
- am_sinkID_t staticSinkID,firstDynamicSinkID,secondDynamicSinkID;
- std::vector<am_Sink_s> sinkList;
-
- pCF.createSink(staticSink);
- staticSink.sinkID=4;
-
- EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))<< "ERROR: database error";
- ASSERT_EQ(staticSink.sinkID,staticSinkID)<< "ERROR: ID not the one given in staticSink";
-
- pCF.createSink(firstDynamicSink);
- firstDynamicSink.name="firstdynamic";
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(firstDynamicSink,firstDynamicSinkID))<< "ERROR: database error";
- ASSERT_EQ(firstDynamicSinkID,DYNAMIC_ID_BOUNDARY)<< "ERROR: ID not the one given in firstDynamicSink";
-
- pCF.createSink(secondDynamicSink);
- secondDynamicSink.name="seconddynamic";
-
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(secondDynamicSink,secondDynamicSinkID))<< "ERROR: database error";
- ASSERT_NEAR(secondDynamicSinkID,DYNAMIC_ID_BOUNDARY,10)<< "ERROR: ID not the one given in secondDynamicSink";
-
- //now read back and check the returns agains the given values
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(sinkList))<< "ERROR: database error";
- bool equal=true;
-
- std::vector<am_Sink_s>::iterator listIterator=sinkList.begin();
- for(;listIterator<sinkList.end();++listIterator)
- {
- if(listIterator->sinkID==staticSinkID)
- {
- equal = equal && pCF.compareSink(listIterator,staticSink);
- }
-
- if(listIterator->sinkID==firstDynamicSinkID)
- {
- equal = equal && pCF.compareSink(listIterator,firstDynamicSink);
- }
-
- if(listIterator->sinkID==secondDynamicSinkID)
- {
- equal = equal && pCF.compareSink(listIterator,secondDynamicSink);
- }
- }
- ASSERT_EQ(true,equal);
+TEST_F(routingTest,enterMainConnectionCorrect)
+{
+ createMainConnectionSetup();
+}
+
+TEST_F(routingTest,enterSinksCorrect)
+{
+ //fill the connection database
+ am_Sink_s staticSink, firstDynamicSink, secondDynamicSink;
+ am_sinkID_t staticSinkID, firstDynamicSinkID, secondDynamicSinkID;
+ std::vector<am_Sink_s> sinkList;
+
+ pCF.createSink(staticSink);
+ staticSink.sinkID = 4;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
+ << "ERROR: database error";
+ ASSERT_EQ(staticSink.sinkID,staticSinkID)
+ << "ERROR: ID not the one given in staticSink";
+
+ pCF.createSink(firstDynamicSink);
+ firstDynamicSink.name = "firstdynamic";
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(firstDynamicSink,firstDynamicSinkID))
+ << "ERROR: database error";
+ ASSERT_EQ(firstDynamicSinkID,DYNAMIC_ID_BOUNDARY)
+ << "ERROR: ID not the one given in firstDynamicSink";
+
+ pCF.createSink(secondDynamicSink);
+ secondDynamicSink.name = "seconddynamic";
+
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(secondDynamicSink,secondDynamicSinkID))
+ << "ERROR: database error";
+ ASSERT_NEAR(secondDynamicSinkID,DYNAMIC_ID_BOUNDARY,10)
+ << "ERROR: ID not the one given in secondDynamicSink";
+
+ //now read back and check the returns agains the given values
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(sinkList))
+ << "ERROR: database error";
+ bool equal = true;
+
+ std::vector<am_Sink_s>::iterator listIterator = sinkList.begin();
+ for (; listIterator < sinkList.end(); ++listIterator)
+ {
+ if (listIterator->sinkID == staticSinkID)
+ {
+ equal = equal && pCF.compareSink(listIterator, staticSink);
+ }
+
+ if (listIterator->sinkID == firstDynamicSinkID)
+ {
+ equal = equal && pCF.compareSink(listIterator, firstDynamicSink);
+ }
+
+ if (listIterator->sinkID == secondDynamicSinkID)
+ {
+ equal = equal && pCF.compareSink(listIterator, secondDynamicSink);
+ }
+ }
+ ASSERT_EQ(true, equal);
}
//Commented out - gives always a warning..
@@ -1539,18 +1592,9 @@ TEST_F(databaseTest,enterSinksCorrect)
// ASSERT_DEATH(pDatabaseHandler.enterDomainDB(domain,domainID),"Assertion `domainData.domainID==0'");
//}
-
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
-
-
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/test/database/databaseTest.h b/AudioManagerDaemon/test/database/databaseTest.h
index 4098dc0..0d46b68 100644
--- a/AudioManagerDaemon/test/database/databaseTest.h
+++ b/AudioManagerDaemon/test/database/databaseTest.h
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file databasetest.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file databasetest.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef DATABASETEST_H_
#define DATABASETEST_H_
@@ -45,28 +45,29 @@
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
-namespace am {
+namespace am
+{
-
-class databaseTest : public ::testing::Test {
+class routingTest: public ::testing::Test
+{
public:
- databaseTest();
- ~databaseTest();
- std::vector<std::string> plistRoutingPluginDirs;
- std::vector<std::string> plistCommandPluginDirs;
- DatabaseHandler pDatabaseHandler;
- RoutingSender pRoutingSender;
- CommandSender pCommandSender;
- MockCommandSendInterface pMockInterface;
- RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
- CommandInterfaceBackdoor pCommandInterfaceBackdoor;
- ControlReceiver pControlReceiver;
- DatabaseObserver pObserver;
- CommonFunctions pCF;
- void SetUp();
- void TearDown();
+ routingTest();
+ ~routingTest();
+ std::vector<std::string> plistRoutingPluginDirs;
+ std::vector<std::string> plistCommandPluginDirs;
+ DatabaseHandler pDatabaseHandler;
+ RoutingSender pRoutingSender;
+ CommandSender pCommandSender;
+ MockCommandSendInterface pMockInterface;
+ RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
+ CommandInterfaceBackdoor pCommandInterfaceBackdoor;
+ ControlReceiver pControlReceiver;
+ DatabaseObserver pObserver;
+ CommonFunctions pCF;
+ void SetUp();
+ void TearDown();
- void createMainConnectionSetup();
+ void createMainConnectionSetup();
};
}
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
index 8a66d57..6ebd99d 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file routingInterfaces.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 routingInterfaces.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 "routingInterfaceTest.h"
@@ -30,22 +30,22 @@ using namespace testing;
DLT_DECLARE_CONTEXT(DLT_CONTEXT);
-routingInterfaceTest::routingInterfaceTest()
- :plistRoutingPluginDirs(),
- plistCommandPluginDirs(),
- pDatabaseHandler(std::string(":memory:")),
- pRoutingSender(plistRoutingPluginDirs),
- pCommandSender(plistCommandPluginDirs),
- pMockInterface(),
- pRoutingInterfaceBackdoor(),
- pCommandInterfaceBackdoor(),
- pControlReceiver(&pDatabaseHandler,&pRoutingSender,&pCommandSender),
- pObserver(&pCommandSender,&pRoutingSender)
+routingInterfaceTest::routingInterfaceTest() :
+ plistRoutingPluginDirs(), //
+ plistCommandPluginDirs(), //
+ pDatabaseHandler(std::string(":memory:")), //
+ pRoutingSender(plistRoutingPluginDirs), //
+ pCommandSender(plistCommandPluginDirs), //
+ pMockInterface(), //
+ pRoutingInterfaceBackdoor(), //
+ pCommandInterfaceBackdoor(), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
+ pObserver(&pCommandSender, &pRoutingSender)
{
- pDatabaseHandler.registerObserver(&pObserver);
- pRoutingInterfaceBackdoor.unloadPlugins(&pRoutingSender);
- pRoutingInterfaceBackdoor.injectInterface(&pRoutingSender,&pMockInterface,"mock");
- pCommandInterfaceBackdoor.unloadPlugins(&pCommandSender);
+ pDatabaseHandler.registerObserver(&pObserver);
+ pRoutingInterfaceBackdoor.unloadPlugins(&pRoutingSender);
+ pRoutingInterfaceBackdoor.injectInterface(&pRoutingSender, &pMockInterface, "mock");
+ pCommandInterfaceBackdoor.unloadPlugins(&pCommandSender);
}
routingInterfaceTest::~routingInterfaceTest()
@@ -54,389 +54,387 @@ routingInterfaceTest::~routingInterfaceTest()
void routingInterfaceTest::SetUp()
{
- DLT_REGISTER_APP("Rtest","RoutingInterfacetest");
- DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context");
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
+ DLT_REGISTER_APP("Rtest", "RoutingInterfacetest");
+ DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
}
void routingInterfaceTest::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
TEST_F(routingInterfaceTest,abort)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
am_connectionID_t connectionID;
- std::vector<am_Handle_s>listHandles;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
-
- //prepare the stage
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
-
- //start a connect, expect a call on the routingInterface
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+
+ //prepare the stage
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //start a connect, expect a call on the routingInterface
EXPECT_CALL(pMockInterface,asyncConnect(_,_,1,sinkID,CF_ANALOG)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
+ ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
//check the correctness of the handle
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_CONNECT);
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_CONNECT);
//the handle must be inside the handlelist
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles[0].handle==handle.handle);
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
//send an abort expect a call on the routing interface
EXPECT_CALL(pMockInterface,asyncAbort(_)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.abortAction(handle));
+ ASSERT_EQ(E_OK, pControlReceiver.abortAction(handle));
//the reaction on the abort is specific for every function
//now we try to abort a handle that does not exist
- handle.handle=24;
- ASSERT_EQ(E_NON_EXISTENT,pControlReceiver.abortAction(handle));
+ handle.handle = 24;
+ ASSERT_EQ(E_NON_EXISTENT, pControlReceiver.abortAction(handle));
}
TEST_F(routingInterfaceTest,abortNonExistent)
{
EXPECT_CALL(pMockInterface,asyncAbort(_)).Times(0);
am_Handle_s handle;
- ASSERT_EQ(E_NON_EXISTENT,pControlReceiver.abortAction(handle));
+ ASSERT_EQ(E_NON_EXISTENT, pControlReceiver.abortAction(handle));
}
TEST_F(routingInterfaceTest,alreadyConnected)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
EXPECT_CALL(pMockInterface,asyncConnect(_,_,1,sinkID,CF_ANALOG)).WillOnce(Return(E_OK));
am_Handle_s handle;
am_connectionID_t connectionID;
- ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
- ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionFinal(connectionID));
- ASSERT_EQ(E_ALREADY_EXISTS,pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_CONNECT);
+ ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
+ ASSERT_EQ(E_ALREADY_EXISTS, pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_CONNECT);
}
TEST_F(routingInterfaceTest,setSinkSoundPropertyNoChange)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
am_SoundProperty_s soundProperty;
- soundProperty.type=SP_TREBLE;
- soundProperty.value=23;
- std::vector<am_Handle_s>listHandles;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- sink.listSoundProperties.push_back(soundProperty);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+ soundProperty.type = SP_TREBLE;
+ soundProperty.value = 23;
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+ 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);
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSinkSoundProperty(handle,sinkID,soundProperty));
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkSoundProperty(handle,sinkID,soundProperty));
}
TEST_F(routingInterfaceTest,setSourceState)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_Handle_s handle;
- handle.handle=0;
- am_SourceState_e state=SS_PAUSED;
- pCF.createSource(source);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- source.domainID=1;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
- EXPECT_CALL(pMockInterface,asyncSetSourceState(_,sourceID,state)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.setSourceState(handle,sourceID,state));
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_SETSOURCESTATE);
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_Handle_s handle;
+ handle.handle = 0;
+ am_SourceState_e state = SS_PAUSED;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ source.domainID = 1;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ EXPECT_CALL(pMockInterface,asyncSetSourceState(_,sourceID,state)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK, pControlReceiver.setSourceState(handle,sourceID,state));
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_SETSOURCESTATE);
}
TEST_F(routingInterfaceTest,setSourceSoundProperty)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
am_SoundProperty_s soundProperty;
- std::vector<am_Handle_s>listHandles;
- pCF.createSource(source);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- source.sourceID=2;
- source.domainID=1;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ source.sourceID = 2;
+ 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));
- ASSERT_EQ(E_OK,pControlReceiver.setSourceSoundProperty(handle,sourceID,soundProperty));
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_SETSOURCESOUNDPROPERTY);
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_OK, pControlReceiver.setSourceSoundProperty(handle,sourceID,soundProperty));
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_SETSOURCESOUNDPROPERTY);
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles[0].handle==handle.handle);
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
TEST_F(routingInterfaceTest,setSinkSoundProperty)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
am_SoundProperty_s soundProperty;
- std::vector<am_Handle_s>listHandles;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ 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));
- ASSERT_EQ(E_OK,pControlReceiver.setSinkSoundProperty(handle,sinkID,soundProperty));
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_SETSINKSOUNDPROPERTY);
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_OK, pControlReceiver.setSinkSoundProperty(handle,sinkID,soundProperty));
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_SETSINKSOUNDPROPERTY);
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles[0].handle==handle.handle);
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
TEST_F(routingInterfaceTest,setSourceVolumeNoChange)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
- am_volume_t volume=34;
- am_RampType_e rampType=RAMP_DIRECT;
- am_time_t rampTime=300;
- std::vector<am_Handle_s>listHandles;
- pCF.createSource(source);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- source.sourceID=2;
- source.domainID=1;
- source.volume=volume;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+ am_volume_t volume = 34;
+ am_RampType_e rampType = RAMP_DIRECT;
+ am_time_t rampTime = 300;
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ source.sourceID = 2;
+ source.domainID = 1;
+ source.volume = volume;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
EXPECT_CALL(pMockInterface,asyncSetSourceVolume(_,2,volume,rampType,rampTime)).Times(0);
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSourceVolume(handle,2,volume,rampType,rampTime));
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceVolume(handle,2,volume,rampType,rampTime));
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles.empty());
}
TEST_F(routingInterfaceTest,setSourceVolume)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
- am_volume_t volume=34;
- am_RampType_e rampType=RAMP_DIRECT;
- am_time_t rampTime=300;
- std::vector<am_Handle_s>listHandles;
- pCF.createSource(source);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- source.sourceID=2;
- source.domainID=1;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+ am_volume_t volume = 34;
+ am_RampType_e rampType = RAMP_DIRECT;
+ am_time_t rampTime = 300;
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ source.sourceID = 2;
+ source.domainID = 1;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
EXPECT_CALL(pMockInterface,asyncSetSourceVolume(_,2,volume,rampType,rampTime)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.setSourceVolume(handle,2,volume,rampType,rampTime));
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_SETSOURCEVOLUME);
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_OK, pControlReceiver.setSourceVolume(handle,2,volume,rampType,rampTime));
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_SETSOURCEVOLUME);
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles[0].handle==handle.handle);
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
TEST_F(routingInterfaceTest,setSinkVolumeNoChange)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
- am_volume_t volume=34;
- am_RampType_e rampType=RAMP_DIRECT;
- am_time_t rampTime=300;
- std::vector<am_Handle_s>listHandles;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- sink.volume=volume;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+ am_volume_t volume = 34;
+ am_RampType_e rampType = RAMP_DIRECT;
+ am_time_t rampTime = 300;
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+ sink.volume = volume;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
EXPECT_CALL(pMockInterface,asyncSetSinkVolume(_,2,volume,rampType,rampTime)).Times(0);
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSinkVolume(handle,2,volume,rampType,rampTime));
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkVolume(handle,2,volume,rampType,rampTime));
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles.empty());
}
TEST_F(routingInterfaceTest,setSinkVolume)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
- am_volume_t volume=34;
- am_RampType_e rampType=RAMP_DIRECT;
- am_time_t rampTime=300;
- std::vector<am_Handle_s>listHandles;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+ am_volume_t volume = 34;
+ am_RampType_e rampType = RAMP_DIRECT;
+ am_time_t rampTime = 300;
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
EXPECT_CALL(pMockInterface,asyncSetSinkVolume(_,2,volume,rampType,rampTime)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.setSinkVolume(handle,2,volume,rampType,rampTime));
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_SETSINKVOLUME);
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_OK, pControlReceiver.setSinkVolume(handle,2,volume,rampType,rampTime));
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_SETSINKVOLUME);
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles[0].handle==handle.handle);
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
TEST_F(routingInterfaceTest,connect)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
am_connectionID_t connectionID;
- std::vector<am_Handle_s>listHandles;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
EXPECT_CALL(pMockInterface,asyncConnect(_,_,1,sinkID,CF_ANALOG)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_CONNECT);
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_CONNECT);
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles[0].handle==handle.handle);
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
}
TEST_F(routingInterfaceTest,disconnect)
{
- am_Sink_s sink;
- am_sinkID_t sinkID;
- am_Domain_s domain;
- am_domainID_t domainID;
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
am_Handle_s handle;
am_connectionID_t connectionID;
- std::vector<am_Handle_s>listHandles;
- pCF.createSink(sink);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- sink.sinkID=2;
- sink.domainID=1;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+ std::vector<am_Handle_s> listHandles;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ sink.sinkID = 2;
+ sink.domainID = 1;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
EXPECT_CALL(pMockInterface,asyncConnect(_,_,1,sinkID,CF_ANALOG)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
- ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionFinal(connectionID));
+ ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
EXPECT_CALL(pMockInterface,asyncDisconnect(_,connectionID)).WillOnce(Return(E_OK));
- ASSERT_EQ(E_OK,pControlReceiver.disconnect(handle,connectionID));
- ASSERT_NE(handle.handle,0);
- ASSERT_EQ(handle.handleType,H_DISCONNECT);
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ ASSERT_EQ(E_OK, pControlReceiver.disconnect(handle,connectionID));
+ ASSERT_NE(handle.handle, 0);
+ ASSERT_EQ(handle.handleType, H_DISCONNECT);
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles[1].handle==handle.handle);
ASSERT_TRUE(listHandles[1].handleType==handle.handleType);
}
TEST_F(routingInterfaceTest,nothingTodisconnect)
{
- am_Handle_s handle;
- am_connectionID_t connectionID=4;
- std::vector<am_Handle_s>listHandles;
- ASSERT_EQ(E_NON_EXISTENT,pControlReceiver.disconnect(handle,connectionID));
- ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
+ am_Handle_s handle;
+ am_connectionID_t connectionID = 4;
+ std::vector<am_Handle_s> listHandles;
+ ASSERT_EQ(E_NON_EXISTENT, pControlReceiver.disconnect(handle,connectionID));
+ ASSERT_EQ(E_OK, pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles.empty());
}
-
TEST_F(routingInterfaceTest,setSourceStateNoChange)
{
- am_Source_s source;
- am_sourceID_t sourceID;
- am_Domain_s domain;
- am_domainID_t domainID;
- am_Handle_s handle;
- handle.handle=0;
- am_SourceState_e state=SS_PAUSED;
- pCF.createSource(source);
- pCF.createDomain(domain);
- domain.name="mock";
- domain.busname="mock";
- source.domainID=1;
- source.sourceState=state;
- ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
- EXPECT_CALL(pMockInterface,asyncSetSourceState(_,sourceID,state)).Times(0);
- ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSourceState(handle,sourceID,state));
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_Handle_s handle;
+ handle.handle = 0;
+ am_SourceState_e state = SS_PAUSED;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name = "mock";
+ domain.busname = "mock";
+ source.domainID = 1;
+ source.sourceState = state;
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ EXPECT_CALL(pMockInterface,asyncSetSourceState(_,sourceID,state)).Times(0);
+ ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceState(handle,sourceID,state));
}
-
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
index acd1264..4da9643 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file routingInterfaces.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file routingInterfaces.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef ROUTINGINTERFACETEST_H_
#define ROUTINGINTERFACETEST_H_
@@ -42,26 +42,27 @@
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
+namespace am
+{
-namespace am {
-
-class routingInterfaceTest : public ::testing::Test{
+class routingInterfaceTest: public ::testing::Test
+{
public:
- routingInterfaceTest();
- ~routingInterfaceTest();
- std::vector<std::string> plistRoutingPluginDirs;
- std::vector<std::string> plistCommandPluginDirs;
- DatabaseHandler pDatabaseHandler;
- RoutingSender pRoutingSender;
- CommandSender pCommandSender;
- MockRoutingSendInterface pMockInterface;
- RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
- CommandInterfaceBackdoor pCommandInterfaceBackdoor;
- ControlReceiver pControlReceiver;
- DatabaseObserver pObserver;
- CommonFunctions pCF;
- void SetUp();
- void TearDown();
+ routingInterfaceTest();
+ ~routingInterfaceTest();
+ std::vector<std::string> plistRoutingPluginDirs;
+ std::vector<std::string> plistCommandPluginDirs;
+ DatabaseHandler pDatabaseHandler;
+ RoutingSender pRoutingSender;
+ CommandSender pCommandSender;
+ MockRoutingSendInterface pMockInterface;
+ RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
+ CommandInterfaceBackdoor pCommandInterfaceBackdoor;
+ ControlReceiver pControlReceiver;
+ DatabaseObserver pObserver;
+ CommonFunctions pCF;
+ void SetUp();
+ void TearDown();
};
}
diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp
index cf551aa..5c23789 100644
--- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp
+++ b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp
@@ -23,7 +23,7 @@ using namespace am;
DLT_DECLARE_CONTEXT(AudioManager)
-static volatile sig_atomic_t gDispatch = 1; //this global is used to stop the mainloop
+static volatile sig_atomic_t gDispatch = 1; //this global is used to stop the mainloop
sockethandlerTest::sockethandlerTest()
{
@@ -33,89 +33,83 @@ sockethandlerTest::~sockethandlerTest()
{
}
-am::timerCallBack::timerCallBack(SocketHandler *myHandler)
- :pTimer1Callback(this, &timerCallBack::timer1Callback),
- pTimer2Callback(this, &timerCallBack::timer2Callback),
- pTimer3Callback(this, &timerCallBack::timer3Callback),
- pTimer4Callback(this, &timerCallBack::timer4Callback),
- mSocketHandler(myHandler)
+timerCallBack::timerCallBack(SocketHandler *myHandler) :
+ pTimer1Callback(this, &timerCallBack::timer1Callback), //
+ pTimer2Callback(this, &timerCallBack::timer2Callback), //
+ pTimer3Callback(this, &timerCallBack::timer3Callback), //
+ pTimer4Callback(this, &timerCallBack::timer4Callback), //
+ mSocketHandler(myHandler)
{
}
-
-
am::timerCallBack::~timerCallBack()
{
}
-
-
void am::timerCallBack::timer1Callback(sh_timerHandle_t handle, void* userData)
{
- std::cout<<"callback1 called"<<std::endl;
- timespec timeout;
- timeout.tv_nsec=0;
- timeout.tv_sec=1;
- shTimerCallBack *buf=&pTimer1Callback;
- sh_timerHandle_t handle_;
- mSocketHandler->addTimer(timeout,buf,handle_,NULL);
+ std::cout << "callback1 called" << std::endl;
+ timespec timeout;
+ timeout.tv_nsec = 0;
+ timeout.tv_sec = 1;
+ shTimerCallBack *buf = &pTimer1Callback;
+ sh_timerHandle_t handle_;
+ mSocketHandler->addTimer(timeout, buf, handle_, NULL);
}
-
-
void am::timerCallBack::timer2Callback(sh_timerHandle_t handle, void* userData)
{
- std::cout<<"callback2 called"<<std::endl;
- timespec timeout;
- timeout.tv_nsec=0;
- timeout.tv_sec=1;
- shTimerCallBack *buf=&pTimer2Callback;
- sh_timerHandle_t handle_;
- mSocketHandler->addTimer(timeout,buf,handle_,NULL);
+ std::cout << "callback2 called" << std::endl;
+ timespec timeout;
+ timeout.tv_nsec = 0;
+ timeout.tv_sec = 1;
+ shTimerCallBack *buf = &pTimer2Callback;
+ sh_timerHandle_t handle_;
+ mSocketHandler->addTimer(timeout, buf, handle_, NULL);
}
void am::timerCallBack::timer3Callback(sh_timerHandle_t, void* userData)
{
- std::cout<<"callback3 called"<<std::endl;
+ std::cout << "callback3 called" << std::endl;
}
void am::timerCallBack::timer4Callback(sh_timerHandle_t, void* userData)
{
- std::cout<<"callback4 called"<<std::endl;
- mSocketHandler->stop_listening();
+ std::cout << "callback4 called" << std::endl;
+ mSocketHandler->stop_listening();
}
void* playWithSocketServer(void* data)
{
- SocketHandler myHandler;
- SamplePlugin::sockType_e type=SamplePlugin::INET;
- SamplePlugin myplugin(&myHandler,type);
- myHandler.start_listenting();
+ SocketHandler myHandler;
+ SamplePlugin::sockType_e type = SamplePlugin::INET;
+ SamplePlugin myplugin(&myHandler, type);
+ myHandler.start_listenting();
}
void* playWithUnixSocketServer(void* data)
{
- SocketHandler myHandler;
- SamplePlugin::sockType_e type=SamplePlugin::UNIX;
- SamplePlugin myplugin(&myHandler,type);
- myHandler.start_listenting();
+ SocketHandler myHandler;
+ SamplePlugin::sockType_e type = SamplePlugin::UNIX;
+ SamplePlugin myplugin(&myHandler, type);
+ myHandler.start_listenting();
}
TEST(sockethandlerTest,playWithUNIXSockets)
{
- pthread_t serverThread;
- char buffer[3000];
- struct sockaddr_un servAddr;
- int socket_;
+ pthread_t serverThread;
+ char buffer[3000];
+ struct sockaddr_un servAddr;
+ int socket_;
- //creates a thread that handles the serverpart
- pthread_create(&serverThread,NULL,playWithUnixSocketServer,NULL);
+ //creates a thread that handles the serverpart
+ pthread_create(&serverThread, NULL, playWithUnixSocketServer, NULL);
- sleep(1); //we need that here because the port needs to be opened
+ sleep(1); //we need that here because the port needs to be opened
if ((socket_ = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
{
- std::cout<<"socket problem"<<std::endl;
+ std::cout << "socket problem" << std::endl;
}
@@ -124,90 +118,90 @@ TEST(sockethandlerTest,playWithUNIXSockets)
servAddr.sun_family = AF_UNIX;
if (connect(socket_, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0)
{
- std::cout<<"ERROR: connect() failed\n"<<std::endl;
+ std::cout << "ERROR: connect() failed\n" << std::endl;
}
- for (int i=0;i<=1000;i++)
- {
- std::string string("Got It?");
- send(socket_,string.c_str(),string.size(),0);
- }
- std::string string("finish!");
- send(socket_,string.c_str(),string.size(),0);
+ for (int i = 0; i <= 1000; i++)
+ {
+ std::string string("Got It?");
+ send(socket_, string.c_str(), string.size(), 0);
+ }
+ std::string string("finish!");
+ send(socket_, string.c_str(), string.size(), 0);
- pthread_join(serverThread,NULL);
+ pthread_join(serverThread, NULL);
}
TEST(sockethandlerTest,playWithSockets)
{
- pthread_t serverThread;
- char buffer[3000];
- struct sockaddr_in servAddr;
- unsigned short servPort = 6060;
- struct hostent *host;
- int socket_;
+ pthread_t serverThread;
+ char buffer[3000];
+ struct sockaddr_in servAddr;
+ unsigned short servPort = 6060;
+ struct hostent *host;
+ int socket_;
- //creates a thread that handles the serverpart
- pthread_create(&serverThread,NULL,playWithSocketServer,NULL);
+ //creates a thread that handles the serverpart
+ pthread_create(&serverThread, NULL, playWithSocketServer, NULL);
- sleep(1); //we need that here because the port needs to be opened
+ sleep(1); //we need that here because the port needs to be opened
if ((socket_ = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
{
- std::cout<<"socket problem"<<std::endl;
+ std::cout << "socket problem" << std::endl;
}
if ((host = (struct hostent*) gethostbyname("localhost")) == 0)
{
- std::cout<<"ERROR: gethostbyname() failed\n"<<std::endl;
+ std::cout << "ERROR: gethostbyname() failed\n" << std::endl;
}
memset(&servAddr, 0, sizeof(servAddr));
- servAddr.sin_family = AF_INET;
- servAddr.sin_addr.s_addr = inet_addr(inet_ntoa(*( struct in_addr*)( host -> h_addr_list[0])));
- servAddr.sin_port = htons(servPort);
+ servAddr.sin_family = AF_INET;
+ servAddr.sin_addr.s_addr = inet_addr(inet_ntoa(*(struct in_addr*) (host->h_addr_list[0])));
+ servAddr.sin_port = htons(servPort);
if (connect(socket_, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0)
{
- std::cout<<"ERROR: connect() failed\n"<<std::endl;
+ std::cout << "ERROR: connect() failed\n" << std::endl;
}
- for (int i=0;i<=1000;i++)
- {
- std::string string("Got It?");
- send(socket_,string.c_str(),string.size(),0);
- }
- std::string string("finish!");
- send(socket_,string.c_str(),string.size(),0);
+ for (int i = 0; i <= 1000; i++)
+ {
+ std::string string("Got It?");
+ send(socket_, string.c_str(), string.size(), 0);
+ }
+ std::string string("finish!");
+ send(socket_, string.c_str(), string.size(), 0);
- pthread_join(serverThread,NULL);
+ pthread_join(serverThread, NULL);
}
TEST(sockethandlerTest,playWithTimers)
{
- gDispatchDone=0;
- SocketHandler myHandler;
- timerCallBack testCallback(&myHandler);
- timespec timeoutTime, timeout2, timeout3, timeout4;
- timeoutTime.tv_sec=3;
- timeoutTime.tv_nsec=0;
- timeout2.tv_nsec=0;
- timeout2.tv_sec=1;
- timeout3.tv_nsec=000000000;
- timeout3.tv_sec=2;
- timeout4.tv_nsec=0;
- timeout4.tv_sec=13;
- shTimerCallBack* buf=&testCallback.pTimer1Callback;
- shTimerCallBack* buf2=&testCallback.pTimer2Callback;
- shTimerCallBack* buf3=&testCallback.pTimer3Callback;
- shTimerCallBack* buf4=&testCallback.pTimer4Callback;
- sh_timerHandle_t handle;
- myHandler.addTimer(timeoutTime,buf,handle,NULL);
- myHandler.addTimer(timeout2,buf2,handle,NULL);
- myHandler.addTimer(timeout3,buf3,handle,NULL);
- myHandler.addTimer(timeout4,buf4,handle,NULL);
- myHandler.start_listenting();
+ gDispatchDone = 0;
+ SocketHandler myHandler;
+ timerCallBack testCallback(&myHandler);
+ timespec timeoutTime, timeout2, timeout3, timeout4;
+ timeoutTime.tv_sec = 3;
+ timeoutTime.tv_nsec = 0;
+ timeout2.tv_nsec = 0;
+ timeout2.tv_sec = 1;
+ timeout3.tv_nsec = 000000000;
+ timeout3.tv_sec = 2;
+ timeout4.tv_nsec = 0;
+ timeout4.tv_sec = 13;
+ shTimerCallBack* buf = &testCallback.pTimer1Callback;
+ shTimerCallBack* buf2 = &testCallback.pTimer2Callback;
+ shTimerCallBack* buf3 = &testCallback.pTimer3Callback;
+ shTimerCallBack* buf4 = &testCallback.pTimer4Callback;
+ sh_timerHandle_t handle;
+ myHandler.addTimer(timeoutTime, buf, handle, NULL);
+ myHandler.addTimer(timeout2, buf2, handle, NULL);
+ myHandler.addTimer(timeout3, buf3, handle, NULL);
+ myHandler.addTimer(timeout4, buf4, handle, NULL);
+ myHandler.start_listenting();
}
@@ -221,131 +215,118 @@ void sockethandlerTest::TearDown()
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
-am::SamplePlugin::SamplePlugin(SocketHandler *mySocketHandler, sockType_e socketType)
- :connectFiredCB(this,&SamplePlugin::connectSocket),
- receiveFiredCB(this,&SamplePlugin::receiveData),
- sampleDispatchCB(this,&SamplePlugin::dispatchData),
- sampleCheckCB(this,&SamplePlugin::check),
- mSocketHandler(mySocketHandler),
- mConnecthandle(),
- mReceiveHandle(),
- msgList()
+am::SamplePlugin::SamplePlugin(SocketHandler *mySocketHandler, sockType_e socketType) :
+ connectFiredCB(this, &SamplePlugin::connectSocket), //
+ receiveFiredCB(this, &SamplePlugin::receiveData), //
+ sampleDispatchCB(this, &SamplePlugin::dispatchData), //
+ sampleCheckCB(this, &SamplePlugin::check), //
+ mSocketHandler(mySocketHandler), //
+ mConnecthandle(), //
+ mReceiveHandle(), //
+ msgList()
{
- int ret;
- int yes = 1;
-
- int socketHandle;
- struct sockaddr_in servAddr;
- struct sockaddr_un unixAddr;
- unsigned int servPort = 6060;
-
- switch (socketType)
- {
- case UNIX:
- socketHandle = socket(AF_UNIX, SOCK_STREAM, 0);
- unixAddr.sun_family = AF_UNIX;
- strcpy(unixAddr.sun_path,SOCK_PATH);
- unlink(unixAddr.sun_path);
- bind(socketHandle, (struct sockaddr *)&unixAddr, strlen(unixAddr.sun_path) + sizeof(unixAddr.sun_family));
- break;
- case INET:
- socketHandle = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
- setsockopt(socketHandle, 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(socketHandle, (struct sockaddr *) &servAddr, sizeof(servAddr));
- break;
- default:
- break;
- }
+ int ret;
+ int yes = 1;
+
+ int socketHandle;
+ struct sockaddr_in servAddr;
+ struct sockaddr_un unixAddr;
+ unsigned int servPort = 6060;
+
+ switch (socketType)
+ {
+ case UNIX:
+ socketHandle = socket(AF_UNIX, SOCK_STREAM, 0);
+ unixAddr.sun_family = AF_UNIX;
+ strcpy(unixAddr.sun_path, SOCK_PATH);
+ unlink(unixAddr.sun_path);
+ bind(socketHandle, (struct sockaddr *) &unixAddr, strlen(unixAddr.sun_path) + sizeof(unixAddr.sun_family));
+ break;
+ case INET:
+ socketHandle = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+ setsockopt(socketHandle, 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(socketHandle, (struct sockaddr *) &servAddr, sizeof(servAddr));
+ break;
+ default:
+ break;
+ }
if (listen(socketHandle, 3) < 0)
{
- std::cout<<"listen ok"<<std::endl;
+ std::cout << "listen ok" << std::endl;
} /* if */
- int a=1;
- ioctl (socketHandle, FIONBIO, (char *) &a);
- setsockopt (socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char *) &a, sizeof (a));
+ int a = 1;
+ ioctl(socketHandle, FIONBIO, (char *) &a);
+ setsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char *) &a, sizeof(a));
- short events=0;
- events |= POLLIN;
- mySocketHandler->addFDPoll(socketHandle,events,NULL,&connectFiredCB,NULL,NULL,NULL,mConnecthandle);
- std::cout<<"setup server - listening"<<std::endl;
+ short events = 0;
+ events |= POLLIN;
+ mySocketHandler->addFDPoll(socketHandle, events, NULL, &connectFiredCB, NULL, NULL, NULL, mConnecthandle);
+ std::cout << "setup server - listening" << std::endl;
}
-
-
void am::SamplePlugin::connectSocket(const pollfd pollfd1, const sh_pollHandle_t handle, void *userData)
{
- //first, accept the connection, create a new filedescriptor
- std::cout<<"Got a connection request !"<<std::endl;
- struct sockaddr answer;
- socklen_t len=sizeof(answer);
- int receiveFD = accept(pollfd1.fd, (struct sockaddr*)&answer, &len);
+ //first, accept the connection, create a new filedescriptor
+ std::cout << "Got a connection request !" << std::endl;
+ struct sockaddr answer;
+ socklen_t len = sizeof(answer);
+ int receiveFD = accept(pollfd1.fd, (struct sockaddr*) &answer, &len);
- //set the correct event:
- short event = 0;
- event |=POLLIN;
+ //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(receiveFD,event,NULL,&receiveFiredCB,&sampleCheckCB,&sampleDispatchCB,NULL,mReceiveHandle);
+ //aded the filedescriptor to the sockethandler and register the callbacks for receiving the data
+ mSocketHandler->addFDPoll(receiveFD, event, NULL, &receiveFiredCB, &sampleCheckCB, &sampleDispatchCB, NULL, mReceiveHandle);
}
-
-
void am::SamplePlugin::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
- //initialize buffer
- char buffer[10];
- //read until buffer is full or no more data is there
- int read=recv(pollfd.fd,buffer,7,NULL);
- if (read>1)
- {
- //read the message and store it in a queue
- std::string msg=std::string(buffer,read);
- msgList.push(msg);
- std::cout<<"Got a message !"<<std::endl;
- }
+ //initialize buffer
+ char buffer[10];
+ //read until buffer is full or no more data is there
+ int read = recv(pollfd.fd, buffer, 7, NULL);
+ if (read > 1)
+ {
+ //read the message and store it in a queue
+ std::string msg = std::string(buffer, read);
+ msgList.push(msg);
+ std::cout << "Got a message !" << std::endl;
+ }
}
-
-
bool am::SamplePlugin::dispatchData(const sh_pollHandle_t handle, void *userData)
{
- //read data from the queue
- std::cout<<"Data:"<<msgList.front()<<std::endl;
-
- //if the message was our finish message, we quit the poll loop
- if (msgList.front().compare("finish!")==0)
- {
- mSocketHandler->stop_listening();
- }
- //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;
- return false;
+ //read data from the queue
+ std::cout << "Data:" << msgList.front() << std::endl;
+
+ //if the message was our finish message, we quit the poll loop
+ if (msgList.front().compare("finish!") == 0)
+ {
+ mSocketHandler->stop_listening();
+ }
+ //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;
+ return false;
}
bool am::SamplePlugin::check(const sh_pollHandle_t handle, void *userData)
{
- //checks if there is data to dispatch
- std::cout<<"check!:"<<std::endl;
- if (msgList.size()!=0) return true;
- return false;
+ //checks if there is data to dispatch
+ std::cout << "check!:" << std::endl;
+ if (msgList.size() != 0) return true;
+ return false;
}
-
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h
index 18eff7e..faf604b 100644
--- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h
+++ b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.h
@@ -12,56 +12,58 @@
#include <queue>
#include "SocketHandler.h"
-namespace am {
+namespace am
+{
class SamplePlugin
{
public:
- enum sockType_e
- {
- UNIX,
- INET
- };
- SamplePlugin(SocketHandler *mySocketHandler,sockType_e socketType);
- virtual ~SamplePlugin() {};
- void connectSocket(const pollfd pollfd,const sh_pollHandle_t handle, void* userData);
- void receiveData(const pollfd pollfd,const sh_pollHandle_t handle, void* userData);
- bool dispatchData(const sh_pollHandle_t handle, void* userData);
- bool check(const sh_pollHandle_t handle, void* userData);
- shPollFired_T<SamplePlugin> connectFiredCB;
- shPollFired_T<SamplePlugin> receiveFiredCB;
- shPollDispatch_T<SamplePlugin> sampleDispatchCB;
- shPollCheck_T<SamplePlugin> sampleCheckCB;
+ enum sockType_e
+ {
+ UNIX, INET
+ };
+ SamplePlugin(SocketHandler *mySocketHandler, sockType_e socketType);
+ virtual ~SamplePlugin()
+ {
+ }
+ ;
+ void connectSocket(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+ void receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+ bool dispatchData(const sh_pollHandle_t handle, void* userData);
+ bool check(const sh_pollHandle_t handle, void* userData);
+ shPollFired_T<SamplePlugin> connectFiredCB;
+ shPollFired_T<SamplePlugin> receiveFiredCB;
+ shPollDispatch_T<SamplePlugin> sampleDispatchCB;
+ shPollCheck_T<SamplePlugin> sampleCheckCB;
private:
- SocketHandler *mSocketHandler;
- sh_pollHandle_t mConnecthandle,mReceiveHandle;
- std::queue<std::string> msgList;
+ SocketHandler *mSocketHandler;
+ sh_pollHandle_t mConnecthandle, mReceiveHandle;
+ std::queue<std::string> msgList;
};
-
class timerCallBack
{
public:
- timerCallBack(SocketHandler *SocketHandler);
- virtual ~timerCallBack();
- void timer1Callback(sh_timerHandle_t handle,void * userData);
- void timer2Callback(sh_timerHandle_t handle,void * userData);
- void timer3Callback(sh_timerHandle_t handle,void * userData);
- void timer4Callback(sh_timerHandle_t handle,void * userData);
- shTimerCallBack_T<timerCallBack> pTimer1Callback;
- shTimerCallBack_T<timerCallBack> pTimer2Callback;
- shTimerCallBack_T<timerCallBack> pTimer3Callback;
- shTimerCallBack_T<timerCallBack> pTimer4Callback;
- SocketHandler *mSocketHandler;
+ timerCallBack(SocketHandler *SocketHandler);
+ virtual ~timerCallBack();
+ void timer1Callback(sh_timerHandle_t handle, void * userData);
+ void timer2Callback(sh_timerHandle_t handle, void * userData);
+ void timer3Callback(sh_timerHandle_t handle, void * userData);
+ void timer4Callback(sh_timerHandle_t handle, void * userData);
+ shTimerCallBack_T<timerCallBack> pTimer1Callback;
+ shTimerCallBack_T<timerCallBack> pTimer2Callback;
+ shTimerCallBack_T<timerCallBack> pTimer3Callback;
+ shTimerCallBack_T<timerCallBack> pTimer4Callback;
+ SocketHandler *mSocketHandler;
};
class sockethandlerTest: public ::testing::Test
{
public:
- sockethandlerTest();
- virtual ~sockethandlerTest();
- void SetUp();
- void TearDown();
+ sockethandlerTest();
+ virtual ~sockethandlerTest();
+ void SetUp();
+ void TearDown();
};
} /* namespace am */
diff --git a/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h b/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h
index 48745b4..ab09bf1 100644
--- a/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h
+++ b/PluginCommandInterfaceDbus/include/CommandReceiverShadow.h
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file CommandReceiverShadow.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger DbusPlugin
+ *
+ * \file CommandReceiverShadow.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef COMMANDRECEIVERSHADOW_H_
#define COMMANDRECEIVERSHADOW_H_
@@ -34,7 +34,8 @@
#include <map>
#include "DBusMessageHandler.h"
-namespace am {
+namespace am
+{
class CommandReceiverShadow;
@@ -43,66 +44,67 @@ typedef void (CommandReceiverShadow::*CallBackMethod)(DBusConnection *connection
/**
* receives the DBus Callbacks, marhsalls and demarshalls the parameters and calls CommandReceive
*/
-class CommandReceiverShadow {
+class CommandReceiverShadow
+{
public:
- CommandReceiverShadow();
- virtual ~CommandReceiverShadow();
- void connect(DBusConnection *conn, DBusMessage *msg) ;
- void disconnect(DBusConnection *conn, DBusMessage *msg) ;
- void setVolume(DBusConnection *conn, DBusMessage *msg) ;
- void volumeStep(DBusConnection *conn, DBusMessage *msg) ;
- void setSinkMuteState(DBusConnection *conn, DBusMessage *msg) ;
- void setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg) ;
- void setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg) ;
- void setSystemProperty(DBusConnection *conn, DBusMessage *msg) ;
- void getListMainConnections(DBusConnection *conn, DBusMessage *msg) ;
- void getListMainSinks(DBusConnection *conn, DBusMessage *msg) ;
- void getListMainSources(DBusConnection *conn, DBusMessage *msg) ;
- void getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg) ;
- void getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg) ;
- void getListSourceClasses(DBusConnection *conn, DBusMessage *msg) ;
- void getListSinkClasses(DBusConnection *conn, DBusMessage *msg) ;
- void getListSystemProperties(DBusConnection *conn, DBusMessage *msg) ;
- void getTimingInformation(DBusConnection *conn, DBusMessage *msg) ;
+ CommandReceiverShadow();
+ virtual ~CommandReceiverShadow();
+ void connect(DBusConnection *conn, DBusMessage *msg);
+ void disconnect(DBusConnection *conn, DBusMessage *msg);
+ void setVolume(DBusConnection *conn, DBusMessage *msg);
+ void volumeStep(DBusConnection *conn, DBusMessage *msg);
+ void setSinkMuteState(DBusConnection *conn, DBusMessage *msg);
+ void setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg);
+ void setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg);
+ void setSystemProperty(DBusConnection *conn, DBusMessage *msg);
+ void getListMainConnections(DBusConnection *conn, DBusMessage *msg);
+ void getListMainSinks(DBusConnection *conn, DBusMessage *msg);
+ void getListMainSources(DBusConnection *conn, DBusMessage *msg);
+ void getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg);
+ void getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg);
+ void getListSourceClasses(DBusConnection *conn, DBusMessage *msg);
+ void getListSinkClasses(DBusConnection *conn, DBusMessage *msg);
+ void getListSystemProperties(DBusConnection *conn, DBusMessage *msg);
+ void getTimingInformation(DBusConnection *conn, DBusMessage *msg);
- /**
- * sets the pointer to the CommandReceiveInterface and registers Callback
- * @param receiver
- */
- void setCommandReceiver(CommandReceiveInterface*& receiver);
+ /**
+ * sets the pointer to the CommandReceiveInterface and registers Callback
+ * @param receiver
+ */
+ void setCommandReceiver(CommandReceiveInterface*& receiver);
private:
- CommandReceiveInterface* mCommandReceiveInterface;
- DBusWrapper* mDBusWrapper;
- typedef std::map<std::string,CallBackMethod> functionMap_t;
- functionMap_t mFunctionMap;
- DBusMessageHandler mDBUSMessageHandler;
+ CommandReceiveInterface* mCommandReceiveInterface;
+ DBusWrapper* mDBusWrapper;
+ typedef std::map<std::string, CallBackMethod> functionMap_t;
+ functionMap_t mFunctionMap;
+ DBusMessageHandler mDBUSMessageHandler;
- /**
- * receives a callback whenever the path of the plugin is called
- */
- static DBusHandlerResult receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
+ /**
+ * receives a callback whenever the path of the plugin is called
+ */
+ static DBusHandlerResult receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data);
- /**
- * dynamic delegate that handles the Callback of the static receiveCallback
- * @param conn DBus connection
- * @param msg DBus message
- * @param user_data pointer to instance of CommandReceiverShadow
- * @return
- */
- DBusHandlerResult receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg);
+ /**
+ * dynamic delegate that handles the Callback of the static receiveCallback
+ * @param conn DBus connection
+ * @param msg DBus message
+ * @param user_data pointer to instance of CommandReceiverShadow
+ * @return
+ */
+ DBusHandlerResult receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg);
- /**
- * sends out introspectiondata read from an xml file.
- * @param conn
- * @param msg
- */
- void sendIntrospection(DBusConnection* conn, DBusMessage* msg) ;
+ /**
+ * sends out introspectiondata read from an xml file.
+ * @param conn
+ * @param msg
+ */
+ void sendIntrospection(DBusConnection* conn, DBusMessage* msg);
- /**
- * creates the function map needed to combine DBus messages and function adresses
- * @return the map
- */
- functionMap_t createMap();
+ /**
+ * creates the function map needed to combine DBus messages and function adresses
+ * @return the map
+ */
+ functionMap_t createMap();
};
}
diff --git a/PluginCommandInterfaceDbus/include/DBusCommandSender.h b/PluginCommandInterfaceDbus/include/DBusCommandSender.h
index 4e73c66..3a01c14 100644
--- a/PluginCommandInterfaceDbus/include/DBusCommandSender.h
+++ b/PluginCommandInterfaceDbus/include/DBusCommandSender.h
@@ -1,28 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file CommandSender.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
-
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger DbusPlugin
+ *
+ * \file CommandSender.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef DBUSCOMMANDSENDER_H_
#define DBUSCOMMANDSENDER_H_
@@ -38,77 +37,79 @@
#include "DBusMessageHandler.h"
#include "CommandReceiverShadow.h"
-namespace am {
+namespace am
+{
-const char MY_NODE[]="CommandInterface";
+const char MY_NODE[] = "CommandInterface";
/**
* Dbus Implementation of CommandSendInterface
*/
-class DbusCommandSender: public CommandSendInterface {
+class DbusCommandSender: public CommandSendInterface
+{
public:
- DbusCommandSender();
- virtual ~DbusCommandSender();
- am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface) ;
- am_Error_e stopInterface() ;
- am_Error_e cbCommunicationReady() ;
- am_Error_e cbCommunicationRundown() ;
- void cbNumberOfMainConnectionsChanged() ;
- void cbNumberOfSinksChanged() ;
- void cbNumberOfSourcesChanged() ;
- void cbNumberOfSinkClassesChanged() ;
- void cbNumberOfSourceClassesChanged() ;
- void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState) ;
- void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty) ;
- void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty) ;
- void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
- void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
- void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume) ;
- void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
- void cbSystemPropertyChanged(const am_SystemProperty_s& SystemProperty) ;
- void cbTimingInformationChanged(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID) ;
- uint16_t getInterfaceVersion() const;
+ DbusCommandSender();
+ virtual ~DbusCommandSender();
+ am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface);
+ am_Error_e stopInterface();
+ am_Error_e cbCommunicationReady();
+ am_Error_e cbCommunicationRundown();
+ void cbNumberOfMainConnectionsChanged();
+ void cbNumberOfSinksChanged();
+ void cbNumberOfSourcesChanged();
+ void cbNumberOfSinkClassesChanged();
+ void cbNumberOfSourceClassesChanged();
+ void cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState);
+ void cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty);
+ void cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s& SoundProperty);
+ void cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s& availability);
+ void cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume);
+ void cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState);
+ void cbSystemPropertyChanged(const am_SystemProperty_s& SystemProperty);
+ void cbTimingInformationChanged(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID);
+ uint16_t getInterfaceVersion() const;
#ifdef UNIT_TEST
friend class DbusCommandInterfaceBackdoor;
#endif
private:
- DBusMessageHandler mDBUSMessageHandler;
- CommandReceiverShadow mCommandReceiverShadow;
- DBusWrapper* mDBusWrapper;
- CommandReceiveInterface* mCommandReceiveInterface;
+ DBusMessageHandler mDBUSMessageHandler;
+ CommandReceiverShadow mCommandReceiverShadow;
+ DBusWrapper* mDBusWrapper;
+ CommandReceiveInterface* mCommandReceiveInterface;
- /**
- * list of sinks, needed to send out only deltas
- */
- std::vector<am_SinkType_s> mlistSinks;
+ /**
+ * list of sinks, needed to send out only deltas
+ */
+ std::vector<am_SinkType_s> mlistSinks;
- /**
- * list of sources, needed to send out only deltas
- */
- std::vector<am_SourceType_s> mlistSources;
+ /**
+ * list of sources, needed to send out only deltas
+ */
+ std::vector<am_SourceType_s> mlistSources;
- /**
- * used as comparison function for am_SinkType_s
- */
- struct sortBySinkID
- {
- bool operator()(const am_SinkType_s & a, const am_SinkType_s & b)
- {
- return (a.sinkID < b.sinkID);
- }
- };
+ /**
+ * used as comparison function for am_SinkType_s
+ */
+ struct sortBySinkID
+ {
+ bool operator()(const am_SinkType_s & a, const am_SinkType_s & b)
+ {
+ return (a.sinkID < b.sinkID);
+ }
+ };
- /**
- * used as comparison function for am_SourceType_s
- */
- struct sortBySourceID
- {
- bool operator()(const am_SourceType_s & a, const am_SourceType_s & b)
- {
- return (a.sourceID < b.sourceID);
- }
- };
+ /**
+ * used as comparison function for am_SourceType_s
+ */
+ struct sortBySourceID
+ {
+ bool operator()(const am_SourceType_s & a, const am_SourceType_s & b)
+ {
+ return (a.sourceID < b.sourceID);
+ }
+ };
};
diff --git a/PluginCommandInterfaceDbus/include/DBusMessageHandler.h b/PluginCommandInterfaceDbus/include/DBusMessageHandler.h
index db80532..73989bb 100644
--- a/PluginCommandInterfaceDbus/include/DBusMessageHandler.h
+++ b/PluginCommandInterfaceDbus/include/DBusMessageHandler.h
@@ -1,32 +1,31 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file DBusMessageHandler
-*
-* \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 DbusPlugin
+ *
+ * \file DBusMessageHandler
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef _DBUSMESSAGEHANDLER_H_
#define _DBUSMESSAGEHANDLER_H_
-
#include <audiomanagertypes.h>
#include <dbus/dbus.h>
#include <dlt/dlt.h>
@@ -35,8 +34,8 @@
#include <string>
#include <list>
-namespace am{
-
+namespace am
+{
/**
* handles DBus Messages, is used to extract & append parameters and send messages
@@ -44,7 +43,7 @@ namespace am{
class DBusMessageHandler
{
public:
- DBusMessageHandler();
+ DBusMessageHandler();
~DBusMessageHandler();
/**
diff --git a/PluginCommandInterfaceDbus/include/mainpage.h b/PluginCommandInterfaceDbus/include/mainpage.h
index 19789d0..8a2848c 100644
--- a/PluginCommandInterfaceDbus/include/mainpage.h
+++ b/PluginCommandInterfaceDbus/include/mainpage.h
@@ -29,5 +29,4 @@
#ifndef MAINPAGE_H_
#define MAINPAGE_H_
-
#endif /* MAINPAGE_H_ */
diff --git a/PluginCommandInterfaceDbus/src/CommandReceiverShadow.cpp b/PluginCommandInterfaceDbus/src/CommandReceiverShadow.cpp
index 6999bc1..5336626 100644
--- a/PluginCommandInterfaceDbus/src/CommandReceiverShadow.cpp
+++ b/PluginCommandInterfaceDbus/src/CommandReceiverShadow.cpp
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file CommandReceiverShadow.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 DbusPlugin
+ *
+ * \file CommandReceiverShadow.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 <audiomanagertypes.h>
#include <string>
@@ -39,345 +39,311 @@ DLT_IMPORT_CONTEXT(DLT_CONTEXT)
*/
static DBusObjectPathVTable gObjectPathVTable;
-CommandReceiverShadow::CommandReceiverShadow()
-: mCommandReceiveInterface(NULL),
- mDBusWrapper(NULL),
- mFunctionMap(createMap()),
- mDBUSMessageHandler()
+CommandReceiverShadow::CommandReceiverShadow() :
+ mCommandReceiveInterface(NULL), //
+ mDBusWrapper(NULL), //
+ mFunctionMap(createMap()), //
+ mDBUSMessageHandler()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow constructed"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow constructed"));
}
CommandReceiverShadow::~CommandReceiverShadow()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow destructed"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow destructed"));
}
void CommandReceiverShadow::connect(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::connect called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sourceID_t sourceID=(am_sourceID_t)mDBUSMessageHandler.getUInt();
- am_sinkID_t sinkID=(am_sinkID_t)mDBUSMessageHandler.getUInt();
- am_mainConnectionID_t mainConnectionID=0;
- am_Error_e returnCode=mCommandReceiveInterface->connect(sourceID,sinkID,mainConnectionID);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append((dbus_uint16_t)mainConnectionID);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::connect called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_sourceID_t sourceID = (am_sourceID_t) mDBUSMessageHandler.getUInt();
+ am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
+ am_mainConnectionID_t mainConnectionID = 0;
+ am_Error_e returnCode = mCommandReceiveInterface->connect(sourceID, sinkID, mainConnectionID);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append((dbus_uint16_t) mainConnectionID);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::disconnect(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::disconnect called"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::disconnect called"));
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
- mDBUSMessageHandler.initReceive(msg);
- am_mainConnectionID_t mainConnnectionID=(am_mainConnectionID_t)mDBUSMessageHandler.getUInt();
- am_Error_e returnCode=mCommandReceiveInterface->disconnect(mainConnnectionID);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initReceive(msg);
+ am_mainConnectionID_t mainConnnectionID = (am_mainConnectionID_t) mDBUSMessageHandler.getUInt();
+ am_Error_e returnCode = mCommandReceiveInterface->disconnect(mainConnnectionID);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::setVolume(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setVolume called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID=(am_sinkID_t)mDBUSMessageHandler.getUInt();
- am_volume_t volume=(am_volume_t)mDBUSMessageHandler.getInt();
- am_Error_e returnCode=mCommandReceiveInterface->setVolume(sinkID,volume);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setVolume called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
+ am_volume_t volume = (am_volume_t) mDBUSMessageHandler.getInt();
+ am_Error_e returnCode = mCommandReceiveInterface->setVolume(sinkID, volume);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::volumeStep(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::volumeStep called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID=(am_sinkID_t)mDBUSMessageHandler.getUInt();
- int16_t volumeStep=(int16_t)mDBUSMessageHandler.getInt();
- am_Error_e returnCode=mCommandReceiveInterface->volumeStep(sinkID,volumeStep);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::volumeStep called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
+ int16_t volumeStep = (int16_t) mDBUSMessageHandler.getInt();
+ am_Error_e returnCode = mCommandReceiveInterface->volumeStep(sinkID, volumeStep);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::setSinkMuteState(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setSinkMuteState called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID=(am_sinkID_t)mDBUSMessageHandler.getUInt();
- am_MuteState_e muteState=(am_MuteState_e)mDBUSMessageHandler.getInt();
- am_Error_e returnCode=mCommandReceiveInterface->setSinkMuteState(sinkID,muteState);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setSinkMuteState called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
+ am_MuteState_e muteState = (am_MuteState_e) mDBUSMessageHandler.getInt();
+ am_Error_e returnCode = mCommandReceiveInterface->setSinkMuteState(sinkID, muteState);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::setMainSinkSoundProperty(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setMainSinkSoundProperty called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID=(am_sinkID_t)mDBUSMessageHandler.getUInt();
- dbus_int16_t type=0;
- dbus_int16_t value=0;
- mDBUSMessageHandler.getProperty(type,value);
- am_MainSoundProperty_s mainSoundProperty;
- mainSoundProperty.type=(am_MainSoundPropertyType_e)type;
- mainSoundProperty.value=(int32_t)value;
- am_Error_e returnCode=mCommandReceiveInterface->setMainSinkSoundProperty(mainSoundProperty,sinkID);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setMainSinkSoundProperty called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
+ dbus_int16_t type = 0;
+ dbus_int16_t value = 0;
+ mDBUSMessageHandler.getProperty(type, value);
+ am_MainSoundProperty_s mainSoundProperty;
+ mainSoundProperty.type = (am_MainSoundPropertyType_e) type;
+ mainSoundProperty.value = (int32_t) value;
+ am_Error_e returnCode = mCommandReceiveInterface->setMainSinkSoundProperty(mainSoundProperty, sinkID);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::setMainSourceSoundProperty(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setMainSourceSoundProperty called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sourceID_t sourceID=(am_sinkID_t)mDBUSMessageHandler.getUInt();
- dbus_int16_t type=0;
- dbus_int16_t value=0;
- mDBUSMessageHandler.getProperty(type,value);
- am_MainSoundProperty_s mainSoundProperty;
- mainSoundProperty.type=(am_MainSoundPropertyType_e)type;
- mainSoundProperty.value=(int32_t)value;
- am_Error_e returnCode=mCommandReceiveInterface->setMainSourceSoundProperty(mainSoundProperty,sourceID);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setMainSourceSoundProperty called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_sourceID_t sourceID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
+ dbus_int16_t type = 0;
+ dbus_int16_t value = 0;
+ mDBUSMessageHandler.getProperty(type, value);
+ am_MainSoundProperty_s mainSoundProperty;
+ mainSoundProperty.type = (am_MainSoundPropertyType_e) type;
+ mainSoundProperty.value = (int32_t) value;
+ am_Error_e returnCode = mCommandReceiveInterface->setMainSourceSoundProperty(mainSoundProperty, sourceID);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::setSystemProperty(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setSystemProperty called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- dbus_int16_t type=0;
- dbus_int16_t value=0;
- mDBUSMessageHandler.getProperty(type,value);
- am_SystemProperty_s systemProperty;
- systemProperty.type=(am_SystemPropertyType_e)type;
- systemProperty.value=(int32_t)value;
- am_Error_e returnCode=mCommandReceiveInterface->setSystemProperty(systemProperty);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::setSystemProperty called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ dbus_int16_t type = 0;
+ dbus_int16_t value = 0;
+ mDBUSMessageHandler.getProperty(type, value);
+ am_SystemProperty_s systemProperty;
+ systemProperty.type = (am_SystemPropertyType_e) type;
+ systemProperty.value = (int32_t) value;
+ am_Error_e returnCode = mCommandReceiveInterface->setSystemProperty(systemProperty);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getListMainConnections(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainConnections called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
- std::vector<am_MainConnectionType_s> listMainConnections;
- am_Error_e returnCode=mCommandReceiveInterface->getListMainConnections(listMainConnections);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append(listMainConnections);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainConnections called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+ std::vector<am_MainConnectionType_s> listMainConnections;
+ am_Error_e returnCode = mCommandReceiveInterface->getListMainConnections(listMainConnections);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append(listMainConnections);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getListMainSinks(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainSinks called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
- std::vector<am_SinkType_s> listSinks;
- am_Error_e returnCode=mCommandReceiveInterface->getListMainSinks(listSinks);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append(listSinks);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainSinks called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+ std::vector<am_SinkType_s> listSinks;
+ am_Error_e returnCode = mCommandReceiveInterface->getListMainSinks(listSinks);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append(listSinks);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getListMainSources(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainSources called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
- std::vector<am_SourceType_s> listSources;
- am_Error_e returnCode=mCommandReceiveInterface->getListMainSources(listSources);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append(listSources);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainSources called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+ std::vector<am_SourceType_s> listSources;
+ am_Error_e returnCode = mCommandReceiveInterface->getListMainSources(listSources);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append(listSources);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getListMainSinkSoundProperties(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainSinkSoundProperties called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sinkID_t sinkID=(am_sinkID_t)mDBUSMessageHandler.getUInt();
- std::vector<am_MainSoundProperty_s> listSinkSoundProperties;
- am_Error_e returnCode=mCommandReceiveInterface->getListMainSinkSoundProperties(sinkID,listSinkSoundProperties);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append(listSinkSoundProperties);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainSinkSoundProperties called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_sinkID_t sinkID = (am_sinkID_t) mDBUSMessageHandler.getUInt();
+ std::vector<am_MainSoundProperty_s> listSinkSoundProperties;
+ am_Error_e returnCode = mCommandReceiveInterface->getListMainSinkSoundProperties(sinkID, listSinkSoundProperties);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append(listSinkSoundProperties);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getListMainSourceSoundProperties(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainSourceSoundProperties called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_sourceID_t sourceID=(am_sourceID_t)mDBUSMessageHandler.getUInt();
- std::vector<am_MainSoundProperty_s> listSinkSoundProperties;
- am_Error_e returnCode=mCommandReceiveInterface->getListMainSourceSoundProperties(sourceID,listSinkSoundProperties);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append(listSinkSoundProperties);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListMainSourceSoundProperties called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_sourceID_t sourceID = (am_sourceID_t) mDBUSMessageHandler.getUInt();
+ std::vector<am_MainSoundProperty_s> listSinkSoundProperties;
+ am_Error_e returnCode = mCommandReceiveInterface->getListMainSourceSoundProperties(sourceID, listSinkSoundProperties);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append(listSinkSoundProperties);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getListSourceClasses(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListSourceClasses called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
- std::vector<am_SourceClass_s> listSourceClasses;
- am_Error_e returnCode=mCommandReceiveInterface->getListSourceClasses(listSourceClasses);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append(listSourceClasses);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListSourceClasses called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+ std::vector<am_SourceClass_s> listSourceClasses;
+ am_Error_e returnCode = mCommandReceiveInterface->getListSourceClasses(listSourceClasses);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append(listSourceClasses);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getListSinkClasses(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListSinkClasses called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
- std::vector<am_SinkClass_s> listSinkClasses;
- am_Error_e returnCode=mCommandReceiveInterface->getListSinkClasses(listSinkClasses);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append(listSinkClasses);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListSinkClasses called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+ std::vector<am_SinkClass_s> listSinkClasses;
+ am_Error_e returnCode = mCommandReceiveInterface->getListSinkClasses(listSinkClasses);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append(listSinkClasses);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getListSystemProperties(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListSystemProperties called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
- std::vector<am_SystemProperty_s> listSystemProperties;
- am_Error_e returnCode=mCommandReceiveInterface->getListSystemProperties(listSystemProperties);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append(listSystemProperties);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getListSystemProperties called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+ std::vector<am_SystemProperty_s> listSystemProperties;
+ am_Error_e returnCode = mCommandReceiveInterface->getListSystemProperties(listSystemProperties);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append(listSystemProperties);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void CommandReceiverShadow::getTimingInformation(DBusConnection *conn, DBusMessage *msg)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getTimingInformation called"));
-
- (void) conn;
- assert(mCommandReceiveInterface!=NULL);
-
- mDBUSMessageHandler.initReceive(msg);
- am_mainConnectionID_t mainConnectionID=(am_mainConnectionID_t)mDBUSMessageHandler.getUInt();
- am_timeSync_t delay=0;
- am_Error_e returnCode=mCommandReceiveInterface->getTimingInformation(mainConnectionID,delay);
- mDBUSMessageHandler.initReply(msg);
- mDBUSMessageHandler.append((dbus_int16_t)returnCode);
- mDBUSMessageHandler.append((dbus_int16_t)delay);
- mDBUSMessageHandler.sendMessage();
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("CommandReceiverShadow::getTimingInformation called"));
+
+ (void) conn;
+ assert(mCommandReceiveInterface!=NULL);
+
+ mDBUSMessageHandler.initReceive(msg);
+ am_mainConnectionID_t mainConnectionID = (am_mainConnectionID_t) mDBUSMessageHandler.getUInt();
+ am_timeSync_t delay = 0;
+ am_Error_e returnCode = mCommandReceiveInterface->getTimingInformation(mainConnectionID, delay);
+ mDBUSMessageHandler.initReply(msg);
+ mDBUSMessageHandler.append((dbus_int16_t) returnCode);
+ mDBUSMessageHandler.append((dbus_int16_t) delay);
+ mDBUSMessageHandler.sendMessage();
}
-
-
DBusHandlerResult CommandReceiverShadow::receiveCallback(DBusConnection *conn, DBusMessage *msg, void *user_data)
{
- assert(conn!=NULL);
- assert(msg!=NULL);
- assert(user_data!=NULL);
- CommandReceiverShadow* reference=(CommandReceiverShadow*) user_data;
- return (reference->receiveCallbackDelegate(conn,msg));
+ assert(conn!=NULL);
+ assert(msg!=NULL);
+ assert(user_data!=NULL);
+ CommandReceiverShadow* reference = (CommandReceiverShadow*) user_data;
+ return (reference->receiveCallbackDelegate(conn, msg));
}
void CommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessage *msg)
{
- assert(conn!=NULL);
- assert(msg!=NULL);
+ assert(conn!=NULL);
+ assert(msg!=NULL);
DBusMessage* reply;
DBusMessageIter args;
dbus_uint32_t serial = 0;
@@ -393,13 +359,13 @@ void CommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessage
dbus_message_iter_init_append(reply, &args);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &string))
{
- // DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBUS handler Out Of Memory!"));
+ // DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBUS handler Out Of Memory!"));
}
// send the reply && flush the connection
if (!dbus_connection_send(conn, reply, &serial))
{
- // DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBUS handler Out Of Memory!"));
+ // DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBUS handler Out Of Memory!"));
}
dbus_connection_flush(conn);
@@ -409,68 +375,67 @@ void CommandReceiverShadow::sendIntrospection(DBusConnection *conn, DBusMessage
DBusHandlerResult CommandReceiverShadow::receiveCallbackDelegate(DBusConnection *conn, DBusMessage *msg)
{
- //DLT_LOG(dMain, DLT_LOG_INFO, DLT_STRING("message received"));
+ //DLT_LOG(dMain, DLT_LOG_INFO, DLT_STRING("message received"));
- if (dbus_message_is_method_call(msg, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
- sendIntrospection(conn,msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
- }
+ if (dbus_message_is_method_call(msg, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
+ {
+ sendIntrospection(conn, msg);
+ return (DBUS_HANDLER_RESULT_HANDLED);
+ }
- functionMap_t::iterator iter = mFunctionMap.begin();
- std::string k(dbus_message_get_member(msg));
- iter=mFunctionMap.find(k);
+ functionMap_t::iterator iter = mFunctionMap.begin();
+ std::string k(dbus_message_get_member(msg));
+ iter = mFunctionMap.find(k);
if (iter != mFunctionMap.end())
{
- std::string p(iter->first);
- CallBackMethod cb=iter->second;
- (this->*cb)(conn,msg);
- return (DBUS_HANDLER_RESULT_HANDLED);
+ std::string p(iter->first);
+ CallBackMethod cb = iter->second;
+ (this->*cb)(conn, msg);
+ return (DBUS_HANDLER_RESULT_HANDLED);
}
- return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
+ return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
}
void CommandReceiverShadow::setCommandReceiver(CommandReceiveInterface*& receiver)
{
- assert(receiver!=NULL);
- mCommandReceiveInterface=receiver;
+ assert(receiver!=NULL);
+ mCommandReceiveInterface = receiver;
- gObjectPathVTable.message_function=CommandReceiverShadow::receiveCallback;
+ gObjectPathVTable.message_function = CommandReceiverShadow::receiveCallback;
- DBusConnection* connection;
- mCommandReceiveInterface->getDBusConnectionWrapper(mDBusWrapper);
- assert(mDBusWrapper!=NULL);
+ DBusConnection* connection;
+ mCommandReceiveInterface->getDBusConnectionWrapper(mDBusWrapper);
+ assert(mDBusWrapper!=NULL);
- mDBusWrapper->getDBusConnection(connection);
- assert(connection!=NULL);
- mDBUSMessageHandler.setDBusConnection(connection);
+ mDBusWrapper->getDBusConnection(connection);
+ assert(connection!=NULL);
+ mDBUSMessageHandler.setDBusConnection(connection);
- std::string path(MY_NODE);
- mDBusWrapper->registerCallback(&gObjectPathVTable,path,this);
+ std::string path(MY_NODE);
+ mDBusWrapper->registerCallback(&gObjectPathVTable, path, this);
}
CommandReceiverShadow::functionMap_t CommandReceiverShadow::createMap()
{
- functionMap_t m;
- m["Connect"]=&CommandReceiverShadow::connect ;
- m["Disconnect"]=&CommandReceiverShadow::disconnect ;
- m["SetVolume"]=&CommandReceiverShadow::setVolume ;
- m["VolumeStep"]=&CommandReceiverShadow::volumeStep ;
- m["SetSinkMuteState"]=&CommandReceiverShadow::setSinkMuteState ;
- m["SetMainSinkSoundProperty"]=&CommandReceiverShadow::setMainSinkSoundProperty ;
- m["SetMainSourceSoundProperty"]=&CommandReceiverShadow::setMainSourceSoundProperty ;
- m["GetListMainConnections"]=&CommandReceiverShadow::getListMainConnections ;
- m["GetListMainSinks"]=&CommandReceiverShadow::getListMainSinks ;
- m["GetListMainSources"]=&CommandReceiverShadow::getListMainSources ;
- m["GetListMainSinkSoundProperties"]=&CommandReceiverShadow::getListMainSinkSoundProperties ;
- m["GetListMainSourceSoundProperties"]=&CommandReceiverShadow::getListMainSourceSoundProperties ;
- m["GetListSourceClasses"]=&CommandReceiverShadow::getListSourceClasses ;
- m["GetListSinkClasses"]=&CommandReceiverShadow::getListSinkClasses ;
- m["GetListSystemProperties"]=&CommandReceiverShadow::getListSystemProperties ;
- m["GetTimingInformation"]=&CommandReceiverShadow::getTimingInformation ;
- m["SetSystemProperty"]=&CommandReceiverShadow::setSystemProperty ;
- return (m);
+ functionMap_t m;
+ m["Connect"] = &CommandReceiverShadow::connect;
+ m["Disconnect"] = &CommandReceiverShadow::disconnect;
+ m["SetVolume"] = &CommandReceiverShadow::setVolume;
+ m["VolumeStep"] = &CommandReceiverShadow::volumeStep;
+ m["SetSinkMuteState"] = &CommandReceiverShadow::setSinkMuteState;
+ m["SetMainSinkSoundProperty"] = &CommandReceiverShadow::setMainSinkSoundProperty;
+ m["SetMainSourceSoundProperty"] = &CommandReceiverShadow::setMainSourceSoundProperty;
+ m["GetListMainConnections"] = &CommandReceiverShadow::getListMainConnections;
+ m["GetListMainSinks"] = &CommandReceiverShadow::getListMainSinks;
+ m["GetListMainSources"] = &CommandReceiverShadow::getListMainSources;
+ m["GetListMainSinkSoundProperties"] = &CommandReceiverShadow::getListMainSinkSoundProperties;
+ m["GetListMainSourceSoundProperties"] = &CommandReceiverShadow::getListMainSourceSoundProperties;
+ m["GetListSourceClasses"] = &CommandReceiverShadow::getListSourceClasses;
+ m["GetListSinkClasses"] = &CommandReceiverShadow::getListSinkClasses;
+ m["GetListSystemProperties"] = &CommandReceiverShadow::getListSystemProperties;
+ m["GetTimingInformation"] = &CommandReceiverShadow::getTimingInformation;
+ m["SetSystemProperty"] = &CommandReceiverShadow::setSystemProperty;
+ return (m);
}
-
-
diff --git a/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp b/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp
index 1387779..bbc2778 100644
--- a/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp
+++ b/PluginCommandInterfaceDbus/src/DBusCommandSender.cpp
@@ -1,28 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file CommandSender.cpp
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
-
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger DbusPlugin
+ *
+ * \file CommandSender.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#include <command/CommandReceiveInterface.h>
#include <dbus/DBusWrapper.h>
@@ -44,7 +43,7 @@ DLT_DECLARE_CONTEXT(DLT_CONTEXT)
*/
extern "C" CommandSendInterface* PluginCommandInterfaceDbusFactory()
{
- return (new DbusCommandSender());
+ return (new DbusCommandSender());
}
/**
@@ -55,282 +54,233 @@ extern "C" void destroyRoutingPluginInterfaceDbus(CommandSendInterface* commandS
delete commandSendInterface;
}
-
-DbusCommandSender::DbusCommandSender()
-: mDBUSMessageHandler(),
- mCommandReceiverShadow(),
- mDBusWrapper(NULL),
- mCommandReceiveInterface(NULL)
+DbusCommandSender::DbusCommandSender() :
+ mDBUSMessageHandler(), //
+ mCommandReceiverShadow(), //
+ mDBusWrapper(NULL), //
+ mCommandReceiveInterface(NULL)
{
- DLT_REGISTER_CONTEXT(DLT_CONTEXT,"DBP","DBus Plugin");
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DbusCommandSender constructed"));
+ DLT_REGISTER_CONTEXT(DLT_CONTEXT, "DBP", "DBus Plugin");
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("DbusCommandSender constructed"));
}
DbusCommandSender::~DbusCommandSender()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DbusCommandSender destructed"));
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("DbusCommandSender destructed"));
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
am_Error_e DbusCommandSender::startupInterface(CommandReceiveInterface* commandreceiveinterface)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("startupInterface called"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("startupInterface called"));
- mCommandReceiveInterface=commandreceiveinterface;
- mCommandReceiverShadow.setCommandReceiver(mCommandReceiveInterface);
- mCommandReceiveInterface->getDBusConnectionWrapper(mDBusWrapper);
- assert(mDBusWrapper!=NULL);
- return (E_OK);
+ mCommandReceiveInterface = commandreceiveinterface;
+ mCommandReceiverShadow.setCommandReceiver(mCommandReceiveInterface);
+ mCommandReceiveInterface->getDBusConnectionWrapper(mDBusWrapper);
+ assert(mDBusWrapper!=NULL);
+ return (E_OK);
}
-
-
am_Error_e DbusCommandSender::stopInterface()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("stopInterface called"));
- /**
- * todo: finish DbusCommandSender::stopInterface(), what needs to be done?
- */
- return(E_OK);
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("stopInterface called"));
+ /**
+ * todo: finish DbusCommandSender::stopInterface(), what needs to be done?
+ */
+ return (E_OK);
}
-
-
am_Error_e DbusCommandSender::cbCommunicationReady()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbCommunicationReady called"));
- /**
- * todo: implement DbusCommandSender::cbCommunicationReady()
- */
- return E_NOT_USED;
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbCommunicationReady called"));
+ /**
+ * todo: implement DbusCommandSender::cbCommunicationReady()
+ */
+ return E_NOT_USED;
}
-
-
am_Error_e DbusCommandSender::cbCommunicationRundown()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbCommunicationRundown called"));
- /**
- * todo: implement DbusCommandSender::cbCommunicationRundown()
- */
- return E_NOT_USED;
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbCommunicationRundown called"));
+ /**
+ * todo: implement DbusCommandSender::cbCommunicationRundown()
+ */
+ return E_NOT_USED;
}
-
-
void DbusCommandSender::cbNumberOfMainConnectionsChanged()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbNumberOfMainConnectionsChanged called"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbNumberOfMainConnectionsChanged called"));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("NumberOfMainConnectionsChanged"));
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfMainConnectionsChanged"));
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbNumberOfSinksChanged()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbNumberOfSinksChanged called"));
-
- std::vector<am_SinkType_s> newListSinks;
- std::vector<am_SinkType_s> diffList;
- mCommandReceiveInterface->getListMainSinks(newListSinks);
- std::sort(newListSinks.begin(),newListSinks.end(),sortBySinkID());
- std::set_symmetric_difference(newListSinks.begin(),newListSinks.end(),mlistSinks.begin(),mlistSinks.end(),std::back_inserter(diffList), sortBySinkID());
- assert(diffList.size()==1);
- if (newListSinks.size()>mlistSinks.size())
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),"SinkAdded");
- mDBUSMessageHandler.append(diffList[0]);
-
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("send signal SinkAdded"));
- }
- else
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),"SinkRemoved");
- mDBUSMessageHandler.append(diffList.begin()->sinkID);
-
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("send signal SinkRemoved"));
- }
-
- mDBUSMessageHandler.sendMessage();
- mlistSinks=newListSinks;
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbNumberOfSinksChanged called"));
+
+ std::vector<am_SinkType_s> newListSinks;
+ std::vector<am_SinkType_s> diffList;
+ mCommandReceiveInterface->getListMainSinks(newListSinks);
+ std::sort(newListSinks.begin(), newListSinks.end(), sortBySinkID());
+ std::set_symmetric_difference(newListSinks.begin(), newListSinks.end(), mlistSinks.begin(), mlistSinks.end(), std::back_inserter(diffList), sortBySinkID());
+ assert(diffList.size()==1);
+ if (newListSinks.size() > mlistSinks.size())
+ {
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), "SinkAdded");
+ mDBUSMessageHandler.append(diffList[0]);
+
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("send signal SinkAdded"));
+ }
+ else
+ {
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), "SinkRemoved");
+ mDBUSMessageHandler.append(diffList.begin()->sinkID);
+
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("send signal SinkRemoved"));
+ }
+
+ mDBUSMessageHandler.sendMessage();
+ mlistSinks = newListSinks;
}
-
-
void DbusCommandSender::cbNumberOfSourcesChanged()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbNumberOfSourcesChanged called"));
-
- std::vector<am_SourceType_s> newlistSources;
- std::vector<am_SourceType_s> diffList;
- mCommandReceiveInterface->getListMainSources(newlistSources);
- std::sort(newlistSources.begin(),newlistSources.end(),sortBySourceID());
- std::set_symmetric_difference(newlistSources.begin(),newlistSources.end(),mlistSources.begin(),mlistSources.end(),std::back_inserter(diffList), sortBySourceID());
- assert(diffList.size()==1);
- if (newlistSources.size()>mlistSources.size())
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),"SourceAdded");
- mDBUSMessageHandler.append(diffList[0]);
-
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("send signal SourceAdded"));
- }
- else
- {
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),"SourceRemoved");
- mDBUSMessageHandler.append((dbus_uint16_t)diffList.begin()->sourceID);
-
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("send signal SourceRemoved"));
- }
-
- mDBUSMessageHandler.sendMessage();
- mlistSources=newlistSources;
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbNumberOfSourcesChanged called"));
+
+ std::vector<am_SourceType_s> newlistSources;
+ std::vector<am_SourceType_s> diffList;
+ mCommandReceiveInterface->getListMainSources(newlistSources);
+ std::sort(newlistSources.begin(), newlistSources.end(), sortBySourceID());
+ std::set_symmetric_difference(newlistSources.begin(), newlistSources.end(), mlistSources.begin(), mlistSources.end(), std::back_inserter(diffList), sortBySourceID());
+ assert(diffList.size()==1);
+ if (newlistSources.size() > mlistSources.size())
+ {
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), "SourceAdded");
+ mDBUSMessageHandler.append(diffList[0]);
+
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("send signal SourceAdded"));
+ }
+ else
+ {
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), "SourceRemoved");
+ mDBUSMessageHandler.append((dbus_uint16_t) diffList.begin()->sourceID);
+
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("send signal SourceRemoved"));
+ }
+
+ mDBUSMessageHandler.sendMessage();
+ mlistSources = newlistSources;
}
-
void DbusCommandSender::cbNumberOfSinkClassesChanged()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbNumberOfSinkClassesChanged called"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbNumberOfSinkClassesChanged called"));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("NumberOfSinkClassesChanged"));
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfSinkClassesChanged"));
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbNumberOfSourceClassesChanged()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbNumberOfSourceClassesChanged called"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbNumberOfSourceClassesChanged called"));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("NumberOfSourceClassesChanged"));
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("NumberOfSourceClassesChanged"));
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbMainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbMainConnectionStateChanged called, connectionID"),DLT_INT16(connectionID),DLT_STRING("connectionState"),DLT_INT16(connectionState));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbMainConnectionStateChanged called, connectionID"), DLT_INT16(connectionID), DLT_STRING("connectionState"), DLT_INT16(connectionState));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("MainConnectionStateChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t)connectionID);
- mDBUSMessageHandler.append((dbus_int16_t)connectionState);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("MainConnectionStateChanged"));
+ mDBUSMessageHandler.append((dbus_uint16_t) connectionID);
+ mDBUSMessageHandler.append((dbus_int16_t) connectionState);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbMainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbMainSinkSoundPropertyChanged called, sinkID"),DLT_INT16(sinkID),DLT_STRING("SoundProperty.type"),DLT_INT16(SoundProperty.type),DLT_STRING("SoundProperty.value"),DLT_INT16(SoundProperty.value));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbMainSinkSoundPropertyChanged called, sinkID"), DLT_INT16(sinkID), DLT_STRING("SoundProperty.type"), DLT_INT16(SoundProperty.type), DLT_STRING("SoundProperty.value"), DLT_INT16(SoundProperty.value));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("MainSinkSoundPropertyChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t)sinkID);
- mDBUSMessageHandler.append(SoundProperty);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("MainSinkSoundPropertyChanged"));
+ mDBUSMessageHandler.append((dbus_uint16_t) sinkID);
+ mDBUSMessageHandler.append(SoundProperty);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbMainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbMainSourceSoundPropertyChanged called, sourceID"),DLT_INT16(sourceID),DLT_STRING("SoundProperty.type"),DLT_INT16(SoundProperty.type),DLT_STRING("SoundProperty.value"),DLT_INT16(SoundProperty.value));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbMainSourceSoundPropertyChanged called, sourceID"), DLT_INT16(sourceID), DLT_STRING("SoundProperty.type"), DLT_INT16(SoundProperty.type), DLT_STRING("SoundProperty.value"), DLT_INT16(SoundProperty.value));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("MainSourceSoundPropertyChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t)sourceID);
- mDBUSMessageHandler.append(SoundProperty);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("MainSourceSoundPropertyChanged"));
+ mDBUSMessageHandler.append((dbus_uint16_t) sourceID);
+ mDBUSMessageHandler.append(SoundProperty);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbSinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbSinkAvailabilityChanged called, sinkID"),DLT_INT16(sinkID),DLT_STRING("availability.availability"),DLT_INT16(availability.availability),DLT_STRING("SoundProperty.reason"),DLT_INT16(availability.availabilityReason));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbSinkAvailabilityChanged called, sinkID"), DLT_INT16(sinkID), DLT_STRING("availability.availability"), DLT_INT16(availability.availability), DLT_STRING("SoundProperty.reason"), DLT_INT16(availability.availabilityReason));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("SinkAvailabilityChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t)sinkID);
- mDBUSMessageHandler.append(availability);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkAvailabilityChanged"));
+ mDBUSMessageHandler.append((dbus_uint16_t) sinkID);
+ mDBUSMessageHandler.append(availability);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbSourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbSourceAvailabilityChanged called, sourceID"),DLT_INT16(sourceID),DLT_STRING("availability.availability"),DLT_INT16(availability.availability),DLT_STRING("SoundProperty.reason"),DLT_INT16(availability.availabilityReason));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbSourceAvailabilityChanged called, sourceID"), DLT_INT16(sourceID), DLT_STRING("availability.availability"), DLT_INT16(availability.availability), DLT_STRING("SoundProperty.reason"), DLT_INT16(availability.availabilityReason));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("SourceAvailabilityChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t)sourceID);
- mDBUSMessageHandler.append(availability);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("SourceAvailabilityChanged"));
+ mDBUSMessageHandler.append((dbus_uint16_t) sourceID);
+ mDBUSMessageHandler.append(availability);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbVolumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbVolumeChanged called, sinkID"),DLT_INT16(sinkID),DLT_STRING("volume"),DLT_INT16(volume));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbVolumeChanged called, sinkID"), DLT_INT16(sinkID), DLT_STRING("volume"), DLT_INT16(volume));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("VolumeChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t)sinkID);
- mDBUSMessageHandler.append((dbus_int16_t)volume);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("VolumeChanged"));
+ mDBUSMessageHandler.append((dbus_uint16_t) sinkID);
+ mDBUSMessageHandler.append((dbus_int16_t) volume);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbSinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbSinkMuteStateChanged called, sinkID"),DLT_INT16(sinkID),DLT_STRING("muteState"),DLT_INT16(muteState));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbSinkMuteStateChanged called, sinkID"), DLT_INT16(sinkID), DLT_STRING("muteState"), DLT_INT16(muteState));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("SinkMuteStateChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t)sinkID);
- mDBUSMessageHandler.append((dbus_int16_t)muteState);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("SinkMuteStateChanged"));
+ mDBUSMessageHandler.append((dbus_uint16_t) sinkID);
+ mDBUSMessageHandler.append((dbus_int16_t) muteState);
+ mDBUSMessageHandler.sendMessage();
}
-
-
void DbusCommandSender::cbSystemPropertyChanged(const am_SystemProperty_s & SystemProperty)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbSystemPropertyChanged called, SystemProperty.type"),DLT_INT16(SystemProperty.type),DLT_STRING("SystemProperty.value"),DLT_INT16(SystemProperty.value));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbSystemPropertyChanged called, SystemProperty.type"), DLT_INT16(SystemProperty.type), DLT_STRING("SystemProperty.value"), DLT_INT16(SystemProperty.value));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("SystemPropertyChanged"));
- mDBUSMessageHandler.append(SystemProperty);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("SystemPropertyChanged"));
+ mDBUSMessageHandler.append(SystemProperty);
+ mDBUSMessageHandler.sendMessage();
}
void am::DbusCommandSender::cbTimingInformationChanged(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("cbTimingInformationChanged called, mainConnectionID"),DLT_INT16(mainConnectionID),DLT_STRING("time"),DLT_INT16(time));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("cbTimingInformationChanged called, mainConnectionID"), DLT_INT16(mainConnectionID), DLT_STRING("time"), DLT_INT16(time));
- mDBUSMessageHandler.initSignal(std::string(MY_NODE),std::string("TimingInformationChanged"));
- mDBUSMessageHandler.append((dbus_uint16_t)mainConnectionID);
- mDBUSMessageHandler.append((dbus_int16_t)time);
- mDBUSMessageHandler.sendMessage();
+ mDBUSMessageHandler.initSignal(std::string(MY_NODE), std::string("TimingInformationChanged"));
+ mDBUSMessageHandler.append((dbus_uint16_t) mainConnectionID);
+ mDBUSMessageHandler.append((dbus_int16_t) time);
+ mDBUSMessageHandler.sendMessage();
}
-
-
uint16_t DbusCommandSender::getInterfaceVersion() const
{
- return (CommandSendVersion);
+ return (CommandSendVersion);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp b/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp
index adc157f..d6f2ee1 100644
--- a/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp
+++ b/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file DBusMessageHandler.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 DbusPlugin
+ *
+ * \file DBusMessageHandler.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 <config.h>
#include "DBusMessageHandler.h"
#include "DBusCommandSender.h"
@@ -34,79 +34,81 @@ using namespace am;
DLT_IMPORT_CONTEXT(DLT_CONTEXT)
-DBusMessageHandler::DBusMessageHandler()
-: mDBusMessageIter(),
- mDBusError(),
- mSerial(0),
- mErrorName(""),
- mErrorMsg(""),
- mDbusMessage(NULL),
- mReveiveMessage(NULL),
- mDBusConnection(NULL)
+DBusMessageHandler::DBusMessageHandler() :
+ mDBusMessageIter(), //
+ mDBusError(), //
+ mSerial(0), //
+ mErrorName(""), //
+ mErrorMsg(""), //
+ mDbusMessage(NULL), //
+ mReveiveMessage(NULL), //
+ mDBusConnection(NULL)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBUSMessageHandler constructed"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("DBUSMessageHandler constructed"));
}
DBusMessageHandler::~DBusMessageHandler()
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("DBUSMessageHandler destructed"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("DBUSMessageHandler destructed"));
}
void DBusMessageHandler::initReceive(DBusMessage* msg)
{
- assert(msg!=NULL);
- mReveiveMessage=msg;
+ assert(msg!=NULL);
+ mReveiveMessage = msg;
if (!dbus_message_iter_init(msg, &mDBusMessageIter))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::initReceive DBus Message has no arguments!"));
- mErrorName=std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg="DBUS Message has no arguments!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::initReceive DBus Message has no arguments!"));
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBUS Message has no arguments!";
}
}
void DBusMessageHandler::initReply(DBusMessage* msg)
{
- assert(msg!=NULL);
+ assert(msg!=NULL);
mDbusMessage = dbus_message_new_method_return(msg);
- if (mDbusMessage==NULL) {
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::initReply Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ if (mDbusMessage == NULL)
+ {
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::initReply Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
dbus_message_iter_init_append(mDbusMessage, &mDBusMessageIter);
}
void DBusMessageHandler::initSignal(std::string path, std::string signalName)
{
- assert(!path.empty());
- assert(!signalName.empty());
- std::string completePath=std::string(DBUS_SERVICE_OBJECT_PATH)+"/"+path;
- mDbusMessage=dbus_message_new_signal(completePath.c_str(),DBUS_SERVICE_PREFIX,signalName.c_str());
-
- if (mDbusMessage == NULL)
- {
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::initSignal Cannot allocate DBus message!"));
- }
+ assert(!path.empty());
+ assert(!signalName.empty());
+ std::string completePath = std::string(DBUS_SERVICE_OBJECT_PATH) + "/" + path;
+ mDbusMessage = dbus_message_new_signal(completePath.c_str(), DBUS_SERVICE_PREFIX, signalName.c_str());
+
+ if (mDbusMessage == NULL)
+ {
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::initSignal Cannot allocate DBus message!"));
+ }
dbus_message_iter_init_append(mDbusMessage, &mDBusMessageIter);
}
void DBusMessageHandler::sendMessage()
{
- assert(mDBusConnection!=NULL);
- if(mReveiveMessage!=0)
- {
- mSerial=dbus_message_get_serial(mReveiveMessage);
- }
- else
- {
- mSerial=1;
- }
- if (!mErrorName.empty()) {
- mDbusMessage = dbus_message_new_error(mReveiveMessage, mErrorName.c_str(), mErrorMsg.c_str());
- }
+ assert(mDBusConnection!=NULL);
+ if (mReveiveMessage != 0)
+ {
+ mSerial = dbus_message_get_serial(mReveiveMessage);
+ }
+ else
+ {
+ mSerial = 1;
+ }
+ if (!mErrorName.empty())
+ {
+ mDbusMessage = dbus_message_new_error(mReveiveMessage, mErrorName.c_str(), mErrorMsg.c_str());
+ }
if (!dbus_connection_send(mDBusConnection, mDbusMessage, &mSerial))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::sendMessage cannot send message!"));
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::sendMessage cannot send message!"));
}
dbus_connection_flush(mDBusConnection);
dbus_message_unref(mDbusMessage);
@@ -115,13 +117,13 @@ void DBusMessageHandler::sendMessage()
char* DBusMessageHandler::getString()
{
- char* param=NULL;
+ char* param = NULL;
if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&mDBusMessageIter))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getString DBUS handler argument is no String!"));
- mErrorName=std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg="DBus argument is no string";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getString DBUS handler argument is no String!"));
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBus argument is no string";
}
else
{
@@ -133,13 +135,13 @@ char* DBusMessageHandler::getString()
dbus_bool_t DBusMessageHandler::getBool()
{
- dbus_bool_t boolparam=false;
+ dbus_bool_t boolparam = false;
if (DBUS_TYPE_BOOLEAN != dbus_message_iter_get_arg_type(&mDBusMessageIter))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getBool DBUS handler argument is no bool!"));
- mErrorName=std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg="DBus argument is no bool";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getBool DBUS handler argument is no bool!"));
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBus argument is no bool";
}
else
{
@@ -155,9 +157,9 @@ char DBusMessageHandler::getByte()
if (DBUS_TYPE_BYTE != dbus_message_iter_get_arg_type(&mDBusMessageIter))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getByte DBUS handler argument is no byte!"));
- mErrorName=std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg="DBus argument is no byte";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getByte DBUS handler argument is no byte!"));
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBus argument is no byte";
}
else
{
@@ -177,9 +179,9 @@ dbus_uint16_t DBusMessageHandler::getUInt()
if (DBUS_TYPE_UINT16 != dbus_message_iter_get_arg_type(&mDBusMessageIter))
#endif
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getUInt DBUS handler argument is no uint16_t!"));
- mErrorName=std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg="DBus argument is no uint16_t";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getUInt DBUS handler argument is no uint16_t!"));
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBus argument is no uint16_t";
}
else
{
@@ -199,9 +201,9 @@ dbus_int16_t DBusMessageHandler::getInt()
if (DBUS_TYPE_INT16 != dbus_message_iter_get_arg_type(&mDBusMessageIter))
#endif
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getInt DBUS handler argument is no int16_t!"));
- mErrorName=std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg="DBus argument is no int16_t";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getInt DBUS handler argument is no int16_t!"));
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBus argument is no int16_t";
}
else
{
@@ -216,9 +218,9 @@ double DBusMessageHandler::getDouble()
double param;
if (DBUS_TYPE_DOUBLE != dbus_message_iter_get_arg_type(&mDBusMessageIter))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getDouble DBUS handler argument is no double!"));
- mErrorName=std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg="DBus argument is no double";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getDouble DBUS handler argument is no double!"));
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBus argument is no double";
}
else
{
@@ -230,12 +232,12 @@ double DBusMessageHandler::getDouble()
void DBusMessageHandler::getProperty(dbus_int16_t & type, dbus_int16_t & value)
{
- DBusMessageIter arrayIter;
+ DBusMessageIter arrayIter;
if (DBUS_TYPE_STRUCT != dbus_message_iter_get_arg_type(&mDBusMessageIter))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getProperty DBUS handler argument is no array!"));
- mErrorName=std::string(DBUS_ERROR_INVALID_ARGS);
- mErrorMsg="DBus argument is no array";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::getProperty DBUS handler argument is no array!"));
+ mErrorName = std::string(DBUS_ERROR_INVALID_ARGS);
+ mErrorMsg = "DBus argument is no array";
}
else
{
@@ -249,23 +251,22 @@ void DBusMessageHandler::getProperty(dbus_int16_t & type, dbus_int16_t & value)
void DBusMessageHandler::append(bool toAppend)
{
- dbus_bool_t mybool=toAppend;
+ dbus_bool_t mybool = toAppend;
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_BOOLEAN, &mybool))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
-
void DBusMessageHandler::append(double toAppend)
{
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_DOUBLE, &toAppend))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -273,20 +274,19 @@ void DBusMessageHandler::append(char toAppend)
{
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_BYTE, &toAppend))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
-
void DBusMessageHandler::append(dbus_int16_t toAppend)
{
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_INT16, &toAppend))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -294,42 +294,42 @@ void DBusMessageHandler::append(dbus_uint16_t toAppend)
{
if (!dbus_message_iter_append_basic(&mDBusMessageIter, DBUS_TYPE_UINT16, &toAppend))
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
void DBusMessageHandler::setDBusConnection(DBusConnection *& connection)
{
- assert(connection!=NULL);
- mDBusConnection=connection;
+ assert(connection!=NULL);
+ mDBusConnection = connection;
}
void DBusMessageHandler::append(const am::am_SinkType_s& sinkType)
{
DBusMessageIter structIter;
DBusMessageIter structAvailIter;
- dbus_bool_t success=true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sinkType.sinkID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &sinkType.name);
+ dbus_bool_t success = true;
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sinkType.sinkID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &sinkType.name);
- success=success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &structAvailIter);
- success=success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sinkType.availability.availability);
- success=success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sinkType.availability.availabilityReason);
- success=success && dbus_message_iter_close_container(&structIter, &structAvailIter);
+ success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &structAvailIter);
+ success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sinkType.availability.availability);
+ success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sinkType.availability.availabilityReason);
+ success = success && dbus_message_iter_close_container(&structIter, &structAvailIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &sinkType.volume);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &sinkType.muteState);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sinkType.sinkClassID);
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &sinkType.volume);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &sinkType.muteState);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sinkType.sinkClassID);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -337,75 +337,75 @@ void DBusMessageHandler::append(const am::am_SourceType_s & sourceType)
{
DBusMessageIter structIter;
DBusMessageIter structAvailIter;
- dbus_bool_t success=true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sourceType.sourceID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &sourceType.name);
+ dbus_bool_t success = true;
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sourceType.sourceID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &sourceType.name);
- success=success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &structAvailIter);
- success=success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sourceType.availability.availability);
- success=success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sourceType.availability.availabilityReason);
- success=success && dbus_message_iter_close_container(&structIter, &structAvailIter);
+ success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &structAvailIter);
+ success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sourceType.availability.availability);
+ success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &sourceType.availability.availabilityReason);
+ success = success && dbus_message_iter_close_container(&structIter, &structAvailIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sourceType.sourceClassID);
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &sourceType.sourceClassID);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
void DBusMessageHandler::append(const am::am_MainSoundProperty_s mainSoundProperty)
{
- DBusMessageIter structIter;
- dbus_bool_t success=true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &mainSoundProperty.type);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &mainSoundProperty.value);
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
+ DBusMessageIter structIter;
+ dbus_bool_t success = true;
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &mainSoundProperty.type);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &mainSoundProperty.value);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
void DBusMessageHandler::append(const am::am_Availability_s & availability)
{
DBusMessageIter structAvailIter;
- dbus_bool_t success=true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT,NULL, &structAvailIter);
- success=success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &availability.availability);
- success=success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &availability.availabilityReason);
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &structAvailIter);
+ dbus_bool_t success = true;
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structAvailIter);
+ success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &availability.availability);
+ success = success && dbus_message_iter_append_basic(&structAvailIter, DBUS_TYPE_INT16, &availability.availabilityReason);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structAvailIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
void DBusMessageHandler::append(const am::am_SystemProperty_s & SystemProperty)
{
DBusMessageIter structIter;
- dbus_bool_t success=true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &SystemProperty.type);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &SystemProperty.value);
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
+ dbus_bool_t success = true;
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &SystemProperty.type);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &SystemProperty.value);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &structIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -413,27 +413,27 @@ void DBusMessageHandler::append(const std::vector<am::am_MainConnectionType_s>&
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
- std::vector<am::am_MainConnectionType_s>::const_iterator listIterator=listMainConnections.begin();
- dbus_bool_t success=true;
+ std::vector<am::am_MainConnectionType_s>::const_iterator listIterator = listMainConnections.begin();
+ dbus_bool_t success = true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qqqnn)", &arrayIter);
- for(;listIterator<listMainConnections.end();++listIterator)
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qqqnn)", &arrayIter);
+ for (; listIterator < listMainConnections.end(); ++listIterator)
{
- success=success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->mainConnectionID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->delay);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->connectionState);
- success=success && dbus_message_iter_close_container(&arrayIter, &structIter);
+ success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->mainConnectionID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->delay);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->connectionState);
+ success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
}
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -442,64 +442,62 @@ void DBusMessageHandler::append(const std::vector<am::am_SinkType_s> & listMainS
DBusMessageIter arrayIter;
DBusMessageIter structIter;
DBusMessageIter availIter;
- std::vector<am::am_SinkType_s>::const_iterator listIterator=listMainSinks.begin();
- dbus_bool_t success=true;
-
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qs(nn)nnq)", &arrayIter);
- for(;listIterator<listMainSinks.end();++listIterator)
- {
- success=success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
- success=success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &availIter);
- success=success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availability);
- success=success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availabilityReason);
- success=success && dbus_message_iter_close_container(&structIter, &availIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->volume);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->muteState);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkClassID);
- success=success && dbus_message_iter_close_container(&arrayIter, &structIter);
- }
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
+ std::vector<am::am_SinkType_s>::const_iterator listIterator = listMainSinks.begin();
+ dbus_bool_t success = true;
+
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qs(nn)nnq)", &arrayIter);
+ for (; listIterator < listMainSinks.end(); ++listIterator)
+ {
+ success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
+ success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &availIter);
+ success = success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availability);
+ success = success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availabilityReason);
+ success = success && dbus_message_iter_close_container(&structIter, &availIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->volume);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->muteState);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkClassID);
+ success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
+ }
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
-
-
void DBusMessageHandler::append(const std::vector<am::am_SourceType_s> & listMainSources)
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
DBusMessageIter availIter;
- std::vector<am::am_SourceType_s>::const_iterator listIterator=listMainSources.begin();
- dbus_bool_t success=true;
+ std::vector<am::am_SourceType_s>::const_iterator listIterator = listMainSources.begin();
+ dbus_bool_t success = true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qs(nn)q)", &arrayIter);
- for(;listIterator<listMainSources.end();++listIterator)
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qs(nn)q)", &arrayIter);
+ for (; listIterator < listMainSources.end(); ++listIterator)
{
- success=success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
- success=success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &availIter);
- success=success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availability);
- success=success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availabilityReason);
- success=success && dbus_message_iter_close_container(&structIter, &availIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceClassID);
- success=success && dbus_message_iter_close_container(&arrayIter, &structIter);
+ success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
+ success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_STRUCT, NULL, &availIter);
+ success = success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availability);
+ success = success && dbus_message_iter_append_basic(&availIter, DBUS_TYPE_INT16, &listIterator->availability.availabilityReason);
+ success = success && dbus_message_iter_close_container(&structIter, &availIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceClassID);
+ success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
}
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -507,24 +505,24 @@ void DBusMessageHandler::append(const std::vector<am::am_MainSoundProperty_s> &
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
- std::vector<am::am_MainSoundProperty_s>::const_iterator listIterator=listMainSoundProperties.begin();
- dbus_bool_t success=true;
+ std::vector<am::am_MainSoundProperty_s>::const_iterator listIterator = listMainSoundProperties.begin();
+ dbus_bool_t success = true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(nn)", &arrayIter);
- for(;listIterator<listMainSoundProperties.end();++listIterator)
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(nn)", &arrayIter);
+ for (; listIterator < listMainSoundProperties.end(); ++listIterator)
{
- success=success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->type);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->value);
- success=success && dbus_message_iter_close_container(&arrayIter, &structIter);
+ success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->type);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->value);
+ success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
}
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -534,35 +532,35 @@ void DBusMessageHandler::append(const std::vector<am::am_SourceClass_s> & listSo
DBusMessageIter structIter;
DBusMessageIter propIter;
DBusMessageIter innerIter;
- std::vector<am::am_SourceClass_s>::const_iterator listIterator=listSourceClasses.begin();
- dbus_bool_t success=true;
+ std::vector<am::am_SourceClass_s>::const_iterator listIterator = listSourceClasses.begin();
+ dbus_bool_t success = true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qsa(nn))", &arrayIter);
- for(;listIterator<listSourceClasses.end();++listIterator)
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qsa(nn))", &arrayIter);
+ for (; listIterator < listSourceClasses.end(); ++listIterator)
{
- success=success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceClassID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
- success=success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_ARRAY, "(nn)", &innerIter);
+ success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sourceClassID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
+ success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_ARRAY, "(nn)", &innerIter);
- std::vector<am::am_ClassProperty_s>::const_iterator listInnerIterator=listIterator->listClassProperties.begin();
- for(;listInnerIterator<listIterator->listClassProperties.end();++listInnerIterator)
+ std::vector<am::am_ClassProperty_s>::const_iterator listInnerIterator = listIterator->listClassProperties.begin();
+ for (; listInnerIterator < listIterator->listClassProperties.end(); ++listInnerIterator)
{
- success=success && dbus_message_iter_open_container(&innerIter, DBUS_TYPE_STRUCT, NULL, &propIter);
- success=success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->classProperty);
- success=success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->value);
- success=success && dbus_message_iter_close_container(&innerIter, &propIter);
+ success = success && dbus_message_iter_open_container(&innerIter, DBUS_TYPE_STRUCT, NULL, &propIter);
+ success = success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->classProperty);
+ success = success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->value);
+ success = success && dbus_message_iter_close_container(&innerIter, &propIter);
}
- success=success && dbus_message_iter_close_container(&structIter, &innerIter);
- success=success && dbus_message_iter_close_container(&arrayIter, &structIter);
+ success = success && dbus_message_iter_close_container(&structIter, &innerIter);
+ success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
}
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -572,35 +570,35 @@ void DBusMessageHandler::append(const std::vector<am::am_SinkClass_s> & listSink
DBusMessageIter structIter;
DBusMessageIter propIter;
DBusMessageIter innerIter;
- std::vector<am::am_SinkClass_s>::const_iterator listIterator=listSinkClasses.begin();
- dbus_bool_t success=true;
+ std::vector<am::am_SinkClass_s>::const_iterator listIterator = listSinkClasses.begin();
+ dbus_bool_t success = true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qsa(nn))", &arrayIter);
- for(;listIterator<listSinkClasses.end();++listIterator)
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(qsa(nn))", &arrayIter);
+ for (; listIterator < listSinkClasses.end(); ++listIterator)
{
- success=success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkClassID);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
- success=success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_ARRAY, "(nn)", &innerIter);
+ success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_UINT16, &listIterator->sinkClassID);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_STRING, &listIterator->name);
+ success = success && dbus_message_iter_open_container(&structIter, DBUS_TYPE_ARRAY, "(nn)", &innerIter);
- std::vector<am::am_ClassProperty_s>::const_iterator listInnerIterator=listIterator->listClassProperties.begin();
- for(;listInnerIterator<listIterator->listClassProperties.end();++listInnerIterator)
+ std::vector<am::am_ClassProperty_s>::const_iterator listInnerIterator = listIterator->listClassProperties.begin();
+ for (; listInnerIterator < listIterator->listClassProperties.end(); ++listInnerIterator)
{
- success=success && dbus_message_iter_open_container(&innerIter, DBUS_TYPE_STRUCT, NULL, &propIter);
- success=success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->classProperty);
- success=success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->value);
- success=success && dbus_message_iter_close_container(&innerIter, &propIter);
+ success = success && dbus_message_iter_open_container(&innerIter, DBUS_TYPE_STRUCT, NULL, &propIter);
+ success = success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->classProperty);
+ success = success && dbus_message_iter_append_basic(&propIter, DBUS_TYPE_INT16, &listInnerIterator->value);
+ success = success && dbus_message_iter_close_container(&innerIter, &propIter);
}
- success=success && dbus_message_iter_close_container(&structIter, &innerIter);
- success=success && dbus_message_iter_close_container(&arrayIter, &structIter);
+ success = success && dbus_message_iter_close_container(&structIter, &innerIter);
+ success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
}
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
@@ -608,37 +606,24 @@ void DBusMessageHandler::append(const std::vector<am::am_SystemProperty_s> & lis
{
DBusMessageIter arrayIter;
DBusMessageIter structIter;
- std::vector<am::am_SystemProperty_s>::const_iterator listIterator=listSystemProperties.begin();
- dbus_bool_t success=true;
+ std::vector<am::am_SystemProperty_s>::const_iterator listIterator = listSystemProperties.begin();
+ dbus_bool_t success = true;
- success=success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(nn)", &arrayIter);
- for(;listIterator<listSystemProperties.end();++listIterator)
+ success = success && dbus_message_iter_open_container(&mDBusMessageIter, DBUS_TYPE_ARRAY, "(nn)", &arrayIter);
+ for (; listIterator < listSystemProperties.end(); ++listIterator)
{
- success=success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->type);
- success=success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->value);
- success=success && dbus_message_iter_close_container(&arrayIter, &structIter);
+ success = success && dbus_message_iter_open_container(&arrayIter, DBUS_TYPE_STRUCT, NULL, &structIter);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->type);
+ success = success && dbus_message_iter_append_basic(&structIter, DBUS_TYPE_INT16, &listIterator->value);
+ success = success && dbus_message_iter_close_container(&arrayIter, &structIter);
}
- success=success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
+ success = success && dbus_message_iter_close_container(&mDBusMessageIter, &arrayIter);
if (!success)
{
- DLT_LOG(DLT_CONTEXT,DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
- mErrorName=std::string(DBUS_ERROR_NO_MEMORY);
- mErrorMsg="Cannot create reply!";
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_ERROR, DLT_STRING("DBusMessageHandler::append Cannot allocate DBus message!"));
+ mErrorName = std::string(DBUS_ERROR_NO_MEMORY);
+ mErrorMsg = "Cannot create reply!";
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/PluginCommandInterfaceDbus/test/config.h b/PluginCommandInterfaceDbus/test/config.h
deleted file mode 100644
index ea737e0..0000000
--- a/PluginCommandInterfaceDbus/test/config.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _CONFIG_H
-#define _CONFIG_H
-
-#define WITH_DBUS_WRAPPER
-#define WITH_SOCKETHANDLER_LOOP
-/* #undef WITH_SIMPLEDBUS_LOOP */
-
-#define DEFAULT_PLUGIN_COMMAND_DIR "/home/christian/workspace/gitserver/bin/plugins/command"
-#define DEFAULT_PLUGIN_ROUTING_DIR "/home/christian/workspace/gitserver/bin/plugins/routing"
-#define CONTROLLER_PLUGIN "/home/christian/workspace/gitserver/bin/plugins/control/libPluginControlInterface.so"
-
-#define DBUS_SERVICE_PREFIX "org.genivi.audiomanager"
-#define DBUS_SERVICE_OBJECT_PATH "/org/genivi/audiomanager"
-
-#define INTROSPECTION_COMMAND_XML_FILE "/home/christian/workspace/gitserver/includes/dbus/CommandInterface.xml"
-
-#endif /* _CONFIG_H */
diff --git a/PluginControlInterface/include/ControlSender.h b/PluginControlInterface/include/ControlSender.h
index d0014a4..40be70f 100644
--- a/PluginControlInterface/include/ControlSender.h
+++ b/PluginControlInterface/include/ControlSender.h
@@ -1,28 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file ControlSender.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
-
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger DbusPlugin
+ *
+ * \file ControlSender.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef CONTROLSENDER_H_
#define CONTROLSENDER_H_
@@ -31,52 +30,54 @@
using namespace am;
-class ControlSenderPlugin: public ControlSendInterface {
+class ControlSenderPlugin: public ControlSendInterface
+{
public:
- ControlSenderPlugin();
- virtual ~ControlSenderPlugin();
- am_Error_e startupController(ControlReceiveInterface* controlreceiveinterface) ;
- am_Error_e stopController() ;
- void hookAllPluginsLoaded() ;
- am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID) ;
- am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID) ;
- am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty) ;
- am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty) ;
- am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property) ;
- am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume) ;
- am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment) ;
- am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState) ;
- am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID) ;
- am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID) ;
- void hookSystemDomainRegistrationComplete(const am_domainID_t domainID) ;
- am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID) ;
- am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID) ;
- am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID) ;
- am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID) ;
- am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID) ;
- am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID) ;
- am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID) ;
- am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID) ;
- void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume) ;
- void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume) ;
- void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) ;
- void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
- void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
- void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state) ;
- void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data) ;
- void hookSystemSpeedChange(const am_speed_t speed) ;
- void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time) ;
- void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID) ;
- void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID) ;
- void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error) ;
- void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ;
- void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, 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 cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error) ;
- void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error) ;
- void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error) ;
- uint16_t getInterfaceVersion() const;
+ ControlSenderPlugin();
+ virtual ~ControlSenderPlugin();
+ am_Error_e startupController(ControlReceiveInterface* controlreceiveinterface);
+ am_Error_e stopController();
+ void hookAllPluginsLoaded();
+ am_Error_e hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID);
+ am_Error_e hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID);
+ am_Error_e hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty);
+ am_Error_e hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty);
+ am_Error_e hookUserSetSystemProperty(const am_SystemProperty_s& property);
+ am_Error_e hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume);
+ am_Error_e hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment);
+ am_Error_e hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState);
+ am_Error_e hookSystemRegisterDomain(const am_Domain_s& domainData, am_domainID_t& domainID);
+ am_Error_e hookSystemDeregisterDomain(const am_domainID_t domainID);
+ void hookSystemDomainRegistrationComplete(const am_domainID_t domainID);
+ am_Error_e hookSystemRegisterSink(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
+ am_Error_e hookSystemDeregisterSink(const am_sinkID_t sinkID);
+ am_Error_e hookSystemRegisterSource(const am_Source_s& sourceData, am_sourceID_t& sourceID);
+ am_Error_e hookSystemDeregisterSource(const am_sourceID_t sourceID);
+ am_Error_e hookSystemRegisterGateway(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID);
+ am_Error_e hookSystemDeregisterGateway(const am_gatewayID_t gatewayID);
+ am_Error_e hookSystemRegisterCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID);
+ am_Error_e hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID);
+ void hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume);
+ void hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume);
+ void hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState);
+ void hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s& availability);
+ void hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state);
+ void hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s>& data);
+ void hookSystemSpeedChange(const am_speed_t speed);
+ void hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time);
+ void cbAckConnect(const am_Handle_s handle, const am_Error_e errorID);
+ void cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID);
+ void cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error);
+ void cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
+ void cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, 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 cbAckSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error);
+ void cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error);
+ void cbAckSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error);
+ am_Error_e getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats);
+ uint16_t getInterfaceVersion() const;
};
#endif /* CONTROLSENDER_H_ */
diff --git a/PluginControlInterface/src/ControlSender.cpp b/PluginControlInterface/src/ControlSender.cpp
index fb54c8c..0d1b3de 100644
--- a/PluginControlInterface/src/ControlSender.cpp
+++ b/PluginControlInterface/src/ControlSender.cpp
@@ -1,35 +1,37 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \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.
-*
-* 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 DbusPlugin
+ *
+ * \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.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#include "ControlSender.h"
-extern "C" ControlSendInterface* PluginControlInterfaceFactory() {
+extern "C" ControlSendInterface* PluginControlInterfaceFactory()
+{
return (new ControlSenderPlugin());
}
-extern "C" void destroyControlPluginInterface(ControlSendInterface* controlSendInterface) {
+extern "C" void destroyControlPluginInterface(ControlSendInterface* controlSendInterface)
+{
delete controlSendInterface;
}
@@ -37,265 +39,184 @@ ControlSenderPlugin::ControlSenderPlugin()
{
}
-
-
ControlSenderPlugin::~ControlSenderPlugin()
{
}
-
-
am_Error_e ControlSenderPlugin::startupController(ControlReceiveInterface *controlreceiveinterface)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::stopController()
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
void ControlSenderPlugin::hookAllPluginsLoaded()
{
}
-
-
am_Error_e ControlSenderPlugin::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
-
am_Error_e ControlSenderPlugin::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookUserSetSystemProperty(const am_SystemProperty_s & property)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookUserVolumeChange(const am_sinkID_t SinkID, const am_mainVolume_t newVolume)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookUserVolumeStep(const am_sinkID_t SinkID, const int16_t increment)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemDeregisterDomain(const am_domainID_t domainID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
void ControlSenderPlugin::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
{
}
-
-
am_Error_e ControlSenderPlugin::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemDeregisterSink(const am_sinkID_t sinkID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemDeregisterSource(const am_sourceID_t sourceID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
am_Error_e ControlSenderPlugin::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
- return E_NOT_USED;
+ return E_NOT_USED;
}
-
-
void ControlSenderPlugin::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
}
-
-
void ControlSenderPlugin::hookSystemSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
}
-
-
void ControlSenderPlugin::hookSystemInterruptStateChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
}
-
-
void ControlSenderPlugin::hookSystemSinkAvailablityStateChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
}
-
-
void ControlSenderPlugin::hookSystemSourceAvailablityStateChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
}
-
-
void ControlSenderPlugin::hookSystemDomainStateChange(const am_domainID_t domainID, const am_DomainState_e state)
{
}
-
-
void ControlSenderPlugin::hookSystemReceiveEarlyData(const std::vector<am_EarlyData_s> & data)
{
}
-
-
void ControlSenderPlugin::hookSystemSpeedChange(const am_speed_t speed)
{
}
-
-
void ControlSenderPlugin::hookSystemTimingInformationChanged(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time)
{
}
-
-
void ControlSenderPlugin::cbAckConnect(const am_Handle_s handle, const am_Error_e errorID)
{
}
-
-
void ControlSenderPlugin::cbAckDisconnect(const am_Handle_s handle, const am_Error_e errorID)
{
}
-
-
void ControlSenderPlugin::cbAckCrossFade(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error)
{
}
-
-
void ControlSenderPlugin::cbAckSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
}
-
-
void ControlSenderPlugin::cbAckSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error)
{
}
-
-
void ControlSenderPlugin::cbAckSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
}
-
-
void ControlSenderPlugin::cbAckSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
}
-
-
void ControlSenderPlugin::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
}
@@ -308,12 +229,14 @@ void ControlSenderPlugin::cbAckSetSinkSoundProperties(const am_Handle_s handle,
{
}
-uint16_t ControlSenderPlugin::getInterfaceVersion() const
+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)
{
- return (ControlSendVersion);
+ listPrioConnectionFormats = listPossibleConnectionFormats;
+ return (E_OK);
}
-
-
-
+uint16_t ControlSenderPlugin::getInterfaceVersion() const
+{
+ return (ControlSendVersion);
+}
diff --git a/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h b/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h
index 5aa9e1f..ea6da5f 100644
--- a/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h
+++ b/PluginRoutingInterfaceAsync/include/RoutingReceiverAsyncShadow.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file testRoutingItnerfaceAsync.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file testRoutingItnerfaceAsync.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 ROUTINGRECEIVERASYNCSHADOW_H_
#define ROUTINGRECEIVERASYNCSHADOW_H_
@@ -30,7 +30,8 @@
#include <pthread.h>
#include <queue>
-namespace am {
+namespace am
+{
/**
* Threadsafe shadow of the RoutingReceiverInterface
@@ -39,151 +40,137 @@ namespace am {
class RoutingReceiverAsyncShadow
{
public:
- RoutingReceiverAsyncShadow();
- virtual ~RoutingReceiverAsyncShadow();
- void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) ;
- void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error) ;
- void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error) ;
- 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 ackSetSourceSoundProperty(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) ;
- void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) ;
- void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability) ;
- void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability) ;
- void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState) ;
- void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay) ;
-
- am_Error_e setRoutingInterface(RoutingReceiveInterface *receiveInterface);
- void asyncMsgReceiver(const pollfd pollfd,const sh_pollHandle_t handle, void* userData);
- bool asyncDispatcher(const sh_pollHandle_t handle, void* userData);
- bool asyncChecker(const sh_pollHandle_t handle, void* userData);
-
- shPollFired_T<RoutingReceiverAsyncShadow> asyncMsgReceive;
- shPollDispatch_T<RoutingReceiverAsyncShadow> asyncDispatch;
- shPollCheck_T<RoutingReceiverAsyncShadow> asyncCheck;
+ RoutingReceiverAsyncShadow();
+ virtual ~RoutingReceiverAsyncShadow();
+ void ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
+ void ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error);
+ void ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error);
+ 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 ackSetSourceSoundProperty(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);
+ void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState);
+ void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability);
+ void hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s& availability);
+ void hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState);
+ void hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay);
+
+ am_Error_e setRoutingInterface(RoutingReceiveInterface *receiveInterface);
+ void asyncMsgReceiver(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+ bool asyncDispatcher(const sh_pollHandle_t handle, void* userData);
+ bool asyncChecker(const sh_pollHandle_t handle, void* userData);
+
+ shPollFired_T<RoutingReceiverAsyncShadow> asyncMsgReceive;
+ shPollDispatch_T<RoutingReceiverAsyncShadow> asyncDispatch;
+ shPollCheck_T<RoutingReceiverAsyncShadow> asyncCheck;
private:
- enum msgID_e
- {
- MSG_ACKCONNECT,
- MSG_ACKDISCONNECT,
- MSG_ACKSETSINKVOLUMECHANGE,
- MSG_ACKSETSOURCEVOLUMECHANGE,
- MSG_ACKSETSOURCESTATE,
- MSG_ACKSETSINKSOUNDPROPERTY,
- MSG_ACKSETSOURCESOUNDPROPERTY,
- MSG_ACKCROSSFADING,
- MSG_ACKSOURCEVOLUMETICK,
- MSG_ACKSINKVOLUMETICK,
- MSG_HOOKINTERRUPTSTATUSCHANGE,
- MSG_HOOKSINKAVAILABLITYSTATUSCHANGE,
- MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE,
- MSG_HOOKDOMAINSTATECHANGE,
- MSG_HOOKTIMINGINFORMATIONCHANGED
- };
-
- struct a_connect_s
- {
- am_Handle_s handle;
- am_connectionID_t connectionID;
- am_Error_e error;
- };
-
- struct a_volume_s
- {
- am_Handle_s handle;
- am_volume_t volume;
- am_Error_e error;
- };
-
- struct a_handle_s
- {
- am_Handle_s handle;
- am_Error_e error;
- };
-
- struct a_crossfading_s
- {
- am_Handle_s handle;
- am_HotSink_e hotSink;
- am_Error_e error;
- };
-
- struct a_sourceVolumeTick_s
- {
- am_sourceID_t sourceID;
- am_Handle_s handle;
- am_volume_t volume;
- };
-
- struct a_sinkVolumeTick_s
- {
- am_sinkID_t sinkID;
- am_Handle_s handle;
- am_volume_t volume;
- };
-
- struct a_interruptStatusChange_s
- {
- am_sourceID_t sourceID;
- am_InterruptState_e interruptState;
- };
-
- struct a_sinkAvailability_s
- {
- am_sinkID_t sinkID;
- am_Availability_s availability;
- };
-
- struct a_sourceAvailability_s
- {
- am_sourceID_t sourceID;
- am_Availability_s availability;
- };
-
- struct a_hookDomainStateChange_s
- {
- am_domainID_t domainID;
- am_DomainState_e state;
- };
-
- struct a_timingInfoChanged_s
- {
- am_connectionID_t connectionID;
- am_timeSync_t delay;
- };
-
- union parameter_u
- {
- a_connect_s connect;
- a_volume_s volume;
- a_handle_s handle;
- a_crossfading_s crossfading;
- a_sourceVolumeTick_s sourceVolumeTick;
- a_sinkVolumeTick_s sinkVolumeTick;
- a_interruptStatusChange_s interruptStatusChange;
- a_sinkAvailability_s sinkAvailability;
- a_sourceAvailability_s sourceAvailability;
- a_hookDomainStateChange_s domainStateChange;
- a_timingInfoChanged_s timingInfoChange;
- };
-
- struct msg_s
- {
- msgID_e msgID;
- parameter_u parameters;
- };
-
- SocketHandler *mSocketHandler;
- RoutingReceiveInterface *mRoutingReceiveInterface;
- std::queue<msg_s> mQueue;
- static pthread_mutex_t mMutex;
- sh_pollHandle_t mHandle;
- int mPipe[2];
+ enum msgID_e
+ {
+ MSG_ACKCONNECT, MSG_ACKDISCONNECT, MSG_ACKSETSINKVOLUMECHANGE, MSG_ACKSETSOURCEVOLUMECHANGE, MSG_ACKSETSOURCESTATE, MSG_ACKSETSINKSOUNDPROPERTY, MSG_ACKSETSOURCESOUNDPROPERTY, MSG_ACKCROSSFADING, MSG_ACKSOURCEVOLUMETICK, MSG_ACKSINKVOLUMETICK, MSG_HOOKINTERRUPTSTATUSCHANGE, MSG_HOOKSINKAVAILABLITYSTATUSCHANGE, MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE, MSG_HOOKDOMAINSTATECHANGE, MSG_HOOKTIMINGINFORMATIONCHANGED
+ };
+
+ struct a_connect_s
+ {
+ am_Handle_s handle;
+ am_connectionID_t connectionID;
+ am_Error_e error;
+ };
+
+ struct a_volume_s
+ {
+ am_Handle_s handle;
+ am_volume_t volume;
+ am_Error_e error;
+ };
+
+ struct a_handle_s
+ {
+ am_Handle_s handle;
+ am_Error_e error;
+ };
+
+ struct a_crossfading_s
+ {
+ am_Handle_s handle;
+ am_HotSink_e hotSink;
+ am_Error_e error;
+ };
+
+ struct a_sourceVolumeTick_s
+ {
+ am_sourceID_t sourceID;
+ am_Handle_s handle;
+ am_volume_t volume;
+ };
+
+ struct a_sinkVolumeTick_s
+ {
+ am_sinkID_t sinkID;
+ am_Handle_s handle;
+ am_volume_t volume;
+ };
+
+ struct a_interruptStatusChange_s
+ {
+ am_sourceID_t sourceID;
+ am_InterruptState_e interruptState;
+ };
+
+ struct a_sinkAvailability_s
+ {
+ am_sinkID_t sinkID;
+ am_Availability_s availability;
+ };
+
+ struct a_sourceAvailability_s
+ {
+ am_sourceID_t sourceID;
+ am_Availability_s availability;
+ };
+
+ struct a_hookDomainStateChange_s
+ {
+ am_domainID_t domainID;
+ am_DomainState_e state;
+ };
+
+ struct a_timingInfoChanged_s
+ {
+ am_connectionID_t connectionID;
+ am_timeSync_t delay;
+ };
+
+ union parameter_u
+ {
+ a_connect_s connect;
+ a_volume_s volume;
+ a_handle_s handle;
+ a_crossfading_s crossfading;
+ a_sourceVolumeTick_s sourceVolumeTick;
+ a_sinkVolumeTick_s sinkVolumeTick;
+ a_interruptStatusChange_s interruptStatusChange;
+ a_sinkAvailability_s sinkAvailability;
+ a_sourceAvailability_s sourceAvailability;
+ a_hookDomainStateChange_s domainStateChange;
+ a_timingInfoChanged_s timingInfoChange;
+ };
+
+ struct msg_s
+ {
+ msgID_e msgID;
+ parameter_u parameters;
+ };
+
+ SocketHandler *mSocketHandler;
+ RoutingReceiveInterface *mRoutingReceiveInterface;
+ std::queue<msg_s> mQueue;
+ static pthread_mutex_t mMutex;
+ sh_pollHandle_t mHandle;
+ int mPipe[2];
};
} /* namespace am */
diff --git a/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h b/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h
index ad76d52..6ca920d 100644
--- a/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h
+++ b/PluginRoutingInterfaceAsync/include/RoutingSenderAsyn.h
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file RoutingSender.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger DbusPlugin
+ *
+ * \file RoutingSender.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef ROUTINGSENDER_H_
#define ROUTINGSENDER_H_
@@ -30,7 +30,8 @@
#include "RoutingReceiverAsyncShadow.h"
#include <semaphore.h>
-namespace am {
+namespace am
+{
class WorkerThreadPool;
@@ -41,233 +42,234 @@ class WorkerThreadPool;
class Worker
{
public:
- Worker(WorkerThreadPool* pool);
- virtual ~Worker(){};
- /**
- * needs to be overwritten, this function is called when the worker should start to work
- */
- void virtual start2work()=0;
-
- /**
- * needs to be overwritten, this function is called when the worker thread is canceled. Should be used for
- * clean up and sending important messages
- */
- void virtual cancelWork()=0;
- /**
- * waits for a semaphore with a timeout. This leaves the Threadpool the chance to interrupt the processing
- * You should call whenever waiting on some event, even with time=0 in order to make sure that cancel events are
- * received
- * @param time time until timeout in timespec format
- * @return true if thread is canceled. Then just return start2work function so that the thread is given back to the pool
- */
- bool timedWait(timespec time);
-
- /**
- * the semaphore for cancellation is set by the thread automatically...
- * @param cancel
- */
- void setCancelSempaphore(sem_t* cancel);
- WorkerThreadPool* pPool;
+ Worker(WorkerThreadPool* pool);
+ virtual ~Worker()
+ {
+ }
+ ;
+ /**
+ * needs to be overwritten, this function is called when the worker should start to work
+ */
+ void virtual start2work()=0;
+
+ /**
+ * needs to be overwritten, this function is called when the worker thread is canceled. Should be used for
+ * clean up and sending important messages
+ */
+ void virtual cancelWork()=0;
+ /**
+ * waits for a semaphore with a timeout. This leaves the Threadpool the chance to interrupt the processing
+ * You should call whenever waiting on some event, even with time=0 in order to make sure that cancel events are
+ * received
+ * @param time time until timeout in timespec format
+ * @return true if thread is canceled. Then just return start2work function so that the thread is given back to the pool
+ */
+ bool timedWait(timespec time);
+
+ /**
+ * the semaphore for cancellation is set by the thread automatically...
+ * @param cancel
+ */
+ void setCancelSempaphore(sem_t* cancel);
+ WorkerThreadPool* pPool;
private:
- sem_t* mCancelSem; //<! semaphore for cancellation
+ sem_t* mCancelSem; //<! semaphore for cancellation
};
-
/**
* This class handles the threadpool
*/
class WorkerThreadPool
{
public:
- /**
- * creates the pool. Give the max number of threads as argument
- * @param numThreads max number of threads
- */
- WorkerThreadPool(int numThreads);
- virtual ~WorkerThreadPool();
-
- /**
- * assigns a thread to a worker class and starts working.
- * @param worker
- * @return the actual assigned workerID or -1 in case no thread is free
- */
- int16_t startWork(Worker* worker);
- /**
- * cancels a thread
- * @param workerID thread to be canceled
- * @return true if thread was found, false if not
- */
- bool cancelWork(int workerID);
-
- /**
- * the workers call this function upon completion of their task
- * @param threadID
- */
- void finishedWork(pthread_t threadID);
-
+ /**
+ * creates the pool. Give the max number of threads as argument
+ * @param numThreads max number of threads
+ */
+ WorkerThreadPool(int numThreads);
+ virtual ~WorkerThreadPool();
+
+ /**
+ * assigns a thread to a worker class and starts working.
+ * @param worker
+ * @return the actual assigned workerID or -1 in case no thread is free
+ */
+ int16_t startWork(Worker* worker);
+ /**
+ * cancels a thread
+ * @param workerID thread to be canceled
+ * @return true if thread was found, false if not
+ */
+ bool cancelWork(int workerID);
+
+ /**
+ * the workers call this function upon completion of their task
+ * @param threadID
+ */
+ void finishedWork(pthread_t threadID);
private:
- static void* WorkerThread (void* data);
- int mNumThreads;
- struct threadInfo_s
- {
- uint16_t workerID;
- pthread_t threadID;
- bool busy;
- sem_t block;
- sem_t cancel;
- 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 void* WorkerThread(void* data);
+ int mNumThreads;
+ struct threadInfo_s
+ {
+ uint16_t workerID;
+ pthread_t threadID;
+ bool busy;
+ sem_t block;
+ sem_t cancel;
+ Worker *worker;
+ };
+ std::vector<threadInfo_s> mListWorkers; //<! list of all workers
+ static pthread_mutex_t mBlockingMutex; //<! mutex to block the acces of the list
};
-class AsyncRoutingSender: public RoutingSendInterface {
+class AsyncRoutingSender: public RoutingSendInterface
+{
public:
- AsyncRoutingSender();
- virtual ~AsyncRoutingSender();
- void startupRoutingInterface(RoutingReceiveInterface* routingreceiveinterface) ;
- void routingInterfacesReady() ;
- void routingInterfacesRundown() ;
- am_Error_e asyncAbort(const am_Handle_s handle) ;
- am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat) ;
- am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID) ;
- 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 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 ;
- uint16_t getInterfaceVersion() const;
-
- /**
- * threadafe insert of route and connectionID
- * @param connectionID
- * @param route
- */
- void insertConnectionSafe(am_connectionID_t connectionID,am_RoutingElement_s route);
-
- /**
- * threadsafe removal of a connection
- * @param
- */
- void removeConnectionSafe(am_connectionID_t);
-
- /**
- * threadsafe remove of a handle
- * @param handle
- */
- void removeHandleSafe(uint16_t handle);
-
- /**
- * threadsafe update of Sinkvolume
- * @param sinkID
- * @param volume
- */
- void updateSinkVolumeSafe(am_sinkID_t sinkID,am_volume_t volume);
-
- /**
- * threadsafe update of SourceVolume
- * @param sourceID
- * @param volume
- */
- void updateSourceVolumeSafe(am_sourceID_t sourceID,am_volume_t volume);
-
- /**
- * threadsafe update of sourceState
- * @param sourceID
- * @param state
- */
- void updateSourceStateSafe(am_sourceID_t sourceID,am_SourceState_e state);
-
- /**
- * threadsafe update of sinkSoundProperty
- * @param sinkID
- * @param soundProperty
- */
- void updateSinkSoundPropertySafe(am_sinkID_t sinkID, am_SoundProperty_s soundProperty);
-
- /**
- * threadsafe update of sourceSoundProperty
- * @param sourceID
- * @param soundProperty
- */
- void updateSourceSoundPropertySafe(am_sourceID_t sourceID, am_SoundProperty_s soundProperty);
-
- /**
- * threadsafe update of domainstate
- * @param domainID
- * @param domainState
- */
- void updateDomainstateSafe(am_domainID_t domainID,am_DomainState_e domainState);
+ AsyncRoutingSender();
+ virtual ~AsyncRoutingSender();
+ void startupRoutingInterface(RoutingReceiveInterface* routingreceiveinterface);
+ void routingInterfacesReady();
+ void routingInterfacesRundown();
+ am_Error_e asyncAbort(const am_Handle_s handle);
+ am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat);
+ am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID);
+ 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 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;
+ uint16_t getInterfaceVersion() const;
+
+ /**
+ * threadafe insert of route and connectionID
+ * @param connectionID
+ * @param route
+ */
+ void insertConnectionSafe(am_connectionID_t connectionID, am_RoutingElement_s route);
+
+ /**
+ * threadsafe removal of a connection
+ * @param
+ */
+ void removeConnectionSafe(am_connectionID_t);
+
+ /**
+ * threadsafe remove of a handle
+ * @param handle
+ */
+ void removeHandleSafe(uint16_t handle);
+
+ /**
+ * threadsafe update of Sinkvolume
+ * @param sinkID
+ * @param volume
+ */
+ void updateSinkVolumeSafe(am_sinkID_t sinkID, am_volume_t volume);
+
+ /**
+ * threadsafe update of SourceVolume
+ * @param sourceID
+ * @param volume
+ */
+ void updateSourceVolumeSafe(am_sourceID_t sourceID, am_volume_t volume);
+
+ /**
+ * threadsafe update of sourceState
+ * @param sourceID
+ * @param state
+ */
+ void updateSourceStateSafe(am_sourceID_t sourceID, am_SourceState_e state);
+
+ /**
+ * threadsafe update of sinkSoundProperty
+ * @param sinkID
+ * @param soundProperty
+ */
+ void updateSinkSoundPropertySafe(am_sinkID_t sinkID, am_SoundProperty_s soundProperty);
+
+ /**
+ * threadsafe update of sourceSoundProperty
+ * @param sourceID
+ * @param soundProperty
+ */
+ void updateSourceSoundPropertySafe(am_sourceID_t sourceID, am_SoundProperty_s soundProperty);
+
+ /**
+ * threadsafe update of domainstate
+ * @param domainID
+ * @param domainState
+ */
+ void updateDomainstateSafe(am_domainID_t domainID, am_DomainState_e domainState);
private:
- /**
- * Extra thread that handles dbus stimulation for interrupt tests
- * @param data
- */
- static void* InterruptEvents (void* data);
- std::vector<am_Domain_s> createDomainTable();
- std::vector<am_Sink_s> createSinkTable();
- std::vector<am_Source_s> createSourceTable();
- std::vector<am_Gateway_s> createGatewayTable();
- RoutingReceiverAsyncShadow mShadow;
- RoutingReceiveInterface* mReceiveInterface;
- SocketHandler *mSocketHandler;
- std::vector<am_Domain_s> mDomains;
- std::vector<am_Sink_s> mSinks;
- std::vector<am_Source_s> mSources;
- std::vector<am_Gateway_s> mGateways;
- std::map<uint16_t,int16_t> mMapHandleWorker;
- std::map<am_connectionID_t,am_RoutingElement_s> mMapConnectionIDRoute;
- WorkerThreadPool mPool;
- pthread_t mInterruptThread;
- static pthread_mutex_t mMapConnectionMutex;
- static pthread_mutex_t mMapHandleWorkerMutex;
- static pthread_mutex_t mSinksMutex;
- static pthread_mutex_t mSourcesMutex;
- static pthread_mutex_t mDomainsMutex;
+ /**
+ * Extra thread that handles dbus stimulation for interrupt tests
+ * @param data
+ */
+ static void* InterruptEvents(void* data);
+ std::vector<am_Domain_s> createDomainTable();
+ std::vector<am_Sink_s> createSinkTable();
+ std::vector<am_Source_s> createSourceTable();
+ std::vector<am_Gateway_s> createGatewayTable();
+ RoutingReceiverAsyncShadow mShadow;
+ RoutingReceiveInterface* mReceiveInterface;
+ SocketHandler *mSocketHandler;
+ std::vector<am_Domain_s> mDomains;
+ std::vector<am_Sink_s> mSinks;
+ std::vector<am_Source_s> mSources;
+ std::vector<am_Gateway_s> mGateways;
+ std::map<uint16_t, int16_t> mMapHandleWorker;
+ std::map<am_connectionID_t, am_RoutingElement_s> mMapConnectionIDRoute;
+ WorkerThreadPool mPool;
+ pthread_t mInterruptThread;
+ static pthread_mutex_t mMapConnectionMutex;
+ static pthread_mutex_t mMapHandleWorkerMutex;
+ static pthread_mutex_t mSinksMutex;
+ static pthread_mutex_t mSourcesMutex;
+ static pthread_mutex_t mDomainsMutex;
};
-
/**
* worker to for connection
*/
-class asycConnectWorker : public Worker
+class asycConnectWorker: public Worker
{
public:
- asycConnectWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat);
- void start2work();
- void cancelWork();
+ 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);
+ void start2work();
+ void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
- am_Handle_s mHandle;
- am_connectionID_t mConnectionID;
- am_sourceID_t mSourceID;
- am_sinkID_t mSinkID;
- am_ConnectionFormat_e mConnectionFormat;
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ am_Handle_s mHandle;
+ am_connectionID_t mConnectionID;
+ am_sourceID_t mSourceID;
+ am_sinkID_t mSinkID;
+ am_ConnectionFormat_e mConnectionFormat;
};
/**
* worker for disconnecting
*/
-class asycDisConnectWorker : public Worker
+class asycDisConnectWorker: public Worker
{
public:
- asycDisConnectWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID);
- void start2work();
- void cancelWork();
+ asycDisConnectWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID);
+ void start2work();
+ void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
- am_Handle_s mHandle;
- am_connectionID_t mConnectionID;
- am_ConnectionFormat_e mConnectionFormat;
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ am_Handle_s mHandle;
+ am_connectionID_t mConnectionID;
+ am_ConnectionFormat_e mConnectionFormat;
};
/**
@@ -278,93 +280,93 @@ private:
#include <sys/signalfd.h>
#include <signal.h>
-class asyncSetSinkVolumeWorker : public Worker
+class asyncSetSinkVolumeWorker: public Worker
{
public:
- asyncSetSinkVolumeWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_volume_t currentVolume,const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
- void start2work();
- void cancelWork();
+ 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);
+ void start2work();
+ void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
- am_volume_t mCurrentVolume;
- am_Handle_s mHandle;
- am_sinkID_t mSinkID;
- am_volume_t mVolume;
- am_RampType_e mRamp;
- am_time_t mTime;
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ am_volume_t mCurrentVolume;
+ am_Handle_s mHandle;
+ am_sinkID_t mSinkID;
+ am_volume_t mVolume;
+ am_RampType_e mRamp;
+ am_time_t mTime;
};
-class asyncSetSourceVolumeWorker : public Worker
+class asyncSetSourceVolumeWorker: public Worker
{
public:
- asyncSetSourceVolumeWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_volume_t currentVolume,const am_Handle_s handle, const am_sourceID_t SourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time);
- void start2work();
- void cancelWork();
+ 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);
+ void start2work();
+ void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
- am_volume_t mCurrentVolume;
- am_Handle_s mHandle;
- am_sourceID_t mSourceID;
- am_volume_t mVolume;
- am_RampType_e mRamp;
- am_time_t mTime;
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ am_volume_t mCurrentVolume;
+ am_Handle_s mHandle;
+ am_sourceID_t mSourceID;
+ am_volume_t mVolume;
+ am_RampType_e mRamp;
+ am_time_t mTime;
};
-class asyncSetSourceStateWorker : public Worker
+class asyncSetSourceStateWorker: public Worker
{
public:
- asyncSetSourceStateWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state);
- void start2work();
- void cancelWork();
+ asyncSetSourceStateWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state);
+ void start2work();
+ void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
- am_Handle_s mHandle;
- am_sourceID_t mSourceID;
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ am_Handle_s mHandle;
+ am_sourceID_t mSourceID;
am_SourceState_e mSourcestate;
};
-class asyncSetSinkSoundPropertyWorker : public Worker
+class asyncSetSinkSoundPropertyWorker: public Worker
{
public:
- asyncSetSinkSoundPropertyWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID);
- void start2work();
- void cancelWork();
+ asyncSetSinkSoundPropertyWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sinkID_t sinkID);
+ void start2work();
+ void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
- am_Handle_s mHandle;
- am_sinkID_t mSinkID;
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ am_Handle_s mHandle;
+ am_sinkID_t mSinkID;
am_SoundProperty_s mSoundProperty;
};
-class asyncSetSourceSoundPropertyWorker : public Worker
+class asyncSetSourceSoundPropertyWorker: public Worker
{
public:
- asyncSetSourceSoundPropertyWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID);
- void start2work();
- void cancelWork();
+ asyncSetSourceSoundPropertyWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_SoundProperty_s soundProperty, const am_sourceID_t sourceID);
+ void start2work();
+ void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
- am_Handle_s mHandle;
- am_sourceID_t mSourceID;
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ am_Handle_s mHandle;
+ am_sourceID_t mSourceID;
am_SoundProperty_s mSoundProperty;
};
-class asyncDomainStateChangeWorker : public Worker
+class asyncDomainStateChangeWorker: public Worker
{
public:
- asyncDomainStateChangeWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_domainID_t domainID, const am_DomainState_e domainState);
- void start2work();
- void cancelWork();
+ asyncDomainStateChangeWorker(AsyncRoutingSender * asyncSender, WorkerThreadPool* pool, RoutingReceiverAsyncShadow* shadow, const am_domainID_t domainID, const am_DomainState_e domainState);
+ void start2work();
+ void cancelWork();
private:
- AsyncRoutingSender * mAsyncSender;
- RoutingReceiverAsyncShadow *mShadow;
- am_domainID_t mDomainID;
- am_DomainState_e mDomainState;
+ AsyncRoutingSender * mAsyncSender;
+ RoutingReceiverAsyncShadow *mShadow;
+ am_domainID_t mDomainID;
+ am_DomainState_e mDomainState;
};
}
diff --git a/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp b/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
index c2db4b0..3192e09 100644
--- a/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
+++ b/PluginRoutingInterfaceAsync/src/RoutingReceiverAsyncShadow.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file RoutingReceiverAsyncShadow.cpp
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file RoutingReceiverAsyncShadow.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ */
#include "RoutingReceiverAsyncShadow.h"
#include "DltContext.h"
@@ -37,15 +37,14 @@ using namespace am;
pthread_mutex_t RoutingReceiverAsyncShadow::mMutex = PTHREAD_MUTEX_INITIALIZER;
-
-RoutingReceiverAsyncShadow::RoutingReceiverAsyncShadow()
- :asyncMsgReceive(this, &RoutingReceiverAsyncShadow::asyncMsgReceiver),
- asyncDispatch(this, &RoutingReceiverAsyncShadow::asyncDispatcher),
- asyncCheck(this, &RoutingReceiverAsyncShadow::asyncChecker),
- mSocketHandler(),
- mRoutingReceiveInterface(),
- mHandle(),
- mPipe()
+RoutingReceiverAsyncShadow::RoutingReceiverAsyncShadow():
+asyncMsgReceive(this, &RoutingReceiverAsyncShadow::asyncMsgReceiver), //
+asyncDispatch(this, &RoutingReceiverAsyncShadow::asyncDispatcher),//
+asyncCheck(this, &RoutingReceiverAsyncShadow::asyncChecker), //
+mSocketHandler(), //
+mRoutingReceiveInterface(),//
+mHandle (),//
+mPipe()
{
}
@@ -56,469 +55,470 @@ RoutingReceiverAsyncShadow::~RoutingReceiverAsyncShadow()
void RoutingReceiverAsyncShadow::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_connect_s temp;
- temp.handle = handle;
- temp.connectionID = connectionID;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKCONNECT;
- msg.parameters.connect = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackConnect write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_connect_s temp;
+ temp.handle = handle;
+ temp.connectionID = connectionID;
+ temp.error = error;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKCONNECT;
+ msg.parameters.connect = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackConnect write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_connect_s temp;
- temp.handle = handle;
- temp.connectionID = connectionID;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKDISCONNECT;
- msg.parameters.connect = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackDisconnect write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_connect_s temp;
+ temp.handle = handle;
+ temp.connectionID = connectionID;
+ temp.error = error;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKDISCONNECT;
+ msg.parameters.connect = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackDisconnect write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_volume_s temp;
- temp.handle = handle;
- temp.volume = volume;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSINKVOLUMECHANGE;
- msg.parameters.volume = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSinkVolumeChange write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_volume_s temp;
+ temp.handle = handle;
+ temp.volume = volume;
+ temp.error = error;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKSETSINKVOLUMECHANGE;
+ msg.parameters.volume = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSinkVolumeChange write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_volume_s temp;
- temp.handle = handle;
- temp.volume = volume;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCEVOLUMECHANGE;
- msg.parameters.volume = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSourceVolumeChange write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_volume_s temp;
+ temp.handle = handle;
+ temp.volume = volume;
+ temp.error = error;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKSETSOURCEVOLUMECHANGE;
+ msg.parameters.volume = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSourceVolumeChange write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCESTATE;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSourceState write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_handle_s temp;
+ temp.handle = handle;
+ temp.error = error;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKSETSOURCESTATE;
+ msg.parameters.handle = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSourceState write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSINKSOUNDPROPERTY;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSinkSoundProperty write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_handle_s temp;
+ temp.handle = handle;
+ temp.error = error;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKSETSINKSOUNDPROPERTY;
+ msg.parameters.handle = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSinkSoundProperty write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_handle_s temp;
- temp.handle = handle;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSETSOURCESOUNDPROPERTY;
- msg.parameters.handle = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSourceSoundProperty write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_handle_s temp;
+ temp.handle = handle;
+ temp.error = error;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKSETSOURCESOUNDPROPERTY;
+ msg.parameters.handle = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSetSourceSoundProperty write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_crossfading_s temp;
- temp.handle = handle;
- temp.hotSink=hotSink;
- temp.error = error;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKCROSSFADING;
- msg.parameters.crossfading = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackCrossFading write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_crossfading_s temp;
+ temp.handle = handle;
+ temp.hotSink = hotSink;
+ temp.error = error;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKCROSSFADING;
+ msg.parameters.crossfading = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackCrossFading write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sourceVolumeTick_s temp;
- temp.sourceID=sourceID;
- temp.handle = handle;
- temp.volume = volume;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSOURCEVOLUMETICK;
- msg.parameters.sourceVolumeTick = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSourceVolumeTick write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_sourceVolumeTick_s temp;
+ temp.sourceID = sourceID;
+ temp.handle = handle;
+ temp.volume = volume;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKSOURCEVOLUMETICK;
+ msg.parameters.sourceVolumeTick = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSourceVolumeTick write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sinkVolumeTick_s temp;
- temp.sinkID=sinkID;
- temp.handle = handle;
- temp.volume = volume;
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_ACKSINKVOLUMETICK;
- msg.parameters.sinkVolumeTick = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSinkVolumeTick write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_sinkVolumeTick_s temp;
+ temp.sinkID = sinkID;
+ temp.handle = handle;
+ temp.volume = volume;
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_ACKSINKVOLUMETICK;
+ msg.parameters.sinkVolumeTick = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::ackSinkVolumeTick write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_interruptStatusChange_s temp;
- temp.sourceID=sourceID;
- temp.interruptState = interruptState;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKINTERRUPTSTATUSCHANGE;
- msg.parameters.interruptStatusChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookInterruptStatusChange write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_interruptStatusChange_s temp;
+ temp.sourceID = sourceID;
+ temp.interruptState = interruptState;
+
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_HOOKINTERRUPTSTATUSCHANGE;
+ msg.parameters.interruptStatusChange = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookInterruptStatusChange write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sinkAvailability_s temp;
- temp.sinkID=sinkID;
- temp.availability = availability;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKSINKAVAILABLITYSTATUSCHANGE;
- msg.parameters.sinkAvailability = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookSinkAvailablityStatusChange write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_sinkAvailability_s temp;
+ temp.sinkID = sinkID;
+ temp.availability = availability;
+
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_HOOKSINKAVAILABLITYSTATUSCHANGE;
+ msg.parameters.sinkAvailability = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookSinkAvailablityStatusChange write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_sourceAvailability_s temp;
- temp.sourceID=sourceID;
- temp.availability = availability;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE;
- msg.parameters.sourceAvailability = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookSourceAvailablityStatusChange write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_sourceAvailability_s temp;
+ temp.sourceID = sourceID;
+ temp.availability = availability;
+
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE;
+ msg.parameters.sourceAvailability = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookSourceAvailablityStatusChange write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_hookDomainStateChange_s temp;
- temp.domainID=domainID;
- temp.state = domainState;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKDOMAINSTATECHANGE;
- msg.parameters.domainStateChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookDomainStateChange write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_hookDomainStateChange_s temp;
+ temp.domainID = domainID;
+ temp.state = domainState;
+
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_HOOKDOMAINSTATECHANGE;
+ msg.parameters.domainStateChange = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookDomainStateChange write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
- assert(mPipe[0]!=0);
- //put the data in the queue:
- a_timingInfoChanged_s temp;
- temp.connectionID=connectionID;
- temp.delay = delay;
-
- //then we make a message out of it:
- msg_s msg;
- msg.msgID = MSG_HOOKTIMINGINFORMATIONCHANGED;
- msg.parameters.timingInfoChange = temp;
- //here we share data !
- pthread_mutex_lock(&mMutex);
- mQueue.push(msg);
- pthread_mutex_unlock(&mMutex);
-
- //ok, fire the signal that data needs to be received !
- if (write(mPipe[1], &msg.msgID, sizeof (msgID_e))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookTimingInformationChanged write failed, error code:"),DLT_STRING(strerror(errno)));
- }
+ assert(mPipe[0]!=0);
+ //put the data in the queue:
+ a_timingInfoChanged_s temp;
+ temp.connectionID = connectionID;
+ temp.delay = delay;
+
+ //then we make a message out of it:
+ msg_s msg;
+ msg.msgID = MSG_HOOKTIMINGINFORMATIONCHANGED;
+ msg.parameters.timingInfoChange = temp;
+ //here we share data !
+ pthread_mutex_lock(&mMutex);
+ mQueue.push(msg);
+ pthread_mutex_unlock(&mMutex);
+
+ //ok, fire the signal that data needs to be received !
+ if (write(mPipe[1], &msg.msgID, sizeof(msgID_e)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::hookTimingInformationChanged write failed, error code:"), DLT_STRING(strerror(errno)));
+ }
}
void RoutingReceiverAsyncShadow::asyncMsgReceiver(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
- (void)handle;
- (void)userData;
- //it is no really important what to read here, we will read the queue later...
- char buffer[10];
- if(read(pollfd.fd, buffer, 10)==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::asyncMsgReceiver could not read!"));
- }
+ (void) handle;
+ (void) userData;
+ //it is no really important what to read here, we will read the queue later...
+ char buffer[10];
+ if (read(pollfd.fd, buffer, 10) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::asyncMsgReceiver could not read!"));
+ }
}
bool RoutingReceiverAsyncShadow::asyncDispatcher(const sh_pollHandle_t handle, void *userData)
{
- (void)handle;
- (void)userData;
- msg_s msg;
-
- //ok, let's receive, first lock
- pthread_mutex_lock(&mMutex);
- msg = mQueue.front();
- mQueue.pop();
- pthread_mutex_unlock(&mMutex);
-
- //check for the message:
- switch (msg.msgID){
- case MSG_ACKCONNECT:
- mRoutingReceiveInterface->ackConnect(msg.parameters.connect.handle, msg.parameters.connect.connectionID, msg.parameters.connect.error);
- break;
- case MSG_ACKDISCONNECT:
- mRoutingReceiveInterface->ackDisconnect(msg.parameters.connect.handle, msg.parameters.connect.connectionID, msg.parameters.connect.error);
- break;
- case MSG_ACKSETSINKVOLUMECHANGE:
- mRoutingReceiveInterface->ackSetSinkVolumeChange(msg.parameters.volume.handle, msg.parameters.volume.volume,msg.parameters.volume.error);
- break;
- case MSG_ACKSETSOURCEVOLUMECHANGE:
- mRoutingReceiveInterface->ackSetSourceVolumeChange(msg.parameters.volume.handle,msg.parameters.volume.volume,msg.parameters.volume.error);
- break;
- case MSG_ACKSETSOURCESTATE:
- mRoutingReceiveInterface->ackSetSourceState(msg.parameters.handle.handle,msg.parameters.handle.error);
- break;
- case MSG_ACKSETSINKSOUNDPROPERTY:
- mRoutingReceiveInterface->ackSetSinkSoundProperty(msg.parameters.handle.handle,msg.parameters.handle.error);
- break;
- case MSG_ACKSETSOURCESOUNDPROPERTY:
- mRoutingReceiveInterface->ackSetSourceSoundProperty(msg.parameters.handle.handle,msg.parameters.handle.error);
- break;
- case MSG_ACKCROSSFADING:
- mRoutingReceiveInterface->ackCrossFading(msg.parameters.crossfading.handle,msg.parameters.crossfading.hotSink,msg.parameters.crossfading.error);
- break;
- case MSG_ACKSOURCEVOLUMETICK:
- mRoutingReceiveInterface->ackSourceVolumeTick(msg.parameters.sourceVolumeTick.handle,msg.parameters.sourceVolumeTick.sourceID,msg.parameters.sourceVolumeTick.volume);
- break;
- case MSG_ACKSINKVOLUMETICK:
- mRoutingReceiveInterface->ackSinkVolumeTick(msg.parameters.sinkVolumeTick.handle,msg.parameters.sinkVolumeTick.sinkID,msg.parameters.sinkVolumeTick.volume);
- break;
- case MSG_HOOKINTERRUPTSTATUSCHANGE:
- mRoutingReceiveInterface->hookInterruptStatusChange(msg.parameters.interruptStatusChange.sourceID,msg.parameters.interruptStatusChange.interruptState);
- break;
- case MSG_HOOKSINKAVAILABLITYSTATUSCHANGE:
- mRoutingReceiveInterface->hookSinkAvailablityStatusChange(msg.parameters.sinkAvailability.sinkID,msg.parameters.sinkAvailability.availability);
- break;
- case MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE:
- mRoutingReceiveInterface->hookSourceAvailablityStatusChange(msg.parameters.sourceAvailability.sourceID,msg.parameters.sourceAvailability.availability);
- break;
- case MSG_HOOKDOMAINSTATECHANGE:
- mRoutingReceiveInterface->hookDomainStateChange(msg.parameters.domainStateChange.domainID,msg.parameters.domainStateChange.state);
- break;
- case MSG_HOOKTIMINGINFORMATIONCHANGED:
- mRoutingReceiveInterface->hookTimingInformationChanged(msg.parameters.timingInfoChange.connectionID,msg.parameters.timingInfoChange.delay);
- break;
- default:
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::asyncDispatcher unknown message was received:"),DLT_INT(msg.msgID));
- break;
- }
-
- bool retVal=false;
- pthread_mutex_lock(&mMutex);
- if(mQueue.size() > 0) retVal=true;
- pthread_mutex_unlock(&mMutex);
-
- return (retVal);
+ (void) handle;
+ (void) userData;
+ msg_s msg;
+
+ //ok, let's receive, first lock
+ pthread_mutex_lock(&mMutex);
+ msg = mQueue.front();
+ mQueue.pop();
+ pthread_mutex_unlock(&mMutex);
+
+ //check for the message:
+ switch (msg.msgID)
+ {
+ case MSG_ACKCONNECT:
+ mRoutingReceiveInterface->ackConnect(msg.parameters.connect.handle, msg.parameters.connect.connectionID, msg.parameters.connect.error);
+ break;
+ case MSG_ACKDISCONNECT:
+ mRoutingReceiveInterface->ackDisconnect(msg.parameters.connect.handle, msg.parameters.connect.connectionID, msg.parameters.connect.error);
+ break;
+ case MSG_ACKSETSINKVOLUMECHANGE:
+ mRoutingReceiveInterface->ackSetSinkVolumeChange(msg.parameters.volume.handle, msg.parameters.volume.volume, msg.parameters.volume.error);
+ break;
+ case MSG_ACKSETSOURCEVOLUMECHANGE:
+ mRoutingReceiveInterface->ackSetSourceVolumeChange(msg.parameters.volume.handle, msg.parameters.volume.volume, msg.parameters.volume.error);
+ break;
+ case MSG_ACKSETSOURCESTATE:
+ mRoutingReceiveInterface->ackSetSourceState(msg.parameters.handle.handle, msg.parameters.handle.error);
+ break;
+ case MSG_ACKSETSINKSOUNDPROPERTY:
+ mRoutingReceiveInterface->ackSetSinkSoundProperty(msg.parameters.handle.handle, msg.parameters.handle.error);
+ break;
+ case MSG_ACKSETSOURCESOUNDPROPERTY:
+ mRoutingReceiveInterface->ackSetSourceSoundProperty(msg.parameters.handle.handle, msg.parameters.handle.error);
+ break;
+ case MSG_ACKCROSSFADING:
+ mRoutingReceiveInterface->ackCrossFading(msg.parameters.crossfading.handle, msg.parameters.crossfading.hotSink, msg.parameters.crossfading.error);
+ break;
+ case MSG_ACKSOURCEVOLUMETICK:
+ mRoutingReceiveInterface->ackSourceVolumeTick(msg.parameters.sourceVolumeTick.handle, msg.parameters.sourceVolumeTick.sourceID, msg.parameters.sourceVolumeTick.volume);
+ break;
+ case MSG_ACKSINKVOLUMETICK:
+ mRoutingReceiveInterface->ackSinkVolumeTick(msg.parameters.sinkVolumeTick.handle, msg.parameters.sinkVolumeTick.sinkID, msg.parameters.sinkVolumeTick.volume);
+ break;
+ case MSG_HOOKINTERRUPTSTATUSCHANGE:
+ mRoutingReceiveInterface->hookInterruptStatusChange(msg.parameters.interruptStatusChange.sourceID, msg.parameters.interruptStatusChange.interruptState);
+ break;
+ case MSG_HOOKSINKAVAILABLITYSTATUSCHANGE:
+ mRoutingReceiveInterface->hookSinkAvailablityStatusChange(msg.parameters.sinkAvailability.sinkID, msg.parameters.sinkAvailability.availability);
+ break;
+ case MSG_HOOKSOURCEAVAILABLITYSTATUSCHANGE:
+ mRoutingReceiveInterface->hookSourceAvailablityStatusChange(msg.parameters.sourceAvailability.sourceID, msg.parameters.sourceAvailability.availability);
+ break;
+ case MSG_HOOKDOMAINSTATECHANGE:
+ mRoutingReceiveInterface->hookDomainStateChange(msg.parameters.domainStateChange.domainID, msg.parameters.domainStateChange.state);
+ break;
+ case MSG_HOOKTIMINGINFORMATIONCHANGED:
+ mRoutingReceiveInterface->hookTimingInformationChanged(msg.parameters.timingInfoChange.connectionID, msg.parameters.timingInfoChange.delay);
+ break;
+ default:
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::asyncDispatcher unknown message was received:"), DLT_INT(msg.msgID));
+ break;
+ }
+
+ bool retVal = false;
+ pthread_mutex_lock(&mMutex);
+ if (mQueue.size() > 0) retVal = true;
+ pthread_mutex_unlock(&mMutex);
+
+ return (retVal);
}
bool RoutingReceiverAsyncShadow::asyncChecker(const sh_pollHandle_t handle, void *userData)
{
- (void)handle;
- (void)userData;
- bool returnVal=false;
- pthread_mutex_lock(&mMutex);
- if(mQueue.size() > 0) returnVal=true;
- pthread_mutex_unlock(&mMutex);
- return (returnVal);
+ (void) handle;
+ (void) userData;
+ bool returnVal = false;
+ pthread_mutex_lock(&mMutex);
+ if (mQueue.size() > 0) returnVal = true;
+ pthread_mutex_unlock(&mMutex);
+ return (returnVal);
}
am_Error_e RoutingReceiverAsyncShadow::setRoutingInterface(RoutingReceiveInterface *receiveInterface)
{
- assert(receiveInterface!=0);
- mRoutingReceiveInterface=receiveInterface;
- mRoutingReceiveInterface->getSocketHandler(mSocketHandler);
- if(pipe(mPipe)==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::setRoutingInterface could not create pipe!:"));
- return (E_UNKNOWN);
- }
-
- short event = 0;
- event |=POLLIN;
- mSocketHandler->addFDPoll(mPipe[0],event,NULL,&asyncMsgReceive,&asyncCheck,&asyncDispatch,NULL,mHandle);
- return (E_OK);
+ assert(receiveInterface!=0);
+ mRoutingReceiveInterface = receiveInterface;
+ mRoutingReceiveInterface->getSocketHandler(mSocketHandler);
+ if (pipe(mPipe) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("RoutingReceiverAsyncShadow::setRoutingInterface could not create pipe!:"));
+ return (E_UNKNOWN);
+ }
+
+ short event = 0;
+ event |= POLLIN;
+ mSocketHandler->addFDPoll(mPipe[0], event, NULL, &asyncMsgReceive, &asyncCheck, &asyncDispatch, NULL, mHandle);
+ return (E_OK);
}
diff --git a/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp b/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp
index c8d648e..562e269 100644
--- a/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp
+++ b/PluginRoutingInterfaceAsync/src/RoutingSenderAsync.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file RoutingSender.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger DbusPlugin
+ *
+ * \file RoutingSender.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 "RoutingSenderAsyn.h"
#include "DltContext.h"
@@ -34,17 +34,17 @@
#include <string>
#include <dbus/dbus.h>
-
-
using namespace am;
DLT_DECLARE_CONTEXT(PluginRoutingAsync)
-extern "C" RoutingSendInterface* PluginRoutingInterfaceAsyncFactory() {
+extern "C" RoutingSendInterface* PluginRoutingInterfaceAsyncFactory()
+{
return (new AsyncRoutingSender());
}
-extern "C" void destroyRoutingPluginInterfaceAsync(RoutingSendInterface* routingSendInterface) {
+extern "C" void destroyRoutingPluginInterfaceAsync(RoutingSendInterface* routingSendInterface)
+{
delete routingSendInterface;
}
@@ -55,298 +55,285 @@ pthread_mutex_t AsyncRoutingSender::mSourcesMutex= PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t AsyncRoutingSender::mDomainsMutex= PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t WorkerThreadPool::mBlockingMutex = PTHREAD_MUTEX_INITIALIZER;
-
void* AsyncRoutingSender::InterruptEvents(void *data)
{
- //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;
- DBusConnection* conn;
- dbus_error_init(&err);
- conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
- 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);
-
- while (dbus_connection_read_write_dispatch(conn, -1))
- {
- dbus_connection_read_write(conn, 0);
- msg = dbus_connection_pop_message(conn);
-
- if (dbus_message_is_method_call(msg, "org.genivi.test", "timingChanged"))
- {
- am_connectionID_t connectionID;
- am_timeSync_t delay;
- dbus_message_iter_init(msg, &args);
- dbus_message_iter_get_basic(&args,(void*) &connectionID);
- dbus_message_iter_next(&args);
- dbus_message_iter_get_basic(&args,(void*) &delay);
- reply = dbus_message_new_method_return(msg);
- dbus_message_iter_init_append(reply, &args);
- dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &connectionID);
- dbus_connection_send(conn, reply, &serial);
- shadow->hookTimingInformationChanged(connectionID,delay);
- dbus_message_unref(reply);
- }
- else if (dbus_message_is_method_call(msg, "org.genivi.test", "SinkAvailablityStatusChange"))
- {
- am_sinkID_t sinkID;
- am_timeSync_t delay;
- am_Availability_s availability;
- dbus_message_iter_init(msg, &args);
- dbus_message_iter_get_basic(&args,(void*) &sinkID);
- reply = dbus_message_new_method_return(msg);
- dbus_message_iter_init_append(reply, &args);
- dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sinkID);
- dbus_connection_send(conn, reply, &serial);
- shadow->hookSinkAvailablityStatusChange(sinkID,availability);
- dbus_message_unref(reply);
- }
- else if (dbus_message_is_method_call(msg, "org.genivi.test", "SourceAvailablityStatusChange"))
- {
- am_sourceID_t sourceID;
- am_timeSync_t delay;
- am_Availability_s availability;
- dbus_message_iter_init(msg, &args);
- dbus_message_iter_get_basic(&args,(void*) &sourceID);
- reply = dbus_message_new_method_return(msg);
- dbus_message_iter_init_append(reply, &args);
- dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sourceID);
- dbus_connection_send(conn, reply, &serial);
- shadow->hookSourceAvailablityStatusChange(sourceID,availability);
- dbus_message_unref(reply);
- }
- else if (dbus_message_is_method_call(msg, "org.genivi.test", "InterruptStatusChange"))
- {
- am_sourceID_t sourceID;
-
- am_InterruptState_e state;
- dbus_message_iter_init(msg, &args);
- dbus_message_iter_get_basic(&args,(void*) &sourceID);
- reply = dbus_message_new_method_return(msg);
- dbus_message_iter_init_append(reply, &args);
- dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sourceID);
- dbus_connection_send(conn, reply, &serial);
- shadow->hookInterruptStatusChange(sourceID,state);
- dbus_message_unref(reply);
- }
- dbus_connection_flush(conn);
- }
+ //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;
+ DBusConnection* conn;
+ dbus_error_init(&err);
+ conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
+ 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);
+
+ while (dbus_connection_read_write_dispatch(conn, -1))
+ {
+ dbus_connection_read_write(conn, 0);
+ msg = dbus_connection_pop_message(conn);
+
+ if (dbus_message_is_method_call(msg, "org.genivi.test", "timingChanged"))
+ {
+ am_connectionID_t connectionID;
+ am_timeSync_t delay;
+ dbus_message_iter_init(msg, &args);
+ dbus_message_iter_get_basic(&args,(void*) &connectionID);
+ dbus_message_iter_next(&args);
+ dbus_message_iter_get_basic(&args,(void*) &delay);
+ reply = dbus_message_new_method_return(msg);
+ dbus_message_iter_init_append(reply, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &connectionID);
+ dbus_connection_send(conn, reply, &serial);
+ shadow->hookTimingInformationChanged(connectionID,delay);
+ dbus_message_unref(reply);
+ }
+ else if (dbus_message_is_method_call(msg, "org.genivi.test", "SinkAvailablityStatusChange"))
+ {
+ am_sinkID_t sinkID;
+ am_timeSync_t delay;
+ am_Availability_s availability;
+ dbus_message_iter_init(msg, &args);
+ dbus_message_iter_get_basic(&args,(void*) &sinkID);
+ reply = dbus_message_new_method_return(msg);
+ dbus_message_iter_init_append(reply, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sinkID);
+ dbus_connection_send(conn, reply, &serial);
+ shadow->hookSinkAvailablityStatusChange(sinkID,availability);
+ dbus_message_unref(reply);
+ }
+ else if (dbus_message_is_method_call(msg, "org.genivi.test", "SourceAvailablityStatusChange"))
+ {
+ am_sourceID_t sourceID;
+ am_timeSync_t delay;
+ am_Availability_s availability;
+ dbus_message_iter_init(msg, &args);
+ dbus_message_iter_get_basic(&args,(void*) &sourceID);
+ reply = dbus_message_new_method_return(msg);
+ dbus_message_iter_init_append(reply, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sourceID);
+ dbus_connection_send(conn, reply, &serial);
+ shadow->hookSourceAvailablityStatusChange(sourceID,availability);
+ dbus_message_unref(reply);
+ }
+ else if (dbus_message_is_method_call(msg, "org.genivi.test", "InterruptStatusChange"))
+ {
+ am_sourceID_t sourceID;
+
+ am_InterruptState_e state;
+ dbus_message_iter_init(msg, &args);
+ dbus_message_iter_get_basic(&args,(void*) &sourceID);
+ reply = dbus_message_new_method_return(msg);
+ dbus_message_iter_init_append(reply, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &sourceID);
+ dbus_connection_send(conn, reply, &serial);
+ shadow->hookInterruptStatusChange(sourceID,state);
+ dbus_message_unref(reply);
+ }
+ dbus_connection_flush(conn);
+ }
}
-
-
void *WorkerThreadPool::WorkerThread(void* data)
{
- threadInfo_s *myInfo=(threadInfo_s*)data;
- while (1)
- {
- sem_wait(&myInfo->block);
- pthread_mutex_lock(&mBlockingMutex);
- Worker* actWorker=myInfo->worker;
- pthread_mutex_unlock(&mBlockingMutex);
- actWorker->setCancelSempaphore(&myInfo->cancel);
- actWorker->start2work();
- actWorker->pPool->finishedWork(myInfo->threadID);
- }
-}
-
-WorkerThreadPool::WorkerThreadPool(int numThreads)
- :mNumThreads(numThreads)
-{
- int workerID=0;
- mListWorkers.resize(mNumThreads);
- for (int i=0;i<mNumThreads;i++)
- {
- sem_init(&mListWorkers[i].block,NULL,NULL);
- sem_init(&mListWorkers[i].cancel,NULL,NULL);
- mListWorkers[i].busy=false;
- mListWorkers[i].workerID=++workerID;
- pthread_create(&mListWorkers[i].threadID,NULL,&WorkerThreadPool::WorkerThread,(void*)&mListWorkers[i]);
- }
+ threadInfo_s *myInfo=(threadInfo_s*)data;
+ while (1)
+ {
+ sem_wait(&myInfo->block);
+ pthread_mutex_lock(&mBlockingMutex);
+ Worker* actWorker=myInfo->worker;
+ pthread_mutex_unlock(&mBlockingMutex);
+ actWorker->setCancelSempaphore(&myInfo->cancel);
+ actWorker->start2work();
+ actWorker->pPool->finishedWork(myInfo->threadID);
+ }
+}
+
+WorkerThreadPool::WorkerThreadPool(int numThreads):
+ mNumThreads(numThreads)
+{
+ int workerID=0;
+ mListWorkers.resize(mNumThreads);
+ for (int i=0;i<mNumThreads;i++)
+ {
+ sem_init(&mListWorkers[i].block,NULL,NULL);
+ sem_init(&mListWorkers[i].cancel,NULL,NULL);
+ mListWorkers[i].busy=false;
+ mListWorkers[i].workerID=++workerID;
+ pthread_create(&mListWorkers[i].threadID,NULL,&WorkerThreadPool::WorkerThread,(void*)&mListWorkers[i]);
+ }
}
int16_t WorkerThreadPool::startWork(Worker *worker)
{
- pthread_mutex_lock(&mBlockingMutex);
- std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
- for(;it!=mListWorkers.end();++it)
- {
- if(!it->busy)
- {
- it->worker=worker;
- it->busy=true;
- pthread_mutex_unlock(&mBlockingMutex);
- sem_post(&it->block);
- return ((int)it->workerID);
- }
- }
- pthread_mutex_unlock(&mBlockingMutex);
- return (-1);
+ pthread_mutex_lock(&mBlockingMutex);
+ std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
+ for(;it!=mListWorkers.end();++it)
+ {
+ if(!it->busy)
+ {
+ it->worker=worker;
+ it->busy=true;
+ pthread_mutex_unlock(&mBlockingMutex);
+ sem_post(&it->block);
+ return ((int)it->workerID);
+ }
+ }
+ pthread_mutex_unlock(&mBlockingMutex);
+ return (-1);
}
bool WorkerThreadPool::cancelWork(int workerID)
{
- std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
- for(;it!=mListWorkers.end();++it)
- {
- if(it->workerID==workerID && it->busy)
- {
- sem_post(&it->cancel);
- return (true);
- }
- }
- return (false);
+ std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
+ for(;it!=mListWorkers.end();++it)
+ {
+ if(it->workerID==workerID && it->busy)
+ {
+ sem_post(&it->cancel);
+ return (true);
+ }
+ }
+ return (false);
}
void WorkerThreadPool::finishedWork(pthread_t threadID)
{
- pthread_mutex_lock(&mBlockingMutex);
- std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
- for(;it!=mListWorkers.end();++it)
- {
- if(it->threadID==threadID)
- {
- it->busy=false;
- delete it->worker;
- break;
- }
- }
- pthread_mutex_unlock(&mBlockingMutex);
+ pthread_mutex_lock(&mBlockingMutex);
+ std::vector<threadInfo_s>::iterator it=mListWorkers.begin();
+ for(;it!=mListWorkers.end();++it)
+ {
+ if(it->threadID==threadID)
+ {
+ it->busy=false;
+ delete it->worker;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mBlockingMutex);
}
-
-
WorkerThreadPool::~WorkerThreadPool()
{
- for (int i=0;i<mNumThreads;i++)
- {
- pthread_cancel(mListWorkers[i].threadID);
- }
-}
+ for (int i=0;i<mNumThreads;i++)
+ {
+ pthread_cancel(mListWorkers[i].threadID);
+ }
+ }
-Worker::Worker(WorkerThreadPool *pool)
-:pPool(pool),
- mCancelSem()
+Worker::Worker(WorkerThreadPool *pool):
+ pPool(pool), //
+ mCancelSem()
{
}
void Worker::setCancelSempaphore(sem_t* cancel)
{
- mCancelSem=cancel;
+ mCancelSem=cancel;
}
-
-
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)
- {
- 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);
-}
-
-AsyncRoutingSender::AsyncRoutingSender()
- :mShadow(),
- mReceiveInterface(0),
- 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"));
+ 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);
+}
+
+AsyncRoutingSender::AsyncRoutingSender():
+ mShadow(), //
+ mReceiveInterface(0), //
+ 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"));
}
-
-
AsyncRoutingSender::~AsyncRoutingSender()
{
}
-
-
void AsyncRoutingSender::startupRoutingInterface(RoutingReceiveInterface *routingreceiveinterface)
{
- //first, create the Shadow:
- assert(routingreceiveinterface!=0);
- mReceiveInterface=routingreceiveinterface;
- mShadow.setRoutingInterface(routingreceiveinterface);
+ //first, create the Shadow:
+ assert(routingreceiveinterface!=0);
+ mReceiveInterface = routingreceiveinterface;
+ mShadow.setRoutingInterface(routingreceiveinterface);
}
-
-
void AsyncRoutingSender::routingInterfacesReady()
{
- assert(mReceiveInterface!=0);
- am_Error_e eCode;
- //first register the domains
- std::vector<am_Domain_s>::iterator domainIter=mDomains.begin();
- for(;domainIter!=mDomains.end();++domainIter)
- {
- am_domainID_t domainID;
- if((eCode=mReceiveInterface->registerDomain(*domainIter,domainID))!=E_OK)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::routingInterfacesReady error on registering domain, failed with"), DLT_INT(eCode));
- }
- domainIter->domainID=domainID;
- }
-
- //then sources
- std::vector<am_Source_s>::iterator sourceIter=mSources.begin();
- for(;sourceIter!=mSources.end();++sourceIter)
- {
- am_sourceID_t sourceID;
- //set the correct domainID
- sourceIter->domainID=mDomains[0].domainID;
- if((eCode=mReceiveInterface->registerSource(*sourceIter,sourceID))!=E_OK)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::routingInterfacesReady error on registering source, failed with"), DLT_INT(eCode));
- }
- }
-
- //sinks
- std::vector<am_Sink_s>::iterator sinkIter=mSinks.begin();
- for(;sinkIter!=mSinks.end();++sinkIter)
- {
- am_sinkID_t sinkID;
- //set the correct domainID
- sinkIter->domainID=mDomains[0].domainID;
- if((eCode=mReceiveInterface->registerSink(*sinkIter,sinkID))!=E_OK)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::routingInterfacesReady error on registering sink, failed with"), DLT_INT(eCode));
- }
- }
-
- //gateways
+ assert(mReceiveInterface!=0);
+ am_Error_e eCode;
+ //first register the domains
+ std::vector<am_Domain_s>::iterator domainIter = mDomains.begin();
+ for (; domainIter != mDomains.end(); ++domainIter)
+ {
+ am_domainID_t domainID;
+ if ((eCode = mReceiveInterface->registerDomain(*domainIter, domainID)) != E_OK)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::routingInterfacesReady error on registering domain, failed with"), DLT_INT(eCode));
+ }
+ domainIter->domainID = domainID;
+ }
+
+ //then sources
+ std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
+ for (; sourceIter != mSources.end(); ++sourceIter)
+ {
+ am_sourceID_t sourceID;
+ //set the correct domainID
+ sourceIter->domainID = mDomains[0].domainID;
+ if ((eCode = mReceiveInterface->registerSource(*sourceIter, sourceID)) != E_OK)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::routingInterfacesReady error on registering source, failed with"), DLT_INT(eCode));
+ }
+ }
+
+ //sinks
+ std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
+ for (; sinkIter != mSinks.end(); ++sinkIter)
+ {
+ am_sinkID_t sinkID;
+ //set the correct domainID
+ sinkIter->domainID = mDomains[0].domainID;
+ if ((eCode = mReceiveInterface->registerSink(*sinkIter, sinkID)) != E_OK)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::routingInterfacesReady error on registering sink, failed with"), DLT_INT(eCode));
+ }
+ }
+
+ //gateways
// std::vector<am_Gateway_s>::iterator gatewayIter=mGateways.begin();
// for(;gatewayIter!=mGateways.end();++gatewayIter)
// {
@@ -361,1011 +348,883 @@ void AsyncRoutingSender::routingInterfacesReady()
// gatewayIter->gatewayID=gatewayID;
// }
- //create thread for interrupts, but only if we are testing - otherwise we get 100% cpu load:
- //todo: find a solution for the 100% dbus load to uncomment this and make interrupt tests work
- //pthread_create(&mInterruptThread,NULL,&AsyncRoutingSender::InterruptEvents,&mShadow);
+ //create thread for interrupts, but only if we are testing - otherwise we get 100% cpu load:
+ //todo: find a solution for the 100% dbus load to uncomment this and make interrupt tests work
+ //pthread_create(&mInterruptThread,NULL,&AsyncRoutingSender::InterruptEvents,&mShadow);
}
void AsyncRoutingSender::routingInterfacesRundown()
{
- assert(mReceiveInterface!=0);
+ assert(mReceiveInterface!=0);
}
-
-
am_Error_e AsyncRoutingSender::asyncAbort(const am_Handle_s handle)
{
- assert(mReceiveInterface!=0);
- assert(handle.handle!=0);
-
- //first check if we know the handle
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- std::map<uint16_t,int16_t>::iterator iter=mMapHandleWorker.begin();
- if(mMapHandleWorker.find(handle.handle)==mMapHandleWorker.end())
- {
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
- return (E_NON_EXISTENT);
- }
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
+ assert(mReceiveInterface!=0);
+ assert(handle.handle!=0);
+ //first check if we know the handle
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ std::map<uint16_t, int16_t>::iterator iter = mMapHandleWorker.begin();
+ if (mMapHandleWorker.find(handle.handle) == mMapHandleWorker.end())
+ {
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
+ return (E_NON_EXISTENT);
+ }
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
- //ok, cancel the action:
- if(mPool.cancelWork(iter->second)) return (E_OK);
- return (E_UNKNOWN);
+ //ok, cancel the action:
+ if (mPool.cancelWork(iter->second)) return (E_OK);
+ return (E_UNKNOWN);
}
-
-
am_Error_e AsyncRoutingSender::asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
{
- assert(mReceiveInterface!=0);
- assert(handle.handle!=0);
- assert(handle.handleType==H_CONNECT);
- assert(connectionID!=0);
- assert(sinkID!=0);
- assert(sourceID!=0);
-
- //check if we can take the job
- am_Sink_s sink;
- am_Source_s source;
- int16_t work=-1;
-
- //find the sink
- std::vector<am_Sink_s>::iterator sinkIter=mSinks.begin();
- for(;sinkIter!=mSinks.end();++sinkIter)
- {
- if(sinkIter->sinkID==sinkID)
- {
- sink=*sinkIter;
- break;
- }
- }
- if (sinkIter==mSinks.end()) return (E_NON_EXISTENT); //not found!
-
- //find the source
- std::vector<am_Source_s>::iterator sourceIter=mSources.begin();
- for(;sourceIter!=mSources.end();++sourceIter)
- {
- if(sourceIter->sourceID==sourceID)
- {
- source=*sourceIter;
- break;
- }
- }
- 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);
-
- //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);
- if((work=mPool.startWork(worker))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncConnect not enough threads!"));
- delete worker;
- return (E_NOT_POSSIBLE);
- }
-
- //save the handle related to the workerID
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- mMapHandleWorker.insert(std::make_pair(handle.handle,work));
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
-
- return (E_OK);
+ assert(mReceiveInterface!=0);
+ assert(handle.handle!=0);
+ assert(handle.handleType==H_CONNECT);
+ assert(connectionID!=0);
+ assert(sinkID!=0);
+ assert(sourceID!=0);
+
+ //check if we can take the job
+ am_Sink_s sink;
+ am_Source_s source;
+ int16_t work = -1;
+
+ //find the sink
+ std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
+ for (; sinkIter != mSinks.end(); ++sinkIter)
+ {
+ if (sinkIter->sinkID == sinkID)
+ {
+ sink = *sinkIter;
+ break;
+ }
+ }
+ if (sinkIter == mSinks.end()) return (E_NON_EXISTENT); //not found!
+
+ //find the source
+ std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
+ for (; sourceIter != mSources.end(); ++sourceIter)
+ {
+ if (sourceIter->sourceID == sourceID)
+ {
+ source = *sourceIter;
+ break;
+ }
+ }
+ 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);
+
+ //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);
+ if ((work = mPool.startWork(worker)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncConnect not enough threads!"));
+ delete worker;
+ return (E_NOT_POSSIBLE);
+ }
+
+ //save the handle related to the workerID
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ mMapHandleWorker.insert(std::make_pair(handle.handle, work));
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
+
+ return (E_OK);
}
-
-
am_Error_e AsyncRoutingSender::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID)
{
- assert(mReceiveInterface!=0);
- assert(handle.handle!=0);
- assert(handle.handleType==H_DISCONNECT);
- assert(connectionID!=0);
+ assert(mReceiveInterface!=0);
+ assert(handle.handle!=0);
+ assert(handle.handleType==H_DISCONNECT);
+ assert(connectionID!=0);
- //check if we can take the job
- int16_t work=-1;
+ //check if we can take the job
+ int16_t work = -1;
- pthread_mutex_lock(&mMapConnectionMutex);
- if (mMapConnectionIDRoute.find(connectionID)==mMapConnectionIDRoute.end())
- {
- pthread_mutex_unlock(&mMapConnectionMutex);
- return (E_NON_EXISTENT);
- }
- pthread_mutex_unlock(&mMapConnectionMutex);
+ pthread_mutex_lock(&mMapConnectionMutex);
+ if (mMapConnectionIDRoute.find(connectionID) == mMapConnectionIDRoute.end())
+ {
+ pthread_mutex_unlock(&mMapConnectionMutex);
+ return (E_NON_EXISTENT);
+ }
+ pthread_mutex_unlock(&mMapConnectionMutex);
- //the operation is ok, lets create a worker, assign it to a task in the task pool
- asycDisConnectWorker *worker=new asycDisConnectWorker(this,&mPool,&mShadow,handle,connectionID);
- if((work=mPool.startWork(worker))==-1)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncDisconnect not enough threads!"));
- delete worker;
- return (E_NOT_POSSIBLE);
- }
+ //the operation is ok, lets create a worker, assign it to a task in the task pool
+ asycDisConnectWorker *worker = new asycDisConnectWorker(this, &mPool, &mShadow, handle, connectionID);
+ if ((work = mPool.startWork(worker)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncDisconnect not enough threads!"));
+ delete worker;
+ return (E_NOT_POSSIBLE);
+ }
- //save the handle related to the workerID
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- mMapHandleWorker.insert(std::make_pair(handle.handle,work));
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
+ //save the handle related to the workerID
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ mMapHandleWorker.insert(std::make_pair(handle.handle, work));
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
- return (E_OK);
+ return (E_OK);
}
-
-
am_Error_e AsyncRoutingSender::asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
- assert(mReceiveInterface!=0);
- assert(handle.handle!=0);
- assert(handle.handleType==H_SETSINKVOLUME);
- assert(sinkID!=0);
-
- //check if we can take the job
- am_Sink_s sink;
- int16_t work=-1;
-
- //find the sink
- pthread_mutex_lock(&mSinksMutex);
- std::vector<am_Sink_s>::iterator sinkIter=mSinks.begin();
- for(;sinkIter!=mSinks.end();++sinkIter)
- {
- if(sinkIter->sinkID==sinkID)
- {
- sink=*sinkIter;
- break;
- }
- }
- pthread_mutex_unlock(&mSinksMutex);
- 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)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSinkVolume not enough threads!"));
- delete worker;
- return (E_NOT_POSSIBLE);
- }
-
- //save the handle related to the workerID
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- mMapHandleWorker.insert(std::make_pair(handle.handle,work));
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
-
- return (E_OK);
+ assert(mReceiveInterface!=0);
+ assert(handle.handle!=0);
+ assert(handle.handleType==H_SETSINKVOLUME);
+ assert(sinkID!=0);
+
+ //check if we can take the job
+ am_Sink_s sink;
+ int16_t work = -1;
+
+ //find the sink
+ pthread_mutex_lock(&mSinksMutex);
+ std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
+ for (; sinkIter != mSinks.end(); ++sinkIter)
+ {
+ if (sinkIter->sinkID == sinkID)
+ {
+ sink = *sinkIter;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mSinksMutex);
+ 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)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSinkVolume not enough threads!"));
+ delete worker;
+ return (E_NOT_POSSIBLE);
+ }
+
+ //save the handle related to the workerID
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ mMapHandleWorker.insert(std::make_pair(handle.handle, work));
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
+
+ return (E_OK);
}
-
-
am_Error_e AsyncRoutingSender::asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
- assert(mReceiveInterface!=0);
- assert(handle.handle!=0);
- assert(handle.handleType==H_SETSOURCEVOLUME);
- assert(sourceID!=0);
-
- //check if we can take the job
- am_Source_s source;
- int16_t work=-1;
-
- //find the sink
- pthread_mutex_lock(&mSourcesMutex);
- std::vector<am_Source_s>::iterator sourceIter=mSources.begin();
- for(;sourceIter!=mSources.end();++sourceIter)
- {
- if(sourceIter->sourceID==sourceID)
- {
- source=*sourceIter;
- break;
- }
- }
- pthread_mutex_unlock(&mSourcesMutex);
- 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)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSourceVolume not enough threads!"));
- delete worker;
- return (E_NOT_POSSIBLE);
- }
-
- //save the handle related to the workerID
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- mMapHandleWorker.insert(std::make_pair(handle.handle,work));
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
-
- return (E_OK);
+ assert(mReceiveInterface!=0);
+ assert(handle.handle!=0);
+ assert(handle.handleType==H_SETSOURCEVOLUME);
+ assert(sourceID!=0);
+
+ //check if we can take the job
+ am_Source_s source;
+ int16_t work = -1;
+
+ //find the sink
+ pthread_mutex_lock(&mSourcesMutex);
+ std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
+ for (; sourceIter != mSources.end(); ++sourceIter)
+ {
+ if (sourceIter->sourceID == sourceID)
+ {
+ source = *sourceIter;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mSourcesMutex);
+ 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)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSourceVolume not enough threads!"));
+ delete worker;
+ return (E_NOT_POSSIBLE);
+ }
+
+ //save the handle related to the workerID
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ mMapHandleWorker.insert(std::make_pair(handle.handle, work));
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
+
+ return (E_OK);
}
-
-
am_Error_e AsyncRoutingSender::asyncSetSourceState(const am_Handle_s handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
- assert(mReceiveInterface!=0);
- assert(handle.handle!=0);
- assert(handle.handleType==H_SETSOURCESTATE);
- assert(sourceID!=0);
-
- //check if we can take the job
- am_Source_s source;
- int16_t work=-1;
-
- //find the source
- pthread_mutex_lock(&mSourcesMutex);
- std::vector<am_Source_s>::iterator sourceIter=mSources.begin();
- for(;sourceIter!=mSources.end();++sourceIter)
- {
- if(sourceIter->sourceID==sourceID)
- {
- source=*sourceIter;
- break;
- }
- }
- pthread_mutex_unlock(&mSourcesMutex);
- 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)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSourceState not enough threads!"));
- delete worker;
- return (E_NOT_POSSIBLE);
- }
-
- //save the handle related to the workerID
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- mMapHandleWorker.insert(std::make_pair(handle.handle,work));
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
-
- return (E_OK);
+ assert(mReceiveInterface!=0);
+ assert(handle.handle!=0);
+ assert(handle.handleType==H_SETSOURCESTATE);
+ assert(sourceID!=0);
+
+ //check if we can take the job
+ am_Source_s source;
+ int16_t work = -1;
+
+ //find the source
+ pthread_mutex_lock(&mSourcesMutex);
+ std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
+ for (; sourceIter != mSources.end(); ++sourceIter)
+ {
+ if (sourceIter->sourceID == sourceID)
+ {
+ source = *sourceIter;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mSourcesMutex);
+ 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)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSourceState not enough threads!"));
+ delete worker;
+ return (E_NOT_POSSIBLE);
+ }
+
+ //save the handle related to the workerID
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ mMapHandleWorker.insert(std::make_pair(handle.handle, work));
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
+
+ return (E_OK);
}
-
am_Error_e AsyncRoutingSender::asyncSetSinkSoundProperty(const am_Handle_s handle, const am_SoundProperty_s& soundProperty, const am_sinkID_t sinkID)
{
- assert(mReceiveInterface!=0);
- assert(handle.handle!=0);
- assert(handle.handleType==H_SETSINKSOUNDPROPERTY);
- assert(sinkID!=0);
-
- //check if we can take the job
- am_Sink_s sink;
- int16_t work=-1;
-
- //find the sink
- pthread_mutex_lock(&mSinksMutex);
- std::vector<am_Sink_s>::iterator sinkIter=mSinks.begin();
- for(;sinkIter!=mSinks.end();++sinkIter)
- {
- if(sinkIter->sinkID==sinkID)
- {
- sink=*sinkIter;
- break;
- }
- }
- pthread_mutex_unlock(&mSinksMutex);
- 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)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSinkSoundProperty not enough threads!"));
- delete worker;
- return (E_NOT_POSSIBLE);
- }
-
- //save the handle related to the workerID
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- mMapHandleWorker.insert(std::make_pair(handle.handle,work));
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
-
- return (E_OK);
+ assert(mReceiveInterface!=0);
+ assert(handle.handle!=0);
+ assert(handle.handleType==H_SETSINKSOUNDPROPERTY);
+ assert(sinkID!=0);
+
+ //check if we can take the job
+ am_Sink_s sink;
+ int16_t work = -1;
+
+ //find the sink
+ pthread_mutex_lock(&mSinksMutex);
+ std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
+ for (; sinkIter != mSinks.end(); ++sinkIter)
+ {
+ if (sinkIter->sinkID == sinkID)
+ {
+ sink = *sinkIter;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mSinksMutex);
+ 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)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSinkSoundProperty not enough threads!"));
+ delete worker;
+ return (E_NOT_POSSIBLE);
+ }
+
+ //save the handle related to the workerID
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ mMapHandleWorker.insert(std::make_pair(handle.handle, work));
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
+
+ return (E_OK);
}
-
am_Error_e AsyncRoutingSender::asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
{
- //todo: implement crossfader
- return E_NOT_USED;
+ //todo: implement crossfader
+ return E_NOT_USED;
}
-
-
am_Error_e AsyncRoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- assert(mReceiveInterface!=0);
- assert(domainID!=0);
+ assert(mReceiveInterface!=0);
+ assert(domainID!=0);
- //check if we can take the job
- am_Domain_s domain;
- int16_t work=-1;
+ //check if we can take the job
+ am_Domain_s domain;
+ int16_t work = -1;
- //find the sink
- pthread_mutex_lock(&mDomainsMutex);
- std::vector<am_Domain_s>::iterator domainIter=mDomains.begin();
- for(;domainIter!=mDomains.end();++domainIter)
- {
- if(domainIter->domainID==domainID)
- {
- domain=*domainIter;
- break;
- }
- }
- pthread_mutex_unlock(&mDomainsMutex);
- if (domainIter==mDomains.end()) return (E_NON_EXISTENT); //not found!
+ //find the sink
+ pthread_mutex_lock(&mDomainsMutex);
+ std::vector<am_Domain_s>::iterator domainIter = mDomains.begin();
+ for (; domainIter != mDomains.end(); ++domainIter)
+ {
+ if (domainIter->domainID == domainID)
+ {
+ domain = *domainIter;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mDomainsMutex);
+ 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)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::setDomainState not enough threads!"));
- delete worker;
- return (E_NOT_POSSIBLE);
- }
+ asyncDomainStateChangeWorker *worker = new asyncDomainStateChangeWorker(this, &mPool, &mShadow, domainID, domainState);
+ if ((work = mPool.startWork(worker)) == -1)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::setDomainState not enough threads!"));
+ delete worker;
+ return (E_NOT_POSSIBLE);
+ }
- return (E_OK);
+ return (E_OK);
}
-
-
am_Error_e AsyncRoutingSender::asyncSetSourceSoundProperty(const am_Handle_s handle, const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
- assert(mReceiveInterface!=0);
- assert(handle.handle!=0);
- assert(handle.handleType==H_SETSOURCESOUNDPROPERTY);
- assert(sourceID!=0);
-
- //check if we can take the job
- am_Source_s source;
- int16_t work=-1;
-
- //find the source
- pthread_mutex_lock(&mSourcesMutex);
- std::vector<am_Source_s>::iterator sourceIter=mSources.begin();
- for(;sourceIter!=mSources.end();++sourceIter)
- {
- if(sourceIter->sourceID==sourceID)
- {
- source=*sourceIter;
- break;
- }
- }
- pthread_mutex_unlock(&mSourcesMutex);
- 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)
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSourceState not enough threads!"));
- delete worker;
- return (E_NOT_POSSIBLE);
- }
-
- //save the handle related to the workerID
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- mMapHandleWorker.insert(std::make_pair(handle.handle,work));
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
-
- return (E_OK);
+ assert(mReceiveInterface!=0);
+ assert(handle.handle!=0);
+ assert(handle.handleType==H_SETSOURCESOUNDPROPERTY);
+ assert(sourceID!=0);
+
+ //check if we can take the job
+ am_Source_s source;
+ int16_t work = -1;
+
+ //find the source
+ pthread_mutex_lock(&mSourcesMutex);
+ std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
+ for (; sourceIter != mSources.end(); ++sourceIter)
+ {
+ if (sourceIter->sourceID == sourceID)
+ {
+ source = *sourceIter;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mSourcesMutex);
+ 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)
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::asyncSetSourceState not enough threads!"));
+ delete worker;
+ return (E_NOT_POSSIBLE);
+ }
+
+ //save the handle related to the workerID
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ mMapHandleWorker.insert(std::make_pair(handle.handle, work));
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
+
+ return (E_OK);
}
-
-
am_Error_e AsyncRoutingSender::returnBusName(std::string & BusName) const
{
- BusName="RoutingAsync";
- return (E_OK);
+ BusName = "RoutingAsync";
+ return (E_OK);
}
std::vector<am_Domain_s> AsyncRoutingSender::createDomainTable()
{
- //just write two domains into the table and return it
- std::vector<am_Domain_s> table;
- am_Domain_s item;
- item.busname="RoutingAsync";
- item.domainID=0;
- item.early=false;
- item.name="AsyncDomain1";
- item.nodename="AsyncNode1";
- item.state=DS_CONTROLLED;
- table.push_back(item);
- item.busname="RoutingAsync";
- item.domainID=0;
- item.early=false;
- item.name="AsyncDomain2";
- item.nodename="AsyncNode2";
- item.state=DS_CONTROLLED;
- table.push_back(item);
- return (table);
+ //just write two domains into the table and return it
+ std::vector<am_Domain_s> table;
+ am_Domain_s item;
+ item.busname = "RoutingAsync";
+ item.domainID = 0;
+ item.early = false;
+ item.name = "AsyncDomain1";
+ item.nodename = "AsyncNode1";
+ item.state = DS_CONTROLLED;
+ table.push_back(item);
+ item.busname = "RoutingAsync";
+ item.domainID = 0;
+ item.early = false;
+ item.name = "AsyncDomain2";
+ item.nodename = "AsyncNode2";
+ item.state = DS_CONTROLLED;
+ table.push_back(item);
+ return (table);
}
-
-
std::vector<am_Sink_s> AsyncRoutingSender::createSinkTable()
{
- //create a bunch full of sinks
- std::vector<am_Sink_s> table;
- am_Sink_s item;
- am_SoundProperty_s sp;
- sp.type=SP_BASS;
- sp.value=0;
- for (int16_t i=0;i<=10;i++)
- {
- std::stringstream temp;
- temp<<i;
- 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.sinkClassID=1;
- item.volume=0;
- item.listSoundProperties.push_back(sp);
- item.visible=true;
- item.listConnectionFormats.push_back(CF_ANALOG);
- table.push_back(item);
- }
- return (table);
+ //create a bunch full of sinks
+ std::vector<am_Sink_s> table;
+ am_Sink_s item;
+ am_SoundProperty_s sp;
+ sp.type = SP_BASS;
+ sp.value = 0;
+ for (int16_t i = 0; i <= 10; i++)
+ {
+ std::stringstream temp;
+ temp << i;
+ 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.sinkClassID = 1;
+ item.volume = 0;
+ item.listSoundProperties.push_back(sp);
+ item.visible = true;
+ item.listConnectionFormats.push_back(CF_ANALOG);
+ table.push_back(item);
+ }
+ return (table);
}
-
-
std::vector<am_Source_s> AsyncRoutingSender::createSourceTable()
{
- //create a bunch full of sources
- std::vector<am_Source_s> table;
- am_Source_s item;
- for (int16_t i=0;i<=10;i++)
- {
- std::stringstream temp;
- temp<<i;
- 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.sourceClassID=1;
- item.volume=0;
- item.visible=true;
- item.listConnectionFormats.push_back(CF_ANALOG);
- table.push_back(item);
- }
- return (table);
+ //create a bunch full of sources
+ std::vector<am_Source_s> table;
+ am_Source_s item;
+ for (int16_t i = 0; i <= 10; i++)
+ {
+ std::stringstream temp;
+ temp << i;
+ 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.sourceClassID = 1;
+ item.volume = 0;
+ item.visible = true;
+ item.listConnectionFormats.push_back(CF_ANALOG);
+ table.push_back(item);
+ }
+ return (table);
}
void AsyncRoutingSender::insertConnectionSafe(am_connectionID_t connectionID, am_RoutingElement_s route)
{
- pthread_mutex_lock(&mMapConnectionMutex);
- mMapConnectionIDRoute.insert(std::make_pair(connectionID,route));
- pthread_mutex_unlock(&mMapConnectionMutex);
+ pthread_mutex_lock(&mMapConnectionMutex);
+ mMapConnectionIDRoute.insert(std::make_pair(connectionID, route));
+ pthread_mutex_unlock(&mMapConnectionMutex);
}
void AsyncRoutingSender::removeHandleSafe(uint16_t handle)
{
- pthread_mutex_lock(&mMapHandleWorkerMutex);
- if (mMapHandleWorker.erase(handle))
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::removeHandle could not remove handle"));
- }
- pthread_mutex_unlock(&mMapHandleWorkerMutex);
+ pthread_mutex_lock(&mMapHandleWorkerMutex);
+ if (mMapHandleWorker.erase(handle))
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::removeHandle could not remove handle"));
+ }
+ pthread_mutex_unlock(&mMapHandleWorkerMutex);
}
void AsyncRoutingSender::removeConnectionSafe(am_connectionID_t connectionID)
{
- pthread_mutex_lock(&mMapConnectionMutex);
- if (mMapConnectionIDRoute.erase(connectionID))
- {
- DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::removeConnectionSafe could not remove connection"));
- }
- pthread_mutex_unlock(&mMapConnectionMutex);
+ pthread_mutex_lock(&mMapConnectionMutex);
+ if (mMapConnectionIDRoute.erase(connectionID))
+ {
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_ERROR, DLT_STRING("AsyncRoutingSender::removeConnectionSafe could not remove connection"));
+ }
+ pthread_mutex_unlock(&mMapConnectionMutex);
}
void AsyncRoutingSender::updateSinkVolumeSafe(am_sinkID_t sinkID, am_volume_t volume)
{
- pthread_mutex_lock(&mSinksMutex);
- std::vector<am_Sink_s>::iterator sinkIter=mSinks.begin();
- for(;sinkIter!=mSinks.end();++sinkIter)
- {
- if(sinkIter->sinkID==sinkID)
- {
- sinkIter->volume=volume;
- break;
- }
- }
- pthread_mutex_unlock(&mSinksMutex);
+ pthread_mutex_lock(&mSinksMutex);
+ std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
+ for (; sinkIter != mSinks.end(); ++sinkIter)
+ {
+ if (sinkIter->sinkID == sinkID)
+ {
+ sinkIter->volume = volume;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mSinksMutex);
}
void am::AsyncRoutingSender::updateSourceVolumeSafe(am_sourceID_t sourceID, am_volume_t volume)
{
- pthread_mutex_lock(&mSourcesMutex);
- std::vector<am_Source_s>::iterator sourceIter=mSources.begin();
- for(;sourceIter!=mSources.end();++sourceIter)
- {
- if(sourceIter->sourceID==sourceID)
- {
- sourceIter->volume=volume;
- break;
- }
- }
- pthread_mutex_unlock(&mSourcesMutex);
+ pthread_mutex_lock(&mSourcesMutex);
+ std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
+ for (; sourceIter != mSources.end(); ++sourceIter)
+ {
+ if (sourceIter->sourceID == sourceID)
+ {
+ sourceIter->volume = volume;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mSourcesMutex);
}
void am::AsyncRoutingSender::updateSourceStateSafe(am_sourceID_t sourceID, am_SourceState_e state)
{
- pthread_mutex_lock(&mSourcesMutex);
- std::vector<am_Source_s>::iterator sourceIter=mSources.begin();
- for(;sourceIter!=mSources.end();++sourceIter)
- {
- if(sourceIter->sourceID==sourceID)
- {
- sourceIter->sourceState=state;
- break;
- }
- }
- pthread_mutex_unlock(&mSourcesMutex);
+ pthread_mutex_lock(&mSourcesMutex);
+ std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
+ for (; sourceIter != mSources.end(); ++sourceIter)
+ {
+ if (sourceIter->sourceID == sourceID)
+ {
+ sourceIter->sourceState = state;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mSourcesMutex);
}
void am::AsyncRoutingSender::updateSinkSoundPropertySafe(am_sinkID_t sinkID, am_SoundProperty_s soundProperty)
{
- pthread_mutex_lock(&mSinksMutex);
- std::vector<am_Sink_s>::iterator sinkIter=mSinks.begin();
- for(;sinkIter!=mSinks.end();++sinkIter)
- {
- if(sinkIter->sinkID==sinkID)
- {
- std::vector<am_SoundProperty_s>::iterator spIterator=sinkIter->listSoundProperties.begin();
- for(;spIterator!=sinkIter->listSoundProperties.end();++spIterator)
- {
- if(spIterator->type==soundProperty.type)
- {
- spIterator->value=soundProperty.value;
- break;
- }
- }
- }
- }
- pthread_mutex_unlock(&mSinksMutex);
+ pthread_mutex_lock(&mSinksMutex);
+ std::vector<am_Sink_s>::iterator sinkIter = mSinks.begin();
+ for (; sinkIter != mSinks.end(); ++sinkIter)
+ {
+ if (sinkIter->sinkID == sinkID)
+ {
+ std::vector<am_SoundProperty_s>::iterator spIterator = sinkIter->listSoundProperties.begin();
+ for (; spIterator != sinkIter->listSoundProperties.end(); ++spIterator)
+ {
+ if (spIterator->type == soundProperty.type)
+ {
+ spIterator->value = soundProperty.value;
+ break;
+ }
+ }
+ }
+ }
+ pthread_mutex_unlock(&mSinksMutex);
}
void am::AsyncRoutingSender::updateSourceSoundPropertySafe(am_sourceID_t sourceID, am_SoundProperty_s soundProperty)
{
- pthread_mutex_lock(&mSourcesMutex);
- std::vector<am_Source_s>::iterator sourceIter=mSources.begin();
- for(;sourceIter!=mSources.end();++sourceIter)
- {
- if(sourceIter->sourceID==sourceID)
- {
- std::vector<am_SoundProperty_s>::iterator spIterator=sourceIter->listSoundProperties.begin();
- for(;spIterator!=sourceIter->listSoundProperties.end();++spIterator)
- {
- if(spIterator->type==soundProperty.type)
- {
- spIterator->value=soundProperty.value;
- break;
- }
- }
- }
- }
- pthread_mutex_unlock(&mSourcesMutex);
+ pthread_mutex_lock(&mSourcesMutex);
+ std::vector<am_Source_s>::iterator sourceIter = mSources.begin();
+ for (; sourceIter != mSources.end(); ++sourceIter)
+ {
+ if (sourceIter->sourceID == sourceID)
+ {
+ std::vector<am_SoundProperty_s>::iterator spIterator = sourceIter->listSoundProperties.begin();
+ for (; spIterator != sourceIter->listSoundProperties.end(); ++spIterator)
+ {
+ if (spIterator->type == soundProperty.type)
+ {
+ spIterator->value = soundProperty.value;
+ break;
+ }
+ }
+ }
+ }
+ pthread_mutex_unlock(&mSourcesMutex);
}
void am::AsyncRoutingSender::updateDomainstateSafe(am_domainID_t domainID, am_DomainState_e domainState)
{
- pthread_mutex_lock(&mDomainsMutex);
- std::vector<am_Domain_s>::iterator domainIter=mDomains.begin();
- for(;domainIter!=mDomains.end();++domainIter)
- {
- if(domainIter->domainID==domainID)
- {
- domainIter->state=domainState;
- break;
- }
- }
- pthread_mutex_unlock(&mDomainsMutex);
+ pthread_mutex_lock(&mDomainsMutex);
+ std::vector<am_Domain_s>::iterator domainIter = mDomains.begin();
+ for (; domainIter != mDomains.end(); ++domainIter)
+ {
+ if (domainIter->domainID == domainID)
+ {
+ domainIter->state = domainState;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mDomainsMutex);
}
uint16_t AsyncRoutingSender::getInterfaceVersion() const
{
- return (RoutingSendVersion);
+ 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)
{
- //todo: implement
+ //todo: implement
}
am_Error_e am::AsyncRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s handle, const std::vector<am_SoundProperty_s> & listSoundProperties, const am_sourceID_t sourceID)
{
- //todo: implement
+ //todo: implement
}
std::vector<am_Gateway_s> AsyncRoutingSender::createGatewayTable()
{
- std::vector<am_Gateway_s> table;
- am_Gateway_s item;
- item.name="myGateway";
- item.sinkID=2;
- item.sourceID=2;
- table.push_back(item);
- return (table);
+ std::vector<am_Gateway_s> table;
+ am_Gateway_s item;
+ item.name = "myGateway";
+ item.sinkID = 2;
+ item.sourceID = 2;
+ table.push_back(item);
+ return (table);
}
-
-asycConnectWorker::asycConnectWorker(AsyncRoutingSender * asyncSender,WorkerThreadPool *pool, RoutingReceiverAsyncShadow* shadow, const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
- :Worker(pool),
- mAsyncSender(asyncSender),
- mShadow(shadow),
- mHandle(handle),
- mConnectionID(connectionID),
- mSourceID(sourceID),
- mSinkID(sinkID),
- mConnectionFormat(connectionFormat)
+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)
{
}
void asycConnectWorker::start2work()
{
- DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("Start connecting"));
- timespec t;
- t.tv_nsec=0;
- t.tv_sec=1;
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start connecting"));
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 1;
- //do something for one second
- if (timedWait(t)) return;
- am_RoutingElement_s route;
- route.sinkID=mSinkID;
- route.sourceID=mSourceID;
- route.connectionFormat=mConnectionFormat;
+ //do something for one second
+ if (timedWait(t)) return;
+ am_RoutingElement_s route;
+ route.sinkID = mSinkID;
+ route.sourceID = mSourceID;
+ route.connectionFormat = mConnectionFormat;
- //enter new connectionID into the list
- mAsyncSender->insertConnectionSafe(mConnectionID,route);
+ //enter new connectionID into the list
+ mAsyncSender->insertConnectionSafe(mConnectionID, route);
- //send the ack
- mShadow->ackConnect(mHandle,mConnectionID,E_OK);
+ //send the ack
+ mShadow->ackConnect(mHandle, mConnectionID, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ mAsyncSender->removeHandleSafe(mHandle.handle);
}
void asycConnectWorker::cancelWork()
{
- mAsyncSender->removeHandleSafe(mHandle.handle);
- mShadow->ackConnect(mHandle,mConnectionID,E_ABORTED);
+ mAsyncSender->removeHandleSafe(mHandle.handle);
+ mShadow->ackConnect(mHandle, mConnectionID, E_ABORTED);
}
-asycDisConnectWorker::asycDisConnectWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_Handle_s handle, const am_connectionID_t connectionID)
- :Worker(pool),
- mAsyncSender(asyncSender),
- mShadow(shadow),
- mHandle(handle),
- mConnectionID(connectionID)
+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)
{
}
-
void asycDisConnectWorker::start2work()
{
- DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("Start disconnecting"));
- timespec t;
- t.tv_nsec=0;
- t.tv_sec=1;
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start disconnecting"));
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 1;
- //do something for one second
- if (timedWait(t)) return;
- am_RoutingElement_s route;
+ //do something for one second
+ if (timedWait(t)) return;
+ am_RoutingElement_s route;
- //enter new connectionID into the list
- mAsyncSender->insertConnectionSafe(mConnectionID,route);
+ //enter new connectionID into the list
+ mAsyncSender->insertConnectionSafe(mConnectionID, route);
- //send the ack
- mShadow->ackDisconnect(mHandle,mConnectionID,E_OK);
+ //send the ack
+ mShadow->ackDisconnect(mHandle, mConnectionID, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ mAsyncSender->removeHandleSafe(mHandle.handle);
}
-
-
void asycDisConnectWorker::cancelWork()
{
- mAsyncSender->removeHandleSafe(mHandle.handle);
- mShadow->ackDisconnect(mHandle,mConnectionID,E_ABORTED);
+ mAsyncSender->removeHandleSafe(mHandle.handle);
+ mShadow->ackDisconnect(mHandle, mConnectionID, E_ABORTED);
}
-asyncSetSinkVolumeWorker::asyncSetSinkVolumeWorker(AsyncRoutingSender *asyncSender, WorkerThreadPool *pool, RoutingReceiverAsyncShadow *shadow, const am_volume_t currentVolume, const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
- :Worker(pool),
- mAsyncSender(asyncSender),
- mShadow(shadow),
- mCurrentVolume(currentVolume),
- mHandle(handle),
- mSinkID(sinkID),
- mVolume(volume),
- mRamp(ramp),
- mTime(time)
+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)
{
}
-
-
void asyncSetSinkVolumeWorker::start2work()
{
- //todo: this implementation does not respect time and ramp....
- DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("Start setting sink volume"));
- timespec t;
- t.tv_nsec=10000000;
- t.tv_sec=0;
+ //todo: this implementation does not respect time and ramp....
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting sink volume"));
+ timespec t;
+ t.tv_nsec = 10000000;
+ t.tv_sec = 0;
- while (mCurrentVolume!=mVolume)
- {
- if (mCurrentVolume<mVolume) mCurrentVolume++;
- else mCurrentVolume--;
- mShadow->ackSinkVolumeTick(mHandle,mSinkID,mCurrentVolume);
- if (timedWait(t)) return;
- }
+ while (mCurrentVolume != mVolume)
+ {
+ if (mCurrentVolume < mVolume)
+ mCurrentVolume++;
+ else
+ mCurrentVolume--;
+ mShadow->ackSinkVolumeTick(mHandle, mSinkID, mCurrentVolume);
+ if (timedWait(t)) return;
+ }
- //enter new connectionID into the list
- mAsyncSender->updateSinkVolumeSafe(mSinkID,mCurrentVolume);
+ //enter new connectionID into the list
+ mAsyncSender->updateSinkVolumeSafe(mSinkID, mCurrentVolume);
- //send the ack
- mShadow->ackSetSinkVolumeChange(mHandle,mCurrentVolume,E_OK);
+ //send the ack
+ mShadow->ackSetSinkVolumeChange(mHandle, mCurrentVolume, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ mAsyncSender->removeHandleSafe(mHandle.handle);
}
void asyncSetSinkVolumeWorker::cancelWork()
{
- mAsyncSender->updateSinkVolumeSafe(mSinkID,mCurrentVolume);
- mAsyncSender->removeHandleSafe(mHandle.handle);
- mShadow->ackSetSinkVolumeChange(mHandle,mCurrentVolume,E_ABORTED);
+ mAsyncSender->updateSinkVolumeSafe(mSinkID, mCurrentVolume);
+ mAsyncSender->removeHandleSafe(mHandle.handle);
+ 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)
+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)
{
}
void am::asyncSetSourceVolumeWorker::start2work()
{
- //todo: this implementation does not respect time and ramp....
- DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("Start setting source volume"));
- timespec t;
- t.tv_nsec=10000000;
- t.tv_sec=0;
+ //todo: this implementation does not respect time and ramp....
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting source volume"));
+ timespec t;
+ t.tv_nsec = 10000000;
+ t.tv_sec = 0;
- while (mCurrentVolume!=mVolume)
- {
- if (mCurrentVolume<mVolume) mCurrentVolume++;
- else mCurrentVolume--;
- mShadow->ackSourceVolumeTick(mHandle,mSourceID,mCurrentVolume);
- if (timedWait(t)) return;
- }
+ while (mCurrentVolume != mVolume)
+ {
+ if (mCurrentVolume < mVolume)
+ mCurrentVolume++;
+ else
+ mCurrentVolume--;
+ mShadow->ackSourceVolumeTick(mHandle, mSourceID, mCurrentVolume);
+ if (timedWait(t)) return;
+ }
- //enter new connectionID into the list
- mAsyncSender->updateSourceVolumeSafe(mSourceID,mCurrentVolume);
+ //enter new connectionID into the list
+ mAsyncSender->updateSourceVolumeSafe(mSourceID, mCurrentVolume);
- //send the ack
- mShadow->ackSetSourceVolumeChange(mHandle,mCurrentVolume,E_OK);
+ //send the ack
+ mShadow->ackSetSourceVolumeChange(mHandle, mCurrentVolume, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ mAsyncSender->removeHandleSafe(mHandle.handle);
}
-
-
void am::asyncSetSourceVolumeWorker::cancelWork()
{
- mAsyncSender->updateSourceVolumeSafe(mSourceID,mCurrentVolume);
- mAsyncSender->removeHandleSafe(mHandle.handle);
- mShadow->ackSetSourceVolumeChange(mHandle,mCurrentVolume,E_ABORTED);
+ 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)
+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)
{
}
-
-
void am::asyncSetSourceStateWorker::start2work()
{
- DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("Start setting source state"));
- timespec t;
- t.tv_nsec=0;
- t.tv_sec=1;
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting source state"));
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 1;
- //do something for one second
- if (timedWait(t)) return;
+ //do something for one second
+ if (timedWait(t)) return;
- //enter new connectionID into the list
- mAsyncSender->updateSourceStateSafe(mSourceID,mSourcestate);
+ //enter new connectionID into the list
+ mAsyncSender->updateSourceStateSafe(mSourceID, mSourcestate);
- //send the ack
- mShadow->ackSetSourceState(mHandle,E_OK);
+ //send the ack
+ mShadow->ackSetSourceState(mHandle, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ mAsyncSender->removeHandleSafe(mHandle.handle);
}
-
-
void am::asyncSetSourceStateWorker::cancelWork()
{
- //send the ack
- mShadow->ackSetSourceState(mHandle,E_ABORTED);
+ //send the ack
+ mShadow->ackSetSourceState(mHandle, E_ABORTED);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ 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)
+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)
{
}
-
-
void am::asyncSetSinkSoundPropertyWorker::start2work()
{
- DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("Start setting sink sound property"));
- timespec t;
- t.tv_nsec=0;
- t.tv_sec=1;
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting sink sound property"));
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 1;
- //do something for one second
- if (timedWait(t)) return;
+ //do something for one second
+ if (timedWait(t)) return;
- //enter new connectionID into the list
- mAsyncSender->updateSinkSoundPropertySafe(mSinkID,mSoundProperty);
+ //enter new connectionID into the list
+ mAsyncSender->updateSinkSoundPropertySafe(mSinkID, mSoundProperty);
- //send the ack
- mShadow->ackSetSinkSoundProperty(mHandle,E_OK);
+ //send the ack
+ mShadow->ackSetSinkSoundProperty(mHandle, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ mAsyncSender->removeHandleSafe(mHandle.handle);
}
-
-
void am::asyncSetSinkSoundPropertyWorker::cancelWork()
{
- //send the ack
- mShadow->ackSetSinkSoundProperty(mHandle,E_OK);
+ //send the ack
+ mShadow->ackSetSinkSoundProperty(mHandle, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ 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)
+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)
{
}
-
-
void am::asyncSetSourceSoundPropertyWorker::start2work()
{
- DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("Start setting source sound property"));
- timespec t;
- t.tv_nsec=0;
- t.tv_sec=1;
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting source sound property"));
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 1;
- //do something for one second
- if (timedWait(t)) return;
+ //do something for one second
+ if (timedWait(t)) return;
- //enter new connectionID into the list
- mAsyncSender->updateSourceSoundPropertySafe(mSourceID,mSoundProperty);
+ //enter new connectionID into the list
+ mAsyncSender->updateSourceSoundPropertySafe(mSourceID, mSoundProperty);
- //send the ack
- mShadow->ackSetSourceSoundProperty(mHandle,E_OK);
+ //send the ack
+ mShadow->ackSetSourceSoundProperty(mHandle, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ mAsyncSender->removeHandleSafe(mHandle.handle);
}
-
-
void am::asyncSetSourceSoundPropertyWorker::cancelWork()
{
- //send the ack
- mShadow->ackSetSourceSoundProperty(mHandle,E_OK);
+ //send the ack
+ mShadow->ackSetSourceSoundProperty(mHandle, E_OK);
- //destroy the handle
- mAsyncSender->removeHandleSafe(mHandle.handle);
+ //destroy the handle
+ 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)
+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)
{
}
void am::asyncDomainStateChangeWorker::start2work()
{
- //todo: sendchanged data must be in here !
- DLT_LOG(PluginRoutingAsync,DLT_LOG_INFO, DLT_STRING("Start setting source sound property"));
- timespec t;
- t.tv_nsec=0;
- t.tv_sec=1;
-
+ //todo: sendchanged data must be in here !
+ DLT_LOG(PluginRoutingAsync, DLT_LOG_INFO, DLT_STRING("Start setting source sound property"));
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 1;
- //do something for one second
- if (timedWait(t)) return;
+ //do something for one second
+ if (timedWait(t)) return;
- //enter new connectionID into the list
- mAsyncSender->updateDomainstateSafe(mDomainID,mDomainState);
- mShadow->hookDomainStateChange(mDomainID,mDomainState);
- //send the new status
+ //enter new connectionID into the list
+ mAsyncSender->updateDomainstateSafe(mDomainID, mDomainState);
+ mShadow->hookDomainStateChange(mDomainID, mDomainState);
+ //send the new status
}
-
-
void am::asyncDomainStateChangeWorker::cancelWork()
{
- //send the new status
- mShadow->hookDomainStateChange(mDomainID,mDomainState);
+ //send the new status
+ mShadow->hookDomainStateChange(mDomainID, mDomainState);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp
index 2a331a6..512ef8f 100644
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp
+++ b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.cpp
@@ -1,46 +1,43 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file testRoutingItnerfaceAsync.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file testRoutingItnerfaceAsync.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 "testRoutingInterfaceAsync.h"
#include "config.h"
-
using namespace am;
using namespace testing;
-
DLT_DECLARE_CONTEXT(DLT_CONTEXT)
+std::vector<std::string> testRoutingInterfaceAsync::pListRoutingPluginDirs = returnListPlugins();
+am_domainID_t testRoutingInterfaceAsync::mDomainIDCount = 0;
+RoutingSender testRoutingInterfaceAsync::pRoutingSender = RoutingSender(pListRoutingPluginDirs);
-std::vector<std::string> testRoutingInterfaceAsync::pListRoutingPluginDirs=returnListPlugins();
-am_domainID_t testRoutingInterfaceAsync::mDomainIDCount=0;
-RoutingSender testRoutingInterfaceAsync::pRoutingSender=RoutingSender(pListRoutingPluginDirs);
-
-testRoutingInterfaceAsync::testRoutingInterfaceAsync()
- :pSocketHandler(),
- pReceiveInterface(),
- ptimerCallback(this, &testRoutingInterfaceAsync::timerCallback)
+testRoutingInterfaceAsync::testRoutingInterfaceAsync() :
+ pSocketHandler(), //
+ pReceiveInterface(), //
+ ptimerCallback(this, &testRoutingInterfaceAsync::timerCallback)
{
}
@@ -50,407 +47,403 @@ testRoutingInterfaceAsync::~testRoutingInterfaceAsync()
void testRoutingInterfaceAsync::SetUp()
{
- 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 "));
- std::vector<int> domainIDs;
- domainIDs.push_back(0);
- domainIDs.push_back(1);
+ std::vector<int> domainIDs;
+ domainIDs.push_back(0);
+ domainIDs.push_back(1);
- EXPECT_CALL(pReceiveInterface,getSocketHandler(_)).WillOnce(DoAll(SetArgReferee<0>(&pSocketHandler),Return(E_OK)));
- EXPECT_CALL(pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleDomainRegister));
- EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSourceRegister));
- EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSinkRegister));
+ EXPECT_CALL(pReceiveInterface,getSocketHandler(_)).WillOnce(DoAll(SetArgReferee<0>(&pSocketHandler), Return(E_OK)));
+ EXPECT_CALL(pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleDomainRegister));
+ EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSourceRegister));
+ EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSinkRegister));
- pRoutingSender.startupRoutingInterface(&pReceiveInterface);
- pRoutingSender.routingInterfacesReady();
+ pRoutingSender.startupRoutingInterface(&pReceiveInterface);
+ pRoutingSender.routingInterfacesReady();
- timespec t;
- t.tv_nsec=0;
- t.tv_sec=4;
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 4;
- sh_timerHandle_t handle;
+ sh_timerHandle_t handle;
- shTimerCallBack *buf=&ptimerCallback;
- //lets use a timeout so the test will finish
- pSocketHandler.addTimer(t,buf,handle,(void*)NULL);
+ shTimerCallBack *buf = &ptimerCallback;
+ //lets use a timeout so the test will finish
+ pSocketHandler.addTimer(t, buf, handle, (void*) NULL);
}
std::vector<std::string> am::testRoutingInterfaceAsync::returnListPlugins()
{
- std::vector<std::string> list;
- list.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
- return (list);
+ std::vector<std::string> list;
+ list.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
+ return (list);
}
am_Error_e am::testRoutingInterfaceAsync::handleSourceRegister(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- sourceID=sourceData.sourceID;
- pRoutingSender.addSourceLookup(sourceData);
- return (E_OK);
+ sourceID = sourceData.sourceID;
+ pRoutingSender.addSourceLookup(sourceData);
+ return (E_OK);
}
am_Error_e am::testRoutingInterfaceAsync::handleSinkRegister(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- sinkID=sinkData.sinkID;
- pRoutingSender.addSinkLookup(sinkData);
- return(E_OK);
+ sinkID = sinkData.sinkID;
+ pRoutingSender.addSinkLookup(sinkData);
+ return (E_OK);
}
am_Error_e am::testRoutingInterfaceAsync::handleDomainRegister(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- am_Domain_s domain=domainData;
- domainID=mDomainIDCount++;
- domain.domainID=domainID;
- pRoutingSender.addDomainLookup(domain);
- return (E_OK);
+ am_Domain_s domain = domainData;
+ domainID = mDomainIDCount++;
+ domain.domainID = domainID;
+ pRoutingSender.addDomainLookup(domain);
+ return (E_OK);
}
void am::testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
{
- pSocketHandler.stop_listening();
+ pSocketHandler.stop_listening();
}
void testRoutingInterfaceAsync::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
-
TEST_F(testRoutingInterfaceAsync,setDomainState)
{
- am_domainID_t domainID=1;
- am_DomainState_e state=DS_INDEPENDENT_RUNDOWN;
+ am_domainID_t domainID = 1;
+ am_DomainState_e state = DS_INDEPENDENT_RUNDOWN;
- EXPECT_CALL(pReceiveInterface,hookDomainStateChange(_,DS_INDEPENDENT_RUNDOWN)).Times(1);
+ EXPECT_CALL(pReceiveInterface,hookDomainStateChange(_,DS_INDEPENDENT_RUNDOWN)).Times(1);
- ASSERT_EQ(E_OK,pRoutingSender.setDomainState(domainID,state));
- pSocketHandler.start_listenting();
+ ASSERT_EQ(E_OK, pRoutingSender.setDomainState(domainID,state));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,setSourceSoundProperty)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_SETSOURCESOUNDPROPERTY;
+ handle.handle = 1;
+ handle.handleType = H_SETSOURCESOUNDPROPERTY;
- am_sourceID_t sourceID=3;
- am_SoundProperty_s property;
- property.type=SP_MID;
- property.value=24;
+ am_sourceID_t sourceID = 3;
+ am_SoundProperty_s property;
+ property.type = SP_MID;
+ property.value = 24;
- EXPECT_CALL(pReceiveInterface,ackSetSourceSoundProperty(_,E_OK)).Times(1);
+ EXPECT_CALL(pReceiveInterface,ackSetSourceSoundProperty(_,E_OK)).Times(1);
- ASSERT_EQ(E_OK,pRoutingSender.asyncSetSourceSoundProperty(handle,sourceID,property));
- pSocketHandler.start_listenting();
+ ASSERT_EQ(E_OK, pRoutingSender.asyncSetSourceSoundProperty(handle,sourceID,property));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,setSinkSoundProperty)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_SETSINKSOUNDPROPERTY;
+ handle.handle = 1;
+ handle.handleType = H_SETSINKSOUNDPROPERTY;
- am_sinkID_t sinkID=1;
- am_SoundProperty_s property;
- property.type=SP_MID;
- property.value=24;
+ am_sinkID_t sinkID = 1;
+ am_SoundProperty_s property;
+ property.type = SP_MID;
+ property.value = 24;
- EXPECT_CALL(pReceiveInterface,ackSetSinkSoundProperty(_,E_OK)).Times(1);
+ EXPECT_CALL(pReceiveInterface,ackSetSinkSoundProperty(_,E_OK)).Times(1);
- ASSERT_EQ(E_OK,pRoutingSender.asyncSetSinkSoundProperty(handle,sinkID,property));
- pSocketHandler.start_listenting();
+ ASSERT_EQ(E_OK, pRoutingSender.asyncSetSinkSoundProperty(handle,sinkID,property));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,setSourceState)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_SETSOURCEVOLUME;
+ handle.handle = 1;
+ handle.handleType = H_SETSOURCEVOLUME;
- am_sourceID_t sourceID=1;
- am_SourceState_e state=SS_OFF;
+ am_sourceID_t sourceID = 1;
+ am_SourceState_e state = SS_OFF;
- EXPECT_CALL(pReceiveInterface,ackSetSourceState(_,E_OK)).Times(1);
+ EXPECT_CALL(pReceiveInterface,ackSetSourceState(_,E_OK)).Times(1);
- ASSERT_EQ(E_OK,pRoutingSender.asyncSetSourceState(handle,sourceID,state));
- pSocketHandler.start_listenting();
+ ASSERT_EQ(E_OK, pRoutingSender.asyncSetSourceState(handle,sourceID,state));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,setSourceVolume)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_SETSOURCEVOLUME;
+ handle.handle = 1;
+ handle.handleType = H_SETSOURCEVOLUME;
- am_sourceID_t sourceID=3;
- am_volume_t volume=3;
- am_RampType_e ramp=RAMP_DIRECT;
- am_time_t myTime=25;
+ am_sourceID_t sourceID = 3;
+ am_volume_t volume = 3;
+ am_RampType_e ramp = RAMP_DIRECT;
+ am_time_t myTime = 25;
- EXPECT_CALL(pReceiveInterface,ackSourceVolumeTick(_,sourceID,_)).Times(3);
- EXPECT_CALL(pReceiveInterface,ackSetSourceVolumeChange(_,volume,E_OK)).Times(1);
+ EXPECT_CALL(pReceiveInterface,ackSourceVolumeTick(_,sourceID,_)).Times(3);
+ EXPECT_CALL(pReceiveInterface,ackSetSourceVolumeChange(_,volume,E_OK)).Times(1);
- ASSERT_EQ(E_OK,pRoutingSender.asyncSetSourceVolume(handle,sourceID,volume,ramp,myTime));
- pSocketHandler.start_listenting();
+ ASSERT_EQ(E_OK, pRoutingSender.asyncSetSourceVolume(handle,sourceID,volume,ramp,myTime));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,setSinkVolume)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_SETSINKVOLUME;
+ handle.handle = 1;
+ handle.handleType = H_SETSINKVOLUME;
- am_sinkID_t sinkID=1;
- am_volume_t volume=9;
- am_RampType_e ramp=RAMP_DIRECT;
- am_time_t myTime=25;
+ am_sinkID_t sinkID = 1;
+ am_volume_t volume = 9;
+ am_RampType_e ramp = RAMP_DIRECT;
+ am_time_t myTime = 25;
- EXPECT_CALL(pReceiveInterface,ackSinkVolumeTick(_,sinkID,_)).Times(9);
- EXPECT_CALL(pReceiveInterface,ackSetSinkVolumeChange(_,volume,E_OK)).Times(1);
+ EXPECT_CALL(pReceiveInterface,ackSinkVolumeTick(_,sinkID,_)).Times(9);
+ EXPECT_CALL(pReceiveInterface,ackSetSinkVolumeChange(_,volume,E_OK)).Times(1);
- ASSERT_EQ(E_OK,pRoutingSender.asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
- pSocketHandler.start_listenting();
+ ASSERT_EQ(E_OK, pRoutingSender.asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,setSinkVolumeAbort)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_SETSINKVOLUME;
+ handle.handle = 1;
+ handle.handleType = H_SETSINKVOLUME;
- am_sinkID_t sinkID=2;
- am_volume_t volume=25;
- am_RampType_e ramp=RAMP_DIRECT;
- am_time_t myTime=25;
+ am_sinkID_t sinkID = 2;
+ am_volume_t volume = 25;
+ am_RampType_e ramp = RAMP_DIRECT;
+ am_time_t myTime = 25;
- EXPECT_CALL(pReceiveInterface,ackSinkVolumeTick(_,sinkID,_));
- EXPECT_CALL(pReceiveInterface,ackSetSinkVolumeChange(_,AllOf(Ne(volume),Ne(0)),E_ABORTED)).Times(1);
+ EXPECT_CALL(pReceiveInterface, ackSinkVolumeTick(_,sinkID,_));
+ EXPECT_CALL(pReceiveInterface,ackSetSinkVolumeChange(_,AllOf(Ne(volume),Ne(0)),E_ABORTED)).Times(1);
- ASSERT_EQ(E_OK,pRoutingSender.asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
- sleep(0.5);
- ASSERT_EQ(E_OK,pRoutingSender.asyncAbort(handle));
- pSocketHandler.start_listenting();
+ ASSERT_EQ(E_OK, pRoutingSender.asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
+ sleep(0.5);
+ ASSERT_EQ(E_OK, pRoutingSender.asyncAbort(handle));
+ pSocketHandler.start_listenting();
}
-
TEST_F(testRoutingInterfaceAsync,disconnectTooEarly)
{
am_Handle_s handle;
- handle.handle=1;
- 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));
- EXPECT_CALL(pReceiveInterface,ackDisconnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_OK,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- ASSERT_EQ(E_NON_EXISTENT,pRoutingSender.asyncDisconnect(handle,connectionID));
- pSocketHandler.start_listenting();
+ handle.handle = 1;
+ 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));
+ EXPECT_CALL(pReceiveInterface,ackDisconnect(_,connectionID,E_OK)).Times(0);
+ ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncDisconnect(handle,connectionID));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,disconnectAbort)
{
am_Handle_s handle;
- handle.handle=1;
- 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));
- EXPECT_CALL(pReceiveInterface,ackDisconnect(_,connectionID,E_ABORTED));
- ASSERT_EQ(E_OK,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- sleep(2);
- ASSERT_EQ(E_OK,pRoutingSender.asyncDisconnect(handle,connectionID));
- ASSERT_EQ(E_OK,pRoutingSender.asyncAbort(handle));
- pSocketHandler.start_listenting();
+ handle.handle = 1;
+ 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));
+ EXPECT_CALL(pReceiveInterface, ackDisconnect(_,connectionID,E_ABORTED));
+ ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ sleep(2);
+ ASSERT_EQ(E_OK, pRoutingSender.asyncDisconnect(handle,connectionID));
+ ASSERT_EQ(E_OK, pRoutingSender.asyncAbort(handle));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,disconnectNonExisting)
{
am_Handle_s handle;
- handle.handle=1;
- 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);
- ASSERT_EQ(E_NON_EXISTENT,pRoutingSender.asyncDisconnect(handle,connectionID));
- pSocketHandler.start_listenting();
+ handle.handle = 1;
+ 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);
+ ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncDisconnect(handle,connectionID));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,disconnect)
{
am_Handle_s handle;
- handle.handle=1;
- 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));
- EXPECT_CALL(pReceiveInterface,ackDisconnect(_,connectionID,E_OK));
- ASSERT_EQ(E_OK,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- sleep(2);
- ASSERT_EQ(E_OK,pRoutingSender.asyncDisconnect(handle,connectionID));
- pSocketHandler.start_listenting();
+ handle.handle = 1;
+ 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));
+ EXPECT_CALL(pReceiveInterface, ackDisconnect(_,connectionID,E_OK));
+ ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ sleep(2);
+ ASSERT_EQ(E_OK, pRoutingSender.asyncDisconnect(handle,connectionID));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,connectNoMoreThreads)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_CONNECT;
-
- am_connectionID_t connectionID=1;
- am_sourceID_t sourceID=2;
- am_sinkID_t sinkID=1;
- am_ConnectionFormat_e format=CF_ANALOG;
-
- EXPECT_CALL(pReceiveInterface,ackConnect(_,_,E_OK)).Times(10);
- for(int i=0;i<10;i++)
- {
- handle.handle++;
- connectionID++;
- ASSERT_EQ(E_OK,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- }
- ASSERT_EQ(E_NOT_POSSIBLE,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- pSocketHandler.start_listenting();
+ handle.handle = 1;
+ handle.handleType = H_CONNECT;
+
+ am_connectionID_t connectionID = 1;
+ am_sourceID_t sourceID = 2;
+ am_sinkID_t sinkID = 1;
+ am_ConnectionFormat_e format = CF_ANALOG;
+
+ EXPECT_CALL(pReceiveInterface,ackConnect(_,_,E_OK)).Times(10);
+ for (int i = 0; i < 10; i++)
+ {
+ handle.handle++;
+ connectionID++;
+ ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ }ASSERT_EQ(E_NOT_POSSIBLE, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,connectAbortTooLate)
{
am_Handle_s handle;
- handle.handle=1;
- 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(1);
- ASSERT_EQ(E_OK,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- sleep(3);
- ASSERT_EQ(E_NON_EXISTENT,pRoutingSender.asyncAbort(handle));
- pSocketHandler.start_listenting();
+ handle.handle = 1;
+ 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(1);
+ ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ sleep(3);
+ ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncAbort(handle));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,connectAbort)
{
am_Handle_s handle;
- handle.handle=1;
- 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_ABORTED)).Times(1);
- ASSERT_EQ(E_OK,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- sleep(0.5);
- ASSERT_EQ(E_OK,pRoutingSender.asyncAbort(handle));
- pSocketHandler.start_listenting();
+ handle.handle = 1;
+ 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_ABORTED)).Times(1);
+ ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ sleep(0.5);
+ ASSERT_EQ(E_OK, pRoutingSender.asyncAbort(handle));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,connectWrongFormat)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_CONNECT;
+ handle.handle = 1;
+ handle.handleType = H_CONNECT;
- am_connectionID_t connectionID=4;
- am_sourceID_t sourceID=2;
- am_sinkID_t sinkID=1;
- am_ConnectionFormat_e format=CF_MONO;
+ am_connectionID_t connectionID = 4;
+ am_sourceID_t sourceID = 2;
+ am_sinkID_t sinkID = 1;
+ am_ConnectionFormat_e format = CF_MONO;
- EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_WRONG_FORMAT,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- pSocketHandler.start_listenting();
+ EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
+ ASSERT_EQ(E_WRONG_FORMAT, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,connectWrongSink)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_CONNECT;
+ handle.handle = 1;
+ handle.handleType = H_CONNECT;
- am_connectionID_t connectionID=4;
- am_sourceID_t sourceID=2;
- am_sinkID_t sinkID=122;
- am_ConnectionFormat_e format=CF_ANALOG;
+ am_connectionID_t connectionID = 4;
+ am_sourceID_t sourceID = 2;
+ am_sinkID_t sinkID = 122;
+ am_ConnectionFormat_e format = CF_ANALOG;
- EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_NON_EXISTENT,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- pSocketHandler.start_listenting();
+ EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
+ ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,connectWrongSource)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_CONNECT;
+ handle.handle = 1;
+ handle.handleType = H_CONNECT;
- am_connectionID_t connectionID=4;
- am_sourceID_t sourceID=25;
- am_sinkID_t sinkID=1;
- am_ConnectionFormat_e format=CF_ANALOG;
+ am_connectionID_t connectionID = 4;
+ am_sourceID_t sourceID = 25;
+ am_sinkID_t sinkID = 1;
+ am_ConnectionFormat_e format = CF_ANALOG;
- EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
- ASSERT_EQ(E_NON_EXISTENT,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- pSocketHandler.start_listenting();
+ EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(0);
+ ASSERT_EQ(E_NON_EXISTENT, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,connect)
{
am_Handle_s handle;
- handle.handle=1;
- handle.handleType=H_CONNECT;
+ handle.handle = 1;
+ 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;
+ 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));
- ASSERT_EQ(E_OK,pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
- pSocketHandler.start_listenting();
+ EXPECT_CALL(pReceiveInterface, ackConnect(_,connectionID,E_OK));
+ ASSERT_EQ(E_OK, pRoutingSender.asyncConnect(handle,connectionID,sourceID,sinkID,format));
+ pSocketHandler.start_listenting();
}
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
-
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h
index 4e5a841..ecb5bad 100644
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h
+++ b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsync.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file testRoutingItnerfaceAsync.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.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file testRoutingItnerfaceAsync.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 TESTROUTINGINTERFACEASYNC_H_
#define TESTROUTINGINTERFACEASYNC_H_
@@ -34,28 +34,29 @@
#define UNIT_TEST 1
-namespace am {
+namespace am
+{
-class testRoutingInterfaceAsync :public ::testing::Test
+class testRoutingInterfaceAsync: public ::testing::Test
{
public:
- static std::vector<std::string> pListRoutingPluginDirs;
- SocketHandler pSocketHandler;
- MockRoutingReceiveInterface pReceiveInterface;
- static RoutingSender pRoutingSender;
- static std::vector<std::string> returnListPlugins();
- static am_Error_e handleDomainRegister (const am_Domain_s& domainData, am_domainID_t& domainID);
- static am_Error_e handleSourceRegister (const am_Source_s& sourceData, am_sourceID_t& sourceID);
- static am_Error_e handleSinkRegister(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
- void timerCallback(sh_timerHandle_t handle, void* userData);
- shTimerCallBack_T<testRoutingInterfaceAsync> ptimerCallback;
- testRoutingInterfaceAsync();
- virtual ~testRoutingInterfaceAsync();
+ static std::vector<std::string> pListRoutingPluginDirs;
+ SocketHandler pSocketHandler;
+ MockRoutingReceiveInterface pReceiveInterface;
+ static RoutingSender pRoutingSender;
+ static std::vector<std::string> returnListPlugins();
+ static am_Error_e handleDomainRegister(const am_Domain_s& domainData, am_domainID_t& domainID);
+ static am_Error_e handleSourceRegister(const am_Source_s& sourceData, am_sourceID_t& sourceID);
+ static am_Error_e handleSinkRegister(const am_Sink_s& sinkData, am_sinkID_t& sinkID);
+ void timerCallback(sh_timerHandle_t handle, void* userData);
+ shTimerCallBack_T<testRoutingInterfaceAsync> ptimerCallback;
+ testRoutingInterfaceAsync();
+ virtual ~testRoutingInterfaceAsync();
- void SetUp();
- void TearDown();
+ void SetUp();
+ void TearDown();
private:
- static am_domainID_t mDomainIDCount;
+ static am_domainID_t mDomainIDCount;
};
} /* namespace am */
diff --git a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp
index 6818b75..be8a326 100644
--- a/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp
+++ b/PluginRoutingInterfaceAsync/test/testRoutingInterfaceAsyncInterrupt.cpp
@@ -1,48 +1,45 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file testRoutingItnerfaceAsyncInterrupt.cpp
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file testRoutingItnerfaceAsyncInterrupt.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ */
#define INTERRUPT_TEST 1
#include "testRoutingInterfaceAsync.h"
#include "config.h"
-
using namespace am;
using namespace testing;
-
DLT_DECLARE_CONTEXT(DLT_CONTEXT)
+std::vector<std::string> testRoutingInterfaceAsync::pListRoutingPluginDirs = returnListPlugins();
+am_domainID_t testRoutingInterfaceAsync::mDomainIDCount = 0;
+RoutingSender testRoutingInterfaceAsync::pRoutingSender = RoutingSender(pListRoutingPluginDirs);
-std::vector<std::string> testRoutingInterfaceAsync::pListRoutingPluginDirs=returnListPlugins();
-am_domainID_t testRoutingInterfaceAsync::mDomainIDCount=0;
-RoutingSender testRoutingInterfaceAsync::pRoutingSender=RoutingSender(pListRoutingPluginDirs);
-
-testRoutingInterfaceAsync::testRoutingInterfaceAsync()
- :pSocketHandler(),
- pReceiveInterface(),
- ptimerCallback(this, &testRoutingInterfaceAsync::timerCallback)
+testRoutingInterfaceAsync::testRoutingInterfaceAsync() :
+ pSocketHandler(), //
+ pReceiveInterface(), //
+ ptimerCallback(this, &testRoutingInterfaceAsync::timerCallback)
{
}
@@ -52,114 +49,111 @@ testRoutingInterfaceAsync::~testRoutingInterfaceAsync()
void testRoutingInterfaceAsync::SetUp()
{
- 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 "));
- std::vector<int> domainIDs;
- domainIDs.push_back(0);
- domainIDs.push_back(1);
+ std::vector<int> domainIDs;
+ domainIDs.push_back(0);
+ domainIDs.push_back(1);
- EXPECT_CALL(pReceiveInterface,getSocketHandler(_)).WillOnce(DoAll(SetArgReferee<0>(&pSocketHandler),Return(E_OK)));
- EXPECT_CALL(pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleDomainRegister));
- EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSourceRegister));
- EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSinkRegister));
+ EXPECT_CALL(pReceiveInterface,getSocketHandler(_)).WillOnce(DoAll(SetArgReferee<0>(&pSocketHandler), Return(E_OK)));
+ EXPECT_CALL(pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleDomainRegister));
+ EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSourceRegister));
+ EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(testRoutingInterfaceAsync::handleSinkRegister));
- pRoutingSender.startupRoutingInterface(&pReceiveInterface);
- pRoutingSender.routingInterfacesReady();
+ pRoutingSender.startupRoutingInterface(&pReceiveInterface);
+ pRoutingSender.routingInterfacesReady();
- timespec t;
- t.tv_nsec=0;
- t.tv_sec=4;
+ timespec t;
+ t.tv_nsec = 0;
+ t.tv_sec = 4;
- sh_timerHandle_t handle;
+ sh_timerHandle_t handle;
- shTimerCallBack *buf=&ptimerCallback;
- //lets use a timeout so the test will finish
- pSocketHandler.addTimer(t,buf,handle,(void*)NULL);
+ shTimerCallBack *buf = &ptimerCallback;
+ //lets use a timeout so the test will finish
+ pSocketHandler.addTimer(t, buf, handle, (void*) NULL);
}
std::vector<std::string> am::testRoutingInterfaceAsync::returnListPlugins()
{
- std::vector<std::string> list;
- list.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
- return (list);
+ std::vector<std::string> list;
+ list.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
+ return (list);
}
am_Error_e am::testRoutingInterfaceAsync::handleSourceRegister(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- sourceID=sourceData.sourceID;
- pRoutingSender.addSourceLookup(sourceData);
- return (E_OK);
+ sourceID = sourceData.sourceID;
+ pRoutingSender.addSourceLookup(sourceData);
+ return (E_OK);
}
am_Error_e am::testRoutingInterfaceAsync::handleSinkRegister(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- sinkID=sinkData.sinkID;
- pRoutingSender.addSinkLookup(sinkData);
- return(E_OK);
+ sinkID = sinkData.sinkID;
+ pRoutingSender.addSinkLookup(sinkData);
+ return (E_OK);
}
am_Error_e am::testRoutingInterfaceAsync::handleDomainRegister(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- am_Domain_s domain=domainData;
- domainID=mDomainIDCount++;
- domain.domainID=domainID;
- pRoutingSender.addDomainLookup(domain);
- return (E_OK);
+ am_Domain_s domain = domainData;
+ domainID = mDomainIDCount++;
+ domain.domainID = domainID;
+ pRoutingSender.addDomainLookup(domain);
+ return (E_OK);
}
void am::testRoutingInterfaceAsync::timerCallback(sh_timerHandle_t handle, void *userData)
{
- pSocketHandler.stop_listening();
+ pSocketHandler.stop_listening();
}
void testRoutingInterfaceAsync::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
std::string DBUSCOMMAND = "dbus-send --session --print-reply --dest=org.genivi.test /org/genivi/test org.genivi.test.";
-
-
TEST_F(testRoutingInterfaceAsync,hookInterruptStatusChange)
{
- am_sourceID_t sourceID=2;
- EXPECT_CALL(pReceiveInterface,hookInterruptStatusChange(sourceID,_)).Times(1);
- system((DBUSCOMMAND + std::string("InterruptStatusChange int16:2")).c_str());
- pSocketHandler.start_listenting();
+ am_sourceID_t sourceID = 2;
+ EXPECT_CALL(pReceiveInterface,hookInterruptStatusChange(sourceID,_)).Times(1);
+ system((DBUSCOMMAND + std::string("InterruptStatusChange int16:2")).c_str());
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,hookSourceAvailablityStatusChange)
{
- am_sourceID_t sourceID=2;
- EXPECT_CALL(pReceiveInterface,hookSourceAvailablityStatusChange(sourceID,_)).Times(1);
- system((DBUSCOMMAND + std::string("SourceAvailablityStatusChange int16:2")).c_str());
- pSocketHandler.start_listenting();
+ am_sourceID_t sourceID = 2;
+ EXPECT_CALL(pReceiveInterface,hookSourceAvailablityStatusChange(sourceID,_)).Times(1);
+ system((DBUSCOMMAND + std::string("SourceAvailablityStatusChange int16:2")).c_str());
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,hookSinkAvailablityStatusChange)
{
- am_sinkID_t sinkID=2;
- EXPECT_CALL(pReceiveInterface,hookSinkAvailablityStatusChange(sinkID,_)).Times(1);
- system((DBUSCOMMAND + std::string("SinkAvailablityStatusChange int16:2")).c_str());
- pSocketHandler.start_listenting();
+ am_sinkID_t sinkID = 2;
+ EXPECT_CALL(pReceiveInterface,hookSinkAvailablityStatusChange(sinkID,_)).Times(1);
+ system((DBUSCOMMAND + std::string("SinkAvailablityStatusChange int16:2")).c_str());
+ pSocketHandler.start_listenting();
}
TEST_F(testRoutingInterfaceAsync,hookTimingInformationChanged)
{
- am_connectionID_t connectionID=4;
- am_timeSync_t delay=35;
- EXPECT_CALL(pReceiveInterface,hookTimingInformationChanged(connectionID,delay)).Times(1);
- system((DBUSCOMMAND + std::string("timingChanged int16:4 int16:35")).c_str());
- pSocketHandler.start_listenting();
+ am_connectionID_t connectionID = 4;
+ am_timeSync_t delay = 35;
+ EXPECT_CALL(pReceiveInterface,hookTimingInformationChanged(connectionID,delay)).Times(1);
+ system((DBUSCOMMAND + std::string("timingChanged int16:4 int16:35")).c_str());
+ pSocketHandler.start_listenting();
}
int main(int argc, char **argv)
{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
-
diff --git a/PluginRoutingInterfaceDbus/include/RoutingSender.h b/PluginRoutingInterfaceDbus/include/RoutingSender.h
index e8dd9ba..2b6f75b 100644
--- a/PluginRoutingInterfaceDbus/include/RoutingSender.h
+++ b/PluginRoutingInterfaceDbus/include/RoutingSender.h
@@ -1,27 +1,27 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file RoutingSender.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger DbusPlugin
+ *
+ * \file RoutingSender.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef ROUTINGSENDER_H_
#define ROUTINGSENDER_H_
@@ -30,27 +30,28 @@
using namespace am;
-class DbusRoutingSender: public RoutingSendInterface {
+class DbusRoutingSender: public RoutingSendInterface
+{
public:
- DbusRoutingSender();
- virtual ~DbusRoutingSender();
- void startupRoutingInterface(RoutingReceiveInterface* routingreceiveinterface) ;
- void routingInterfacesReady() ;
- void routingInterfacesRundown() ;
- am_Error_e asyncAbort(const am_Handle_s handle) ;
- am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat) ;
- am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID) ;
- 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 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 ;
- uint16_t getInterfaceVersion() const ;
+ DbusRoutingSender();
+ virtual ~DbusRoutingSender();
+ void startupRoutingInterface(RoutingReceiveInterface* routingreceiveinterface);
+ void routingInterfacesReady();
+ void routingInterfacesRundown();
+ am_Error_e asyncAbort(const am_Handle_s handle);
+ am_Error_e asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat);
+ am_Error_e asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID);
+ 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 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;
+ uint16_t getInterfaceVersion() const;
};
#endif /* ROUTINGSENDER_H_ */
diff --git a/PluginRoutingInterfaceDbus/src/RoutingSender.cpp b/PluginRoutingInterfaceDbus/src/RoutingSender.cpp
index e93d921..44eadc5 100644
--- a/PluginRoutingInterfaceDbus/src/RoutingSender.cpp
+++ b/PluginRoutingInterfaceDbus/src/RoutingSender.cpp
@@ -1,36 +1,37 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger DbusPlugin
-*
-* \file RoutingSender.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 DbusPlugin
+ *
+ * \file RoutingSender.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 "RoutingSender.h"
-
-extern "C" RoutingSendInterface* PluginRoutingInterfaceDbusFactory() {
+extern "C" RoutingSendInterface* PluginRoutingInterfaceDbusFactory()
+{
return (new DbusRoutingSender());
}
-extern "C" void destroyRoutingPluginInterfaceDbus(RoutingSendInterface* routingSendInterface) {
+extern "C" void destroyRoutingPluginInterfaceDbus(RoutingSendInterface* routingSendInterface)
+{
delete routingSendInterface;
}
@@ -38,95 +39,66 @@ DbusRoutingSender::DbusRoutingSender()
{
}
-
-
DbusRoutingSender::~DbusRoutingSender()
{
}
-
-
void DbusRoutingSender::startupRoutingInterface(RoutingReceiveInterface *routingreceiveinterface)
{
}
-
-
void DbusRoutingSender::routingInterfacesReady()
{
}
-
-
void DbusRoutingSender::routingInterfacesRundown()
{
}
-
-
am_Error_e DbusRoutingSender::asyncAbort(const am_Handle_s handle)
{
}
-
-
am_Error_e DbusRoutingSender::asyncConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
{
}
-
-
am_Error_e DbusRoutingSender::asyncDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID)
{
}
-
-
am_Error_e DbusRoutingSender::asyncSetSinkVolume(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
}
-
-
am_Error_e DbusRoutingSender::asyncSetSourceVolume(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
}
-
-
am_Error_e 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)
{
}
-
am_Error_e DbusRoutingSender::asyncCrossFade(const am_Handle_s handle, const am_crossfaderID_t crossfaderID, const am_HotSink_e hotSink, const am_RampType_e rampType, const am_time_t time)
{
}
-
-
am_Error_e 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)
{
}
-
-
am_Error_e DbusRoutingSender::returnBusName(std::string & BusName) const
{
- BusName="DbusPlugin";
- return (E_OK);
+ BusName = "DbusPlugin";
+ 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)
@@ -141,13 +113,6 @@ am_Error_e DbusRoutingSender::asyncSetSourceSoundProperties(const am_Handle_s ha
uint16_t DbusRoutingSender::getInterfaceVersion() const
{
- return (RoutingSendVersion);
+ return (RoutingSendVersion);
}
-
-
-
-
-
-
-
diff --git a/README b/README
index beded22..95fd403 100644
--- a/README
+++ b/README
@@ -139,6 +139,9 @@ The commandline options of the AudioManager:
+The source code if formatted with eclipse, the style sheet used can be found in the cmake folder:
+cmake/AudioManager_Codestyle.xml
+
_..-------++._
_.-'/ | _|| \"--._
__.--'`._/_\j_____/_||___\ `----.
diff --git a/cmake/AudioManager_Codestyle.xml b/cmake/AudioManager_Codestyle.xml
new file mode 100644
index 0000000..0ecdb53
--- /dev/null
+++ b/cmake/AudioManager_Codestyle.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles version="1">
+<profile kind="CodeFormatterProfile" name="AudioManager" version="1">
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="800"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="4"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_enumerator_list" value="48"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_declarator_list" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_expression_list" value="0"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression" value="80"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_compact_if" value="0"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration" value="80"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block_in_case" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_switch" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="4"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.brace_position_for_array_initializer" value="next_line"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters" value="insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments" value="do not insert"/>
+</profile>
+</profiles>
diff --git a/includes/SocketHandler.h b/includes/SocketHandler.h
index db81365..e7e80ba 100644
--- a/includes/SocketHandler.h
+++ b/includes/SocketHandler.h
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file SocketHandler.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file SocketHandler.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ */
#ifndef SOCKETHANDLER_H_
#define SOCKETHANDLER_H_
@@ -34,12 +34,13 @@
#include <map>
#include <signal.h>
-namespace am {
+namespace am
+{
-static volatile sig_atomic_t gDispatchDone = 0; //this global is used to stop the mainloop
+static volatile sig_atomic_t gDispatchDone = 0; //this global is used to stop the mainloop
-typedef uint16_t sh_timerHandle_t; //!<this is a handle for a timer to be used with the SocketHandler
-typedef uint16_t sh_pollHandle_t; //!<this is a handle for a filedescriptor to be used with the SocketHandler
+typedef uint16_t sh_timerHandle_t; //!<this is a handle for a timer to be used with the SocketHandler
+typedef uint16_t sh_pollHandle_t; //!<this is a handle for a filedescriptor to be used with the SocketHandler
class shPollPrepare;
class shPollCheck;
@@ -50,85 +51,87 @@ class shTimerCallBack;
class SocketHandler
{
public:
- SocketHandler();
- virtual ~SocketHandler();
-
- am_Error_e addFDPoll(const int fd,const short event, shPollPrepare *prepare,shPollFired *fired,shPollCheck *check,shPollDispatch *dispatch, void* userData,sh_pollHandle_t& handle);
- am_Error_e removeFDPoll(const sh_pollHandle_t handle);
- am_Error_e updateEventFlags(const sh_pollHandle_t handle, const short events);
- am_Error_e addTimer(const timespec timeouts,shTimerCallBack*& callback,sh_timerHandle_t& handle, void* userData);
- am_Error_e removeTimer(const sh_timerHandle_t handle);
- am_Error_e restartTimer(const sh_timerHandle_t handle, const timespec timeouts);
- am_Error_e stopTimer(const sh_timerHandle_t handle);
- void start_listenting();
- void stop_listening();
+ SocketHandler();
+ virtual ~SocketHandler();
+
+ am_Error_e addFDPoll(const int fd, const short event, shPollPrepare *prepare, shPollFired *fired, shPollCheck *check, shPollDispatch *dispatch, void* userData, sh_pollHandle_t& handle);
+ am_Error_e removeFDPoll(const sh_pollHandle_t handle);
+ am_Error_e updateEventFlags(const sh_pollHandle_t handle, const short events);
+ am_Error_e addTimer(const timespec timeouts, shTimerCallBack*& callback, sh_timerHandle_t& handle, void* userData);
+ am_Error_e removeTimer(const sh_timerHandle_t handle);
+ am_Error_e restartTimer(const sh_timerHandle_t handle, const timespec timeouts);
+ am_Error_e stopTimer(const sh_timerHandle_t handle);
+ void start_listenting();
+ void stop_listening();
private:
- struct timer_s //!<struct that holds information of timers
- {
- sh_timerHandle_t handle; //!<the handle of the timer
- timespec countdown; //!<the countdown, this value is decreased every time the timer is up
- timespec timeout; //!<the original timer value
- shTimerCallBack* callback; //!<the callbackfunction
- void * userData; //!<saves a void pointer together with the rest.
- };
-
- class SubstractTime //!<functor to easy substract from each countdown value
- {
- private:
- timespec param;
- public:
- SubstractTime(timespec param): param(param) {}
- void operator()(timer_s& t) const;
- };
-
- struct sh_poll_s //!<struct that holds information about polls
- {
- sh_pollHandle_t handle; //!<handle to uniquely adress a filedesriptor
- shPollPrepare *prepareCB;
- shPollFired *firedCB;
- shPollCheck *checkCB;
- shPollDispatch *dispatchCB;
- pollfd pollfdValue; //!<the array for polling the filedescriptors
- void *userData; //!<userdata saved together with the callback.
- };
-
- typedef std::vector<pollfd> mPollfd_t; //!<vector of filedescriptors
- typedef std::vector<sh_poll_s> mListPoll_t; //!<list for the callbacks
-
- class CopyPollfd
- {
- private:
- mPollfd_t& mArray;
- public:
- CopyPollfd(mPollfd_t& dest): mArray(dest) {}
- void operator()(const sh_poll_s& row);
- };
-
- bool fdIsValid(const int fd) const;
- void initTimer();
- void timerUp();
- int timespec2ms(const timespec& time);
- timespec* insertTime(timespec& buffertime);
- static bool compareCountdown(const timer_s& a, const timer_s& b)
- {
- return (a.countdown.tv_sec==b.countdown.tv_sec) ? (a.countdown.tv_nsec < b.countdown.tv_nsec) : (a.countdown.tv_sec < b.countdown.tv_sec);
- }
-
- static bool onlyFiredEvents(const pollfd& a)
- {
- return a.revents==0 ? false : true;
- }
-
- //todo: maybe we could simplify mListActiveTimer to hold only the handle and the countdown ....
- mPollfd_t mfdPollingArray;
- mListPoll_t mListPoll;
- std::list<timer_s> mListTimer; //!<list of all timers
- std::list<timer_s> mListActiveTimer; //!<list of all currently active timers
- sh_timerHandle_t mNextTimer;
- sh_timerHandle_t mLastInsertedHandle;
- sh_pollHandle_t mLastInsertedPollHandle;
- timespec mTimeout;
- bool mRecreatePollfds;
+ struct timer_s //!<struct that holds information of timers
+ {
+ sh_timerHandle_t handle; //!<the handle of the timer
+ timespec countdown; //!<the countdown, this value is decreased every time the timer is up
+ timespec timeout; //!<the original timer value
+ shTimerCallBack* callback; //!<the callbackfunction
+ void * userData; //!<saves a void pointer together with the rest.
+ };
+
+ class SubstractTime //!<functor to easy substract from each countdown value
+ {
+ private:
+ timespec param;
+ public:
+ SubstractTime(timespec param) :
+ param(param){}
+ void operator()(timer_s& t) const;
+ };
+
+ struct sh_poll_s //!<struct that holds information about polls
+ {
+ sh_pollHandle_t handle; //!<handle to uniquely adress a filedesriptor
+ shPollPrepare *prepareCB;
+ shPollFired *firedCB;
+ shPollCheck *checkCB;
+ shPollDispatch *dispatchCB;
+ pollfd pollfdValue; //!<the array for polling the filedescriptors
+ void *userData; //!<userdata saved together with the callback.
+ };
+
+ typedef std::vector<pollfd> mPollfd_t; //!<vector of filedescriptors
+ typedef std::vector<sh_poll_s> mListPoll_t; //!<list for the callbacks
+
+ class CopyPollfd
+ {
+ private:
+ mPollfd_t& mArray;
+ public:
+ CopyPollfd(mPollfd_t& dest) :
+ mArray(dest){}
+ void operator()(const sh_poll_s& row);
+ };
+
+ bool fdIsValid(const int fd) const;
+ void initTimer();
+ void timerUp();
+ int timespec2ms(const timespec& time);
+ timespec* insertTime(timespec& buffertime);
+ static bool compareCountdown(const timer_s& a, const timer_s& b)
+ {
+ return (a.countdown.tv_sec == b.countdown.tv_sec) ? (a.countdown.tv_nsec < b.countdown.tv_nsec) : (a.countdown.tv_sec < b.countdown.tv_sec);
+ }
+
+ static bool onlyFiredEvents(const pollfd& a)
+ {
+ return a.revents == 0 ? false : true;
+ }
+
+ //todo: maybe we could simplify mListActiveTimer to hold only the handle and the countdown ....
+ mPollfd_t mfdPollingArray;
+ mListPoll_t mListPoll;
+ std::list<timer_s> mListTimer; //!<list of all timers
+ std::list<timer_s> mListActiveTimer; //!<list of all currently active timers
+ sh_timerHandle_t mNextTimer;
+ sh_timerHandle_t mLastInsertedHandle;
+ sh_pollHandle_t mLastInsertedPollHandle;
+ timespec mTimeout;
+ bool mRecreatePollfds;
};
/**
@@ -137,122 +140,127 @@ private:
class shTimerCallBack
{
public:
- virtual void Call (const sh_timerHandle_t handle, void* userData)=0;
- virtual ~shTimerCallBack(){};
+ virtual void Call(const sh_timerHandle_t handle, void* userData)=0;
+ virtual ~shTimerCallBack(){};
};
class shPollPrepare
{
public:
- virtual void Call (const sh_pollHandle_t handle, void* userData)=0;
- virtual ~shPollPrepare(){};
+ virtual void Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~shPollPrepare(){};
};
class shPollFired
{
public:
- virtual void Call(const pollfd pollfd,const sh_pollHandle_t handle, void* userData)=0;
- virtual ~ shPollFired(){};
+ virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ shPollFired(){};
};
class shPollCheck
{
public:
- virtual bool Call (const sh_pollHandle_t handle, void* userData)=0;
- virtual ~ shPollCheck(){};
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ shPollCheck(){};
};
class shPollDispatch
{
public:
- virtual bool Call (const sh_pollHandle_t handle, void* userData)=0;
- virtual ~ shPollDispatch(){};
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)=0;
+ virtual ~ shPollDispatch() {};
};
/**
* template to create the functor for a class
*/
-template <class TClass> class shTimerCallBack_T : public shTimerCallBack
+template<class TClass> class shTimerCallBack_T: public shTimerCallBack
{
private:
- TClass* mInstance;
- void (TClass::*mFunction)(sh_timerHandle_t handle, void* userData);
+ TClass* mInstance;
+ void (TClass::*mFunction)(sh_timerHandle_t handle, void* userData);
public:
- shTimerCallBack_T(TClass* instance, void(TClass::*function)(sh_timerHandle_t handle, void* userData))
- :mInstance(instance), mFunction(function){};
-
- virtual void Call(sh_timerHandle_t handle, void* userData)
- {
- (*mInstance.*mFunction)(handle, userData);
- }
+ shTimerCallBack_T(TClass* instance, void(TClass::*function)(sh_timerHandle_t handle, void* userData)) :
+ mInstance(instance),//
+ mFunction(function) {};
+
+ virtual void Call(sh_timerHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(handle, userData);
+ }
};
/**
* template to create the functor for a class
*/
-template <class TClass> class shPollPrepare_T : public shPollPrepare
+template<class TClass> class shPollPrepare_T: public shPollPrepare
{
private:
- TClass* mInstance;
- void (TClass::*mFunction)(const sh_timerHandle_t handle, void* userData);
+ TClass* mInstance;
+ void (TClass::*mFunction)(const sh_timerHandle_t handle, void* userData);
public:
- shPollPrepare_T(TClass* instance, void(TClass::*function)(const sh_timerHandle_t handle, void* userData))
- :mInstance(instance), mFunction(function){};
-
- virtual void Call(const sh_timerHandle_t handle, void* userData)
- {
- (*mInstance.*mFunction)(handle,userData);
- };
+ shPollPrepare_T(TClass* instance, void(TClass::*function)(const sh_timerHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual void Call(const sh_timerHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(handle, userData);
+ };
};
-template <class TClass> class shPollFired_T : public shPollFired
+template<class TClass> class shPollFired_T: public shPollFired
{
private:
- TClass* mInstance;
- void (TClass::*mFunction)(const pollfd pollfd,const sh_pollHandle_t handle, void* userData);
+ TClass* mInstance;
+ void (TClass::*mFunction)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
public:
- shPollFired_T(TClass* instance, void(TClass::*function)(const pollfd pollfd,const sh_pollHandle_t handle, void* userData))
- :mInstance(instance), mFunction(function){};
-
- virtual void Call(const pollfd pollfd,const sh_pollHandle_t handle, void* userData)
- {
- (*mInstance.*mFunction)(pollfd,handle,userData);
- };
+ shPollFired_T(TClass* instance, void(TClass::*function)(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual void Call(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)
+ {
+ (*mInstance.*mFunction)(pollfd, handle, userData);
+ };
};
-template <class TClass> class shPollCheck_T : public shPollCheck
+template<class TClass> class shPollCheck_T: public shPollCheck
{
private:
- TClass* mInstance;
- bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
+ TClass* mInstance;
+ bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
public:
- shPollCheck_T(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData))
- :mInstance(instance), mFunction(function){};
-
- virtual bool Call(const sh_pollHandle_t handle, void* userData)
- {
- return (*mInstance.*mFunction)(handle,userData);
- };
+ shPollCheck_T(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function){};
+
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)
+ {
+ return (*mInstance.*mFunction)(handle, userData);
+ };
};
-template <class TClass> class shPollDispatch_T : public shPollDispatch
+template<class TClass> class shPollDispatch_T: public shPollDispatch
{
private:
- TClass* mInstance;
- bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
+ TClass* mInstance;
+ bool (TClass::*mFunction)(const sh_pollHandle_t handle, void* userData);
public:
- shPollDispatch_T(TClass* instance, bool (TClass::*function)(const sh_pollHandle_t handle, void* userData))
- :mInstance(instance), mFunction(function){};
-
- virtual bool Call(const sh_pollHandle_t handle, void* userData)
- {
- return (*mInstance.*mFunction)(handle,userData);
- };
+ shPollDispatch_T(TClass* instance, bool(TClass::*function)(const sh_pollHandle_t handle, void* userData)) :
+ mInstance(instance), //
+ mFunction(function) {};
+
+ virtual bool Call(const sh_pollHandle_t handle, void* userData)
+ {
+ return (*mInstance.*mFunction)(handle, userData);
+ };
};
} /* namespace am */
#endif /* SOCKETHANDLER_H_ */
diff --git a/includes/audiomanagertypes.cpp b/includes/audiomanagertypes.cpp
deleted file mode 100644
index e69de29..0000000
--- a/includes/audiomanagertypes.cpp
+++ /dev/null
diff --git a/includes/audiomanagertypes.h b/includes/audiomanagertypes.h
index 265a8c7..228c848 100644
--- a/includes/audiomanagertypes.h
+++ b/includes/audiomanagertypes.h
@@ -22,8 +22,8 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_F71B3C5D_FC1B_400e_A704_C0FF897D4E53__INCLUDED_)
-#define EA_F71B3C5D_FC1B_400e_A704_C0FF897D4E53__INCLUDED_
+#if !defined(EA_3B272E4F_E824_49e3_862F_3C86FD59D14B__INCLUDED_)
+#define EA_3B272E4F_E824_49e3_862F_3C86FD59D14B__INCLUDED_
#include <stdint.h>
#include "projecttypes.h"
@@ -124,56 +124,56 @@ namespace am {
* 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 11-Jan-2012 9:19:44 PM
+ * @created 19-Jan-2012 4:31:47 PM
*/
typedef uint16_t am_domainID_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:45 PM
+ * @created 19-Jan-2012 4:31:47 PM
*/
typedef uint16_t am_sourceID_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:45 PM
+ * @created 19-Jan-2012 4:31:48 PM
*/
typedef uint16_t am_sinkID_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:45 PM
+ * @created 19-Jan-2012 4:31:48 PM
*/
typedef uint16_t am_gatewayID_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:46 PM
+ * @created 19-Jan-2012 4:31:48 PM
*/
typedef uint16_t am_crossfaderID_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:46 PM
+ * @created 19-Jan-2012 4:31:48 PM
*/
typedef uint16_t am_connectionID_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:46 PM
+ * @created 19-Jan-2012 4:31:49 PM
*/
typedef uint16_t am_mainConnectionID_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:46 PM
+ * @created 19-Jan-2012 4:31:49 PM
*/
typedef uint16_t am_speed_t;
@@ -181,7 +181,7 @@ namespace am {
* 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 11-Jan-2012 9:19:46 PM
+ * @created 19-Jan-2012 4:31:49 PM
*/
typedef int16_t am_volume_t;
@@ -190,21 +190,21 @@ namespace am {
* The range of this type is customer specific.
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:47 PM
+ * @created 19-Jan-2012 4:31:49 PM
*/
typedef int16_t am_mainVolume_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:47 PM
+ * @created 19-Jan-2012 4:31:50 PM
*/
typedef uint16_t am_sourceClass_t;
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:47 PM
+ * @created 19-Jan-2012 4:31:50 PM
*/
typedef uint16_t am_sinkClass_t;
@@ -212,7 +212,7 @@ namespace am {
* time in ms!
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:47 PM
+ * @created 19-Jan-2012 4:31:50 PM
*/
typedef uint16_t am_time_t;
@@ -220,7 +220,7 @@ namespace am {
* offset time that is introduced in milli seconds.
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:48 PM
+ * @created 19-Jan-2012 4:31:50 PM
*/
typedef int16_t am_timeSync_t;
@@ -228,7 +228,7 @@ namespace am {
* with the help of this enum, sinks and sources can report their availability state
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:48 PM
+ * @created 19-Jan-2012 4:31:50 PM
*/
enum am_Availablility_e
{
@@ -243,7 +243,7 @@ namespace am {
* represents the connection state
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:48 PM
+ * @created 19-Jan-2012 4:31:50 PM
*/
enum am_ConnectionState_e
{
@@ -274,7 +274,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:48 PM
+ * @created 19-Jan-2012 4:31:51 PM
*/
enum am_DomainState_e
{
@@ -289,7 +289,7 @@ namespace am {
* This enum characterizes the data of the EarlyData_t
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:48 PM
+ * @created 19-Jan-2012 4:31:51 PM
*/
enum am_EarlyDataType_e
{
@@ -305,7 +305,7 @@ namespace am {
* 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 11-Jan-2012 9:19:49 PM
+ * @created 19-Jan-2012 4:31:51 PM
*/
enum am_Error_e
{
@@ -330,7 +330,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:49 PM
+ * @created 19-Jan-2012 4:31:51 PM
*/
enum am_MuteState_e
{
@@ -344,7 +344,7 @@ namespace am {
* The source state reflects the state of the source
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:49 PM
+ * @created 19-Jan-2012 4:31:52 PM
*/
enum am_SourceState_e
{
@@ -368,7 +368,7 @@ namespace am {
* This enumeration is used to define the type of the action that is correlated to a handle.
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:49 PM
+ * @created 19-Jan-2012 4:31:52 PM
*/
enum am_Handle_e
{
@@ -389,7 +389,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:49 PM
+ * @created 19-Jan-2012 4:31:52 PM
*/
enum am_InterruptState_e
{
@@ -403,7 +403,7 @@ namespace am {
* describes the active sink of a crossfader.
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:49 PM
+ * @created 19-Jan-2012 4:31:52 PM
*/
enum am_HotSink_e
{
@@ -418,7 +418,7 @@ namespace am {
* this describes the availability of a sink or a source together with the latest change
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:50 PM
+ * @created 19-Jan-2012 4:31:52 PM
*/
struct am_Availability_s
{
@@ -438,7 +438,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:50 PM
+ * @created 19-Jan-2012 4:31:53 PM
*/
struct am_ClassProperty_s
{
@@ -452,7 +452,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:50 PM
+ * @created 19-Jan-2012 4:31:53 PM
*/
struct am_Crossfader_s
{
@@ -470,7 +470,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:51 PM
+ * @created 19-Jan-2012 4:31:53 PM
*/
struct am_Gateway_s
{
@@ -511,7 +511,7 @@ namespace am {
* This represents one "hopp" in a route
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:51 PM
+ * @created 19-Jan-2012 4:31:54 PM
*/
struct am_RoutingElement_s
{
@@ -527,7 +527,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:51 PM
+ * @created 19-Jan-2012 4:31:54 PM
*/
struct am_Route_s
{
@@ -542,7 +542,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:52 PM
+ * @created 19-Jan-2012 4:31:54 PM
*/
struct am_SoundProperty_s
{
@@ -556,7 +556,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:52 PM
+ * @created 19-Jan-2012 4:31:55 PM
*/
struct am_SystemProperty_s
{
@@ -576,7 +576,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:52 PM
+ * @created 19-Jan-2012 4:31:55 PM
*/
struct am_SinkClass_s
{
@@ -591,7 +591,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:53 PM
+ * @created 19-Jan-2012 4:31:55 PM
*/
struct am_SourceClass_s
{
@@ -610,7 +610,7 @@ namespace am {
* this type holds all information of sources relevant to the HMI
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:53 PM
+ * @created 19-Jan-2012 4:31:55 PM
*/
struct am_SourceType_s
{
@@ -627,7 +627,7 @@ namespace am {
* this type holds all information of sinks relevant to the HMI
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:53 PM
+ * @created 19-Jan-2012 4:31:56 PM
*/
struct am_SinkType_s
{
@@ -645,7 +645,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:53 PM
+ * @created 19-Jan-2012 4:31:56 PM
*/
struct am_Handle_s
{
@@ -659,7 +659,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:54 PM
+ * @created 19-Jan-2012 4:31:56 PM
*/
struct am_MainSoundProperty_s
{
@@ -674,7 +674,7 @@ namespace am {
* this type holds all information of connections relevant to the HMI
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:54 PM
+ * @created 19-Jan-2012 4:31:57 PM
*/
struct am_MainConnectionType_s
{
@@ -691,7 +691,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:54 PM
+ * @created 19-Jan-2012 4:31:57 PM
*/
struct am_MainConnection_s
{
@@ -707,7 +707,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:55 PM
+ * @created 19-Jan-2012 4:31:57 PM
*/
struct am_Sink_s
{
@@ -731,7 +731,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:56 PM
+ * @created 19-Jan-2012 4:31:58 PM
*/
struct am_Source_s
{
@@ -764,7 +764,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:56 PM
+ * @created 19-Jan-2012 4:31:58 PM
*/
struct am_Domain_s
{
@@ -783,7 +783,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:56 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
struct am_Connection_s
{
@@ -803,7 +803,7 @@ namespace am {
* soundProperty_t in case of ED_SOURCE_PROPERTY, ED_SINK_PROPERTY
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:56 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
union am_EarlyData_u
{
@@ -820,7 +820,7 @@ namespace am {
* sinkID in case of ED_SINK_VOLUME, ED_SINK_PROPERTY
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
union am_DataType_u
{
@@ -834,7 +834,7 @@ namespace am {
/**
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
struct am_EarlyData_s
{
@@ -846,4 +846,4 @@ namespace am {
};
}
-#endif // !defined(EA_F71B3C5D_FC1B_400e_A704_C0FF897D4E53__INCLUDED_)
+#endif // !defined(EA_3B272E4F_E824_49e3_862F_3C86FD59D14B__INCLUDED_)
diff --git a/includes/command/CommandReceiveInterface.h b/includes/command/CommandReceiveInterface.h
index 9e2aa8a..8821898 100644
--- a/includes/command/CommandReceiveInterface.h
+++ b/includes/command/CommandReceiveInterface.h
@@ -22,8 +22,8 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_A90A11B4_5916_4910_AE0C_4F9713F898A1__INCLUDED_)
-#define EA_A90A11B4_5916_4910_AE0C_4F9713F898A1__INCLUDED_
+#if !defined(EA_434BDFE9_DDA7_4273_AF1E_77AE60CB055D__INCLUDED_)
+#define EA_434BDFE9_DDA7_4273_AF1E_77AE60CB055D__INCLUDED_
#include <vector>
#include <string>
@@ -40,7 +40,7 @@ namespace am {
* 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 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:32:00 PM
*/
class CommandReceiveInterface
{
@@ -196,4 +196,4 @@ namespace am {
};
}
-#endif // !defined(EA_A90A11B4_5916_4910_AE0C_4F9713F898A1__INCLUDED_)
+#endif // !defined(EA_434BDFE9_DDA7_4273_AF1E_77AE60CB055D__INCLUDED_)
diff --git a/includes/command/CommandSendInterface.h b/includes/command/CommandSendInterface.h
index 8ae8b50..160db6c 100644
--- a/includes/command/CommandSendInterface.h
+++ b/includes/command/CommandSendInterface.h
@@ -22,8 +22,8 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_B654AC7A_A617_46d0_836D_36974F99E750__INCLUDED_)
-#define EA_B654AC7A_A617_46d0_836D_36974F99E750__INCLUDED_
+#if !defined(EA_55B59518_08CD_47c3_91EC_B59681773D46__INCLUDED_)
+#define EA_55B59518_08CD_47c3_91EC_B59681773D46__INCLUDED_
#include <vector>
#include <string>
@@ -33,13 +33,15 @@ namespace am {
class CommandReceiveInterface;
}
+#include "CommandReceiveInterface.h"
+
#define CommandSendVersion 1
namespace am {
/**
* 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 11-Jan-2012 9:19:58 PM
+ * @created 19-Jan-2012 4:32:00 PM
*/
class CommandSendInterface
{
@@ -155,4 +157,4 @@ namespace am {
};
}
-#endif // !defined(EA_B654AC7A_A617_46d0_836D_36974F99E750__INCLUDED_)
+#endif // !defined(EA_55B59518_08CD_47c3_91EC_B59681773D46__INCLUDED_)
diff --git a/includes/config.h b/includes/config.h
index db5b56d..f741d75 100644
--- a/includes/config.h
+++ b/includes/config.h
@@ -1,14 +1,14 @@
#ifndef _CONFIG_H
#define _CONFIG_H
-#define DAEMONVERSION "ver-0.0.1-11-g64ba8be"
+#define DAEMONVERSION "ver-0.0.1-12-g80213f1"
#define WITH_DBUS_WRAPPER
#define WITH_SOCKETHANDLER_LOOP
/* #undef WITH_SIMPLEDBUS_LOOP */
#define WITH_PPOLL
/* #undef WITH_TELNET */
-/* #undef GLIB_DBUS_TYPES_TOLERANT */
+#define GLIB_DBUS_TYPES_TOLERANT
#define DEFAULT_PLUGIN_COMMAND_DIR "/home/christian/workspace/AudioManager/bin/plugins/command"
#define DEFAULT_PLUGIN_ROUTING_DIR "/home/christian/workspace/AudioManager/bin/plugins/routing"
diff --git a/includes/control/ControlReceiveInterface.h b/includes/control/ControlReceiveInterface.h
index 9478794..85fda32 100644
--- a/includes/control/ControlReceiveInterface.h
+++ b/includes/control/ControlReceiveInterface.h
@@ -22,8 +22,8 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_1D9028B1_EE8B_4860_B728_B37C63BA3D03__INCLUDED_)
-#define EA_1D9028B1_EE8B_4860_B728_B37C63BA3D03__INCLUDED_
+#if !defined(EA_E6AC61AD_E107_4b3d_8E11_9A434157C19F__INCLUDED_)
+#define EA_E6AC61AD_E107_4b3d_8E11_9A434157C19F__INCLUDED_
#include <vector>
#include <string>
@@ -39,7 +39,7 @@ namespace am {
* 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 11-Jan-2012 9:19:58 PM
+ * @created 19-Jan-2012 4:32:00 PM
*/
class ControlReceiveInterface
{
@@ -562,4 +562,4 @@ namespace am {
};
}
-#endif // !defined(EA_1D9028B1_EE8B_4860_B728_B37C63BA3D03__INCLUDED_)
+#endif // !defined(EA_E6AC61AD_E107_4b3d_8E11_9A434157C19F__INCLUDED_)
diff --git a/includes/dbus/DBusWrapper.h b/includes/dbus/DBusWrapper.h
index 6999e38..528d111 100644
--- a/includes/dbus/DBusWrapper.h
+++ b/includes/dbus/DBusWrapper.h
@@ -1,104 +1,105 @@
/**
-* Copyright (C) 2011, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file DBusWrapper.h
-*
-* \date 20-Oct-2011 3:42:04 PM
-* \author Christian Mueller (christian.ei.mueller@bmw.de)
-*
-* \section License
-* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
-* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
-*/
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file DBusWrapper.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
#ifndef DBUSWRAPPER_H_
#define DBUSWRAPPER_H_
-
#include <config.h>
#include <SocketHandler.h>
#include <dbus/dbus.h>
#include <string>
#include <list>
-namespace am {
+namespace am
+{
/**
* This wraps dbus and provides everything needed to anyone who wants to use dbus (including plugins)
*/
-class DBusWrapper {
+class DBusWrapper
+{
public:
- DBusWrapper();
- DBusWrapper(SocketHandler* socketHandler);
- virtual ~DBusWrapper();
-
- /**
- * registers a callback that is entered as path below the main path.
- * The configuration of the mainpath is done via DBusConfiguration.h
- * @param vtable the vtable that holds a pointer to the callback that is called when the path is called from the dbus
- * @param path the name of the path
- * @param userdata pointer to the class that will handle the callback
- */
- void registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata);
-
- /**
- * returns the dbus connection
- * @param connection pointer to the connection
- */
- void getDBusConnection(DBusConnection*& connection) const;
-
- /**
- * If Dbus is used, this MainLoop must be called as mainloop, otherwise the messages are not dispatched.
- */
- void dbusMainLoop();
-
- static dbus_bool_t addWatch(DBusWatch *watch, void *userData);
- static void removeWatch(DBusWatch *watch, void *userData);
- static void toogleWatch(DBusWatch *watch, void *userData);
-
- static dbus_bool_t addTimeout(DBusTimeout *timeout,void* userData);
- static void removeTimeout(DBusTimeout *timeout, void* userData);
- static void toggleTimeout(DBusTimeout *timeout, void* userData);
-
- bool dbusDispatchCallback(const sh_pollHandle_t handle, void* userData);
- shPollDispatch_T<DBusWrapper> pDbusDispatchCallback;
-
- 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;
-
- void dbusTimerCallback(sh_timerHandle_t handle, void* userData);
- shTimerCallBack_T<DBusWrapper> pDbusTimerCallback;
+ DBusWrapper();
+ DBusWrapper(SocketHandler* socketHandler);
+ virtual ~DBusWrapper();
+
+ /**
+ * registers a callback that is entered as path below the main path.
+ * The configuration of the mainpath is done via DBusConfiguration.h
+ * @param vtable the vtable that holds a pointer to the callback that is called when the path is called from the dbus
+ * @param path the name of the path
+ * @param userdata pointer to the class that will handle the callback
+ */
+ void registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata);
+
+ /**
+ * returns the dbus connection
+ * @param connection pointer to the connection
+ */
+ void getDBusConnection(DBusConnection*& connection) const;
+
+ /**
+ * If Dbus is used, this MainLoop must be called as mainloop, otherwise the messages are not dispatched.
+ */
+ void dbusMainLoop();
+
+ static dbus_bool_t addWatch(DBusWatch *watch, void *userData);
+ static void removeWatch(DBusWatch *watch, void *userData);
+ static void toogleWatch(DBusWatch *watch, void *userData);
+
+ static dbus_bool_t addTimeout(DBusTimeout *timeout, void* userData);
+ static void removeTimeout(DBusTimeout *timeout, void* userData);
+ static void toggleTimeout(DBusTimeout *timeout, void* userData);
+
+ bool dbusDispatchCallback(const sh_pollHandle_t handle, void* userData);
+ shPollDispatch_T<DBusWrapper> pDbusDispatchCallback;
+
+ 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;
+
+ void dbusTimerCallback(sh_timerHandle_t handle, void* userData);
+ shTimerCallBack_T<DBusWrapper> pDbusTimerCallback;
private:
static DBusWrapper* mReference;
- static DBusHandlerResult cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference);
- dbus_bool_t addWatchDelegate(DBusWatch * watch,void* userData);
- void removeWatchDelegate(DBusWatch *watch, void *userData);
- void toogleWatchDelegate(DBusWatch *watch, void *userData);
- dbus_bool_t addTimeoutDelegate(DBusTimeout *timeout,void* userData);
- void removeTimeoutDelegate(DBusTimeout *timeout, void* userData);
- void toggleTimeoutDelegate(DBusTimeout *timeout, void* userData);
- DBusObjectPathVTable mObjectPathVTable;
+ static DBusHandlerResult cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference);
+ dbus_bool_t addWatchDelegate(DBusWatch * watch, void* userData);
+ void removeWatchDelegate(DBusWatch *watch, void *userData);
+ void toogleWatchDelegate(DBusWatch *watch, void *userData);
+ dbus_bool_t addTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ void removeTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ void toggleTimeoutDelegate(DBusTimeout *timeout, void* userData);
+ DBusObjectPathVTable mObjectPathVTable;
DBusConnection* mDbusConnection;
DBusError mDBusError;
std::list<std::string> mNodesList;
std::vector<sh_timerHandle_t*> mListTimerhandlePointer;
SocketHandler *mSocketHandler;
- std::map<DBusWatch*,sh_pollHandle_t> mMapHandleWatch;
+ std::map<DBusWatch*, sh_pollHandle_t> mMapHandleWatch;
};
}
diff --git a/includes/projecttypes.h b/includes/projecttypes.h
index a50e92c..6e463b9 100644
--- a/includes/projecttypes.h
+++ b/includes/projecttypes.h
@@ -22,15 +22,15 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_D30EA3FF_652C_41f2_84C1_C4EDCBFA0E37__INCLUDED_)
-#define EA_D30EA3FF_652C_41f2_84C1_C4EDCBFA0E37__INCLUDED_
+#if !defined(EA_D441AD1F_B077_485c_AE04_AF1567A1359F__INCLUDED_)
+#define EA_D441AD1F_B077_485c_AE04_AF1567A1359F__INCLUDED_
namespace am {
/**
* This enum classifies the format in which data is exchanged within a connection. The enum itself is project specific although there are some Genivi standard formats defined.
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
enum am_ConnectionFormat_e
{
@@ -45,7 +45,7 @@ namespace am {
* This enum gives the information about reason for reason for Source/Sink change
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
enum am_AvailabilityReason_e
{
@@ -63,7 +63,7 @@ namespace am {
* product specific identifier of property
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
enum am_ClassProperty_e
{
@@ -84,7 +84,7 @@ namespace am {
* 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 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
enum am_RampType_e
{
@@ -106,7 +106,7 @@ namespace am {
* sound properties. Within genivi only the standard properties are defined, for products these need to be extended.
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
enum am_SoundPropertyType_e
{
@@ -121,7 +121,7 @@ namespace am {
* Here are all SoundProperties that can be set via the CommandInterface. Product specific
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
enum am_MainSoundPropertyType_e
{
@@ -138,7 +138,7 @@ namespace am {
* describes the different system properties. Project specific
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:19:57 PM
+ * @created 19-Jan-2012 4:31:59 PM
*/
enum am_SystemPropertyType_e
{
@@ -147,4 +147,4 @@ namespace am {
SYP_MIN = SYP_TEST
};
}
-#endif // !defined(EA_D30EA3FF_652C_41f2_84C1_C4EDCBFA0E37__INCLUDED_)
+#endif // !defined(EA_D441AD1F_B077_485c_AE04_AF1567A1359F__INCLUDED_)
diff --git a/includes/routing/RoutingReceiveInterface.h b/includes/routing/RoutingReceiveInterface.h
index c1cfc76..13752c4 100644
--- a/includes/routing/RoutingReceiveInterface.h
+++ b/includes/routing/RoutingReceiveInterface.h
@@ -22,8 +22,8 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_F103F724_CE43_4c5d_A6E5_859230D16B1E__INCLUDED_)
-#define EA_F103F724_CE43_4c5d_A6E5_859230D16B1E__INCLUDED_
+#if !defined(EA_5AC7DCDD_B4FD_44d2_8783_CC96D8595F43__INCLUDED_)
+#define EA_5AC7DCDD_B4FD_44d2_8783_CC96D8595F43__INCLUDED_
#include <vector>
#include <string>
@@ -41,7 +41,7 @@ namespace am {
* Routing Receive sendInterface description. This class implements everything from RoutingAdapter -> Audiomanager
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:54:30 PM
+ * @created 19-Jan-2012 4:32:01 PM
*/
class RoutingReceiveInterface
{
@@ -324,4 +324,4 @@ namespace am {
};
}
-#endif // !defined(EA_F103F724_CE43_4c5d_A6E5_859230D16B1E__INCLUDED_)
+#endif // !defined(EA_5AC7DCDD_B4FD_44d2_8783_CC96D8595F43__INCLUDED_)
diff --git a/includes/routing/RoutingSendInterface.h b/includes/routing/RoutingSendInterface.h
index 9637a08..ac4b6ab 100644
--- a/includes/routing/RoutingSendInterface.h
+++ b/includes/routing/RoutingSendInterface.h
@@ -22,8 +22,8 @@
*
* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
*/
-#if !defined(EA_8F359F31_A78B_4e36_B94C_31E6A09C8F67__INCLUDED_)
-#define EA_8F359F31_A78B_4e36_B94C_31E6A09C8F67__INCLUDED_
+#if !defined(EA_D17051E6_21F6_42a8_A7D0_F996E885E15F__INCLUDED_)
+#define EA_D17051E6_21F6_42a8_A7D0_F996E885E15F__INCLUDED_
#include <vector>
#include <string>
@@ -41,7 +41,7 @@ namespace am {
* This class implements everything from Audiomanager -> RoutingAdapter
* @author christian
* @version 1.0
- * @created 11-Jan-2012 9:22:46 PM
+ * @created 19-Jan-2012 4:32:02 PM
*/
class RoutingSendInterface
{
@@ -188,4 +188,4 @@ namespace am {
};
}
-#endif // !defined(EA_8F359F31_A78B_4e36_B94C_31E6A09C8F67__INCLUDED_)
+#endif // !defined(EA_D17051E6_21F6_42a8_A7D0_F996E885E15F__INCLUDED_)