summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/src
diff options
context:
space:
mode:
authorFrank Herchet <frank.fh.herchet@bmw.de>2012-02-14 17:00:45 +0100
committerFrank Herchet <frank.fh.herchet@bmw.de>2012-02-14 17:00:45 +0100
commit6d59e9585db35d9a3c16f01b4180ea440e4b5a4a (patch)
treeac8931eab1c733becece1a6fa49216169fdcf90e /AudioManagerDaemon/src
parent000b6cb9766473e76e3f7790c6579d44a09c81c0 (diff)
downloadaudiomanager-6d59e9585db35d9a3c16f01b4180ea440e4b5a4a.tar.gz
* merge of changes from Christian
Diffstat (limited to 'AudioManagerDaemon/src')
-rw-r--r--AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp1455
-rw-r--r--AudioManagerDaemon/src/CommandSender.cpp2
-rw-r--r--AudioManagerDaemon/src/ControlReceiver.cpp42
-rw-r--r--AudioManagerDaemon/src/DatabaseHandler.cpp320
-rw-r--r--AudioManagerDaemon/src/SocketHandler.cpp5
-rw-r--r--AudioManagerDaemon/src/TelnetServer.cpp6
-rw-r--r--AudioManagerDaemon/src/main.cpp2
7 files changed, 1014 insertions, 818 deletions
diff --git a/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp b/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
index f965a3b..eca274b 100644
--- a/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
+++ b/AudioManagerDaemon/src/CAmTelnetMenuHelper.cpp
@@ -1,26 +1,26 @@
/**
-* Copyright (C) 2012, BMW AG
-*
-* GeniviAudioMananger AudioManagerDaemon
-*
-* \file CAmTelnetMenuHelper.cpp
-*
-* \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
-*
-* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
-* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
-* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
-* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
-* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
-* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
-*
-*/
+ * Copyright (C) 2012, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file CAmTelnetMenuHelper.cpp
+ *
+ * \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
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ */
#include "CAmTelnetMenuHelper.h"
#include "TelnetServer.h"
@@ -42,30 +42,13 @@ using namespace am;
CAmTelnetMenuHelper* CAmTelnetMenuHelper::instance = NULL;
/****************************************************************************/
-CAmTelnetMenuHelper::CAmTelnetMenuHelper(SocketHandler *iSocketHandler,
- CommandSender *iCommandSender,
- CommandReceiver *iCommandReceiver,
- RoutingSender *iRoutingSender,
- RoutingReceiver *iRoutingReceiver,
- ControlSender *iControlSender,
- ControlReceiver *iControlReceiver,
- DatabaseHandler *iDatabasehandler,
- Router *iRouter,
- TelnetServer *iTelnetServer)
-/****************************************************************************/
-: mTelenetServer(iTelnetServer)
-, mSocketHandler(iSocketHandler)
-, mCommandSender(iCommandSender)
-, mCommandReceiver(iCommandReceiver)
-, mRoutingSender(iRoutingSender)
-, mRoutingReceiver(iRoutingReceiver)
-, mControlSender(iControlSender)
-, mControlReceiver(iControlReceiver)
-, mDatabasehandler(iDatabasehandler)
-, mRouter(iRouter)
+CAmTelnetMenuHelper::CAmTelnetMenuHelper(SocketHandler *iSocketHandler, CommandSender *iCommandSender, CommandReceiver *iCommandReceiver, RoutingSender *iRoutingSender, RoutingReceiver *iRoutingReceiver, ControlSender *iControlSender, ControlReceiver *iControlReceiver, DatabaseHandler *iDatabasehandler, Router *iRouter)
+/****************************************************************************/
+:
+ mTelenetServer(NULL), mSocketHandler(iSocketHandler), mCommandSender(iCommandSender), mCommandReceiver(iCommandReceiver), mRoutingSender(iRoutingSender), mRoutingReceiver(iRoutingReceiver), mControlSender(iControlSender), mControlReceiver(iControlReceiver), mDatabasehandler(iDatabasehandler), mRouter(iRouter)
{
- instance = this;
- createCommandMaps();
+ instance = this;
+ createCommandMaps();
}
/****************************************************************************/
@@ -78,705 +61,696 @@ CAmTelnetMenuHelper::~CAmTelnetMenuHelper()
void CAmTelnetMenuHelper::createCommandMaps()
/****************************************************************************/
{
- // ROOT commands
-
- mRootCommands.clear();
-
- mRootCommands.insert(std::make_pair("help",sCommandPrototypeInfo("show all possible commands",&CAmTelnetMenuHelper::helpCommand)));
- mRootCommands.insert(std::make_pair("list",sCommandPrototypeInfo("Go into 'list'-submenu",&CAmTelnetMenuHelper::rootListCommand)));
- mRootCommands.insert(std::make_pair("info",sCommandPrototypeInfo("Go into 'info'-submenu",&CAmTelnetMenuHelper::rootInfoCommand)));
- mRootCommands.insert(std::make_pair("set",sCommandPrototypeInfo("Go into 'set'-submenu",&CAmTelnetMenuHelper::rootSetCommand)));
- mRootCommands.insert(std::make_pair("get",sCommandPrototypeInfo("Go into 'get'-submenu",&CAmTelnetMenuHelper::rootGetCommand)));
- mRootCommands.insert(std::make_pair("exit",sCommandPrototypeInfo("quit telnet session",&CAmTelnetMenuHelper::exitCommand)));
-
- // List commands
- mListCommands.insert(std::make_pair("help",sCommandPrototypeInfo(std::string("show all possible commands"),&CAmTelnetMenuHelper::helpCommand)));
- mListCommands.insert(std::make_pair("conn",sCommandPrototypeInfo("list all connections",&CAmTelnetMenuHelper::listConnectionsCommand)));
- mListCommands.insert(std::make_pair("sources",sCommandPrototypeInfo("list all available sources",&CAmTelnetMenuHelper::listSourcesCommand)));
- mListCommands.insert(std::make_pair("sinks",sCommandPrototypeInfo("list all available sinks",&CAmTelnetMenuHelper::listSinksCommands)));
- mListCommands.insert(std::make_pair("crfaders",sCommandPrototypeInfo("list all crossfaders",&CAmTelnetMenuHelper::listCrossfaders)));
- mListCommands.insert(std::make_pair("domains",sCommandPrototypeInfo("list all domains",&CAmTelnetMenuHelper::listDomainsCommand)));
- mListCommands.insert(std::make_pair("gws",sCommandPrototypeInfo("list all gateways",&CAmTelnetMenuHelper::listGatewaysCommand)));
- mListCommands.insert(std::make_pair("..",sCommandPrototypeInfo("one step back in menu tree (back to root folder)",&CAmTelnetMenuHelper::oneStepBackCommand)));
- mListCommands.insert(std::make_pair("exit",sCommandPrototypeInfo("close telnet session",&CAmTelnetMenuHelper::exitCommand)));
-
- // Set commands
- mSetCommands.insert(std::make_pair("help",sCommandPrototypeInfo(std::string("show all possible commands"),&CAmTelnetMenuHelper::helpCommand)));
- mSetCommands.insert(std::make_pair("..",sCommandPrototypeInfo("one step back in menu tree (back to root folder)",&CAmTelnetMenuHelper::oneStepBackCommand)));
- mSetCommands.insert(std::make_pair("exit",sCommandPrototypeInfo("close telnet session",&CAmTelnetMenuHelper::exitCommand)));
- mSetCommands.insert(std::make_pair("conn",sCommandPrototypeInfo("use 'conn sourceId sinkId' to connect a source and a sink",&CAmTelnetMenuHelper::setConnection)));
- mSetCommands.insert(std::make_pair("routing",sCommandPrototypeInfo("use 'routing sourceId sinkId' to get all\n\t possible routes between a sourceID and a sinkID",&CAmTelnetMenuHelper::setRoutingCommand)));
- mSetCommands.insert(std::make_pair("disc",sCommandPrototypeInfo("use 'disc connectionID' to disconnect \n\t this connection",&CAmTelnetMenuHelper::setDisconnectConnId)));
-
- // Get commands
- mGetCommands.insert(std::make_pair("help",sCommandPrototypeInfo(std::string("show all possible commands"),&CAmTelnetMenuHelper::helpCommand)));
- mGetCommands.insert(std::make_pair("routing",sCommandPrototypeInfo("show current routing",&CAmTelnetMenuHelper::getRoutingCommand)));
- mGetCommands.insert(std::make_pair("sendv",sCommandPrototypeInfo("show senderversion",&CAmTelnetMenuHelper::getSenderversionCommand)));
- mGetCommands.insert(std::make_pair("recv",sCommandPrototypeInfo("show receiverversion ",&CAmTelnetMenuHelper::getReceiverversionCommand)));
- mGetCommands.insert(std::make_pair("..",sCommandPrototypeInfo("one step back in menu tree (back to root folder)",&CAmTelnetMenuHelper::oneStepBackCommand)));
- mGetCommands.insert(std::make_pair("exit",sCommandPrototypeInfo("close telnet session",&CAmTelnetMenuHelper::exitCommand)));
-
- // Info comands
- mInfoCommands.insert(std::make_pair("help",sCommandPrototypeInfo(std::string("show all possible commands"),&CAmTelnetMenuHelper::helpCommand)));
- mInfoCommands.insert(std::make_pair("sysprop",sCommandPrototypeInfo("show all systemproperties",&CAmTelnetMenuHelper::infoSystempropertiesCommand)));
- mInfoCommands.insert(std::make_pair("..",sCommandPrototypeInfo("one step back in menu tree (back to root folder)",&CAmTelnetMenuHelper::oneStepBackCommand)));
- mInfoCommands.insert(std::make_pair("exit",sCommandPrototypeInfo("close telnet session",&CAmTelnetMenuHelper::exitCommand)));
+ // ROOT commands
+
+ mRootCommands.clear();
+
+ mRootCommands.insert(std::make_pair("help", sCommandPrototypeInfo("show all possible commands", &CAmTelnetMenuHelper::helpCommand)));
+ mRootCommands.insert(std::make_pair("list", sCommandPrototypeInfo("Go into 'list'-submenu", &CAmTelnetMenuHelper::rootListCommand)));
+ mRootCommands.insert(std::make_pair("info", sCommandPrototypeInfo("Go into 'info'-submenu", &CAmTelnetMenuHelper::rootInfoCommand)));
+ mRootCommands.insert(std::make_pair("set", sCommandPrototypeInfo("Go into 'set'-submenu", &CAmTelnetMenuHelper::rootSetCommand)));
+ mRootCommands.insert(std::make_pair("get", sCommandPrototypeInfo("Go into 'get'-submenu", &CAmTelnetMenuHelper::rootGetCommand)));
+ mRootCommands.insert(std::make_pair("exit", sCommandPrototypeInfo("quit telnet session", &CAmTelnetMenuHelper::exitCommand)));
+
+ // List commands
+ mListCommands.insert(std::make_pair("help", sCommandPrototypeInfo(std::string("show all possible commands"), &CAmTelnetMenuHelper::helpCommand)));
+ mListCommands.insert(std::make_pair("conn", sCommandPrototypeInfo("list all connections", &CAmTelnetMenuHelper::listConnectionsCommand)));
+ mListCommands.insert(std::make_pair("sources", sCommandPrototypeInfo("list all available sources", &CAmTelnetMenuHelper::listSourcesCommand)));
+ mListCommands.insert(std::make_pair("sinks", sCommandPrototypeInfo("list all available sinks", &CAmTelnetMenuHelper::listSinksCommands)));
+ mListCommands.insert(std::make_pair("crfaders", sCommandPrototypeInfo("list all crossfaders", &CAmTelnetMenuHelper::listCrossfaders)));
+ mListCommands.insert(std::make_pair("domains", sCommandPrototypeInfo("list all domains", &CAmTelnetMenuHelper::listDomainsCommand)));
+ mListCommands.insert(std::make_pair("gws", sCommandPrototypeInfo("list all gateways", &CAmTelnetMenuHelper::listGatewaysCommand)));
+ mListCommands.insert(std::make_pair("..", sCommandPrototypeInfo("one step back in menu tree (back to root folder)", &CAmTelnetMenuHelper::oneStepBackCommand)));
+ mListCommands.insert(std::make_pair("exit", sCommandPrototypeInfo("close telnet session", &CAmTelnetMenuHelper::exitCommand)));
+
+ // Set commands
+ mSetCommands.insert(std::make_pair("help", sCommandPrototypeInfo(std::string("show all possible commands"), &CAmTelnetMenuHelper::helpCommand)));
+ mSetCommands.insert(std::make_pair("..", sCommandPrototypeInfo("one step back in menu tree (back to root folder)", &CAmTelnetMenuHelper::oneStepBackCommand)));
+ mSetCommands.insert(std::make_pair("exit", sCommandPrototypeInfo("close telnet session", &CAmTelnetMenuHelper::exitCommand)));
+ mSetCommands.insert(std::make_pair("conn", sCommandPrototypeInfo("use 'conn sourceId sinkId' to connect a source and a sink", &CAmTelnetMenuHelper::setConnection)));
+ mSetCommands.insert(std::make_pair("routing", sCommandPrototypeInfo("use 'routing sourceId sinkId' to get all\n\t possible routes between a sourceID and a sinkID", &CAmTelnetMenuHelper::setRoutingCommand)));
+ mSetCommands.insert(std::make_pair("disc", sCommandPrototypeInfo("use 'disc connectionID' to disconnect \n\t this connection", &CAmTelnetMenuHelper::setDisconnectConnId)));
+
+ // Get commands
+ mGetCommands.insert(std::make_pair("help", sCommandPrototypeInfo(std::string("show all possible commands"), &CAmTelnetMenuHelper::helpCommand)));
+ mGetCommands.insert(std::make_pair("routing", sCommandPrototypeInfo("show current routing", &CAmTelnetMenuHelper::getRoutingCommand)));
+ mGetCommands.insert(std::make_pair("sendv", sCommandPrototypeInfo("show senderversion", &CAmTelnetMenuHelper::getSenderversionCommand)));
+ mGetCommands.insert(std::make_pair("recv", sCommandPrototypeInfo("show receiverversion ", &CAmTelnetMenuHelper::getReceiverversionCommand)));
+ mGetCommands.insert(std::make_pair("..", sCommandPrototypeInfo("one step back in menu tree (back to root folder)", &CAmTelnetMenuHelper::oneStepBackCommand)));
+ mGetCommands.insert(std::make_pair("exit", sCommandPrototypeInfo("close telnet session", &CAmTelnetMenuHelper::exitCommand)));
+
+ // Info comands
+ mInfoCommands.insert(std::make_pair("help", sCommandPrototypeInfo(std::string("show all possible commands"), &CAmTelnetMenuHelper::helpCommand)));
+ mInfoCommands.insert(std::make_pair("sysprop", sCommandPrototypeInfo("show all systemproperties", &CAmTelnetMenuHelper::infoSystempropertiesCommand)));
+ mInfoCommands.insert(std::make_pair("..", sCommandPrototypeInfo("one step back in menu tree (back to root folder)", &CAmTelnetMenuHelper::oneStepBackCommand)));
+ mInfoCommands.insert(std::make_pair("exit", sCommandPrototypeInfo("close telnet session", &CAmTelnetMenuHelper::exitCommand)));
}
/****************************************************************************/
void CAmTelnetMenuHelper::setTelnetServer(TelnetServer* iTelnetServer)
/****************************************************************************/
{
- mTelenetServer = iTelnetServer;
+ mTelenetServer = iTelnetServer;
}
/****************************************************************************/
void CAmTelnetMenuHelper::newSocketConnection(int filedescriptor)
/****************************************************************************/
{
- EMainState state = eRootState;
- std::map<int,EMainState>::iterator it;
- std::stringstream welcome;
+ EMainState state = eRootState;
+ std::map<int, EMainState>::iterator it;
+ std::stringstream welcome;
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- // socket connection already exists, delete entry and go back to root state
- mCurrentMainStateMap.erase(it);
- }
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ // socket connection already exists, delete entry and go back to root state
+ mCurrentMainStateMap.erase(it);
+ }
- it = mCurrentMainStateMap.begin();
+ it = mCurrentMainStateMap.begin();
- // insert new socket connection
- mCurrentMainStateMap.insert(it,std::make_pair<int,EMainState>(filedescriptor,state));
+ // insert new socket connection
+ mCurrentMainStateMap.insert(it, std::make_pair<int, EMainState>(filedescriptor, state));
- // Send welcome message
- welcome << "Welcome to GENIVI AudioManager " << DAEMONVERSION << "\n>";
- send(filedescriptor,welcome.str().c_str(),welcome.str().size(),0);
+ // Send welcome message
+ welcome << "Welcome to GENIVI AudioManager " << DAEMONVERSION << "\n>";
+ send(filedescriptor, welcome.str().c_str(), welcome.str().size(), 0);
}
/****************************************************************************/
void CAmTelnetMenuHelper::socketConnectionsClosed(int filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
-
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- mCurrentMainStateMap.erase(it);
- }
- else
- {
- // connection not found
- }
+ std::map<int, EMainState>::iterator it;
+
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ mCurrentMainStateMap.erase(it);
+ }
+ else
+ {
+ // connection not found
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::enterCmdQueue(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- std::string cmd;
- tCommandMap::iterator cmditer;
-
- // find current filedescriptor to get the current state of the telnet session
- it = mCurrentMainStateMap.find(filedescriptor);
- while(!CmdQueue.empty())
- {
- cmd = CmdQueue.front();
-
- // Now remove the first command, it's stored in 'cmd'
- CmdQueue.pop();
- // telnet session found. depending on the current state, different commands are available
- switch(it->second)
- {
- case eRootState:
+ std::map<int, EMainState>::iterator it;
+ std::string cmd;
+ tCommandMap::iterator cmditer;
+
+ // find current filedescriptor to get the current state of the telnet session
+ it = mCurrentMainStateMap.find(filedescriptor);
+ while (!CmdQueue.empty())
+ {
+ cmd = CmdQueue.front();
+
+ // Now remove the first command, it's stored in 'cmd'
+ CmdQueue.pop();
+ // telnet session found. depending on the current state, different commands are available
+ switch (it->second)
+ {
+ case eRootState:
cmditer = mRootCommands.find(cmd);
- if(mRootCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue,filedescriptor);
+ if (mRootCommands.end() != cmditer)
+ cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
else
- sendError(filedescriptor,"Command not found\n");
+ sendError(filedescriptor, "Command not found\n");
break;
- case eListState:
+ case eListState:
cmditer = mListCommands.find(cmd);
- if(mListCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue,filedescriptor);
+ if (mListCommands.end() != cmditer)
+ cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
else
- sendError(filedescriptor,"Command not found\n");
+ sendError(filedescriptor, "Command not found\n");
break;
- case eInfoState:
+ case eInfoState:
cmditer = mInfoCommands.find(cmd);
- if(mInfoCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue,filedescriptor);
+ if (mInfoCommands.end() != cmditer)
+ cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
else
- sendError(filedescriptor,"Command not found\n");
+ sendError(filedescriptor, "Command not found\n");
break;
- case eGetState:
+ case eGetState:
cmditer = mGetCommands.find(cmd);
- if(mGetCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue,filedescriptor);
+ if (mGetCommands.end() != cmditer)
+ cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
else
- sendError(filedescriptor,"Command not found\n");
+ sendError(filedescriptor, "Command not found\n");
break;
- case eSetState:
+ case eSetState:
cmditer = mSetCommands.find(cmd);
- if(mSetCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue,filedescriptor);
+ if (mSetCommands.end() != cmditer)
+ cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
else
- sendError(filedescriptor,"Command not found\n");
+ sendError(filedescriptor, "Command not found\n");
break;
- default:
+ default:
break;
- }
- }
+ }
+ }
- sendCurrentCmdPrompt(filedescriptor);
+ sendCurrentCmdPrompt(filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::sendError(int & filedescriptor, std::string error_string)
/****************************************************************************/
{
- send(filedescriptor,error_string.c_str(),error_string.size(),0);
+ send(filedescriptor, error_string.c_str(), error_string.size(), 0);
}
/****************************************************************************/
void CAmTelnetMenuHelper::sendTelnetLine(int & filedescriptor, std::stringstream &line)
/****************************************************************************/
{
- send(filedescriptor,line.str().c_str(),line.str().size(),0);
+ send(filedescriptor, line.str().c_str(), line.str().size(), 0);
}
/****************************************************************************/
void CAmTelnetMenuHelper::sendCurrentCmdPrompt(int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- std::stringstream outputstream;
- outputstream << std::endl;
-
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- switch(it->second)
- {
- case eRootState:
- outputstream << "\\>";
+ std::map<int, EMainState>::iterator it;
+ std::stringstream outputstream;
+ outputstream << std::endl;
+
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ switch (it->second)
+ {
+ case eRootState:
+ outputstream << "\\>";
break;
- case eListState:
- outputstream << "\\List>";
+ case eListState:
+ outputstream << "\\List>";
break;
- case eGetState:
- outputstream << "\\Get>";
+ case eGetState:
+ outputstream << "\\Get>";
break;
- case eSetState:
- outputstream << "\\Set>";
+ case eSetState:
+ outputstream << "\\Set>";
break;
- case eInfoState:
- outputstream << "\\Info>";
+ case eInfoState:
+ outputstream << "\\Info>";
break;
- default:
+ default:
break;
- }
+ }
- send(filedescriptor,outputstream.str().c_str(),outputstream.str().size(),0);
+ send(filedescriptor, outputstream.str().c_str(), outputstream.str().size(), 0);
- }
- else
- {
- // connection not found
- }
+ }
+ else
+ {
+ // connection not found
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::exitCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->exitCommandExec(CmdQueue,filedescriptor);
+ instance->exitCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::oneStepBackCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- if(DEBUG_ON)std::cout << "old state: " << it->second;
- switch(it->second)
- {
- case eRootState:
+ (void) CmdQueue;
+ std::map<int, EMainState>::iterator it;
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ if (DEBUG_ON)
+ std::cout << "old state: " << it->second;
+ switch (it->second)
+ {
+ case eRootState:
it->second = eRootState;
break;
- case eListState:
- it->second = eRootState;;
+ case eListState:
+ it->second = eRootState;
+ ;
break;
- case eGetState:
- it->second = eRootState;;
+ case eGetState:
+ it->second = eRootState;
+ ;
break;
- case eSetState:
- it->second = eRootState;;
+ case eSetState:
+ it->second = eRootState;
+ ;
break;
- case eInfoState:
- it->second = eRootState;;
+ case eInfoState:
+ it->second = eRootState;
+ ;
break;
- default:
+ default:
it->second = eRootState;
break;
- }
- if(DEBUG_ON)std::cout << "new state: " << it->second << std::endl;
- }
+ }
+ if (DEBUG_ON)
+ std::cout << "new state: " << it->second << std::endl;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::oneStepBackCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->oneStepBackCommandExec(CmdQueue,filedescriptor);
+ instance->oneStepBackCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::exitCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- std::stringstream line;
- std::stringstream output;
-
- // Sending a last message to the client
- output << "Your wish is my command ... bye!" << std::endl;
- sendTelnetLine(filedescriptor,output);
-
-
- tCommandMap::iterator iter;
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- if(DEBUG_ON)std::cout << "removing client connection " << filedescriptor << std::endl;
-
- if(NULL != mTelenetServer)
- {
- mTelenetServer->disconnectClient(filedescriptor);
- mCurrentMainStateMap.erase(it);
- }
- else
- {
- // ASSERT mTelenetServer == NULL
- if(DEBUG_ON)std::cout << "mTelenetServer";
- }
- }
+ (void) CmdQueue;
+ std::map<int, EMainState>::iterator it;
+ std::stringstream line;
+ std::stringstream output;
+
+ // Sending a last message to the client
+ output << "Your wish is my command ... bye!" << std::endl;
+ sendTelnetLine(filedescriptor, output);
+
+ tCommandMap::iterator iter;
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ if (DEBUG_ON)
+ std::cout << "removing client connection " << filedescriptor << std::endl;
+
+ if (NULL != mTelenetServer)
+ {
+ mTelenetServer->disconnectClient(filedescriptor);
+ mCurrentMainStateMap.erase(it);
+ }
+ else
+ {
+ // ASSERT mTelenetServer == NULL
+ if (DEBUG_ON)
+ std::cout << "mTelenetServer";
+ }
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::helpCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->helpCommandExec(CmdQueue,filedescriptor);
+ instance->helpCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::helpCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- std::stringstream line;
- tCommandMap::iterator cmdIter;
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- line << "###################################################" << std::endl;
- line << "###### The following commands are supported: ######"<< std::endl;
- line << "###################################################" << std::endl << std::endl;
- switch(it->second)
- {
- case eRootState:
+ (void) CmdQueue;
+ std::map<int, EMainState>::iterator it;
+ std::stringstream line;
+ tCommandMap::iterator cmdIter;
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ line << "###################################################" << std::endl;
+ line << "###### The following commands are supported: ######" << std::endl;
+ line << "###################################################" << std::endl << std::endl;
+ switch (it->second)
+ {
+ case eRootState:
cmdIter = mRootCommands.begin();
- while(cmdIter != mRootCommands.end())
+ while (cmdIter != mRootCommands.end())
{
- line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
+ line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
+ cmdIter++;
}
break;
- case eListState:
+ case eListState:
cmdIter = mListCommands.begin();
- while(cmdIter != mListCommands.end())
+ while (cmdIter != mListCommands.end())
{
- line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
+ line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
+ cmdIter++;
}
break;
- case eGetState:
+ case eGetState:
cmdIter = mGetCommands.begin();
- while(cmdIter != mGetCommands.end())
+ while (cmdIter != mGetCommands.end())
{
- line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
+ line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
+ cmdIter++;
}
break;
- case eSetState:
+ case eSetState:
cmdIter = mSetCommands.begin();
- while(cmdIter != mSetCommands.end())
+ while (cmdIter != mSetCommands.end())
{
- line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
+ line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
+ cmdIter++;
}
break;
- case eInfoState:
+ case eInfoState:
cmdIter = mInfoCommands.begin();
- while(cmdIter != mInfoCommands.end())
+ while (cmdIter != mInfoCommands.end())
{
- line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
+ line << cmdIter->first << "\t- " << cmdIter->second.info << std::endl;
+ cmdIter++;
}
break;
- default:
+ default:
break;
- }
- sendTelnetLine(filedescriptor,line);
- }
+ }
+ sendTelnetLine(filedescriptor, line);
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::rootGetCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->rootGetCommandExec(CmdQueue,filedescriptor);
+ instance->rootGetCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::rootGetCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- it->second = eGetState;
- }
+ (void) CmdQueue;
+ std::map<int, EMainState>::iterator it;
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ it->second = eGetState;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::rootSetCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->rootSetCommandExec(CmdQueue,filedescriptor);
+ instance->rootSetCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::rootSetCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- it->second = eSetState;
- }
+ (void) CmdQueue;
+ std::map<int, EMainState>::iterator it;
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ it->second = eSetState;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::rootListCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->rootListCommandExec(CmdQueue,filedescriptor);
+ instance->rootListCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::rootListCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- it->second = eListState;
- }
+ (void) CmdQueue;
+ std::map<int, EMainState>::iterator it;
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ it->second = eListState;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::rootInfoCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->rootInfoCommandExec(CmdQueue,filedescriptor);
+ instance->rootInfoCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::rootInfoCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::map<int,EMainState>::iterator it;
- it = mCurrentMainStateMap.find(filedescriptor);
- if( it != mCurrentMainStateMap.end())
- {
- it->second = eInfoState;
- }
+ (void) CmdQueue;
+ std::map<int, EMainState>::iterator it;
+ it = mCurrentMainStateMap.find(filedescriptor);
+ if (it != mCurrentMainStateMap.end())
+ {
+ it->second = eInfoState;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::listConnectionsCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->listConnectionsCommandExec(CmdQueue,filedescriptor);
+ instance->listConnectionsCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::listConnectionsCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::vector<am_Connection_s> listConnections;
- std::stringstream line;
+ (void) CmdQueue;
+ std::vector<am_Connection_s> listConnections;
+ std::stringstream line;
- mDatabasehandler->getListConnections(listConnections);
+ mDatabasehandler->getListConnections(listConnections);
- line << "\tCurrent connections: " << listConnections.size() << std::endl;
+ line << "\tCurrent connections: " << listConnections.size() << std::endl;
- sendTelnetLine(filedescriptor,line);
+ sendTelnetLine(filedescriptor, line);
- std::vector<am_Connection_s>::iterator it(listConnections.begin());
- while(it != listConnections.end())
- {
- line.str("");
- line << "\tID: " << it->connectionID
- << "\tSrcID: " << it->sourceID
- << "\tSinkID: " << it->sinkID
- << "\tFormat: " << it->connectionFormat
- << "\tdelay: " << it->delay
- << std::endl;
+ std::vector<am_Connection_s>::iterator it(listConnections.begin());
+ while (it != listConnections.end())
+ {
+ line.str("");
+ line << "\tID: " << it->connectionID << "\tSrcID: " << it->sourceID << "\tSinkID: " << it->sinkID << "\tFormat: " << it->connectionFormat << "\tdelay: " << it->delay << std::endl;
- sendTelnetLine(filedescriptor,line);
- it++;
- }
+ sendTelnetLine(filedescriptor, line);
+ it++;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::listSourcesCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->listSourcesCommandExec(CmdQueue,filedescriptor);
+ instance->listSourcesCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::listSourcesCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::vector<am_Source_s> listSources;
- std::stringstream line;
-
- mDatabasehandler->getListSources(listSources);
-
- line << "\tCurrent sources: " << listSources.size();
- sendTelnetLine(filedescriptor,line);
-
- std::vector<am_Source_s>::iterator it(listSources.begin());
- while(it != listSources.end())
- {
- line.str("");
- line << "\tID: " << it->sourceID
- << "\tDomainID: " << it->domainID
- << "\tName: " << it->name
- << "\tState: " << it->sourceState
- << "\tVolume: " << it->volume
- << std::endl;
-
- sendTelnetLine(filedescriptor,line);
- it++;
- }
+ (void) CmdQueue;
+ std::vector<am_Source_s> listSources;
+ std::stringstream line;
+
+ mDatabasehandler->getListSources(listSources);
+
+ line << "\tCurrent sources: " << listSources.size();
+ sendTelnetLine(filedescriptor, line);
+
+ std::vector<am_Source_s>::iterator it(listSources.begin());
+ while (it != listSources.end())
+ {
+ line.str("");
+ line << "\tID: " << it->sourceID << "\tDomainID: " << it->domainID << "\tName: " << it->name << "\tState: " << it->sourceState << "\tVolume: " << it->volume << std::endl;
+
+ sendTelnetLine(filedescriptor, line);
+ it++;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::listSinksCommands(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->listSinksCommandsExec(CmdQueue,filedescriptor);
+ instance->listSinksCommandsExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::listSinksCommandsExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::vector<am_Sink_s> listSinks;
- std::stringstream line;
-
- mDatabasehandler->getListSinks(listSinks);
-
- line << "\tCurrent sinks: " << listSinks.size() << std::endl;
- sendTelnetLine(filedescriptor,line);
-
- std::vector<am_Sink_s>::iterator it(listSinks.begin());
- while(it != listSinks.end())
- {
- line.str("");
- line << "\tID: " << it->sinkID
- << "\tDomainID: " << it->domainID
- << "\tName: " << it->name
- << "\tAvailable: " << it->available.availability
- << "\tVolume: " << it->volume
- << std::endl;
-
- sendTelnetLine(filedescriptor,line);
- it++;
- }
+ (void) CmdQueue;
+ std::vector<am_Sink_s> listSinks;
+ std::stringstream line;
+
+ mDatabasehandler->getListSinks(listSinks);
+
+ line << "\tCurrent sinks: " << listSinks.size() << std::endl;
+ sendTelnetLine(filedescriptor, line);
+
+ std::vector<am_Sink_s>::iterator it(listSinks.begin());
+ while (it != listSinks.end())
+ {
+ line.str("");
+ line << "\tID: " << it->sinkID << "\tDomainID: " << it->domainID << "\tName: " << it->name << "\tAvailable: " << it->available.availability << "\tVolume: " << it->volume << std::endl;
+
+ sendTelnetLine(filedescriptor, line);
+ it++;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::listCrossfaders(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->listCrossfadersExec(CmdQueue,filedescriptor);
+ instance->listCrossfadersExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::listCrossfadersExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::vector<am_Crossfader_s> listCrossfaders;
- std::stringstream line;
-
- mDatabasehandler->getListCrossfaders(listCrossfaders);
-
- line << "\tCurrent crossfaders: " << listCrossfaders.size();
- sendTelnetLine(filedescriptor,line);
-
- std::vector<am_Crossfader_s>::iterator it(listCrossfaders.begin());
- while(it != listCrossfaders.end())
- {
- line.str("");
- line << "\tID: " << it->crossfaderID
- << "\tName: " << it->name
- << "\tSourceID: " << it->sourceID
- << std::endl;
-
- sendTelnetLine(filedescriptor,line);
- it++;
- }
+ (void) CmdQueue;
+ std::vector<am_Crossfader_s> listCrossfaders;
+ std::stringstream line;
+
+ mDatabasehandler->getListCrossfaders(listCrossfaders);
+
+ line << "\tCurrent crossfaders: " << listCrossfaders.size();
+ sendTelnetLine(filedescriptor, line);
+
+ std::vector<am_Crossfader_s>::iterator it(listCrossfaders.begin());
+ while (it != listCrossfaders.end())
+ {
+ line.str("");
+ line << "\tID: " << it->crossfaderID << "\tName: " << it->name << "\tSourceID: " << it->sourceID << std::endl;
+
+ sendTelnetLine(filedescriptor, line);
+ it++;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::listDomainsCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->listDomainsCommandExec(CmdQueue,filedescriptor);
+ instance->listDomainsCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::listDomainsCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::vector<am_Domain_s> listDomains;
- std::stringstream line;
-
- mDatabasehandler->getListDomains(listDomains);
-
- line << "\tCurrent domains: " << listDomains.size()<<std::endl;
- sendTelnetLine(filedescriptor,line);
-
- std::vector<am_Domain_s>::iterator it(listDomains.begin());
- while(it != listDomains.end())
- {
- line.str("");
- line << "\tID: " << it->domainID
- << "\tName: " << it->name
- << "\tBusname: " << it->busname
- << "\tNodename: " << it->nodename
- << "\tState: " << static_cast<int>(it->state)
- << std::endl;
-
- sendTelnetLine(filedescriptor,line);
- it++;
- }
+ (void) CmdQueue;
+ std::vector<am_Domain_s> listDomains;
+ std::stringstream line;
+
+ mDatabasehandler->getListDomains(listDomains);
+
+ line << "\tCurrent domains: " << listDomains.size() << std::endl;
+ sendTelnetLine(filedescriptor, line);
+
+ std::vector<am_Domain_s>::iterator it(listDomains.begin());
+ while (it != listDomains.end())
+ {
+ line.str("");
+ line << "\tID: " << it->domainID << "\tName: " << it->name << "\tBusname: " << it->busname << "\tNodename: " << it->nodename << "\tState: " << static_cast<int>(it->state) << std::endl;
+
+ sendTelnetLine(filedescriptor, line);
+ it++;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::listGatewaysCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->listGatewaysCommandExec(CmdQueue,filedescriptor);
+ instance->listGatewaysCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::listGatewaysCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::vector<am_Gateway_s> listGateways;
- std::stringstream line;
-
- mDatabasehandler->getListGateways(listGateways);
-
- line << "\tCurrent gateways: " << listGateways.size();
- sendTelnetLine(filedescriptor,line);
-
- std::vector<am_Gateway_s>::iterator it(listGateways.begin());
- while(it != listGateways.end())
- {
- line.str("");
- line << "\tID: " << it->gatewayID
- << "\tName: " << it->name
- << "\tSourceID: " << it->sourceID
- << "\tSinkID: " << it->sinkID
- << std::endl;
-
- sendTelnetLine(filedescriptor,line);
- it++;
- }
+ (void) CmdQueue;
+ std::vector<am_Gateway_s> listGateways;
+ std::stringstream line;
+
+ mDatabasehandler->getListGateways(listGateways);
+
+ line << "\tCurrent gateways: " << listGateways.size();
+ sendTelnetLine(filedescriptor, line);
+
+ std::vector<am_Gateway_s>::iterator it(listGateways.begin());
+ while (it != listGateways.end())
+ {
+ line.str("");
+ line << "\tID: " << it->gatewayID << "\tName: " << it->name << "\tSourceID: " << it->sourceID << "\tSinkID: " << it->sinkID << std::endl;
+
+ sendTelnetLine(filedescriptor, line);
+ it++;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::getRoutingCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->getRoutingCommandExec(CmdQueue,filedescriptor);
+ instance->getRoutingCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::getRoutingCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- //TODO: fill with function
+ (void) CmdQueue;
+ (void) filedescriptor;
+ //TODO: fill with function
}
/****************************************************************************/
void CAmTelnetMenuHelper::getSenderversionCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->getSenderversionCommandExec(CmdQueue,filedescriptor);
+ instance->getSenderversionCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::getSenderversionCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::stringstream line;
+ (void) CmdQueue;
+ std::stringstream line;
- line << "\tSender versions:" << std::endl
- << "\tCtrl: " << mControlSender->getInterfaceVersion() << " | "
- << "Cmd: " << mCommandSender->getInterfaceVersion() << " | "
- << "Routing: " << mRoutingSender->getInterfaceVersion() << std::endl;
+ line << "\tSender versions:" << std::endl << "\tCtrl: " << mControlSender->getInterfaceVersion() << " | " << "Cmd: " << mCommandSender->getInterfaceVersion() << " | " << "Routing: " << mRoutingSender->getInterfaceVersion() << std::endl;
- sendTelnetLine(filedescriptor,line);
+ sendTelnetLine(filedescriptor, line);
}
/****************************************************************************/
void CAmTelnetMenuHelper::getReceiverversionCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->getReceiverversionCommandExec(CmdQueue,filedescriptor);
+ instance->getReceiverversionCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::getReceiverversionCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::stringstream line;
+ (void) CmdQueue;
+ std::stringstream line;
- line << "\tReceiver versions:" << std::endl
- << "\tCtrl: " << mControlReceiver->getInterfaceVersion() << " | "
- << "Cmd: " << mCommandReceiver->getInterfaceVersion() << " | "
- << "Routing: " << mRoutingReceiver->getInterfaceVersion() << std::endl;
+ line << "\tReceiver versions:" << std::endl << "\tCtrl: " << mControlReceiver->getInterfaceVersion() << " | " << "Cmd: " << mCommandReceiver->getInterfaceVersion() << " | " << "Routing: " << mRoutingReceiver->getInterfaceVersion() << std::endl;
- sendTelnetLine(filedescriptor,line);
+ sendTelnetLine(filedescriptor, line);
}
@@ -784,106 +758,106 @@ void CAmTelnetMenuHelper::getReceiverversionCommandExec(std::queue<std::string>
void CAmTelnetMenuHelper::infoSystempropertiesCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->infoSystempropertiesCommandExec(CmdQueue,filedescriptor);
+ instance->infoSystempropertiesCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::infoSystempropertiesCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::vector<am_SystemProperty_s> listSystemProperties;
- std::vector<am_SystemProperty_s>::iterator it;
- std::stringstream line;
-
- mDatabasehandler->getListSystemProperties(listSystemProperties);
-
- line << "\tSystemproperties: ";
- sendTelnetLine(filedescriptor,line);
-
- for(it = listSystemProperties.begin(); it < listSystemProperties.end(); it++ )
- {
- line.str("");
- line << "\tType: " << it->type << " Value: " << it->value << std::endl;
- sendTelnetLine(filedescriptor,line);
- }
+ (void) CmdQueue;
+ std::vector<am_SystemProperty_s> listSystemProperties;
+ std::vector<am_SystemProperty_s>::iterator it;
+ std::stringstream line;
+
+ mDatabasehandler->getListSystemProperties(listSystemProperties);
+
+ line << "\tSystemproperties: ";
+ sendTelnetLine(filedescriptor, line);
+
+ for (it = listSystemProperties.begin(); it < listSystemProperties.end(); it++)
+ {
+ line.str("");
+ line << "\tType: " << it->type << " Value: " << it->value << std::endl;
+ sendTelnetLine(filedescriptor, line);
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::setRoutingCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->setRoutingCommandExec(CmdQueue,filedescriptor);
+ instance->setRoutingCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::setRoutingCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::stringstream output;
- std::vector<am_Route_s> routingList;
-
- am_sourceID_t sourceID = 0;
- am_sinkID_t sinkID = 0;
-
- bool error = false;
- am_Error_e rError = E_OK;
-
-
- if(CmdQueue.size() >= 2)
- {
- std::istringstream istream_sourceID(CmdQueue.front());
- CmdQueue.pop();
- std::istringstream istream_sinkID(CmdQueue.front());
- CmdQueue.pop();
-
- if(!(istream_sourceID >> sourceID))
- error = true;
- if(!(istream_sinkID >> sinkID))
- error = true;
-
- if(error)
- {
- sendError(filedescriptor,"Error parsing sourcID and sinkID");
- return;
- }
-
- if(DEBUG_ON)std::cout << "setRoutingCommandExec(sourceID: " << sourceID << ",sinkID: " << sinkID << ")" << std::endl;
-
- rError = mRouter->getRoute(true,sourceID,sinkID,routingList);
-
- if(E_OK == rError)
- {
- std::vector<am_Route_s>::iterator rlIter = routingList.begin();
- for(int rlCnt = 1;rlIter < routingList.end();rlIter++)
- {
- output << "#" << rlCnt << " ";
-
- std::vector<am_RoutingElement_s>::iterator reIter = rlIter->route.begin();
- for(;reIter < rlIter->route.end();reIter++)
+ std::stringstream output;
+ std::vector<am_Route_s> routingList;
+
+ am_sourceID_t sourceID = 0;
+ am_sinkID_t sinkID = 0;
+
+ bool error = false;
+ am_Error_e rError = E_OK;
+
+ if (CmdQueue.size() >= 2)
+ {
+ std::istringstream istream_sourceID(CmdQueue.front());
+ CmdQueue.pop();
+ std::istringstream istream_sinkID(CmdQueue.front());
+ CmdQueue.pop();
+
+ if (!(istream_sourceID >> sourceID))
+ error = true;
+ if (!(istream_sinkID >> sinkID))
+ error = true;
+
+ if (error)
+ {
+ sendError(filedescriptor, "Error parsing sourcID and sinkID");
+ return;
+ }
+
+ if (DEBUG_ON)
+ std::cout << "setRoutingCommandExec(sourceID: " << sourceID << ",sinkID: " << sinkID << ")" << std::endl;
+
+ rError = mRouter->getRoute(true, sourceID, sinkID, routingList);
+
+ if (E_OK == rError)
+ {
+ std::vector<am_Route_s>::iterator rlIter = routingList.begin();
+ for (int rlCnt = 1; rlIter < routingList.end(); rlIter++)
{
- reIter->connectionFormat;
- reIter->domainID;
- output << ">(" << reIter->sourceID << ")->--[D:"<< reIter->domainID <<"][F:"<< reIter->connectionFormat <<"]-->-(" << reIter->sinkID<< ")" << std::endl;
- }
-
- rlCnt++;
- }
+ output << "#" << rlCnt << " ";
- sendTelnetLine(filedescriptor,output);
- }
- else
- {
- sendError(filedescriptor,"Error getting route");
- }
+ std::vector<am_RoutingElement_s>::iterator reIter = rlIter->route.begin();
+ for (; reIter < rlIter->route.end(); reIter++)
+ {
+ reIter->connectionFormat;
+ reIter->domainID;
+ output << ">(" << reIter->sourceID << ")->--[D:" << reIter->domainID << "][F:" << reIter->connectionFormat << "]-->-(" << reIter->sinkID << ")" << std::endl;
+ }
- }
- else
- {
- CmdQueue.pop();
- output << "Not enough arguments to set routing. Please enter sourceID and sinkID after command" << std::endl;
- return;
- }
+ rlCnt++;
+ }
+ sendTelnetLine(filedescriptor, output);
+ }
+ else
+ {
+ sendError(filedescriptor, "Error getting route");
+ }
+
+ }
+ else
+ {
+ CmdQueue.pop();
+ output << "Not enough arguments to set routing. Please enter sourceID and sinkID after command" << std::endl;
+ return;
+ }
}
@@ -891,292 +865,281 @@ void CAmTelnetMenuHelper::setRoutingCommandExec(std::queue<std::string> & CmdQue
void CAmTelnetMenuHelper::setConnection(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->setConnectionExec(CmdQueue,filedescriptor);
+ instance->setConnectionExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::setConnectionExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::stringstream output;
-
- am_sourceID_t sourceID = 0;
- am_sinkID_t sinkID = 0;
- am_mainConnectionID_t connID = 0;
-
- bool error = false;
- am_Error_e rError = E_OK;
-
- if(CmdQueue.size() >= 2)
- {
- std::istringstream istream_sourceID(CmdQueue.front());
- CmdQueue.pop();
-
- std::istringstream istream_sinkID(CmdQueue.front());
- CmdQueue.pop();
-
- if(!(istream_sourceID >> sourceID))
- error = true;
-
- if(!(istream_sinkID >> sinkID))
- error = true;
-
- if(error)
- {
- sendError(filedescriptor,"Error parsing sinkID and/or sourceID");
- return;
- }
-
- // Try to set up connection
- rError = mCommandReceiver->connect(sourceID,sinkID,connID);
-
- if(E_OK == rError)
- {
- output << "ConnID: " << connID << "\tSrc: " << sourceID << " ---> Sink: " << sinkID << std::endl;
- sendTelnetLine(filedescriptor,output);
- }
- else
- {
- sendError(filedescriptor,"Error connecting sourceID and sinkID");
- }
-
- }
- else
- {
- CmdQueue.pop();
- sendError(filedescriptor,"Not enough arguments to set routing. Please enter sourceID and sinkID after command");
- return;
- }
+ std::stringstream output;
+
+ am_sourceID_t sourceID = 0;
+ am_sinkID_t sinkID = 0;
+ am_mainConnectionID_t connID = 0;
+
+ bool error = false;
+ am_Error_e rError = E_OK;
+
+ if (CmdQueue.size() >= 2)
+ {
+ std::istringstream istream_sourceID(CmdQueue.front());
+ CmdQueue.pop();
+
+ std::istringstream istream_sinkID(CmdQueue.front());
+ CmdQueue.pop();
+
+ if (!(istream_sourceID >> sourceID))
+ error = true;
+
+ if (!(istream_sinkID >> sinkID))
+ error = true;
+
+ if (error)
+ {
+ sendError(filedescriptor, "Error parsing sinkID and/or sourceID");
+ return;
+ }
+
+ // Try to set up connection
+ rError = mCommandReceiver->connect(sourceID, sinkID, connID);
+
+ if (E_OK == rError)
+ {
+ output << "ConnID: " << connID << "\tSrc: " << sourceID << " ---> Sink: " << sinkID << std::endl;
+ sendTelnetLine(filedescriptor, output);
+ }
+ else
+ {
+ sendError(filedescriptor, "Error connecting sourceID and sinkID");
+ }
+
+ }
+ else
+ {
+ CmdQueue.pop();
+ sendError(filedescriptor, "Not enough arguments to set routing. Please enter sourceID and sinkID after command");
+ return;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::setDisconnectConnId(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->setDisconnectConnIdExec(CmdQueue,filedescriptor);
+ instance->setDisconnectConnIdExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::setDisconnectConnIdExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::stringstream output;
-
- am_mainConnectionID_t connID = 0;
-
- bool error = false;
- am_Error_e rError = E_OK;
-
- if(CmdQueue.size() >= 1)
- {
- std::istringstream istream_connID(CmdQueue.front());
- CmdQueue.pop();
-
- if(!(istream_connID >> connID))
- error = true;
-
- if(error)
- {
- sendError(filedescriptor,"Error parsing connID");
- return;
- }
-
- // Try to disconnect connection id
- rError = mCommandReceiver->disconnect(connID);
-
- if(E_OK == rError)
- {
- output << "ConnID " << connID << " closed successfully! " << std::endl;
- sendTelnetLine(filedescriptor,output);
- }
- else
- {
- sendError(filedescriptor,"Error disconnecting connectionID");
- }
- }
- else
- {
- sendError(filedescriptor,"Not enough arguments to disconnect a Main Connection, please enter 'connectionID' after command");
- return;
- }
+ std::stringstream output;
+
+ am_mainConnectionID_t connID = 0;
+
+ bool error = false;
+ am_Error_e rError = E_OK;
+
+ if (CmdQueue.size() >= 1)
+ {
+ std::istringstream istream_connID(CmdQueue.front());
+ CmdQueue.pop();
+
+ if (!(istream_connID >> connID))
+ error = true;
+
+ if (error)
+ {
+ sendError(filedescriptor, "Error parsing connID");
+ return;
+ }
+
+ // Try to disconnect connection id
+ rError = mCommandReceiver->disconnect(connID);
+
+ if (E_OK == rError)
+ {
+ output << "ConnID " << connID << " closed successfully! " << std::endl;
+ sendTelnetLine(filedescriptor, output);
+ }
+ else
+ {
+ sendError(filedescriptor, "Error disconnecting connectionID");
+ }
+ }
+ else
+ {
+ sendError(filedescriptor, "Not enough arguments to disconnect a Main Connection, please enter 'connectionID' after command");
+ return;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::setSourceSoundProperties(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->setConnectionExec(CmdQueue,filedescriptor);
+ instance->setConnectionExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::setSourceSoundPropertiesExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::stringstream output;
- am_sinkID_t sourceID;
- am_MainSoundProperty_s soundProperty;
- unsigned int tmpType = 0;
- bool error = false;
-
- if(CmdQueue.size() >= 3)
- {
- std::istringstream istream_sourceID(CmdQueue.front());
- CmdQueue.pop();
-
- std::istringstream istream_type(CmdQueue.front());
- CmdQueue.pop();
-
- std::istringstream istream_value(CmdQueue.front());
- CmdQueue.pop();
-
- if(!(istream_type >> tmpType))
- error = true;
-
- if(tmpType < MSP_MAX)
- soundProperty.type = static_cast<am_MainSoundPropertyType_e>(tmpType);
- else
- error = true;
-
- if(!(istream_value >> soundProperty.value))
- error = true;
-
- if(!(istream_sourceID >> sourceID))
- error = true;
-
- if(error)
- {
- sendError(filedescriptor,"Error parsing MainSinkSoundProperty 'type', 'value' or 'sourceID'");
- return;
- }
-
- if(E_OK == mCommandReceiver->setMainSourceSoundProperty(soundProperty,sourceID))
- {
- output << "MainSourceSoundProperty set: " << soundProperty.type << "->" << soundProperty.value << std::endl;
- sendTelnetLine(filedescriptor,output);
- }
- else
- {
- sendError(filedescriptor,"Error setMainSourceSoundProperty");
- }
- }
- else
- {
- sendError(filedescriptor,"Not enough arguments to set MainSourceSoundProperty, please enter 'sourceID', 'type' and 'value' after command");
- return;
- }
+ std::stringstream output;
+ am_sinkID_t sourceID;
+ am_MainSoundProperty_s soundProperty;
+ unsigned int tmpType = 0;
+ bool error = false;
+
+ if (CmdQueue.size() >= 3)
+ {
+ std::istringstream istream_sourceID(CmdQueue.front());
+ CmdQueue.pop();
+
+ std::istringstream istream_type(CmdQueue.front());
+ CmdQueue.pop();
+
+ std::istringstream istream_value(CmdQueue.front());
+ CmdQueue.pop();
+
+ if (!(istream_type >> tmpType))
+ error = true;
+
+ if (tmpType < MSP_MAX)
+ soundProperty.type = static_cast<am_MainSoundPropertyType_e>(tmpType);
+ else
+ error = true;
+
+ if (!(istream_value >> soundProperty.value))
+ error = true;
+
+ if (!(istream_sourceID >> sourceID))
+ error = true;
+
+ if (error)
+ {
+ sendError(filedescriptor, "Error parsing MainSinkSoundProperty 'type', 'value' or 'sourceID'");
+ return;
+ }
+
+ if (E_OK == mCommandReceiver->setMainSourceSoundProperty(soundProperty, sourceID))
+ {
+ output << "MainSourceSoundProperty set: " << soundProperty.type << "->" << soundProperty.value << std::endl;
+ sendTelnetLine(filedescriptor, output);
+ }
+ else
+ {
+ sendError(filedescriptor, "Error setMainSourceSoundProperty");
+ }
+ }
+ else
+ {
+ sendError(filedescriptor, "Not enough arguments to set MainSourceSoundProperty, please enter 'sourceID', 'type' and 'value' after command");
+ return;
+ }
}
/****************************************************************************/
void CAmTelnetMenuHelper::setSinkSoundProperties(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->setConnectionExec(CmdQueue,filedescriptor);
+ instance->setConnectionExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::setSinkSoundPropertiesExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::stringstream output;
- am_sinkID_t sinkID;
- am_MainSoundProperty_s soundProperty;
- unsigned int tmpType = 0;
- bool error = false;
-
- if(CmdQueue.size() >= 3)
- {
- std::istringstream istream_sinkID(CmdQueue.front());
- CmdQueue.pop();
-
- std::istringstream istream_type(CmdQueue.front());
- CmdQueue.pop();
-
- std::istringstream istream_value(CmdQueue.front());
- CmdQueue.pop();
-
- if(!(istream_type >> tmpType))
- error = true;
-
- if(tmpType < MSP_MAX)
- soundProperty.type = static_cast<am_MainSoundPropertyType_e>(tmpType);
- else
- error = true;
-
- if(!(istream_value >> soundProperty.value))
- error = true;
-
- if(!(istream_sinkID >> sinkID))
- error = true;
-
- if(error)
- {
- sendError(filedescriptor,"Error parsing MainSinkSoundProperty 'type', 'value' or 'sinkID'");
- return;
- }
-
- if(E_OK == mCommandReceiver->setMainSinkSoundProperty(soundProperty,sinkID))
- {
- output << "MainSinkSoundProperty set: " << soundProperty.type << "->" << soundProperty.value << std::endl;
- sendTelnetLine(filedescriptor,output);
- }
- else
- {
- sendError(filedescriptor,"Error setMainSinkSoundProperty");
- }
- }
- else
- {
- sendError(filedescriptor,"Not enough arguments to set MainSinkSoundProperty, please enter 'sinkID', 'type' and 'value' after command");
- return;
- }
+ std::stringstream output;
+ am_sinkID_t sinkID;
+ am_MainSoundProperty_s soundProperty;
+ unsigned int tmpType = 0;
+ bool error = false;
+
+ if (CmdQueue.size() >= 3)
+ {
+ std::istringstream istream_sinkID(CmdQueue.front());
+ CmdQueue.pop();
+
+ std::istringstream istream_type(CmdQueue.front());
+ CmdQueue.pop();
+
+ std::istringstream istream_value(CmdQueue.front());
+ CmdQueue.pop();
+
+ if (!(istream_type >> tmpType))
+ error = true;
+
+ if (tmpType < MSP_MAX)
+ soundProperty.type = static_cast<am_MainSoundPropertyType_e>(tmpType);
+ else
+ error = true;
+
+ if (!(istream_value >> soundProperty.value))
+ error = true;
+
+ if (!(istream_sinkID >> sinkID))
+ error = true;
+
+ if (error)
+ {
+ sendError(filedescriptor, "Error parsing MainSinkSoundProperty 'type', 'value' or 'sinkID'");
+ return;
+ }
+
+ if (E_OK == mCommandReceiver->setMainSinkSoundProperty(soundProperty, sinkID))
+ {
+ output << "MainSinkSoundProperty set: " << soundProperty.type << "->" << soundProperty.value << std::endl;
+ sendTelnetLine(filedescriptor, output);
+ }
+ else
+ {
+ sendError(filedescriptor, "Error setMainSinkSoundProperty");
+ }
+ }
+ else
+ {
+ sendError(filedescriptor, "Not enough arguments to set MainSinkSoundProperty, please enter 'sinkID', 'type' and 'value' after command");
+ return;
+ }
}
-
/****************************************************************************/
void CAmTelnetMenuHelper::listPluginsCommand(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- instance->listPluginsCommandExec(CmdQueue,filedescriptor);
+ instance->listPluginsCommandExec(CmdQueue, filedescriptor);
}
/****************************************************************************/
void CAmTelnetMenuHelper::listPluginsCommandExec(std::queue<std::string> & CmdQueue, int & filedescriptor)
/****************************************************************************/
{
- std::vector<std::string> PlugInNames;
- std::vector<std::string>::iterator iter;
- std::stringstream output;
- am_Error_e rError = E_OK;
+ (void) CmdQueue;
+ std::vector<std::string> PlugInNames;
+ std::vector<std::string>::iterator iter;
+ std::stringstream output;
+ am_Error_e rError = E_OK;
+ rError = mCommandSender->getListPlugins(PlugInNames);
- rError = mCommandSender->getListPlugins(PlugInNames);
+ output << "CommandSender Plugins loaded: " << PlugInNames.size() << std::endl;
- output << "CommandSender Plugins loaded: " << PlugInNames.size() << std::endl;
+ for (iter = PlugInNames.begin(); iter < PlugInNames.end(); iter++)
+ {
+ output << iter->c_str() << std::endl;
+ }
- for(iter = PlugInNames.begin(); iter < PlugInNames.end(); iter++ )
- {
- output << iter->c_str() << std::endl;
- }
+ rError = mRoutingSender->getListPlugins(PlugInNames);
- rError = mRoutingSender->getListPlugins(PlugInNames);
+ output << std::endl << "RoutingSender Plugins loaded: " << PlugInNames.size() << std::endl;
- output << std::endl << "RoutingSender Plugins loaded: " << PlugInNames.size() << std::endl;
+ for (iter = PlugInNames.begin(); iter < PlugInNames.end(); iter++)
+ {
+ output << iter->c_str() << std::endl;
+ }
- for(iter = PlugInNames.begin(); iter < PlugInNames.end(); iter++ )
- {
- output << iter->c_str() << std::endl;
- }
-
- sendTelnetLine(filedescriptor,output);
+ sendTelnetLine(filedescriptor, output);
}
-
-
-
-
-
-
-
-
-
-
diff --git a/AudioManagerDaemon/src/CommandSender.cpp b/AudioManagerDaemon/src/CommandSender.cpp
index 810eec4..d2cc1ca 100644
--- a/AudioManagerDaemon/src/CommandSender.cpp
+++ b/AudioManagerDaemon/src/CommandSender.cpp
@@ -32,8 +32,6 @@ using namespace am;
#define REQUIRED_INTERFACE_VERSION 1
-DLT_IMPORT_CONTEXT(AudioManager)
-
//!< macro to call all interfaces
#define CALL_ALL_INTERFACES(...) \
std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin(); \
diff --git a/AudioManagerDaemon/src/ControlReceiver.cpp b/AudioManagerDaemon/src/ControlReceiver.cpp
index b32ffdd..b352d0d 100644
--- a/AudioManagerDaemon/src/ControlReceiver.cpp
+++ b/AudioManagerDaemon/src/ControlReceiver.cpp
@@ -66,8 +66,7 @@ ControlReceiver::~ControlReceiver()
am_Error_e ControlReceiver::getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s> & returnList)
{
- mRouter->getRoute(onlyfree, sourceID, sinkID, returnList);
- return E_NOT_USED;
+ return mRouter->getRoute(onlyfree, sourceID, sinkID, returnList);
}
am_Error_e ControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & connectionID, const am_ConnectionFormat_e format, const am_sourceID_t sourceID, const am_sinkID_t sinkID)
@@ -99,7 +98,7 @@ am_Error_e ControlReceiver::disconnect(am_Handle_s & handle, const am_connection
am_Error_e ControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e hotSource, const am_crossfaderID_t crossfaderID, const am_RampType_e rampType, const am_time_t rampTime)
{
- logInfo("ControlReceiver::crossfade got called, hotSource=",hotSource,"crossfaderID=",crossfaderID,"rampType=",rampType,"rampTime=",rampTime);
+ logInfo("ControlReceiver::crossfade got called, hotSource=", hotSource, "crossfaderID=", crossfaderID, "rampType=", rampType, "rampTime=", rampTime);
if (!mDatabaseHandler->existcrossFader(crossfaderID))
return E_NON_EXISTENT;
@@ -108,7 +107,7 @@ am_Error_e ControlReceiver::crossfade(am_Handle_s & handle, const am_HotSink_e h
am_Error_e ControlReceiver::setSourceState(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SourceState_e state)
{
- logInfo("ControlReceiver::setSourceState got called, sourceID=",sourceID,"state=",state);
+ logInfo("ControlReceiver::setSourceState got called, sourceID=", sourceID, "state=", state);
am_SourceState_e sourceState;
if (mDatabaseHandler->getSoureState(sourceID, sourceState) != E_OK)
@@ -120,7 +119,7 @@ am_Error_e ControlReceiver::setSourceState(am_Handle_s & handle, const am_source
am_Error_e ControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_t sinkID, const am_volume_t volume, const am_RampType_e ramp, const am_time_t time)
{
- logInfo("ControlReceiver::setSinkVolume got called, sinkID=",sinkID,"volume=",volume,"ramp=",ramp, "time=",time);
+ logInfo("ControlReceiver::setSinkVolume got called, sinkID=", sinkID, "volume=", volume, "ramp=", ramp, "time=", time);
am_volume_t tempVolume;
if (mDatabaseHandler->getSinkVolume(sinkID, tempVolume) != E_OK)
@@ -132,7 +131,7 @@ am_Error_e ControlReceiver::setSinkVolume(am_Handle_s & handle, const am_sinkID_
am_Error_e ControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourceID_t sourceID, const am_volume_t volume, const am_RampType_e rampType, const am_time_t time)
{
- logInfo("ControlReceiver::setSourceVolume got called, sourceID=",sourceID,"volume=",volume,"ramp=",rampType,"time=",time);
+ logInfo("ControlReceiver::setSourceVolume got called, sourceID=", sourceID, "volume=", volume, "ramp=", rampType, "time=", time);
am_volume_t tempVolume;
if (mDatabaseHandler->getSourceVolume(sourceID, tempVolume) != E_OK)
@@ -144,7 +143,7 @@ am_Error_e ControlReceiver::setSourceVolume(am_Handle_s & handle, const am_sourc
am_Error_e ControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_sinkID_t sinkID, const am_SoundProperty_s & soundProperty)
{
- logInfo("ControlReceiver::setSinkSoundProperty got called, sinkID=",sinkID,"soundProperty.Type=",soundProperty.type,"soundProperty.value=",soundProperty.value);
+ logInfo("ControlReceiver::setSinkSoundProperty got called, sinkID=", sinkID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value);
uint16_t value;
if (mDatabaseHandler->getSinkSoundPropertyValue(sinkID, soundProperty.type, value) != E_OK)
@@ -156,7 +155,7 @@ am_Error_e ControlReceiver::setSinkSoundProperty(am_Handle_s & handle, const am_
am_Error_e ControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const am_sinkID_t sinkID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
- logInfo("ControlReceiver::setSinkSoundProperties got called, sinkID=",sinkID);
+ logInfo("ControlReceiver::setSinkSoundProperties got called, sinkID=", sinkID);
uint16_t value;
bool noChange = true;
@@ -175,7 +174,7 @@ am_Error_e ControlReceiver::setSinkSoundProperties(am_Handle_s & handle, const a
am_Error_e ControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const am_sourceID_t sourceID, const am_SoundProperty_s & soundProperty)
{
- logInfo("ControlReceiver::setSourceSoundProperty got called, sourceID=",sourceID,"soundProperty.Type=",soundProperty.type,"soundProperty.value=",soundProperty.value);
+ logInfo("ControlReceiver::setSourceSoundProperty got called, sourceID=", sourceID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value);
uint16_t value;
if (mDatabaseHandler->getSourceSoundPropertyValue(sourceID, soundProperty.type, value) != E_OK)
@@ -187,7 +186,7 @@ am_Error_e ControlReceiver::setSourceSoundProperty(am_Handle_s & handle, const a
am_Error_e ControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const am_sourceID_t sourceID, const std::vector<am_SoundProperty_s> & listSoundProperties)
{
- logInfo("ControlReceiver::setSourceSoundProperties got called, sourceID=",sourceID);
+ logInfo("ControlReceiver::setSourceSoundProperties got called, sourceID=", sourceID);
uint16_t value;
bool noChange = true;
@@ -206,7 +205,7 @@ am_Error_e ControlReceiver::setSourceSoundProperties(am_Handle_s & handle, const
am_Error_e ControlReceiver::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- logInfo("ControlReceiver::setDomainState got called, domainID=",domainID,"domainState=",domainState);
+ logInfo("ControlReceiver::setDomainState got called, domainID=", domainID, "domainState=", domainState);
am_DomainState_e tempState = DS_MIN;
if (mDatabaseHandler->getDomainState(domainID, tempState) != E_OK)
@@ -218,7 +217,7 @@ am_Error_e ControlReceiver::setDomainState(const am_domainID_t domainID, const a
am_Error_e ControlReceiver::abortAction(const am_Handle_s handle)
{
- logInfo("ControlReceiver::abortAction got called, handle.type=",handle.handle,"handle.handleType=",handle.handleType);
+ logInfo("ControlReceiver::abortAction got called, handle.type=", handle.handle, "handle.handleType=", handle.handleType);
return mRoutingSender->asyncAbort(handle);
}
@@ -268,9 +267,9 @@ am_Error_e ControlReceiver::enterSystemPropertiesListDB(const std::vector<am_Sys
return mDatabaseHandler->enterSystemProperties(listSystemProperties);
}
-am_Error_e ControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s & route)
+am_Error_e ControlReceiver::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
{
- return mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, route);
+ return mDatabaseHandler->changeMainConnectionRouteDB(mainconnectionID, listConnectionID);
}
am_Error_e ControlReceiver::changeMainConnectionStateDB(const am_mainConnectionID_t mainconnectionID, const am_ConnectionState_e connectionState)
@@ -358,6 +357,21 @@ am_Error_e ControlReceiver::getSinkClassInfoDB(const am_sinkID_t sinkID, am_Sink
return mDatabaseHandler->getSinkClassInfoDB(sinkID, sinkClass);
}
+am_Error_e ControlReceiver::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
+{
+ return mDatabaseHandler->getSinkInfoDB(sinkID, sinkData);
+}
+
+am_Error_e ControlReceiver::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
+{
+ return mDatabaseHandler->getSourceInfoDB(sourceID, sourceData);
+}
+
+am_Error_e ControlReceiver::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
+{
+ return mDatabaseHandler->getMainConnectionInfoDB(mainConnectionID, mainConnectionData);
+}
+
am_Error_e ControlReceiver::getGatewayInfoDB(const am_gatewayID_t gatewayID, am_Gateway_s & gatewayData) const
{
return mDatabaseHandler->getGatewayInfoDB(gatewayID, gatewayData);
diff --git a/AudioManagerDaemon/src/DatabaseHandler.cpp b/AudioManagerDaemon/src/DatabaseHandler.cpp
index 1082c25..5f7ee1d 100644
--- a/AudioManagerDaemon/src/DatabaseHandler.cpp
+++ b/AudioManagerDaemon/src/DatabaseHandler.cpp
@@ -176,17 +176,18 @@ am_Error_e DatabaseHandler::enterDomainDB(const am_Domain_s & domainData, am_dom
am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & mainConnectionData, am_mainConnectionID_t & connectionID)
{
- assert(mainConnectionData.connectionID==0);
+ assert(mainConnectionData.mainConnectionID==0);
assert(mainConnectionData.connectionState>=CS_MIN && mainConnectionData.connectionState<=CS_MAX);
- assert(mainConnectionData.route.sinkID!=0);
- assert(mainConnectionData.route.sourceID!=0);
+ assert(mainConnectionData.sinkID!=0);
+ assert(mainConnectionData.sourceID!=0);
sqlite3_stmt* query = NULL;
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_bind_int(query, 1, mainConnectionData.route.sourceID);
- sqlite3_bind_int(query, 2, mainConnectionData.route.sinkID);
+ sqlite3_bind_int(query, 1, mainConnectionData.sourceID);
+ sqlite3_bind_int(query, 2, mainConnectionData.sinkID);
sqlite3_bind_int(query, 3, mainConnectionData.connectionState);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
@@ -203,21 +204,16 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
connectionID = sqlite3_last_insert_rowid(mDatabase);
- //now check the connectionTable for all connections in the route. IF a particular route is not found, we return with error
- std::vector<uint16_t> listOfConnections;
- int16_t delay = 0;
- command = "SELECT connectionID, delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE sourceID=? AND sinkID=? AND connectionFormat=?");
+ //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);
- std::vector<am_RoutingElement_s>::const_iterator elementIterator = mainConnectionData.route.route.begin();
- for (; elementIterator < mainConnectionData.route.route.end(); ++elementIterator)
+ std::vector<am_connectionID_t>::const_iterator elementIterator = mainConnectionData.listConnectionID.begin();
+ for (; elementIterator < mainConnectionData.listConnectionID.end(); ++elementIterator)
{
- sqlite3_bind_int(query, 1, elementIterator->sourceID);
- sqlite3_bind_int(query, 2, elementIterator->sinkID);
- sqlite3_bind_int(query, 3, elementIterator->connectionFormat);
+ sqlite3_bind_int(query, 1, *elementIterator);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
- listOfConnections.push_back(sqlite3_column_int(query, 0));
int16_t temp_delay = sqlite3_column_int(query, 1);
if (temp_delay != -1 && delay != -1)
delay += temp_delay;
@@ -227,7 +223,6 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
else
{
logError("DatabaseHandler::enterMainConnectionDB did not find route for MainConnection:", eCode);
-
return E_DATABASE_ERROR;
}
sqlite3_reset(query);
@@ -245,8 +240,8 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
command = "INSERT INTO MainConnectionRoute" + i2s(connectionID) + "(connectionID) VALUES (?)";
sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- std::vector<uint16_t>::iterator listConnectionIterator = listOfConnections.begin();
- for (; listConnectionIterator < listOfConnections.end(); ++listConnectionIterator)
+ std::vector<am_connectionID_t>::const_iterator listConnectionIterator(mainConnectionData.listConnectionID.begin());
+ for (; listConnectionIterator < mainConnectionData.listConnectionID.end(); ++listConnectionIterator)
{
sqlite3_bind_int(query, 1, *listConnectionIterator);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
@@ -263,7 +258,7 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
return E_DATABASE_ERROR;
}
- logInfo("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID", mainConnectionData.route.sourceID, "sinkID:", mainConnectionData.route.sinkID, "delay:", delay, "assigned ID:", connectionID);
+ logInfo("DatabaseHandler::enterMainConnectionDB entered new mainConnection with sourceID", mainConnectionData.sourceID, "sinkID:", mainConnectionData.sinkID, "delay:", delay, "assigned ID:", connectionID);
if (mDatabaseObserver)
{
@@ -832,7 +827,7 @@ am_Error_e DatabaseHandler::enterSourceDB(const am_Source_s & sourceData, am_sou
return E_OK;
}
-am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const am_Route_s & route)
+am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionID_t mainconnectionID, const std::vector<am_connectionID_t>& listConnectionID)
{
assert(mainconnectionID!=0);
if (!existMainConnection(mainconnectionID))
@@ -843,20 +838,16 @@ am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionI
int eCode = 0;
std::string command;
- std::vector<uint16_t> listOfConnections;
int16_t delay = 0;
- command = "SELECT connectionID, delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE sourceID=? AND sinkID=? AND connectionFormat=?");
+ command = "SELECT delay FROM " + std::string(CONNECTION_TABLE) + (" WHERE connectionID=?");
sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- std::vector<am_RoutingElement_s>::const_iterator elementIterator = route.route.begin();
- for (; elementIterator < route.route.end(); ++elementIterator)
+ std::vector<am_connectionID_t>::const_iterator elementIterator = listConnectionID.begin();
+ for (; elementIterator < listConnectionID.end(); ++elementIterator)
{
- sqlite3_bind_int(query, 1, elementIterator->sourceID);
- sqlite3_bind_int(query, 2, elementIterator->sinkID);
- sqlite3_bind_int(query, 3, elementIterator->connectionFormat);
+ sqlite3_bind_int(query, 1, *elementIterator);
if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
- listOfConnections.push_back(sqlite3_column_int(query, 0));
int16_t temp_delay = sqlite3_column_int(query, 1);
if (temp_delay != -1 && delay != -1)
delay += temp_delay;
@@ -885,8 +876,8 @@ am_Error_e DatabaseHandler::changeMainConnectionRouteDB(const am_mainConnectionI
command = "INSERT INTO MainConnectionRoute" + i2s(mainconnectionID) + "(connectionID) VALUES (?)";
sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- std::vector<uint16_t>::iterator listConnectionIterator = listOfConnections.begin();
- for (; listConnectionIterator < listOfConnections.end(); ++listConnectionIterator)
+ std::vector<am_connectionID_t>::const_iterator listConnectionIterator(listConnectionID.begin());
+ for (; listConnectionIterator != listConnectionID.end(); ++listConnectionIterator)
{
sqlite3_bind_int(query, 1, *listConnectionIterator);
if ((eCode = sqlite3_step(query)) != SQLITE_DONE)
@@ -1393,11 +1384,8 @@ am_Error_e DatabaseHandler::removeConnection(const am_connectionID_t connectionI
assert(connectionID!=0);
std::string command = "DELETE from " + std::string(CONNECTION_TABLE) + " WHERE connectionID=" + i2s(connectionID);
- std::string command1 = "DROP table SourceClassProperties" + i2s(connectionID);
if (!sqQuery(command))
return E_DATABASE_ERROR;
- if (!sqQuery(command1))
- return E_DATABASE_ERROR;
logInfo("DatabaseHandler::removeConnection removed:", connectionID);
return E_OK;
}
@@ -1477,6 +1465,246 @@ am_Error_e DatabaseHandler::getSourceClassInfoDB(const am_sourceID_t sourceID, a
return E_OK;
}
+am_Error_e DatabaseHandler::getSinkInfoDB(const am_sinkID_t sinkID, am_Sink_s & sinkData) const
+{
+
+ assert(sinkID!=0);
+
+ if (!existSink(sinkID))
+ {
+ return E_NON_EXISTENT;
+ }
+
+ sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
+ int eCode = 0;
+ am_ConnectionFormat_e tempConnectionFormat;
+ am_SoundProperty_s tempSoundProperty;
+ am_MainSoundProperty_s tempMainSoundProperty;
+ std::string command = "SELECT name, domainID, sinkClassID, volume, visible, availability, availabilityReason, muteState, mainVolume, sinkID FROM " + std::string(SINK_TABLE) + " WHERE reserved=0 and sinkID=" + i2s(sinkID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sinkData.name = std::string((const char*) sqlite3_column_text(query, 0));
+ sinkData.domainID = sqlite3_column_int(query, 1);
+ sinkData.sinkClassID = sqlite3_column_int(query, 2);
+ sinkData.volume = sqlite3_column_int(query, 3);
+ sinkData.visible = sqlite3_column_int(query, 4);
+ sinkData.available.availability = (am_Availablility_e) sqlite3_column_int(query, 5);
+ sinkData.available.availabilityReason = (am_AvailabilityReason_e) sqlite3_column_int(query, 6);
+ sinkData.muteState = (am_MuteState_e) sqlite3_column_int(query, 7);
+ sinkData.mainVolume = sqlite3_column_int(query, 8);
+ sinkData.sinkID = sqlite3_column_int(query, 9);
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM SinkConnectionFormat" + i2s(sinkID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
+ sinkData.listConnectionFormats.push_back(tempConnectionFormat);
+ }
+
+ if ((eCode = sqlite3_finalize(qConnectionFormat)) != SQLITE_OK)
+ {
+ logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode);
+
+ 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);
+ while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
+ {
+ tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0);
+ tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
+ sinkData.listSoundProperties.push_back(tempSoundProperty);
+ }
+
+ if ((eCode = sqlite3_finalize(qSoundProperty)) != SQLITE_OK)
+ {
+ logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode);
+
+ 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);
+ while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
+ {
+ tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0);
+ tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
+ sinkData.listMainSoundProperties.push_back(tempMainSoundProperty);
+ }
+
+ if ((eCode = sqlite3_finalize(qMAinSoundProperty)) != SQLITE_OK)
+ {
+ logError("DatabaseHandler::getSinkInfoDB SQLITE Finalize error code:", eCode);
+
+ return E_DATABASE_ERROR;
+ }
+ }
+
+ else if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getSinkInfoDB SQLITE error code:", eCode);
+
+ 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_OK;
+}
+
+am_Error_e DatabaseHandler::getSourceInfoDB(const am_sourceID_t sourceID, am_Source_s & sourceData) const
+{
+ assert(sourceID!=0);
+
+ if (!existSource(sourceID))
+ {
+ return E_NON_EXISTENT;
+ }
+
+ sqlite3_stmt* query = NULL, *qConnectionFormat = NULL, *qSoundProperty = NULL, *qMAinSoundProperty = NULL;
+ int eCode = 0;
+ am_ConnectionFormat_e tempConnectionFormat;
+ am_SoundProperty_s tempSoundProperty;
+ am_MainSoundProperty_s tempMainSoundProperty;
+ std::string command = "SELECT name, domainID, sourceClassID, sourceState, volume, visible, availability, availabilityReason, interruptState, sourceID FROM " + std::string(SOURCE_TABLE) + " WHERE reserved=0 AND sourceID=" + i2s(sourceID);
+ sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
+
+ if ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ sourceData.name = std::string((const char*) sqlite3_column_text(query, 0));
+ sourceData.domainID = sqlite3_column_int(query, 1);
+ sourceData.sourceClassID = sqlite3_column_int(query, 2);
+ sourceData.sourceState = (am_SourceState_e) sqlite3_column_int(query, 3);
+ sourceData.volume = sqlite3_column_int(query, 4);
+ sourceData.visible = sqlite3_column_int(query, 5);
+ sourceData.available.availability = (am_Availablility_e) sqlite3_column_int(query, 6);
+ sourceData.available.availabilityReason = (am_AvailabilityReason_e) sqlite3_column_int(query, 7);
+ sourceData.interruptState = (am_InterruptState_e) sqlite3_column_int(query, 8);
+ sourceData.sourceID = sqlite3_column_int(query, 9);
+
+ //read out the connectionFormats
+ std::string commandConnectionFormat = "SELECT soundFormat FROM SourceConnectionFormat" + i2s(sourceID);
+ sqlite3_prepare_v2(mDatabase, commandConnectionFormat.c_str(), -1, &qConnectionFormat, NULL);
+ while ((eCode = sqlite3_step(qConnectionFormat)) == SQLITE_ROW)
+ {
+ tempConnectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(qConnectionFormat, 0);
+ sourceData.listConnectionFormats.push_back(tempConnectionFormat);
+ }
+
+ if ((eCode = sqlite3_finalize(qConnectionFormat)) != SQLITE_OK)
+ {
+ logError("DatabaseHandler::getListSources SQLITE Finalize error code:", eCode);
+
+ 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);
+ while ((eCode = sqlite3_step(qSoundProperty)) == SQLITE_ROW)
+ {
+ tempSoundProperty.type = (am_SoundPropertyType_e) sqlite3_column_int(qSoundProperty, 0);
+ tempSoundProperty.value = sqlite3_column_int(qSoundProperty, 1);
+ sourceData.listSoundProperties.push_back(tempSoundProperty);
+ }
+
+ if ((eCode = sqlite3_finalize(qSoundProperty)) != SQLITE_OK)
+ {
+ logError("DatabaseHandler::getSourceInfoDB SQLITE Finalize error code:", eCode);
+
+ 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);
+ while ((eCode = sqlite3_step(qMAinSoundProperty)) == SQLITE_ROW)
+ {
+ tempMainSoundProperty.type = (am_MainSoundPropertyType_e) sqlite3_column_int(qMAinSoundProperty, 0);
+ tempMainSoundProperty.value = sqlite3_column_int(qMAinSoundProperty, 1);
+ sourceData.listMainSoundProperties.push_back(tempMainSoundProperty);
+ }
+
+ if ((eCode = sqlite3_finalize(qMAinSoundProperty)) != SQLITE_OK)
+ {
+ logError("DatabaseHandler::getSourceInfoDB SQLITE Finalize error code:", eCode);
+
+ return E_DATABASE_ERROR;
+ }
+ }
+ else if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getSourceInfoDB SQLITE error code:", eCode);
+
+ 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_OK;
+}
+
+am_Error_e am::DatabaseHandler::getMainConnectionInfoDB(const am_mainConnectionID_t mainConnectionID, am_MainConnection_s & mainConnectionData) const
+{
+ assert(mainConnectionID!=0);
+ if (!existMainConnection(mainConnectionID))
+ {
+ 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);
+
+ while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
+ {
+ mainConnectionData.mainConnectionID = sqlite3_column_int(query, 0);
+ mainConnectionData.sourceID = sqlite3_column_int(query, 1);
+ mainConnectionData.sinkID = sqlite3_column_int(query, 2);
+ 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);
+ while ((eCode = sqlite3_step(query1)) == SQLITE_ROW)
+ {
+ mainConnectionData.listConnectionID.push_back(sqlite3_column_int(query1, 0));
+ }
+ }
+
+ if (eCode != SQLITE_DONE)
+ {
+ logError("DatabaseHandler::getMainConnectionInfoDB SQLITE error code:", eCode);
+ 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_OK;
+}
+
am_Error_e DatabaseHandler::changeSinkClassInfoDB(const am_SinkClass_s& sinkClass)
{
assert(sinkClass.sinkClassID!=0);
@@ -1893,39 +2121,25 @@ am_Error_e DatabaseHandler::getListGatewaysOfDomain(const am_domainID_t domainID
am_Error_e DatabaseHandler::getListMainConnections(std::vector<am_MainConnection_s> & listMainConnections) const
{
listMainConnections.clear();
- sqlite3_stmt *query = NULL, *query1 = NULL, *query2 = NULL;
+ sqlite3_stmt *query = NULL, *query1 = NULL;
int eCode = 0;
am_MainConnection_s temp;
- am_RoutingElement_s tempRoute;
-
std::string command = "SELECT mainConnectionID, sourceID, sinkID, connectionState, delay FROM " + std::string(MAINCONNECTION_TABLE);
std::string command1 = "SELECT connectionID FROM MainConnectionRoute";
- std::string command2 = "SELECT sourceID, sinkID, connectionFormat FROM " + std::string(CONNECTION_TABLE) + " WHERE connectionID=?";
sqlite3_prepare_v2(mDatabase, command.c_str(), -1, &query, NULL);
- sqlite3_prepare_v2(mDatabase, command2.c_str(), -1, &query2, NULL);
while ((eCode = sqlite3_step(query)) == SQLITE_ROW)
{
- temp.connectionID = sqlite3_column_int(query, 0);
- temp.route.sourceID = sqlite3_column_int(query, 1);
- temp.route.sinkID = sqlite3_column_int(query, 2);
+ temp.mainConnectionID = sqlite3_column_int(query, 0);
+ temp.sourceID = sqlite3_column_int(query, 1);
+ temp.sinkID = sqlite3_column_int(query, 2);
temp.connectionState = (am_ConnectionState_e) sqlite3_column_int(query, 3);
temp.delay = sqlite3_column_int(query, 4);
- std::string statement = command1 + i2s(temp.connectionID);
+ std::string statement = command1 + i2s(temp.mainConnectionID);
sqlite3_prepare_v2(mDatabase, statement.c_str(), -1, &query1, NULL);
while ((eCode = sqlite3_step(query1)) == SQLITE_ROW)
{
- int k = sqlite3_column_int(query1, 0);
- sqlite3_bind_int(query2, 1, k);
- while ((eCode = sqlite3_step(query2)) == SQLITE_ROW)
- {
- tempRoute.sourceID = sqlite3_column_int(query2, 0);
- tempRoute.sinkID = sqlite3_column_int(query2, 1);
- tempRoute.connectionFormat = (am_ConnectionFormat_e) sqlite3_column_int(query2, 2);
- getDomainOfSource(tempRoute.sourceID, tempRoute.domainID);
- temp.route.route.push_back(tempRoute);
- }
- sqlite3_reset(query2);
+ temp.listConnectionID.push_back(sqlite3_column_int(query1, 0));
}
listMainConnections.push_back(temp);
}
diff --git a/AudioManagerDaemon/src/SocketHandler.cpp b/AudioManagerDaemon/src/SocketHandler.cpp
index fa7fee4..d9fdc3a 100644
--- a/AudioManagerDaemon/src/SocketHandler.cpp
+++ b/AudioManagerDaemon/src/SocketHandler.cpp
@@ -219,7 +219,8 @@ void SocketHandler::stop_listening()
* @param callback the callback that shall be called if the filedescriptor poll succeeded
* @return E_OK if the descriptor was added, E_NON_EXISTENT if the fd is not valid
*/
-am_Error_e SocketHandler::addFDPoll(const int fd, const int16_t event, shPollPrepare *prepare, shPollFired *fired, shPollCheck *check, shPollDispatch *dispatch, void* userData, sh_pollHandle_t& handle)
+
+am_Error_e SocketHandler::addFDPoll(const int fd, const short event, shPollPrepare *prepare, shPollFired *fired, shPollCheck *check, shPollDispatch *dispatch, void *userData, sh_pollHandle_t & handle)
{
if (!fdIsValid(fd))
return E_NON_EXISTENT;
@@ -386,7 +387,7 @@ am_Error_e SocketHandler::stopTimer(const sh_timerHandle_t handle)
* @param event the event flags
* @return E_OK on succsess, E_NON_EXISTENT if fd was not found
*/
-am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const int16_t events)
+am_Error_e SocketHandler::updateEventFlags(const sh_pollHandle_t handle, const short events)
{
mListPoll_t::iterator iterator = mListPoll.begin();
diff --git a/AudioManagerDaemon/src/TelnetServer.cpp b/AudioManagerDaemon/src/TelnetServer.cpp
index e879066..059a147 100644
--- a/AudioManagerDaemon/src/TelnetServer.cpp
+++ b/AudioManagerDaemon/src/TelnetServer.cpp
@@ -118,6 +118,8 @@ TelnetServer::~TelnetServer()
void TelnetServer::connectSocket(const pollfd pfd, const sh_pollHandle_t handle, void *userData)
{
+ (void) handle;
+ (void) userData;
//first, accept the connection, create a new filedescriptor
struct sockaddr answer;
socklen_t len=sizeof(answer);
@@ -162,6 +164,8 @@ void TelnetServer::disconnectClient(int filedescriptor)
void TelnetServer::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
@@ -176,6 +180,7 @@ void TelnetServer::receiveData(const pollfd pollfd, const sh_pollHandle_t handle
bool TelnetServer::dispatchData(const sh_pollHandle_t handle, void *userData)
{
+ (void) userData;
std::vector<connection_s>::iterator iterator=mListConnections.begin();
for(;iterator!=mListConnections.end();++iterator)
{
@@ -225,6 +230,7 @@ bool TelnetServer::check(const sh_pollHandle_t handle, void *userData)
void am::TelnetServer::sliceCommand(const std::string & string, std::string & command, std::queue<std::string> & MsgQueue)
{
+ (void) command;
std::stringstream stream(string);
std::istream_iterator<std::string> begin(stream);
std::istream_iterator<std::string> end;
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index 82bac88..ad0e3b8 100644
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -33,7 +33,7 @@
//todo: there is a bug in the visible flags of sinks and sources. fix it.
//todo: make sure all configurations are tested
//todo: clean up startup sequences controller, command and routing interfaces----
-//todo: add getMainConnectionData in commandreceive interface to retrieve infos about mainconnections
+
#include <config.h>
#include <SocketHandler.h>
#ifdef WITH_DBUS_WRAPPER