summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/src
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 /AudioManagerDaemon/src
parent92c8b837306ff1dcd889f9c075435aec50e9aea3 (diff)
downloadaudiomanager-68678bed2dc3d4a5849d283bec84a01e2836603f.tar.gz
update in headers, small things
Diffstat (limited to 'AudioManagerDaemon/src')
-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
11 files changed, 475 insertions, 335 deletions
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);