summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/src
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-03-05 22:49:12 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-03-05 22:49:12 +0100
commit8ced1dced5ae1fbc7356ec65c03e6e8201216155 (patch)
treeb4b19aac085948040d775e284455a0041b17e022 /AudioManagerDaemon/src
parent1b85f2410d1d644ff00284e78b1eeff6cfad2fc4 (diff)
downloadaudiomanager-8ced1dced5ae1fbc7356ec65c03e6e8201216155.tar.gz
* updated license headers
* updated documentation
Diffstat (limited to 'AudioManagerDaemon/src')
-rw-r--r--AudioManagerDaemon/src/CAmCommandReceiver.cpp78
-rw-r--r--AudioManagerDaemon/src/CAmCommandSender.cpp44
-rw-r--r--AudioManagerDaemon/src/CAmControlReceiver.cpp190
-rw-r--r--AudioManagerDaemon/src/CAmControlSender.cpp81
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandler.cpp1302
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseObserver.cpp28
-rw-r--r--AudioManagerDaemon/src/CAmDbusWrapper.cpp90
-rw-r--r--AudioManagerDaemon/src/CAmDltWrapper.cpp32
-rw-r--r--AudioManagerDaemon/src/CAmRouter.cpp76
-rw-r--r--AudioManagerDaemon/src/CAmRoutingReceiver.cpp207
-rw-r--r--AudioManagerDaemon/src/CAmRoutingSender.cpp189
-rw-r--r--AudioManagerDaemon/src/CAmSocketHandler.cpp99
-rw-r--r--AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp27
-rw-r--r--AudioManagerDaemon/src/CAmTelnetServer.cpp288
-rw-r--r--AudioManagerDaemon/src/main.cpp87
15 files changed, 1478 insertions, 1340 deletions
diff --git a/AudioManagerDaemon/src/CAmCommandReceiver.cpp b/AudioManagerDaemon/src/CAmCommandReceiver.cpp
index c6f760c..95554bd 100644
--- a/AudioManagerDaemon/src/CAmCommandReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmCommandReceiver.cpp
@@ -1,34 +1,32 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CommandReveiver.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
*
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ *
+ * \file CAmCommandReceiver.cpp
+ * For further information see http://www.genivi.org/.
*
*/
#include "CAmCommandReceiver.h"
+#include <cassert>
+#include <algorithm>
#include "CAmDatabaseHandler.h"
#include "CAmControlSender.h"
#include "shared/CAmDltWrapper.h"
-#include <shared/CAmSocketHandler.h>
-#include <cassert>
-#include <algorithm>
+#include "shared/CAmSocketHandler.h"
namespace am
{
@@ -71,111 +69,111 @@ CAmCommandReceiver::~CAmCommandReceiver()
am_Error_e CAmCommandReceiver::connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
logInfo("CommandReceiver::connect got called, sourceID=", sourceID, "sinkID=", sinkID);
- return mControlSender->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID);
+ return (mControlSender->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID));
}
am_Error_e CAmCommandReceiver::disconnect(const am_mainConnectionID_t mainConnectionID)
{
logInfo("CommandReceiver::disconnect got called, mainConnectionID=", mainConnectionID);
- return mControlSender->hookUserDisconnectionRequest(mainConnectionID);
+ return (mControlSender->hookUserDisconnectionRequest(mainConnectionID));
}
am_Error_e CAmCommandReceiver::setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
logInfo("CommandReceiver::setVolume got called, sinkID=", sinkID, "volume=", volume);
- return mControlSender->hookUserVolumeChange(sinkID, volume);
+ return (mControlSender->hookUserVolumeChange(sinkID, volume));
}
am_Error_e CAmCommandReceiver::volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep)
{
logInfo("CommandReceiver::volumeStep got called, sinkID=", sinkID, "volumeStep=", volumeStep);
- return mControlSender->hookUserVolumeStep(sinkID, volumeStep);
+ return (mControlSender->hookUserVolumeStep(sinkID, volumeStep));
}
am_Error_e CAmCommandReceiver::setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
logInfo("CommandReceiver::setSinkMuteState got called, sinkID=", sinkID, "muteState=", muteState);
- return mControlSender->hookUserSetSinkMuteState(sinkID, muteState);
+ return (mControlSender->hookUserSetSinkMuteState(sinkID, muteState));
}
am_Error_e CAmCommandReceiver::setMainSinkSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
logInfo("CommandReceiver::setMainSinkSoundProperty got called, sinkID=", sinkID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
- return mControlSender->hookUserSetMainSinkSoundProperty(sinkID, soundProperty);
+ return (mControlSender->hookUserSetMainSinkSoundProperty(sinkID, soundProperty));
}
am_Error_e CAmCommandReceiver::setMainSourceSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
logInfo("CommandReceiver::setMainSourceSoundProperty got called, sourceID=", sourceID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
- return mControlSender->hookUserSetMainSourceSoundProperty(sourceID, soundProperty);
+ return (mControlSender->hookUserSetMainSourceSoundProperty(sourceID, soundProperty));
}
am_Error_e CAmCommandReceiver::setSystemProperty(const am_SystemProperty_s & property)
{
logInfo("CommandReceiver::setSystemProperty got called", "type=", property.type, "soundPropertyValue=", property.value);
- return mControlSender->hookUserSetSystemProperty(property);
+ return (mControlSender->hookUserSetSystemProperty(property));
}
am_Error_e CAmCommandReceiver::getListMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
- return mDatabaseHandler->getListVisibleMainConnections(listConnections);
+ return (mDatabaseHandler->getListVisibleMainConnections(listConnections));
}
am_Error_e CAmCommandReceiver::getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const
{
- return mDatabaseHandler->getListMainSinks(listMainSinks);
+ return (mDatabaseHandler->getListMainSinks(listMainSinks));
}
am_Error_e CAmCommandReceiver::getListMainSources(std::vector<am_SourceType_s>& listMainSources) const
{
- return mDatabaseHandler->getListMainSources(listMainSources);
+ return (mDatabaseHandler->getListMainSources(listMainSources));
}
am_Error_e CAmCommandReceiver::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
{
- return mDatabaseHandler->getListMainSinkSoundProperties(sinkID, listSoundProperties);
+ return (mDatabaseHandler->getListMainSinkSoundProperties(sinkID, listSoundProperties));
}
am_Error_e CAmCommandReceiver::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
{
- return mDatabaseHandler->getListMainSourceSoundProperties(sourceID, listSourceProperties);
+ return (mDatabaseHandler->getListMainSourceSoundProperties(sourceID, listSourceProperties));
}
am_Error_e CAmCommandReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
- return mDatabaseHandler->getListSourceClasses(listSourceClasses);
+ return (mDatabaseHandler->getListSourceClasses(listSourceClasses));
}
am_Error_e CAmCommandReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
- return mDatabaseHandler->getListSinkClasses(listSinkClasses);
+ return (mDatabaseHandler->getListSinkClasses(listSinkClasses));
}
am_Error_e CAmCommandReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
- return mDatabaseHandler->getListSystemProperties(listSystemProperties);
+ return (mDatabaseHandler->getListSystemProperties(listSystemProperties));
}
am_Error_e CAmCommandReceiver::getTimingInformation(const am_mainConnectionID_t mainConnectionID, am_timeSync_t & delay) const
{
- return mDatabaseHandler->getTimingInformation(mainConnectionID, delay);
+ return (mDatabaseHandler->getTimingInformation(mainConnectionID, delay));
}
am_Error_e CAmCommandReceiver::getDBusConnectionWrapper(CAmDbusWrapper*& dbusConnectionWrapper) const
{
#ifdef WITH_DBUS_WRAPPER
dbusConnectionWrapper = mDBusWrapper;
- return E_OK;
+ return (E_OK);
#else
- return E_UNKNOWN;
+ return (E_UNKNOWN);
#endif /*WITH_DBUS_WRAPPER*/
}
am_Error_e CAmCommandReceiver::getSocketHandler(CAmSocketHandler *& socketHandler) const
{
socketHandler = mSocketHandler;
- return E_OK;
+ return (E_OK);
}
void CAmCommandReceiver::getInterfaceVersion(std::string & version) const
@@ -201,14 +199,14 @@ uint16_t CAmCommandReceiver::getStartupHandle()
{
uint16_t handle = ++handleCount; //todo: handle overflow
mListStartupHandles.push_back(handle);
- return handle;
+ return (handle);
}
uint16_t CAmCommandReceiver::getRundownHandle()
{
uint16_t handle = ++handleCount; //todo: handle overflow
mListRundownHandles.push_back(handle);
- return handle;
+ return (handle);
}
void CAmCommandReceiver::waitOnStartup(bool startup)
diff --git a/AudioManagerDaemon/src/CAmCommandSender.cpp b/AudioManagerDaemon/src/CAmCommandSender.cpp
index 0ada15c..d16485f 100644
--- a/AudioManagerDaemon/src/CAmCommandSender.cpp
+++ b/AudioManagerDaemon/src/CAmCommandSender.cpp
@@ -1,24 +1,22 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmCommandSender.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * 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 CAmCommandSender.cpp
+ * For further information see http://www.genivi.org/.
*
*/
@@ -33,13 +31,15 @@
namespace am
{
-#define REQUIRED_INTERFACE_VERSION_MAJOR 1
-#define REQUIRED_INTERFACE_VERSION_MINOR 0
+#define REQUIRED_INTERFACE_VERSION_MAJOR 1 //!< major interface version. All versions smaller than this will be rejected
+#define REQUIRED_INTERFACE_VERSION_MINOR 0 //!< minor interface version. All versions smaller than this will be rejected
-//!< macro to call all interfaces
+/**
+ * macro to call all interfaces
+ */
#define CALL_ALL_INTERFACES(...) \
- std::vector<IAmCommandSend*>::iterator iter = mListInterfaces.begin(); \
- std::vector<IAmCommandSend*>::iterator iterEnd = mListInterfaces.end(); \
+ std::vector<IAmCommandSend*>::iterator iter = mListInterfaces.begin(); \
+ std::vector<IAmCommandSend*>::iterator iterEnd = mListInterfaces.end(); \
for (; iter<iterEnd;++iter) \
{ \
(*iter)->__VA_ARGS__; \
@@ -151,7 +151,7 @@ am_Error_e CAmCommandSender::startupInterfaces(CAmCommandReceiver *iCommandRecei
returnError = error;
}
}
- return returnError;
+ return (returnError);
}
void CAmCommandSender::cbNumberOfSinkClassesChanged()
@@ -271,7 +271,7 @@ void CAmCommandSender::getInterfaceVersion(std::string & version) const
am_Error_e am::CAmCommandSender::getListPlugins(std::vector<std::string> & interfaces) const
{
interfaces = mListLibraryNames;
- return E_OK;
+ return (E_OK);
}
void CAmCommandSender::unloadLibraries(void)
diff --git a/AudioManagerDaemon/src/CAmControlReceiver.cpp b/AudioManagerDaemon/src/CAmControlReceiver.cpp
index 6d68089..3d64226 100644
--- a/AudioManagerDaemon/src/CAmControlReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmControlReceiver.cpp
@@ -1,36 +1,34 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmControlReceiver.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * 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 CAmControlReceiver.cpp
+ * For further information see http://www.genivi.org/.
*
*/
-#include <config.h>
-#include <shared/CAmSocketHandler.h>
#include "CAmControlReceiver.h"
+#include <cassert>
+#include "config.h"
#include "CAmDatabaseHandler.h"
#include "CAmRoutingSender.h"
#include "CAmCommandSender.h"
#include "CAmRouter.h"
#include "shared/CAmDltWrapper.h"
-#include <cassert>
+#include "shared/CAmSocketHandler.h"
namespace am {
@@ -54,7 +52,7 @@ CAmControlReceiver::~CAmControlReceiver()
am_Error_e CAmControlReceiver::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
{
- return mRouter->getRoute(onlyfree, sourceID, sinkID, returnList);
+ return (mRouter->getRoute(onlyfree, sourceID, sinkID, returnList));
}
am_Error_e CAmControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & connectionID, const am_ConnectionFormat_e format, const am_sourceID_t sourceID, const am_sinkID_t sinkID)
@@ -69,10 +67,10 @@ am_Error_e CAmControlReceiver::connect(am_Handle_s & handle, am_connectionID_t &
//todo: enter function to find out what happends if the same connection is in the course of being build up.
if (mDatabaseHandler->existConnection(tempConnection))
- return E_ALREADY_EXISTS; //todo:enter the correct connectionID here?
+ return (E_ALREADY_EXISTS); //todo:enter the correct connectionID here?
mDatabaseHandler->enterConnectionDB(tempConnection, connectionID);
- return mRoutingSender->asyncConnect(handle, connectionID, sourceID, sinkID, format);
+ return (mRoutingSender->asyncConnect(handle, connectionID, sourceID, sinkID, format));
}
am_Error_e CAmControlReceiver::disconnect(am_Handle_s & handle, const am_connectionID_t connectionID)
@@ -80,8 +78,8 @@ am_Error_e CAmControlReceiver::disconnect(am_Handle_s & handle, const am_connect
logInfo("CAmControlReceiver::disconnect got called, connectionID=", connectionID);
if (!mDatabaseHandler->existConnectionID(connectionID))
- return E_NON_EXISTENT; //todo: check with EA model and correct
- return mRoutingSender->asyncDisconnect(handle, connectionID);
+ return (E_NON_EXISTENT); //todo: check with EA model and correct
+ return (mRoutingSender->asyncDisconnect(handle, connectionID));
}
am_Error_e CAmControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime)
@@ -89,8 +87,8 @@ am_Error_e CAmControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_
logInfo("CAmControlReceiver::crossfade got called, hotSource=", hotSource, "crossfaderID=", crossfaderID, "rampType=", rampType, "rampTime=", rampTime);
if (!mDatabaseHandler->existcrossFader(crossfaderID))
- return E_NON_EXISTENT;
- return mRoutingSender->asyncCrossFade(handle, crossfaderID, hotSource, rampType, rampTime);
+ return (E_NON_EXISTENT);
+ return (mRoutingSender->asyncCrossFade(handle, crossfaderID, hotSource, rampType, rampTime));
}
am_Error_e CAmControlReceiver::setSourceState(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SourceState_e state)
@@ -99,10 +97,10 @@ am_Error_e CAmControlReceiver::setSourceState(am_Handle_s & handle, const am_sou
am_SourceState_e sourceState;
if (mDatabaseHandler->getSoureState(sourceID, sourceState) != E_OK)
- return E_UNKNOWN;
+ return (E_UNKNOWN);
if (sourceState == state)
- return E_NO_CHANGE;
- return mRoutingSender->asyncSetSourceState(handle, sourceID, state);
+ return (E_NO_CHANGE);
+ return (mRoutingSender->asyncSetSourceState(handle, sourceID, state));
}
am_Error_e CAmControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
@@ -111,10 +109,10 @@ am_Error_e CAmControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sink
am_volume_t tempVolume;
if (mDatabaseHandler->getSinkVolume(sinkID, tempVolume) != E_OK)
- return E_UNKNOWN;
+ return (E_UNKNOWN);
if (tempVolume == volume)
- return E_NO_CHANGE;
- return mRoutingSender->asyncSetSinkVolume(handle, sinkID, volume, ramp, time);
+ return (E_NO_CHANGE);
+ return (mRoutingSender->asyncSetSinkVolume(handle, sinkID, volume, ramp, time));
}
am_Error_e CAmControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e rampType, const am_time_t time)
@@ -123,10 +121,10 @@ am_Error_e CAmControlReceiver::setSourceVolume(am_Handle_s & handle, const am_so
am_volume_t tempVolume;
if (mDatabaseHandler->getSourceVolume(sourceID, tempVolume) != E_OK)
- return E_UNKNOWN;
+ return (E_UNKNOWN);
if (tempVolume == volume)
- return E_NO_CHANGE;
- return mRoutingSender->asyncSetSourceVolume(handle, sourceID, volume, rampType, time);
+ return (E_NO_CHANGE);
+ return (mRoutingSender->asyncSetSourceVolume(handle, sourceID, volume, rampType, time));
}
am_Error_e CAmControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
@@ -135,10 +133,10 @@ am_Error_e CAmControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const
uint16_t value;
if (mDatabaseHandler->getSinkSoundPropertyValue(sinkID, soundProperty.type, value) != E_OK)
- return E_UNKNOWN;
+ return (E_UNKNOWN);
if (value == soundProperty.value)
- return E_NO_CHANGE;
- return mRoutingSender->asyncSetSinkSoundProperty(handle, sinkID, soundProperty);
+ return (E_NO_CHANGE);
+ return (mRoutingSender->asyncSetSinkSoundProperty(handle, sinkID, soundProperty));
}
am_Error_e CAmControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
@@ -166,10 +164,10 @@ am_Error_e CAmControlReceiver::setSourceSoundProperty(am_Handle_s & handle, cons
uint16_t value;
if (mDatabaseHandler->getSourceSoundPropertyValue(sourceID, soundProperty.type, value) != E_OK)
- return E_UNKNOWN;
+ return (E_UNKNOWN);
if (value == soundProperty.value)
- return E_NO_CHANGE;
- return mRoutingSender->asyncSetSourceSoundProperty(handle, sourceID, soundProperty);
+ return (E_NO_CHANGE);
+ return (mRoutingSender->asyncSetSourceSoundProperty(handle, sourceID, soundProperty));
}
am_Error_e CAmControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
@@ -197,272 +195,272 @@ am_Error_e CAmControlReceiver::setDomainState(const am_domainID_t domainID, cons
am_DomainState_e tempState = DS_UNKNOWN;
if (mDatabaseHandler->getDomainState(domainID, tempState) != E_OK)
- return E_UNKNOWN;
+ return (E_UNKNOWN);
if (tempState == domainState)
- return E_NO_CHANGE;
- return mRoutingSender->setDomainState(domainID, domainState);
+ return (E_NO_CHANGE);
+ return (mRoutingSender->setDomainState(domainID, domainState));
}
am_Error_e CAmControlReceiver::abortAction(const am_Handle_s handle)
{
logInfo("CAmControlReceiver::abortAction got called, handle.type=", handle.handle, "handle.handleType=", handle.handleType);
- return mRoutingSender->asyncAbort(handle);
+ return (mRoutingSender->asyncAbort(handle));
}
am_Error_e CAmControlReceiver::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- return mDatabaseHandler->enterDomainDB(domainData, domainID);
+ return (mDatabaseHandler->enterDomainDB(domainData, domainID));
}
am_Error_e CAmControlReceiver::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
{
- return mDatabaseHandler->enterMainConnectionDB(mainConnectionData, connectionID);
+ return (mDatabaseHandler->enterMainConnectionDB(mainConnectionData, connectionID));
}
am_Error_e CAmControlReceiver::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- return mDatabaseHandler->enterSinkDB(sinkData, sinkID);
+ return (mDatabaseHandler->enterSinkDB(sinkData, sinkID));
}
am_Error_e CAmControlReceiver::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- return mDatabaseHandler->enterCrossfaderDB(crossfaderData, crossfaderID);
+ return (mDatabaseHandler->enterCrossfaderDB(crossfaderData, crossfaderID));
}
am_Error_e CAmControlReceiver::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- return mDatabaseHandler->enterGatewayDB(gatewayData, gatewayID);
+ return (mDatabaseHandler->enterGatewayDB(gatewayData, gatewayID));
}
am_Error_e CAmControlReceiver::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- return mDatabaseHandler->enterSourceDB(sourceData, sourceID);
+ return (mDatabaseHandler->enterSourceDB(sourceData, sourceID));
}
am_Error_e CAmControlReceiver::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
{
- return mDatabaseHandler->enterSinkClassDB(sinkClass, sinkClassID);
+ return (mDatabaseHandler->enterSinkClassDB(sinkClass, sinkClassID));
}
am_Error_e CAmControlReceiver::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
{
- return mDatabaseHandler->enterSourceClassDB(sourceClassID, sourceClass);
+ return (mDatabaseHandler->enterSourceClassDB(sourceClassID, sourceClass));
}
am_Error_e CAmControlReceiver::enterSystemPropertiesListDB(const std::vector<am_SystemProperty_s> & listSystemProperties)
{
- return mDatabaseHandler->enterSystemProperties(listSystemProperties);
+ return (mDatabaseHandler->enterSystemProperties(listSystemProperties));
}
am_Error_e CAmControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
{
- return mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, listConnectionID);
+ return (mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, listConnectionID));
}
am_Error_e CAmControlReceiver::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
{
- return mDatabaseHandler->changeMainConnectionStateDB(mainconnectionID, connectionState);
+ return (mDatabaseHandler->changeMainConnectionStateDB(mainconnectionID, connectionState));
}
am_Error_e CAmControlReceiver::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
{
- return mDatabaseHandler->changeSinkMainVolumeDB(mainVolume, sinkID);
+ return (mDatabaseHandler->changeSinkMainVolumeDB(mainVolume, sinkID));
}
am_Error_e CAmControlReceiver::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
{
- return mDatabaseHandler->changeSinkAvailabilityDB(availability, sinkID);
+ return (mDatabaseHandler->changeSinkAvailabilityDB(availability, sinkID));
}
am_Error_e CAmControlReceiver::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
{
- return mDatabaseHandler->changDomainStateDB(domainState, domainID);
+ return (mDatabaseHandler->changDomainStateDB(domainState, domainID));
}
am_Error_e CAmControlReceiver::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
{
- return mDatabaseHandler->changeSinkMuteStateDB(muteState, sinkID);
+ return (mDatabaseHandler->changeSinkMuteStateDB(muteState, sinkID));
}
am_Error_e CAmControlReceiver::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
- return mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sinkID);
+ return (mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sinkID));
}
am_Error_e CAmControlReceiver::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
- return mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sourceID);
+ return (mDatabaseHandler->changeMainSinkSoundPropertyDB(soundProperty, sourceID));
}
am_Error_e CAmControlReceiver::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
{
- return mDatabaseHandler->changeSourceAvailabilityDB(availability, sourceID);
+ return (mDatabaseHandler->changeSourceAvailabilityDB(availability, sourceID));
}
am_Error_e CAmControlReceiver::changeSystemPropertyDB(const am_SystemProperty_s & property)
{
- return mDatabaseHandler->changeSystemPropertyDB(property);
+ return (mDatabaseHandler->changeSystemPropertyDB(property));
}
am_Error_e CAmControlReceiver::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
{
- return mDatabaseHandler->removeMainConnectionDB(mainConnectionID);
+ return (mDatabaseHandler->removeMainConnectionDB(mainConnectionID));
}
am_Error_e CAmControlReceiver::removeSinkDB(const am_sinkID_t sinkID)
{
- return mDatabaseHandler->removeSinkDB(sinkID);
+ return (mDatabaseHandler->removeSinkDB(sinkID));
}
am_Error_e CAmControlReceiver::removeSourceDB(const am_sourceID_t sourceID)
{
- return mDatabaseHandler->removeSourceDB(sourceID);
+ return (mDatabaseHandler->removeSourceDB(sourceID));
}
am_Error_e CAmControlReceiver::removeGatewayDB(const am_gatewayID_t gatewayID)
{
- return mDatabaseHandler->removeGatewayDB(gatewayID);
+ return (mDatabaseHandler->removeGatewayDB(gatewayID));
}
am_Error_e CAmControlReceiver::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
{
- return mDatabaseHandler->removeCrossfaderDB(crossfaderID);
+ return (mDatabaseHandler->removeCrossfaderDB(crossfaderID));
}
am_Error_e CAmControlReceiver::removeDomainDB(const am_domainID_t domainID)
{
- return mDatabaseHandler->removeDomainDB(domainID);
+ return (mDatabaseHandler->removeDomainDB(domainID));
}
am_Error_e CAmControlReceiver::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
{
- return mDatabaseHandler->getSourceClassInfoDB(sourceID, classInfo);
+ return (mDatabaseHandler->getSourceClassInfoDB(sourceID, classInfo));
}
am_Error_e CAmControlReceiver::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
{
- return mDatabaseHandler->getSinkClassInfoDB(sinkID, sinkClass);
+ return (mDatabaseHandler->getSinkClassInfoDB(sinkID, sinkClass));
}
am_Error_e CAmControlReceiver::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
{
- return mDatabaseHandler->getSinkInfoDB(sinkID, sinkData);
+ return (mDatabaseHandler->getSinkInfoDB(sinkID, sinkData));
}
am_Error_e CAmControlReceiver::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
{
- return mDatabaseHandler->getSourceInfoDB(sourceID, sourceData);
+ return (mDatabaseHandler->getSourceInfoDB(sourceID, sourceData));
}
am_Error_e CAmControlReceiver::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
{
- return mDatabaseHandler->getMainConnectionInfoDB(mainConnectionID, mainConnectionData);
+ return (mDatabaseHandler->getMainConnectionInfoDB(mainConnectionID, mainConnectionData));
}
am_Error_e CAmControlReceiver::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
{
- return mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData);
+ return (mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData));
}
am_Error_e CAmControlReceiver::getCrossfaderInfoDB(const am_crossfaderID_t crossfaderID, am_Crossfader_s & crossfaderData) const
{
- return mDatabaseHandler->getCrossfaderInfoDB(crossfaderID, crossfaderData);
+ return (mDatabaseHandler->getCrossfaderInfoDB(crossfaderID, crossfaderData));
}
am_Error_e CAmControlReceiver::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
{
- return mDatabaseHandler->getListSinksOfDomain(domainID, listSinkID);
+ return (mDatabaseHandler->getListSinksOfDomain(domainID, listSinkID));
}
am_Error_e CAmControlReceiver::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
{
- return mDatabaseHandler->getListSourcesOfDomain(domainID, listSourceID);
+ return (mDatabaseHandler->getListSourcesOfDomain(domainID, listSourceID));
}
am_Error_e CAmControlReceiver::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listGatewaysID) const
{
- return mDatabaseHandler->getListCrossfadersOfDomain(domainID, listGatewaysID);
+ return (mDatabaseHandler->getListCrossfadersOfDomain(domainID, listGatewaysID));
}
am_Error_e CAmControlReceiver::getListGatewaysOfDomain(const am_domainID_t domainID, std::vector<am_gatewayID_t> & listGatewaysID) const
{
- return mDatabaseHandler->getListGatewaysOfDomain(domainID, listGatewaysID);
+ return (mDatabaseHandler->getListGatewaysOfDomain(domainID, listGatewaysID));
}
am_Error_e CAmControlReceiver::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
- return mDatabaseHandler->getListMainConnections(listMainConnections);
+ return (mDatabaseHandler->getListMainConnections(listMainConnections));
}
am_Error_e CAmControlReceiver::getListDomains(std::vector<am_Domain_s> & listDomains) const
{
- return mDatabaseHandler->getListDomains(listDomains);
+ return (mDatabaseHandler->getListDomains(listDomains));
}
am_Error_e CAmControlReceiver::getListConnections(std::vector<am_Connection_s> & listConnections) const
{
- return mDatabaseHandler->getListConnections(listConnections);
+ return (mDatabaseHandler->getListConnections(listConnections));
}
am_Error_e CAmControlReceiver::getListSinks(std::vector<am_Sink_s> & listSinks) const
{
- return mDatabaseHandler->getListSinks(listSinks);
+ return (mDatabaseHandler->getListSinks(listSinks));
}
am_Error_e CAmControlReceiver::getListSources(std::vector<am_Source_s> & listSources) const
{
- return mDatabaseHandler->getListSources(listSources);
+ return (mDatabaseHandler->getListSources(listSources));
}
am_Error_e CAmControlReceiver::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
{
- return mDatabaseHandler->getListSourceClasses(listSourceClasses);
+ return (mDatabaseHandler->getListSourceClasses(listSourceClasses));
}
am_Error_e CAmControlReceiver::getListHandles(std::vector<am_Handle_s> & listHandles) const
{
- return mRoutingSender->getListHandles(listHandles);
+ return (mRoutingSender->getListHandles(listHandles));
}
am_Error_e CAmControlReceiver::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
{
- return mDatabaseHandler->getListCrossfaders(listCrossfaders);
+ return (mDatabaseHandler->getListCrossfaders(listCrossfaders));
}
am_Error_e CAmControlReceiver::getListGateways(std::vector<am_Gateway_s> & listGateways) const
{
- return mDatabaseHandler->getListGateways(listGateways);
+ return (mDatabaseHandler->getListGateways(listGateways));
}
am_Error_e CAmControlReceiver::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
{
- return mDatabaseHandler->getListSinkClasses(listSinkClasses);
+ return (mDatabaseHandler->getListSinkClasses(listSinkClasses));
}
am_Error_e CAmControlReceiver::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
{
- return mDatabaseHandler->getListSystemProperties(listSystemProperties);
+ return (mDatabaseHandler->getListSystemProperties(listSystemProperties));
}
am_Error_e CAmControlReceiver::changeSinkClassInfoDB(const am_SinkClass_s & classInfo)
{
- return mDatabaseHandler->changeSinkClassInfoDB(classInfo);
+ return (mDatabaseHandler->changeSinkClassInfoDB(classInfo));
}
am_Error_e CAmControlReceiver::changeSourceClassInfoDB(const am_SourceClass_s & classInfo)
{
- return mDatabaseHandler->changeSourceClassInfoDB(classInfo);
+ return(mDatabaseHandler->changeSourceClassInfoDB(classInfo));
}
am_Error_e CAmControlReceiver::removeSinkClassDB(const am_sinkClass_t sinkClassID)
{
- return mDatabaseHandler->removeSinkClassDB(sinkClassID);
+ return (mDatabaseHandler->removeSinkClassDB(sinkClassID));
}
am_Error_e CAmControlReceiver::removeSourceClassDB(const am_sourceClass_t sourceClassID)
{
- return mDatabaseHandler->removeSourceClassDB(sourceClassID);
+ return (mDatabaseHandler->removeSourceClassDB(sourceClassID));
}
void CAmControlReceiver::setCommandReady()
@@ -490,7 +488,7 @@ void CAmControlReceiver::confirmControllerRundown()
am_Error_e CAmControlReceiver::getSocketHandler(CAmSocketHandler *& socketHandler)
{
socketHandler = mSocketHandler;
- return E_OK;
+ return (E_OK);
}
void CAmControlReceiver::setCommandRundown()
diff --git a/AudioManagerDaemon/src/CAmControlSender.cpp b/AudioManagerDaemon/src/CAmControlSender.cpp
index cc26c90..39c29a7 100644
--- a/AudioManagerDaemon/src/CAmControlSender.cpp
+++ b/AudioManagerDaemon/src/CAmControlSender.cpp
@@ -1,40 +1,39 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmControlSender.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * 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 CAmControlSender.cpp
+ * For further information see http://www.genivi.org/.
*
*/
#include "CAmControlSender.h"
-#include "TAmPluginTemplate.h"
-#include "shared/CAmDltWrapper.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdexcept>
+#include "TAmPluginTemplate.h"
+#include "shared/CAmDltWrapper.h"
-namespace am {
+namespace am
+{
-#define REQUIRED_INTERFACE_VERSION_MAJOR 1
-#define REQUIRED_INTERFACE_VERSION_MINOR 0
+#define REQUIRED_INTERFACE_VERSION_MAJOR 1 //!< major interface version. All versions smaller than this will be rejected
+#define REQUIRED_INTERFACE_VERSION_MINOR 0 //!< minor interface version. All versions smaller than this will be rejected
CAmControlSender::CAmControlSender(std::string controlPluginFile) :
mlibHandle(NULL), //
@@ -79,97 +78,97 @@ CAmControlSender::~CAmControlSender()
am_Error_e CAmControlSender::hookUserConnectionRequest(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
- return mController->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID);
+ return (mController->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID));
}
am_Error_e CAmControlSender::hookUserDisconnectionRequest(const am_mainConnectionID_t connectionID)
{
- return mController->hookUserDisconnectionRequest(connectionID);
+ return (mController->hookUserDisconnectionRequest(connectionID));
}
am_Error_e CAmControlSender::hookUserSetMainSinkSoundProperty(const am_sinkID_t sinkID, const am_MainSoundProperty_s & soundProperty)
{
- return mController->hookUserSetMainSinkSoundProperty(sinkID, soundProperty);
+ return (mController->hookUserSetMainSinkSoundProperty(sinkID, soundProperty));
}
am_Error_e CAmControlSender::hookUserSetMainSourceSoundProperty(const am_sourceID_t sourceID, const am_MainSoundProperty_s & soundProperty)
{
- return mController->hookUserSetMainSourceSoundProperty(sourceID, soundProperty);
+ return (mController->hookUserSetMainSourceSoundProperty(sourceID, soundProperty));
}
am_Error_e CAmControlSender::hookUserSetSystemProperty(const am_SystemProperty_s & property)
{
- return mController->hookUserSetSystemProperty(property);
+ return (mController->hookUserSetSystemProperty(property));
}
am_Error_e CAmControlSender::hookUserVolumeChange(const am_sinkID_t sinkID, const am_mainVolume_t newVolume)
{
- return mController->hookUserVolumeChange(sinkID, newVolume);
+ return (mController->hookUserVolumeChange(sinkID, newVolume));
}
am_Error_e CAmControlSender::hookUserVolumeStep(const am_sinkID_t sinkID, const int16_t increment)
{
- return mController->hookUserVolumeStep(sinkID, increment);
+ return (mController->hookUserVolumeStep(sinkID, increment));
}
am_Error_e CAmControlSender::hookUserSetSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
- return mController->hookUserSetSinkMuteState(sinkID, muteState);
+ return (mController->hookUserSetSinkMuteState(sinkID, muteState));
}
am_Error_e CAmControlSender::hookSystemRegisterDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- return mController->hookSystemRegisterDomain(domainData, domainID);
+ return (mController->hookSystemRegisterDomain(domainData, domainID));
}
am_Error_e CAmControlSender::hookSystemDeregisterDomain(const am_domainID_t domainID)
{
- return mController->hookSystemDeregisterDomain(domainID);
+ return (mController->hookSystemDeregisterDomain(domainID));
}
void CAmControlSender::hookSystemDomainRegistrationComplete(const am_domainID_t domainID)
{
- return mController->hookSystemDomainRegistrationComplete(domainID);
+ return (mController->hookSystemDomainRegistrationComplete(domainID));
}
am_Error_e CAmControlSender::hookSystemRegisterSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- return mController->hookSystemRegisterSink(sinkData, sinkID);
+ return (mController->hookSystemRegisterSink(sinkData, sinkID));
}
am_Error_e CAmControlSender::hookSystemDeregisterSink(const am_sinkID_t sinkID)
{
- return mController->hookSystemDeregisterSink(sinkID);
+ return (mController->hookSystemDeregisterSink(sinkID));
}
am_Error_e CAmControlSender::hookSystemRegisterSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- return mController->hookSystemRegisterSource(sourceData, sourceID);
+ return (mController->hookSystemRegisterSource(sourceData, sourceID));
}
am_Error_e CAmControlSender::hookSystemDeregisterSource(const am_sourceID_t sourceID)
{
- return mController->hookSystemDeregisterSource(sourceID);
+ return (mController->hookSystemDeregisterSource(sourceID));
}
am_Error_e CAmControlSender::hookSystemRegisterGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- return mController->hookSystemRegisterGateway(gatewayData, gatewayID);
+ return (mController->hookSystemRegisterGateway(gatewayData, gatewayID));
}
am_Error_e CAmControlSender::hookSystemDeregisterGateway(const am_gatewayID_t gatewayID)
{
- return mController->hookSystemDeregisterGateway(gatewayID);
+ return (mController->hookSystemDeregisterGateway(gatewayID));
}
am_Error_e CAmControlSender::hookSystemRegisterCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- return mController->hookSystemRegisterCrossfader(crossfaderData, crossfaderID);
+ return (mController->hookSystemRegisterCrossfader(crossfaderData, crossfaderID));
}
am_Error_e CAmControlSender::hookSystemDeregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
- return mController->hookSystemDeregisterCrossfader(crossfaderID);
+ return (mController->hookSystemDeregisterCrossfader(crossfaderID));
}
void CAmControlSender::hookSystemSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
@@ -254,7 +253,7 @@ void CAmControlSender::cbAckSetSourceSoundProperty(const am_Handle_s handle, con
am_Error_e CAmControlSender::startupController(IAmControlReceive *controlreceiveinterface)
{
- return mController->startupController(controlreceiveinterface);
+ return (mController->startupController(controlreceiveinterface));
}
void CAmControlSender::cbAckSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
@@ -284,7 +283,7 @@ void CAmControlSender::setControllerRundown()
am_Error_e am::CAmControlSender::getConnectionFormatChoice(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_Route_s listRoute, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e> & listPrioConnectionFormats)
{
- return mController->getConnectionFormatChoice(sourceID, sinkID, listRoute, listPossibleConnectionFormats, listPrioConnectionFormats);
+ return (mController->getConnectionFormatChoice(sourceID, sinkID, listRoute, listPossibleConnectionFormats, listPrioConnectionFormats));
}
void CAmControlSender::getInterfaceVersion(std::string & version) const
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandler.cpp b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp
index b9da10e..a13b38c 100644
--- a/AudioManagerDaemon/src/CAmDatabaseHandler.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp
@@ -1,53 +1,52 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmDatabaseHandler.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * 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 CAmDatabaseHandler.cpp
+ * For further information see http://www.genivi.org/.
*
*/
#include "CAmDatabaseHandler.h"
-#include "CAmDatabaseObserver.h"
#include <cassert>
#include <vector>
#include <fstream>
#include <sstream>
#include <string>
-#include "shared/CAmDltWrapper.h"
+#include "CAmDatabaseObserver.h"
#include "CAmRouter.h"
-
-#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 CROSSFADER_TABLE "Crossfaders"
-#define CONNECTION_TABLE "Connections"
-#define MAINCONNECTION_TABLE "MainConnections"
-#define INTERRUPT_TABLE "Interrupts"
-#define MAIN_TABLE "MainTable"
-#define SYSTEM_TABLE "SystemProperties"
+#include "shared/CAmDltWrapper.h"
namespace am
{
+#define DOMAIN_TABLE "Domains" //!< domain table
+#define SOURCE_CLASS_TABLE "SourceClasses" //!< source class table
+#define SINK_CLASS_TABLE "SinkClasses" //!< sink class table
+#define SOURCE_TABLE "Sources" //!< source table
+#define SINK_TABLE "Sinks" //!< sink table
+#define GATEWAY_TABLE "Gateways" //!< gateway table
+#define CROSSFADER_TABLE "Crossfaders" //!< crossfader table
+#define CONNECTION_TABLE "Connections" //!< connection table
+#define MAINCONNECTION_TABLE "MainConnections" //!< main connection table
+#define SYSTEM_TABLE "SystemProperties" //!< system properties table
+
+/**
+ * table that holds table informations
+ */
const std::string databaseTables[] =
{ " Domains (domainID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50), busname VARCHAR(50), nodename VARCHAR(50), early BOOL, complete BOOL, state INTEGER, reserved BOOL);", //
" SourceClasses (sourceClassID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(50));", //
@@ -62,21 +61,21 @@ const std::string databaseTables[] =
/**
* template to converts T to std::string
- * @param i the value to be converted
- * @return the string
+ * @param x T
+ * @return string
*/
template<typename T>
inline std::string i2s(T const& x)
{
std::ostringstream o;
o << x;
- return o.str();
+ return (o.str());
}
CAmDatabaseHandler::CAmDatabaseHandler(std::string databasePath) :
- mDatabase(NULL), //
+ mpDatabase(NULL), //
mPath(databasePath), //
- mDatabaseObserver(NULL), //
+ mpDatabaseObserver(NULL), //
mFirstStaticSink(true), //
mFirstStaticSource(true), //
mFirstStaticGateway(true), //
@@ -106,7 +105,7 @@ CAmDatabaseHandler::CAmDatabaseHandler(std::string databasePath) :
CAmDatabaseHandler::~CAmDatabaseHandler()
{
logInfo("Closed Database");
- sqlite3_close(mDatabase);
+ sqlite3_close(mpDatabase);
}
am_Error_e CAmDatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_domainID_t & domainID)
@@ -120,7 +119,7 @@ am_Error_e CAmDatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_
sqlite3_stmt* query = NULL, *queryFinal;
int eCode = 0;
std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, domainData.name.c_str(), domainData.name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -134,16 +133,16 @@ am_Error_e CAmDatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_
else
{
logError("DatabaseHandler::enterDomainDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterDomainDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryFinal, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &queryFinal, NULL);
sqlite3_bind_text(queryFinal, 1, domainData.name.c_str(), domainData.name.size(), SQLITE_STATIC);
sqlite3_bind_text(queryFinal, 2, domainData.busname.c_str(), domainData.busname.size(), SQLITE_STATIC);
sqlite3_bind_text(queryFinal, 3, domainData.nodename.c_str(), domainData.nodename.size(), SQLITE_STATIC);
@@ -155,24 +154,24 @@ am_Error_e CAmDatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_
if ((eCode = sqlite3_step(queryFinal)) != SQLITE_DONE)
{
logError("DatabaseHandler::enterDomainDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(queryFinal)) != SQLITE_OK)
{
logError("DatabaseHandler::enterDomainDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- domainID = sqlite3_last_insert_rowid(mDatabase);
+ domainID = sqlite3_last_insert_rowid(mpDatabase);
logInfo("DatabaseHandler::enterDomainDB entered new domain with name=", domainData.name, "busname=", domainData.busname, "nodename=", domainData.nodename, "assigned ID:", domainID);
am_Domain_s domain = domainData;
domain.domainID = domainID;
- if (mDatabaseObserver)
- mDatabaseObserver->newDomain(domain);
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->newDomain(domain);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
@@ -186,7 +185,7 @@ am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s &
int eCode = 0;
int16_t delay = 0;
std::string command = "INSERT INTO " + std::string(MAINCONNECTION_TABLE) + "(sourceID, sinkID, connectionState, delay) VALUES (?,?,?,-1)";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, mainConnectionData.sourceID);
sqlite3_bind_int(query, 2, mainConnectionData.sinkID);
sqlite3_bind_int(query, 3, mainConnectionData.connectionState);
@@ -194,20 +193,20 @@ am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s &
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::enterMainConnectionDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- connectionID = sqlite3_last_insert_rowid(mDatabase);
+ connectionID = sqlite3_last_insert_rowid(mpDatabase);
//now check the connectionTable for all connections in the route. IF connectionID exist
command = "SELECT delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE connectionID=?");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_connectionID_t>::const_iterator elementIterator = mainConnectionData.listConnectionID.begin();
for (; elementIterator < mainConnectionData.listConnectionID.end(); ++elementIterator)
{
@@ -224,7 +223,7 @@ am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s &
else
{
logError("DatabaseHandler::enterMainConnectionDB did not find route for MainConnection:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -232,7 +231,7 @@ am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s &
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//now we create a table with references to the connections;
@@ -240,7 +239,7 @@ am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s &
assert(this->sqQuery(command));
command = "INSERT INTO MainConnectionRoute" + i2s(connectionID) + "(connectionID) VALUES (?)";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_connectionID_t>::const_iterator listConnectionIterator(mainConnectionData.listConnectionID.begin());
for (; listConnectionIterator < mainConnectionData.listConnectionID.end(); ++listConnectionIterator)
{
@@ -248,7 +247,7 @@ am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s &
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::enterMainConnectionDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -256,12 +255,12 @@ am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s &
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterMainConnectionDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID", mainConnectionData.sourceID, "sinkID:", mainConnectionData.sinkID, "delay:", delay, "assigned ID:", connectionID);
- if (mDatabaseObserver)
+ if (mpDatabaseObserver)
{
am_MainConnectionType_s mainConnection;
mainConnection.mainConnectionID = connectionID;
@@ -269,14 +268,14 @@ am_Error_e CAmDatabaseHandler::enterMainConnectionDB(const am_MainConnection_s &
mainConnection.delay = delay;
mainConnection.sinkID = mainConnectionData.sinkID;
mainConnection.sourceID = mainConnectionData.sourceID;
- mDatabaseObserver->newMainConnection(mainConnection);
- mDatabaseObserver->mainConnectionStateChanged(connectionID, mainConnectionData.connectionState);
+ mpDatabaseObserver->newMainConnection(mainConnection);
+ mpDatabaseObserver->mainConnectionStateChanged(connectionID, mainConnectionData.connectionState);
}
//finally, we update the delay value for the maintable
if (delay == 0)
delay = -1;
- return changeDelayMainConnection(delay, connectionID);
+ return (changeDelayMainConnection(delay, connectionID));
}
am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
@@ -285,7 +284,7 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
assert(sinkData.domainID!=0);
assert(!sinkData.name.empty());
assert(sinkData.sinkClassID!=0);
- // \todo: need to check if class exists?
+ //todo: need to check if class exists?
assert(!sinkData.listConnectionFormats.empty());
assert(sinkData.muteState>=MS_UNKNOWN && sinkData.muteState<=MS_MAX);
@@ -293,7 +292,7 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
int eCode = 0;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=? AND reserved=1";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
@@ -313,7 +312,7 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
if (existSinkNameOrID(sinkData.sinkID, sinkData.name))
{
sqlite3_finalize(query);
- return E_ALREADY_EXISTS;
+ return (E_ALREADY_EXISTS);
}
command = "INSERT INTO " + std::string(SINK_TABLE) + "(name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, reserved, sinkID) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
}
@@ -322,16 +321,16 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
{
logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterSinkDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryFinal, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &queryFinal, NULL);
sqlite3_bind_text(queryFinal, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC);
sqlite3_bind_int(queryFinal, 2, sinkData.domainID);
sqlite3_bind_int(queryFinal, 3, sinkData.sinkClassID);
@@ -360,18 +359,18 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
{
logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
sqlite3_finalize(queryFinal);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(queryFinal)) != SQLITE_OK)
{
logError("DatabaseHandler::enterSinkDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//now read back the sinkID
command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, sinkData.name.c_str(), sinkData.name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -382,7 +381,7 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
sinkID = 0;
logError("DatabaseHandler::existSink database error!:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_finalize(query);
@@ -394,7 +393,7 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
//fill ConnectionFormats
command = "INSERT INTO SinkConnectionFormat" + i2s(sinkID) + std::string("(soundFormat) VALUES (?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator = sinkData.listConnectionFormats.begin();
for (; connectionFormatIterator < sinkData.listConnectionFormats.end(); ++connectionFormatIterator)
{
@@ -403,14 +402,14 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
{
logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
//Fill SinkSoundProperties
command = "INSERT INTO SinkSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator = sinkData.listSoundProperties.begin();
for (; SoundPropertyIterator < sinkData.listSoundProperties.end(); ++SoundPropertyIterator)
{
@@ -420,7 +419,7 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
{
logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -432,7 +431,7 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
//Fill MainSinkSoundProperties
command = "INSERT INTO SinkMainSoundProperty" + i2s(sinkID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator = sinkData.listMainSoundProperties.begin();
for (; mainSoundPropertyIterator < sinkData.listMainSoundProperties.end(); ++mainSoundPropertyIterator)
{
@@ -442,7 +441,7 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
{
logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -451,9 +450,9 @@ am_Error_e CAmDatabaseHandler::enterSinkDB(const am_Sink_s & sinkData, am_sinkID
logInfo("DatabaseHandler::enterSinkDB entered new sink with name", sinkData.name, "domainID:", sinkData.domainID, "classID:", sinkData.sinkClassID, "volume:", sinkData.volume, "assigned ID:", sinkID);
am_Sink_s sink = sinkData;
sink.sinkID = sinkID;
- if (mDatabaseObserver != NULL)
- mDatabaseObserver->newSink(sink);
- return E_OK;
+ if (mpDatabaseObserver != NULL)
+ mpDatabaseObserver->newSink(sink);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
@@ -478,11 +477,11 @@ am_Error_e CAmDatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfa
{
//check if the ID already exists
if (existcrossFader(crossfaderData.crossfaderID))
- return E_ALREADY_EXISTS;
+ return (E_ALREADY_EXISTS);
command = "INSERT INTO " + std::string(CROSSFADER_TABLE) + "(name, sinkID_A, sinkID_B, sourceID, hotSink, crossfaderID) VALUES (?,?,?,?,?,?)";
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, crossfaderData.name.c_str(), crossfaderData.name.size(), SQLITE_STATIC);
sqlite3_bind_int(query, 2, crossfaderData.sinkID_A);
@@ -507,19 +506,19 @@ am_Error_e CAmDatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfa
{
logError("DatabaseHandler::enterCrossfaderDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterCrossfaderDB SQLITE Finalize error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//now read back the crossfaderID
command = "SELECT crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, crossfaderData.name.c_str(), crossfaderData.name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -530,7 +529,7 @@ am_Error_e CAmDatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfa
crossfaderID = 0;
logError("DatabaseHandler::enterCrossfaderDB database error!:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_finalize(query);
@@ -538,9 +537,9 @@ am_Error_e CAmDatabaseHandler::enterCrossfaderDB(const am_Crossfader_s & crossfa
am_Crossfader_s crossfader(crossfaderData);
crossfader.crossfaderID = crossfaderID;
- if (mDatabaseObserver)
- mDatabaseObserver->newCrossfader(crossfader);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->newCrossfader(crossfader);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
@@ -571,11 +570,11 @@ am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData,
{
//check if the ID already exists
if (existGateway(gatewayData.gatewayID))
- return E_ALREADY_EXISTS;
+ return (E_ALREADY_EXISTS);
command = "INSERT INTO " + std::string(GATEWAY_TABLE) + "(name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID) VALUES (?,?,?,?,?,?,?)";
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, gatewayData.name.c_str(), gatewayData.name.size(), SQLITE_STATIC);
sqlite3_bind_int(query, 2, gatewayData.sinkID);
sqlite3_bind_int(query, 3, gatewayData.sourceID);
@@ -599,16 +598,16 @@ am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData,
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::enterGatewayDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterGatewayDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- gatewayID = sqlite3_last_insert_rowid(mDatabase);
+ gatewayID = sqlite3_last_insert_rowid(mpDatabase);
//now the convertion matrix todo: change the map implementation sometimes to blob in sqlite
mListConnectionFormat.insert(std::make_pair(gatewayID, gatewayData.convertionMatrix));
@@ -620,7 +619,7 @@ am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData,
//fill ConnectionFormats
command = "INSERT INTO GatewaySourceFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator = gatewayData.listSourceFormats.begin();
for (; connectionFormatIterator < gatewayData.listSourceFormats.end(); ++connectionFormatIterator)
{
@@ -628,13 +627,13 @@ am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData,
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::enterGatewayDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
command = "INSERT INTO GatewaySinkFormat" + i2s(gatewayID) + std::string("(soundFormat) VALUES (?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
connectionFormatIterator = gatewayData.listSinkFormats.begin();
for (; connectionFormatIterator < gatewayData.listSinkFormats.end(); ++connectionFormatIterator)
{
@@ -642,7 +641,7 @@ am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData,
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::enterGatewayDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -650,9 +649,9 @@ am_Error_e CAmDatabaseHandler::enterGatewayDB(const am_Gateway_s & gatewayData,
logInfo("DatabaseHandler::enterGatewayDB entered new gateway with name", gatewayData.name, "sourceID:", gatewayData.sourceID, "sinkID:", gatewayData.sinkID, "assigned ID:", gatewayID);
am_Gateway_s gateway = gatewayData;
gateway.gatewayID = gatewayID;
- if (mDatabaseObserver)
- mDatabaseObserver->newGateway(gateway);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->newGateway(gateway);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sourceID_t & sourceID)
@@ -670,7 +669,7 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
int eCode = 0;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=? AND reserved=1";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
@@ -690,7 +689,7 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
if (existSourceNameOrID(sourceData.sourceID, sourceData.name))
{
sqlite3_finalize(query);
- return E_ALREADY_EXISTS;
+ return (E_ALREADY_EXISTS);
}
command = "INSERT INTO " + std::string(SOURCE_TABLE) + "(name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, reserved, sourceID) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
}
@@ -699,15 +698,15 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
{
logError("DatabaseHandler::enterSourceDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterSourceDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryFinal, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &queryFinal, NULL);
sqlite3_bind_text(queryFinal, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC);
sqlite3_bind_int(queryFinal, 2, sourceData.domainID);
sqlite3_bind_int(queryFinal, 3, sourceData.sourceClassID);
@@ -736,19 +735,19 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
{
logError("DatabaseHandler::enterSourceDB SQLITE Step error code:", eCode);
sqlite3_finalize(queryFinal);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(queryFinal)) != SQLITE_OK)
{
logError("DatabaseHandler::enterSourceDB SQLITE Finalize error code:", eCode);
sqlite3_finalize(queryFinal);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//now read back the sinkID
command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, sourceData.name.c_str(), sourceData.name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -759,7 +758,7 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
sourceID = 0;
logError("DatabaseHandler::existSink database error!:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_finalize(query);
@@ -771,7 +770,7 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
//fill ConnectionFormats
command = "INSERT INTO SourceConnectionFormat" + i2s(sourceID) + std::string("(soundFormat) VALUES (?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_ConnectionFormat_e>::const_iterator connectionFormatIterator = sourceData.listConnectionFormats.begin();
for (; connectionFormatIterator < sourceData.listConnectionFormats.end(); ++connectionFormatIterator)
{
@@ -780,14 +779,14 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
{
logError("DatabaseHandler::enterSourceDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
//Fill SinkSoundProperties
command = "INSERT INTO SourceSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_SoundProperty_s>::const_iterator SoundPropertyIterator = sourceData.listSoundProperties.begin();
for (; SoundPropertyIterator < sourceData.listSoundProperties.end(); ++SoundPropertyIterator)
{
@@ -797,7 +796,7 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
{
logError("DatabaseHandler::enterSinkDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -809,7 +808,7 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
//Fill MainSinkSoundProperties
command = "INSERT INTO SourceMainSoundProperty" + i2s(sourceID) + std::string("(soundPropertyType,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_MainSoundProperty_s>::const_iterator mainSoundPropertyIterator = sourceData.listMainSoundProperties.begin();
for (; mainSoundPropertyIterator < sourceData.listMainSoundProperties.end(); ++mainSoundPropertyIterator)
{
@@ -819,7 +818,7 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
{
logError("DatabaseHandler::enterSourceDB SQLITE Step error code:", eCode);
sqlite3_finalize(query);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -829,9 +828,9 @@ am_Error_e CAmDatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_
am_Source_s source = sourceData;
source.sourceID = sourceID;
- if (mDatabaseObserver)
- mDatabaseObserver->newSource(source);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->newSource(source);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
@@ -839,7 +838,7 @@ am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnecti
assert(mainconnectionID!=0);
if (!existMainConnection(mainconnectionID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL;
int eCode = 0;
@@ -847,7 +846,7 @@ am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnecti
int16_t delay = 0;
command = "SELECT delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE connectionID=?");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_connectionID_t>::const_iterator elementIterator = listConnectionID.begin();
for (; elementIterator < listConnectionID.end(); ++elementIterator)
{
@@ -865,7 +864,7 @@ am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnecti
{
logError("DatabaseHandler::changeMainConnectionRouteDB did not find route for MainConnection:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -874,7 +873,7 @@ am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnecti
{
logError("DatabaseHandler::changeMainConnectionRouteDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//now we delete the data in the table
@@ -882,7 +881,7 @@ am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnecti
assert(this->sqQuery(command));
command = "INSERT INTO MainConnectionRoute" + i2s(mainconnectionID) + "(connectionID) VALUES (?)";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_connectionID_t>::const_iterator listConnectionIterator(listConnectionID.begin());
for (; listConnectionIterator != listConnectionID.end(); ++listConnectionIterator)
{
@@ -891,7 +890,7 @@ am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnecti
{
logError("DatabaseHandler::changeMainConnectionRouteDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -900,10 +899,10 @@ am_Error_e CAmDatabaseHandler::changeMainConnectionRouteDB(const am_mainConnecti
{
logError("DatabaseHandler::changeMainConnectionRouteDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeMainConnectionRouteDB entered new route:", mainconnectionID);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
@@ -917,26 +916,26 @@ am_Error_e CAmDatabaseHandler::changeMainConnectionStateDB(const am_mainConnecti
if (!existMainConnection(mainconnectionID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET connectionState=? WHERE mainConnectionID=" + i2s(mainconnectionID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, connectionState);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeMainConnectionStateDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeMainConnectionStateDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeMainConnectionStateDB changed mainConnectionState of MainConnection:", mainconnectionID, "to:", connectionState);
- if (mDatabaseObserver)
- mDatabaseObserver->mainConnectionStateChanged(mainconnectionID, connectionState);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->mainConnectionStateChanged(mainconnectionID, connectionState);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSinkMainVolumeDB(const am_mainVolume_t mainVolume, const am_sinkID_t sinkID)
@@ -949,28 +948,28 @@ am_Error_e CAmDatabaseHandler::changeSinkMainVolumeDB(const am_mainVolume_t main
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(SINK_TABLE) + " SET mainVolume=? WHERE sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, mainVolume);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSinkMainVolumeDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSinkMainVolumeDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSinkMainVolumeDB changed mainVolume of sink:", sinkID, "to:", mainVolume);
- if (mDatabaseObserver)
- mDatabaseObserver->volumeChanged(sinkID, mainVolume);
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->volumeChanged(sinkID, mainVolume);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSinkAvailabilityDB(const am_Availability_s & availability, const am_sinkID_t sinkID)
@@ -985,29 +984,30 @@ am_Error_e CAmDatabaseHandler::changeSinkAvailabilityDB(const am_Availability_s
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(SINK_TABLE) + " SET availability=?, availabilityReason=? WHERE sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, availability.availability);
sqlite3_bind_int(query, 2, availability.availabilityReason);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSinkAvailabilityDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
- }assert(sinkID!=0);
+ return (E_DATABASE_ERROR);
+ }
+ assert(sinkID!=0);
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSinkAvailabilityDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSinkAvailabilityDB changed sinkAvailability of sink:", sinkID, "to:", availability.availability, "Reason:", availability.availabilityReason);
- if (mDatabaseObserver && sourceVisible(sinkID))
- mDatabaseObserver->sinkAvailabilityChanged(sinkID, availability);
- return E_OK;
+ if (mpDatabaseObserver && sourceVisible(sinkID))
+ mpDatabaseObserver->sinkAvailabilityChanged(sinkID, availability);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changDomainStateDB(const am_DomainState_e domainState, const am_domainID_t domainID)
@@ -1021,26 +1021,26 @@ am_Error_e CAmDatabaseHandler::changDomainStateDB(const am_DomainState_e domainS
if (!existDomain(domainID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(DOMAIN_TABLE) + " SET state=? WHERE domainID=" + i2s(domainID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, domainState);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changDomainStateDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changDomainStateDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changDomainStateDB changed domainState of domain:", domainID, "to:", domainState);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSinkMuteStateDB(const am_MuteState_e muteState, const am_sinkID_t sinkID)
@@ -1054,29 +1054,30 @@ am_Error_e CAmDatabaseHandler::changeSinkMuteStateDB(const am_MuteState_e muteSt
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(SINK_TABLE) + " SET muteState=? WHERE sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, muteState);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSinkMuteStateDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
- }assert(sinkID!=0);
+ return (E_DATABASE_ERROR);
+ }
+ assert(sinkID!=0);
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSinkMuteStateDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSinkMuteStateDB changed sinkMuteState of sink:", sinkID, "to:", muteState);
- if (mDatabaseObserver)
- mDatabaseObserver->sinkMuteStateChanged(sinkID, muteState);
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->sinkMuteStateChanged(sinkID, muteState);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeMainSinkSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
@@ -1090,27 +1091,28 @@ am_Error_e CAmDatabaseHandler::changeMainSinkSoundPropertyDB(const am_MainSoundP
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE SinkMainSoundProperty" + i2s(sinkID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, soundProperty.value);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeMainSinkSoundPropertyDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
- }assert(sinkID!=0);
+ return (E_DATABASE_ERROR);
+ }
+ assert(sinkID!=0);
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeMainSinkSoundPropertyDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeMainSinkSoundPropertyDB changed MainSinkSoundProperty of sink:", sinkID, "type:", soundProperty.type, "to:", soundProperty.value);
- if (mDatabaseObserver)
- mDatabaseObserver->mainSinkSoundPropertyChanged(sinkID, soundProperty);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->mainSinkSoundPropertyChanged(sinkID, soundProperty);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeMainSourceSoundPropertyDB(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
@@ -1124,28 +1126,28 @@ am_Error_e CAmDatabaseHandler::changeMainSourceSoundPropertyDB(const am_MainSoun
if (!existSource(sourceID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE SourceMainSoundProperty" + i2s(sourceID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, soundProperty.value);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeMainSourceSoundPropertyDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeMainSourceSoundPropertyDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeMainSourceSoundPropertyDB changed MainSinkSoundProperty of source:", sourceID, "type:", soundProperty.type, "to:", soundProperty.value);
- if (mDatabaseObserver)
- mDatabaseObserver->mainSourceSoundPropertyChanged(sourceID, soundProperty);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->mainSourceSoundPropertyChanged(sourceID, soundProperty);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSourceAvailabilityDB(const am_Availability_s & availability, const am_sourceID_t sourceID)
@@ -1160,29 +1162,29 @@ am_Error_e CAmDatabaseHandler::changeSourceAvailabilityDB(const am_Availability_
if (!existSource(sourceID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(SOURCE_TABLE) + " SET availability=?, availabilityReason=? WHERE sourceID=" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, availability.availability);
sqlite3_bind_int(query, 2, availability.availabilityReason);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSourceAvailabilityDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSourceAvailabilityDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSourceAvailabilityDB changed changeSourceAvailabilityDB of source:", sourceID, "to:", availability.availability, "Reason:", availability.availabilityReason);
- if (mDatabaseObserver && sourceVisible(sourceID))
- mDatabaseObserver->sourceAvailabilityChanged(sourceID, availability);
- return E_OK;
+ if (mpDatabaseObserver && sourceVisible(sourceID))
+ mpDatabaseObserver->sourceAvailabilityChanged(sourceID, availability);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSystemPropertyDB(const am_SystemProperty_s & property)
@@ -1192,28 +1194,28 @@ am_Error_e CAmDatabaseHandler::changeSystemPropertyDB(const am_SystemProperty_s
int eCode = 0;
std::string command = "UPDATE " + std::string(SYSTEM_TABLE) + " set value=? WHERE type=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, property.value);
sqlite3_bind_int(query, 2, property.type);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSystemPropertyDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSystemPropertyDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSystemPropertyDB changed system property");
- if (mDatabaseObserver)
- mDatabaseObserver->systemPropertyChanged(property);
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->systemPropertyChanged(property);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_t mainConnectionID)
@@ -1222,21 +1224,21 @@ am_Error_e CAmDatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_
if (!existMainConnection(mainConnectionID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
std::string command = "DELETE from " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
std::string command1 = "DROP table MainConnectionRoute" + i2s(mainConnectionID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command1))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeMainConnectionDB removed:", mainConnectionID);
- if (mDatabaseObserver)
+ if (mpDatabaseObserver)
{
- mDatabaseObserver->mainConnectionStateChanged(mainConnectionID, CS_DISCONNECTED);
- mDatabaseObserver->removedMainConnection(mainConnectionID);
+ mpDatabaseObserver->mainConnectionStateChanged(mainConnectionID, CS_DISCONNECTED);
+ mpDatabaseObserver->removedMainConnection(mainConnectionID);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
@@ -1245,7 +1247,7 @@ am_Error_e CAmDatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
bool visible = sinkVisible(sinkID);
@@ -1255,19 +1257,19 @@ am_Error_e CAmDatabaseHandler::removeSinkDB(const am_sinkID_t sinkID)
std::string command2 = "DROP table SinkMainSoundProperty" + i2s(sinkID);
std::string command3 = "DROP table SinkSoundProperty" + i2s(sinkID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command1))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command2))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command3))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeSinkDB removed:", sinkID);
- if (mDatabaseObserver != NULL)
- mDatabaseObserver->removedSink(sinkID, visible);
+ if (mpDatabaseObserver != NULL)
+ mpDatabaseObserver->removedSink(sinkID, visible);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
@@ -1276,7 +1278,7 @@ am_Error_e CAmDatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
if (!existSource(sourceID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
bool visible = sourceVisible(sourceID);
@@ -1286,17 +1288,17 @@ am_Error_e CAmDatabaseHandler::removeSourceDB(const am_sourceID_t sourceID)
std::string command2 = "DROP table SourceMainSoundProperty" + i2s(sourceID);
std::string command3 = "DROP table SourceSoundProperty" + i2s(sourceID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command1))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command2))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command3))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeSourceDB removed:", sourceID);
- if (mDatabaseObserver)
- mDatabaseObserver->removedSource(sourceID, visible);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->removedSource(sourceID, visible);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
@@ -1305,15 +1307,15 @@ am_Error_e CAmDatabaseHandler::removeGatewayDB(const am_gatewayID_t gatewayID)
if (!existGateway(gatewayID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
std::string command = "DELETE from " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeGatewayDB removed:", gatewayID);
- if (mDatabaseObserver)
- mDatabaseObserver->removeGateway(gatewayID);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->removeGateway(gatewayID);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeCrossfaderDB(const am_crossfaderID_t crossfaderID)
@@ -1322,15 +1324,15 @@ am_Error_e CAmDatabaseHandler::removeCrossfaderDB(const am_crossfaderID_t crossf
if (!existcrossFader(crossfaderID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
std::string command = "DELETE from " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=" + i2s(crossfaderID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeDomainDB removed:", crossfaderID);
- if (mDatabaseObserver)
- mDatabaseObserver->removeCrossfader(crossfaderID);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->removeCrossfader(crossfaderID);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeDomainDB(const am_domainID_t domainID)
@@ -1339,15 +1341,15 @@ am_Error_e CAmDatabaseHandler::removeDomainDB(const am_domainID_t domainID)
if (!existDomain(domainID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
std::string command = "DELETE from " + std::string(DOMAIN_TABLE) + " WHERE domainID=" + i2s(domainID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeDomainDB removed:", domainID);
- if (mDatabaseObserver)
- mDatabaseObserver->removeDomain(domainID);
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->removeDomain(domainID);
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeSinkClassDB(const am_sinkClass_t sinkClassID)
@@ -1356,20 +1358,20 @@ am_Error_e CAmDatabaseHandler::removeSinkClassDB(const am_sinkClass_t sinkClassI
if (!existSinkClass(sinkClassID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
std::string command = "DELETE from " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
std::string command1 = "DROP table SinkClassProperties" + i2s(sinkClassID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command1))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeSinkClassDB removed:", sinkClassID);
- if (mDatabaseObserver)
- mDatabaseObserver->numberOfSinkClassesChanged();
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->numberOfSinkClassesChanged();
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeSourceClassDB(const am_sourceClass_t sourceClassID)
@@ -1378,18 +1380,18 @@ am_Error_e CAmDatabaseHandler::removeSourceClassDB(const am_sourceClass_t source
if (!existSourceClass(sourceClassID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
std::string command = "DELETE from " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
std::string command1 = "DROP table SourceClassProperties" + i2s(sourceClassID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
if (!sqQuery(command1))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeSourceClassDB removed:", sourceClassID);
- if (mDatabaseObserver)
- mDatabaseObserver->numberOfSourceClassesChanged();
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->numberOfSourceClassesChanged();
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::removeConnection(const am_connectionID_t connectionID)
@@ -1398,9 +1400,9 @@ am_Error_e CAmDatabaseHandler::removeConnection(const am_connectionID_t connecti
std::string command = "DELETE from " + std::string(CONNECTION_TABLE) + " WHERE connectionID=" + i2s(connectionID);
if (!sqQuery(command))
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
logInfo("DatabaseHandler::removeConnection removed:", connectionID);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, am_SourceClass_s & classInfo) const
@@ -1409,13 +1411,13 @@ am_Error_e CAmDatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID
if (!existSource(sourceID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL;
int eCode = 0;
am_ClassProperty_s propertyTemp;
std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + (i2s(sourceID));
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1425,17 +1427,17 @@ am_Error_e CAmDatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::getSourceClassInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
command = "SELECT name FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + (i2s(classInfo.sourceClassID));
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1445,18 +1447,18 @@ am_Error_e CAmDatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::getSourceClassInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out Properties
command = "SELECT classProperty, value FROM SourceClassProperties" + i2s(classInfo.sourceClassID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
propertyTemp.classProperty = (am_ClassProperty_e) sqlite3_column_int(query, 0);
@@ -1467,15 +1469,15 @@ am_Error_e CAmDatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getSourceClassInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSourceClassInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
@@ -1485,7 +1487,7 @@ am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
@@ -1494,7 +1496,7 @@ am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s
am_SoundProperty_s tempSoundProperty;
am_MainSoundProperty_s tempMainSoundProperty;
std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 and sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1511,7 +1513,7 @@ am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s
//read out the connectionFormats
std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
@@ -1522,12 +1524,12 @@ am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s
{
logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out sound properties
std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
{
tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0);
@@ -1539,12 +1541,12 @@ am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s
{
logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out MainSoundProperties
std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
{
tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0);
@@ -1556,7 +1558,7 @@ am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s
{
logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
}
@@ -1564,17 +1566,17 @@ am_Error_e CAmDatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s
{
logError("DatabaseHandler::getSinkInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
@@ -1583,7 +1585,7 @@ am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_
if (!existSource(sourceID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
@@ -1592,7 +1594,7 @@ am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_
am_SoundProperty_s tempSoundProperty;
am_MainSoundProperty_s tempMainSoundProperty;
std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1609,7 +1611,7 @@ am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_
//read out the connectionFormats
std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
@@ -1620,12 +1622,12 @@ am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_
{
logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out sound properties
std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
{
tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0);
@@ -1637,12 +1639,12 @@ am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_
{
logError("DatabaseHandler::getSourceInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out MainSoundProperties
std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
{
tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0);
@@ -1654,24 +1656,24 @@ am_Error_e CAmDatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_
{
logError("DatabaseHandler::getSourceInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
}
else if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getSourceInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSourceInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e am::CAmDatabaseHandler::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
@@ -1679,14 +1681,14 @@ am_Error_e am::CAmDatabaseHandler::getMainConnectionInfoDB(const am_mainConnecti
assert(mainConnectionID!=0);
if (!existMainConnection(mainConnectionID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt *query = NULL, *query1 = NULL;
int eCode = 0;
am_MainConnection_s temp;
std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
std::string command1 = "SELECT connectionID FROM MainConnectionRoute";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1696,7 +1698,7 @@ am_Error_e am::CAmDatabaseHandler::getMainConnectionInfoDB(const am_mainConnecti
mainConnectionData.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3);
mainConnectionData.delay = sqlite3_column_int(query, 4);
std::string statement = command1 + i2s(mainConnectionID);
- sqlite3_prepare_v2(mDatabase, statement.c_str(), -1, &query1, NULL);
+ sqlite3_prepare_v2(mpDatabase, statement.c_str(), -1, &query1, NULL);
while ((eCode = sqlite3_step(query1)) == SQLITE_ROW)
{
mainConnectionData.listConnectionID.push_back(sqlite3_column_int(query1, 0));
@@ -1706,16 +1708,16 @@ am_Error_e am::CAmDatabaseHandler::getMainConnectionInfoDB(const am_mainConnecti
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getMainConnectionInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getMainConnectionInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
@@ -1728,11 +1730,11 @@ am_Error_e CAmDatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkC
//check if the ID already exists
if (!existSinkClass(sinkClass.sinkClassID))
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
//fill ConnectionFormats
std::string command = "UPDATE SinkClassProperties" + i2s(sinkClass.sinkClassID) + " set value=? WHERE classProperty=?;";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_ClassProperty_s>::const_iterator Iterator = sinkClass.listClassProperties.begin();
for (; Iterator < sinkClass.listClassProperties.end(); ++Iterator)
{
@@ -1741,7 +1743,7 @@ am_Error_e CAmDatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkC
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::setSinkClassInfoDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -1749,11 +1751,11 @@ am_Error_e CAmDatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkC
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::setSinkClassInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo");
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& sourceClass)
@@ -1766,11 +1768,11 @@ am_Error_e CAmDatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& s
//check if the ID already exists
if (!existSourceClass(sourceClass.sourceClassID))
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
//fill ConnectionFormats
std::string command = "UPDATE SourceClassProperties" + i2s(sourceClass.sourceClassID) + " set value=? WHERE classProperty=?;";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_ClassProperty_s>::const_iterator Iterator = sourceClass.listClassProperties.begin();
for (; Iterator < sourceClass.listClassProperties.end(); ++Iterator)
{
@@ -1779,7 +1781,7 @@ am_Error_e CAmDatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& s
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::setSinkClassInfoDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -1787,11 +1789,11 @@ am_Error_e CAmDatabaseHandler::changeSourceClassInfoDB(const am_SourceClass_s& s
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::setSinkClassInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::setSinkClassInfoDB set setSinkClassInfo");
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_SinkClass_s & sinkClass) const
@@ -1800,13 +1802,13 @@ am_Error_e CAmDatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_S
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL;
int eCode = 0;
am_ClassProperty_s propertyTemp;
std::string command = "SELECT sinkClassID FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + (i2s(sinkID));
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1816,17 +1818,17 @@ am_Error_e CAmDatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_S
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::getSinkClassInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
command = "SELECT name FROM " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + (i2s(sinkClass.sinkClassID));
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1836,18 +1838,18 @@ am_Error_e CAmDatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_S
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::getSinkClassInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out Properties
command = "SELECT classProperty, value FROM SinkClassProperties" + i2s(sinkClass.sinkClassID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
propertyTemp.classProperty = (am_ClassProperty_e) sqlite3_column_int(query, 0);
@@ -1858,15 +1860,15 @@ am_Error_e CAmDatabaseHandler::getSinkClassInfoDB(const am_sinkID_t sinkID, am_S
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getSinkClassInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSinkClassInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
@@ -1874,13 +1876,13 @@ am_Error_e CAmDatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID,
assert(gatewayID!=0);
if (!existGateway(gatewayID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL, *qSinkConnectionFormat = NULL, *qSourceConnectionFormat = NULL;
int eCode = 0;
am_ConnectionFormat_e tempConnectionFormat;
std::string command = "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1898,13 +1900,13 @@ am_Error_e CAmDatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID,
if (iter == mListConnectionFormat.end())
{
logError("DatabaseHandler::getGatewayInfoDB database error with convertionFormat");
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
gatewayData.convertionMatrix = iter->second;
//read out the connectionFormats
std::string commandConnectionFormat = "SELECT soundFormat FROM GatewaySourceFormat" + i2s(gatewayData.gatewayID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL);
while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qSourceConnectionFormat, 0);
@@ -1914,12 +1916,12 @@ am_Error_e CAmDatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID,
if ((eCode = sqlite3_finalize(qSourceConnectionFormat)) != SQLITE_OK)
{
logError("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out sound properties
commandConnectionFormat = "SELECT soundFormat FROM GatewaySinkFormat" + i2s(gatewayData.gatewayID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL);
while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qSinkConnectionFormat, 0);
@@ -1929,7 +1931,7 @@ am_Error_e CAmDatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID,
if ((eCode = sqlite3_finalize(qSinkConnectionFormat)) != SQLITE_OK)
{
logError("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
}
@@ -1937,16 +1939,16 @@ am_Error_e CAmDatabaseHandler::getGatewayInfoDB(const am_gatewayID_t gatewayID,
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getGatewayInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getGatewayInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
@@ -1955,12 +1957,12 @@ am_Error_e CAmDatabaseHandler::getCrossfaderInfoDB(const am_crossfaderID_t cross
assert(crossfaderID!=0);
if (!existcrossFader(crossfaderID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL;
int eCode = 0;
std::string command = "SELECT name, sinkID_A, sinkID_B, sourceID, hotSink,crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=" + i2s(crossfaderID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -1975,16 +1977,16 @@ am_Error_e CAmDatabaseHandler::getCrossfaderInfoDB(const am_crossfaderID_t cross
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getCrossfaderInfoDB SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getCrossfaderInfoDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListSinksOfDomain(const am_domainID_t domainID, std::vector<am_sinkID_t> & listSinkID) const
@@ -1993,13 +1995,13 @@ am_Error_e CAmDatabaseHandler::getListSinksOfDomain(const am_domainID_t domainID
listSinkID.clear();
if (!existDomain(domainID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL;
int eCode = 0;
am_sinkID_t temp;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND domainID=" + (i2s(domainID));
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2010,16 +2012,16 @@ am_Error_e CAmDatabaseHandler::getListSinksOfDomain(const am_domainID_t domainID
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getListSinksOfDomain SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSinksOfDomain SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListSourcesOfDomain(const am_domainID_t domainID, std::vector<am_sourceID_t> & listSourceID) const
@@ -2028,14 +2030,14 @@ am_Error_e CAmDatabaseHandler::getListSourcesOfDomain(const am_domainID_t domain
listSourceID.clear();
if (!existDomain(domainID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL;
int eCode = 0;
am_sourceID_t temp;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2046,16 +2048,16 @@ am_Error_e CAmDatabaseHandler::getListSourcesOfDomain(const am_domainID_t domain
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getListSourcesOfDomain SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSourcesOfDomain SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListCrossfadersOfDomain(const am_domainID_t domainID, std::vector<am_crossfaderID_t> & listCrossfader) const
@@ -2064,14 +2066,14 @@ am_Error_e CAmDatabaseHandler::getListCrossfadersOfDomain(const am_domainID_t do
listCrossfader.clear();
if (!existDomain(domainID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL;
int eCode = 0;
am_crossfaderID_t temp;
std::string command = "SELECT c.crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " c," + std::string(SOURCE_TABLE) + " s WHERE c.sourceID=s.sourceID AND s.domainID=" + i2s(domainID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2082,16 +2084,16 @@ am_Error_e CAmDatabaseHandler::getListCrossfadersOfDomain(const am_domainID_t do
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getListCrossfadersOfDomain SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListCrossfadersOfDomain SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
@@ -2101,14 +2103,14 @@ am_Error_e CAmDatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domai
listGatewaysID.clear();
if (!existDomain(domainID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
sqlite3_stmt* query = NULL;
int eCode = 0;
am_gatewayID_t temp;
std::string command = "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE controlDomainID=" + i2s(domainID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2119,16 +2121,16 @@ am_Error_e CAmDatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domai
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getListGatewaysOfDomain SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListGatewaysOfDomain SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
@@ -2139,7 +2141,7 @@ am_Error_e CAmDatabaseHandler::getListMainConnections(std::vector<am_MainConnect
am_MainConnection_s temp;
std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
std::string command1 = "SELECT connectionID FROM MainConnectionRoute";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2149,7 +2151,7 @@ am_Error_e CAmDatabaseHandler::getListMainConnections(std::vector<am_MainConnect
temp.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3);
temp.delay = sqlite3_column_int(query, 4);
std::string statement = command1 + i2s(temp.mainConnectionID);
- sqlite3_prepare_v2(mDatabase, statement.c_str(), -1, &query1, NULL);
+ sqlite3_prepare_v2(mpDatabase, statement.c_str(), -1, &query1, NULL);
while ((eCode = sqlite3_step(query1)) == SQLITE_ROW)
{
temp.listConnectionID.push_back(sqlite3_column_int(query1, 0));
@@ -2160,16 +2162,16 @@ am_Error_e CAmDatabaseHandler::getListMainConnections(std::vector<am_MainConnect
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getListMainConnections SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListMainConnections SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListDomains(std::vector<am_Domain_s> & listDomains) const
@@ -2179,7 +2181,7 @@ am_Error_e CAmDatabaseHandler::getListDomains(std::vector<am_Domain_s> & listDom
int eCode = 0;
am_Domain_s temp;
std::string command = "SELECT domainID, name, busname, nodename, early, complete, state FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2197,17 +2199,17 @@ am_Error_e CAmDatabaseHandler::getListDomains(std::vector<am_Domain_s> & listDom
{
logError("DatabaseHandler::getListDomains SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListDomains SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListConnections(std::vector<am_Connection_s> & listConnections) const
@@ -2217,7 +2219,7 @@ am_Error_e CAmDatabaseHandler::getListConnections(std::vector<am_Connection_s> &
int eCode = 0;
am_Connection_s temp;
std::string command = "SELECT connectionID, sourceID, sinkID, delay, connectionFormat FROM " + std::string(CONNECTION_TABLE) + " WHERE reserved=0";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2232,16 +2234,16 @@ am_Error_e CAmDatabaseHandler::getListConnections(std::vector<am_Connection_s> &
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getListConnections SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListConnections SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks) const
@@ -2254,7 +2256,7 @@ am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks)
am_SoundProperty_s tempSoundProperty;
am_MainSoundProperty_s tempMainSoundProperty;
std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2271,7 +2273,7 @@ am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks)
//read out the connectionFormats
std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(temp.sinkID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
@@ -2282,12 +2284,12 @@ am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks)
{
logError("DatabaseHandler::getListSinks SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out sound properties
std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SinkSoundProperty" + i2s(temp.sinkID);
- sqlite3_prepare_v2(mDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
{
tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0);
@@ -2299,12 +2301,12 @@ am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks)
{
logError("DatabaseHandler::getListSinks SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out MainSoundProperties
std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(temp.sinkID);
- sqlite3_prepare_v2(mDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
{
tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0);
@@ -2316,7 +2318,7 @@ am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks)
{
logError("DatabaseHandler::getListSinks SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
listSinks.push_back(temp);
temp.listConnectionFormats.clear();
@@ -2328,17 +2330,17 @@ am_Error_e CAmDatabaseHandler::getListSinks(std::vector<am_Sink_s> & listSinks)
{
logError("DatabaseHandler::getListSinks SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSinks SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSources) const
@@ -2351,7 +2353,7 @@ am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSou
am_SoundProperty_s tempSoundProperty;
am_MainSoundProperty_s tempMainSoundProperty;
std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2368,7 +2370,7 @@ am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSou
//read out the connectionFormats
std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(temp.sourceID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
@@ -2379,12 +2381,12 @@ am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSou
{
logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out sound properties
std::string commandSoundProperty = "SELECT soundPropertyType, value FROM SourceSoundProperty" + i2s(temp.sourceID);
- sqlite3_prepare_v2(mDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandSoundProperty.c_str(), -1, &qSoundProperty, NULL);
while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
{
tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0);
@@ -2396,12 +2398,12 @@ am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSou
{
logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out MainSoundProperties
std::string commandMainSoundProperty = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(temp.sourceID);
- sqlite3_prepare_v2(mDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandMainSoundProperty.c_str(), -1, &qMAinSoundProperty, NULL);
while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
{
tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0);
@@ -2413,7 +2415,7 @@ am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSou
{
logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
listSources.push_back(temp);
temp.listConnectionFormats.clear();
@@ -2425,17 +2427,17 @@ am_Error_e CAmDatabaseHandler::getListSources(std::vector<am_Source_s> & listSou
{
logError("DatabaseHandler::getListSources SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s> & listSourceClasses) const
@@ -2449,7 +2451,7 @@ am_Error_e CAmDatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s
std::string command = "SELECT sourceClassID, name FROM " + std::string(SOURCE_CLASS_TABLE);
std::string command2;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2458,7 +2460,7 @@ am_Error_e CAmDatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s
//read out Properties
command2 = "SELECT classProperty, value FROM SourceClassProperties" + i2s(classTemp.sourceClassID);
- sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &subQuery, NULL);
+ sqlite3_prepare_v2(mpDatabase, command2.c_str(), -1, &subQuery, NULL);
while ((eCode1 = sqlite3_step(subQuery)) == SQLITE_ROW)
{
@@ -2471,14 +2473,14 @@ am_Error_e CAmDatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s
{
logError("DatabaseHandler::getListSourceClasses SQLITE error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode1 = sqlite3_finalize(subQuery)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
listSourceClasses.push_back(classTemp);
}
@@ -2487,17 +2489,17 @@ am_Error_e CAmDatabaseHandler::getListSourceClasses(std::vector<am_SourceClass_s
{
logError("DatabaseHandler::getListSourceClasses SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListCrossfaders(std::vector<am_Crossfader_s> & listCrossfaders) const
@@ -2507,7 +2509,7 @@ am_Error_e CAmDatabaseHandler::getListCrossfaders(std::vector<am_Crossfader_s> &
int eCode = 0;
am_Crossfader_s tempData;
std::string command = "SELECT name, sinkID_A, sinkID_B, sourceID, hotSink,crossfaderID FROM " + std::string(CROSSFADER_TABLE);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2523,16 +2525,16 @@ am_Error_e CAmDatabaseHandler::getListCrossfaders(std::vector<am_Crossfader_s> &
if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::getListCrossfaders SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListCrossfaders SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listGateways) const
@@ -2544,7 +2546,7 @@ am_Error_e CAmDatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listG
am_ConnectionFormat_e tempConnectionFormat;
std::string command = "SELECT name, sinkID, sourceID, domainSinkID, domainSourceID, controlDomainID, gatewayID FROM " + std::string(GATEWAY_TABLE);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2563,13 +2565,13 @@ am_Error_e CAmDatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listG
{
logError("DatabaseHandler::getListGateways database error with convertionFormat");
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
temp.convertionMatrix = iter->second;
//read out the connectionFormats
std::string commandConnectionFormat = "SELECT soundFormat FROM GatewaySourceFormat" + i2s(temp.gatewayID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSourceConnectionFormat, NULL);
while ((eCode = sqlite3_step(qSourceConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qSourceConnectionFormat, 0);
@@ -2580,12 +2582,12 @@ am_Error_e CAmDatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listG
{
logError("DatabaseHandler::getListGateways SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//read out sound properties
commandConnectionFormat = "SELECT soundFormat FROM GatewaySinkFormat" + i2s(temp.gatewayID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qSinkConnectionFormat, NULL);
while ((eCode = sqlite3_step(qSinkConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qSinkConnectionFormat, 0);
@@ -2596,7 +2598,7 @@ am_Error_e CAmDatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listG
{
logError("DatabaseHandler::getListGateways SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
listGateways.push_back(temp);
@@ -2608,17 +2610,17 @@ am_Error_e CAmDatabaseHandler::getListGateways(std::vector<am_Gateway_s> & listG
{
logError("DatabaseHandler::getListGateways SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListGateways SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> & listSinkClasses) const
@@ -2632,7 +2634,7 @@ am_Error_e CAmDatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> &
std::string command = "SELECT sinkClassID, name FROM " + std::string(SINK_CLASS_TABLE);
std::string command2;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2641,7 +2643,7 @@ am_Error_e CAmDatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> &
//read out Properties
command2 = "SELECT classProperty, value FROM SinkClassProperties" + i2s(classTemp.sinkClassID);
- sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &subQuery, NULL);
+ sqlite3_prepare_v2(mpDatabase, command2.c_str(), -1, &subQuery, NULL);
while ((eCode = sqlite3_step(subQuery)) == SQLITE_ROW)
{
@@ -2654,14 +2656,14 @@ am_Error_e CAmDatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> &
{
logError("DatabaseHandler::getListSourceClasses SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(subQuery)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
listSinkClasses.push_back(classTemp);
}
@@ -2670,17 +2672,17 @@ am_Error_e CAmDatabaseHandler::getListSinkClasses(std::vector<am_SinkClass_s> &
{
logError("DatabaseHandler::getListSourceClasses SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSourceClasses SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListVisibleMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
@@ -2691,7 +2693,7 @@ am_Error_e CAmDatabaseHandler::getListVisibleMainConnections(std::vector<am_Main
am_MainConnectionType_s temp;
std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2707,17 +2709,17 @@ am_Error_e CAmDatabaseHandler::getListVisibleMainConnections(std::vector<am_Main
{
logError("DatabaseHandler::getListVisibleMainConnections SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListVisibleMainConnections SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListMainSinks(std::vector<am_SinkType_s> & listMainSinks) const
@@ -2728,7 +2730,7 @@ am_Error_e CAmDatabaseHandler::getListMainSinks(std::vector<am_SinkType_s> & lis
am_SinkType_s temp;
std::string command = "SELECT name, sinkID, availability, availabilityReason, muteState, mainVolume, sinkClassID FROM " + std::string(SINK_TABLE) + " WHERE visible=1 AND reserved=0";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2746,17 +2748,17 @@ am_Error_e CAmDatabaseHandler::getListMainSinks(std::vector<am_SinkType_s> & lis
{
logError("DatabaseHandler::getListSinks SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSinks SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListMainSources(std::vector<am_SourceType_s> & listMainSources) const
@@ -2766,7 +2768,7 @@ am_Error_e CAmDatabaseHandler::getListMainSources(std::vector<am_SourceType_s> &
int eCode = 0;
am_SourceType_s temp;
std::string command = "SELECT name, sourceClassID, availability, availabilityReason, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE visible=1";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2783,31 +2785,31 @@ am_Error_e CAmDatabaseHandler::getListMainSources(std::vector<am_SourceType_s> &
{
logError("DatabaseHandler::getListSources SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s> & listSoundProperties) const
{
assert(sinkID!=0);
if (!existSink(sinkID))
- return E_DATABASE_ERROR; // todo: here we could change to non existen, but not shown in sequences
+ return (E_DATABASE_ERROR); // todo: here we could change to non existen, but not shown in sequences
listSoundProperties.clear();
sqlite3_stmt* query = NULL;
int eCode = 0;
am_MainSoundProperty_s temp;
std::string command = "SELECT soundPropertyType, value FROM SinkMainSoundProperty" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2820,31 +2822,31 @@ am_Error_e CAmDatabaseHandler::getListMainSinkSoundProperties(const am_sinkID_t
{
logError("DatabaseHandler::getListMainSinkSoundProperties SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListMainSinkSoundProperties SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s> & listSourceProperties) const
{
assert(sourceID!=0);
if (!existSource(sourceID))
- return E_DATABASE_ERROR; // todo: here we could change to non existen, but not shown in sequences
+ return (E_DATABASE_ERROR); // todo: here we could change to non existen, but not shown in sequences
listSourceProperties.clear();
sqlite3_stmt* query = NULL;
int eCode = 0;
am_MainSoundProperty_s temp;
std::string command = "SELECT soundPropertyType, value FROM SourceMainSoundProperty" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2857,17 +2859,17 @@ am_Error_e CAmDatabaseHandler::getListMainSourceSoundProperties(const am_sourceI
{
logError("DatabaseHandler::getListMainSinkSoundProperties SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListMainSinkSoundProperties SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getListSystemProperties(std::vector<am_SystemProperty_s> & listSystemProperties) const
@@ -2878,7 +2880,7 @@ am_Error_e CAmDatabaseHandler::getListSystemProperties(std::vector<am_SystemProp
int eCode = 0;
am_SystemProperty_s temp;
std::string command = "SELECT type, value FROM " + std::string(SYSTEM_TABLE);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2891,17 +2893,17 @@ am_Error_e CAmDatabaseHandler::getListSystemProperties(std::vector<am_SystemProp
{
logError("DatabaseHandler::getListSystemProperties SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getListSystemProperties SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e am::CAmDatabaseHandler::getListSinkConnectionFormats(const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
@@ -2911,7 +2913,7 @@ am_Error_e am::CAmDatabaseHandler::getListSinkConnectionFormats(const am_sinkID_
int eCode = 0;
am_ConnectionFormat_e tempConnectionFormat;
std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
@@ -2922,10 +2924,10 @@ am_Error_e am::CAmDatabaseHandler::getListSinkConnectionFormats(const am_sinkID_
{
logError("DatabaseHandler::getListSinkConnectionFormats SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e am::CAmDatabaseHandler::getListSourceConnectionFormats(const am_sourceID_t sourceID, std::vector<am_ConnectionFormat_e> & listConnectionFormats) const
@@ -2937,7 +2939,7 @@ am_Error_e am::CAmDatabaseHandler::getListSourceConnectionFormats(const am_sourc
//read out the connectionFormats
std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ sqlite3_prepare_v2(mpDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
{
tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
@@ -2948,10 +2950,10 @@ am_Error_e am::CAmDatabaseHandler::getListSourceConnectionFormats(const am_sourc
{
logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e am::CAmDatabaseHandler::getListGatewayConnectionFormats(const am_gatewayID_t gatewayID, std::vector<bool> & listConnectionFormat) const
@@ -2977,7 +2979,7 @@ am_Error_e CAmDatabaseHandler::getTimingInformation(const am_mainConnectionID_t
int eCode = 0;
std::string command = "SELECT delay FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -2988,43 +2990,43 @@ am_Error_e CAmDatabaseHandler::getTimingInformation(const am_mainConnectionID_t
{
logError("DatabaseHandler::getTimingInformation SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getTimingInformation SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if (delay == -1)
- return E_NOT_POSSIBLE;
+ return (E_NOT_POSSIBLE);
- return E_OK;
+ return (E_OK);
}
bool CAmDatabaseHandler::sqQuery(const std::string& query)
{
sqlite3_stmt* statement;
int eCode = 0;
- if ((eCode = sqlite3_exec(mDatabase, query.c_str(), NULL, &statement, NULL)) != SQLITE_OK)
+ if ((eCode = sqlite3_exec(mpDatabase, query.c_str(), NULL, &statement, NULL)) != SQLITE_OK)
{
logError("DatabaseHandler::sqQuery SQL Query failed:", query.c_str(), "error code:", eCode);
- return false;
+ return (false);
}
- return true;
+ return (true);
}
bool CAmDatabaseHandler::openDatabase()
{
- if (sqlite3_open_v2(mPath.c_str(), &mDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL) == SQLITE_OK)
+ if (sqlite3_open_v2(mPath.c_str(), &mpDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL) == SQLITE_OK)
{
logInfo("DatabaseHandler::openDatabase opened database");
- return true;
+ return (true);
}
logError("DatabaseHandler::openDatabase failed to open database");
- return false;
+ return (false);
}
am_Error_e CAmDatabaseHandler::changeDelayMainConnection(const am_timeSync_t & delay, const am_mainConnectionID_t & connectionID)
@@ -3034,16 +3036,16 @@ am_Error_e CAmDatabaseHandler::changeDelayMainConnection(const am_timeSync_t & d
sqlite3_stmt* query = NULL;
int eCode = 0;
std::string command = "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE delay=? AND mainConnectionID=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, delay);
sqlite3_bind_int(query, 2, connectionID);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
sqlite3_finalize(query);
- return E_OK;
+ return (E_OK);
}
command = "UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET delay=? WHERE mainConnectionID=?;";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, delay);
sqlite3_bind_int(query, 2, connectionID);
@@ -3051,20 +3053,20 @@ am_Error_e CAmDatabaseHandler::changeDelayMainConnection(const am_timeSync_t & d
{
logError("DatabaseHandler::changeDelayMainConnection SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeDelayMainConnection SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- if (mDatabaseObserver)
- mDatabaseObserver->timingInformationChanged(connectionID, delay);
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->timingInformationChanged(connectionID, delay);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::enterConnectionDB(const am_Connection_s& connection, am_connectionID_t& connectionID)
@@ -3078,7 +3080,7 @@ am_Error_e CAmDatabaseHandler::enterConnectionDB(const am_Connection_s& connecti
int eCode = 0;
std::string command = "INSERT INTO " + std::string(CONNECTION_TABLE) + "(sinkID, sourceID, delay, connectionFormat, reserved) VALUES (?,?,?,?,?)";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, connection.sinkID);
sqlite3_bind_int(query, 2, connection.sourceID);
sqlite3_bind_int(query, 3, connection.delay);
@@ -3089,20 +3091,20 @@ am_Error_e CAmDatabaseHandler::enterConnectionDB(const am_Connection_s& connecti
{
logError("DatabaseHandler::enterConnectionDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterConnectionDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- connectionID = sqlite3_last_insert_rowid(mDatabase);
+ connectionID = sqlite3_last_insert_rowid(mpDatabase);
logInfo("DatabaseHandler::enterConnectionDB entered new connection sourceID=", connection.sourceID, "sinkID=", connection.sinkID, "sourceID=", connection.sourceID, "connectionFormat=", connection.connectionFormat, "assigned ID=", connectionID);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass, am_sinkClass_t & sinkClassID)
@@ -3123,11 +3125,11 @@ am_Error_e CAmDatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass
{
//check if the ID already exists
if (existSinkClass(sinkClass.sinkClassID))
- return E_ALREADY_EXISTS;
+ return (E_ALREADY_EXISTS);
command = "INSERT INTO " + std::string(SINK_CLASS_TABLE) + "(name, sinkClassID) VALUES (?,?)";
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, sinkClass.name.c_str(), sinkClass.name.size(), SQLITE_STATIC);
//if the ID is not created, we add it to the query
@@ -3147,17 +3149,17 @@ am_Error_e CAmDatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass
{
logError("DatabaseHandler::enterSinkClassDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterSinkClassDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- sinkClassID = sqlite3_last_insert_rowid(mDatabase); //todo:change last_insert implementations for mulithread usage...
+ sinkClassID = sqlite3_last_insert_rowid(mpDatabase); //todo:change last_insert implementations for mulithread usage...
//now we need to create the additional tables:
command = "CREATE TABLE SinkClassProperties" + i2s(sinkClassID) + std::string("(classProperty INTEGER, value INTEGER)");
@@ -3165,7 +3167,7 @@ am_Error_e CAmDatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass
//fill ConnectionFormats
command = "INSERT INTO SinkClassProperties" + i2s(sinkClassID) + std::string("(classProperty,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_ClassProperty_s>::const_iterator Iterator = sinkClass.listClassProperties.begin();
for (; Iterator < sinkClass.listClassProperties.end(); ++Iterator)
{
@@ -3175,7 +3177,7 @@ am_Error_e CAmDatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass
{
logError("DatabaseHandler::enterSinkClassDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -3184,13 +3186,13 @@ am_Error_e CAmDatabaseHandler::enterSinkClassDB(const am_SinkClass_s & sinkClass
{
logError("DatabaseHandler::enterSinkClassDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::enterSinkClassDB entered new sinkClass");
- if (mDatabaseObserver)
- mDatabaseObserver->numberOfSinkClassesChanged();
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->numberOfSinkClassesChanged();
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClassID, const am_SourceClass_s & sourceClass)
@@ -3211,11 +3213,11 @@ am_Error_e CAmDatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClass
{
//check if the ID already exists
if (existSourceClass(sourceClass.sourceClassID))
- return E_ALREADY_EXISTS;
+ return (E_ALREADY_EXISTS);
command = "INSERT INTO " + std::string(SOURCE_CLASS_TABLE) + "(name, sourceClassID) VALUES (?,?)";
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, sourceClass.name.c_str(), sourceClass.name.size(), SQLITE_STATIC);
//if the ID is not created, we add it to the query
@@ -3235,17 +3237,17 @@ am_Error_e CAmDatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClass
{
logError("DatabaseHandler::enterSourceClassDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::enterSourceClassDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- sourceClassID = sqlite3_last_insert_rowid(mDatabase); //todo:change last_insert implementations for mulithread usage...
+ sourceClassID = sqlite3_last_insert_rowid(mpDatabase); //todo:change last_insert implementations for mulithread usage...
//now we need to create the additional tables:
command = "CREATE TABLE SourceClassProperties" + i2s(sourceClassID) + std::string("(classProperty INTEGER, value INTEGER)");
@@ -3253,7 +3255,7 @@ am_Error_e CAmDatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClass
//fill ConnectionFormats
command = "INSERT INTO SourceClassProperties" + i2s(sourceClassID) + std::string("(classProperty,value) VALUES (?,?)");
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
std::vector<am_ClassProperty_s>::const_iterator Iterator = sourceClass.listClassProperties.begin();
for (; Iterator < sourceClass.listClassProperties.end(); ++Iterator)
{
@@ -3263,7 +3265,7 @@ am_Error_e CAmDatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClass
{
logError("DatabaseHandler::enterSourceClassDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
}
@@ -3272,14 +3274,14 @@ am_Error_e CAmDatabaseHandler::enterSourceClassDB(am_sourceClass_t & sourceClass
{
logError("DatabaseHandler::enterSourceClassDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::enterSourceClassDB entered new sourceClass");
- if (mDatabaseObserver)
- mDatabaseObserver->numberOfSourceClassesChanged();
- return E_OK;
+ if (mpDatabaseObserver)
+ mpDatabaseObserver->numberOfSourceClassesChanged();
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::enterSystemProperties(const std::vector<am_SystemProperty_s> & listSystemProperties)
@@ -3293,7 +3295,7 @@ am_Error_e CAmDatabaseHandler::enterSystemProperties(const std::vector<am_System
command = "INSERT INTO " + std::string(SYSTEM_TABLE) + " (type, value) VALUES (?,?)";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
for (; listIterator < listSystemProperties.end(); ++listIterator)
{
sqlite3_bind_int(query, 1, listIterator->type);
@@ -3303,7 +3305,7 @@ am_Error_e CAmDatabaseHandler::enterSystemProperties(const std::vector<am_System
{
logError("DatabaseHandler::enterSystemProperties SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
sqlite3_reset(query);
@@ -3313,20 +3315,25 @@ am_Error_e CAmDatabaseHandler::enterSystemProperties(const std::vector<am_System
{
logError("DatabaseHandler::enterSystemProperties SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::enterSystemProperties entered system properties");
- return E_OK;
+ return (E_OK);
}
+/**
+ * checks for a certain mainConnection
+ * @param mainConnectionID to be checked for
+ * @return true if it exists
+ */
bool CAmDatabaseHandler::existMainConnection(const am_mainConnectionID_t mainConnectionID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE) + " WHERE mainConnectionID=" + i2s(mainConnectionID);
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
else if (eCode != SQLITE_ROW)
@@ -3335,16 +3342,21 @@ bool CAmDatabaseHandler::existMainConnection(const am_mainConnectionID_t mainCon
logError("DatabaseHandler::existMainConnection database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks for a certain Source
+ * @param sourceID to be checked for
+ * @return true if it exists
+ */
bool CAmDatabaseHandler::existSource(const am_sourceID_t sourceID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID);
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
else if (eCode != SQLITE_ROW)
@@ -3353,16 +3365,22 @@ bool CAmDatabaseHandler::existSource(const am_sourceID_t sourceID) const
logError("DatabaseHandler::existSource database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks if a source name or ID exists
+ * @param sourceID the sourceID
+ * @param name the name
+ * @return true if it exits
+ */
bool CAmDatabaseHandler::existSourceNameOrID(const am_sourceID_t sourceID, const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND (name=? OR sourceID=?)";
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
sqlite3_bind_int(query, 2, sourceID);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
@@ -3373,16 +3391,21 @@ bool CAmDatabaseHandler::existSourceNameOrID(const am_sourceID_t sourceID, const
logError("DatabaseHandler::existSource database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks if a name exits
+ * @param name the name
+ * @return true if it exits
+ */
bool CAmDatabaseHandler::existSourceName(const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND name=?";
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
@@ -3392,16 +3415,21 @@ bool CAmDatabaseHandler::existSourceName(const std::string & name) const
logError("DatabaseHandler::existSource database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks for a certain Sink
+ * @param sinkID to be checked for
+ * @return true if it exists
+ */
bool CAmDatabaseHandler::existSink(const am_sinkID_t sinkID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
else if (eCode != SQLITE_ROW)
@@ -3410,16 +3438,22 @@ bool CAmDatabaseHandler::existSink(const am_sinkID_t sinkID) const
logError("DatabaseHandler::existSink database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks if a sink with the ID or the name exists
+ * @param sinkID the ID
+ * @param name the name
+ * @return true if it exists.
+ */
bool CAmDatabaseHandler::existSinkNameOrID(const am_sinkID_t sinkID, const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND (name=? OR sinkID=?)";
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
sqlite3_bind_int(query, 2, sinkID);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
@@ -3430,16 +3464,21 @@ bool CAmDatabaseHandler::existSinkNameOrID(const am_sinkID_t sinkID, const std::
logError("DatabaseHandler::existSink database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks if a sink with the name exists
+ * @param name the name
+ * @return true if it exists
+ */
bool CAmDatabaseHandler::existSinkName(const std::string & name) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND name=?";
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
@@ -3449,16 +3488,21 @@ bool CAmDatabaseHandler::existSinkName(const std::string & name) const
logError("DatabaseHandler::existSink database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks for a certain domain
+ * @param domainID to be checked for
+ * @return true if it exists
+ */
bool CAmDatabaseHandler::existDomain(const am_domainID_t domainID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE reserved=0 AND domainID=" + i2s(domainID);
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
else if (eCode != SQLITE_ROW)
@@ -3467,16 +3511,21 @@ bool CAmDatabaseHandler::existDomain(const am_domainID_t domainID) const
logError("DatabaseHandler::existDomain database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks for certain gateway
+ * @param gatewayID to be checked for
+ * @return true if it exists
+ */
bool CAmDatabaseHandler::existGateway(const am_gatewayID_t gatewayID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT gatewayID FROM " + std::string(GATEWAY_TABLE) + " WHERE gatewayID=" + i2s(gatewayID);
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
else if (eCode != SQLITE_ROW)
@@ -3485,7 +3534,7 @@ bool CAmDatabaseHandler::existGateway(const am_gatewayID_t gatewayID) const
logError("DatabaseHandler::existGateway database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
am_Error_e CAmDatabaseHandler::getDomainOfSource(const am_sourceID_t sourceID, am_domainID_t & domainID) const
@@ -3496,7 +3545,7 @@ am_Error_e CAmDatabaseHandler::getDomainOfSource(const am_sourceID_t sourceID, a
std::string command = "SELECT domainID FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
int eCode = 0;
am_Error_e returnVal = E_DATABASE_ERROR;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
domainID = sqlite3_column_int(query, 0);
@@ -3518,7 +3567,7 @@ am_Error_e am::CAmDatabaseHandler::getDomainOfSink(const am_sinkID_t sinkID, am_
std::string command = "SELECT domainID FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
int eCode = 0;
am_Error_e returnVal = E_DATABASE_ERROR;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
domainID = sqlite3_column_int(query, 0);
@@ -3532,13 +3581,18 @@ am_Error_e am::CAmDatabaseHandler::getDomainOfSink(const am_sinkID_t sinkID, am_
return (returnVal);
}
+/**
+ * checks for certain SinkClass
+ * @param sinkClassID
+ * @return true if it exists
+ */
bool CAmDatabaseHandler::existSinkClass(const am_sinkClass_t sinkClassID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sinkClassID FROM " + std::string(SINK_CLASS_TABLE) + " WHERE sinkClassID=" + i2s(sinkClassID);
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
else if (eCode != SQLITE_ROW)
@@ -3547,16 +3601,21 @@ bool CAmDatabaseHandler::existSinkClass(const am_sinkClass_t sinkClassID) const
logError("DatabaseHandler::existSinkClass database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks for certain sourceClass
+ * @param sourceClassID
+ * @return true if it exists
+ */
bool CAmDatabaseHandler::existSourceClass(const am_sourceClass_t sourceClassID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE sourceClassID=" + i2s(sourceClassID);
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
else if (eCode != SQLITE_ROW)
@@ -3565,7 +3624,7 @@ bool CAmDatabaseHandler::existSourceClass(const am_sourceClass_t sourceClassID)
logError("DatabaseHandler::existSinkClass database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
am_Error_e CAmDatabaseHandler::changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay)
@@ -3576,7 +3635,7 @@ am_Error_e CAmDatabaseHandler::changeConnectionTimingInformation(const am_connec
int eCode = 0, eCode1 = 0;
std::string command = "UPDATE " + std::string(CONNECTION_TABLE) + " set delay=? WHERE connectionID=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, delay);
sqlite3_bind_int(query, 2, connectionID);
@@ -3584,14 +3643,14 @@ am_Error_e CAmDatabaseHandler::changeConnectionTimingInformation(const am_connec
{
logError("DatabaseHandler::changeConnectionTimingInformation SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeConnectionTimingInformation SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
//now we need to find all mainConnections that use the changed connection and update their timing
@@ -3599,14 +3658,14 @@ am_Error_e CAmDatabaseHandler::changeConnectionTimingInformation(const am_connec
int tempMainConnectionID;
//first get all route tables for all mainconnections
command = "SELECT name FROM sqlite_master WHERE type ='table' and name LIKE 'MainConnectionRoute%'";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryMainConnections, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &queryMainConnections, NULL);
while ((eCode = sqlite3_step(queryMainConnections)) == SQLITE_ROW)
{
//now check if the connection ID is in this table
std::string tablename = std::string((const char*) sqlite3_column_text(queryMainConnections, 0));
std::string command2 = "SELECT connectionID FROM " + tablename + " WHERE connectionID=" + i2s(connectionID);
- sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &queryMainConnectionSubIDs, NULL);
+ sqlite3_prepare_v2(mpDatabase, command2.c_str(), -1, &queryMainConnectionSubIDs, NULL);
if ((eCode1 = sqlite3_step(queryMainConnectionSubIDs)) == SQLITE_ROW)
{
//if the connection ID is in, recalculate the mainconnection delay
@@ -3617,7 +3676,7 @@ am_Error_e CAmDatabaseHandler::changeConnectionTimingInformation(const am_connec
{
logError("DatabaseHandler::changeConnectionTimingInformation SQLITE error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
}
@@ -3625,17 +3684,17 @@ am_Error_e CAmDatabaseHandler::changeConnectionTimingInformation(const am_connec
{
logError("DatabaseHandler::changeConnectionTimingInformation SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(queryMainConnections)) != SQLITE_OK)
{
logError("DatabaseHandler::changeConnectionTimingInformation SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeConnectionFinal(const am_connectionID_t connectionID)
@@ -3646,23 +3705,23 @@ am_Error_e CAmDatabaseHandler::changeConnectionFinal(const am_connectionID_t con
int eCode = 0;
std::string command = "UPDATE " + std::string(CONNECTION_TABLE) + " set reserved=0 WHERE connectionID=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, connectionID);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeConnectionFinal SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeConnectionFinal SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_timeSync_t CAmDatabaseHandler::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
@@ -3673,7 +3732,7 @@ am_timeSync_t CAmDatabaseHandler::calculateMainConnectionDelay(const am_mainConn
int eCode = 0;
am_timeSync_t delay = 0;
am_timeSync_t min = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
delay = sqlite3_column_int(query, 0);
@@ -3683,27 +3742,36 @@ am_timeSync_t CAmDatabaseHandler::calculateMainConnectionDelay(const am_mainConn
{
logError("DatabaseHandler::calculateMainConnectionDelay SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::calculateMainConnectionDelay SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if (min < 0)
delay = -1;
- return delay;
+ return (delay);
}
+/**
+ * registers the Observer at the Database
+ * @param iObserver pointer to the observer
+ */
void CAmDatabaseHandler::registerObserver(CAmDatabaseObserver *iObserver)
{
assert(iObserver!=NULL);
- mDatabaseObserver = iObserver;
+ mpDatabaseObserver = iObserver;
}
+/**
+ * gives information about the visibility of a source
+ * @param sourceID the sourceID
+ * @return true if source is visible
+ */
bool CAmDatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
{
assert(sourceID!=0);
@@ -3711,7 +3779,7 @@ bool CAmDatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
std::string command = "SELECT visible FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
int eCode = 0;
bool returnVal = false;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
{
returnVal = (bool) sqlite3_column_int(query, 0);
@@ -3722,16 +3790,21 @@ bool CAmDatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
logError("DatabaseHandler::sourceVisible database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * gives information about the visibility of a sink
+ * @param sinkID the sinkID
+ * @return true if source is visible
+ */
bool CAmDatabaseHandler::sinkVisible(const am_sinkID_t sinkID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT visible FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 AND sinkID=" + i2s(sinkID);
int eCode = 0;
bool returnVal = false;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
{
returnVal = sqlite3_column_int(query, 0);
@@ -3742,16 +3815,22 @@ bool CAmDatabaseHandler::sinkVisible(const am_sinkID_t sinkID) const
logError("DatabaseHandler::sinkVisible database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks if a connection already exists.
+ * Only takes sink, source and format information for search!
+ * @param connection the connection to be checked
+ * @return true if connections exists
+ */
bool CAmDatabaseHandler::existConnection(const am_Connection_s connection)
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE sinkID=? AND sourceID=? AND connectionFormat=? AND reserved=0";
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, connection.sinkID);
sqlite3_bind_int(query, 2, connection.sourceID);
sqlite3_bind_int(query, 3, connection.connectionFormat);
@@ -3763,16 +3842,21 @@ bool CAmDatabaseHandler::existConnection(const am_Connection_s connection)
logError("DatabaseHandler::existMainConnection database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks if a connection with the given ID exists
+ * @param connectionID
+ * @return true if connection exits
+ */
bool CAmDatabaseHandler::existConnectionID(const am_connectionID_t connectionID)
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT connectionID FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=? AND reserved=0";
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, connectionID);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
@@ -3782,16 +3866,21 @@ bool CAmDatabaseHandler::existConnectionID(const am_connectionID_t connectionID)
logError("DatabaseHandler::existMainConnection database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
+/**
+ * checks if a CrossFader exists
+ * @param crossfaderID the ID of the crossfader to be checked
+ * @return true if exists
+ */
bool CAmDatabaseHandler::existcrossFader(const am_crossfaderID_t crossfaderID) const
{
sqlite3_stmt* query = NULL;
std::string command = "SELECT crossfaderID FROM " + std::string(CROSSFADER_TABLE) + " WHERE crossfaderID=?";
int eCode = 0;
bool returnVal = true;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, crossfaderID);
if ((eCode = sqlite3_step(query)) == SQLITE_DONE)
returnVal = false;
@@ -3801,7 +3890,7 @@ bool CAmDatabaseHandler::existcrossFader(const am_crossfaderID_t crossfaderID) c
logError("DatabaseHandler::existMainConnection database error!:", eCode);
}
sqlite3_finalize(query);
- return returnVal;
+ return (returnVal);
}
am_Error_e CAmDatabaseHandler::getSoureState(const am_sourceID_t sourceID, am_SourceState_e & sourceState) const
@@ -3811,7 +3900,7 @@ am_Error_e CAmDatabaseHandler::getSoureState(const am_sourceID_t sourceID, am_So
sourceState = SS_UNKNNOWN;
std::string command = "SELECT sourceState FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
int eCode = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
sourceState = (am_SourceState_e) sqlite3_column_int(query, 0);
@@ -3821,7 +3910,7 @@ am_Error_e CAmDatabaseHandler::getSoureState(const am_sourceID_t sourceID, am_So
logError("DatabaseHandler::getSoureState database error!:", eCode);
}
sqlite3_finalize(query);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState)
@@ -3831,22 +3920,22 @@ am_Error_e CAmDatabaseHandler::changeSourceState(const am_sourceID_t sourceID, c
sqlite3_stmt* query = NULL;
std::string command = "UPDATE " + std::string(SOURCE_TABLE) + " SET sourceState=? WHERE sourceID=" + i2s(sourceID);
int eCode = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, sourceState);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSourceState SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSourceState SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume_t & volume) const
@@ -3856,7 +3945,7 @@ am_Error_e CAmDatabaseHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume
volume = -1;
std::string command = "SELECT volume FROM " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID);
int eCode = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
volume = sqlite3_column_int(query, 0);
@@ -3866,7 +3955,7 @@ am_Error_e CAmDatabaseHandler::getSinkVolume(const am_sinkID_t sinkID, am_volume
logError("DatabaseHandler::getSinkVolume database error!:", eCode);
}
sqlite3_finalize(query);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_volume_t & volume) const
@@ -3876,7 +3965,7 @@ am_Error_e CAmDatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_
volume = -1;
std::string command = "SELECT volume FROM " + std::string(SOURCE_TABLE) + " WHERE sourceID=" + i2s(sourceID);
int eCode = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
volume = sqlite3_column_int(query, 0);
@@ -3886,19 +3975,19 @@ am_Error_e CAmDatabaseHandler::getSourceVolume(const am_sourceID_t sourceID, am_
logError("DatabaseHandler::getSourceVolume database error!:", eCode);
}
sqlite3_finalize(query);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_SoundPropertyType_e propertyType, uint16_t & value) const
{
assert(sinkID!=0);
if (!existSink(sinkID))
- return E_DATABASE_ERROR; // todo: here we could change to non existent, but not shown in sequences
+ return (E_DATABASE_ERROR); // todo: here we could change to non existent, but not shown in sequences
sqlite3_stmt* query = NULL;
int eCode = 0;
std::string command = "SELECT value FROM SinkSoundProperty" + i2s(sinkID) + " WHERE soundPropertyType=" + i2s(propertyType);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -3909,29 +3998,29 @@ am_Error_e CAmDatabaseHandler::getSinkSoundPropertyValue(const am_sinkID_t sinkI
{
logError("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSinkSoundPropertyValue SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_SoundPropertyType_e propertyType, uint16_t & value) const
{
assert(sourceID!=0);
if (!existSource(sourceID))
- return E_DATABASE_ERROR; // todo: here we could change to non existent, but not shown in sequences
+ return (E_DATABASE_ERROR); // todo: here we could change to non existent, but not shown in sequences
sqlite3_stmt* query = NULL;
int eCode = 0;
std::string command = "SELECT value FROM SourceSoundProperty" + i2s(sourceID) + " WHERE soundPropertyType=" + i2s(propertyType);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -3942,17 +4031,17 @@ am_Error_e CAmDatabaseHandler::getSourceSoundPropertyValue(const am_sourceID_t s
{
logError("DatabaseHandler::getSinkSoundPropertyValue SQLITE error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::getSinkSoundPropertyValue SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getDomainState(const am_domainID_t domainID, am_DomainState_e state) const
@@ -3962,7 +4051,7 @@ am_Error_e CAmDatabaseHandler::getDomainState(const am_domainID_t domainID, am_D
state = DS_UNKNOWN;
std::string command = "SELECT domainState FROM " + std::string(DOMAIN_TABLE) + " WHERE domainID=" + i2s(domainID);
int eCode = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
state = (am_DomainState_e) sqlite3_column_int(query, 0);
@@ -3972,7 +4061,7 @@ am_Error_e CAmDatabaseHandler::getDomainState(const am_domainID_t domainID, am_D
logError("DatabaseHandler::getDomainState database error!:", eCode);
}
sqlite3_finalize(query);
- return E_OK;
+ return (E_OK);
}
@@ -3981,7 +4070,7 @@ am_Error_e CAmDatabaseHandler::peekDomain(const std::string & name, am_domainID_
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT domainID FROM " + std::string(DOMAIN_TABLE) + " WHERE name=?";
int eCode = 0, eCode1 = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -3990,29 +4079,29 @@ am_Error_e CAmDatabaseHandler::peekDomain(const std::string & name, am_domainID_
else if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::peekDomain database error!:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
else
{
command = "INSERT INTO " + std::string(DOMAIN_TABLE) + " (name,reserved) VALUES (?,?)";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryInsert, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &queryInsert, NULL);
sqlite3_bind_text(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC);
sqlite3_bind_int(queryInsert, 2, 1); //reservation flag
if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
{
logError("DatabaseHandler::peekDomain SQLITE Step error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode1 = sqlite3_finalize(queryInsert)) != SQLITE_OK)
{
logError("DatabaseHandler::peekDomain SQLITE Finalize error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- domainID = sqlite3_last_insert_rowid(mDatabase);
+ domainID = sqlite3_last_insert_rowid(mpDatabase);
}
sqlite3_finalize(query);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::peekSink(const std::string & name, am_sinkID_t & sinkID)
@@ -4020,7 +4109,7 @@ am_Error_e CAmDatabaseHandler::peekSink(const std::string & name, am_sinkID_t &
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT sinkID FROM " + std::string(SINK_TABLE) + " WHERE name=?";
int eCode = 0, eCode1 = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -4029,7 +4118,7 @@ am_Error_e CAmDatabaseHandler::peekSink(const std::string & name, am_sinkID_t &
else if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::peekSink database error!:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
else
{
@@ -4042,24 +4131,24 @@ am_Error_e CAmDatabaseHandler::peekSink(const std::string & name, am_sinkID_t &
{
command = "INSERT INTO " + std::string(SINK_TABLE) + " (name,reserved) VALUES (?,?)";
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryInsert, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &queryInsert, NULL);
sqlite3_bind_text(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC);
sqlite3_bind_int(queryInsert, 2, 1); //reservation flag
if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
{
logError("DatabaseHandler::peekSink SQLITE Step error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode1 = sqlite3_finalize(queryInsert)) != SQLITE_OK)
{
logError("DatabaseHandler::peekDomain SQLITE Finalize error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- sinkID = sqlite3_last_insert_rowid(mDatabase);
+ sinkID = sqlite3_last_insert_rowid(mpDatabase);
}
sqlite3_finalize(query);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::peekSource(const std::string & name, am_sourceID_t & sourceID)
@@ -4067,7 +4156,7 @@ am_Error_e CAmDatabaseHandler::peekSource(const std::string & name, am_sourceID_
sqlite3_stmt* query = NULL, *queryInsert = NULL;
std::string command = "SELECT sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE name=?";
int eCode = 0, eCode1 = 0;
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
@@ -4076,7 +4165,7 @@ am_Error_e CAmDatabaseHandler::peekSource(const std::string & name, am_sourceID_
else if (eCode != SQLITE_DONE)
{
logError("DatabaseHandler::peekSink database error!:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
else
{
@@ -4089,24 +4178,24 @@ am_Error_e CAmDatabaseHandler::peekSource(const std::string & name, am_sourceID_
{
command = "INSERT INTO " + std::string(SOURCE_TABLE) + " (name,reserved) VALUES (?,?)";
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &queryInsert, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &queryInsert, NULL);
sqlite3_bind_text(queryInsert, 1, name.c_str(), name.size(), SQLITE_STATIC);
sqlite3_bind_int(queryInsert, 2, 1); //reservation flag
if ((eCode1 = sqlite3_step(queryInsert)) != SQLITE_DONE)
{
logError("DatabaseHandler::peekSink SQLITE Step error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode1 = sqlite3_finalize(queryInsert)) != SQLITE_OK)
{
logError("DatabaseHandler::peekDomain SQLITE Finalize error code:", eCode1);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
- sourceID = sqlite3_last_insert_rowid(mDatabase);
+ sourceID = sqlite3_last_insert_rowid(mpDatabase);
}
sqlite3_finalize(query);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume)
@@ -4119,27 +4208,27 @@ am_Error_e CAmDatabaseHandler::changeSinkVolume(const am_sinkID_t sinkID, const
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(SINK_TABLE) + " SET volume=? WHERE sinkID=" + i2s(sinkID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, volume);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSinkVolume SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSinkVolume SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSinkVolume changed volume of sink:", sinkID, "to:", volume);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume)
@@ -4152,27 +4241,27 @@ am_Error_e CAmDatabaseHandler::changeSourceVolume(const am_sourceID_t sourceID,
if (!existSource(sourceID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(SOURCE_TABLE) + " SET volume=? WHERE sourceID=" + i2s(sourceID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, volume);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSourceVolume SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSourceVolume SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSourceVolume changed volume of source=:", sourceID, "to:", volume);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSourceSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sourceID_t sourceID)
@@ -4186,28 +4275,28 @@ am_Error_e CAmDatabaseHandler::changeSourceSoundPropertyDB(const am_SoundPropert
if (!existSource(sourceID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE SourceSoundProperty" + i2s(sourceID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, soundProperty.value);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSourceSoundPropertyDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSourceSoundPropertyDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSourceSoundPropertyDB changed SourceSoundProperty of source:", sourceID, "type:", soundProperty.type, "to:", soundProperty.value);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeSinkSoundPropertyDB(const am_SoundProperty_s & soundProperty, const am_sinkID_t sinkID)
@@ -4221,26 +4310,27 @@ am_Error_e CAmDatabaseHandler::changeSinkSoundPropertyDB(const am_SoundProperty_
if (!existSink(sinkID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE SinkSoundProperty" + i2s(sinkID) + " SET value=? WHERE soundPropertyType=" + i2s(soundProperty.type);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, soundProperty.value);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeSinkSoundPropertyDB SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
- }assert(sinkID!=0);
+ return (E_DATABASE_ERROR);
+ }
+ assert(sinkID!=0);
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeSinkSoundPropertyDB SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeSinkSoundPropertyDB changed MainSinkSoundProperty of sink:", sinkID, "type:", soundProperty.type, "to:", soundProperty.value);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink)
@@ -4254,26 +4344,26 @@ am_Error_e CAmDatabaseHandler::changeCrossFaderHotSink(const am_crossfaderID_t c
if (!existcrossFader(crossfaderID))
{
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
command = "UPDATE " + std::string(CROSSFADER_TABLE) + " SET hotsink=? WHERE crossfaderID=" + i2s(crossfaderID);
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, hotsink);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
{
logError("DatabaseHandler::changeCrossFaderHotSink SQLITE Step error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
if ((eCode = sqlite3_finalize(query)) != SQLITE_OK)
{
logError("DatabaseHandler::changeCrossFaderHotSink SQLITE Finalize error code:", eCode);
- return E_DATABASE_ERROR;
+ return (E_DATABASE_ERROR);
}
logInfo("DatabaseHandler::changeCrossFaderHotSink changed hotsink of crossfader=", crossfaderID, "to:", hotsink);
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmDatabaseHandler::getRoutingTree(bool onlyfree, CAmRoutingTree& tree, std::vector<CAmRoutingTreeItem*>& flatTree)
@@ -4301,7 +4391,7 @@ am_Error_e CAmDatabaseHandler::getRoutingTree(bool onlyfree, CAmRoutingTree& tre
parent = flatTree.at(i - 1);
rootID = parent->returnDomainID();
}
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_int(query, 1, rootID);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
@@ -4331,13 +4421,13 @@ am_Error_e CAmDatabaseHandler::getRoutingTree(bool onlyfree, CAmRoutingTree& tre
am_Error_e am::CAmDatabaseHandler::peekSinkClassID(const std::string & name, am_sinkClass_t & sinkClassID)
{
if (name.empty())
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
am_Error_e returnVal = E_NON_EXISTENT;
sqlite3_stmt* query = NULL;
int eCode = 0;
std::string command = "SELECT sinkClassID FROM " + std::string(SINK_CLASS_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
@@ -4357,19 +4447,19 @@ am_Error_e am::CAmDatabaseHandler::peekSinkClassID(const std::string & name, am_
logError("DatabaseHandler::peekSinkClassID SQLITE Finalize error code:", eCode);
returnVal = E_DATABASE_ERROR;
}
- return returnVal;
+ return (returnVal);
}
am_Error_e am::CAmDatabaseHandler::peekSourceClassID(const std::string & name, am_sourceClass_t & sourceClassID)
{
if (name.empty())
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
am_Error_e returnVal = E_NON_EXISTENT;
sqlite3_stmt* query = NULL;
int eCode = 0;
std::string command = "SELECT sourceClassID FROM " + std::string(SOURCE_CLASS_TABLE) + " WHERE name=?";
- sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+ sqlite3_prepare_v2(mpDatabase, command.c_str(), -1, &query, NULL);
sqlite3_bind_text(query, 1, name.c_str(), name.size(), SQLITE_STATIC);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
@@ -4389,7 +4479,7 @@ am_Error_e am::CAmDatabaseHandler::peekSourceClassID(const std::string & name, a
logError("DatabaseHandler::peekSourceClassID SQLITE Finalize error code:", eCode);
returnVal = E_DATABASE_ERROR;
}
- return returnVal;
+ return (returnVal);
}
void CAmDatabaseHandler::createTables()
diff --git a/AudioManagerDaemon/src/CAmDatabaseObserver.cpp b/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
index 9bbc275..775b239 100644
--- a/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
+++ b/AudioManagerDaemon/src/CAmDatabaseObserver.cpp
@@ -1,24 +1,22 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmDatabaseObserver.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * 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 statiasyncCally or dynamiasyncCally 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 CAmDatabaseObserver.cpp
+ * For further information see http://www.genivi.org/.
*
*/
diff --git a/AudioManagerDaemon/src/CAmDbusWrapper.cpp b/AudioManagerDaemon/src/CAmDbusWrapper.cpp
index 082d62f..6148edf 100644
--- a/AudioManagerDaemon/src/CAmDbusWrapper.cpp
+++ b/AudioManagerDaemon/src/CAmDbusWrapper.cpp
@@ -1,24 +1,22 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmSocketHandler.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
*
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ *
+ * \file CAmDbusWrapper.cpp
+ * For further information see http://www.genivi.org/.
*
*/
@@ -35,6 +33,9 @@
namespace am
{
+/**
+ * introspectio header
+ */
#define ROOT_INTROSPECT_XML \
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
"<node>" \
@@ -99,12 +100,12 @@ CAmDbusWrapper::CAmDbusWrapper(CAmSocketHandler* socketHandler) :
int ret = dbus_bus_request_name(mpDbusConnection, DBUS_SERVICE_PREFIX, DBUS_NAME_FLAG_DO_NOT_QUEUE, &mDBusError);
if (dbus_error_is_set(&mDBusError))
{
- logError("DBusWrapper::DBusWrapper Name Error",mDBusError.message);
+ logError("DBusWrapper::DBusWrapper Name Error", mDBusError.message);
dbus_error_free(&mDBusError);
}
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
{
- logError("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner ! Another instance already running?",ret);
+ logError("DBusWrapper::DBusWrapper Wrapper is not the Primary Owner ! Another instance already running?", ret);
exit(1);
}
}
@@ -123,9 +124,16 @@ CAmDbusWrapper::~CAmDbusWrapper()
}
}
+/**
+ * registers a callback that is entered as path below the main path.
+ * The configuration of the mainpath is done via DBusConfiguration.h
+ * @param vtable the vtable that holds a pointer to the callback that is called when the path is called from the dbus
+ * @param path the name of the path
+ * @param userdata pointer to the class that will handle the callback
+ */
void CAmDbusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const std::string& path, void* userdata)
{
- logInfo("DBusWrapper::~registerCallback register callback:",path);
+ logInfo("DBusWrapper::~registerCallback register callback:", path);
std::string completePath = std::string(DBUS_SERVICE_OBJECT_PATH) + "/" + path;
dbus_error_init(&mDBusError);
@@ -133,12 +141,19 @@ void CAmDbusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const
dbus_connection_register_object_path(mpDbusConnection, completePath.c_str(), vtable, userdata);
if (dbus_error_is_set(&mDBusError))
{
- logError("DBusWrapper::registerCallack error: ",mDBusError.message);
+ logError("DBusWrapper::registerCallack error: ", mDBusError.message);
dbus_error_free(&mDBusError);
}
mListNodes.push_back(path);
}
+/**
+ * internal callback for the root introspection
+ * @param conn
+ * @param msg
+ * @param reference
+ * @return
+ */
DBusHandlerResult CAmDbusWrapper::cbRootIntrospection(DBusConnection *conn, DBusMessage *msg, void *reference)
{
logInfo("DBusWrapper::~cbRootIntrospection called:");
@@ -180,14 +195,18 @@ DBusHandlerResult CAmDbusWrapper::cbRootIntrospection(DBusConnection *conn, DBus
// free the reply
dbus_message_unref(reply);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return (DBUS_HANDLER_RESULT_HANDLED);
}
else
{
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
}
}
+/**
+ * returns the dbus connection
+ * @param connection pointer to the connection
+ */
void CAmDbusWrapper::getDBusConnection(DBusConnection *& connection) const
{
connection = mpDbusConnection;
@@ -197,7 +216,7 @@ dbus_bool_t CAmDbusWrapper::addWatch(DBusWatch *watch, void *userData)
{
mpReference = (CAmDbusWrapper*) userData;
assert(mpReference!=0);
- return mpReference->addWatchDelegate(watch, userData);
+ return (mpReference->addWatchDelegate(watch, userData));
}
dbus_bool_t CAmDbusWrapper::addWatchDelegate(DBusWatch * watch, void* userData)
@@ -216,14 +235,14 @@ dbus_bool_t CAmDbusWrapper::addWatchDelegate(DBusWatch * watch, void* userData)
event |= POLLOUT;
}
- logInfo("DBusWrapper::addWatchDelegate entered new watch, fd=",dbus_watch_get_unix_fd(watch),"event flag=",event);
+ logInfo("DBusWrapper::addWatchDelegate entered new watch, fd=", dbus_watch_get_unix_fd(watch), "event flag=", event);
am_Error_e error = mpSocketHandler->addFDPoll(dbus_watch_get_unix_fd(watch), event, NULL, &pDbusFireCallback, &pDbusCheckCallback, &pDbusDispatchCallback, watch, handle);
//if everything is alright, add the watch and the handle to our map so we know this relationship
if (error == E_OK && handle != 0)
{
mMapHandleWatch.insert(std::make_pair(watch, handle));
- return true;
+ return (true);
}
logError("DBusWrapper::addWatchDelegate entering watch failed");
return (true);
@@ -243,7 +262,7 @@ void CAmDbusWrapper::removeWatchDelegate(DBusWatch *watch, void *userData)
iterator = mMapHandleWatch.find(watch);
if (iterator != mMapHandleWatch.end())
mpSocketHandler->removeFDPoll(iterator->second);
- logInfo("DBusWrapper::removeWatch removed watch with handle",iterator->second);
+ logInfo("DBusWrapper::removeWatch removed watch with handle", iterator->second);
mMapHandleWatch.erase(iterator);
}
@@ -279,13 +298,13 @@ dbus_bool_t CAmDbusWrapper::addTimeout(DBusTimeout *timeout, void* userData)
{
mpReference = (CAmDbusWrapper*) userData;
assert(mpReference!=0);
- return mpReference->addTimeoutDelegate(timeout, userData);
+ return (mpReference->addTimeoutDelegate(timeout, userData));
}
dbus_bool_t CAmDbusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userData)
{
if (!dbus_timeout_get_enabled(timeout))
- return false;
+ return (false);
//calculate the timeout in timeval
timespec pollTimeout;
@@ -296,7 +315,7 @@ dbus_bool_t CAmDbusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userD
//prepare handle and callback. new is eval, but there is no other choice because we need the pointer!
sh_timerHandle_t* handle = new sh_timerHandle_t;
mpListTimerhandles.push_back(handle);
- CAmShTimerCallBack* buffer = &pDbusTimerCallback;
+ IAmShTimerCallBack* buffer = &pDbusTimerCallback;
//add the timer to the pollLoop
mpSocketHandler->addTimer(pollTimeout, buffer, *handle, timeout);
@@ -307,7 +326,7 @@ dbus_bool_t CAmDbusWrapper::addTimeoutDelegate(DBusTimeout *timeout, void* userD
//save timeout in Socket context
userData = timeout;
logInfo("DBusWrapper::addTimeoutDelegate a timeout was added");
- return true;
+ return (true);
}
void CAmDbusWrapper::removeTimeout(DBusTimeout *timeout, void* userData)
@@ -354,8 +373,8 @@ bool am::CAmDbusWrapper::dbusDispatchCallback(const sh_pollHandle_t handle, void
if (dbus_connection_dispatch(mpDbusConnection) == DBUS_DISPATCH_COMPLETE)
returnVal = false;
dbus_connection_unref(mpDbusConnection);
-// logInfo("DBusWrapper::dbusDispatchCallback was called");
- return returnVal;
+ //logInfo("DBusWrapper::dbusDispatchCallback was called");
+ return (returnVal);
}
bool am::CAmDbusWrapper::dbusCheckCallback(const sh_pollHandle_t handle, void *userData)
@@ -367,8 +386,8 @@ bool am::CAmDbusWrapper::dbusCheckCallback(const sh_pollHandle_t handle, void *u
if (dbus_connection_get_dispatch_status(mpDbusConnection) == DBUS_DISPATCH_DATA_REMAINS)
returnVal = true;
dbus_connection_unref(mpDbusConnection);
-// logInfo("DBusWrapper::dbusCheckCallback was called");
- return returnVal;
+ //logInfo("DBusWrapper::dbusCheckCallback was called");
+ return (returnVal);
}
void am::CAmDbusWrapper::dbusFireCallback(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
@@ -392,7 +411,7 @@ void am::CAmDbusWrapper::dbusFireCallback(const pollfd pollfd, const sh_pollHand
dbus_connection_ref(mpDbusConnection);
dbus_watch_handle(watch, flags);
dbus_connection_unref(mpDbusConnection);
-// logInfo("DBusWrapper::dbusFireCallback was called");
+ //logInfo("DBusWrapper::dbusFireCallback was called");
}
void CAmDbusWrapper::toggleTimeoutDelegate(DBusTimeout *timeout, void* userData)
@@ -414,7 +433,8 @@ void CAmDbusWrapper::toggleTimeoutDelegate(DBusTimeout *timeout, void* userData)
else
{
mpSocketHandler->stopTimer(*handle);
- }logInfo("DBusWrapper::toggleTimeoutDelegate was called");
+ }
+ logInfo("DBusWrapper::toggleTimeoutDelegate was called");
}
void CAmDbusWrapper::dbusTimerCallback(sh_timerHandle_t handle, void *userData)
diff --git a/AudioManagerDaemon/src/CAmDltWrapper.cpp b/AudioManagerDaemon/src/CAmDltWrapper.cpp
index fc7e064..7890e64 100644
--- a/AudioManagerDaemon/src/CAmDltWrapper.cpp
+++ b/AudioManagerDaemon/src/CAmDltWrapper.cpp
@@ -1,30 +1,28 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmDltWrapper.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * 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 CAmDltWrapper.cpp
+ * For further information see http://www.genivi.org/.
*
*/
#include "shared/CAmDltWrapper.h"
-#include <string.h>
+#include <string>
#include <sstream>
#include <iostream>
@@ -41,7 +39,7 @@ CAmDltWrapper *CAmDltWrapper::instance(const bool enableNoDLTDebug)
if(enableNoDLTDebug)
mpDLTWrapper->enableNoDLTDebug(true);
#endif
- return mpDLTWrapper;
+ return (mpDLTWrapper);
}
void CAmDltWrapper::unregisterContext(DltContext & handle)
diff --git a/AudioManagerDaemon/src/CAmRouter.cpp b/AudioManagerDaemon/src/CAmRouter.cpp
index 265f77d..fd394a9 100644
--- a/AudioManagerDaemon/src/CAmRouter.cpp
+++ b/AudioManagerDaemon/src/CAmRouter.cpp
@@ -1,24 +1,22 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmRouter.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * 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 CAmRouter.cpp
+ * For further information see http://www.genivi.org/.
*
*/
@@ -33,22 +31,30 @@
namespace am {
CAmRouter::CAmRouter(CAmDatabaseHandler* iDatabaseHandler, CAmControlSender* iSender) :
- mDatabaseHandler(iDatabaseHandler), //
- mControlSender(iSender)
+ mpDatabaseHandler(iDatabaseHandler), //
+ mpControlSender(iSender)
{
- assert(mDatabaseHandler);
- assert(mControlSender);
+ assert(mpDatabaseHandler);
+ assert(mpControlSender);
}
+/**
+ * returns the best route between a source and a sink
+ * @param onlyfree if true only free gateways are used
+ * @param sourceID
+ * @param sinkID
+ * @param returnList this list contains a set of routes
+ * @return E_OK in case of success
+ */
am_Error_e CAmRouter::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
{
returnList.clear();
//first find out in which domains the source and sink are
am_domainID_t sourceDomainID;
am_domainID_t sinkDomainID;
- if (mDatabaseHandler->getDomainOfSource(sourceID, sourceDomainID) != E_OK)
+ if (mpDatabaseHandler->getDomainOfSource(sourceID, sourceDomainID) != E_OK)
return (E_NON_EXISTENT);
- if (mDatabaseHandler->getDomainOfSink(sinkID, sinkDomainID) != E_OK)
+ if (mpDatabaseHandler->getDomainOfSink(sinkID, sinkDomainID) != E_OK)
return (E_NON_EXISTENT);
if (sourceDomainID == sinkDomainID) //shortcut if the domains are the same...
@@ -64,11 +70,11 @@ am_Error_e CAmRouter::getRoute(const bool onlyfree, const am_sourceID_t sourceID
route.route.clear();
//get the prio of the Controller:
- mControlSender->getConnectionFormatChoice(sourceID, sinkID, route, listFormats, listPriorityConnectionFormats);
+ mpControlSender->getConnectionFormatChoice(sourceID, sinkID, route, listFormats, listPriorityConnectionFormats);
//no possible connection, so no route ! But we report OK since there is no fault ...
if (listPriorityConnectionFormats.empty())
- return E_OK;
+ return (E_OK);
//return the first item as route:
am_RoutingElement_s routingElement;
@@ -85,7 +91,7 @@ am_Error_e CAmRouter::getRoute(const bool onlyfree, const am_sourceID_t sourceID
//push it to the return list - we are done here ...
returnList.push_back(actualRoute);
- return E_OK;
+ return (E_OK);
}
CAmRoutingTree routingtree(sourceDomainID); //Build up a Tree from the Source_Domain to every other domain.
@@ -96,7 +102,7 @@ am_Error_e CAmRouter::getRoute(const bool onlyfree, const am_sourceID_t sourceID
am_Route_s actualRoute; //holds the actual Route
am_sourceID_t lastSource = 0;
- mDatabaseHandler->getRoutingTree(onlyfree, routingtree, flattree); //Build up the tree out of the database as
+ mpDatabaseHandler->getRoutingTree(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
std::vector<CAmRoutingTreeItem*>::iterator iterator = flattree.begin();
@@ -121,7 +127,7 @@ am_Error_e CAmRouter::getRoute(const bool onlyfree, const am_sourceID_t sourceID
for (; gatewayIterator != listGatewayID.end(); ++gatewayIterator)
{
am_Gateway_s gatewayData;
- if (mDatabaseHandler->getGatewayInfoDB(*gatewayIterator, gatewayData) != E_OK)
+ if (mpDatabaseHandler->getGatewayInfoDB(*gatewayIterator, gatewayData) != E_OK)
return (E_UNKNOWN);
//at the beginning of the route, we connect first the source to the first gateway
@@ -168,8 +174,8 @@ void CAmRouter::listPossibleConnectionFormats(const am_sourceID_t sourceID, cons
{
std::vector<am_ConnectionFormat_e> listSourceFormats;
std::vector<am_ConnectionFormat_e> listSinkFormats;
- mDatabaseHandler->getListSinkConnectionFormats(sinkID, listSinkFormats);
- mDatabaseHandler->getListSourceConnectionFormats(sourceID, listSourceFormats);
+ mpDatabaseHandler->getListSinkConnectionFormats(sinkID, listSinkFormats);
+ mpDatabaseHandler->getListSourceConnectionFormats(sourceID, listSourceFormats);
std::sort(listSinkFormats.begin(), listSinkFormats.end()); //todo: this might be not needed if we use strictly sorted input
std::sort(listSourceFormats.begin(), listSourceFormats.end()); //todo: this might be not needed if we use strictly sorted input
std::insert_iterator<std::vector<am_ConnectionFormat_e> > inserter(listFormats, listFormats.begin());
@@ -210,7 +216,7 @@ am_Error_e CAmRouter::findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, st
route.route = listRoute;
//let the controller decide:
- mControlSender->getConnectionFormatChoice(routeIterator->sourceID, routeIterator->sinkID, route, listMergeConnectionFormats, listPriorityConnectionFormats);
+ mpControlSender->getConnectionFormatChoice(routeIterator->sourceID, routeIterator->sinkID, route, listMergeConnectionFormats, listPriorityConnectionFormats);
//we have the list sorted after prios - now we try one after the other with the next part of the route
std::vector<am_ConnectionFormat_e>::iterator connectionFormatIterator = listPriorityConnectionFormats.begin();
@@ -221,10 +227,10 @@ am_Error_e CAmRouter::findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, st
if (!listPriorityConnectionFormats.empty())
{
routeIterator->connectionFormat = listPriorityConnectionFormats.front();
- return E_OK;
+ return (E_OK);
}
else
- return E_NOT_POSSIBLE;
+ return (E_NOT_POSSIBLE);
}
for (; connectionFormatIterator != listPriorityConnectionFormats.end(); ++connectionFormatIterator)
@@ -243,7 +249,7 @@ void CAmRouter::listRestrictedOutputFormatsGateways(const am_gatewayID_t gateway
{
listFormats.clear();
am_Gateway_s gatewayData;
- mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData);
+ mpDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData);
std::vector<am_ConnectionFormat_e>::const_iterator rowSinkIterator = gatewayData.listSinkFormats.begin();
std::vector<bool>::const_iterator matrixIterator = gatewayData.convertionMatrix.begin();
@@ -272,7 +278,7 @@ CAmRouter::~CAmRouter()
CAmRoutingTreeItem::CAmRoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, CAmRoutingTreeItem *parent) :
mDomainID(domainID), //
mGatewayID(gatewayID), //
- mParentItem(parent)
+ mpParentItem(parent)
{
assert(mDomainID!=0);
}
@@ -300,7 +306,7 @@ am_gatewayID_t CAmRoutingTreeItem::returnGatewayID() const
CAmRoutingTreeItem* CAmRoutingTreeItem::returnParent() const
{
- return (mParentItem);
+ return (mpParentItem);
}
CAmRoutingTreeItem::~CAmRoutingTreeItem()
@@ -318,7 +324,7 @@ CAmRoutingTreeItem *CAmRoutingTree::insertItem(const am_domainID_t domainID, con
CAmRoutingTreeItem *newTree = new CAmRoutingTreeItem(domainID, gatewayID, parent);
parent->appendChild(newTree);
mListChild.push_back(newTree);
- return newTree;
+ return (newTree);
}
void CAmRoutingTree::getRoute(CAmRoutingTreeItem *targetItem, std::vector<am_gatewayID_t>& listGateways)
diff --git a/AudioManagerDaemon/src/CAmRoutingReceiver.cpp b/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
index 8f489fb..3e9aa65 100644
--- a/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
+++ b/AudioManagerDaemon/src/CAmRoutingReceiver.cpp
@@ -1,25 +1,22 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmRoutingReceiver.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \section LicenseCAmRoutingReceiver.h
*
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
*
- * 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 CAmRoutingReceiver.cpp
+ * For further information see http://www.genivi.org/.
*
*/
@@ -36,37 +33,37 @@ namespace am
{
CAmRoutingReceiver::CAmRoutingReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler) :
- mDatabaseHandler(iDatabaseHandler), //
- mRoutingSender(iRoutingSender), //
- mControlSender(iControlSender), //
- mSocketHandler(iSocketHandler), //
+ mpDatabaseHandler(iDatabaseHandler), //
+ mpRoutingSender(iRoutingSender), //
+ mpControlSender(iControlSender), //
+ mpSocketHandler(iSocketHandler), //
mListStartupHandles(), //
mListRundownHandles(), //
mWaitStartup(false), //
mWaitRundown(false)
{
- assert(mDatabaseHandler!=NULL);
- assert(mRoutingSender!=NULL);
- assert(mControlSender!=NULL);
- assert(mSocketHandler!=NULL);
+ assert(mpDatabaseHandler!=NULL);
+ assert(mpRoutingSender!=NULL);
+ assert(mpControlSender!=NULL);
+ assert(mpSocketHandler!=NULL);
}
CAmRoutingReceiver::CAmRoutingReceiver(CAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmControlSender *iControlSender, CAmSocketHandler *iSocketHandler, CAmDbusWrapper *iDBusWrapper) :
- mDatabaseHandler(iDatabaseHandler), //
- mRoutingSender(iRoutingSender), //
- mControlSender(iControlSender), //
- mSocketHandler(iSocketHandler), //
- mDBusWrapper(iDBusWrapper), //
+ mpDatabaseHandler(iDatabaseHandler), //
+ mpRoutingSender(iRoutingSender), //
+ mpControlSender(iControlSender), //
+ mpSocketHandler(iSocketHandler), //
+ mpDBusWrapper(iDBusWrapper), //
mListStartupHandles(), //
mListRundownHandles(), //
mWaitStartup(false), //
mWaitRundown(false)
{
- assert(mDatabaseHandler!=NULL);
- assert(mRoutingSender!=NULL);
- assert(mControlSender!=NULL);
- assert(mSocketHandler!=NULL);
- assert(mDBusWrapper!=NULL);
+ assert(mpDatabaseHandler!=NULL);
+ assert(mpRoutingSender!=NULL);
+ assert(mpControlSender!=NULL);
+ assert(mpSocketHandler!=NULL);
+ assert(mpDBusWrapper!=NULL);
}
CAmRoutingReceiver::~CAmRoutingReceiver()
@@ -75,266 +72,266 @@ CAmRoutingReceiver::~CAmRoutingReceiver()
void CAmRoutingReceiver::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- mRoutingSender->removeHandle(handle);
+ mpRoutingSender->removeHandle(handle);
if (error == E_OK)
{
- mDatabaseHandler->changeConnectionFinal(connectionID);
+ mpDatabaseHandler->changeConnectionFinal(connectionID);
}
else
{
- mDatabaseHandler->removeConnection(connectionID);
+ mpDatabaseHandler->removeConnection(connectionID);
}
- mControlSender->cbAckConnect(handle, error);
+ mpControlSender->cbAckConnect(handle, error);
}
void CAmRoutingReceiver::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- mRoutingSender->removeHandle(handle);
+ mpRoutingSender->removeHandle(handle);
if (error == E_OK)
{
- mDatabaseHandler->removeConnection(connectionID);
+ mpDatabaseHandler->removeConnection(connectionID);
}
- mControlSender->cbAckDisconnect(handle, error);
+ mpControlSender->cbAckDisconnect(handle, error);
}
void CAmRoutingReceiver::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mpRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sinkID != 0)
{
//todo: check if volume in handleData is same than volume. React to it.
- mDatabaseHandler->changeSinkVolume(handleData.sinkID, volume);
+ mpDatabaseHandler->changeSinkVolume(handleData.sinkID, volume);
}
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSinkVolumeChange(handle, volume, error);
+ mpRoutingSender->removeHandle(handle);
+ mpControlSender->cbAckSetSinkVolumeChange(handle, volume, error);
}
void CAmRoutingReceiver::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mpRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sourceID != 0)
{
//todo: check if volume in handleData is same than volume. React to it.
- mDatabaseHandler->changeSourceVolume(handleData.sourceID, volume);
+ mpDatabaseHandler->changeSourceVolume(handleData.sourceID, volume);
}
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSourceVolumeChange(handle, volume, error);
+ mpRoutingSender->removeHandle(handle);
+ mpControlSender->cbAckSetSourceVolumeChange(handle, volume, error);
}
void CAmRoutingReceiver::ackSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
- CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mpRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sourceID != 0)
{
//todo: check if volume in handleData is same than volume. React to it.
- mDatabaseHandler->changeSourceState(handleData.sourceID, handleData.sourceState);
+ mpDatabaseHandler->changeSourceState(handleData.sourceID, handleData.sourceState);
}
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSourceState(handle, error);
+ mpRoutingSender->removeHandle(handle);
+ mpControlSender->cbAckSetSourceState(handle, error);
}
void CAmRoutingReceiver::ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mpRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sinkID != 0)
{
- mDatabaseHandler->changeSinkSoundPropertyDB(handleData.soundPropery, handleData.sinkID);
+ mpDatabaseHandler->changeSinkSoundPropertyDB(handleData.soundPropery, handleData.sinkID);
}
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSinkSoundProperty(handle, error);
+ mpRoutingSender->removeHandle(handle);
+ mpControlSender->cbAckSetSinkSoundProperty(handle, error);
}
void am::CAmRoutingReceiver::ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
- CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mpRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sinkID != 0)
{
std::vector<am_SoundProperty_s>::const_iterator it = handleData.soundProperties->begin();
for (; it != handleData.soundProperties->end(); ++it)
{
- mDatabaseHandler->changeSinkSoundPropertyDB(*it, handleData.sinkID);
+ mpDatabaseHandler->changeSinkSoundPropertyDB(*it, handleData.sinkID);
}
delete handleData.soundProperties;
}
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSinkSoundProperties(handle, error);
+ mpRoutingSender->removeHandle(handle);
+ mpControlSender->cbAckSetSinkSoundProperties(handle, error);
}
void CAmRoutingReceiver::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mpRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sourceID != 0)
{
- mDatabaseHandler->changeSourceSoundPropertyDB(handleData.soundPropery, handleData.sourceID);
+ mpDatabaseHandler->changeSourceSoundPropertyDB(handleData.soundPropery, handleData.sourceID);
}
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSourceSoundProperty(handle, error);
+ mpRoutingSender->removeHandle(handle);
+ mpControlSender->cbAckSetSourceSoundProperty(handle, error);
}
void am::CAmRoutingReceiver::ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
- CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mpRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.sourceID != 0)
{
std::vector<am_SoundProperty_s>::const_iterator it = handleData.soundProperties->begin();
for (; it != handleData.soundProperties->end(); ++it)
{
- mDatabaseHandler->changeSourceSoundPropertyDB(*it, handleData.sourceID);
+ mpDatabaseHandler->changeSourceSoundPropertyDB(*it, handleData.sourceID);
}
delete handleData.soundProperties;
}
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckSetSourceSoundProperties(handle, error);
+ mpRoutingSender->removeHandle(handle);
+ mpControlSender->cbAckSetSourceSoundProperties(handle, error);
}
void CAmRoutingReceiver::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error)
{
- CAmRoutingSender::am_handleData_c handleData = mRoutingSender->returnHandleData(handle);
+ CAmRoutingSender::am_handleData_c handleData = mpRoutingSender->returnHandleData(handle);
if (error == E_OK && handleData.crossfaderID != 0)
{
//todo: check if volume in handleData is same than volume. React to it.
- mDatabaseHandler->changeCrossFaderHotSink(handleData.crossfaderID, hotSink);
+ mpDatabaseHandler->changeCrossFaderHotSink(handleData.crossfaderID, hotSink);
}
- mRoutingSender->removeHandle(handle);
- mControlSender->cbAckCrossFade(handle, hotSink, error);
+ mpRoutingSender->removeHandle(handle);
+ mpControlSender->cbAckCrossFade(handle, hotSink, error);
}
void CAmRoutingReceiver::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
- mControlSender->hookSystemSourceVolumeTick(handle, sourceID, volume);
+ mpControlSender->hookSystemSourceVolumeTick(handle, sourceID, volume);
}
void CAmRoutingReceiver::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
- mControlSender->hookSystemSinkVolumeTick(handle, sinkID, volume);
+ mpControlSender->hookSystemSinkVolumeTick(handle, sinkID, volume);
}
am_Error_e CAmRoutingReceiver::peekDomain(const std::string & name, am_domainID_t & domainID)
{
- return mDatabaseHandler->peekDomain(name, domainID);
+ return (mpDatabaseHandler->peekDomain(name, domainID));
}
am_Error_e CAmRoutingReceiver::registerDomain(const am_Domain_s & domainData, am_domainID_t & domainID)
{
- return mControlSender->hookSystemRegisterDomain(domainData, domainID);
+ return (mpControlSender->hookSystemRegisterDomain(domainData, domainID));
}
am_Error_e CAmRoutingReceiver::deregisterDomain(const am_domainID_t domainID)
{
- return mControlSender->hookSystemDeregisterDomain(domainID);
+ return (mpControlSender->hookSystemDeregisterDomain(domainID));
}
am_Error_e CAmRoutingReceiver::registerGateway(const am_Gateway_s & gatewayData, am_gatewayID_t & gatewayID)
{
- return mControlSender->hookSystemRegisterGateway(gatewayData, gatewayID);
+ return (mpControlSender->hookSystemRegisterGateway(gatewayData, gatewayID));
}
am_Error_e CAmRoutingReceiver::deregisterGateway(const am_gatewayID_t gatewayID)
{
- return mControlSender->hookSystemDeregisterGateway(gatewayID);
+ return (mpControlSender->hookSystemDeregisterGateway(gatewayID));
}
am_Error_e CAmRoutingReceiver::peekSink(const std::string& name, am_sinkID_t & sinkID)
{
- return mDatabaseHandler->peekSink(name, sinkID);
+ return (mpDatabaseHandler->peekSink(name, sinkID));
}
am_Error_e CAmRoutingReceiver::registerSink(const am_Sink_s & sinkData, am_sinkID_t & sinkID)
{
- return mControlSender->hookSystemRegisterSink(sinkData, sinkID);
+ return (mpControlSender->hookSystemRegisterSink(sinkData, sinkID));
}
am_Error_e CAmRoutingReceiver::deregisterSink(const am_sinkID_t sinkID)
{
- return mControlSender->hookSystemDeregisterSink(sinkID);
+ return (mpControlSender->hookSystemDeregisterSink(sinkID));
}
am_Error_e CAmRoutingReceiver::peekSource(const std::string & name, am_sourceID_t & sourceID)
{
- return mDatabaseHandler->peekSource(name, sourceID);
+ return (mpDatabaseHandler->peekSource(name, sourceID));
}
am_Error_e CAmRoutingReceiver::registerSource(const am_Source_s & sourceData, am_sourceID_t & sourceID)
{
- return mControlSender->hookSystemRegisterSource(sourceData, sourceID);
+ return (mpControlSender->hookSystemRegisterSource(sourceData, sourceID));
}
am_Error_e CAmRoutingReceiver::deregisterSource(const am_sourceID_t sourceID)
{
- return mControlSender->hookSystemDeregisterSource(sourceID);
+ return (mpControlSender->hookSystemDeregisterSource(sourceID));
}
am_Error_e CAmRoutingReceiver::registerCrossfader(const am_Crossfader_s & crossfaderData, am_crossfaderID_t & crossfaderID)
{
- return mControlSender->hookSystemRegisterCrossfader(crossfaderData, crossfaderID);
+ return (mpControlSender->hookSystemRegisterCrossfader(crossfaderData, crossfaderID));
}
am_Error_e CAmRoutingReceiver::deregisterCrossfader(const am_crossfaderID_t crossfaderID)
{
- return mControlSender->hookSystemDeregisterCrossfader(crossfaderID);
+ return (mpControlSender->hookSystemDeregisterCrossfader(crossfaderID));
}
void CAmRoutingReceiver::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
- return mControlSender->hookSystemInterruptStateChange(sourceID, interruptState);
+ return (mpControlSender->hookSystemInterruptStateChange(sourceID, interruptState));
}
void CAmRoutingReceiver::hookDomainRegistrationComplete(const am_domainID_t domainID)
{
- mControlSender->hookSystemDomainRegistrationComplete(domainID);
+ mpControlSender->hookSystemDomainRegistrationComplete(domainID);
}
void CAmRoutingReceiver::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
- mControlSender->hookSystemSinkAvailablityStateChange(sinkID, availability);
+ mpControlSender->hookSystemSinkAvailablityStateChange(sinkID, availability);
}
void CAmRoutingReceiver::hookSourceAvailablityStatusChange(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
- mControlSender->hookSystemSourceAvailablityStateChange(sourceID, availability);
+ mpControlSender->hookSystemSourceAvailablityStateChange(sourceID, availability);
}
void CAmRoutingReceiver::hookDomainStateChange(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- mControlSender->hookSystemDomainStateChange(domainID, domainState);
+ mpControlSender->hookSystemDomainStateChange(domainID, domainState);
}
void CAmRoutingReceiver::hookTimingInformationChanged(const am_connectionID_t connectionID, const am_timeSync_t delay)
{
- mDatabaseHandler->changeConnectionTimingInformation(connectionID, delay);
+ mpDatabaseHandler->changeConnectionTimingInformation(connectionID, delay);
}
void CAmRoutingReceiver::sendChangedData(const std::vector<am_EarlyData_s> & earlyData)
{
- mControlSender->hookSystemReceiveEarlyData(earlyData);
+ mpControlSender->hookSystemReceiveEarlyData(earlyData);
}
am_Error_e CAmRoutingReceiver::peekSinkClassID(const std::string& name, am_sinkClass_t& sinkClassID)
{
- return mDatabaseHandler->peekSinkClassID(name, sinkClassID);
+ return (mpDatabaseHandler->peekSinkClassID(name, sinkClassID));
}
am_Error_e CAmRoutingReceiver::peekSourceClassID(const std::string& name, am_sourceClass_t& sourceClassID)
{
- return mDatabaseHandler->peekSourceClassID(name, sourceClassID);
+ return (mpDatabaseHandler->peekSourceClassID(name, sourceClassID));
}
am_Error_e CAmRoutingReceiver::getDBusConnectionWrapper(CAmDbusWrapper *& dbusConnectionWrapper) const
{
#ifdef WITH_DBUS_WRAPPER
- dbusConnectionWrapper = mDBusWrapper;
- return E_OK;
+ dbusConnectionWrapper = mpDBusWrapper;
+ return (E_OK);
#else
- return E_UNKNOWN;
+ return (E_UNKNOWN);
#endif
}
am_Error_e CAmRoutingReceiver::getSocketHandler(CAmSocketHandler *& socketHandler) const
{
- socketHandler = mSocketHandler;
- return E_OK;
+ socketHandler = mpSocketHandler;
+ return (E_OK);
}
void CAmRoutingReceiver::getInterfaceVersion(std::string & version) const
@@ -346,28 +343,28 @@ void CAmRoutingReceiver::confirmRoutingReady(const uint16_t handle)
{
mListStartupHandles.erase(std::remove(mListStartupHandles.begin(), mListStartupHandles.end(), handle), mListStartupHandles.end());
if (mWaitStartup && mListStartupHandles.empty())
- mControlSender->confirmRoutingReady();
+ mpControlSender->confirmRoutingReady();
}
void CAmRoutingReceiver::confirmRoutingRundown(const uint16_t handle)
{
mListRundownHandles.erase(std::remove(mListRundownHandles.begin(), mListRundownHandles.end(), handle), mListRundownHandles.end());
if (mWaitRundown && mListRundownHandles.empty())
- mControlSender->confirmCommandRundown();
+ mpControlSender->confirmCommandRundown();
}
uint16_t am::CAmRoutingReceiver::getStartupHandle()
{
uint16_t handle = ++handleCount; //todo: handle overflow
mListStartupHandles.push_back(handle);
- return handle;
+ return (handle);
}
uint16_t am::CAmRoutingReceiver::getRundownHandle()
{
uint16_t handle = ++handleCount; //todo: handle overflow
mListRundownHandles.push_back(handle);
- return handle;
+ return (handle);
}
void am::CAmRoutingReceiver::waitOnStartup(bool startup)
diff --git a/AudioManagerDaemon/src/CAmRoutingSender.cpp b/AudioManagerDaemon/src/CAmRoutingSender.cpp
index c134c3f..d14c826 100644
--- a/AudioManagerDaemon/src/CAmRoutingSender.cpp
+++ b/AudioManagerDaemon/src/CAmRoutingSender.cpp
@@ -1,24 +1,22 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmRoutingSender.h
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
*
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ *
+ * \file CAmRoutingSender.cpp
+ * For further information see http://www.genivi.org/.
*
*/
@@ -36,9 +34,12 @@
namespace am
{
-#define REQUIRED_INTERFACE_VERSION_MAJOR 1
-#define REQUIRED_INTERFACE_VERSION_MINOR 0
-
+#define REQUIRED_INTERFACE_VERSION_MAJOR 1 //!< major interface version. All versions smaller than this will be rejected
+#define REQUIRED_INTERFACE_VERSION_MINOR 0 //!< minor interface version. All versions smaller than this will be rejected
+/**
+ * macro to call all interfaces
+ *
+ */
#define CALL_ALL_INTERFACES(...) \
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin(); \
std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end(); \
@@ -57,7 +58,7 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
mMapSinkInterface(), //
mMapSourceInterface(), //
mMapHandleInterface(), //
- mRoutingReceiver()
+ mpRoutingReceiver()
{
std::vector<std::string> sharedLibraryNameList;
std::vector<std::string>::const_iterator dirIter = listOfPluginDirectories.begin();
@@ -167,7 +168,7 @@ CAmRoutingSender::~CAmRoutingSender()
am_Error_e CAmRoutingSender::startupInterfaces(CAmRoutingReceiver *iRoutingReceiver)
{
- mRoutingReceiver = iRoutingReceiver;
+ mpRoutingReceiver = iRoutingReceiver;
am_Error_e returnError = E_OK;
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
@@ -180,7 +181,7 @@ am_Error_e CAmRoutingSender::startupInterfaces(CAmRoutingReceiver *iRoutingRecei
returnError = error;
}
}
- return returnError;
+ return (returnError);
}
am_Error_e CAmRoutingSender::asyncAbort(const am_Handle_s& handle)
@@ -189,10 +190,10 @@ am_Error_e CAmRoutingSender::asyncAbort(const am_Handle_s& handle)
iter = mMapHandleInterface.find(handle.handle);
if (iter != mMapHandleInterface.end())
{
- return iter->second->asyncAbort(handle);
+ return (iter->second->asyncAbort(handle));
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
am_Error_e CAmRoutingSender::asyncConnect(am_Handle_s& handle, const am_connectionID_t connectionID, const am_sourceID_t sourceID, const am_sinkID_t sinkID, const am_ConnectionFormat_e connectionFormat)
@@ -206,10 +207,10 @@ am_Error_e CAmRoutingSender::asyncConnect(am_Handle_s& handle, const am_connecti
handle = createHandle(handleData, H_CONNECT);
mMapConnectionInterface.insert(std::make_pair(connectionID, iter->second));
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncConnect(handle, connectionID, sourceID, sinkID, connectionFormat);
+ return (iter->second->asyncConnect(handle, connectionID, sourceID, sinkID, connectionFormat));
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
am_Error_e CAmRoutingSender::asyncDisconnect(am_Handle_s& handle, const am_connectionID_t connectionID)
@@ -224,10 +225,10 @@ am_Error_e CAmRoutingSender::asyncDisconnect(am_Handle_s& handle, const am_conne
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
am_Error_e returnVal = iter->second->asyncDisconnect(handle, connectionID);
mMapConnectionInterface.erase(iter);
- return returnVal;
+ return (returnVal);
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
am_Error_e CAmRoutingSender::asyncSetSinkVolume(am_Handle_s& handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
@@ -241,9 +242,9 @@ am_Error_e CAmRoutingSender::asyncSetSinkVolume(am_Handle_s& handle, const am_si
handleData.volume = volume;
handle = createHandle(handleData, H_SETSINKVOLUME);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSinkVolume(handle, sinkID, volume, ramp, time);
+ return (iter->second->asyncSetSinkVolume(handle, sinkID, volume, ramp, time));
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
am_Error_e CAmRoutingSender::asyncSetSourceVolume(am_Handle_s& handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
@@ -257,9 +258,9 @@ am_Error_e CAmRoutingSender::asyncSetSourceVolume(am_Handle_s& handle, const am_
handleData.volume = volume;
handle = createHandle(handleData, H_SETSOURCEVOLUME);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceVolume(handle, sourceID, volume, ramp, time);
+ return (iter->second->asyncSetSourceVolume(handle, sourceID, volume, ramp, time));
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
am_Error_e CAmRoutingSender::asyncSetSourceState(am_Handle_s& handle, const am_sourceID_t sourceID, const am_SourceState_e state)
@@ -273,9 +274,9 @@ am_Error_e CAmRoutingSender::asyncSetSourceState(am_Handle_s& handle, const am_s
handleData.sourceState = state;
handle = createHandle(handleData, H_SETSOURCESTATE);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceState(handle, sourceID, state);
+ return (iter->second->asyncSetSourceState(handle, sourceID, state));
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
am_Error_e CAmRoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
@@ -289,7 +290,7 @@ am_Error_e CAmRoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, cons
handleData.soundPropery = soundProperty;
handle = createHandle(handleData, H_SETSINKSOUNDPROPERTY);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSinkSoundProperty(handle, sinkID, soundProperty);
+ return (iter->second->asyncSetSinkSoundProperty(handle, sinkID, soundProperty));
}
return (E_NON_EXISTENT);
}
@@ -305,7 +306,7 @@ am_Error_e CAmRoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, co
handleData.soundPropery = soundProperty;
handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTY);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceSoundProperty(handle, sourceID, soundProperty);
+ return (iter->second->asyncSetSourceSoundProperty(handle, sourceID, soundProperty));
}
return (E_NON_EXISTENT);
}
@@ -321,7 +322,7 @@ am_Error_e CAmRoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle,
handleData.soundProperties = new std::vector<am_SoundProperty_s>(listSoundProperties);
handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTIES);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSourceSoundProperties(handle, sourceID, listSoundProperties);
+ return (iter->second->asyncSetSourceSoundProperties(handle, sourceID, listSoundProperties));
}
return (E_NON_EXISTENT);
}
@@ -337,7 +338,7 @@ am_Error_e CAmRoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, co
handleData.soundProperties = new std::vector<am_SoundProperty_s>(listSoundProperties);
handle = createHandle(handleData, H_SETSINKSOUNDPROPERTIES);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncSetSinkSoundProperties(handle, sinkID, listSoundProperties);
+ return (iter->second->asyncSetSinkSoundProperties(handle, sinkID, listSoundProperties));
}
return (E_NON_EXISTENT);
@@ -354,9 +355,9 @@ am_Error_e CAmRoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossf
handleData.hotSink = hotSink;
handle = createHandle(handleData, H_CROSSFADE);
mMapHandleInterface.insert(std::make_pair(handle.handle, iter->second));
- return iter->second->asyncCrossFade(handle, crossfaderID, hotSink, rampType, time);
+ return (iter->second->asyncCrossFade(handle, crossfaderID, hotSink, rampType, time));
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
am_Error_e CAmRoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
@@ -364,10 +365,15 @@ am_Error_e CAmRoutingSender::setDomainState(const am_domainID_t domainID, const
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
iter = mMapDomainInterface.find(domainID);
if (iter != mMapDomainInterface.end())
- return iter->second->setDomainState(domainID, domainState);
- return E_NON_EXISTENT;
+ return (iter->second->setDomainState(domainID, domainState));
+ return (E_NON_EXISTENT);
}
+/**
+ * @author Christian
+ * this adds the domain to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a domain is registered.
+ */
am_Error_e CAmRoutingSender::addDomainLookup(const am_Domain_s& domainData)
{
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
@@ -377,13 +383,18 @@ am_Error_e CAmRoutingSender::addDomainLookup(const am_Domain_s& domainData)
if ((*iter).busName.compare(domainData.busname) == 0)
{
mMapDomainInterface.insert(std::make_pair(domainData.domainID, (*iter).routingInterface));
- return E_OK;
+ return (E_OK);
}
}
- return E_UNKNOWN;
+ return (E_UNKNOWN);
}
+/**
+ * @author Christian
+ * this adds the Source to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Source is registered.
+ */
am_Error_e CAmRoutingSender::addSourceLookup(const am_Source_s& sourceData)
{
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
@@ -391,12 +402,17 @@ am_Error_e CAmRoutingSender::addSourceLookup(const am_Source_s& sourceData)
if (iter != mMapDomainInterface.end())
{
mMapSourceInterface.insert(std::make_pair(sourceData.sourceID, iter->second));
- return E_OK;
+ return (E_OK);
}
- return E_UNKNOWN;
+ return (E_UNKNOWN);
}
+/**
+ * @author Christian
+ * this adds the Sink to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Sink is registered.
+ */
am_Error_e CAmRoutingSender::addSinkLookup(const am_Sink_s& sinkData)
{
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
@@ -404,12 +420,17 @@ am_Error_e CAmRoutingSender::addSinkLookup(const am_Sink_s& sinkData)
if (iter != mMapDomainInterface.end())
{
mMapSinkInterface.insert(std::make_pair(sinkData.sinkID, iter->second));
- return E_OK;
+ return (E_OK);
}
- return E_UNKNOWN;
+ return (E_UNKNOWN);
}
+/**
+ * @author Christian
+ * this adds the Crossfader to the lookup table of the Router. The data is used to have a quick lookup of the correct pluginInterface.
+ * This must be done whenever a Crossfader is registered.
+ */
am_Error_e CAmRoutingSender::addCrossfaderLookup(const am_Crossfader_s& crossfaderData)
{
DomainInterfaceMap::iterator iter = mMapSourceInterface.begin();
@@ -417,12 +438,16 @@ am_Error_e CAmRoutingSender::addCrossfaderLookup(const am_Crossfader_s& crossfad
if (iter != mMapSourceInterface.end())
{
mMapSourceInterface.insert(std::make_pair(crossfaderData.crossfaderID, iter->second));
- return E_OK;
+ return (E_OK);
}
- return E_UNKNOWN;
+ return (E_UNKNOWN);
}
+/**
+ * @author Christian
+ * this removes the Domain to the lookup table of the Router. This must be done everytime a domain is deregistered.
+ */
am_Error_e CAmRoutingSender::removeDomainLookup(const am_domainID_t domainID)
{
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
@@ -430,12 +455,16 @@ am_Error_e CAmRoutingSender::removeDomainLookup(const am_domainID_t domainID)
if (iter != mMapDomainInterface.end())
{
mMapDomainInterface.erase(iter);
- return E_OK;
+ return (E_OK);
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
+/**
+ * @author Christian
+ * this removes the Source to the lookup table of the Router. This must be done everytime a source is deregistered.
+ */
am_Error_e CAmRoutingSender::removeSourceLookup(const am_sourceID_t sourceID)
{
SourceInterfaceMap::iterator iter = mMapSourceInterface.begin();
@@ -443,12 +472,16 @@ am_Error_e CAmRoutingSender::removeSourceLookup(const am_sourceID_t sourceID)
if (iter != mMapSourceInterface.end())
{
mMapSourceInterface.erase(iter);
- return E_OK;
+ return (E_OK);
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
+/**
+ * @author Christian
+ * this removes the Sink to the lookup table of the Router. This must be done everytime a sink is deregistered.
+ */
am_Error_e CAmRoutingSender::removeSinkLookup(const am_sinkID_t sinkID)
{
SinkInterfaceMap::iterator iter = mMapSinkInterface.begin();
@@ -456,12 +489,16 @@ am_Error_e CAmRoutingSender::removeSinkLookup(const am_sinkID_t sinkID)
if (iter != mMapSinkInterface.end())
{
mMapSinkInterface.erase(iter);
- return E_OK;
+ return (E_OK);
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
+/**
+ * @author Christian
+ * this removes the Crossfader to the lookup table of the Router. This must be done everytime a crossfader is deregistered.
+ */
am_Error_e CAmRoutingSender::removeCrossfaderLookup(const am_crossfaderID_t crossfaderID)
{
CrossfaderInterfaceMap::iterator iter = mMapCrossfaderInterface.begin();
@@ -469,17 +506,22 @@ am_Error_e CAmRoutingSender::removeCrossfaderLookup(const am_crossfaderID_t cros
if (iter != mMapCrossfaderInterface.end())
{
mMapCrossfaderInterface.erase(iter);
- return E_OK;
+ return (E_OK);
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
+/**
+ * removes a handle from the list
+ * @param handle to be removed
+ * @return E_OK in case of success
+ */
am_Error_e CAmRoutingSender::removeHandle(const am_Handle_s& handle)
{
if (mlistActiveHandles.erase(handle))
- return E_OK;
- return E_UNKNOWN;
+ return (E_OK);
+ return (E_UNKNOWN);
}
am_Error_e CAmRoutingSender::getListHandles(std::vector<am_Handle_s> & listHandles) const
@@ -490,18 +532,29 @@ am_Error_e CAmRoutingSender::getListHandles(std::vector<am_Handle_s> & listHandl
{
listHandles.push_back(it->first);
}
- return E_OK;
+ return (E_OK);
}
+/**
+ * creates a handle and adds it to the list of handles
+ * @param handleData the data that should be saves together with the handle
+ * @param type the type of handle to be created
+ * @return the handle
+ */
am_Handle_s CAmRoutingSender::createHandle(const am_handleData_c& handleData, const am_Handle_e type)
{
am_Handle_s handle;
handle.handle = ++mHandleCount; //todo: handle overflows here...
handle.handleType = type;
mlistActiveHandles.insert(std::make_pair(handle, handleData));
- return handle;
+ return (handle);
}
+/**
+ * returns the data that belong to handles
+ * @param handle the handle
+ * @return a class holding the handle data
+ */
CAmRoutingSender::am_handleData_c CAmRoutingSender::returnHandleData(const am_Handle_s handle) const
{
HandlesMap::const_iterator it = mlistActiveHandles.begin();
@@ -511,26 +564,26 @@ CAmRoutingSender::am_handleData_c CAmRoutingSender::returnHandleData(const am_Ha
void CAmRoutingSender::setRoutingReady()
{
- mRoutingReceiver->waitOnStartup(false);
+ mpRoutingReceiver->waitOnStartup(false);
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end();
for (; iter < iterEnd; ++iter)
{
- (*iter).routingInterface->setRoutingReady(mRoutingReceiver->getStartupHandle());
+ (*iter).routingInterface->setRoutingReady(mpRoutingReceiver->getStartupHandle());
}
- mRoutingReceiver->waitOnStartup(true);
+ mpRoutingReceiver->waitOnStartup(true);
}
void CAmRoutingSender::setRoutingRundown()
{
- mRoutingReceiver->waitOnRundown(false);
+ mpRoutingReceiver->waitOnRundown(false);
std::vector<InterfaceNamePairs>::iterator iter = mListInterfaces.begin();
std::vector<InterfaceNamePairs>::iterator iterEnd = mListInterfaces.end();
for (; iter < iterEnd; ++iter)
{
- (*iter).routingInterface->setRoutingRundown(mRoutingReceiver->getStartupHandle());
+ (*iter).routingInterface->setRoutingRundown(mpRoutingReceiver->getStartupHandle());
}
- mRoutingReceiver->waitOnRundown(true);
+ mpRoutingReceiver->waitOnRundown(true);
}
void CAmRoutingSender::unloadLibraries(void)
@@ -550,7 +603,7 @@ am_Error_e CAmRoutingSender::getListPlugins(std::vector<std::string>& interfaces
{
interfaces.push_back(it->busName);
}
- return E_OK;
+ return (E_OK);
}
void CAmRoutingSender::getInterfaceVersion(std::string & version) const
diff --git a/AudioManagerDaemon/src/CAmSocketHandler.cpp b/AudioManagerDaemon/src/CAmSocketHandler.cpp
index 2d5c7d7..d13ea7b 100644
--- a/AudioManagerDaemon/src/CAmSocketHandler.cpp
+++ b/AudioManagerDaemon/src/CAmSocketHandler.cpp
@@ -1,24 +1,22 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmDbusWrapper.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
*
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ *
+ * \file CAmSocketHandler.cpp
+ * For further information see http://www.genivi.org/.
*
*/
@@ -37,7 +35,8 @@
//todo: implement time correction if timer was interrupted by call
//todo: change hitlist to a list that holds all information, because entering and removing items will be cheaper than with std::vector
-namespace am {
+namespace am
+{
CAmSocketHandler::CAmSocketHandler() :
mListPoll(), //
@@ -64,7 +63,7 @@ CAmSocketHandler::~CAmSocketHandler()
*/
void CAmSocketHandler::start_listenting()
{
- gDispatchDone=0;
+ gDispatchDone = 0;
int16_t pollStatus;
std::list<int16_t> hitList;
@@ -84,7 +83,7 @@ void CAmSocketHandler::start_listenting()
{
//first we go through the registered filedescriptors and check if someone needs preparation:
mListPoll_t::iterator prepIter = mListPoll.begin();
- CAmShPollPrepare *prep = NULL;
+ IAmShPollPrepare *prep = NULL;
for (; prepIter != mListPoll.end(); ++prepIter)
{
if ((prep = prepIter->prepareCB) != NULL)
@@ -156,7 +155,7 @@ void CAmSocketHandler::start_listenting()
std::list<int16_t>::iterator hListIt = hitList.begin();
for (; hListIt != hitList.end(); ++hListIt)
{
- CAmShPollFired* fire = NULL;
+ IAmShPollFired* fire = NULL;
if ((fire = listPoll.at(*hListIt).firedCB) != NULL)
fire->Call(mfdPollingArray.at(*hListIt), listPoll.at(*hListIt).handle, listPoll.at(*hListIt).userData);
}
@@ -165,7 +164,7 @@ void CAmSocketHandler::start_listenting()
hListIt = hitList.begin();
for (; hListIt != hitList.end(); ++hListIt)
{
- CAmShPollCheck* check = NULL;
+ IAmShPollCheck* check = NULL;
if ((check = listPoll.at(*hListIt).checkCB) != NULL)
{
if (!check->Call(listPoll.at(*hListIt).handle, listPoll.at(*hListIt).userData))
@@ -181,7 +180,7 @@ void CAmSocketHandler::start_listenting()
hListIt = hitList.begin();
for (; hListIt != hitList.end(); ++hListIt)
{
- CAmShPollDispatch *dispatch = NULL;
+ IAmShPollDispatch *dispatch = NULL;
if ((dispatch = listPoll.at(*hListIt).dispatchCB) != NULL)
{
if (!dispatch->Call(listPoll.at(*hListIt).handle, listPoll.at(*hListIt).userData))
@@ -215,15 +214,20 @@ void CAmSocketHandler::stop_listening()
/**
* Adds a filedescriptor to the polling loop
- * @param fd this is a valid filedescriptor
+ * @param fd the filedescriptor
* @param event the event flags
- * @param callback the callback that shall be called if the filedescriptor poll succeeded
+ * @param prepare a callback that is called before the loop is entered
+ * @param fired a callback that is called when the filedescriptor needs to be read
+ * @param check a callback that is called to check if further actions are neccessary
+ * @param dispatch a callback that is called to dispatch the received data
+ * @param userData a pointer to userdata that is always passed around
+ * @param handle the handle of this poll
* @return E_OK if the descriptor was added, E_NON_EXISTENT if the fd is not valid
*/
-am_Error_e CAmSocketHandler::addFDPoll(const int fd, const short event, CAmShPollPrepare *prepare, CAmShPollFired *fired, CAmShPollCheck *check, CAmShPollDispatch *dispatch, void *userData, sh_pollHandle_t & handle)
+am_Error_e CAmSocketHandler::addFDPoll(const int fd, const short event, IAmShPollPrepare *prepare, IAmShPollFired *fired, IAmShPollCheck *check, IAmShPollDispatch *dispatch, void *userData, sh_pollHandle_t & handle)
{
if (!fdIsValid(fd))
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
sh_poll_s pollData;
pollData.pollfdValue.fd = fd;
@@ -242,13 +246,13 @@ am_Error_e CAmSocketHandler::addFDPoll(const int fd, const short event, CAmShPo
mRecreatePollfds = true;
handle = pollData.handle;
- return E_OK;
+ return (E_OK);
}
/**
* removes a filedescriptor from the poll loop
- * @param fd the filedescriptor to be removed
- * @return E_OK in case of sucess, E_NON_EXISTENT or E_UNKNOWN if the fd in not registered
+ * @param handle
+ * @return
*/
am_Error_e CAmSocketHandler::removeFDPoll(const sh_pollHandle_t handle)
{
@@ -260,10 +264,10 @@ am_Error_e CAmSocketHandler::removeFDPoll(const sh_pollHandle_t handle)
{
iterator = mListPoll.erase(iterator);
mRecreatePollfds = true;
- return E_OK;
+ return (E_OK);
}
}
- return E_UNKNOWN;
+ return (E_UNKNOWN);
}
/**
@@ -271,12 +275,13 @@ am_Error_e CAmSocketHandler::removeFDPoll(const sh_pollHandle_t handle)
* This is not a high precise timer, it is very coarse. It is meant to be used for timeouts when waiting
* for an answer via a filedescriptor.
* One time timer. If you need again a timer, you need to add a new timer in the callback of the old one.
- * @param timeouts time until the callback is fired
- * @param callback the callback
- * @param handle the handle that is created for the timer is returned. Can be used to remove the timer
+ * @param timeouts timeouts time until the callback is fired
+ * @param callback callback the callback
+ * @param handle handle the handle that is created for the timer is returned. Can be used to remove the timer
+ * @param userData pointer always passed with the call
* @return E_OK in case of success
*/
-am_Error_e CAmSocketHandler::addTimer(const timespec timeouts, CAmShTimerCallBack*& callback, sh_timerHandle_t& handle, void * userData)
+am_Error_e CAmSocketHandler::addTimer(const timespec timeouts, IAmShTimerCallBack*& callback, sh_timerHandle_t& handle, void * userData)
{
assert(!((timeouts.tv_sec==0) && (timeouts.tv_nsec==0)));
assert(callback!=NULL);
@@ -298,7 +303,7 @@ am_Error_e CAmSocketHandler::addTimer(const timespec timeouts, CAmShTimerCallBac
//very important: sort the list so that the smallest value is front
mListActiveTimer.sort(compareCountdown);
mTimeout = mListActiveTimer.front().countdown;
- return E_OK;
+ return (E_OK);
}
/**
@@ -319,10 +324,10 @@ am_Error_e CAmSocketHandler::removeTimer(const sh_timerHandle_t handle)
if (it->handle == handle)
{
it = mListTimer.erase(it);
- return E_OK;
+ return (E_OK);
}
}
- return E_UNKNOWN;
+ return (E_UNKNOWN);
}
/**
@@ -354,7 +359,7 @@ am_Error_e CAmSocketHandler::restartTimer(const sh_timerHandle_t handle, const t
//very important: sort the list so that the smallest value is front
mListActiveTimer.sort(compareCountdown);
mTimeout = mListActiveTimer.front().countdown;
- return E_OK;
+ return (E_OK);
}
am_Error_e CAmSocketHandler::stopTimer(const sh_timerHandle_t handle)
@@ -375,17 +380,17 @@ am_Error_e CAmSocketHandler::stopTimer(const sh_timerHandle_t handle)
mTimeout.tv_nsec = -1;
mTimeout.tv_sec = -1;
}
- return E_OK;
+ return (E_OK);
}
}
- return E_NON_EXISTENT;
+ return (E_NON_EXISTENT);
}
/**
* updates the eventFlags of a poll
- * @param fd the filedescriptor of the poll
- * @param event the event flags
- * @return E_OK on succsess, E_NON_EXISTENT if fd was not found
+ * @param handle
+ * @param events
+ * @return @return E_OK on succsess, E_NON_EXISTENT if fd was not found
*/
am_Error_e CAmSocketHandler::updateEventFlags(const sh_pollHandle_t handle, const short events)
{
@@ -397,10 +402,10 @@ am_Error_e CAmSocketHandler::updateEventFlags(const sh_pollHandle_t handle, cons
{
iterator->pollfdValue.events = events;
mRecreatePollfds = true;
- return E_OK;
+ return (E_OK);
}
}
- return E_UNKNOWN;
+ return (E_UNKNOWN);
}
/**
@@ -460,14 +465,14 @@ void CAmSocketHandler::initTimer()
*/
inline int CAmSocketHandler::timespec2ms(const timespec & time)
{
- return (time.tv_nsec == -1 && time.tv_sec == -1) ? -1 : time.tv_sec * 1000 + time.tv_nsec / 1000000;
+ return ((time.tv_nsec == -1 && time.tv_sec == -1) ? -1 : time.tv_sec * 1000 + time.tv_nsec / 1000000);
}
inline timespec* CAmSocketHandler::insertTime(timespec& buffertime)
{
buffertime.tv_nsec = mTimeout.tv_nsec;
buffertime.tv_sec = mTimeout.tv_sec;
- return (mTimeout.tv_nsec == -1 && mTimeout.tv_sec == -1) ? NULL : &buffertime;
+ return ((mTimeout.tv_nsec == -1 && mTimeout.tv_sec == -1) ? NULL : &buffertime);
}
/**
diff --git a/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp b/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
index 92fb09d..46dccf3 100644
--- a/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
+++ b/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
@@ -1,24 +1,23 @@
/**
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
* Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmTelnetMenuHelper.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 24-Jan-2012
- * \author Frank Herchet (frank.fh.herchet@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2012, BMW AG Frank Herchet frank.fh.herchet@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ * \author Frank Herchet, frank.fh.herchet@bmw.de BMW 2012
*
- * 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 CAmTelnetMenuHelper.cpp
+ * For further information see http://www.genivi.org/.
*
*/
diff --git a/AudioManagerDaemon/src/CAmTelnetServer.cpp b/AudioManagerDaemon/src/CAmTelnetServer.cpp
index 1274a8d..079e6e3 100644
--- a/AudioManagerDaemon/src/CAmTelnetServer.cpp
+++ b/AudioManagerDaemon/src/CAmTelnetServer.cpp
@@ -1,24 +1,23 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file CAmTelnetServer.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
+ *
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ * \author Frank Herchet, frank.fh.herchet@bmw.de BMW 2012
*
- * 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 CAmTelnetServer.cpp
+ * For further information see http://www.genivi.org/.
*
*/
@@ -37,78 +36,61 @@
#include <iterator>
#include "CAmDatabaseHandler.h"
#include "CAmRoutingSender.h"
-#include "shared/CAmDltWrapper.h"
#include "CAmTelnetMenuHelper.h"
+#include "shared/CAmDltWrapper.h"
-namespace am {
+namespace am
+{
-CAmTelnetServer* CAmTelnetServer::instance = NULL;
+CAmTelnetServer* CAmTelnetServer::mpInstance = NULL;
#define PRINT_BOOL(var) var ? output+="true\t\t" : output+="false\t\t";
-CAmTelnetServer::CAmTelnetServer(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, unsigned int servPort, unsigned int maxConnections)
- :telnetConnectFiredCB(this,&CAmTelnetServer::connectSocket),
- telnetReceiveFiredCB(this,&CAmTelnetServer::receiveData),
- telnetDispatchCB(this,&CAmTelnetServer::dispatchData),
- telnetCheckCB(this,&CAmTelnetServer::check),
- mSocketHandler(iSocketHandler),
- mCommandSender(iCommandSender),
- mCommandReceiver(iCommandReceiver),
- mRoutingSender(iRoutingSender),
- mRoutingReceiver(iRoutingReceiver),
- mControlSender(iControlSender),
- mControlReceiver(iControlReceiver),
- mDatabasehandler(iDatabasehandler),
- mRouter(iRouter),
- mConnecthandle(),
- mMsgList(),
- mListConnections(),
- mConnectFD(NULL),
- mServerPort(servPort),
- mMaxConnections(maxConnections),
- mTelnetMenuHelper(iSocketHandler,iCommandSender,iCommandReceiver,iRoutingSender,iRoutingReceiver,iControlSender,iControlReceiver,iDatabasehandler,iRouter,this)
+CAmTelnetServer::CAmTelnetServer(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, CAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, unsigned int servPort, unsigned int maxConnections) :
+ telnetConnectFiredCB(this, &CAmTelnetServer::connectSocket), telnetReceiveFiredCB(this, &CAmTelnetServer::receiveData), telnetDispatchCB(this, &CAmTelnetServer::dispatchData), telnetCheckCB(this, &CAmTelnetServer::check), mpSocketHandler(iSocketHandler), mpCommandSender(iCommandSender), mpCommandReceiver(iCommandReceiver), mpRoutingSender(iRoutingSender), mpRoutingReceiver(iRoutingReceiver), mpControlSender(iControlSender), mpControlReceiver(iControlReceiver), mpDatabasehandler(iDatabasehandler), mpRouter(iRouter), mConnecthandle(), mListMessages(), mListConnections(), mConnectFD(NULL), mServerPort(servPort), mMaxConnections(maxConnections), mTelnetMenuHelper(iSocketHandler, iCommandSender, iCommandReceiver, iRoutingSender, iRoutingReceiver, iControlSender, iControlReceiver,
+ iDatabasehandler, iRouter, this)
{
- assert(mSocketHandler!=NULL);
- assert(mCommandReceiver!=NULL);
- assert(mCommandSender!=NULL);
- assert(mControlSender!=NULL);
- assert(mControlReceiver!=NULL);
- assert(mRoutingSender!=NULL);
- assert(mRoutingReceiver!=NULL);
- assert(mDatabasehandler!=NULL);
- assert(mRouter!=NULL);
- assert(servPort!=0);
- assert(mMaxConnections!=0);
-
- instance = this;
- //mTelnetMenuHelper.setTelnetServer(this);
-
- int yes = 1;
- struct sockaddr_in servAddr;
+ assert(mpSocketHandler!=NULL);
+ assert(mpCommandReceiver!=NULL);
+ assert(mpCommandSender!=NULL);
+ assert(mpControlSender!=NULL);
+ assert(mpControlReceiver!=NULL);
+ assert(mpRoutingSender!=NULL);
+ assert(mpRoutingReceiver!=NULL);
+ assert(mpDatabasehandler!=NULL);
+ assert(mpRouter!=NULL);
+ assert(servPort!=0);
+ assert(mMaxConnections!=0);
+
+ mpInstance = this;
+ //mTelnetMenuHelper.setTelnetServer(this);
+
+ int yes = 1;
+ struct sockaddr_in servAddr;
//setup the port Listener
mConnectFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
setsockopt(mConnectFD, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
memset(&servAddr, 0, sizeof(servAddr));
- servAddr.sin_family = AF_INET;
+ servAddr.sin_family = AF_INET;
servAddr.sin_addr.s_addr = INADDR_ANY;
- servAddr.sin_port = htons(servPort);
+ servAddr.sin_port = htons(servPort);
bind(mConnectFD, (struct sockaddr *) &servAddr, sizeof(servAddr));
- if (listen(mConnectFD,mMaxConnections) < 0)
+ if (listen(mConnectFD, mMaxConnections) < 0)
{
- logError("TelnetServer::TelnetServerk cannot listen ",errno);
+ logError("TelnetServer::TelnetServerk cannot listen ", errno);
}
else
logInfo("TelnetServer::TelnetServer started listening on port", mServerPort);
- int a=1;
- ioctl (mConnectFD, FIONBIO, (char *) &a);
- setsockopt (mConnectFD, SOL_SOCKET, SO_KEEPALIVE, (char *) &a, sizeof (a));
+ int a = 1;
+ ioctl(mConnectFD, FIONBIO, (char *) &a);
+ setsockopt(mConnectFD, SOL_SOCKET, SO_KEEPALIVE, (char *) &a, sizeof(a));
short events = 0;
events |= POLLIN;
- mSocketHandler->addFDPoll(mConnectFD, events, NULL, &telnetConnectFiredCB, NULL, NULL, NULL, mConnecthandle);
+ mpSocketHandler->addFDPoll(mConnectFD, events, NULL, &telnetConnectFiredCB, NULL, NULL, NULL, mConnecthandle);
}
CAmTelnetServer::~CAmTelnetServer()
@@ -119,112 +101,95 @@ void CAmTelnetServer::connectSocket(const pollfd pfd, const sh_pollHandle_t hand
{
(void) handle;
(void) userData;
- //first, accept the connection, create a new filedescriptor
- struct sockaddr answer;
- socklen_t len=sizeof(answer);
- connection_s connection;
- connection.handle = 0;
- connection.filedescriptor = accept(pfd.fd, (struct sockaddr*)&answer, &len);
-
- // Notiy menuhelper
- mTelnetMenuHelper.newSocketConnection(connection.filedescriptor);
-
- //set the correct event:
- short event = 0;
- event |=POLLIN;
-
- //aded the filedescriptor to the sockethandler and register the callbacks for receiving the data
- mSocketHandler->addFDPoll(connection.filedescriptor,event,NULL,&telnetReceiveFiredCB,&telnetCheckCB,&telnetDispatchCB,NULL,connection.handle);
- mListConnections.push_back(connection);
+ //first, accept the connection, create a new filedescriptor
+ struct sockaddr answer;
+ socklen_t len = sizeof(answer);
+ connection_s connection;
+ connection.handle = 0;
+ connection.filedescriptor = accept(pfd.fd, (struct sockaddr*) &answer, &len);
+
+ // Notiy menuhelper
+ mTelnetMenuHelper.newSocketConnection(connection.filedescriptor);
+
+ //set the correct event:
+ short event = 0;
+ event |= POLLIN;
+
+ //aded the filedescriptor to the sockethandler and register the callbacks for receiving the data
+ mpSocketHandler->addFDPoll(connection.filedescriptor, event, NULL, &telnetReceiveFiredCB, &telnetCheckCB, &telnetDispatchCB, NULL, connection.handle);
+ mListConnections.push_back(connection);
}
void CAmTelnetServer::disconnectClient(int filedescriptor)
{
- std::vector<connection_s>::iterator iter = mListConnections.begin();
- while(iter != mListConnections.end())
- {
- if( filedescriptor == iter->filedescriptor )
- {
- if( E_OK == mSocketHandler->removeFDPoll(iter->handle))
- {
- mListConnections.erase(iter);
- close(filedescriptor);
- }
- else
- {
- // TODO: Handle error
- }
-
- break;
- }
- iter++;
- }
+ std::vector<connection_s>::iterator iter = mListConnections.begin();
+ while (iter != mListConnections.end())
+ {
+ if (filedescriptor == iter->filedescriptor)
+ {
+ if (E_OK == mpSocketHandler->removeFDPoll(iter->handle))
+ {
+ mListConnections.erase(iter);
+ close(filedescriptor);
+ }
+ else
+ {
+ // TODO: Handle error
+ }
+
+ break;
+ }
+ iter++;
+ }
}
void CAmTelnetServer::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
{
(void) handle;
(void) userData;
- //initialize buffer
- char buffer[100];
- //read until buffer is full or no more data is there
- int read=recv(pollfd.fd,buffer,100,NULL);
- if (read>1)
- {
- //read the message and store it in a queue - its a telnet connection so data will be sent on enter !
- std::string msg=std::string(buffer,read);
- mMsgList.push(msg);
- }
+ //initialize buffer
+ char buffer[100];
+ //read until buffer is full or no more data is there
+ int read = recv(pollfd.fd, buffer, 100, NULL);
+ if (read > 1)
+ {
+ //read the message and store it in a queue - its a telnet connection so data will be sent on enter !
+ std::string msg = std::string(buffer, read);
+ mListMessages.push(msg);
+ }
}
bool CAmTelnetServer::dispatchData(const sh_pollHandle_t handle, void *userData)
{
(void) userData;
- std::vector<connection_s>::iterator iterator=mListConnections.begin();
- for(;iterator!=mListConnections.end();++iterator)
- {
- if(iterator->handle==handle) break;
- }
- //if (iterator==mListConnections.end()) return false;
-
- std::string command;
- std::queue<std::string> MsgQueue;
- if(!mMsgList.empty())
- {
- sliceCommand(mMsgList.front(),command,MsgQueue);
- mMsgList.pop();
- }
-
- mTelnetMenuHelper.enterCmdQueue(MsgQueue,iterator->filedescriptor);
+ std::vector<connection_s>::iterator iterator = mListConnections.begin();
+ for (; iterator != mListConnections.end(); ++iterator)
+ {
+ if (iterator->handle == handle)
+ break;
+ }
- // must return false to stop endless polling
- return false;
+ std::string command;
+ std::queue<std::string> MsgQueue;
+ if (!mListMessages.empty())
+ {
+ sliceCommand(mListMessages.front(), command, MsgQueue);
+ mListMessages.pop();
+ }
- /*
- mMsgList.pop();
- mMapCommand_t::iterator commandIter=mMapCommands.find(command);
- if (commandIter==mMapCommands.end())
- {
- send(iterator->filedescriptor,"Command not found!\n",20,0);
- }
- else
- {
- commandIter->second(msg,iterator->filedescriptor);
- //(*commandIter).second(msg,iterator->filedescriptor);
- }
+ mTelnetMenuHelper.enterCmdQueue(MsgQueue, iterator->filedescriptor);
- //remove the message from the queue and return false if there is no more message to read.
- if (mMsgList.size()!=0) return true;
- return false;
- */
+ // must return false to stop endless polling
+ return (false);
}
bool CAmTelnetServer::check(const sh_pollHandle_t handle, void *userData)
{
- (void)handle;
- (void)userData;
- if (mMsgList.size() != 0) return true;
- return false;
+ (void) handle;
+ (void) userData;
+ if (mListMessages.size() != 0)
+ return (true);
+ return (false);
}
void am::CAmTelnetServer::sliceCommand(const std::string & string, std::string & command, std::queue<std::string> & MsgQueue)
@@ -238,25 +203,18 @@ void am::CAmTelnetServer::sliceCommand(const std::string & string, std::string &
int c = 0;
- while(!endOfStream)
+ while (!endOfStream)
{
- cmd = *begin;
- MsgQueue.push(cmd);
- begin++;
-
- if(begin == end )
- {
- endOfStream = true;
- }
- c++;
+ cmd = *begin;
+ MsgQueue.push(cmd);
+ begin++;
+
+ if (begin == end)
+ {
+ endOfStream = true;
+ }
+ c++;
}
-
-
- /*
- command = *begin++;
- msg = std::vector<std::string>(begin, end);
- */
}
}
-
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index 4e95baa..9c5820d 100644
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -1,29 +1,24 @@
/**
- * Copyright (C) 2011, BMW AG
+ * Copyright (C) 2012, GENIVI Alliance, Inc.
+ * Copyright (C) 2012, BMW AG
*
- * GeniviAudioMananger AudioManagerDaemon
+ * This file is part of GENIVI Project AudioManager.
*
- * \file main.cpp
+ * Contributions are licensed to the GENIVI Alliance under one or more
+ * Contribution License Agreements.
*
- * \date 20-Oct-2011 3:42:04 PM
- * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ * \copyright
+ * This Source Code Form is subject to the terms of the
+ * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+ * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * \section License
- * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
- * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
*
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
- * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
- * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
- * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
- * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
- * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
+ * \author Frank Herchet, frank.fh.herchet@bmw.de BMW 2012
+ *
+ * \file main.cpp
+ * For further information see http://www.genivi.org/.
*
- */
-
-/**
- * Please make sure to have read the documentation on genivi.org!
*/
//todo: create systemd compatibility
@@ -33,24 +28,15 @@
//todo: clean up startup sequences controller, command and routing interfaces----
//todo: package generation only works if package directory exists...
-#include <config.h>
+#include "config.h"
+
#ifdef WITH_TELNET
#include "CAmTelnetServer.h"
#endif
#ifdef WITH_DBUS_WRAPPER
#include <shared/CAmDbusWrapper.h>
#endif
-#include <shared/CAmSocketHandler.h>
-#include "CAmDatabaseHandler.h"
-#include "CAmControlSender.h"
-#include "CAmCommandSender.h"
-#include "CAmRoutingSender.h"
-#include "CAmRoutingReceiver.h"
-#include "CAmCommandReceiver.h"
-#include "CAmControlReceiver.h"
-#include "CAmDatabaseObserver.h"
-#include "CAmRouter.h"
-#include "shared/CAmDltWrapper.h"
+
#include <sys/resource.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -62,6 +48,18 @@
#include <cstring>
#include <cstdio>
#include <new>
+#include "CAmRouter.h"
+#include "CAmDatabaseHandler.h"
+#include "CAmControlSender.h"
+#include "CAmCommandSender.h"
+#include "CAmRoutingSender.h"
+#include "CAmRoutingReceiver.h"
+#include "CAmCommandReceiver.h"
+#include "CAmControlReceiver.h"
+#include "CAmDatabaseObserver.h"
+#include "shared/CAmDltWrapper.h"
+#include "shared/CAmSocketHandler.h"
+
DLT_DECLARE_CONTEXT(AudioManager)
@@ -94,6 +92,9 @@ unsigned int maxConnections = MAX_TELNETCONNECTIONS;
int fd0, fd1, fd2;
bool enableNoDLTDebug = false;
+/**
+ * the out of memory handler
+ */
void OutOfMemoryHandler()
{
logError("No more memory - bye");
@@ -101,6 +102,9 @@ void OutOfMemoryHandler()
exit(1);
}
+/**
+ * daemonizes the AudioManager
+ */
void daemonize()
{
umask(0);
@@ -149,6 +153,11 @@ void daemonize()
}
}
+/**
+ * parses the command line
+ * @param argc
+ * @param argv
+ */
void parseCommandLine(int argc, char **argv)
{
while (optind < argc)
@@ -211,7 +220,7 @@ void parseCommandLine(int argc, char **argv)
exit(-1);
break;
#ifndef WITH_DLT
- case 'V':
+ case 'V':
printf("[DLT] debug output to stdout enabled\n");
enableNoDLTDebug = true;
break;
@@ -225,6 +234,12 @@ void parseCommandLine(int argc, char **argv)
}
}
+/**
+ * the signal handler
+ * @param sig
+ * @param siginfo
+ * @param context
+ */
static void signalHandler(int sig, siginfo_t *siginfo, void *context)
{
(void) sig;
@@ -236,6 +251,12 @@ static void signalHandler(int sig, siginfo_t *siginfo, void *context)
exit(1);
}
+/**
+ * main
+ * @param argc
+ * @param argv
+ * @return
+ */
int main(int argc, char *argv[])
{
listCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
@@ -271,7 +292,6 @@ int main(int argc, char *argv[])
//Instantiate all classes. Keep in same order !
CAmSocketHandler iSocketHandler;
-
#ifdef WITH_DBUS_WRAPPER
CAmDbusWrapper iDBusWrapper(&iSocketHandler);
#endif /*WITH_DBUS_WRAPPER */
@@ -299,7 +319,6 @@ int main(int argc, char *argv[])
CAmDatabaseObserver iObserver(&iCommandSender,&iRoutingSender, &iSocketHandler);
#endif
-
iDatabaseHandler.registerObserver(&iObserver);
//startup all the Plugins and Interfaces