diff options
author | christian mueller <christian.ei.mueller@bmw.de> | 2011-07-01 14:50:34 +0200 |
---|---|---|
committer | christian mueller <christian.ei.mueller@bmw.de> | 2011-07-01 14:50:34 +0200 |
commit | e6ad5d883663688d0e36e9d506aa9a1f1190c47f (patch) | |
tree | 6d6bcaa6c6b1a54c40bab208a7234ecb860eea73 /AudioManagerDaemon | |
parent | 02acf3cebd9ec61193f63415590929ef40c504c1 (diff) | |
download | audiomanager-e6ad5d883663688d0e36e9d506aa9a1f1190c47f.tar.gz |
changed daemon directory name
changed absolute path for doxygen to relative path
Diffstat (limited to 'AudioManagerDaemon')
-rw-r--r-- | AudioManagerDaemon/AudioManagerCore.cpp | 625 | ||||
-rw-r--r-- | AudioManagerDaemon/AudioManagerCore.h | 630 | ||||
-rw-r--r-- | AudioManagerDaemon/CMakeLists.txt | 133 | ||||
-rw-r--r-- | AudioManagerDaemon/DBusCommandInterface.cpp | 123 | ||||
-rw-r--r-- | AudioManagerDaemon/DBusCommandInterface.h | 76 | ||||
-rw-r--r-- | AudioManagerDaemon/DataBaseHandler.cpp | 885 | ||||
-rw-r--r-- | AudioManagerDaemon/DataBaseHandler.h | 383 | ||||
-rw-r--r-- | AudioManagerDaemon/Doxyfile.in | 1661 | ||||
-rw-r--r-- | AudioManagerDaemon/HookEngine.cpp | 378 | ||||
-rw-r--r-- | AudioManagerDaemon/HookEngine.h | 345 | ||||
-rw-r--r-- | AudioManagerDaemon/Router.cpp | 229 | ||||
-rw-r--r-- | AudioManagerDaemon/Router.h | 222 | ||||
-rw-r--r-- | AudioManagerDaemon/RoutingReceive.cpp | 118 | ||||
-rw-r--r-- | AudioManagerDaemon/RoutingReceive.h | 56 | ||||
-rw-r--r-- | AudioManagerDaemon/audioManagerIncludes.h | 43 | ||||
-rw-r--r-- | AudioManagerDaemon/dataTypes.h | 91 | ||||
-rw-r--r-- | AudioManagerDaemon/main.cpp | 103 | ||||
-rw-r--r-- | AudioManagerDaemon/mainpage.h | 34 | ||||
-rw-r--r-- | AudioManagerDaemon/routinginterface.h | 197 |
19 files changed, 6332 insertions, 0 deletions
diff --git a/AudioManagerDaemon/AudioManagerCore.cpp b/AudioManagerDaemon/AudioManagerCore.cpp new file mode 100644 index 0000000..9133006 --- /dev/null +++ b/AudioManagerDaemon/AudioManagerCore.cpp @@ -0,0 +1,625 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file AudioManagerCore.cpp + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 "AudioManagerCore.h" + +Task::Task() { +} + +Task::~Task() { +} + +Task::Task(AudioManagerCore* core) { + m_core = core; +} + +TaskAsyncConnect::TaskAsyncConnect(AudioManagerCore* core, sink_t sink, + source_t source) : + Task(core), m_ParamSink(sink), m_ParamSource(source) { +} + +TaskAsyncConnect::~TaskAsyncConnect() { +} + +void TaskAsyncConnect::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + QObject::connect((const QObject*) m_core->returnReceiver(), + SIGNAL(signal_ackConnect(genHandle_t, genError_t)), + (const QObject*) this, + SLOT(slot_connect_finished(genHandle_t, genError_t))); + m_timer = new QTimer(); + m_timer->setSingleShot(true); + QObject::connect(m_timer, SIGNAL(timeout()), (const QObject*) this, + SLOT(slot_timeout())); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Started Connect")); + m_timer->start(CONNECT_TIMEOUT); + m_core->connect(m_ParamSource, m_ParamSink, &m_handle); +} + +void TaskAsyncConnect::setSink(sink_t sink) { + m_ParamSink = sink; +} + +void TaskAsyncConnect::setSource(source_t source) { + m_ParamSource = source; +} + +sink_t TaskAsyncConnect::getSink() { + return m_ParamSink; +} + +source_t TaskAsyncConnect::getSource() { + return m_ParamSource; +} + +void TaskAsyncConnect::slot_connect_finished(genHandle_t handle, + genError_t error) { + if (handle == m_handle && error == GEN_OK) { + m_timer->stop(); + delete m_timer; + m_timer = NULL; + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Connect returned")); + emit signal_nextTask(); + } else { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Somethings wrong with the connection")); + } +} + +/** + * \todo handle this event better. + */ +void TaskAsyncConnect::slot_timeout() { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Connection timed out")); +} + +TaskConnect::TaskConnect(AudioManagerCore* core, sink_t sink, source_t source) : + Task(core), m_ParamSink(sink), m_ParamSource(source) { +} + +TaskConnect::~TaskConnect() { +} + +void TaskConnect::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Started Syncronous Connect")); + m_core->connect(m_ParamSource, m_ParamSink); + emit signal_nextTask(); +} + +TaskDisconnect::TaskDisconnect(AudioManagerCore* core, connection_t ID) : + Task(core), m_ParamConnectionID(ID) { +} + +TaskDisconnect::~TaskDisconnect() { +} + +void TaskDisconnect::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_core->disconnect(m_ParamConnectionID); + emit signal_nextTask(); +} + +TaskInterruptWait::TaskInterruptWait(AudioManagerCore* core, + genInt_t interruptID) : + Task(core), m_interruptID(interruptID) { +} + +TaskInterruptWait::~TaskInterruptWait() { + +} + +void TaskInterruptWait::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + QObject::connect((const QObject*) m_core->returnCommandInterface(), + SIGNAL(signal_interruptResume(genInt_t)), (const QObject*) this, + SLOT(slot_interrupt_ready(genInt_t))); +} + +void TaskInterruptWait::slot_interrupt_ready(genInt_t ID) { + if (ID == m_interruptID) { + emit signal_nextTask(); + } +} + +TaskSetVolume::TaskSetVolume(AudioManagerCore* core, volume_t newVolume, + sink_t sink) : + Task(core), m_volume(newVolume), m_sink(sink) { + +} + +TaskSetVolume::~TaskSetVolume() { +} + +void TaskSetVolume::setVolume(volume_t newVolume) { + m_volume = newVolume; +} + +void TaskSetVolume::setSink(sink_t sink) { + m_sink = sink; +} + +volume_t TaskSetVolume::getVolume() { + return m_volume; +} + +sink_t TaskSetVolume::getSink() { + return m_sink; +} + +void TaskSetVolume::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Started Changed Volume")); + m_core->setVolume(m_sink, m_volume); + emit signal_nextTask(); +} + +TaskSetSourceVolume::TaskSetSourceVolume(AudioManagerCore* core, + volume_t newVolume, source_t source) : + Task(core), m_volume(newVolume), m_source(source) { + +} + +TaskSetSourceVolume::~TaskSetSourceVolume() { + +} + +void TaskSetSourceVolume::setVolume(volume_t newVolume) { + m_volume = newVolume; +} + +void TaskSetSourceVolume::setSource(source_t source) { + m_source = source; +} + +volume_t TaskSetSourceVolume::getVolume() { + return m_volume; +} +source_t TaskSetSourceVolume::getSource() { + return m_source; +} + +void TaskSetSourceVolume::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Started Changed Source Volume")); + m_core->setSourceVolume(m_source, m_volume); + emit signal_nextTask(); +} + +TaskWait::TaskWait(AudioManagerCore* core, int mseconds) : + Task(core), m_ParamMSeconds(mseconds) { +} + +TaskWait::~TaskWait() { +} + +void TaskWait::setTime(int mseconds) { + m_ParamMSeconds = mseconds; +} + +int TaskWait::getTime() { + return m_ParamMSeconds; +} + +void TaskWait::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_timer = new QTimer(); + m_timer->setSingleShot(true); + QObject::connect(m_timer, SIGNAL(timeout()), (const QObject*) this, + SLOT(slot_timeIsup())); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Start Sleep ")); + m_timer->start(m_ParamMSeconds); +} + +void TaskWait::slot_timeIsup() { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Stop Sleep ")); + m_timer->stop(); + emit signal_nextTask(); +} + +TaskEnterUserConnect::TaskEnterUserConnect(AudioManagerCore* core, + genRoute_t route, connection_t connID) : + Task(core), m_route(route), m_connectionID(connID) { +} + +TaskEnterUserConnect::~TaskEnterUserConnect() { +} + +void TaskEnterUserConnect::setConnection(genRoute_t route, connection_t connID) { + m_route = route; + m_connectionID = connID; +} + +genRoute_t TaskEnterUserConnect::returnConnection() { + return m_route; +} + +void TaskEnterUserConnect::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_core->returnDatabaseHandler()->updateMainConnection(m_connectionID, + m_route); + emit signal_nextTask(); +} + +TaskRemoveUserConnect::TaskRemoveUserConnect(AudioManagerCore* core, + connection_t connID) : + Task(core), m_connectionID(connID) { +} + +TaskRemoveUserConnect::~TaskRemoveUserConnect() { + +} + +void TaskRemoveUserConnect::setConnectionID(connection_t connID) { + m_connectionID = connID; +} + +connection_t TaskRemoveUserConnect::returnConnectionID() { + return m_connectionID; +} + +void TaskRemoveUserConnect::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_core->returnDatabaseHandler()->removeMainConnection(m_connectionID); + emit signal_nextTask(); +} + +TaskEnterInterrupt::TaskEnterInterrupt(AudioManagerCore* core, genInt_t ID, + bool mixed, connection_t connID, QList<source_t> listInterruptedSources) : + Task(core), m_intID(ID), m_mixed(mixed), m_connectionID(connID), + m_interruptedSourcesList(listInterruptedSources) { +} + +TaskEnterInterrupt::~TaskEnterInterrupt() { +} + +void TaskEnterInterrupt::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_core->returnDatabaseHandler()->updateInterrupt(m_intID, m_connectionID, + m_mixed, m_interruptedSourcesList); + emit signal_nextTask(); +} + +TaskRemoveInterrupt::TaskRemoveInterrupt(AudioManagerCore* core, genInt_t ID) : + Task(core), m_intID(ID) { +} + +TaskRemoveInterrupt::~TaskRemoveInterrupt() { +} + +void TaskRemoveInterrupt::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_core->returnDatabaseHandler()->removeInterrupt(m_intID); + emit signal_nextTask(); +} + +TaskSetSourceMute::TaskSetSourceMute(AudioManagerCore* core, source_t source) : + Task(core), m_source(source) { +} + +TaskSetSourceMute::~TaskSetSourceMute() { +} + +void TaskSetSourceMute::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_core->setSourceMute(m_source); + emit signal_nextTask(); +} + +TaskSetSourceUnmute::TaskSetSourceUnmute(AudioManagerCore* core, + source_t source) : + Task(core), m_source(source) { +} + +TaskSetSourceUnmute::~TaskSetSourceUnmute() { +} + +void TaskSetSourceUnmute::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_core->setSourceUnMute(m_source); + emit signal_nextTask(); +} + +TaskEmitSignalConnect::TaskEmitSignalConnect(AudioManagerCore* core) : + Task(core) { +} + +TaskEmitSignalConnect::~TaskEmitSignalConnect() { +} + +void TaskEmitSignalConnect::executeTask(Queue* queue) { + QObject::connect((const QObject*) this, SIGNAL(signal_nextTask()), + (const QObject*) queue, SLOT(slot_nextTask())); + m_core->emitSignalConnect(); + emit signal_nextTask(); +} + +Queue::Queue(AudioManagerCore* core, QString name) : + m_core(core), m_currentIndex(0), m_name(name), m_taskList(QList<Task*> ()) { + m_core->addQueue(this); +} + +Queue::~Queue() { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("shoot all tasks")); + foreach (Task* task, m_taskList) { + delete task; + } + m_core->removeQueue(this); +} + +void Queue::run() { + if (m_taskList.isEmpty() == false) { + Task* task = m_taskList.first(); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Started to execute Task")); + task->executeTask(this); + } else { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("empty tasklist was attempted to run ")); + } + +} + +void Queue::slot_nextTask() { + m_currentIndex++; + if (m_currentIndex < m_taskList.length()) { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Task "),DLT_INT(m_currentIndex),DLT_STRING(" out of ") ,DLT_INT(m_taskList.length())); + m_taskList.at(m_currentIndex)->executeTask(this); + } else { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Finished all Tasks")); + this->~Queue(); + } +} + +void Queue::addTask(Task* task) { + m_taskList.append(task); +} + +genError_t Queue::removeTask(Task* task) { + if (m_taskList.removeAll(task) > 0) { + return GEN_OK; + } + return GEN_OUTOFRANGE; + void addQueue(Queue* queue); + +} + +QList<Task*> Queue::getTaskList() { + return m_taskList; +} + +QString Queue::returnName() { + return m_name; +} + +AudioManagerCore::AudioManagerCore() : + m_queueList(QList<Queue*> ()) { +} + +AudioManagerCore::~AudioManagerCore() { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("delete all running queues")); + foreach (Queue* queue, m_queueList) { + delete queue; + } +} + +Router* AudioManagerCore::returnRouter() { + return m_router; +} + +DataBaseHandler* AudioManagerCore::returnDatabaseHandler() { + return m_databaseHandler; +} + +RoutingReceiver* AudioManagerCore::returnReceiver() { + return m_receiver; +} + +DBusCommandInterface* AudioManagerCore::returnCommandInterface() { + return m_command; +} + +void AudioManagerCore::registerBushandler(Bushandler* handler) { + m_busHandler = handler; +} + +void AudioManagerCore::registerDatabasehandler(DataBaseHandler* handler) { + m_databaseHandler = handler; +} + +void AudioManagerCore::registerRouter(Router* router) { + m_router = router; +} + +void AudioManagerCore::registerHookEngine(HookHandler* handler) { + m_hookHandler = handler; +} + +void AudioManagerCore::registerReceiver(RoutingReceiver* receiver) { + m_receiver = receiver; +} + +void AudioManagerCore::registerCommandInterface(DBusCommandInterface* command) { + m_command = command; +} + +genError_t AudioManagerCore::UserConnect(source_t source, sink_t sink) { + Queue* userConnectionRequestQ = new Queue(this, "User Connect"); + m_hookHandler->fireHookUserConnectionRequest(userConnectionRequestQ, + source, sink); + userConnectionRequestQ->run(); + return GEN_OK; +} + +genError_t AudioManagerCore::UserDisconnect(connection_t connID) { + Queue* userDisconnectionRequestQ = new Queue(this, "User Disconnect"); + m_hookHandler->fireHookUserDisconnectionRequest(userDisconnectionRequestQ, + connID); + userDisconnectionRequestQ->run(); + return GEN_OK; +} + +genError_t AudioManagerCore::UserSetVolume(sink_t sink, volume_t volume) { + m_hookHandler->fireHookVolumeChange(volume, sink); + return GEN_OK; +} + +QList<ConnectionType> AudioManagerCore::getListConnections() { + return m_databaseHandler->getListAllMainConnections(); +} + +QList<SinkType> AudioManagerCore::getListSinks() { + QList<SinkType> sinkList; + m_databaseHandler->getListofSinks(&sinkList); + return sinkList; +} + +QList<SourceType> AudioManagerCore::getListSources() { + QList<SourceType> sourceList; + m_databaseHandler->getListofSources(&sourceList); + return sourceList; +} + +void AudioManagerCore::emitSignalConnect() { + emit signal_connectionChanged(); +} + +genError_t AudioManagerCore::connect(source_t source, sink_t sink, + genHandle_t* handle) { + genHandle_t localhandle; + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Connect"), DLT_INT(source), DLT_STRING(" to "), DLT_INT(sink)); + domain_t domainID = m_databaseHandler->get_Domain_ID_from_Source_ID(source); + RoutingSendInterface* iface = m_busHandler->getInterfaceforBus( + m_databaseHandler->get_Bus_from_Domain_ID(domainID)); + localhandle = m_databaseHandler->insertConnection(source, sink); + + if (handle) { + *handle = localhandle; + } + iface->connect(source, sink, localhandle); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Connect finished")); + return GEN_OK; + /** + * \todo implement error handling + */ +} + +genError_t AudioManagerCore::disconnect(connection_t ID) { + domain_t domainID = m_databaseHandler->get_Domain_ID_from_Connection_ID(ID); + RoutingSendInterface* iface = m_busHandler->getInterfaceforBus( + m_databaseHandler->get_Bus_from_Domain_ID(domainID)); + iface->disconnect(ID); + m_databaseHandler->removeConnection(ID); + return GEN_OK; + /** + * \todo failure handling + */ +} + +genError_t AudioManagerCore::setVolume(sink_t sink, volume_t volume) { + RoutingSendInterface* iface = m_busHandler->getInterfaceforBus( + m_databaseHandler->get_Bus_from_Domain_ID( + m_databaseHandler->get_Domain_ID_from_Sink_ID(sink))); + iface->setSinkVolume(volume, sink); + return GEN_OK; + /** + * \todo failure handling + */ +} + +genError_t AudioManagerCore::interruptRequest(source_t interruptSource, + sink_t sink, genInt_t* interrupt) { + Queue* interruptRequestQ = new Queue(this, "Interrupt Request"); + m_hookHandler->fireHookInterruptRequest(interruptRequestQ, interruptSource, + sink, interrupt); + interruptRequestQ->run(); + return GEN_OK; +} + +genError_t AudioManagerCore::setSourceVolume(source_t source, volume_t volume) { + RoutingSendInterface* iface = m_busHandler->getInterfaceforBus( + m_databaseHandler->get_Bus_from_Domain_ID( + m_databaseHandler->get_Domain_ID_from_Source_ID(source))); + iface->setSourceVolume(volume, source); + return GEN_OK; +} + +genError_t AudioManagerCore::setSourceMute(source_t source) { + RoutingSendInterface* iface = m_busHandler->getInterfaceforBus( + m_databaseHandler->get_Bus_from_Domain_ID( + m_databaseHandler->get_Domain_ID_from_Source_ID(source))); + iface->muteSource(source); + return GEN_OK; +} + +genError_t AudioManagerCore::setSourceUnMute(source_t source) { + RoutingSendInterface* iface = m_busHandler->getInterfaceforBus( + m_databaseHandler->get_Bus_from_Domain_ID( + m_databaseHandler->get_Domain_ID_from_Source_ID(source))); + iface->unmuteSource(source); + return GEN_OK; +} + +genError_t AudioManagerCore::getRoute(const bool onlyfree, + const source_t source, const sink_t sink, QList<genRoute_t>* ReturnList) { + m_hookHandler->fireHookRoutingRequest(onlyfree, source, sink, ReturnList); + return GEN_OK; +} + +connection_t AudioManagerCore::returnConnectionIDforSinkSource(sink_t sink, + source_t source) { + return m_databaseHandler->getConnectionID(source, sink); +} + +genError_t AudioManagerCore::removeQueue(Queue* queue) { + if (m_queueList.removeAll(queue)) { + return GEN_OK; + } else { + return GEN_OUTOFRANGE; + } +} + +source_t AudioManagerCore::returnSourceIDfromName(const QString name) { + return m_databaseHandler->get_Source_ID_from_Name(name); +} + +sink_t AudioManagerCore::returnSinkIDfromName(const QString name) { + return m_databaseHandler->get_Sink_ID_from_Name(name); +} + +void AudioManagerCore::addQueue(Queue* queue) { + m_queueList.append(queue); +} + diff --git a/AudioManagerDaemon/AudioManagerCore.h b/AudioManagerDaemon/AudioManagerCore.h new file mode 100644 index 0000000..36d86b5 --- /dev/null +++ b/AudioManagerDaemon/AudioManagerCore.h @@ -0,0 +1,630 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file AudioManagerCore.h + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 AUDIOMANAGERCORE_H_ +#define AUDIOMANAGERCORE_H_ + +#include <QtCore/QObject> + +#include "audioManagerIncludes.h" + +/**CONSTANT for the Connection timeout when using asynchronous connect. In mseconds. + * + */ +#define CONNECT_TIMEOUT 3000 + +class HookHandler; +class AudioManagerCore; +class Queue; +class Router; +class Bushandler; +class DBusCommandInterface; + +/** + * \class Task + * \brief Base Class for all Tasks + * \details a Base Class for a basic operation together with a set of parameters + * Every Task that can be created by the Hook Plugins is derived from this class + * Be sure to implement executeTask() because this will be called when the task is executed + * Whenever the task is finished, you need to emit the signal signal_nextTask() that will call the next + * Task in the queue. + * \fn virtual void Task::executeTask(Queue* queue)=0 + * \brief This needs to be overwritten in implementation of the class + * The queue calls this function to start the execution of the task + * \param queue pointer to the queue + * \fn void Task::signal_nextTask() + * \brief by emitting this signal, the next task in the queue is triggered + */ +class Task: public QObject { +Q_OBJECT +public: + Task(); + Task(AudioManagerCore* core); + virtual ~Task(); + virtual void executeTask(Queue* queue)=0; + +signals: + void signal_nextTask(); +protected: + AudioManagerCore* m_core; //!< pointer to the core +}; + +/** + * \class TaskAsyncConnect + * \brief This task is used to connect a source and a sink asynchronous + * + * \fn TaskAsyncConnect::TaskAsyncConnect(AudioManagerCore* core, sink_t sink, source_t source) + * \brief Constructor + * \param core pointer to the core + * \param sink the sink to be connected + * \param source the source to be connected + * + * \fn void TaskAsyncConnect::setSink(sink_t sink) + * \brief Sets the Sink that should be connected to + * \param sink the sink + * + * \fn void TaskAsyncConnect::setSource(source_t source) + * \brief sets the source + * \param source the source + * + * \fn sink_t TaskAsyncConnect::getSink() + * \brief returns the sink + * + * \fn source_t TaskAsyncConnect::getSource() + * \brief returns the source + * + * \fn void TaskAsyncConnect::slot_connect_finished(genHandle_t handle, genError_t error) + * \brief is used to receive the asynchronous answer. + * + * \fn void TaskAsyncConnect::slot_timeout() + * \brief used to handle the timeout + */ +class TaskAsyncConnect: public Task { +Q_OBJECT +public: + TaskAsyncConnect(AudioManagerCore* core, sink_t sink, source_t source); + virtual ~TaskAsyncConnect(); + void setSink(sink_t sink); + void setSource(source_t source); + sink_t getSink(); + source_t getSource(); + void executeTask(Queue* queue); + +public slots: + void slot_connect_finished(genHandle_t handle, genError_t error); + void slot_timeout(); +private: + sink_t m_ParamSink; //!< the sink to be connected + source_t m_ParamSource; //!< the source to be connected + genHandle_t m_handle; //!< the handle (ConnectionID) + QTimer* m_timer; //!< pointer to a timer used for timeout tracking +}; + +/** + * \class TaskConnect + * \brief This task is used to connect a source and a sink synchronous + * + * \fn TaskConnect::TaskConnect(AudioManagerCore* core, sink_t sink, source_t source) + * \brief constructor + * \param core pointer to the core + * \param sink the sink to be connected + * \param source the source to be connected + * + */ +class TaskConnect: public Task { +Q_OBJECT +public: + TaskConnect(AudioManagerCore* core, sink_t sink, source_t source); + virtual ~TaskConnect(); + void executeTask(Queue* queue); + +private: + sink_t m_ParamSink; //!< the sink to be connected + source_t m_ParamSource; //!< the source to be connected +}; + +/** + * \class TaskDisconnect + * \brief This task is used to connect a source and a sink synchronous + * + * \fn TaskDisconnect::TaskDisconnect(AudioManagerCore* core, connection_t ID) + * \brief constructor + * \param core pointer to the core + * \param ID the connection ID to be disconnected + * + */ +class TaskDisconnect: public Task { +Q_OBJECT +public: + TaskDisconnect(AudioManagerCore* core, connection_t ID); + virtual ~TaskDisconnect(); + void executeTask(Queue* queue); +private: + connection_t m_ParamConnectionID; //!< the connection to disconnect +}; + +/** + * \class TaskInterruptWait + * \brief this class waits for an interrupt to be resumed + * + * \fn TaskInterruptWait::TaskInterruptWait(AudioManagerCore* core, genInt_t connectionID) + * \brief Constructor + * \param core link to AudioManagercore + * \param connectionID the connection ID to be waited for + * + * \fn void TaskInterruptWait::slot_interrupt_ready(genInt_t ID) + * \brief slot that is called when the interrupt resumes + * \param the interrupt ID of the interrupt that resumed + */ +class TaskInterruptWait: public Task { +Q_OBJECT +public: + TaskInterruptWait(AudioManagerCore* core, genInt_t connectionID); + virtual ~TaskInterruptWait(); + void executeTask(Queue* queue); +public slots: + void slot_interrupt_ready(genInt_t ID); +private: + genInt_t m_interruptID; //!< the interrupt ID that should be waited for +}; + +/** + * \class TaskSetVolume + * \brief a task that sets the volume for a sink + * + * \fn TaskSetVolume::TaskSetVolume(AudioManagerCore* core, volume_t newVolume=0, sink_t sink=0) + * \brief constructor + * \param core the pointer to the AudioManagerCore + * \param newVolume the volume to be set + * \param sink the sink that the volume shall be applied to + * + * \fn void TaskSetVolume::setVolume(volume_t newVolume) + * \brief sets the volume + * + * \fn void TaskSetVolume::setSink(sink_t sink) + * \brief sets the sink + * + * \fn void TaskSetVolume::volume_t getVolume() + * \brief returns the volume + * + * \fn sink_t TaskSetVolume::getSink() + * \brief returns the volume + */ +class TaskSetVolume: public Task { +Q_OBJECT +public: + TaskSetVolume(AudioManagerCore* core, volume_t newVolume=0, sink_t sink=0); + virtual ~TaskSetVolume(); + + void setVolume(volume_t newVolume); + void setSink(sink_t sink); + + volume_t getVolume(); + sink_t getSink(); + + void executeTask(Queue* queue); +private: + volume_t m_volume; //!< the volume + sink_t m_sink; //!< the sink +}; + +/** + * \class TaskSetSourceVolume + * \brief sets the volume of a source + * + * \fn TaskSetSourceVolume::TaskSetSourceVolume(AudioManagerCore* core, volume_t newVolume=0, source_t source=0) + * \brief constructor + * \param core the pointer to the AudioManagerCore + * \param newVolume the volumesink_t to be set + * \param source the source that the volume shall be applied to + * + * * \fn void TaskSetSourceVolume::setVolume(volume_t newVolume) + * \brief sets the volume + * + * \fn void TaskSetSourceVolume::setSink(sink_t sink) + * \brief sets the sink + * + * \fn void TaskSetSourceVolume::volume_t getVolume() + * \brief returns the volume + * + * \fn sink_t TaskSetSourceVolume::getSink() + * \brief returns the volume + * + */ +class TaskSetSourceVolume: public Task { +Q_OBJECT +public: + TaskSetSourceVolume(AudioManagerCore* core, volume_t newVolume=0, source_t source=0); + virtual ~TaskSetSourceVolume(); + + void setVolume(volume_t newVolume); + void setSource(source_t source); + + volume_t getVolume(); + source_t getSource(); + + void executeTask(Queue* queue); +private: + volume_t m_volume; //!< the volume + source_t m_source; //!< the source +}; + +/** + * \class TaskWait + * \brief implements a wait in msecons + * + * \fn TaskWait::TaskWait(AudioManagerCore* core, int mseconds) + * \brief constructor + * \param core the pointer to the AudioManagerCore + * \param newmseconds delay in milliseconds + * + * \fn void TaskWait::setTime(int mseconds) + * \brief sets the time + * + * \fn int TaskWait::getTime() + * \brief returns the time + * + * \fn void TaskWait::slot_timeIsup() + * \brief slot called when the time is up + */ +class TaskWait: public Task { +Q_OBJECT +public: + TaskWait(AudioManagerCore* core, int mseconds); + virtual ~TaskWait(); + void setTime(int mseconds); + int getTime(); + void executeTask(Queue* queue); + +public slots: + void slot_timeIsup(); +private: + int m_ParamMSeconds;//!< time to be delayed in milli seconds + QTimer* m_timer; //!< pointer to timer +}; + +/** + * \class TaskEnterUserConnect + * \brief This task enters the user connection into the struct of the AudioManagerCore + * \details We need this because the connection shall be entered not before it is build up + * + * \fn TaskEnterUserConnect::TaskEnterUserConnect(AudioManagerCore* core, genRoute_t route, connection_t connID=0) + * \brief enters a user connect into the database + */ +class TaskEnterUserConnect: public Task { +Q_OBJECT +public: + TaskEnterUserConnect(AudioManagerCore* core, genRoute_t route, connection_t connID=0); + virtual ~TaskEnterUserConnect(); + void setConnection(genRoute_t route, connection_t connID); + genRoute_t returnConnection(); + void executeTask(Queue* queue); +private: + genRoute_t m_route; //!< the route to be entered + connection_t m_connectionID; //!< the connection ID +}; + +/** + * \class TaskRemoveUserConnect + * \brief removes a user Connect + * + * \fn TaskRemoveUserConnect::TaskRemoveUserConnect(AudioManagerCore* core, connection_t connID) + * \brief constructor + */ +class TaskRemoveUserConnect : public Task { +Q_OBJECT +public: + TaskRemoveUserConnect(AudioManagerCore* core, connection_t connID); + virtual ~TaskRemoveUserConnect(); + void setConnectionID(connection_t connID); + connection_t returnConnectionID(); + void executeTask(Queue* queue); +private: + connection_t m_connectionID; //!< the connection ID +}; + +/** + * \class TaskEnterInterrupt + * \brief enters an interrupt into the database + */ +class TaskEnterInterrupt: public Task { +Q_OBJECT +public: + TaskEnterInterrupt(AudioManagerCore* core, genInt_t ID,bool mixed, connection_t connID, QList<source_t> listInterruptedSources); + virtual ~TaskEnterInterrupt(); + void executeTask(Queue* queue); +private: + genInt_t m_intID; //!< the interrupt ID + bool m_mixed; //!< true if mixed + connection_t m_connectionID; //!< the connection ID + QList<source_t> m_interruptedSourcesList; //!< the list of interrupted sources +}; + +/** + * \class TaskRemoveInterrupt + * \brief removes an interrupt + */ +class TaskRemoveInterrupt: public Task { +Q_OBJECT +public: + TaskRemoveInterrupt(AudioManagerCore* core, genInt_t ID); + virtual ~TaskRemoveInterrupt(); + void executeTask(Queue* queue); +private: + genInt_t m_intID; //!< the interrupt ID +}; + +/** + * \class TaskSetSourceMute + * \brief mutes a source + */ +class TaskSetSourceMute: public Task { +Q_OBJECT +public: + TaskSetSourceMute(AudioManagerCore* core, source_t source); + virtual ~TaskSetSourceMute(); + void executeTask(Queue* queue); +private: + source_t m_source; //!< the source to be muted +}; + +/** + * \class TaskSetSourceUnmute + * \brief unmutes a source + */ +class TaskSetSourceUnmute: public Task { +Q_OBJECT +public: + TaskSetSourceUnmute(AudioManagerCore* core, source_t source); + virtual ~TaskSetSourceUnmute(); + void executeTask(Queue* queue); +private: + source_t m_source; //!< the source to be unmuted +}; + +/** + * \class TaskEmitSignalConnect + * \brief emits the signal connect + */ +class TaskEmitSignalConnect: public Task { +Q_OBJECT +public: + TaskEmitSignalConnect(AudioManagerCore* core); + virtual ~TaskEmitSignalConnect(); + void executeTask(Queue* queue); +}; + +/** + * \class Queue + * \brief With the help of this class, all events that need to be processed are organized and queued + * \details tasks to be added have to be created with new, after the queue is done all tasks will be deleted and the memory freed. + * \todo error handling + * \todo sorting of tasks + * \todo add some function to attach parameters to the Queue so that organizing and handling is possible + * + * \fn Queue::Queue(AudioManagerCore* core,QString name="") + * \brief constructor + * \param name give the queue a name + * \param core pointer to AudioManagerCore + * + * \fn void Queue::run() + * \brief starts the queue + * + * \fn void Queue::addTask(Task* task) + * \brief add a task to the queue + * \param task pointer to the task + * + * \fn genError_t Queue::removeTask(Task* task) + * \brief removes a task + * \param task pointer to the task + * \return GEN_OK on success + * + * \fn QList<Task*> Queue::getTaskList() + * \brief returns the actual task list + * \return list with pointers to the tasks + * + * \fn QString Queue::returnName() + * \brief returns the name of the Queue + * \return the name in QString format + * + * \fn void Queue::slot_nextTask() + * \brief is called when a task is finished and the next task can be called + */ +class Queue: public QObject { +Q_OBJECT +public: + Queue(AudioManagerCore* core,QString name=""); + virtual ~Queue(); + void run(); + void addTask(Task* task); + genError_t removeTask(Task* task); + QList<Task*> getTaskList(); + QString returnName(); + +public slots: + void slot_nextTask(); +private: + AudioManagerCore* m_core; //!< pointer to AudioManagerCore + int m_currentIndex; //!< the index of the list wich is currently worked on + QString m_name; //!< name of the Queue + QList<Task*> m_taskList; //!< the list with pointers to the tasks +}; + +/** + * \class AudioManagerCore + * \brief The central Managing Class of the AudioManager + * + * \fn genError_t AudioManagerCore::UserConnect(source_t source, sink_t sink) + * \brief does a user connect + * + * \fn genError_t AudioManagerCore::UserDisconnect(connection_t connID) + * \brief does a user disconnect + * + * \fn genError_t AudioManagerCore::UserSetVolume(sink_t sink, volume_t volume) + * \brief set the user volume (on sink level) + * + * \fn genError_t AudioManagerCore::connect(source_t source, sink_t sink, genHandle_t* handle = NULL) + * \brief connects sources and sinks + * + * \fn genError_t AudioManagerCore::disconnect(connection_t ID) + * \brief disconnects sources and sinks + * + * \fn genError_t AudioManagerCore::setVolume(sink_t sink, volume_t volume) + * \brief sets the volume to a sink + * + * \fn genError_t AudioManagerCore::interruptRequest(source_t interruptSource, sink_t sink, genInt_t* interruptID) + * \brief via this call, an interrupt is requested + * + * \fn genError_t AudioManagerCore::setSourceVolume (source_t source, volume_t volume) + * \brief sets the source volume + * + * \fn genError_t AudioManagerCore::setSourceMute (source_t source) + * \brief mutes a source + * + * \fn genError_t AudioManagerCore::setSourceUnMute (source_t source) + * \brief unmutes a source + * + * \fn genError_t AudioManagerCore::getRoute(const bool onlyfree, const source_t source, const sink_t sink, QList<genRoute_t>* ReturnList) + * \brief returns a route + * + * \fn connection_t AudioManagerCore::returnConnectionIDforSinkSource (sink_t sink, source_t source) + * \brief returns the connection ID for a sink source combination + * + * \fn source_t AudioManagerCore::returnSourceIDfromName(const QString name) + * \brief returns the source ID for a name + * + * \fn sink_t AudioManagerCore::returnSinkIDfromName(const QString name) + * \brief returns the sink ID for a given name + * + * \fn QList<ConnectionType> AudioManagerCore::getListConnections() + * \brief returns the list of connections + * + * \fn QList<SinkType> AudioManagerCore::getListSinks() + * \brief returns a list of all sinks + * + * \fn QList<SourceType> AudioManagerCore::getListSources() + * \brief returns a list of all sources + * + * \fn void AudioManagerCore::emitSignalConnect() + * \brief emits the signal connect + * + * \fn Router* AudioManagerCore::returnRouter() + * \brief returns the pointer to the router + * + * \fn DataBaseHandler* AudioManagerCore::returnDatabaseHandler() + * \brief returns the pointer to the database handler + * + * \fn RoutingReceiver* AudioManagerCore::returnReceiver() + * \brief returns the pointer to the receiver + * + * \fn DBusCommandInterface* AudioManagerCore::returnCommandInterface() + * \brief returns the pointer to the command interface + * + * \fn void AudioManagerCore::registerDatabasehandler(DataBaseHandler * handler) + * \brief registers the database handler @ the core + * + * \fn void AudioManagerCore::registerRouter(Router* router) + * \brief registers the router @ the core + * + * \fn void AudioManagerCore::registerBushandler(Bushandler* handler) + * \brief registers the bushandler @ the core + * + * \fn void AudioManagerCore::registerHookEngine(HookHandler* handler) + * \brief registers the hook engine @ the core + * + * \fn void AudioManagerCore::registerReceiver(RoutingReceiver* receiver) + * \brief registers the receiver @ the core + * + * \fn void AudioManagerCore::registerCommandInterface(DBusCommandInterface* command) + * \brief registers the command interface @ the core + * + * \fn void AudioManagerCore::addQueue(Queue* queue) + * \brief adds a queue + * + * \fn genError_t AudioManagerCore::removeQueue(Queue* queue) + * \brief removes a queue + * + * + */ +class AudioManagerCore :public QObject { +Q_OBJECT +public: + AudioManagerCore(); + virtual ~AudioManagerCore(); + + genError_t UserConnect(source_t source, sink_t sink); + genError_t UserDisconnect(connection_t connID); + genError_t UserSetVolume(sink_t sink, volume_t volume); + genError_t connect(source_t source, sink_t sink, genHandle_t* handle = NULL); + genError_t disconnect(connection_t ID); + genError_t setVolume(sink_t sink, volume_t volume); + genError_t interruptRequest(source_t interruptSource, sink_t sink, genInt_t* interruptID); + genError_t setSourceVolume (source_t source, volume_t volume); + genError_t setSourceMute (source_t source); + genError_t setSourceUnMute (source_t source); + + genError_t getRoute(const bool onlyfree, const source_t source, const sink_t sink, QList<genRoute_t>* ReturnList); + connection_t returnConnectionIDforSinkSource (sink_t sink, source_t source); + source_t returnSourceIDfromName(const QString name); + sink_t returnSinkIDfromName(const QString name); + + QList<ConnectionType> getListConnections(); + QList<SinkType> getListSinks(); + QList<SourceType> getListSources(); + + void emitSignalConnect(); + + Router* returnRouter(); + DataBaseHandler* returnDatabaseHandler(); + RoutingReceiver* returnReceiver(); + DBusCommandInterface* returnCommandInterface(); + + void registerDatabasehandler(DataBaseHandler * handler); + void registerRouter(Router* router); + void registerBushandler(Bushandler* handler); + void registerHookEngine(HookHandler* handler); + void registerReceiver(RoutingReceiver* receiver); + void registerCommandInterface(DBusCommandInterface* command); + + void addQueue(Queue* queue); + genError_t removeQueue(Queue* queue); + +signals: + void signal_connectionChanged(); + void signal_numberOfSinksChanged(); + void signal_numberOfSourcesChanged(); + +private: + DataBaseHandler* m_databaseHandler; //!< pointer to the DataBasehandler Class + Router* m_router; //!< pointer to the Router Class + Bushandler* m_busHandler; //!< pointer to the Bushandler Class + HookHandler* m_hookHandler; //!< pointer to the HookHandler CLass + RoutingReceiver* m_receiver; //!< pointer to the Routing receiver Class + DBusCommandInterface* m_command; //!< pointer to the command Interface Class + + QList<Queue*> m_queueList; //!< List of pointers to all running queues +}; + +#endif /* AUDIOMANAGERCORE_H_ */ diff --git a/AudioManagerDaemon/CMakeLists.txt b/AudioManagerDaemon/CMakeLists.txt new file mode 100644 index 0000000..67da2e0 --- /dev/null +++ b/AudioManagerDaemon/CMakeLists.txt @@ -0,0 +1,133 @@ + # + # Copyright (C) 2011, BMW AG + # + # AudioManagerDeamon + # + # @file CMakeLists.txt + # + # @date: 20.05.2011 + # @author: Christian Müller (christian.ei.mueller@bmw.de) + # + +cmake_minimum_required(VERSION 2.6) + +PROJECT(AudioManagerDeamon) + +set(CMAKE_CXX_FLAGS "-g -pipe -g -Wall -W -D_REENTRANT") + +set(STD_INCLUDE_DIRS "/usr/include") +set(EXECUTABLE_OUTPUT_PATH ../../bin/) +set(DOC_OUTPUT_PATH ../../doc/) +set(DBUS_FOLDER ${CMAKE_SOURCE_DIR}/../dbusInterfaces) +set(DOC_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../doc/AudioManager) + +cmake_policy(SET CMP0015 NEW) + +file(MAKE_DIRECTORY ${DOC_OUTPUT_PATH}) + +FIND_PACKAGE(Qt4 REQUIRED) +FIND_PACKAGE(PkgConfig) +pkg_check_modules(DLT REQUIRED automotive-dlt) +pkg_check_modules(JACK REQUIRED jack) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${STD_INCLUDE_DIRS}) + +# add Qt modules here, the include will setup QT_LIBRARIES +SET(QT_USE_QTSQL TRUE) +#SET(QT_USE_QTXML TRUE) +SET(QT_USE_QTDBUS TRUE) +SET(QT_USE_QTNETWORK TRUE) + +INCLUDE(${QT_USE_FILE}) + +#all source files go here +SET(AUDIOMAN_SRCS_CXX + AudioManagerCore.cpp + RoutingReceive.cpp + Router.cpp + DataBaseHandler.cpp + main.cpp + ${CMAKE_CURRENT_BINARY_DIR}/DBusCommand.cpp + DBusCommandInterface.cpp + HookEngine.cpp + ${DBUS_FOLDER}/DBusTypes.cpp +) + +INCLUDE_DIRECTORIES( + include + ${CMAKE_SOURCE_DIR} + ${STD_INCLUDE_DIRS} + ${GLIB_INCLUDE_DIRS} + ${PULSE_INCLUDE_DIRS} + ${JACK_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${DBUS_FOLDER} + ${QT_INCLUDE_DIR} + ${DLT_INCLUDE_DIRS} +) + +#every header that contains QT stuff like Q_OBJECT .... and must be mocced +SET(AUDIOMAN_MOC_SRCS + Router.h + DataBaseHandler.h + DBusCommandInterface.h + AudioManagerCore.h + RoutingReceive.h + ${CMAKE_CURRENT_BINARY_DIR}/DBusCommand.h + +) + +LINK_DIRECTORIES( + ${LINK_DIRECTORIES} + ${GLIB_LIBRARY_DIRS} + ${PULSE_LIBRARY_DIRS} + ${JACK_LIBRARY_DIRS} + ${DBUS_FOLDER} + ${PROJECT_BINARY_DIR}/../plugins +) + +#now take the headers, moc them and append the resulting moc files to the sources +QT4_WRAP_CPP(AUDIOMAN_SRCS_CXX ${AUDIOMAN_MOC_SRCS}) + +ADD_EXECUTABLE(AudioManager ${AUDIOMAN_SRCS_CXX}) + + +ADD_DEFINITIONS(${QT_DEFINITIONS}) + +TARGET_LINK_LIBRARIES(AudioManager + ${QT_LIBRARIES} + RoutingPlugin + RoutingJackPlugin + TestPlugin + ${PULSE_LIBRARIES} + ${JACK_LIBRARIES} + ${DLT_LIBRARIES} +) + +add_custom_command( + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DBusCommand_.h ${CMAKE_CURRENT_BINARY_DIR}/DBusCommand.cpp + COMMAND qdbusxml2cpp ARGS -c DBusCommand -a DBusCommand.h:DBusCommand.cpp ${DBUS_FOLDER}/DBusAudioManager.xml + MAIN_DEPENDENCY ${DBUS_FOLDER}/DBusAudioManager.xml +) + + +add_custom_command( + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DBusCommand.h + COMMAND sed ARGS -i '1i \#include \"../../dbusInterfaces/DBusTypes.h\"' DBusCommand.h + MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/DBusCommand_.h +) + +#add a target to generate API documentation with Doxygen +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE) + add_custom_target (Docs ALL + COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${DOC_OUTPUT_PATH} + SOURCES ${PROJECT_BINARY_DIR}/Doxyfile) +endif(DOXYGEN_FOUND) + + + + diff --git a/AudioManagerDaemon/DBusCommandInterface.cpp b/AudioManagerDaemon/DBusCommandInterface.cpp new file mode 100644 index 0000000..775d5d6 --- /dev/null +++ b/AudioManagerDaemon/DBusCommandInterface.cpp @@ -0,0 +1,123 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file DBusCommandInterface.cpp + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 "DBusCommandInterface.h" +#include "DBusCommand.h" + +DBusCommandInterface::DBusCommandInterface(QObject* parent) { + (void) parent; +REGISTER_METATYPES} + +void DBusCommandInterface::startupInterface() { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Startup of DBUS Command interface")); + + new DBusCommand(this); + QDBusConnection connection = QDBusConnection::sessionBus(); + connection.registerService(QString(SERVICEINTERFACE)); + if (connection.isConnected()) { + if (connection.registerObject( + "/Control", + this, + (QDBusConnection::ExportAdaptors + | QDBusConnection::ExportAllSignals))) { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Registered DBUS Command interface succsessfully")); + } else { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Failed to register DBUS Command interface succsessfully")); + } + } +} + +int DBusCommandInterface::connect(int Source_ID, int Sink_ID) { + if (m_core->UserConnect(Source_ID, Sink_ID) == GEN_OK) { + return 1; + } + return -1; +} + +int DBusCommandInterface::disconnect(int Source_ID, int Sink_ID) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Disconnect")); + genRoute_t ReturnRoute; + if (int value=m_core->returnDatabaseHandler()->returnMainconnectionIDforSinkSourceID(Sink_ID,Source_ID)>0) { + return m_core->UserDisconnect(value); + } else { + return -1; + } +} + +int DBusCommandInterface::interruptRequest(const QString &SourceName, + const QString &SinkName) { + source_t sourceID = m_core->returnSourceIDfromName(SourceName); + sink_t sinkID = m_core->returnSinkIDfromName(SinkName); + genInt_t intID = -1; + m_core->interruptRequest(sourceID, sinkID, &intID); + return intID; +} + +int DBusCommandInterface::interruptResume(int InterruptID) { + emit signal_interruptResume(InterruptID); + return 1; +} + +void DBusCommandInterface::registerAudioManagerCore(AudioManagerCore* core) { + m_core = core; + QObject::connect((const QObject*) m_core, + SIGNAL(signal_connectionChanged()), (const QObject*) this, + SLOT(slot_connectionChanged())); + QObject::connect((const QObject*) m_core, + SIGNAL(signal_numberOfSinksChanged()), (const QObject*) this, + SLOT(slot_numberOfSinksChanged())); + QObject::connect((const QObject*) m_core, + SIGNAL(signal_numberOfSourcesChanged()), (const QObject*) this, + SLOT(slot_numberOfSourcesChanged())); +} + +void DBusCommandInterface::slot_connectionChanged() { + emit signal_connectionChanged(); +} +void DBusCommandInterface::slot_numberOfSinksChanged() { + emit signal_numberOfSinksChanged(); +} +void DBusCommandInterface::slot_numberOfSourcesChanged() { + emit signal_numberOfSourcesChanged(); +} + +int DBusCommandInterface::setVolume(int SinkID, int Volume) { + if (m_core->UserSetVolume(SinkID, Volume) == GEN_OK) { + return 1; + } + return -1; +} + +QList<SourceType> DBusCommandInterface::getListSources() { + return m_core->getListSources(); +} + +QList<SinkType> DBusCommandInterface::getListSinks() { + return m_core->getListSinks(); +} + +QList<ConnectionType> DBusCommandInterface::getListConnections() { + return m_core->getListConnections(); +} diff --git a/AudioManagerDaemon/DBusCommandInterface.h b/AudioManagerDaemon/DBusCommandInterface.h new file mode 100644 index 0000000..8eaa51f --- /dev/null +++ b/AudioManagerDaemon/DBusCommandInterface.h @@ -0,0 +1,76 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file DBusCommandInterface.h + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 DBUSCOMMANDINTERFACE_H_ +#define DBUSCOMMANDINTERFACE_H_ + +#include "audioManagerIncludes.h" +#include "DBusTypes.h" + +#define SERVICEINTERFACE "org.Genivi.ControllerInterface" + +class AudioManagerCore; + +/**The interface towards the HMI + * This class is copied from DBusCommand.h which is generated out of DBusAudioManager.xml. It handles the communication towards the HMI. + * It also implements some Application logic that needs to be triggered to execute the actions demanded by the HMI. + * TODO: make a clear seperation between HMI Interface and Application Logic + */ +class DBusCommandInterface: public QObject { +Q_OBJECT +public: + DBusCommandInterface(QObject *parent = 0); + void registerAudioManagerCore(AudioManagerCore* core); + void startupInterface(); + +public slots: + void slot_connectionChanged(); + void slot_numberOfSinksChanged(); + void slot_numberOfSourcesChanged(); + +public Q_SLOTS: + // METHODS + int connect(int Source_ID, int Sink_ID); + int disconnect(int Source_ID, int Sink_ID); + QList<ConnectionType> getListConnections(); + QList<SinkType> getListSinks(); + QList<SourceType> getListSources(); + int interruptRequest(const QString &SourceName, const QString &SinkName); + int interruptResume(int InterruptID); + int setVolume(int SinkID, int Volume); + +Q_SIGNALS: // SIGNALS + void signal_connectionChanged(); + void signal_numberOfSinksChanged(); + void signal_numberOfSourcesChanged(); + + void signal_interruptResume(genInt_t interruptID); + +private: + QList<int> getSourceIDsForSinkID(int SinkID); + AudioManagerCore* m_core; +}; + +#endif /* DBUSCOMMANDINTERFACE_H_ */ diff --git a/AudioManagerDaemon/DataBaseHandler.cpp b/AudioManagerDaemon/DataBaseHandler.cpp new file mode 100644 index 0000000..d9997df --- /dev/null +++ b/AudioManagerDaemon/DataBaseHandler.cpp @@ -0,0 +1,885 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file DataBaseHandler.cpp + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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" + +DataBaseHandler::DataBaseHandler() { + + //knock down database + QString path = (QDir::home().path()); + + path.append(QDir::separator()).append(AUDIO_DATABASE); + path = QDir::toNativeSeparators(path); + + QFile db_file(path); + if (db_file.exists()) { + db_file.remove(); + } + if (!this->open_database()) { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Problems with opening the database")); + } +} + +DataBaseHandler::~DataBaseHandler() { + this->close_database(); +} + +bool DataBaseHandler::open_database() { + m_database = QSqlDatabase::addDatabase("QSQLITE"); + QString path = (QDir::home().path()); + + path.append(QDir::separator()).append(AUDIO_DATABASE); + path = QDir::toNativeSeparators(path); + m_database.setDatabaseName(path); + return m_database.open(); +} + +void DataBaseHandler::close_database() { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Closed Database")); + m_database.close(); +} + +bool DataBaseHandler::delete_data(QString table) { + QSqlQuery query; + QString comand = "DELETE FROM " + table; + return query.exec(comand); +} + +bool DataBaseHandler::create_tables() { + + QSqlQuery query; + QString + command = + "CREATE TABLE " + QString(DOMAIN_TABLE) + + " (ID INTEGER NOT NULL, DomainName VARCHAR(50), BusName VARCHAR(50), NodeName VARCHAR(50), EarlyMode BOOL, PRIMARY KEY(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(DOMAIN_TABLE)); + return false; + } + + command + = "CREATE TABLE " + QString(SOURCE_CLASS_TABLE) + + " (ID INTEGER NOT NULL, ClassName VARCHAR(50), VolumeOffset INTEGER, IsInterrupt BOOL, IsMixed BOOL, PRIMARY KEY(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(SOURCE_CLASS_TABLE)); + return false; + } + + command = "CREATE TABLE " + QString(SINK_CLASS_TABLE) + + " (ID INTEGER NOT NULL, ClassName VARCHAR(50), PRIMARY KEY(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(SINK_CLASS_TABLE)); + return false; + } + + command + = "CREATE TABLE " + QString(SOURCE_TABLE) + + " (ID INTEGER NOT NULL, Name VARCHAR(50), Class_ID INTEGER, Domain_ID INTEGER, IsGateway BOOL, PRIMARY KEY(ID), FOREIGN KEY (Domain_ID) REFERENCES " + + DOMAIN_TABLE + "(ID), FOREIGN KEY (Class_ID) REFERENCES " + + SOURCE_CLASS_TABLE + "(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(SOURCE_TABLE)); + return false; + } + + command + = "CREATE TABLE " + QString(SINK_TABLE) + + " (ID INTEGER NOT NULL, Name VARCHAR(50), Class_ID INTEGER, Domain_ID INTEGER, IsGateway BOOL, PRIMARY KEY(ID), FOREIGN KEY (DOMAIN_ID) REFERENCES " + + DOMAIN_TABLE + "(ID), FOREIGN KEY (Class_ID) REFERENCES " + + SOURCE_CLASS_TABLE + "(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(SOURCE_CLASS_TABLE)); + return false; + } + + command + = "CREATE TABLE " + QString(GATEWAY_TABLE) + + " (ID INTEGER NOT NULL, Name VARCHAR(50), Sink_ID INTEGER, Source_ID INTEGER, DomainSource_ID INTEGER, DomainSink_ID INTEGER, ControlDomain_ID Integer, IsBlocked BOOL, PRIMARY KEY(ID), FOREIGN KEY (Sink_ID) REFERENCES " + + SINK_TABLE + "(ID), FOREIGN KEY (Source_ID) REFERENCES " + + SOURCE_TABLE + + "(ID),FOREIGN KEY (DomainSource_ID) REFERENCES " + + DOMAIN_TABLE + + "(ID),FOREIGN KEY (DomainSink_ID) REFERENCES " + + DOMAIN_TABLE + "(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(GATEWAY_TABLE)); + return false; + } + + command + = "CREATE TABLE " + QString(CONNECTION_TABLE) + + " (ID INTEGER NOT NULL, Source_ID INTEGER, Sink_ID INTEGER, PRIMARY KEY(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(CONNECTION_TABLE)); + return false; + } + + command + = "CREATE TABLE " + QString(INTERRUPT_TABLE) + + " (ID INTEGER NOT NULL, Source_ID INTEGER, Sink_ID INTEGER, Connection_ID INTEGER, mixed BOOL, listInterrruptedSources INTEGER, PRIMARY KEY(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(INTERRUPT_TABLE)); + return false; + } + + command + = "CREATE TABLE " + QString(MAIN_TABLE) + + " (ID INTEGER NOT NULL, Source_ID INTEGER, Sink_ID INTEGER, route INTEGER, PRIMARY KEY(ID));"; + if (query.exec(command) != true) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Databasehandler: Could not create table"), DLT_STRING(MAIN_TABLE)); + return false; + } + + return true; + +} + +domain_t DataBaseHandler::insert_into_Domains_table(QString DomainName, + QString BusName, QString NodeName, bool EarlyMode) { + QSqlQuery query; + QString _EarlyMode = "false"; + if (EarlyMode) { + _EarlyMode = "true"; + } + + QString command = "SELECT BusName,ID FROM " + QString(DOMAIN_TABLE) + + " WHERE DomainName=\"" + DomainName + "\";"; + + if (query.exec(command) == true) { + if (query.next()) { + if (!query.value(0).toString().isEmpty()) { + return query.value(1).toInt(); + } else { + command = "UPDATE " + QString(DOMAIN_TABLE) + "SET Busname=" + + BusName + " Nodename=" + NodeName + " EarlyMode=" + + _EarlyMode + " WHERE DomainName=" + DomainName; + } + } else { + command = "INSERT INTO " + QString(DOMAIN_TABLE) + + " (DomainName, BusName, NodeName, EarlyMode) VALUES (\"" + + DomainName + "\",\"" + BusName + "\",\"" + NodeName + + "\",\"" + _EarlyMode + "\")"; + } + } + + if (query.exec(command) != true) { + return -1; + } else { + return get_Domain_ID_from_Name(DomainName); + } +} +sourceClass_t DataBaseHandler::insert_into_Source_Class_table( + QString ClassName, volume_t VolumeOffset, bool IsInterrupt, + bool IsMixed) { + QSqlQuery query; + QString _IsInterrupt = "false"; + QString _IsMixed = "false"; + + if (IsInterrupt) { + _IsInterrupt = "true"; + } + if (IsMixed) { + _IsMixed = "true"; + } + + QString command = "SELECT ID FROM " + QString(SOURCE_CLASS_TABLE) + + " WHERE ClassName=\"" + ClassName + "\";"; + + if (query.exec(command) == true) { + if (query.next()) { + return query.value(0).toInt(); + } + } + + command = "INSERT INTO " + QString(SOURCE_CLASS_TABLE) + + " (ClassName, VolumeOffset, IsInterrupt, IsMixed) VALUES (\"" + + ClassName + "\"," + QString::number(VolumeOffset) + ",\"" + + _IsInterrupt + "\",\"" + _IsMixed + "\")"; + + if (query.exec(command) != true) { + return -1; + } else { + return query.lastInsertId().toInt(); + } +} + +sink_t DataBaseHandler::insert_into_Sink_Class_table(QString ClassName) { + QSqlQuery query; + + QString command = "SELECT ID FROM " + QString(SINK_CLASS_TABLE) + + " WHERE ClassName=\"" + ClassName + "\";"; + + if (query.exec(command) == true) { + if (query.next()) { + return query.value(0).toInt(); + } + } + + command = "INSERT INTO " + QString(SINK_CLASS_TABLE) + + " (ClassName) VALUES (\"" + ClassName + "\")"; + + if (query.exec(command) != true) { + return -1; + } else { + return query.lastInsertId().toInt(); + } +} + +source_t DataBaseHandler::insert_into_Source_table(QString Name, + sourceClass_t Class_ID, domain_t Domain_ID, bool IsGateway) { + QSqlQuery query; + QString _IsGateway = "false"; + + if (IsGateway) { + _IsGateway = "true"; + } + + QString command = "SELECT ID FROM " + QString(SOURCE_TABLE) + + " WHERE Name=\"" + Name + "\";"; + + if (query.exec(command) == true) { + if (query.next()) { + return query.value(0).toInt(); + } + } + + command = "INSERT INTO " + QString(SOURCE_TABLE) + + " (Name, Class_ID, Domain_ID, IsGateway) VALUES (\"" + Name + + "\"," + QString::number(Class_ID) + ",\"" + QString::number( + Domain_ID) + "\",\"" + _IsGateway + "\")"; + + if (query.exec(command) != true) { + return -1; + } else { + emit signal_numberOfSourcesChanged(); + return query.lastInsertId().toInt(); + } +} + +sink_t DataBaseHandler::insert_into_Sink_table(QString Name, + sinkClass_t Class_ID, domain_t Domain_ID, bool IsGateway) { + QSqlQuery query; + QString _IsGateway = "false"; + + if (IsGateway) { + _IsGateway = "true"; + } + + QString command = "SELECT ID FROM " + QString(SINK_TABLE) + + " WHERE Name=\"" + Name + "\";"; + + if (query.exec(command) == true) { + if (query.next()) { + return query.value(0).toInt(); + } + } + + command = "INSERT INTO " + QString(SINK_TABLE) + + " (Name, Class_ID, Domain_ID, IsGateway) VALUES (\"" + Name + + "\"," + QString::number(Class_ID) + ",\"" + QString::number( + Domain_ID) + "\",\"" + _IsGateway + "\")"; + + if (query.exec(command) != true) { + return -1; + } else { + emit signal_numberOfSinksChanged(); + return query.lastInsertId().toInt(); + } +} + +gateway_t DataBaseHandler::insert_into_Gatway_table(QString Name, + sink_t Sink_ID, source_t Source_ID, domain_t DomainSource_ID, + domain_t DomainSink_ID, domain_t ControlDomain_ID) { + QSqlQuery query; + QString command = "SELECT ID FROM " + QString(GATEWAY_TABLE) + + " WHERE Name=\"" + Name + "\";"; + + if (query.exec(command) == true) { + if (query.next()) { + return query.value(0).toInt(); + } + } + + command + = "INSERT INTO " + QString(GATEWAY_TABLE) + + " (Name, Sink_ID, Source_ID, DomainSource_ID, DomainSink_ID, ControlDomain_ID, IsBlocked) VALUES (\"" + + Name + "\"," + QString::number(Sink_ID) + "," + + QString::number(Source_ID) + "," + QString::number( + DomainSource_ID) + "," + QString::number(DomainSink_ID) + + "," + QString::number(ControlDomain_ID) + ",\"false\")"; + if (query.exec(command) != true) { + return -1; + } else { + return query.lastInsertId().toInt(); + } +} + +genInt_t DataBaseHandler::reserveInterrupt(sink_t Sink_ID, source_t Source_ID) { + QSqlQuery query; + query.prepare( + "INSERT INTO " + QString(INTERRUPT_TABLE) + "(Source_ID, Sink_ID)" + " VALUES(:Source_ID, :Sink_ID)"); + query.bindValue(":Source_ID", Source_ID); + query.bindValue(":Sink_ID", Sink_ID); + if (query.exec() != true) { + return -1; + } else { + return query.lastInsertId().toInt(); + } +} + +genError_t DataBaseHandler::updateInterrupt(const genInt_t intID, + connection_t connID, bool mixed, + QList<source_t> listInterrruptedSources) { + QSqlQuery query; + QString _mixed = "false"; + + if (mixed) { + _mixed = "true"; + } + + //This information is not handy to be stored directly in the database. So we put it on the heap and store the pointer to it. + QList<source_t>* pointer = new QList<source_t> (listInterrruptedSources); + + query.prepare( + "UPDATE " + QString(INTERRUPT_TABLE) + + " SET Connection_ID=:Connection_ID, mixed=:mixed ,listInterrruptedSources=:listInterrruptedSources WHERE ID=:id"); + query.bindValue(":Connection_ID", connID); + query.bindValue(":mixed", _mixed); + query.bindValue(":listInterrruptedSources", int(pointer)); + query.bindValue(":id", intID); + if (query.exec() != true) { + return GEN_DATABASE_ERROR; + } else { + return GEN_OK; + } +} + +genError_t DataBaseHandler::getInterruptDatafromID(const genInt_t intID, + connection_t* return_connID, sink_t* return_Sink_ID, + source_t* return_Source_ID, bool* return_mixed, + QList<source_t>** return_listInterrruptedSources) { + QSqlQuery query; + QString + command = + "SELECT Connection_ID, Sink_ID, Source_ID, mixed, listInterrruptedSources FROM " + + QString(INTERRUPT_TABLE) + " WHERE ID=" + + QString::number(intID) + ";"; + + if (query.exec(command) != true) { + return GEN_DATABASE_ERROR; + } else { + if (query.next()) { + *return_connID = query.value(0).toInt(); + *return_Sink_ID = query.value(1).toInt(); + *return_Source_ID = query.value(2).toInt(); + *return_mixed = query.value(3).toBool(); + *return_listInterrruptedSources + = reinterpret_cast<QList<source_t>*> (query.value(4).toInt()); + return GEN_OK; + } else { + return GEN_UNKNOWN; + } + } +} + +genError_t DataBaseHandler::removeInterrupt(const genInt_t intID) { + QSqlQuery query; + QString command = "SELECT listInterrruptedSources FROM " + QString( + INTERRUPT_TABLE) + " WHERE ID=" + QString::number(intID) + ";"; + if (query.exec(command) != true) { + return GEN_DATABASE_ERROR; + } else { + if (query.next()) { + delete reinterpret_cast<QList<source_t>*> (query.value(0).toInt()); + command = "DELETE FROM " + QString(INTERRUPT_TABLE) + + " WHERE ID=\"" + QString::number(intID) + "\";"; + if (query.exec(command) != true) { + return GEN_DATABASE_ERROR; + } else { + return GEN_OK; + } + } + } + return GEN_UNKNOWN; +} + +domain_t DataBaseHandler::peek_Domain_ID(QString DomainName) { + QSqlQuery query; + + QString command = "SELECT ID FROM " + QString(DOMAIN_TABLE) + + " WHERE DomainName=\"" + DomainName + "\";"; + + if (query.next()) { + return query.value(0).toInt(); + } else { + command = "INSERT INTO " + QString(DOMAIN_TABLE) + + " (DomainName) VALUES (\"" + DomainName + "\")"; + } + + if (query.exec(command) != true) { + return -1; + } else { + return query.lastInsertId().toInt(); + } +} + +domain_t DataBaseHandler::get_Domain_ID_from_Source_ID(source_t Source_ID) { + QSqlQuery query; + QString command = "SELECT Domain_ID FROM " + QString(SOURCE_TABLE) + + " WHERE ID=" + QString::number(Source_ID) + ";"; + + if (query.exec(command) != true) { + return -1; + } else { + query.next(); + return query.value(0).toInt(); + } +} + +domain_t DataBaseHandler::get_Domain_ID_from_Sink_ID(sink_t Sink_ID) { + QSqlQuery query; + QString command = "SELECT Domain_ID FROM " + QString(SINK_TABLE) + + " WHERE ID=" + QString::number(Sink_ID) + ";"; + + if (query.exec(command) != true) { + return -1; + } else { + query.next(); + return query.value(0).toInt(); + } +} + +source_t DataBaseHandler::get_Source_ID_from_Name(QString name) { + QSqlQuery query; + QString command = "SELECT ID FROM " + QString(SOURCE_TABLE) + + " WHERE Name=\"" + name + "\";"; + + if (query.exec(command) != true) { + return -1; + } else { + if (query.next()) { + return query.value(0).toInt(); + } else { + return 0; + } + } +} + +sourceClass_t DataBaseHandler::get_Source_Class_ID_from_Name(QString name) { + QSqlQuery query; + QString command = "SELECT ID FROM " + QString(SOURCE_CLASS_TABLE) + + " WHERE ClassName=\"" + name + "\";"; + if (query.exec(command) != true) { + return -1; + } else { + if (query.next()) { + return query.value(0).toInt(); + } else { + return 0; + } + } +} + +domain_t DataBaseHandler::get_Domain_ID_from_Name(QString name) { + QSqlQuery query; + QString command = "SELECT ID FROM " + QString(DOMAIN_TABLE) + + " WHERE DomainName=\"" + name + "\";"; + + if (query.exec(command) != true) { + return -1; + } else { + if (query.next()) { + return query.value(0).toInt(); + } else { + return 0; + } + } +} + +gateway_t DataBaseHandler::get_Gateway_ID_with_Domain_ID( + domain_t startDomain_ID, domain_t targetDomain_ID) { + QSqlQuery query; + QString command = "SELECT ID FROM " + QString(GATEWAY_TABLE) + + " WHERE DomainSource_ID=" + QString::number(startDomain_ID) + + " AND DomainSink_ID=" + QString::number(targetDomain_ID) + ";"; + + if (query.exec(command) != true) { + return -1; + } else { + if (query.next()) { + return query.value(0).toInt(); + } else { + return 0; + } + } +} + +genError_t DataBaseHandler::get_Gateway_Source_Sink_Domain_ID_from_ID( + gateway_t Gateway_ID, source_t* return_Source_ID, + sink_t* return_Sink_ID, domain_t* return_ControlDomain_ID) { + QSqlQuery query; + QString command = "SELECT Source_ID, Sink_ID, ControlDomain_ID FROM " + + QString(GATEWAY_TABLE) + " WHERE ID=" + QString::number( + Gateway_ID) + ";"; + + if (query.exec(command) != true) { + return GEN_DATABASE_ERROR; + } else { + if (query.next()) { + *return_Source_ID = query.value(0).toInt(); + *return_Sink_ID = query.value(1).toInt(); + *return_ControlDomain_ID = query.value(2).toInt(); + return GEN_OK; + } else { + return GEN_UNKNOWN; + } + } +} + +void DataBaseHandler::get_Domain_ID_Tree(bool onlyfree, RoutingTree* Tree, + QList<RoutingTreeItem*>* allItems) { + QSqlQuery query; + int RootID = Tree->returnRootDomainID(); + RoutingTreeItem *parent = Tree->returnRootItem(); + QString _onlyfree = "false"; + int i = 0; + + if (onlyfree) { + _onlyfree = "true"; + } + + query.prepare( + "SELECT ID,DomainSource_ID FROM " + QString(GATEWAY_TABLE) + + " WHERE DomainSink_ID=:id AND IsBlocked=:flag;"); + + do { + query.bindValue(":id", RootID); + query.bindValue(":flag", _onlyfree); + query.exec(); + while (query.next()) { + allItems->append( + Tree->insertItem(query.value(1).toInt(), + query.value(0).toInt(), parent)); + } + parent = allItems->value(i); + RootID = parent->returnDomainID(); + i++; + } while (allItems->length() > i); +} + +QString DataBaseHandler::get_Bus_from_Domain_ID(domain_t Domain_ID) { + QSqlQuery query; + QString command = "SELECT BusName FROM " + QString(DOMAIN_TABLE) + + " WHERE ID=" + QString::number(Domain_ID) + ";"; + + if (query.exec(command) != true) { + return NULL; + } else { + query.next(); + return query.value(0).toString(); + } +} + +domain_t DataBaseHandler::get_Domain_ID_from_Connection_ID(connection_t ID) { + QSqlQuery query; + QString command = "SELECT Source_ID FROM " + QString(CONNECTION_TABLE) + + " WHERE ID=" + QString::number(ID) + ";"; + + if (query.exec(command) != true) { + return -1; + } + query.next(); + int SourceID = query.value(0).toInt(); + command = "SELECT Domain_ID FROM " + QString(SOURCE_TABLE) + " WHERE ID=" + + QString::number(SourceID) + ";"; + if (query.exec(command) != true) { + return -1; + } else { + query.next(); + return query.value(0).toInt(); + } +} + +void DataBaseHandler::getListofSources(QList<SourceType>* SourceList) { + QSqlQuery query; + SourceType sType; + QString command = "SELECT ID,NAME FROM " + QString(SOURCE_TABLE) + + " WHERE isGateway=\"false\";"; + if (query.exec(command) != true) { + + } else { + while (query.next()) { + sType.ID = query.value(0).toInt(); + sType.name = query.value(1).toString(); + SourceList->append(sType); + } + } +} + +void DataBaseHandler::getListofSinks(QList<SinkType>* SinkList) { + QSqlQuery query; + SinkType sType; + QString command = "SELECT ID,NAME FROM " + QString(SINK_TABLE) + ";"; + if (query.exec(command) != true) { + + } else { + while (query.next()) { + sType.ID = query.value(0).toInt(); + sType.name = query.value(1).toString(); + SinkList->append(sType); + } + } +} + +void DataBaseHandler::getListofConnections( + QList<ConnectionType>* ConnectionList) { + QSqlQuery query; + ConnectionType sType; + QString command = "SELECT Source_ID,Sink_ID FROM " + QString( + CONNECTION_TABLE) + ";"; + if (query.exec(command) != true) { + + } else { + while (query.next()) { + sType.Source_ID = query.value(0).toInt(); + sType.Sink_ID = query.value(1).toInt(); + ConnectionList->append(sType); + } + } +} + +bool DataBaseHandler::is_source_Mixed(source_t source) { + QSqlQuery query; + int classID = 0; + + QString command = "SELECT Class_ID FROM " + QString(SOURCE_TABLE) + + " WHERE ID=\"" + QString::number(source) + "\";"; + if (query.exec(command) == true) { + if (query.next()) { + classID = query.value(0).toInt(); + } + } + command = "SELECT isMixed FROM " + QString(SOURCE_CLASS_TABLE) + + " WHERE ID=\"" + QString::number(classID) + "\";"; + + if (query.exec(command) == true) { + if (query.next()) { + if (query.value(0).toString().compare("true") == 0) { + return true; + } + } + } + return false; +} + +sink_t DataBaseHandler::get_Sink_ID_from_Name(QString name) { + QSqlQuery query; + QString command = "SELECT ID FROM " + QString(SINK_TABLE) + + " WHERE Name=\"" + name + "\";"; + + if (query.exec(command) != true) { + return -1; + } else { + if (query.next()) { + return query.value(0).toInt(); + } else { + return 0; + } + } +} + +connection_t DataBaseHandler::getConnectionID(source_t SourceID, sink_t SinkID) { + QSqlQuery query; + query.prepare( + "SELECT ID FROM " + QString(MAIN_TABLE) + + " WHERE Source_ID=:sourceID AND Sink_ID=:sinkID"); + query.bindValue(":sourceID", SourceID); + query.bindValue(":sinkID", SinkID); + if (query.exec() != true) { + return -1; + } else { + if (query.next()) { + return query.value(0).toInt(); + } else { + return -1; + } + } +} + +connection_t DataBaseHandler::insertConnection(source_t SourceID, sink_t SinkID) { + QSqlQuery query; + QString command = "INSERT INTO " + QString(CONNECTION_TABLE) + + " (Source_ID, Sink_ID) VALUES (" + QString::number(SourceID) + + "," + QString::number(SinkID) + ");"; + if (query.exec(command) != true) { + return -1; + } else { + return query.lastInsertId().toInt(); + } +} + +genError_t DataBaseHandler::removeConnection(connection_t ConnectionID) { + QSqlQuery query; + QString command = "DELETE FROM " + QString(CONNECTION_TABLE) + + " WHERE ID=\"" + QString::number(ConnectionID) + "\";"; + if (query.exec(command) != true) { + return GEN_DATABASE_ERROR; + } else { + return GEN_OK; + } +} + +connection_t DataBaseHandler::reserveMainConnection(source_t source, + sink_t sink) { + QSqlQuery query; + query.prepare("INSERT INTO " + QString(MAIN_TABLE) + "(Source_ID, Sink_ID)" + " VALUES(:Source_ID, :Sink_ID)"); + query.bindValue(":Source_ID", source); + query.bindValue(":Sink_ID", sink); + if (query.exec() != true) { + return -1; + } else { + return query.lastInsertId().toInt(); + } +} + +genError_t DataBaseHandler::updateMainConnection(connection_t connID, + genRoute_t route) { + QSqlQuery query; + + //This information is not handy to be stored directly in the database. So we put it on the heap and store the pointer to it. + genRoute_t* routeheap = new genRoute_t(route); + + query.prepare( + "UPDATE " + QString(MAIN_TABLE) + + " SET route=:route WHERE ID=:connID"); + query.bindValue(":connID", connID); + query.bindValue(":route", int(routeheap)); + if (query.exec() != true) { + return GEN_DATABASE_ERROR; + } else { + return GEN_OK; + } +} + +genError_t DataBaseHandler::getMainConnectionDatafromID( + const connection_t connID, sink_t* return_sinkID, + source_t* return_sourceID, genRoute_t** return_route) { + QSqlQuery query; + QString command = "SELECT Sink_ID, Source_ID, route FROM " + QString( + MAIN_TABLE) + " WHERE ID=" + QString::number(connID) + ";"; + + if (query.exec(command) != true) { + return GEN_DATABASE_ERROR; + } else { + if (query.next()) { + *return_sinkID = query.value(0).toInt(); + *return_sourceID = query.value(1).toInt(); + *return_route + = reinterpret_cast<genRoute_t*> (query.value(2).toInt()); + return GEN_OK; + } else { + return GEN_UNKNOWN; + } + } +} + +connection_t DataBaseHandler::returnMainconnectionIDforSinkSourceID( + sink_t sink, source_t source) { + QSqlQuery query; + query.prepare( + "SELECT ID FROM " + QString(MAIN_TABLE) + + " WHERE Sink_ID=:sinkID AND Source_ID=:SourceID"); + query.bindValue(":SinkID", sink); + query.bindValue(":SourceID", source); + + if (query.exec() != true) { + return -1; + } else { + if (query.next()) { + return query.value(0).toInt(); + } + } + return -1; +} + +QList<source_t> DataBaseHandler::getSourceIDsForSinkID(sink_t sink) { + QList<source_t> list; + QSqlQuery query; + query.prepare( + "SELECT Source_ID FROM " + QString(MAIN_TABLE) + + " WHERE Sink_ID=:sinkID"); + query.bindValue(":sinkID", sink); + if (query.exec() == true) { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("query good")); + while (query.next()) { + int p = query.value(0).toInt(); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("SourceID"), DLT_INT(p)); + list.append(query.value(0).toInt()); + } + } + return list; +} + +QList<ConnectionType> DataBaseHandler::getListAllMainConnections() { + QList<ConnectionType> connectionList; + QSqlQuery query; + QString command = "SELECT Sink_ID, Source_ID, route FROM " + QString( + MAIN_TABLE) + ";"; + + if (query.exec(command) != true) { + + } else { + if (query.next()) { + ConnectionType temp; + temp.Sink_ID = query.value(0).toInt(); + temp.Source_ID = query.value(1).toInt(); + connectionList.append(temp); + } + } + return connectionList; +} + +genError_t DataBaseHandler::removeMainConnection(connection_t connID) { + QSqlQuery query; + QString command = "SELECT route FROM " + QString(MAIN_TABLE) + " WHERE ID=" + + QString::number(connID) + ";"; + if (query.exec(command) != true) { + return GEN_DATABASE_ERROR; + } else { + if (query.next()) { + delete reinterpret_cast<genRoute_t*> (query.value(0).toInt()); + command = "DELETE FROM " + QString(MAIN_TABLE) + " WHERE ID=\"" + + QString::number(connID) + "\";"; + if (query.exec(command) != true) { + return GEN_DATABASE_ERROR; + } else { + return GEN_OK; + } + } + } + return GEN_UNKNOWN; +} diff --git a/AudioManagerDaemon/DataBaseHandler.h b/AudioManagerDaemon/DataBaseHandler.h new file mode 100644 index 0000000..03704af --- /dev/null +++ b/AudioManagerDaemon/DataBaseHandler.h @@ -0,0 +1,383 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file DataBaseHandler.h + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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_ + +#define AUDIO_DATABASE "audiomanagerDB.sqlite" + +#define DOMAIN_TABLE "Domains" +#define SOURCE_CLASS_TABLE "SourceClasses" +#define SINK_CLASS_TABLE "SinkClasses" +#define SOURCE_TABLE "Sources" +#define SINK_TABLE "Sinks" +#define GATEWAY_TABLE "Gateways" +#define CONNECTION_TABLE "Connections" +#define INTERRUPT_TABLE "Interrupts" +#define MAIN_TABLE "MainTable" + +#include <QtSql> +#include <QString> +#include <QObject> +#include <QSqlDatabase> +#include <QSqlError> +#include <QFile> +#include <qfile.h> + +#include "audioManagerIncludes.h" + +class RoutingTreeItem; +class Router; +class SinkType; +class SourceType; +class ConnectionType; +class RoutingTree; + +/** + * \class DataBaseHandler + * \brief The handler of the database + * \details creates, deletes inserts and reads data in the database. Works on top of SQLite + * + *\fn bool DataBaseHandler::open_database() + * \brief opens the database + * + * \fn DataBaseHandler::close_database() + * \brief closes the database + * + * \fn bool DataBaseHandler::delete_data(QString table) + * \brief deletes the data of a complete table + * \param table the name of the table to be deleted + * + * \fn bool DataBaseHandler::create_tables() + * \brief creates all neccessary tables + * + * \fn domain_t DataBaseHandler::insert_into_Domains_table(QString DomainName, QString BusName, QString NodeName, bool EarlyMode) + * \brief inserts data into the domain table + * \param DomainName the name to be inserted + * \param BusName the name of the Bus that is used for the domain + * \param NodeName the name of the RoutingAdaptor that belongs to the domain + * \param EarlyMode true if the domain is an early domain + * \return the domain id (unique) + * + * \fn sourceClass_t DataBaseHandler::insert_into_Source_Class_table(QString ClassName, volume_t VolumeOffset, bool IsInterrupt, bool IsMixed) + * \brief inserts data into the Source Class table + * \param ClassName name of the class + * \param VolumeOffset the volume offset of the class + * \param IsInterrupt true if it is an interrupt + * \param IsMixed true if it is mixed + * \return the unique Class ID + * + * \fn sinkClass_t DataBaseHandler::insert_into_Sink_Class_table(QString ClassName) + * \brief enters new Sink Class in the Class Table + * \param ClassName the name of the class + * \return unique class ID + * + * \fn source_t DataBaseHandler::insert_into_Source_table(QString Name, sourceClass_t Class_ID, domain_t Domain_ID, bool IsGateway) + * \brief inserts a new source into the source table + * \param Name the name of the source + * \param Class_ID the class ID of the source + * \param Domain_ID the domain ID + * \param IsGateway true if it is a gateway + * \return returns a new source ID + * + * \fn sink_t DataBaseHandler::insert_into_Sink_table(QString Name, sinkClass_t Class_ID, domain_t Domain_ID, bool IsGateway) + * \brief inserts a new Sink into the table + * \param Name the name of the sink + * \param Class_ID the class ID + * \param Domain_ID the domain ID + * \param IsGateway true if it is a gateway + * \return the new Sink ID + * + * \fn gateway_t DataBaseHandler::insert_into_Gatway_table(QString Name, sink_t Sink_ID, source_t Source_ID, domain_t DomainSource_ID, domain_t DomainSink_ID, domain_t ControlDomain_ID) + * \brief inserts a gateway into the database + * \param Name the name of the gateway + * \param Sink_ID the sink id of the gateway + * \param Source_ID the source id of the gateway + * \param DomainSource_ID the domain id where the source is in + * \param DomainSink_ID the domain id where the sinḱ is in + * \param ControlDomain_ID the domain which controls the gateway + * \return the unique id of the gateway + * + * \fn domain_t DataBaseHandler::peek_Domain_ID(QString DomainName) + * \brief reserves a domain ID but does not register it. + * \details This function is used to register Gateways. The problem is that a gateway is registered from one domain that does not know if the other end of the gateway domain is already registered. + * this can be solved via peeking a domain ID. By using this function the domain is only "reserved" not registered. + * \param DomainName the name of the domain to be peeked + * \return the Domain ID + * + * \fn domain_t DataBaseHandler::get_Domain_ID_from_Source_ID(source_t Source_ID) + * \brief returns the domain if from a source given via an Id + * \param Source_ID the source that the domain shall be returned of + * \return the domain ID + * + * \fn domain_t DataBaseHandler::get_Domain_ID_from_Sink_ID(sink_t Sink_ID) + * \brief returns the domain from a given sink ID + * \param Sink_ID the sink ID + * \return the domain ID + * + * \fn source_t DataBaseHandler::get_Source_ID_from_Name(QString name) + * \brief returns the source ID from a name + * \param name the name for witch the source ID shall be returned + * \return the source ID + * + * \fn sourceClass_t DataBaseHandler::get_Source_Class_ID_from_Name(QString name) + * \brief returns the source class ID from a given class name + * \return the source class ID + * + * \fn domain_t DataBaseHandler::get_Domain_ID_from_Name(QString name) + * \brief returns the domain ID from given domain name + * \param name the name + * \return the domain ID + * + * \fn sink_t DataBaseHandler::get_Sink_ID_from_Name(QString name) + * \brief returns the Sink ID from a given name + * \param name the name + * \return the sink ID + * + * \fn QString DataBaseHandler::get_Bus_from_Domain_ID(domain_t Domain_ID) + * \brief returns the bus name for a given domain ID + * \param Domain_ID the domain ID + * \return the name of the bus + * + * \fn domain_t DataBaseHandler::get_Domain_ID_from_Connection_ID(connection_t ID) + * \brief returns the domain ID from a given Connection ID + * \param ID the connection ID + * \return the domain ID + * + * \fn bool DataBaseHandler::is_source_Mixed(source_t source) + * \brief is used to find out if a source is mixed. Used for interrrupt sources + * \param source the source + * \return true if source is mixed. + * + * \fn gateway_t DataBaseHandler::get_Gateway_ID_with_Domain_ID(domain_t startDomain_ID, domain_t targetDomain_ID) + * \brief returns a gateway ID for a given domain connection + * \param startDomain_ID the domain ID where the gateway should start + * \param targetDomain_ID the domain ID where the gateway should stop + * \return the gateway ID + * + * \fn genError_t DataBaseHandler::get_Gateway_Source_Sink_Domain_ID_from_ID(gateway_t Gateway_ID,source_t* return_Source_ID,sink_t* return_Sink_ID,domain_t* return_ControlDomain_ID) + * \brief retruns informations about gateways + * \param Gateway_ID the gateways ID as input + * \param return_Source_ID call by reference source ID return value + * \param return_Sink_ID call by reference Sink ID return value + * \param return_ControlDomain_ID call by reference Control Domain ID return value + * + * \fn void DataBaseHandler::get_Domain_ID_Tree(bool onlyfree, RoutingTree* Tree, QList<RoutingTreeItem*>* allItems) + * \brief is used to create a Tree out of RoutingTreeItems. Used for routing algorithm + * \param onlyfree if called with true then only routes via free gateways will be returned + * \param Tree pointer the the Routing Tree + * \param allItems pointer to a list of all Routing Tree Items as call by reference value + * + * \fn void DataBaseHandler::getListofSources(QList<SourceType>* SourceList) + * \brief returns a list of all sources + * \param SourceList call by reference pointer to return value + * + * \fn void DataBaseHandler::getListofSinks(QList<SinkType>* SinkList) + * \brief returns a list of all sinks + * \param SinkList call by reference pointer to return value + * + * \fn void DataBaseHandler::getListofConnections(QList<ConnectionType>* ConnectionList) + * \brief returns a list of all connections + * \param ConnectionList call by reference pointer to return value + * + * \fn connection_t DataBaseHandler::getConnectionID(source_t SourceID,sink_t SinkID) + * \brief returns the connection ID for a given source sink combination + * \param SourceID the source ID + * \param SinkID the sink ID + * \return the connection ID, -1 if there is no connection + * + * \fn connection_t DataBaseHandler::insertConnection(source_t SourceID,sink_t SinkID) + * \brief inserts a connection into the database + * \param SourceID the source ID + * \param SinkID the sink ID + * \return the connection ID of the newly entered connection + * + * \fn genError_t DataBaseHandler::removeConnection(connection_t ConnectionID) + * \brief removes a connection from the database + * \param ConnectionID the connection ID + * \return GEN_OK if everything was ok + * + * \fn connection_t DataBaseHandler::reserveMainConnection(source_t source,sink_t sink) + * \brief reserves a main connection ID + * \param source the source + * \param sink the sink + * \return the main connection ID of the newly entered main connection + * + * \fn genError_t DataBaseHandler::updateMainConnection(connection_t connID,genRoute_t route) + * \brief updates the main connection. Enters the missing information into the main connection that was reserved before + * \param connID connection ID + * \param route the route information to be entered + * \return GEN_OK on success + * + * \fn genError_t DataBaseHandler::getMainConnectionDatafromID(const connection_t connID, sink_t* return_sinkID,source_t* return_sourceID,genRoute_t** return_route) + * \brief returns details for a connection ID + * \param connID the connection ID + * \param return_sinkID call by reference pointer to return Sink ID + * \param return_sourceID call by reference pointer to return Source ID + * \param return_route call by reference pointer to return pointer of the route + * \return GEN_OK on success + * + * \fn connection_t DataBaseHandler::returnMainconnectionIDforSinkSourceID (sink_t sink, source_t source) + * \brief return a main connection ID for a sink source combination + * \param sink the sink ID + * \param source the source ID + * \return the connection ID + * + * \fn QList<source_t> DataBaseHandler::getSourceIDsForSinkID (sink_t sink) + * \brief returns the list of source IDs that are connected to a sink ID + * \param sink the sink ID + * \return a list of source IDs + * + * \fn QList<ConnectionType> DataBaseHandler::getListAllMainConnections() + * \brief returns a list of all mainconnections + * \return a list of all connections + * + * \fn genError_t DataBaseHandler::removeMainConnection(connection_t connID) + * \brief removes a main connection ID + * \param connID the connection ID to be removed + * \return GEN_OK on success + * + * \fn genInt_t DataBaseHandler::reserveInterrupt(sink_t Sink_ID, source_t Source_ID) + * \brief reserve an interrupt + * \details use this to reserve an interrupt ID before the actual connections is build up. Via DataBaseHandler::updateInterrupt the information can be complemented afterwards + * \param Sink_ID the sink ID + * \param Source_ID the source ID + * \return the interrupt ID + * + * \fn genError_t DataBaseHandler::updateInterrupt(const genInt_t intID,connection_t connID, bool mixed, QList<source_t> listInterrruptedSources) + * \brief use this to enter the missing information into a reserved Interrupt into the database + * \param intID the interrupt ID + * \param connID the connection ID that is used + * \param mixed true if the interrupt is mixed + * \param listInterrruptedSources the list of interrupted sources. Used to restore the old state afterwards + * \return GEN_OK on success + * + * \fn genError_t DataBaseHandler::getInterruptDatafromID(const genInt_t intID, connection_t* return_connID, sink_t* return_Sink_ID, source_t* return_Source_ID, bool* return_mixed, QList<source_t>** return_listInterrruptedSources) + * \brief returns information about interrupts from the ID + * \param intID the interrupt ID + * \param return_connID pointer to call by reference connection ID + * \param return_Sink_ID pointer to call by reference sink ID + * \param return_Source_ID pointer to call by reference source ID + * \param return_mixed pointer to call by reference mixed value + * \param return_listInterrruptedSources pointer to call by reference list of interrupted sources + * \return GEN_OK on success + * + * \fn genError_t DataBaseHandler::removeInterrupt(const genInt_t intID) + * \brief removes an interrupt from the database + * \param intID the interrrupt ID to be removed + * \return GEN_OK on success + * + * \fn void DataBaseHandler::signal_connectionChanged() + * \brief this signal is emitted when connections are changed + * + * \fn void DataBaseHandler::signal_numberOfSinksChanged() + * \brief this signal is emitted when the number of sinks changed + * + * \fn void DataBaseHandler::signal_numberOfSourcesChanged() + * \brief this signal is emitted when the number of sources changed + * + */ + +class DataBaseHandler: public QObject { +Q_OBJECT +public: + DataBaseHandler(); + virtual ~DataBaseHandler(); + + bool open_database(); + void close_database(); + bool delete_data(QString table); + bool create_tables(); + + domain_t insert_into_Domains_table(QString DomainName, QString BusName, + QString NodeName, bool EarlyMode); + sourceClass_t insert_into_Source_Class_table(QString ClassName, + volume_t VolumeOffset, bool IsInterrupt, bool IsMixed); + sinkClass_t insert_into_Sink_Class_table(QString ClassName); + source_t insert_into_Source_table(QString Name, sourceClass_t Class_ID, + domain_t Domain_ID, bool IsGateway); + sink_t insert_into_Sink_table(QString Name, sinkClass_t Class_ID, + domain_t Domain_ID, bool IsGateway); + gateway_t insert_into_Gatway_table(QString Name, sink_t Sink_ID, + source_t Source_ID, domain_t DomainSource_ID, + domain_t DomainSink_ID, domain_t ControlDomain_ID); + + domain_t peek_Domain_ID(QString DomainName); + domain_t get_Domain_ID_from_Source_ID(source_t Source_ID); + domain_t get_Domain_ID_from_Sink_ID(sink_t Sink_ID); + + source_t get_Source_ID_from_Name(QString name); + sourceClass_t get_Source_Class_ID_from_Name(QString name); + domain_t get_Domain_ID_from_Name(QString name); + sink_t get_Sink_ID_from_Name(QString name); + QString get_Bus_from_Domain_ID(domain_t Domain_ID); + domain_t get_Domain_ID_from_Connection_ID(connection_t ID); + + bool is_source_Mixed(source_t source); + + gateway_t get_Gateway_ID_with_Domain_ID(domain_t startDomain_ID, + domain_t targetDomain_ID); + genError_t get_Gateway_Source_Sink_Domain_ID_from_ID(gateway_t Gateway_ID, + source_t* return_Source_ID, sink_t* return_Sink_ID, + domain_t* return_ControlDomain_ID); + void get_Domain_ID_Tree(bool onlyfree, RoutingTree* Tree, + QList<RoutingTreeItem*>* allItems); + + void getListofSources(QList<SourceType>* SourceList); + void getListofSinks(QList<SinkType>* SinkList); + void getListofConnections(QList<ConnectionType>* ConnectionList); + + connection_t getConnectionID(source_t SourceID, sink_t SinkID); + connection_t insertConnection(source_t SourceID, sink_t SinkID); + genError_t removeConnection(connection_t ConnectionID); + connection_t reserveMainConnection(source_t source, sink_t sink); + genError_t updateMainConnection(connection_t connID, genRoute_t route); + genError_t getMainConnectionDatafromID(const connection_t connID, + sink_t* return_sinkID, source_t* return_sourceID, + genRoute_t** return_route); + connection_t returnMainconnectionIDforSinkSourceID(sink_t sink, + source_t source); + QList<source_t> getSourceIDsForSinkID(sink_t sink); + QList<ConnectionType> getListAllMainConnections(); + genError_t removeMainConnection(connection_t connID); + genInt_t reserveInterrupt(sink_t Sink_ID, source_t Source_ID); + genError_t updateInterrupt(const genInt_t intID, connection_t connID, + bool mixed, QList<source_t> listInterrruptedSources); + genError_t getInterruptDatafromID(const genInt_t intID, + connection_t* return_connID, sink_t* return_Sink_ID, + source_t* return_Source_ID, bool* return_mixed, + QList<source_t>** return_listInterrruptedSources); + genError_t removeInterrupt(const genInt_t intID); + +signals: + void signal_connectionChanged(); + void signal_numberOfSinksChanged(); + void signal_numberOfSourcesChanged(); + +private: + QSqlDatabase m_database; //!< pointer to database +}; + +#endif /* DATABASEHANDLER_H_ */ diff --git a/AudioManagerDaemon/Doxyfile.in b/AudioManagerDaemon/Doxyfile.in new file mode 100644 index 0000000..bb1ef58 --- /dev/null +++ b/AudioManagerDaemon/Doxyfile.in @@ -0,0 +1,1661 @@ +# Doxyfile 1.7.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = AudioManager + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.1 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = YES + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = YES + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = @CMAKE_CURRENT_SOURCE_DIR@ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.vhd \ + *.vhdl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = ../../AudioManGUI + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = YES + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> +# Qt Help Project / Custom Filters</a>. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> +# Qt Help Project / Filter Attributes</a>. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = YES + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvances is that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans.ttf + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/AudioManagerDaemon/HookEngine.cpp b/AudioManagerDaemon/HookEngine.cpp new file mode 100644 index 0000000..c03eadc --- /dev/null +++ b/AudioManagerDaemon/HookEngine.cpp @@ -0,0 +1,378 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file HookEngine.cpp + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 "HookEngine.h" + +BaseHook::BaseHook() { +} + +BaseHook::~BaseHook() { +} + +HookHandler::HookHandler() { +} + +HookHandler::~HookHandler() { +} + +void BaseHook::registerAudioManagerCore(AudioManagerCore* core) { + m_core = core; +} + +genError_t BaseHook::registerHookEngine(HookHandler* engine) { + m_hookhandler = engine; + return GEN_OK; +} + +genError_t HookHandler::registerHook(hookprio_t prio, genHook_t hookType, + BaseHook* hookClass) { + prioList newEntry; + QList<prioList>* list; + + if (prio < 0 || prio > 100) { + DLT_LOG(AudioManager,DLT_LOG_WARN, DLT_STRING("Register Hook: Priority out of range: "), DLT_INT(prio)); + return GEN_OUTOFRANGE; + } + + newEntry.prio = prio; + newEntry.hook = hookClass; + + switch (hookType) { + case HOOK_DOMAIN_REGISTER: + list = &m_domainRegisterList; + break; + case HOOK_DOMAIN_DEREGISTER: + list = &m_domainDeregisterList; + break; + case HOOK_SINK_REGISTER: + list = &m_sinkRegisterList; + break; + case HOOK_SINK_DEREGISTER: + list = &m_sinkDeregisterList; + break; + case HOOK_SOURCE_REGISTER: + list = &m_sourceRegisterList; + break; + case HOOK_SOURCE_DEREGISTER: + list = &m_sourceDeregisterList; + break; + case HOOK_GATEWAY_REGISTER: + list = &m_gatewayRegisterList; + break; + case HOOK_GATEWAY_DERGISTER: + list = &m_gatewayDeregisterList; + break; + case HOOK_ROUTING_REQUEST: + list = &m_routingRequestList; + break; + case HOOK_ROUTING_COMPLETE: + list = &m_routingCompleteList; + break; + case HOOK_SYSTEM_READY: + list = &m_systemReadyList; + break; + case HOOK_SYSTEM_DOWN: + list = &m_systemDownList; + break; + case HOOK_VOLUME_CHANGE: + list = &m_volumeChangeList; + break; + case HOOK_MUTE_SOURCE: + list = &m_muteSourceList; + break; + case HOOK_UNMUTE_SOURCE: + list = &m_unmuteSourceList; + break; + case HOOK_MUTE_SINK: + list = &m_muteSinkList; + break; + case HOOK_UNMUTE_SINK: + list = &m_unmuteSinkList; + break; + case HOOK_USER_CONNECTION_REQUEST: + list = &m_userConnectionRequestList; + break; + case HOOK_USER_DISCONNECTION_REQUEST: + list = &m_userDisconnectionReuestList; + break; + case HOOK_CONNECTION_REQUEST: + list = &m_connectionRequestList; + break; + case HOOK_DISCONNECTION_REQUEST: + list = &m_disconnectionReuestList; + break; + case HOOK_INTERRUPT_REQUEST: + list = &m_interruptRequestList; + break; + default: + DLT_LOG(AudioManager,DLT_LOG_WARN, DLT_STRING("Trying to register unknown Hook ")) + ; + return GEN_OUTOFRANGE; + } + + int index = 0; + foreach(prioList l,*list) + { + if (l.prio > prio) { + index++; + } + } + list->insert(index, newEntry); + //TODO test the sorting of the hooks with more than one plugin + + return GEN_OK; +} + +genError_t HookHandler::fireHookDomainRegister(char* Name, domain_t ID) { + foreach (prioList hook,m_domainRegisterList) + { + if (hook.hook->hookDomainRegister(Name, ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookDomainDeregister(domain_t ID) { + foreach (prioList hook,m_domainDeregisterList) + { + if (hook.hook->hookDomainDeregister(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookSinkRegister(char* Name, sink_t ID) { + foreach (prioList hook,m_sinkRegisterList) + { + if (hook.hook->hookSinkRegister(Name, ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookSinkDeregister(sink_t ID) { + foreach (prioList hook,m_sinkDeregisterList) + { + if (hook.hook->hookSinkDeregister(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookSourceRegister(char* Name, source_t ID) { + foreach (prioList hook,m_sourceRegisterList) + { + if (hook.hook->hookSinkRegister(Name, ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookSourceDeregister(source_t ID) { + foreach (prioList hook,m_sourceDeregisterList) + { + if (hook.hook->hookSourceDeregister(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookGatewayRegister(char* Name, gateway_t ID) { + foreach (prioList hook,m_gatewayRegisterList) + { + if (hook.hook->hookGatewayRegister(Name, ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookGatewayDeregister(gateway_t ID) { + foreach (prioList hook,m_gatewayDeregisterList) + { + if (hook.hook->hookGatewayDeregister(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookSystemReady(void) { + foreach (prioList hook,m_systemReadyList) + { + if (hook.hook->hookSystemReady() == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookSystemDown(void) { + foreach (prioList hook,m_systemDownList) + { + if (hook.hook->hookSystemDown() == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookConnectionRequest(source_t SourceID, + sink_t SinkID) { + foreach (prioList hook,m_connectionRequestList) + { + if (hook.hook->hookConnectionRequest(SourceID, SinkID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookDisconnectionRequest(connection_t ID) { + foreach (prioList hook,m_disconnectionReuestList) + { + if (hook.hook->hookDisconnectionRequest(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookUserConnectionRequest(Queue* queue, + source_t SourceID, sink_t SinkID) { + foreach (prioList hook,m_userConnectionRequestList) + { + if (hook.hook->hookUserConnectionRequest(queue, SourceID, SinkID) + == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookUserDisconnectionRequest(Queue* queue, + connection_t connID) { + foreach (prioList hook,m_userDisconnectionReuestList) + { + if (hook.hook->hookUserDisconnectionRequest(queue, connID) + == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookRoutingRequest(bool onlyfree, source_t source, + sink_t sink, QList<genRoute_t>* ReturnList) { + foreach (prioList hook,m_routingRequestList) + { + if (hook.hook->hookRoutingRequest(onlyfree, source, sink, + ReturnList) == HOOK_STOP) + break; + } + return GEN_OK; +} + +//todo change type +genError_t HookHandler::fireHookRoutingComplete(genRoute_t route) { + foreach (prioList hook,m_routingCompleteList) + { + if (hook.hook->hookRoutingComplete(route) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookVolumeChange(volume_t newVolume, sink_t SinkID) { + foreach (prioList hook,m_volumeChangeList) + { + if (hook.hook->hookVolumeChange(newVolume, SinkID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookMuteSource(source_t ID) { + foreach (prioList hook,m_muteSourceList) + { + if (hook.hook->hookMuteSource(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookUnmuteSource(source_t ID) { + foreach (prioList hook,m_unmuteSourceList) + { + if (hook.hook->hookUnmuteSource(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookMuteSink(sink_t ID) { + foreach (prioList hook,m_muteSinkList) + { + if (hook.hook->hookMuteSink(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookUnmuteSink(sink_t ID) { + foreach (prioList hook,m_unmuteSinkList) + { + if (hook.hook->hookUnmuteSink(ID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +genError_t HookHandler::fireHookInterruptRequest(Queue* queue, + source_t interruptSource, sink_t sink, genInt_t* interruptID) { + foreach (prioList hook,m_interruptRequestList) + { + if (hook.hook->hookInterruptRequest(queue, interruptSource, sink, + interruptID) == HOOK_STOP) + break; + } + return GEN_OK; +} + +void HookHandler::registerAudioManagerCore(AudioManagerCore* core) { + m_core = core; +} + +void HookHandler::loadHookPlugins() { + BaseHook *b = NULL; + foreach (QObject *plugin, QPluginLoader::staticInstances()) + { + HookPluginFactory* HookPluginFactory_ = qobject_cast< + HookPluginFactory *> (plugin); + if (HookPluginFactory_) { + b = HookPluginFactory_->returnInstance(); + b->registerHookEngine(this); + b->registerAudioManagerCore(m_core); + b->InitHook(); + char pName[40]; + if (b->returnPluginName(pName) == GEN_OK) { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Registered Hook Plugin:"), DLT_STRING(pName)); + } + } + } +} + diff --git a/AudioManagerDaemon/HookEngine.h b/AudioManagerDaemon/HookEngine.h new file mode 100644 index 0000000..4586bf5 --- /dev/null +++ b/AudioManagerDaemon/HookEngine.h @@ -0,0 +1,345 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file HookEngine.h + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 HOOKENGINE_H_ +#define HOOKENGINE_H_ + +#include "audioManagerIncludes.h" + +class AudioManagerCore; +class Queue; + +/**These define the different types of Hooks available in the system + * + */ +typedef enum genHook { + HOOK_DOMAIN_REGISTER, //!< HOOK_DOMAIN_REGISTER + HOOK_DOMAIN_DEREGISTER, //!< HOOK_DOMAIN_DEREGISTER + HOOK_SOURCE_REGISTER, //!< HOOK_SOURCE_REGISTER + HOOK_SOURCE_DEREGISTER, //!< HOOK_SOURCE_DEREGISTER + HOOK_SINK_REGISTER, //!< HOOK_SINK_REGISTER + HOOK_SINK_DEREGISTER, //!< HOOK_SINK_DEREGISTER + HOOK_GATEWAY_REGISTER, //!< HOOK_GATEWAY_REGISTER + HOOK_GATEWAY_DERGISTER, //!< HOOK_GATEWAY_DERGISTER + HOOK_SYSTEM_READY, //!< HOOK_SYSTEM_READY + HOOK_SYSTEM_DOWN, //!< HOOK_SYSTEM_DOWN + HOOK_USER_CONNECTION_REQUEST, //!< HOOK_USER_CONNECTION_REQUEST + HOOK_USER_DISCONNECTION_REQUEST, //!< HOOK_USER_DISCONNECTION_REQUEST + HOOK_CONNECTION_REQUEST, //!< HOOK_CONNECTION_REQUEST + HOOK_DISCONNECTION_REQUEST, //!< HOOK_DISCONNECTION_REQUEST + HOOK_ROUTING_REQUEST, //!< HOOK_ROUTING_REQUEST + HOOK_ROUTING_COMPLETE, //!< HOOK_ROUTING_COMPLETE + HOOK_VOLUME_CHANGE, //!< HOOK_VOLUME_CHANGE + HOOK_MUTE_SOURCE, //!< HOOK_MUTE_SOURCEDataBaseHandler + HOOK_UNMUTE_SOURCE, //!< HOOK_UNMUTE_SOURCE + HOOK_MUTE_SINK, //!< HOOK_MUTE_SINK + HOOK_UNMUTE_SINK, //!< HOOK_UNMUTE_SINK + HOOK_INTERRUPT_REQUEST +//!< HOOK_INTERRUPT_REQUEST +} genHook_t; + +class HookHandler; + +/**This is the base class for all HookPlugins + * To implement a HookPlugin, a QTPlugin HookPluginFactory Class needs to be created which factors an instance of a class that is derived from + * BaseHook. + * All Hooks that are possible are implemented here as virtual functions. To use a hook, the derived class needs simply to overwrite the + * virtual hook functions. This means a plugin can only have one hook function for each hook (more than one does not make sense anyway). + * Each plugin need to implement a Init function. Within this function the hooks that the plugin wants to use need to be registered. + * + */ +class BaseHook { +public: + BaseHook(); + virtual ~BaseHook(); + /**This function is used to register the HookHandler in the plugin. + * + * @param engine pointer to the instance of the HookHandler + * @return GEN_OK on success + */ + genError_t registerHookEngine(HookHandler* engine); + + /**This is the init function. Register your hooks here, like for example register to the domainregisterhook with prio 10: + * @code m_hookhandler->registerHook(10,HOOK_DOMAIN_REGISTER,this); @endcode + * + * @return GEN_OK on success + */ + virtual genError_t InitHook(void)=0; + + /**Deinit function. If you need to store or cleaup -> here is the right place to do it + * + * @return GEN_OK on success + */ + virtual genError_t DeinitHook(void)=0; + + /**Retrieve the name of the plugin + * max length of the name: 40 chars + * @param PluginName buffer to write the name to + * @return GEN_OK on success + */ + virtual genError_t returnPluginName(char* PluginName)=0; + + void registerAudioManagerCore(AudioManagerCore* core); + + virtual genHookResult_t hookDomainRegister(char* Name, domain_t ID) { + (void) Name; + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookDomainDeregister(domain_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookSinkRegister(char* Name, sink_t ID) { + (void) Name; + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookSinkDeregister(sink_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookSourceRegister(char* Name, source_t ID) { + (void) Name; + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookSourceDeregister(source_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookGatewayRegister(char* Name, gateway_t ID) { + (void) Name; + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookGatewayDeregister(gateway_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookSystemReady(void) { + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookSystemDown(void) { + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookUserConnectionRequest(Queue* queue, + source_t SourceID, sink_t SinkID) { + (void) queue; + (void) SourceID; + (void) SinkID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookUserDisconnectionRequest(Queue* queue, + connection_t connID) { + (void) queue; + (void) connID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookConnectionRequest(source_t SourceID, + sink_t SinkID) { + (void) SourceID; + (void) SinkID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookDisconnectionRequest(connection_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookRoutingRequest(bool onlyfree, source_t source, + sink_t sink, QList<genRoute_t>* ReturnList) { + (void) onlyfree; + (void) source; + (void) sink; + (void) ReturnList; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookRoutingComplete(genRoute_t route) { + (void) route; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookVolumeChange(volume_t newVolume, sink_t SinkID) { + (void) newVolume; + (void) SinkID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookMuteSource(source_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookUnmuteSource(source_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookMuteSink(sink_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookUnmuteSink(sink_t ID) { + (void) ID; + return HOOK_UNUSED; + } + ; + virtual genHookResult_t hookInterruptRequest(Queue* queue, + source_t interruptSource, sink_t sink, genInt_t* interruptID) { + (void) queue; + (void) interruptSource; + (void) sink; + (void) interruptID; + return HOOK_UNUSED; + } + ; + +protected: + HookHandler* m_hookhandler; + AudioManagerCore* m_core; +}; + +/**This class handles all the hooks. + * It maintains a list of all registered hooks and calls them if desired. + * + */ +class HookHandler { +public: + HookHandler(); + virtual ~HookHandler(); + /**By calling this functions, all Plugins that are related to hooks are automatically loaded + * The init function is called as well, so that the plugins can register their hooks + */ + void loadHookPlugins(); + + /**This function is used to register a hook + * + * @param prio the prio (between 0 and 100, 100 is max) + * @param hookType gives the type of the hook. Must match the hook callback of course ! + * @param hookClass This is a pointer to the Class registering the hook. Usually this. + * @return GEN_OK on success + */ + genError_t registerHook(hookprio_t prio, genHook_t hookType, + BaseHook* hookClass); + + void registerAudioManagerCore(AudioManagerCore* core); + + /**All functions starting with fire are called to execute the hook. They will go throDataBaseHandler::ugh the list + * of registered hooks and call them after the priorities. + */ + + genError_t fireHookDomainRegister(char* Name, domain_t ID); + genError_t fireHookDomainDeregister(domain_t ID); + genError_t fireHookSinkRegister(char* Name, sink_t ID); + genError_t fireHookSinkDeregister(sink_t ID); + genError_t fireHookSourceRegister(char* Name, source_t ID); + genError_t fireHookSourceDeregister(source_t ID); + genError_t fireHookGatewayRegister(char* Name, gateway_t ID); + genError_t fireHookGatewayDeregister(gateway_t ID); + genError_t fireHookSystemReady(void); + genError_t fireHookSystemDown(void); + genError_t fireHookConnectionRequest(source_t SourceID, sink_t SinkID); + genError_t fireHookDisconnectionRequest(connection_t ID); + genError_t fireHookUserConnectionRequest(Queue* queue, source_t SourceID, + sink_t SinkID); + genError_t fireHookUserDisconnectionRequest(Queue* queue, + connection_t connID); + genError_t fireHookRoutingRequest(bool onlyfree, source_t SourceID, + sink_t SinkID, QList<genRoute_t>* ReturnList); + genError_t fireHookRoutingComplete(genRoute_t route); + genError_t fireHookVolumeChange(volume_t newVolume, sink_t SinkID); + genError_t fireHookMuteSource(source_t ID); + genError_t fireHookUnmuteSource(source_t ID); + genError_t fireHookMuteSink(sink_t ID); + genError_t fireHookUnmuteSink(sink_t ID); + genError_t fireHookInterruptRequest(Queue* queue, source_t interruptSource, + sink_t sink, genInt_t* interruptID); + +private: + /**Struct for managing the hookLists + * This struct holds the pointer to the instance of the hook to be called and the priority after that the list ist sorted. + * + */ + struct prioList { + BaseHook* hook; + hookprio_t prio; + }; + + QList<prioList> m_domainRegisterList; + QList<prioList> m_domainDeregisterList; + QList<prioList> m_sinkRegisterList; + QList<prioList> m_sinkDeregisterList; + QList<prioList> m_sourceRegisterList; + QList<prioList> m_sourceDeregisterList; + QList<prioList> m_gatewayRegisterList; + QList<prioList> m_gatewayDeregisterList; + QList<prioList> m_systemReadyList; + QList<prioList> m_systemDownList; + QList<prioList> m_connectionRequestList; + QList<prioList> m_disconnectionReuestList; + QList<prioList> m_userConnectionRequestList; + QList<prioList> m_userDisconnectionReuestList; + QList<prioList> m_routingRequestList; + QList<prioList> m_routingCompleteList; + QList<prioList> m_volumeChangeList; + QList<prioList> m_muteSourceList; + QList<prioList> m_unmuteSourceList; + QList<prioList> m_muteSinkList; + QList<prioList> m_unmuteSinkList; + QList<prioList> m_interruptRequestList; + + AudioManagerCore* m_core; +}; + +/**Factory class for plugin. Needs just to return an instance of the class that the plugin implements. + * + */ +class HookPluginFactory { +public: + virtual ~HookPluginFactory() { + } + virtual BaseHook* returnInstance()=0; +}; + +Q_DECLARE_INTERFACE(HookPluginFactory,"HookPluginFactory/1.0") +; + +#endif /* HOOKENGINE_H_ */ diff --git a/AudioManagerDaemon/Router.cpp b/AudioManagerDaemon/Router.cpp new file mode 100644 index 0000000..6952433 --- /dev/null +++ b/AudioManagerDaemon/Router.cpp @@ -0,0 +1,229 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file Router.cpp + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 <qstring.h> +#include <QMutableListIterator> +#include <iostream> +#include <stdio.h> + +#include "DataBaseHandler.h" +#include "Router.h" + +Router::Router() { +} + +Router::~Router() { +} + +void Router::registerDatabasehandler(DataBaseHandler* db_handler) { + m_dbHandler = db_handler; +} + +bool Router::get_Route_from_Source_ID_to_Sink_ID(const bool onlyfree, + const source_t Source_ID, const sink_t Sink_ID, + QList<genRoute_t>* ReturnList) { + + domain_t Source_Domain = m_dbHandler->get_Domain_ID_from_Source_ID( + Source_ID); //first find out in which domains the source and sink are + domain_t Sink_Domain = m_dbHandler->get_Domain_ID_from_Sink_ID(Sink_ID); + + if (Source_Domain == -1 || Sink_Domain == -1) { + return false; + } //if source or sink does not exists, exit here + + RoutingTree routingtree(Source_Domain); //Build up a Tree from the Source_Domain to every other domain. + QList<RoutingTreeItem*> flattree; //This list is the flat tree + QList<RoutingTreeItem*> matchtree; //This List holds all TreeItems which have the right Domain Sink IDs + QList<gateway_t> gwids; //holds all gateway ids of the route + genRoutingElement_t element; + QList<genRoutingElement_t> actualRoutingElement;//intermediate list of current routing pairs + genRoute_t actualRoute; //holds the actual Route + source_t ReturnSource = 0; + sink_t ReturnSink = 0; + source_t LastSource = 0; + domain_t ReturnDomain = 0; + + //TODO: kind of unclean. The separation between database and router could be better. + m_dbHandler->get_Domain_ID_Tree(onlyfree, &routingtree, &flattree); //Build up the tree out of the database as + + //we go through the returned flattree and look for our sink, after that flattree holds only treeItems that match + foreach (RoutingTreeItem* rTree,flattree) + { + if (rTree->returnDomainID() == Sink_Domain) { + matchtree.append(rTree); + } + } + + //No we need to trace back the routes for each entry in matchtree + foreach (RoutingTreeItem* match, matchtree) + { + //getting the route for the actual item + actualRoute.len = routingtree.getRoute(match, &gwids); //This gives only the Gateway IDs we need more + + //go throught the gatewayids and get more information + for (int i = 0; i < gwids.length(); i++) { + m_dbHandler->get_Gateway_Source_Sink_Domain_ID_from_ID( + gwids.value(i), &ReturnSource, &ReturnSink, + &ReturnDomain); + //first routing pair is source to ReturnSink of course; + if (i == 0) { + element.source = Source_ID; + element.sink = ReturnSink; + element.Domain_ID = Source_Domain; + } else { + element.source = LastSource; + element.sink = ReturnSink; + element.Domain_ID = ReturnDomain; + } + actualRoutingElement.append(element); + LastSource = ReturnSource; + } + element.source = LastSource; + element.sink = Sink_ID; + element.Domain_ID = Sink_Domain; + actualRoutingElement.append(element); + + actualRoute.Source_ID = Source_ID; + actualRoute.Sink_ID = Sink_ID; + actualRoute.route = actualRoutingElement; + ReturnList->append(actualRoute); + } + + return true; + //TODO: return actual status ! +} + +RoutingTreeItem::RoutingTreeItem(const domain_t Domain_Id, + const gateway_t Gateway_Id, RoutingTreeItem *parent) { + parentItem = parent; + m_domainID = Domain_Id; + m_gatewayID = Gateway_Id; +} + +RoutingTreeItem::RoutingTreeItem() { + +} + +RoutingTreeItem::~RoutingTreeItem() { + qDeleteAll(childItems); +} + +void RoutingTreeItem::appendChild(RoutingTreeItem *item) { + childItems.append(item); +} + +RoutingTreeItem *RoutingTreeItem::return_Parent() { + return parentItem; +} + +domain_t RoutingTreeItem::returnDomainID() { + return m_domainID; +} + +gateway_t RoutingTreeItem::returnGatewayID() { + return m_gatewayID; +} + +RoutingTree::RoutingTree(const domain_t Root_ID) : + m_rootItem(RoutingTreeItem(Root_ID)) { +} + +RoutingTree::~RoutingTree() { +} + +RoutingTreeItem* RoutingTree::insertItem(const domain_t Domain_ID, + const gateway_t Gateway_ID, RoutingTreeItem *parentItem) { + RoutingTreeItem *newTree = new RoutingTreeItem(Domain_ID, Gateway_ID, + parentItem); + parentItem->appendChild(newTree); + m_allChildList.append(newTree); + return newTree; +} + +int RoutingTree::getRoute(RoutingTreeItem* Targetitem, QList<gateway_t>* route) { + int hopps = 0; + RoutingTreeItem *parentItem = Targetitem; + while (parentItem != &m_rootItem) { + route->prepend(parentItem->returnGatewayID()); + hopps++; + parentItem = parentItem->return_Parent(); + } + return hopps; +} + +int RoutingTree::returnRootDomainID() { + return m_rootItem.returnDomainID(); +} + +RoutingTreeItem* RoutingTree::returnRootItem() { + return &m_rootItem; +} + +void Bushandler::load_Bus_plugins() { + RoutingSendInterface *b = NULL; + char BusName[40]; + Bus newBus; + foreach (QObject *plugin, QPluginLoader::staticInstances()) + { + strcpy(BusName, ""); + RoutingInterfaceFactory* busInterfaceFactory = qobject_cast< + RoutingInterfaceFactory *> (plugin); + if (busInterfaceFactory) { + b = busInterfaceFactory->returnInstance(); + b->return_BusName(BusName); + newBus.Name = QString(BusName); + newBus.sendInterface = b; + Busses.append(newBus); + QObject::connect((const QObject*) this, + SIGNAL (signal_system_ready(void)), (const QObject*) b, + SLOT(slot_system_ready(void))); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Bushandler:Found new bus interface"), DLT_STRING(newBus.Name.toAscii())); + } + } +} + +void Bushandler::StartupInterfaces() { + foreach (Bus bus, Busses) + { + bus.sendInterface->startup_interface(m_receiver); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Bushandler:Started Interface"), DLT_STRING(bus.Name.toAscii())); + } + emit signal_system_ready(); +} + +void Bushandler::registerReceiver(RoutingReceiver * receiver) { + m_receiver = receiver; +} + +RoutingSendInterface* Bushandler::getInterfaceforBus(QString bus) { + foreach (Bus b, Busses) + { + if (b.Name.compare(bus) == 0) { + return b.sendInterface; + } + } + return NULL; +} + diff --git a/AudioManagerDaemon/Router.h b/AudioManagerDaemon/Router.h new file mode 100644 index 0000000..683b75e --- /dev/null +++ b/AudioManagerDaemon/Router.h @@ -0,0 +1,222 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file Router.h + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 ROUTER_H_ +#define ROUTER_H_ + +#include "audioManagerIncludes.h" + +class DataBaseHandler; +class RoutingReceiver; + +/**calculates routes from sinks to sources + * navigation for audio + */ +class Router { +public: + Router(); + virtual ~Router(); + + /**Registers the database handler + * + * @param db_handler pointer to dabase handler + */ + void registerDatabasehandler(DataBaseHandler* db_handler); + + /**the routing algorithm. Returns a list of routes + * + * @param onlyfree true if only free gateways shall be used + * @param Source_ID the source ID from wich the route should start + * @param Sink_ID the sink ID where the route should end + * @param ReturnList buffer for the answer. + * @return returns true on success + */ + bool get_Route_from_Source_ID_to_Sink_ID(const bool onlyfree, + const source_t Source_ID, const sink_t Sink_ID, + QList<genRoute_t>* ReturnList); + +private: + DataBaseHandler* m_dbHandler; +}; + +/**This represents one Item in the RoutingTree + * + */ +class RoutingTreeItem { +public: + RoutingTreeItem(); + virtual ~RoutingTreeItem(); + + /**overloaded Constructor + * + * @param Domain_Id the domain ID where the gateway ends + * @param Gateway_Id the gateway ID that connects the domains + * @param parent pointer to the parent item in the tree + */ + RoutingTreeItem(const domain_t Domain_Id, const gateway_t Gateway_Id = 0, + RoutingTreeItem *parent = 0); + + /**appends a child from the same type to the tree + * + * @param child + */ + void appendChild(RoutingTreeItem *child); + + /**returns a list of all child items + * + * @param ChildItems buffer for the child items + */ + void returnChildItems(QList<RoutingTreeItem*> ChildItems); + + /**returns the domain ID + * + * @return the domain ID + */ + domain_t returnDomainID(void); + + /**returns the gateway ID + * + * @return gateway ID + */ + gateway_t returnGatewayID(void); + + /** is used to retrieve the parent item + * + * @return pointer to parent RoutingTreeItem + */ + RoutingTreeItem* return_Parent(); + +private: + QList<RoutingTreeItem*> childItems; //!< List of all child items + domain_t m_domainID; //!< the domain ID of the item + gateway_t m_gatewayID; //!< the gateway Id + RoutingTreeItem *parentItem; //!< pointer to the parent item +}; + +/**The routing tree iself + * + */ +class RoutingTree { +public: + + /**constructor must always be called with the root domain ID + * + * @param Root_Domain_ID + */ + RoutingTree(const domain_t Root_Domain_ID); + ~RoutingTree(); + + /**Insert an item in the Tree with the parent parentItem + * + * @param Domain_ID the domain Id + * @param Gateway_ID the gateway ID + * @param parentItem pointer to the parent Item + * @return returns a pointer to the new item + */ + RoutingTreeItem* insertItem(const domain_t Domain_ID, + const gateway_t Gateway_ID, RoutingTreeItem* parentItem); + + /**reverses the tree to get a route to the TargetItem + * + * @param TargetItem pointer to the Item from which should be reversed + * @param route pointer to a list of gateway IDs that need to be connected + * @return the length of the route. + */ + int getRoute(RoutingTreeItem* TargetItem, QList<gateway_t>* route); + + /**returns the DomainId of the rootItem + * + * @return domain ID of the root Item + */ + domain_t returnRootDomainID(void); + + /**returns a pointer to the rootitem + * + * @return pointer to the rootitem + */ + RoutingTreeItem* returnRootItem(void); + +private: + RoutingTreeItem m_rootItem; //!< pointer to root item + QList<RoutingTreeItem*> m_allChildList; //!< list of all childs +}; + +/**This class is responsible for loading the RoutingInterface Plugins + * In order to let a plugin be loaded by the BusManager, just add it in main.cpp like this + * @code Q_IMPORT_PLUGIN(RoutingPlugin) @code + */ +class Bushandler: public QObject { +Q_OBJECT +public: + Bushandler() { + } + ; + virtual ~Bushandler() { + } + ; + + /**by calling this, all bus plugins are loaded + * + */ + void load_Bus_plugins(); + + /**needed to register the m_receiver Instance + * via this function the receiver instance is given to the plugins so that they can call methods to talk to the audiomanager + * @param m_receiver pointer to the receiver + */ + void registerReceiver(RoutingReceiver* Receiver); + + /**By calling this function the plugins are called to startup. + * Init functions etc are done by the plugins in this phase + */ + void StartupInterfaces(); + + /**This function returns the pointer to the actual interface for a Bus + * + * @param bus the name of the bus + * @return pointer to the interface + */ + RoutingSendInterface* getInterfaceforBus(QString bus); + +signals: + /**This signal informs the plugins that the AudioManager is ready to register Domains Sinks and Sources + * + */ + void signal_system_ready(void); + +private: + /**Struct to save Name and Interface together + * + */ + struct Bus { + RoutingSendInterface* sendInterface; + QString Name; + }; + + QList<Bus> Busses; //!< list of all busses + RoutingReceiver* m_receiver; //!< pointer to the routing receiver +}; + +#endif /* ROUTER_H_ */ diff --git a/AudioManagerDaemon/RoutingReceive.cpp b/AudioManagerDaemon/RoutingReceive.cpp new file mode 100644 index 0000000..6108495 --- /dev/null +++ b/AudioManagerDaemon/RoutingReceive.cpp @@ -0,0 +1,118 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file RoutingReceive.cpp + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 "RoutingReceive.h" + +void RoutingReceiver::register_Databasehandler(DataBaseHandler* handler_) { + handler = handler_; +} + +int RoutingReceiver::registerDomain(char* name, char* busname, char* node, + bool earlymode) { + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Domain Registered: "), DLT_STRING(name)); + return handler->insert_into_Domains_table(QString(name), QString(busname), + QString(node), earlymode); +} + +int RoutingReceiver::registerSource(char* name, char* audioclass, char* domain) { + int id_class = handler->get_Source_Class_ID_from_Name(QString(audioclass)); + int id_domain = handler->get_Domain_ID_from_Name(QString(domain)); + + if (id_class == 0) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Class unknown: "), DLT_STRING(audioclass)); + return -1; + } else if (id_class == -1) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Database Error: ")); + return -1; + } + if (id_domain == 0) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Domain unknown: ")); + return -1; + } else if (id_class == -1) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Database Error: ")); + return -1; + } + + return handler->insert_into_Source_table(QString(name), id_class, + id_domain, false); +} +int RoutingReceiver::registerSink(char* name, char* sinkclass, char* domain) { + //TODO: Integrate Sink Classes + (void) sinkclass; + int id_sinkclass = 1; + int id_domain = handler->get_Domain_ID_from_Name(QString(domain)); + + if (id_domain == 0) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Domain unknown: ")); + return -1; + } + + return handler->insert_into_Sink_table(QString(name), id_sinkclass, + id_domain, false); +} +int RoutingReceiver::registerGateway(char* name, char* sink, char* source, + char *domainSource, char* domainSink, char* controlDomain) { + + int domainSourceID = + handler->get_Domain_ID_from_Name(QString(domainSource)); + if (domainSourceID == 0) { + domainSourceID = handler->peek_Domain_ID(QString(domainSource)); + } + int domainSinkID = handler->get_Domain_ID_from_Name(QString(domainSink)); + if (domainSinkID == 0) { + domainSinkID = handler->peek_Domain_ID(QString(domainSink)); + } + int domainControlID = handler->get_Domain_ID_from_Name( + QString(controlDomain)); + + if (domainSourceID == 0) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Domain Source unknown: ")); + return -1; + } + if (domainSink == 0) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Domain Sink unknown: ")); + return -1; + } + if (domainControlID == 0) { + DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Domain Control unknown: ")); + return -1; + } + + int sourceId = handler->insert_into_Source_table(QString(source), 0, + domainSourceID, true); + int sinkID = handler->insert_into_Sink_table(QString(sink), 0, + domainSinkID, true); + return handler->insert_into_Gatway_table(QString(name), sinkID, sourceId, + domainSourceID, domainSinkID, domainControlID); + +} + +int RoutingReceiver::peekDomain(char* name) { + return handler->peek_Domain_ID(QString(name)); +} + +void RoutingReceiver::ackConnect(genHandle_t handle, genError_t error) { + emit signal_ackConnect(handle, error); +} diff --git a/AudioManagerDaemon/RoutingReceive.h b/AudioManagerDaemon/RoutingReceive.h new file mode 100644 index 0000000..81e9213 --- /dev/null +++ b/AudioManagerDaemon/RoutingReceive.h @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file RoutingReceive.h + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 DEAMONACTIONS_H_ +#define DEAMONACTIONS_H_ + +#include "audioManagerIncludes.h" + +class DataBaseHandler; + +/**implementation of the interface + * + */ +class RoutingReceiver: public QObject, public RoutingReceiveInterface { +Q_OBJECT +public: + void register_Databasehandler(DataBaseHandler* handler_); //is used to register the Database handler + + int registerDomain(char* name, char* busname, char* node, bool earlymode); + int registerGateway(char* name, char* sink, char* source, + char *domainSource, char* domainSink, char* controlDomain); + int registerSink(char* name, char* sinkclass, char* domain); + int registerSource(char* name, char* audioclass, char* domain); + int peekDomain(char* name); + void ackConnect(genHandle_t handle, genError_t error); + +signals: + void signal_ackConnect(genHandle_t handle, genError_t error); + +private: + DataBaseHandler* handler; +}; + +#endif /* DEAMONACTIONS_H_ */ diff --git a/AudioManagerDaemon/audioManagerIncludes.h b/AudioManagerDaemon/audioManagerIncludes.h new file mode 100644 index 0000000..f5aeeef --- /dev/null +++ b/AudioManagerDaemon/audioManagerIncludes.h @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file audioManagerIncludes.h + * include this file to have all the basic headers used by the AudioManager included + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 AUDIOMANAGERINCLUDES_H_ +#define AUDIOMANAGERINCLUDES_H_ + +#include "dlt/dlt.h" +#include "dataTypes.h" +#include "routinginterface.h" +#include "DataBaseHandler.h" +#include "RoutingReceive.h" +#include "Router.h" +#include "DBusTypes.h" +#include "HookEngine.h" +#include "AudioManagerCore.h" +#include "DBusCommandInterface.h" + +DLT_IMPORT_CONTEXT(AudioManager) + +#endif /* AUDIOMANAGERINCLUDES_H_ */ diff --git a/AudioManagerDaemon/dataTypes.h b/AudioManagerDaemon/dataTypes.h new file mode 100644 index 0000000..2f17637 --- /dev/null +++ b/AudioManagerDaemon/dataTypes.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2011, BMW AG + * + * AudioManagerDeamon + * + * @file dataTypes.h + * + * @date: 20.05.2011 + * @author: Christian Müller (christian.ei.mueller@bmw.de) + * + */ + +#ifndef DATATYPES_H_ +#define DATATYPES_H_ + +#include <qlist.h> + +typedef int source_t; +typedef int sink_t; +typedef int domain_t; +typedef int gateway_t; +typedef int connection_t; +typedef int interrupt_t; +typedef int volume_t; +typedef int genHandle_t; +typedef int genInt_t; +typedef int hookprio_t; +typedef int sourceClass_t; +typedef int sinkClass_t; + +/**Global defined error Type + * + */ +typedef enum genError { + GEN_OK, //!< GEN_OK + GEN_UNKNOWN, //!< GEN_UNKNOWN + GEN_OUTOFRANGE, //!< GEN_OUTOFRANGE + GEN_NOTUSED, //!< GEN_NOTUSED + GEN_DATABASE_ERROR +//!< GEN_DATABASE_ERROR +} genError_t; + +/** the resulttype for the hooks + * + */ +typedef enum genHookResult { + HOOK_OK, //!< HOOK_OK + HOOK_STOP,//!< HOOK_STOP + HOOK_UNUSED +//!< HOOK_UNUSED +} genHookResult_t; + +/** This represents one "hopp" in the route + * TODO: change from public structs into own public classes + */ +struct genRoutingElement_t { + source_t source; + sink_t sink; + domain_t Domain_ID; +}; + +/**This is a container for a complete route. + * A List of "hopps" and a length. + */ +class genRoute_t { +public: + int len; + source_t Source_ID; + sink_t Sink_ID; + QList<genRoutingElement_t> route; +}; + +/**This class describes the interrupt Type. + * \var ID the ID of the Interrupt (unique) + * \var connID the Connection ID that is used + * \var sourceI the SourceID of the Interrupt + * \var sinkID the sinkID of the interrupt + * \var mixed true if interrupt is mixed into current audio + * \var listInterruptSources the list of the interrupted sources. + */ +class interruptType_t { +public: + genInt_t ID; + connection_t connID; + source_t sourceID; + sink_t SinkID; + bool mixed; + QList<source_t> listInterrruptedSources; +}; + +#endif /* DATATYPES_H_ */ diff --git a/AudioManagerDaemon/main.cpp b/AudioManagerDaemon/main.cpp new file mode 100644 index 0000000..a31c2db --- /dev/null +++ b/AudioManagerDaemon/main.cpp @@ -0,0 +1,103 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file main.cpp + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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. + * + * + */ +/** + * \file The main file of the AudioManager + */ +#include <QtCore> +#include <QCoreApplication> +#include "audioManagerIncludes.h" +/** + * \todo: write some documentation about Plugin mechanism + * + */ +//put here all plugins you want to use with the Routing Interface +Q_IMPORT_PLUGIN(RoutingPlugin) +Q_IMPORT_PLUGIN(RoutingJackPlugin) +//put here all plugins that you want to use with the hooks. No more modification needed (besides adoption of the CMakeList) ! +Q_IMPORT_PLUGIN(TestPlugin) +DLT_DECLARE_CONTEXT(AudioManager) +; + +int main(int argc, char *argv[]) { + QCoreApplication a(argc, argv); + + //of course, we need some logging :-) + DLT_REGISTER_APP("AudioManagerDeamon","AudioManagerDeamon"); + DLT_REGISTER_CONTEXT(AudioManager,"Main","Main Context"); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("The AudioManager is started ")); + + //add library path + a.addLibraryPath("../plugins"); + + //Here are our Main Classes + DataBaseHandler dhandler; + RoutingReceiver breceiver; + Bushandler bushandler; + Router router; + HookHandler hookhandler; + AudioManagerCore core; + DBusCommandInterface commandIface; + + //meet and greet: register all the classes @ each other + hookhandler.registerAudioManagerCore(&core); + core.registerBushandler(&bushandler); + core.registerDatabasehandler(&dhandler); + core.registerRouter(&router); + core.registerHookEngine(&hookhandler); + core.registerReceiver(&breceiver); + core.registerCommandInterface(&commandIface); + router.registerDatabasehandler(&dhandler); + //commandIface.registerDatabasehandler(&dhandler); + + commandIface.registerAudioManagerCore(&core); + breceiver.register_Databasehandler(&dhandler); + bushandler.registerReceiver(&breceiver); + + /** + * \todo: we do not have to knock down the database whole the time - this can be done different + */DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("create tables for database")); + dhandler.create_tables(); + + /** + * \todo replace this static implementation with an XML file that is parsed + */ + dhandler.insert_into_Source_Class_table("default", 10, false, false); + dhandler.insert_into_Source_Class_table("nav", 10, true, true); + dhandler.insert_into_Source_Class_table("ta", 10, true, false); + dhandler.insert_into_Source_Class_table("rad", 10, false, false); + dhandler.insert_into_Sink_Class_table("default"); + + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("load hook plugins")); + hookhandler.loadHookPlugins(); + + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("load bus plugins")); + bushandler.load_Bus_plugins(); + bushandler.StartupInterfaces(); + commandIface.startupInterface(); + DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Init phase is over, everything up and running")); + + return a.exec(); +} + diff --git a/AudioManagerDaemon/mainpage.h b/AudioManagerDaemon/mainpage.h new file mode 100644 index 0000000..8a94c2c --- /dev/null +++ b/AudioManagerDaemon/mainpage.h @@ -0,0 +1,34 @@ +/** + * \mainpage + * \image html "Bild1.png" + * Copyright Copyright (C) 2011, BMW AG + * + * \date 22.06.2011 + * \author Christian Müller (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 Müller 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. + * + * \section About About AudioManager + * The AudioManager is a Deamon that manages all Audio Connections in a GENIVI headunit. + * It is a managing instance that uses so called RoutingAdaptors to control AudioDomains that then do the "real" connections. + * + * \section Info More information + * can be found at <https://collab.genivi.org/wiki/display/genivi/GENIVI+Home> + * + * \todo enhance Interface + */ + +#ifndef MAINPAGE_H_ +#define MAINPAGE_H_ + +#endif /* MAINPAGE_H_ */ diff --git a/AudioManagerDaemon/routinginterface.h b/AudioManagerDaemon/routinginterface.h new file mode 100644 index 0000000..d8a063e --- /dev/null +++ b/AudioManagerDaemon/routinginterface.h @@ -0,0 +1,197 @@ +/** + * Copyright (C) 2011, BMW AG + * + * AudioManangerDeamon + * + * \file routinginterface.h + * + * \date 20.05.2011 + * \author Christian Müller (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 Müller 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 ROUTINGINTERFACE_H_ +#define ROUTINGINTERFACE_H_ + +#include <QObject> +#include "dataTypes.h" + +class RoutingSendInterface; + +/** Routing Receive sendInterface description. + * This class implements everything from RoutingAdapter -> Audiomanager + */ +class RoutingReceiveInterface { +public: + /** destructor*/ + virtual ~RoutingReceiveInterface() { + } + + /** Registers a Domain at the Audiomanager. + * \return a unique ID of the domain */ + virtual domain_t registerDomain(char* name, /**< the name of the domain. Must be unique in the system*/ + char* busname, /**< the name of the bus that is used laster to talk to the domain*/ + char* node, /**< the nonde of the bus*/ + bool earlymode /**< true if the domain is in earlymode*/ + )=0; + + /** Registers a Gateway at the Audiomanager + * \return a unique ID of the gateway */ + virtual gateway_t registerGateway(char* name, /**< the name of the gateway. Should be unique in the system*/ + char* sink, /**< the name of the sink (on the emitting side)*/ + char* source, /**< the name of the source (on the receiving side)*/ + char *domainSource, /**< the domain of the source*/ + char* domainSink, /**< the domain of the sink*/ + char* controlDomain /**< the controlling domain*/ + )=0; + + /** registers a Sink at the Audiomanager + * \return a unique ID of the sink.*/ + virtual sink_t registerSink(char* name, /**< the name of the sink to be registered. Sink names must be unique within a Domain*/ + char* sinkclass, /**< the name of the class. Must be valid otherwise registration fails*/ + char* domain /**< the domain name of the sink*/ + )=0; + + /** registers a Source at the Audiomanager * + * \return unique ID of the source */ + virtual source_t registerSource(char* name, /**< the name of the source to be registered. Source names must be unique wihin the Domain*/ + char* audioclass, /**< the name of the class. If not existend, default will be used.*/ + char* domain /**< the domain of the sink*/ + )=0; + + /** just get the ID of a domain without registering it. This is used to register Gateways. + * During the time of registration it is unclear if the other Domain already exists. This function will either + * return the already existing ID or reserve an ID with is then used later when the domain is registered. * + * \return the unique Id of the domain. */ + virtual domain_t peekDomain(char* name /**< the name of the domain*/ + )=0; + + /**Acknowledgement of a connect. This function shall be called when a connect event is finished + * + * @param handle the the handle for the connection + * @param error reads GEN_OK on success, other errors in case of problems + */ + virtual void ackConnect(genHandle_t handle, genError_t error)=0; + +}; + +/** Routing Send sendInterface + * This class implements everything from Audiomanager -> RoutingAdapter + */ +class RoutingSendInterface: public QObject { +public: + /** destructor*/ + virtual ~RoutingSendInterface() { + } + + /** starts up the interface. In the implementations, here is the best place for + * init routines. + */ + virtual void startup_interface(RoutingReceiveInterface * action /**< hands over the handle to the receive object. */ + )=0; + + /** connect a source to a sink + * \return the unique ID of the connection. + */ + virtual connection_t connect(source_t source, /**< the ID of the source*/ + sink_t sink, /**< the ID of the sink*/ + connection_t con_ID /**< the ID of the connection*/ + )=0; + + /** disconnect a connection + * \return true on success + */ + virtual bool disconnect(connection_t connection_ID /**< the ID of the connection*/ + )=0; + + /** this method is used to retrieve the busname during startup of the plugin. + * Needs to be implemented + */ + virtual void return_BusName(char* BusName /**< pointer to the Busname that needs to be returned*/ + )=0; + + /** this method is used to set the volume of a sink + * \return returns the new value or -1 on error or impossible. + * It is not mandatory that a Plugin implements this feature. + */ + virtual volume_t setSinkVolume(volume_t volume, /**< new volume */ + sink_t sinkID /**< sinkID to change */ + )=0; + + /** this method is used to set the volume of a source + * \return returns the new value or -1 on error or impossible. + * It is not mandatory that a Plugin implements this feature. + */ + virtual volume_t setSourceVolume(volume_t volume, /**< new volume */ + source_t sourceID /**< sourceID to change */ + )=0; + + /** this method is used to mute a source + * + * \return true if succeeded + * \todo add error codes to answers + */ + virtual bool muteSource(source_t sourceID /**< SourceID to be muted */ + )=0; + + /** this method is used to mute a sink + * + * \return true if succeeded + * \todo add error codes to answers + */ + virtual bool muteSink(sink_t sinkID /**< SinkID to be muted */ + )=0; + + /** this method is used to unmute a source + * + * \return true if succeeded + * \todo add error codes to answers + */ + virtual bool unmuteSource(source_t sourceID /**< SourceID to be unmuted */ + )=0; + + /** this method is used to unmute a sink + * + * \return true if succeeded + * \todo add error codes to answers + */ + virtual bool unmuteSink(sink_t sinkID /**< SinkID to be unmuted */ + )=0; + +public slots: + /** signal that tells the plugin that the system is ready. Is used to trigger a registration of Domains, etc..*/ + void slot_system_ready(); +}; + +/** Routing sendInterface Factory. + * This is used for the Qt Plugin mechanism. The factory creates and returns a pointer to the + * RoutingSendInterface. + */ +class RoutingInterfaceFactory { +public: + virtual ~RoutingInterfaceFactory() { + } + + /** returns an Instance of RoutingSendInterface. + * \return pointer to the instance. + */ + virtual RoutingSendInterface* returnInstance()=0; +}; + +Q_DECLARE_INTERFACE(RoutingInterfaceFactory,"RoutingInterfaceFactory/1.0") +; + +#endif /* ROUTINGINTERFACE_H_ */ |