summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mueller <christian@lmuc329619u.(none)>2011-12-14 11:36:44 +0100
committerChristian Mueller <christian@lmuc329619u.(none)>2011-12-14 11:36:44 +0100
commit68678bed2dc3d4a5849d283bec84a01e2836603f (patch)
tree57b58aa549d7e0547468c8f13475b3e5ac1326e8
parent92c8b837306ff1dcd889f9c075435aec50e9aea3 (diff)
downloadaudiomanager-68678bed2dc3d4a5849d283bec84a01e2836603f.tar.gz
update in headers, small things
-rw-r--r--AudioManagerDaemon/CMakeLists.txt2
-rw-r--r--AudioManagerDaemon/include/CommandReceiver.h26
-rw-r--r--AudioManagerDaemon/include/CommandSender.h49
-rw-r--r--AudioManagerDaemon/include/ControlReceiver.h40
-rw-r--r--AudioManagerDaemon/include/ControlSender.h44
-rw-r--r--AudioManagerDaemon/include/DatabaseHandler.h60
-rw-r--r--AudioManagerDaemon/include/DatabaseObserver.h65
-rw-r--r--AudioManagerDaemon/include/Observer.h45
-rw-r--r--AudioManagerDaemon/include/PluginTemplate.h (renamed from AudioManagerDaemon/include/pluginTemplate.h)8
-rw-r--r--AudioManagerDaemon/include/RoutingReceiver.h42
-rw-r--r--AudioManagerDaemon/include/RoutingSender.h95
-rw-r--r--AudioManagerDaemon/src/CommandReceiver.cpp29
-rw-r--r--AudioManagerDaemon/src/CommandSender.cpp63
-rw-r--r--AudioManagerDaemon/src/ControlReceiver.cpp42
-rw-r--r--AudioManagerDaemon/src/ControlSender.cpp11
-rw-r--r--AudioManagerDaemon/src/DBusWrapper.cpp1
-rw-r--r--AudioManagerDaemon/src/DatabaseHandler.cpp108
-rw-r--r--AudioManagerDaemon/src/DatabaseObserver.cpp205
-rw-r--r--AudioManagerDaemon/src/Observer.cpp188
-rw-r--r--AudioManagerDaemon/src/RoutingReceiver.cpp32
-rw-r--r--AudioManagerDaemon/src/RoutingSender.cpp64
-rw-r--r--AudioManagerDaemon/src/main.cpp67
-rw-r--r--AudioManagerDaemon/test/CommandInterfaceBackdoor.h1
-rw-r--r--AudioManagerDaemon/test/controlInterface/CMakeLists.txt2
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp24
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h8
-rw-r--r--AudioManagerDaemon/test/database/CMakeLists.txt2
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.cpp13
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.h2
-rw-r--r--AudioManagerDaemon/test/routingInterface/CMakeLists.txt2
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp9
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h8
32 files changed, 828 insertions, 529 deletions
diff --git a/AudioManagerDaemon/CMakeLists.txt b/AudioManagerDaemon/CMakeLists.txt
index d591de6..8f3c416 100644
--- a/AudioManagerDaemon/CMakeLists.txt
+++ b/AudioManagerDaemon/CMakeLists.txt
@@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 2.6)
PROJECT(AudioManagerDeamon)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
-#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
diff --git a/AudioManagerDaemon/include/CommandReceiver.h b/AudioManagerDaemon/include/CommandReceiver.h
index a49c03d..2e49c9a 100644
--- a/AudioManagerDaemon/include/CommandReceiver.h
+++ b/AudioManagerDaemon/include/CommandReceiver.h
@@ -1,19 +1,9 @@
-/*
- * CommandReceiver.h
- *
- * Created on: Oct 24, 2011
- * Author: christian
- */
-
-#ifndef COMMANDRECEIVER_H_
-#define COMMANDRECEIVER_H_
-
/**
* Copyright (C) 2011, BMW AG
*
* GeniviAudioMananger AudioManagerDaemon
*
-* \file DBusWrapper.cpp
+* \file CommandReveiver.h
*
* \date 20-Oct-2011 3:42:04 PM
* \author Christian Mueller (christian.ei.mueller@bmw.de)
@@ -30,8 +20,11 @@
* 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 COMMANDRECEIVER_H_
+#define COMMANDRECEIVER_H_
+
#include <command/CommandReceiveInterface.h>
#include "DatabaseHandler.h"
#include "DBusWrapper.h"
@@ -39,6 +32,9 @@
using namespace am;
+/**
+ * This class realizes the command Interface
+ */
class CommandReceiver: public CommandReceiveInterface {
public:
CommandReceiver(DatabaseHandler* iDatabaseHandler, DBusWrapper* iDBusWrapper, ControlSender* iControlSender);
@@ -63,9 +59,9 @@ public:
am_Error_e getDBusConnectionWrapper(DBusWrapper*& dbusConnectionWrapper) const ;
private:
- DatabaseHandler* mDatabaseHandler;
- DBusWrapper* mDBusWrapper;
- ControlSender* mControlSender;
+ DatabaseHandler* mDatabaseHandler; //!< pointer to the databasehandler
+ DBusWrapper* mDBusWrapper; //!< pointer to the dbuswrapper
+ ControlSender* mControlSender; //!< pointer to the control sender
};
#endif /* COMMANDRECEIVER_H_ */
diff --git a/AudioManagerDaemon/include/CommandSender.h b/AudioManagerDaemon/include/CommandSender.h
index 2cd5025..a871a77 100644
--- a/AudioManagerDaemon/include/CommandSender.h
+++ b/AudioManagerDaemon/include/CommandSender.h
@@ -1,24 +1,45 @@
-/*
- * CommandSender.h
- *
- * Created on: Oct 26, 2011
- * Author: christian
- */
+/**
+* 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_
-#include "command/CommandSendInterface.h"
-
#ifdef UNIT_TEST
-#include "../test/CommandInterfaceBackdoor.h"
+#include "../test/CommandInterfaceBackdoor.h" //we need this for the unit test
#endif
+#include "command/CommandSendInterface.h"
+
using 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 {
public:
- CommandSender();
+ CommandSender(const std::vector<std::string>& listOfPluginDirectories);
virtual ~CommandSender();
am_Error_e startupInterface(CommandReceiveInterface* commandreceiveinterface) ;
am_Error_e stopInterface() ;
@@ -39,12 +60,12 @@ public:
void cbSystemPropertyChanged(const am_SystemProperty_s& SystemProperty) ;
void cbTimingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time) ;
#ifdef UNIT_TEST
- friend class CommandInterfaceBackdoor;
+ friend class CommandInterfaceBackdoor; //this is to get access to the loaded plugins and be able to exchange the interfaces
#endif
private:
- void unloadLibraries(void);
- std::vector<CommandSendInterface*> mListInterfaces;
- std::vector<void*> mListLibraryHandles;
+ 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.
};
#endif /* COMMANDSENDER_H_ */
diff --git a/AudioManagerDaemon/include/ControlReceiver.h b/AudioManagerDaemon/include/ControlReceiver.h
index 1b5c072..5564fd0 100644
--- a/AudioManagerDaemon/include/ControlReceiver.h
+++ b/AudioManagerDaemon/include/ControlReceiver.h
@@ -1,9 +1,26 @@
-/*
- * ContronlReceiver.h
- *
- * Created on: Oct 24, 2011
- * Author: christian
- */
+/**
+* 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_
@@ -11,12 +28,16 @@
#include <control/ControlReceiveInterface.h>
#include "DatabaseHandler.h"
#include "RoutingSender.h"
+#include "CommandSender.h"
using namespace am;
+/**
+ * This class is used to receive all commands from the control interface
+ */
class ControlReceiver: public ControlReceiveInterface {
public:
- ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender);
+ 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) ;
@@ -81,8 +102,9 @@ public:
void setCommandReady() ;
private:
- DatabaseHandler* mDatabaseHandler;
- RoutingSender* mRoutingSender;
+ DatabaseHandler* mDatabaseHandler; //!< pointer tto the databasehandler
+ RoutingSender* mRoutingSender; //!< pointer to the routing send interface.
+ CommandSender* mCommandSender; //!< pointer to the command send interface
};
#endif /* CONTRONLRECEIVER_H_ */
diff --git a/AudioManagerDaemon/include/ControlSender.h b/AudioManagerDaemon/include/ControlSender.h
index ac917be..133b7cd 100644
--- a/AudioManagerDaemon/include/ControlSender.h
+++ b/AudioManagerDaemon/include/ControlSender.h
@@ -1,28 +1,47 @@
-/*
- * ControlSender.h
- *
- * Created on: Dec 9, 2011
- * Author: christian
- */
+/**
+* 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_
-#include "control/ControlSendInterface.h"
-
#ifdef UNIT_TEST
#include "../test/ControlInterfaceBackdoor.h"
#endif
+#include "control/ControlSendInterface.h"
+
using namespace am;
+/**
+ * sends data to the commandInterface, takes the file of the library that needs to be loaded
+ */
class ControlSender {
public:
- ControlSender();
+ ControlSender(std::string controlPluginFile);
virtual ~ControlSender();
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) ;
@@ -41,6 +60,7 @@ public:
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) ;
@@ -64,8 +84,8 @@ public:
friend class ControlInterfaceBackdoor;
#endif
private:
- ControlSendInterface* mController;
- void* mlibHandle;
+ ControlSendInterface* mController; //!< pointer to the ControlSend interface
+ void* mlibHandle; //!< pointer to the loaded control plugin interface
};
#endif /* CONTROLSENDER_H_ */
diff --git a/AudioManagerDaemon/include/DatabaseHandler.h b/AudioManagerDaemon/include/DatabaseHandler.h
index 057b7a8..798cd27 100644
--- a/AudioManagerDaemon/include/DatabaseHandler.h
+++ b/AudioManagerDaemon/include/DatabaseHandler.h
@@ -1,26 +1,37 @@
-/*
- * DatabaseHandler.h
- *
- * Created on: Oct 24, 2011
- * Author: christian
- */
+/**
+* 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_
-#include "Observer.h"
#include "audiomanagertypes.h"
-#include <map>
-#include <string>
-#include <stdint.h>
-#include <fstream>
-#include <sstream>
-#include <vector>
+#include "DatabaseObserver.h"
#include <sqlite3.h>
using namespace am;
-#define DYNAMIC_ID_BOUNDARY 100
+#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.
@@ -31,9 +42,12 @@ using namespace am;
//todo: create test to ensure uniqueness of names throughout the database
//todo: enforce the uniqueness of names
+/**
+ * This class handles and abstracts the database
+ */
class DatabaseHandler {
public:
- DatabaseHandler();
+ 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) ;
@@ -212,7 +226,7 @@ public:
* registers the Observer at the Database
* @param iObserver pointer to the observer
*/
- void registerObserver(Observer *iObserver);
+ void registerObserver(DatabaseObserver *iObserver);
/**
* gives information about the visibility of a source
@@ -232,18 +246,18 @@ private:
am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const;
bool connectionPartofMainConnection(const am_connectionID_t connectionID,const am_mainConnectionID_t mainConnectionID) const;
bool sqQuery(const std::string& query);
- bool openDatabase();
- void createTables();
- sqlite3 *mDatabase;
- std::string mPath;
- Observer *mObserver;
+ 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;
- ListConnectionFormat mListConnectionFormat;
+ typedef std::map<am_gatewayID_t,std::vector<bool> > ListConnectionFormat; //!< type for list of connection formats
+ ListConnectionFormat mListConnectionFormat; //!< list of connection formats
};
#endif /* DATABASEHANDLER_H_ */
diff --git a/AudioManagerDaemon/include/DatabaseObserver.h b/AudioManagerDaemon/include/DatabaseObserver.h
new file mode 100644
index 0000000..42b38c2
--- /dev/null
+++ b/AudioManagerDaemon/include/DatabaseObserver.h
@@ -0,0 +1,65 @@
+/**
+* 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 "CommandSender.h"
+#include "RoutingSender.h"
+
+/**
+ * This class observes the Database and notifies other classes about important events, mainly the CommandSender.
+ */
+class DatabaseObserver {
+public:
+ DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender);
+ 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
+};
+
+#endif /* DATABASEOBSERVER_H_ */
diff --git a/AudioManagerDaemon/include/Observer.h b/AudioManagerDaemon/include/Observer.h
deleted file mode 100644
index f616722..0000000
--- a/AudioManagerDaemon/include/Observer.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Observer.h
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
-
-#ifndef OBSERVER_H_
-#define OBSERVER_H_
-
-#include "CommandSender.h"
-#include "RoutingSender.h"
-
-class Observer {
-public:
- Observer(CommandSender *iCommandSender, RoutingSender *iRoutingSender);
- virtual ~Observer();
- 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;
- RoutingSender* mRoutingSender;
-};
-
-#endif /* OBSERVER_H_ */
diff --git a/AudioManagerDaemon/include/pluginTemplate.h b/AudioManagerDaemon/include/PluginTemplate.h
index 0054d92..f995f0c 100644
--- a/AudioManagerDaemon/include/pluginTemplate.h
+++ b/AudioManagerDaemon/include/PluginTemplate.h
@@ -20,20 +20,14 @@
* 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 PLUGINTEMPLATE_H_
#define PLUGINTEMPLATE_H_
-#include <iostream>
-#include <stdio.h>
-#include <dirent.h>
+#include <dlt/dlt.h>
#include <dlfcn.h>
#include <libgen.h>
-#include <unistd.h>
-#include <string>
-#include <dlt/dlt.h>
DLT_IMPORT_CONTEXT(AudioManager)
diff --git a/AudioManagerDaemon/include/RoutingReceiver.h b/AudioManagerDaemon/include/RoutingReceiver.h
index f2dc405..2c1cf0e 100644
--- a/AudioManagerDaemon/include/RoutingReceiver.h
+++ b/AudioManagerDaemon/include/RoutingReceiver.h
@@ -1,20 +1,40 @@
-/*
- * RoutingReceiver.h
- *
- * Created on: Oct 24, 2011
- * Author: christian
- */
+/**
+* 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_
#include "routing/RoutingReceiveInterface.h"
-#include "ControlSender.h"
-#include "RoutingSender.h"
#include "DatabaseHandler.h"
+#include "RoutingSender.h"
+#include "ControlSender.h"
using namespace am;
+/**
+ * Implements the Receiving side of the RoutingPlugins.
+ */
class RoutingReceiver : public RoutingReceiveInterface {
public:
RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender);
@@ -53,9 +73,9 @@ public:
am_Error_e sendChangedData(const std::vector<am_EarlyData_s>& earlyData) ;
am_Error_e getDBusConnectionWrapper(DBusWrapper* dbusConnectionWrapper) const ;
private:
- DatabaseHandler *mDatabaseHandler;
- RoutingSender *mRoutingSender;
- ControlSender *mControlSender;
+ DatabaseHandler *mDatabaseHandler; //!< pointer to the databaseHandler
+ RoutingSender *mRoutingSender; //!< pointer to the routingSender
+ ControlSender *mControlSender; //!< pointer to the controlSender
};
diff --git a/AudioManagerDaemon/include/RoutingSender.h b/AudioManagerDaemon/include/RoutingSender.h
index a931940..0a7a1eb 100644
--- a/AudioManagerDaemon/include/RoutingSender.h
+++ b/AudioManagerDaemon/include/RoutingSender.h
@@ -1,27 +1,45 @@
-/*
- * RoutingSender.h
- *
- * Created on: Oct 26, 2011
- * Author: christian
- */
+/**
+* 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_
#include "routing/RoutingSendInterface.h"
+#include <map>
#ifdef UNIT_TEST //this is needed to test RoutingSender
#include "../test/RoutingInterfaceBackdoor.h"
#endif
-#include <map>
-#include <set>
-
using namespace am;
+/**
+ * Implements the RoutingSendInterface. Loads all plugins and dispatches calls to the plugins
+ */
class RoutingSender {
public:
- RoutingSender();
+ RoutingSender(const std::vector<std::string>& listOfPluginDirectories);
virtual ~RoutingSender();
/**
@@ -90,13 +108,14 @@ public:
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 ;
+ //!< is used to pair interfaces with busnames
struct InterfaceNamePairs
{
RoutingSendInterface* routingInterface;
std::string busName;
};
- //todo: maybe this would be valuable information for the controller...
+ //!< is used to store data related to handles
class am_handleData_c
{
public:
@@ -122,10 +141,16 @@ public:
friend class RoutingInterfaceBackdoor;
#endif
-am_handleData_c returnHandleData(am_Handle_s handle);
+ /**
+ * returns the data that belong to handles
+ * @param handle the handle
+ * @return a class holding the handle data
+ */
+ am_handleData_c returnHandleData(am_Handle_s handle);
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
@@ -134,27 +159,33 @@ private:
}
};
+ /**
+ * 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);
-
- typedef std::map<am_domainID_t, RoutingSendInterface*> DomainInterfaceMap;
- typedef std::map<am_sinkID_t, RoutingSendInterface*> SinkInterfaceMap;
- typedef std::map<am_sourceID_t, RoutingSendInterface*> SourceInterfaceMap;
- typedef std::map<am_crossfaderID_t, RoutingSendInterface*> CrossfaderInterfaceMap;
- typedef std::map<am_connectionID_t, RoutingSendInterface*> ConnectionInterfaceMap;
- typedef std::map<uint16_t, RoutingSendInterface*> HandleInterfaceMap;
- typedef std::map<am_Handle_s,am_handleData_c,comparator> HandlesMap;
-
- int16_t mHandleCount;
- std::vector<InterfaceNamePairs> mListInterfaces;
- std::vector<void*> mListLibraryHandles;
- ConnectionInterfaceMap mMapConnectionInterface;
- CrossfaderInterfaceMap mMapCrossfaderInterface;
- DomainInterfaceMap mMapDomainInterface;
- SinkInterfaceMap mMapSinkInterface;
- SourceInterfaceMap mMapSourceInterface;
- HandleInterfaceMap mMapHandleInterface;
- HandlesMap mlistActiveHandles;
+ void unloadLibraries(void); //!< unloads all loaded plugins
+
+ typedef std::map<am_domainID_t, RoutingSendInterface*> DomainInterfaceMap; //!< maps domains to interfaces
+ typedef std::map<am_sinkID_t, RoutingSendInterface*> SinkInterfaceMap; //!< maps sinks to interfaces
+ typedef std::map<am_sourceID_t, RoutingSendInterface*> SourceInterfaceMap; //!< maps sources to interfaces
+ typedef std::map<am_crossfaderID_t, RoutingSendInterface*> CrossfaderInterfaceMap; //!< maps crossfaders to interfaces
+ typedef std::map<am_connectionID_t, RoutingSendInterface*> ConnectionInterfaceMap; //!< maps connections to interfaces
+ typedef std::map<uint16_t, RoutingSendInterface*> HandleInterfaceMap; //!< maps handles to interfaces
+ typedef std::map<am_Handle_s,am_handleData_c,comparator> HandlesMap; //!< maps handleData to handles
+
+ int16_t mHandleCount; //!< is used to create handles
+ std::vector<InterfaceNamePairs> mListInterfaces; //!< list of busname/interface relation
+ std::vector<void*> mListLibraryHandles; //!< list of all loaded pluginInterfaces
+ ConnectionInterfaceMap mMapConnectionInterface; //!< map of connection to interfaces
+ CrossfaderInterfaceMap mMapCrossfaderInterface; //!< map of crossfaders to interface
+ DomainInterfaceMap mMapDomainInterface; //!< map of domains to interfaces
+ SinkInterfaceMap mMapSinkInterface; //!< map of sinks to interfaces
+ SourceInterfaceMap mMapSourceInterface; //!< map of sources to interfaces
+ HandleInterfaceMap mMapHandleInterface; //!< map of handles to interfaces
+ HandlesMap mlistActiveHandles; //!< list of all currently "running" handles.
};
#endif /* ROUTINGSENDER_H_ */
diff --git a/AudioManagerDaemon/src/CommandReceiver.cpp b/AudioManagerDaemon/src/CommandReceiver.cpp
index a970f6b..b9e8eeb 100644
--- a/AudioManagerDaemon/src/CommandReceiver.cpp
+++ b/AudioManagerDaemon/src/CommandReceiver.cpp
@@ -1,9 +1,26 @@
-/*
- * CommandReceiver.cpp
- *
- * Created on: Oct 24, 2011
- * Author: christian
- */
+/**
+* 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 <dlt/dlt.h>
diff --git a/AudioManagerDaemon/src/CommandSender.cpp b/AudioManagerDaemon/src/CommandSender.cpp
index 841c520..8c0afb4 100644
--- a/AudioManagerDaemon/src/CommandSender.cpp
+++ b/AudioManagerDaemon/src/CommandSender.cpp
@@ -1,16 +1,35 @@
-/*
- * CommandSender.cpp
- *
- * Created on: Oct 26, 2011
- * Author: christian
- */
+/**
+* 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/CommandSendInterface.h"
-#include "pluginTemplate.h"
+#include "PluginTemplate.h"
+#include <dirent.h>
using namespace am;
+//!< macro to call all interfaces
#define CALL_ALL_INTERFACES(...) \
std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin(); \
std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end(); \
@@ -19,26 +38,24 @@ using namespace am;
(*iter)->__VA_ARGS__; \
}
-
-const char* commandPluginDirectories[] = { "/home/christian/workspace/gitserver/build/plugins/command"};
-uint16_t commandPluginDirectoriesCount = sizeof(commandPluginDirectories) / sizeof(commandPluginDirectories[0]);
-
-CommandSender::CommandSender()
+CommandSender::CommandSender(const std::vector<std::string>& listOfPluginDirectories)
:mListInterfaces(),
mListLibraryHandles()
{
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 (uint16_t dirIndex = 0; dirIndex < commandPluginDirectoriesCount; dirIndex++)
+ for (; dirIter < dirIterEnd; ++dirIter)
{
- const char* directoryName = commandPluginDirectories[dirIndex];
- //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Searching for HookPlugins in"),DLT_STRING(directoryName));
+ 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(dirName.c_str()));
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Error opening directory "),DLT_STRING(directoryName));
}
// iterate content of directory
@@ -53,16 +70,10 @@ CommandSender::CommandSender()
if (regularFile && sharedLibExtension)
{
- // DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("PluginSearch 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("PluginSearch ignoring file "),DLT_STRING(entryName.c_str()));
- }
}
-
closedir(directory);
}
@@ -72,14 +83,14 @@ CommandSender::CommandSender()
for (; iter < iterEnd; ++iter)
{
- //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Loading Hook plugin"),DLT_STRING(iter->c_str()));
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Loading CommandSender plugin"),DLT_STRING(iter->c_str()));
CommandSendInterface* (*createFunc)();
void* tempLibHandle=NULL;
createFunc = getCreateFunction<CommandSendInterface*()>(*iter,tempLibHandle);
if (!createFunc)
{
- // DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Entry point of Communicator not found"));
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Entry point of CommandPlugin not found"),DLT_STRING(iter->c_str()));
continue;
}
@@ -87,7 +98,7 @@ CommandSender::CommandSender()
if (!commander)
{
- //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("HookPlugin initialization failed. Entry Function not callable"));
+ DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("CommandPlugin initialization failed. Entry Function not callable"));
continue;
}
diff --git a/AudioManagerDaemon/src/ControlReceiver.cpp b/AudioManagerDaemon/src/ControlReceiver.cpp
index e3e888f..efa24e1 100644
--- a/AudioManagerDaemon/src/ControlReceiver.cpp
+++ b/AudioManagerDaemon/src/ControlReceiver.cpp
@@ -1,19 +1,41 @@
-/*
- * ContronlReceiver.cpp
- *
- * Created on: Oct 24, 2011
- * Author: christian
- */
+/**
+* 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 "ControlReceiver.h"
#include <dlt/dlt.h>
+#include <assert.h>
DLT_IMPORT_CONTEXT(AudioManager)
-ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender)
+ControlReceiver::ControlReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, CommandSender *iCommandSender)
: mDatabaseHandler(iDatabaseHandler),
- mRoutingSender(iRoutingSender)
+ mRoutingSender(iRoutingSender),
+ mCommandSender(iCommandSender)
{
+ assert(mDatabaseHandler!=NULL);
+ assert(mRoutingSender!=NULL);
+ assert(mCommandSender!=NULL);
}
ControlReceiver::~ControlReceiver()
@@ -467,10 +489,14 @@ am_Error_e ControlReceiver::removeSourceClassDB(const am_sourceClass_t sourceCla
void ControlReceiver::setCommandReady()
{
+ 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();
}
diff --git a/AudioManagerDaemon/src/ControlSender.cpp b/AudioManagerDaemon/src/ControlSender.cpp
index de2e3b7..57b5974 100644
--- a/AudioManagerDaemon/src/ControlSender.cpp
+++ b/AudioManagerDaemon/src/ControlSender.cpp
@@ -6,20 +6,17 @@
*/
#include "ControlSender.h"
-#include "control/ControlSendInterface.h"
-#include "control/ControlReceiveInterface.h"
-#include "pluginTemplate.h"
+#include "PluginTemplate.h"
#include <assert.h>
-std::string controlPluginFile= "/home/christian/workspace/gitserver/build/plugins/control/libPluginControlInterface.so";
-ControlSender::ControlSender()
+ControlSender::ControlSender(std::string controlPluginFile)
+ :mlibHandle(NULL),
+ mController(NULL)
{
ControlSendInterface* (*createFunc)();
createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile,mlibHandle);
-
assert(createFunc!=NULL);
-
mController = createFunc();
}
diff --git a/AudioManagerDaemon/src/DBusWrapper.cpp b/AudioManagerDaemon/src/DBusWrapper.cpp
index 6f971df..b15374d 100644
--- a/AudioManagerDaemon/src/DBusWrapper.cpp
+++ b/AudioManagerDaemon/src/DBusWrapper.cpp
@@ -20,7 +20,6 @@
* 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 "DBusWrapper.h"
diff --git a/AudioManagerDaemon/src/DatabaseHandler.cpp b/AudioManagerDaemon/src/DatabaseHandler.cpp
index 28fa8db..e9884ca 100644
--- a/AudioManagerDaemon/src/DatabaseHandler.cpp
+++ b/AudioManagerDaemon/src/DatabaseHandler.cpp
@@ -1,26 +1,33 @@
-/*
- * DatabaseHandler.cpp
- *
- * Created on: Oct 24, 2011
- * Author: christian
- */
+/**
+* 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 "Observer.h"
#include <dlt/dlt.h>
#include <assert.h>
-#include <stdint.h>
+#include <vector>
#include <fstream>
#include <sstream>
-#include <stdlib.h>
-#include <stdio.h>
-#include <malloc.h>
-#include <string.h>
-
-DLT_IMPORT_CONTEXT(AudioManager)
-
-//#define DATABASE_PATH "/tmp/audiomanager.sqlite"
-#define DATABASE_PATH ":memory:"
#define DOMAIN_TABLE "Domains"
#define SOURCE_CLASS_TABLE "SourceClasses"
@@ -35,6 +42,8 @@ DLT_IMPORT_CONTEXT(AudioManager)
#define MAIN_TABLE "MainTable"
#define SYSTEM_TABLE "SystemProperties"
+DLT_IMPORT_CONTEXT(AudioManager)
+
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));",
@@ -61,10 +70,10 @@ inline std::string i2s(T const& x)
return o.str();
}
-DatabaseHandler::DatabaseHandler()
+DatabaseHandler::DatabaseHandler(std::string databasePath)
: mDatabase(NULL),
- mPath(DATABASE_PATH),
- mObserver(NULL),
+ mPath(databasePath),
+ mDatabaseObserver(NULL),
mFirstStaticSink(true),
mFirstStaticSource(true),
mFirstStaticGateway(true),
@@ -168,7 +177,7 @@ am_Error_e DatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_dom
am_Domain_s domain=domainData;
domain.domainID=domainID;
- if(mObserver) mObserver->newDomain(domain);
+ if(mDatabaseObserver) mDatabaseObserver->newDomain(domain);
return E_OK;
}
@@ -267,10 +276,10 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
DLT_STRING("delay:"),DLT_INT16(delay),
DLT_STRING("assigned ID:"),DLT_INT16(connectionID));
- if (mObserver)
+ if (mDatabaseObserver)
{
- mObserver->numberOfMainConnectionsChanged();
- mObserver->mainConnectionStateChanged(connectionID,mainConnectionData.connectionState);
+ mDatabaseObserver->numberOfMainConnectionsChanged();
+ mDatabaseObserver->mainConnectionStateChanged(connectionID,mainConnectionData.connectionState);
}
//finally, we update the delay value for the maintable
@@ -457,7 +466,7 @@ am_Error_e DatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t
am_Sink_s sink=sinkData;
sink.sinkID=sinkID;
- if (mObserver!=NULL) mObserver->newSink(sink);
+ if (mDatabaseObserver!=NULL) mDatabaseObserver->newSink(sink);
return E_OK;
}
@@ -586,7 +595,7 @@ am_Error_e DatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData, am_
am_Gateway_s gateway=gatewayData;
gateway.gatewayID=gatewayID;
- if(mObserver) mObserver->newGateway(gateway);
+ if(mDatabaseObserver) mDatabaseObserver->newGateway(gateway);
return E_OK;
}
@@ -769,7 +778,7 @@ am_Error_e DatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sou
am_Source_s source=sourceData;
source.sourceID=sourceID;
- if(mObserver) mObserver->newSource(source);
+ if(mDatabaseObserver) mDatabaseObserver->newSource(source);
return E_OK;
}
@@ -872,7 +881,7 @@ am_Error_e DatabaseHandler::changeMainConnectionStateDB(const am_mainConnectionI
}
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeMainConnectionStateDB changed mainConnectionState of MainConnection:"),DLT_INT(mainconnectionID),DLT_STRING("to:"),DLT_INT(connectionState));
- if (mObserver) mObserver->mainConnectionStateChanged(mainconnectionID,connectionState);
+ if (mDatabaseObserver) mDatabaseObserver->mainConnectionStateChanged(mainconnectionID,connectionState);
return E_OK;
}
@@ -906,7 +915,7 @@ am_Error_e DatabaseHandler::changeSinkMainVolumeDB(const am_mainVolume_t mainVol
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSinkMainVolumeDB changed mainVolume of sink:"),DLT_INT(sinkID),DLT_STRING("to:"),DLT_INT(mainVolume));
- if(mObserver) mObserver->volumeChanged(sinkID,mainVolume);
+ if(mDatabaseObserver) mDatabaseObserver->volumeChanged(sinkID,mainVolume);
return E_OK;
}
@@ -943,7 +952,7 @@ am_Error_e DatabaseHandler::changeSinkAvailabilityDB(const am_Availability_s & a
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 (mObserver && sourceVisible(sinkID)) mObserver->sinkAvailabilityChanged(sinkID,availability);
+ if (mDatabaseObserver && sourceVisible(sinkID)) mDatabaseObserver->sinkAvailabilityChanged(sinkID,availability);
return E_OK;
}
@@ -1011,7 +1020,7 @@ am_Error_e DatabaseHandler::changeSinkMuteStateDB(const am_MuteState_e 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(mObserver) mObserver->sinkMuteStateChanged(sinkID,muteState);
+ if(mDatabaseObserver) mDatabaseObserver->sinkMuteStateChanged(sinkID,muteState);
return E_OK;
}
@@ -1047,7 +1056,7 @@ am_Error_e DatabaseHandler::changeMainSinkSoundPropertyDB(const am_MainSoundProp
}
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 (mObserver) mObserver->mainSinkSoundPropertyChanged(sinkID,soundProperty);
+ if (mDatabaseObserver) mDatabaseObserver->mainSinkSoundPropertyChanged(sinkID,soundProperty);
return E_OK;
}
@@ -1083,7 +1092,7 @@ am_Error_e DatabaseHandler::changeMainSourceSoundPropertyDB(const am_MainSoundPr
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(mObserver) mObserver->mainSourceSoundPropertyChanged(sourceID,soundProperty);
+ if(mDatabaseObserver) mDatabaseObserver->mainSourceSoundPropertyChanged(sourceID,soundProperty);
return E_OK;
}
@@ -1119,7 +1128,7 @@ am_Error_e DatabaseHandler::changeSourceAvailabilityDB(const am_Availability_s &
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 (mObserver && sourceVisible(sourceID)) mObserver->sourceAvailabilityChanged(sourceID,availability);
+ if (mDatabaseObserver && sourceVisible(sourceID)) mDatabaseObserver->sourceAvailabilityChanged(sourceID,availability);
return E_OK;
}
@@ -1150,7 +1159,7 @@ am_Error_e DatabaseHandler::changeSystemPropertyDB(const am_SystemProperty_s & p
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::changeSystemPropertyDB changed system property"));
- if(mObserver) mObserver->systemPropertyChanged(property);
+ if(mDatabaseObserver) mDatabaseObserver->systemPropertyChanged(property);
return E_OK;
}
@@ -1170,7 +1179,7 @@ am_Error_e DatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_t m
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 (mObserver) mObserver->numberOfMainConnectionsChanged();
+ if (mDatabaseObserver) mDatabaseObserver->numberOfMainConnectionsChanged();
return E_OK;
}
@@ -1194,7 +1203,7 @@ am_Error_e DatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
if(!sqQuery(command3)) return E_DATABASE_ERROR;
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSinkDB removed:"),DLT_INT(sinkID));
- if (mObserver!=NULL) mObserver->removedSink(sinkID);
+ if (mDatabaseObserver!=NULL) mDatabaseObserver->removedSink(sinkID);
return E_OK;
}
@@ -1218,7 +1227,7 @@ am_Error_e DatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
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(mObserver) mObserver->removedSource(sourceID);
+ if(mDatabaseObserver) mDatabaseObserver->removedSource(sourceID);
return E_OK;
}
@@ -1235,7 +1244,7 @@ am_Error_e DatabaseHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
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(mObserver) mObserver->removeGateway(gatewayID);
+ if(mDatabaseObserver) mDatabaseObserver->removeGateway(gatewayID);
return E_OK;
}
@@ -1261,7 +1270,7 @@ am_Error_e DatabaseHandler::removeDomainDB(const am_domainID_t domainID)
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(mObserver) mObserver->removeDomain(domainID);
+ if(mDatabaseObserver) mDatabaseObserver->removeDomain(domainID);
return E_OK;
}
@@ -1279,7 +1288,7 @@ am_Error_e DatabaseHandler::removeSinkClassDB(const am_sinkClass_t sinkClassID)
if(!sqQuery(command1)) return E_DATABASE_ERROR;
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSinkClassDB removed:"),DLT_INT(sinkClassID));
- if (mObserver) mObserver->numberOfSinkClassesChanged();
+ if (mDatabaseObserver) mDatabaseObserver->numberOfSinkClassesChanged();
return E_OK;
}
@@ -1298,7 +1307,7 @@ am_Error_e DatabaseHandler::removeSourceClassDB(const am_sourceClass_t sourceCla
if(!sqQuery(command1)) return E_DATABASE_ERROR;
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeSourceClassDB removed:"),DLT_INT(sourceClassID));
- if (mObserver) mObserver->numberOfSourceClassesChanged();
+ if (mDatabaseObserver) mDatabaseObserver->numberOfSourceClassesChanged();
return E_OK;
}
@@ -2595,7 +2604,7 @@ am_Error_e DatabaseHandler::changeDelayMainConnection(const am_timeSync_t & dela
return E_DATABASE_ERROR;
}
- if(mObserver) mObserver->timingInformationChanged(connectionID,delay);
+ if(mDatabaseObserver) mDatabaseObserver->timingInformationChanged(connectionID,delay);
return E_OK;
}
@@ -2720,7 +2729,7 @@ am_Error_e DatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass, a
}
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSinkClassDB entered new sinkClass"));
- if (mObserver) mObserver->numberOfSinkClassesChanged();
+ if (mDatabaseObserver) mDatabaseObserver->numberOfSinkClassesChanged();
return E_OK;
}
@@ -2804,7 +2813,7 @@ am_Error_e DatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClassID,
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::enterSourceClassDB entered new sourceClass"));
- if (mObserver) mObserver->numberOfSourceClassesChanged();
+ if (mDatabaseObserver) mDatabaseObserver->numberOfSourceClassesChanged();
return E_OK;
}
@@ -3190,13 +3199,10 @@ am_timeSync_t DatabaseHandler::calculateMainConnectionDelay(const am_mainConnect
return delay;
}
-void DatabaseHandler::registerObserver(Observer *iObserver)
+void DatabaseHandler::registerObserver(DatabaseObserver *iObserver)
{
- #ifndef UNIT_TEST //we need this here for unittest
- assert(iObserver!=NULL);
- #endif
-
- mObserver=iObserver;
+ assert(iObserver!=NULL);
+ mDatabaseObserver=iObserver;
}
bool DatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
diff --git a/AudioManagerDaemon/src/DatabaseObserver.cpp b/AudioManagerDaemon/src/DatabaseObserver.cpp
new file mode 100644
index 0000000..ba10a7e
--- /dev/null
+++ b/AudioManagerDaemon/src/DatabaseObserver.cpp
@@ -0,0 +1,205 @@
+/**
+* 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"
+#include <assert.h>
+
+DatabaseObserver::DatabaseObserver(CommandSender *iCommandSender, RoutingSender *iRoutingSender)
+ :mCommandSender(iCommandSender),
+ mRoutingSender(iRoutingSender)
+{
+ assert(mCommandSender!=0);
+ assert(mRoutingSender!=0);
+}
+
+DatabaseObserver::~DatabaseObserver() {
+ // TODO Auto-generated destructor stub
+}
+
+void DatabaseObserver::newSink(am_Sink_s sink)
+{
+ mRoutingSender->addSinkLookup(sink);
+ mCommandSender->cbNumberOfSinksChanged();
+}
+
+
+
+void DatabaseObserver::newSource(am_Source_s source)
+{
+ mRoutingSender->addSourceLookup(source);
+ mCommandSender->cbNumberOfSourcesChanged();
+}
+
+
+
+void DatabaseObserver::newDomain(am_Domain_s domain)
+{
+ mRoutingSender->addDomainLookup(domain);
+}
+
+
+
+void DatabaseObserver::newGateway(am_Gateway_s gateway)
+{
+ //todo: implement something
+}
+
+
+
+void DatabaseObserver::newCrossfader(am_Crossfader_s crossfader)
+{
+ mRoutingSender->addCrossfaderLookup(crossfader);
+}
+
+
+
+void DatabaseObserver::removedSink(am_sinkID_t sinkID)
+{
+ mRoutingSender->removeSinkLookup(sinkID);
+ mCommandSender->cbNumberOfSinksChanged();
+}
+
+
+
+void DatabaseObserver::removedSource(am_sourceID_t sourceID)
+{
+ mRoutingSender->removeSourceLookup(sourceID);
+ mCommandSender->cbNumberOfSourcesChanged();
+}
+
+
+
+void DatabaseObserver::removeDomain(am_domainID_t domainID)
+{
+ mRoutingSender->removeDomainLookup(domainID);
+}
+
+
+
+void DatabaseObserver::removeGateway(am_gatewayID_t gatewayID)
+{
+ //todo: implement something
+}
+
+
+
+void DatabaseObserver::removeCrossfader(am_crossfaderID_t crossfaderID)
+{
+ mRoutingSender->removeCrossfaderLookup(crossfaderID);
+}
+
+
+void DatabaseObserver::numberOfMainConnectionsChanged()
+{
+ mCommandSender->cbNumberOfMainConnectionsChanged();
+}
+
+void DatabaseObserver::numberOfSinkClassesChanged()
+{
+ mCommandSender->cbNumberOfSinkClassesChanged();
+}
+
+
+
+void DatabaseObserver::numberOfSourceClassesChanged()
+{
+ mCommandSender->cbNumberOfSourceClassesChanged();
+}
+
+
+
+void DatabaseObserver::mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
+{
+ mCommandSender->cbMainConnectionStateChanged(connectionID,connectionState);
+}
+
+
+
+void DatabaseObserver::mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty)
+{
+ mCommandSender->cbMainSinkSoundPropertyChanged(sinkID,SoundProperty);
+}
+
+
+
+void DatabaseObserver::mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
+{
+ mCommandSender->cbMainSourceSoundPropertyChanged(sourceID,SoundProperty);
+}
+
+
+
+void DatabaseObserver::sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
+{
+ mCommandSender->cbSinkAvailabilityChanged(sinkID,availability);
+}
+
+
+
+void DatabaseObserver::sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
+{
+ mCommandSender->cbSourceAvailabilityChanged(sourceID,availability);
+}
+
+
+
+void DatabaseObserver::volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
+{
+ mCommandSender->cbVolumeChanged(sinkID,volume);
+}
+
+
+
+void DatabaseObserver::sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
+{
+ mCommandSender->cbSinkMuteStateChanged(sinkID,muteState);
+}
+
+
+
+void DatabaseObserver::systemPropertyChanged(const am_SystemProperty_s & 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
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AudioManagerDaemon/src/Observer.cpp b/AudioManagerDaemon/src/Observer.cpp
deleted file mode 100644
index 648c295..0000000
--- a/AudioManagerDaemon/src/Observer.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Observer.cpp
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
-
-#include "Observer.h"
-#include "CommandSender.h"
-#include <assert.h>
-
-Observer::Observer(CommandSender *iCommandSender, RoutingSender *iRoutingSender)
- :mCommandSender(iCommandSender),
- mRoutingSender(iRoutingSender)
-{
- assert(mCommandSender!=0);
- assert(mRoutingSender!=0);
- mCommandSender->cbCommunicationReady();
-}
-
-Observer::~Observer() {
- // TODO Auto-generated destructor stub
-}
-
-void Observer::newSink(am_Sink_s sink)
-{
- mRoutingSender->addSinkLookup(sink);
- mCommandSender->cbNumberOfSinksChanged();
-}
-
-
-
-void Observer::newSource(am_Source_s source)
-{
- mRoutingSender->addSourceLookup(source);
- mCommandSender->cbNumberOfSourcesChanged();
-}
-
-
-
-void Observer::newDomain(am_Domain_s domain)
-{
- mRoutingSender->addDomainLookup(domain);
-}
-
-
-
-void Observer::newGateway(am_Gateway_s gateway)
-{
-
-}
-
-
-
-void Observer::newCrossfader(am_Crossfader_s crossfader)
-{
- mRoutingSender->addCrossfaderLookup(crossfader);
-}
-
-
-
-void Observer::removedSink(am_sinkID_t sinkID)
-{
- mRoutingSender->removeSinkLookup(sinkID);
- mCommandSender->cbNumberOfSinksChanged();
-}
-
-
-
-void Observer::removedSource(am_sourceID_t sourceID)
-{
- mRoutingSender->removeSourceLookup(sourceID);
- mCommandSender->cbNumberOfSourcesChanged();
-}
-
-
-
-void Observer::removeDomain(am_domainID_t domainID)
-{
- mRoutingSender->removeDomainLookup(domainID);
-}
-
-
-
-void Observer::removeGateway(am_gatewayID_t gatewayID)
-{
-}
-
-
-
-void Observer::removeCrossfader(am_crossfaderID_t crossfaderID)
-{
- mRoutingSender->removeCrossfaderLookup(crossfaderID);
-}
-
-
-void Observer::numberOfMainConnectionsChanged()
-{
- mCommandSender->cbNumberOfMainConnectionsChanged();
-}
-
-void Observer::numberOfSinkClassesChanged()
-{
- mCommandSender->cbNumberOfSinkClassesChanged();
-}
-
-
-
-void Observer::numberOfSourceClassesChanged()
-{
- mCommandSender->cbNumberOfSourceClassesChanged();
-}
-
-
-
-void Observer::mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
-{
- mCommandSender->cbMainConnectionStateChanged(connectionID,connectionState);
-}
-
-
-
-void Observer::mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty)
-{
- mCommandSender->cbMainSinkSoundPropertyChanged(sinkID,SoundProperty);
-}
-
-
-
-void Observer::mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
-{
- mCommandSender->cbMainSourceSoundPropertyChanged(sourceID,SoundProperty);
-}
-
-
-
-void Observer::sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
-{
- mCommandSender->cbSinkAvailabilityChanged(sinkID,availability);
-}
-
-
-
-void Observer::sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
-{
- mCommandSender->cbSourceAvailabilityChanged(sourceID,availability);
-}
-
-
-
-void Observer::volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
-{
- mCommandSender->cbVolumeChanged(sinkID,volume);
-}
-
-
-
-void Observer::sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
-{
- mCommandSender->cbSinkMuteStateChanged(sinkID,muteState);
-}
-
-
-
-void Observer::systemPropertyChanged(const am_SystemProperty_s & SystemProperty)
-{
- mCommandSender->cbSystemPropertyChanged(SystemProperty);
-}
-
-
-
-void Observer::timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
-{
- mCommandSender->cbTimingInformationChanged(mainConnection,time);
- //todo:inform the controller via controlsender
-}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/RoutingReceiver.cpp b/AudioManagerDaemon/src/RoutingReceiver.cpp
index b3ccf86..a01164b 100644
--- a/AudioManagerDaemon/src/RoutingReceiver.cpp
+++ b/AudioManagerDaemon/src/RoutingReceiver.cpp
@@ -1,15 +1,31 @@
-/*
- * RoutingReceiver.cpp
- *
- * Created on: Oct 24, 2011
- * Author: christian
- */
+/**
+* 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 <assert.h>
-
-
RoutingReceiver::RoutingReceiver(DatabaseHandler *iDatabaseHandler, RoutingSender *iRoutingSender, ControlSender *iControlSender)
:mDatabaseHandler(iDatabaseHandler),
mRoutingSender(iRoutingSender),
diff --git a/AudioManagerDaemon/src/RoutingSender.cpp b/AudioManagerDaemon/src/RoutingSender.cpp
index 70aa69f..735f260 100644
--- a/AudioManagerDaemon/src/RoutingSender.cpp
+++ b/AudioManagerDaemon/src/RoutingSender.cpp
@@ -1,13 +1,31 @@
-/*
- * RoutingSender.cpp
- *
- * Created on: Oct 26, 2011
- * Author: christian
- */
+/**
+* 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 "pluginTemplate.h"
+#include "PluginTemplate.h"
#include <utility>
+#include <dirent.h>
using namespace am;
@@ -19,26 +37,26 @@ using namespace am;
(*iter).routingInterface->__VA_ARGS__; \
}
-const char* routingPluginDirectories[] = { "/home/christian/workspace/gitserver/build/plugins/routing"};
-uint16_t routingPluginDirectoriesCount = sizeof(routingPluginDirectories) / sizeof(routingPluginDirectories[0]);
-
-
-RoutingSender::RoutingSender()
- : mHandleCount(0),
- mlistActiveHandles(),
- mListInterfaces(),
- mMapConnectionInterface(),
- mMapCrossfaderInterface(),
- mMapDomainInterface(),
- mMapSinkInterface(),
- mMapSourceInterface(),
- mMapHandleInterface()
+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 (uint16_t dirIndex = 0; dirIndex < routingPluginDirectoriesCount; dirIndex++)
+ for (; dirIter < dirIterEnd; ++dirIter)
{
- const char* directoryName = routingPluginDirectories[dirIndex];
+ 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);
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index 59682eb..93bfc8a 100644
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -1,46 +1,79 @@
-/*
- * main.cpp
- *
- * Created on: Oct 24, 2011
- * Author: christian
+/**
+* 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!
*/
//todo: add debug commandline option to allow to use other than memory database
//todo: make real daemon out of it- systemd conform
+//todo: versioning of PluginInterfaces on linux level (.symver stuff)
+//todo: all communication like all plugins loaded etc...
+//todo: seperate documentation of test from normal project
-#include "control/ControlReceiveInterface.h"
+#include <dbus/dbus.h>
+#include <dlt/dlt.h>
+#include "DatabaseHandler.h"
+#include "DatabaseObserver.h"
#include "RoutingReceiver.h"
#include "CommandReceiver.h"
#include "ControlReceiver.h"
-#include "DatabaseHandler.h"
#include "ControlSender.h"
#include "CommandSender.h"
#include "RoutingSender.h"
#include "DBusWrapper.h"
-#include <dbus/dbus.h>
-#include <dlt/dlt.h>
DLT_DECLARE_CONTEXT(AudioManager)
-#define UNIT_TEST 1
-
using namespace am;
+#define DEFAULT_PLUGIN_COMMAND_DIR "/home/christian/workspace/gitserver/build/plugins/command"
+#define DEFAULT_PLUGIN_ROUTING_DIR "/home/christian/workspace/gitserver/build/plugins/routing"
+#define CONTROLLER_PLUGIN "/home/christian/workspace/gitserver/build/plugins/control/libPluginControlInterface.so"
+
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 "));
- DatabaseHandler iDatabaseHandler;
+ std::vector<std::string> listCommandPluginDirs;
+ listCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR)); //change this to be modified by the commandline!
+
+ std::vector<std::string> listRoutingPluginDirs;
+ listRoutingPluginDirs.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR)); //change this to be modified by the commandline!
+
+ //Instantiate all classes. Keep in same order !
+ DatabaseHandler iDatabaseHandler(std::string(":memory:"));
DBusWrapper iDBusWrapper;
- RoutingSender iRoutingSender;
- CommandSender iCommandSender;
- ControlSender iControlSender;
- Observer iObserver(&iCommandSender, &iRoutingSender);
+ RoutingSender iRoutingSender(listRoutingPluginDirs);
+ CommandSender iCommandSender(listCommandPluginDirs);
+ ControlSender iControlSender(std::string(CONTROLLER_PLUGIN));
+ DatabaseObserver iObserver(&iCommandSender, &iRoutingSender);
CommandReceiver iCommandReceiver(&iDatabaseHandler,&iDBusWrapper,&iControlSender);
RoutingReceiver iRoutingReceiver(&iDatabaseHandler,&iRoutingSender,&iControlSender);
- ControlReceiver iControlReceiver(&iDatabaseHandler, &iRoutingSender);
+ ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender);
iCommandSender.startupInterface(&iCommandReceiver);
diff --git a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h b/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
index 10bb135..c5cfc8a 100644
--- a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
@@ -8,6 +8,7 @@
#ifndef COMMANDINTERFACEBACKDOOR_H_
#define COMMANDINTERFACEBACKDOOR_H_
+#include <command/CommandSendInterface.h>
#include "CommandSender.h"
using namespace am;
diff --git a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt b/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
index bd09acd..a96cfe8 100644
--- a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
@@ -54,7 +54,7 @@ INCLUDE_DIRECTORIES(
file(GLOB CONTROL_INTERFACE_SRCS_CXX
"../../src/DatabaseHandler.cpp"
- "../../src/Observer.cpp"
+ "../../src/DatabaseObserver.cpp"
"../../src/RoutingSender.cpp"
"../../src/RoutingReceiver.cpp"
"../../src/CommandSender.cpp"
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
index 8c57cfd..9bfc5f6 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
@@ -10,20 +10,22 @@
controlInterfaceTest::controlInterfaceTest()
- :pDatabaseHandler(),
- pRoutingSender(),
- pCommandSender(),
+ :plistCommandPluginDirs(),
+ plistRoutingPluginDirs(),
+ pDatabaseHandler(std::string(":memory:")),
+ pRoutingSender(plistRoutingPluginDirs),
+ pCommandSender(plistCommandPluginDirs),
pMockControlInterface(),
pMockRoutingInterface(),
- pControlSender(),
+ pControlSender(std::string("")),
pRoutingInterfaceBackdoor(),
pCommandInterfaceBackdoor(),
pControlInterfaceBackdoor(),
- pObserver(&pCommandSender,&pRoutingSender),
- pControlReceiver(&pDatabaseHandler,&pRoutingSender),
+ pDatabaseObserver(&pCommandSender,&pRoutingSender),
+ pControlReceiver(&pDatabaseHandler,&pRoutingSender,&pCommandSender),
pRoutingReceiver(&pDatabaseHandler,&pRoutingSender,&pControlSender)
{
- pDatabaseHandler.registerObserver(&pObserver);
+ pDatabaseHandler.registerObserver(&pDatabaseObserver);
pRoutingInterfaceBackdoor.unloadPlugins(&pRoutingSender);
pCommandInterfaceBackdoor.unloadPlugins(&pCommandSender);
pControlInterfaceBackdoor.replaceController(&pControlSender,&pMockControlInterface);
@@ -207,15 +209,17 @@ TEST_F(controlInterfaceTest,setSourceState)
source.domainID=1;
ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
- EXPECT_CALL(pMockRoutingInterface,asyncSetSourceState(_,2,SS_PAUSED));
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSourceState(_,2,SS_PAUSED)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK,pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
ASSERT_EQ(handlesList[0].handle,handle.handle);
ASSERT_EQ(handlesList[0].handleType,handle.handleType);
ASSERT_EQ(E_OK,pDatabaseHandler.getSoureState(source.sourceID,state));
- ASSERT_EQ(state,SS_PAUSED);
+ ASSERT_EQ(state,SS_ON); //ok, since value will be added after the ack!
EXPECT_CALL(pMockControlInterface,cbAckSetSourceState(_,E_OK)).Times(1);
- //pRoutingReceiver.ackSetSourceState(handle,SS_PAUSED);
+ pRoutingReceiver.ackSetSourceState(handle,E_OK);
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSoureState(source.sourceID,state));
+ ASSERT_EQ(state,SS_PAUSED);
}
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
index d85c1f0..daac707 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
@@ -19,7 +19,7 @@
#include "DatabaseHandler.h"
#include "ControlReceiver.h"
#include "RoutingReceiver.h"
-#include "Observer.h"
+#include "DatabaseObserver.h"
#include "ControlSender.h"
#include "RoutingSender.h"
#include "../RoutingInterfaceBackdoor.h"
@@ -54,7 +54,9 @@ using ::testing::MatchResultListener;
class controlInterfaceTest : public Test{
public:
controlInterfaceTest();
- virtual ~controlInterfaceTest();
+ ~controlInterfaceTest();
+ std::vector<std::string> plistRoutingPluginDirs;
+ std::vector<std::string> plistCommandPluginDirs;
DatabaseHandler pDatabaseHandler;
RoutingSender pRoutingSender;
CommandSender pCommandSender;
@@ -64,7 +66,7 @@ public:
RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
CommandInterfaceBackdoor pCommandInterfaceBackdoor;
ControlInterfaceBackdoor pControlInterfaceBackdoor;
- Observer pObserver;
+ DatabaseObserver pDatabaseObserver;
ControlReceiver pControlReceiver;
RoutingReceiver pRoutingReceiver;
CommonFunctions pCF;
diff --git a/AudioManagerDaemon/test/database/CMakeLists.txt b/AudioManagerDaemon/test/database/CMakeLists.txt
index 33e6f87..33a1b40 100644
--- a/AudioManagerDaemon/test/database/CMakeLists.txt
+++ b/AudioManagerDaemon/test/database/CMakeLists.txt
@@ -54,7 +54,7 @@ INCLUDE_DIRECTORIES(
file(GLOB DATABASE_SRCS_CXX
"../../src/DatabaseHandler.cpp"
- "../../src/Observer.cpp"
+ "../../src/DatabaseObserver.cpp"
"../../src/CommandSender.cpp"
"../../src/RoutingSender.cpp"
"../CommonFunctions.cpp"
diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp
index 6f269e9..a1580fe 100644
--- a/AudioManagerDaemon/test/database/databaseTest.cpp
+++ b/AudioManagerDaemon/test/database/databaseTest.cpp
@@ -24,7 +24,7 @@
*/
#include "databaseTest.h"
-#include "Observer.h"
+#include "DatabaseObserver.h"
using namespace am;
@@ -35,6 +35,15 @@ extern bool equalRoutingElement (const am_RoutingElement_s a,const am_RoutingEle
extern bool equalClassProperties (const am_ClassProperty_s a,const am_ClassProperty_s b);
extern std::string int2string(int i);
+databaseTest::databaseTest()
+ :pDatabaseHandler(std::string(":memory:"))
+{
+}
+
+databaseTest::~databaseTest()
+{
+}
+
void databaseTest::createMainConnectionSetup()
{
//fill the connection database
@@ -111,7 +120,7 @@ void databaseTest::SetUp()
DLT_REGISTER_APP("Dtest","AudioManagerDeamon");
DLT_REGISTER_CONTEXT(AudioManager,"Main","Main Context");
DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Database Test started "));
- Observer *observer=NULL;
+ DatabaseObserver *observer=NULL;
pDatabaseHandler.registerObserver(observer);
}
diff --git a/AudioManagerDaemon/test/database/databaseTest.h b/AudioManagerDaemon/test/database/databaseTest.h
index 3255b71..d7fb36f 100644
--- a/AudioManagerDaemon/test/database/databaseTest.h
+++ b/AudioManagerDaemon/test/database/databaseTest.h
@@ -24,6 +24,8 @@ using namespace testing;
class databaseTest : public Test {
public:
+ databaseTest();
+ ~databaseTest();
DatabaseHandler pDatabaseHandler;
CommonFunctions pCF;
diff --git a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
index b3db54a..0376683 100644
--- a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
@@ -55,7 +55,7 @@ INCLUDE_DIRECTORIES(
file(GLOB ROUTING_INTERFACE_SRCS_CXX
"../../src/ControlReceiver.cpp"
"../../src/DatabaseHandler.cpp"
- "../../src/Observer.cpp"
+ "../../src/DatabaseObserver.cpp"
"../../src/CommandSender.cpp"
"../../src/RoutingSender.cpp"
"../CommonFunctions.cpp"
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
index bc3e583..1e89d7a 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
@@ -22,13 +22,14 @@ using ::testing::ElementsAre;
using ::testing::NotNull;
routingInterfaceTest::routingInterfaceTest()
- :pDatabaseHandler(),
- pRoutingSender(),
- pCommandSender(),
+ :plistCommandPluginDirs(),
+ pDatabaseHandler(std::string(":memory:")),
+ pRoutingSender(plistRoutingPluginDirs),
+ pCommandSender(plistCommandPluginDirs),
pMockInterface(),
pRoutingInterfaceBackdoor(),
pCommandInterfaceBackdoor(),
- pControlReceiver(&pDatabaseHandler,&pRoutingSender),
+ pControlReceiver(&pDatabaseHandler,&pRoutingSender,&pCommandSender),
pObserver(&pCommandSender,&pRoutingSender)
{
pDatabaseHandler.registerObserver(&pObserver);
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
index f46ea5f..3b27701 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
@@ -19,7 +19,7 @@
#include "DatabaseHandler.h"
#include "ControlReceiver.h"
#include "ControlSender.h"
-#include "Observer.h"
+#include "DatabaseObserver.h"
#include "../RoutingInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
@@ -32,7 +32,9 @@ using namespace am;
class routingInterfaceTest : public Test{
public:
routingInterfaceTest();
- virtual ~routingInterfaceTest();
+ ~routingInterfaceTest();
+ std::vector<std::string> plistRoutingPluginDirs;
+ std::vector<std::string> plistCommandPluginDirs;
DatabaseHandler pDatabaseHandler;
RoutingSender pRoutingSender;
CommandSender pCommandSender;
@@ -40,7 +42,7 @@ public:
RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
CommandInterfaceBackdoor pCommandInterfaceBackdoor;
ControlReceiver pControlReceiver;
- Observer pObserver;
+ DatabaseObserver pObserver;
CommonFunctions pCF;
void SetUp();
void TearDown();