summaryrefslogtreecommitdiff
path: root/AudioManagerCore/src
diff options
context:
space:
mode:
Diffstat (limited to 'AudioManagerCore/src')
-rw-r--r--AudioManagerCore/src/CAmCommandReceiver.cpp23
-rw-r--r--AudioManagerCore/src/CAmCommandSender.cpp18
-rw-r--r--AudioManagerCore/src/CAmControlReceiver.cpp44
-rw-r--r--AudioManagerCore/src/CAmDatabaseHandlerMap.cpp270
-rw-r--r--AudioManagerCore/src/CAmDatabaseObserver.cpp1
-rw-r--r--AudioManagerCore/src/CAmRoutingReceiver.cpp36
-rw-r--r--AudioManagerCore/src/CAmRoutingSender.cpp160
-rw-r--r--AudioManagerCore/src/CAmTelnetMenuHelper.cpp1438
-rwxr-xr-xAudioManagerCore/src/CAmTelnetServer.cpp257
9 files changed, 281 insertions, 1966 deletions
diff --git a/AudioManagerCore/src/CAmCommandReceiver.cpp b/AudioManagerCore/src/CAmCommandReceiver.cpp
index d903384..0c6338a 100644
--- a/AudioManagerCore/src/CAmCommandReceiver.cpp
+++ b/AudioManagerCore/src/CAmCommandReceiver.cpp
@@ -29,6 +29,8 @@
#include "CAmDltWrapper.h"
#include "CAmSocketHandler.h"
+#define __METHOD_NAME__ std::string (std::string("CAmCommandReceiver::") + __func__)
+
namespace am
{
@@ -76,49 +78,49 @@ CAmCommandReceiver::~CAmCommandReceiver()
am_Error_e CAmCommandReceiver::connect(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t & mainConnectionID)
{
- logInfo("CommandReceiver::connect got called, sourceID=", sourceID, "sinkID=", sinkID);
+ logInfo(__METHOD_NAME__,"sourceID=", sourceID, "sinkID=", sinkID);
return (mControlSender->hookUserConnectionRequest(sourceID, sinkID, mainConnectionID));
}
am_Error_e CAmCommandReceiver::disconnect(const am_mainConnectionID_t mainConnectionID)
{
- logInfo("CommandReceiver::disconnect got called, mainConnectionID=", mainConnectionID);
+ logInfo(__METHOD_NAME__,"mainConnectionID=", mainConnectionID);
return (mControlSender->hookUserDisconnectionRequest(mainConnectionID));
}
am_Error_e CAmCommandReceiver::setVolume(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
- logInfo("CommandReceiver::setVolume got called, sinkID=", sinkID, "volume=", volume);
+ logInfo(__METHOD_NAME__,"sinkID=", sinkID, "volume=", volume);
return (mControlSender->hookUserVolumeChange(sinkID, volume));
}
am_Error_e CAmCommandReceiver::volumeStep(const am_sinkID_t sinkID, const int16_t volumeStep)
{
- logInfo("CommandReceiver::volumeStep got called, sinkID=", sinkID, "volumeStep=", volumeStep);
+ logInfo(__METHOD_NAME__,"sinkID=", sinkID, "volumeStep=", volumeStep);
return (mControlSender->hookUserVolumeStep(sinkID, volumeStep));
}
am_Error_e CAmCommandReceiver::setSinkMuteState(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
- logInfo("CommandReceiver::setSinkMuteState got called, sinkID=", sinkID, "muteState=", muteState);
+ logInfo(__METHOD_NAME__,"sinkID=", sinkID, "muteState=", muteState);
return (mControlSender->hookUserSetSinkMuteState(sinkID, muteState));
}
am_Error_e CAmCommandReceiver::setMainSinkSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sinkID_t sinkID)
{
- logInfo("CommandReceiver::setMainSinkSoundProperty got called, sinkID=", sinkID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
+ logInfo(__METHOD_NAME__,"sinkID=", sinkID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
return (mControlSender->hookUserSetMainSinkSoundProperty(sinkID, soundProperty));
}
am_Error_e CAmCommandReceiver::setMainSourceSoundProperty(const am_MainSoundProperty_s & soundProperty, const am_sourceID_t sourceID)
{
- logInfo("CommandReceiver::setMainSourceSoundProperty got called, sourceID=", sourceID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
+ logInfo(__METHOD_NAME__,"sourceID=", sourceID, "soundPropertyType=", soundProperty.type, "soundPropertyValue=", soundProperty.value);
return (mControlSender->hookUserSetMainSourceSoundProperty(sourceID, soundProperty));
}
am_Error_e CAmCommandReceiver::setSystemProperty(const am_SystemProperty_s & property)
{
- logInfo("CommandReceiver::setSystemProperty got called", "type=", property.type, "soundPropertyValue=", property.value);
+ logInfo(__METHOD_NAME__,"type=", property.type, "soundPropertyValue=", property.value);
return (mControlSender->hookUserSetSystemProperty(property));
}
@@ -130,7 +132,6 @@ am_Error_e CAmCommandReceiver::getVolume(const am_sinkID_t sinkID, am_mainVolume
am_Error_e CAmCommandReceiver::getListMainConnections(std::vector<am_MainConnectionType_s> & listConnections) const
{
return (mDatabaseHandler->getListVisibleMainConnections(listConnections));
-
}
am_Error_e CAmCommandReceiver::getListMainSinks(std::vector<am_SinkType_s>& listMainSinks) const
@@ -245,13 +246,13 @@ am_Error_e CAmCommandReceiver::getListMainSourceNotificationConfigurations(const
am_Error_e CAmCommandReceiver::setMainSinkNotificationConfiguration(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration)
{
- logInfo("CommandReceiver::setMainSinkNotificationConfiguration got called, sinkID=", sinkID, " type=",mainNotificationConfiguration.type, " parameter=", mainNotificationConfiguration.parameter, "status=",mainNotificationConfiguration.status);
+ logInfo(__METHOD_NAME__,"sinkID=", sinkID, " type=",mainNotificationConfiguration.type, " parameter=", mainNotificationConfiguration.parameter, "status=",mainNotificationConfiguration.status);
return (mControlSender->hookUserSetMainSinkNotificationConfiguration(sinkID,mainNotificationConfiguration));
}
am_Error_e CAmCommandReceiver::setMainSourceNotificationConfiguration(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration)
{
- logInfo("CommandReceiver::setMainSourceNotificationConfiguration got called, sourceID=", sourceID, " type=",mainNotificationConfiguration.type, " parameter=", mainNotificationConfiguration.parameter, "status=",mainNotificationConfiguration.status);
+ logInfo(__METHOD_NAME__,"sourceID=", sourceID, " type=",mainNotificationConfiguration.type, " parameter=", mainNotificationConfiguration.parameter, "status=",mainNotificationConfiguration.status);
return (mControlSender->hookUserSetMainSourceNotificationConfiguration(sourceID,mainNotificationConfiguration));
}
diff --git a/AudioManagerCore/src/CAmCommandSender.cpp b/AudioManagerCore/src/CAmCommandSender.cpp
index da064cc..2e60109 100644
--- a/AudioManagerCore/src/CAmCommandSender.cpp
+++ b/AudioManagerCore/src/CAmCommandSender.cpp
@@ -35,6 +35,8 @@
#include "CAmDltWrapper.h"
#include "audiomanagerconfig.h"
+#define __METHOD_NAME__ std::string (std::string("CAmCommandSender::") + __func__)
+
namespace am
{
@@ -57,7 +59,7 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
{
if (listOfPluginDirectories.empty())
{
- logError("CAmCommandSender::CAmCommandSender: List of commandplugins is empty");
+ logError(__METHOD_NAME__,"List of commandplugins is empty");
}
std::vector<std::string> sharedLibraryNameList;
@@ -68,12 +70,12 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
for (; dirIter < dirIterEnd; ++dirIter)
{
const char* directoryName = dirIter->c_str();
- logInfo("Searching for CommandPlugins in", *dirIter);
+ logInfo(__METHOD_NAME__,"Searching for CommandPlugins in", *dirIter);
DIR *directory = opendir(directoryName);
if (!directory)
{
- logError("Error opening directory ", *dirIter);
+ logError(__METHOD_NAME__,"Error opening directory ", *dirIter);
continue;
}
@@ -93,7 +95,7 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
struct stat buf;
if (stat(fullName.c_str(), &buf)) {
- logInfo(__PRETTY_FUNCTION__,"Failed to stat file: ", entryName, errno);
+ logInfo(__METHOD_NAME__,"Failed to stat file: ", entryName, errno);
continue;
}
@@ -115,14 +117,14 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
for (; iter < iterEnd; ++iter)
{
- logInfo("Loading CommandSender plugin", *iter);
+ logInfo(__METHOD_NAME__,"Loading CommandSender plugin", *iter);
IAmCommandSend* (*createFunc)();
void* tempLibHandle = NULL;
createFunc = getCreateFunction<IAmCommandSend*()>(*iter, tempLibHandle);
if (!createFunc)
{
- logInfo("Entry point of CommandPlugin not found", *iter);
+ logInfo(__METHOD_NAME__,"Entry point of CommandPlugin not found", *iter);
continue;
}
@@ -130,7 +132,7 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
if (!commander)
{
- logInfo("CommandPlugin initialization failed. Entry Function not callable");
+ logInfo(__METHOD_NAME__,"CommandPlugin initialization failed. Entry Function not callable");
dlclose(tempLibHandle);
continue;
}
@@ -148,7 +150,7 @@ CAmCommandSender::CAmCommandSender(const std::vector<std::string>& listOfPluginD
if (majorVersion < cMajorVersion || ((majorVersion == cMajorVersion) && (minorVersion > cMinorVersion)))
{
- logError("CommandInterface initialization failed. Version of Interface to old");
+ logError(__METHOD_NAME__,"CommandInterface initialization failed. Version of Interface to old");
dlclose(tempLibHandle);
continue;
}
diff --git a/AudioManagerCore/src/CAmControlReceiver.cpp b/AudioManagerCore/src/CAmControlReceiver.cpp
index 44ccb96..b1738e0 100644
--- a/AudioManagerCore/src/CAmControlReceiver.cpp
+++ b/AudioManagerCore/src/CAmControlReceiver.cpp
@@ -35,6 +35,8 @@
namespace am {
+#define __METHOD_NAME__ std::string (std::string("CAmControlReceiver::") + __func__)
+
CAmControlReceiver::CAmControlReceiver(IAmDatabaseHandler *iDatabaseHandler, CAmRoutingSender *iRoutingSender, CAmCommandSender *iCommandSender, CAmSocketHandler *iSocketHandler, CAmRouter* iRouter) :
mDatabaseHandler(iDatabaseHandler), //
mRoutingSender(iRoutingSender), //
@@ -402,32 +404,32 @@ am_Error_e CAmControlReceiver::removeSourceClassDB(const am_sourceClass_t source
void CAmControlReceiver::setCommandReady()
{
- logInfo("CAmControlReceiver::setCommandReady got called");
+ logVerbose(__METHOD_NAME__);
mCommandSender->setCommandReady();
}
void CAmControlReceiver::setRoutingReady()
{
- logInfo("CAmControlReceiver::setRoutingReady got called");
+ logVerbose(__METHOD_NAME__);
mRoutingSender->setRoutingReady();
}
void CAmControlReceiver::confirmControllerReady(const am_Error_e error)
{
if (error!=E_OK)
- logError("CAmControlReceiver::confirmControllerReady controller reported error", error);
+ logError(__METHOD_NAME__,"controller reported error", error);
}
void CAmControlReceiver::confirmControllerRundown(const am_Error_e error)
{
if (error!=E_OK)
{
- logError("CAmControlReceiver::confirmControllerRundown() exited with error ",error);
+ logError(__METHOD_NAME__,"exited with error ",error);
//we might be blocked here -> so lets better exit right away
throw std::runtime_error("controller Confirmed with error");
}
- logInfo ("CAmControlReceiver::confirmControllerRundown(), will exit now");
+ logVerbose (__METHOD_NAME__,"will exit now");
//end the mainloop here...
mSocketHandler->exit_mainloop();
@@ -441,13 +443,13 @@ am_Error_e CAmControlReceiver::getSocketHandler(CAmSocketHandler *& socketHandle
void CAmControlReceiver::setCommandRundown()
{
- logInfo("CAmControlReceiver::setCommandRundown got called");
+ logInfo(__METHOD_NAME__);
mCommandSender->setCommandRundown();
}
void CAmControlReceiver::setRoutingRundown()
{
- logInfo("CAmControlReceiver::setRoutingRundown got called");
+ logInfo(__METHOD_NAME__);
mRoutingSender->setRoutingRundown();
}
@@ -493,85 +495,85 @@ am_Error_e CAmControlReceiver::setSourceNotificationConfiguration(am_Handle_s& h
void CAmControlReceiver::sendMainSinkNotificationPayload(const am_sinkID_t sinkID, const am_NotificationPayload_s& notificationPayload)
{
- logInfo(__func__,"sinkID=",sinkID,"type=",notificationPayload.type,"value=",notificationPayload.value);
+ logVerbose(__METHOD_NAME__,"sinkID=",sinkID,"type=",notificationPayload.type,"value=",notificationPayload.value);
mCommandSender->cbSinkNotification(sinkID,notificationPayload);
}
void CAmControlReceiver::sendMainSourceNotificationPayload(const am_sourceID_t sourceID, const am_NotificationPayload_s& notificationPayload)
{
- logInfo(__func__,"sourceID=",sourceID,"type=",notificationPayload.type,"value=",notificationPayload.value);
+ logVerbose(__METHOD_NAME__,"sourceID=",sourceID,"type=",notificationPayload.type,"value=",notificationPayload.value);
mCommandSender->cbSourceNotification(sourceID,notificationPayload);
}
am_Error_e CAmControlReceiver::changeMainSinkNotificationConfigurationDB(const am_sinkID_t sinkID, const am_NotificationConfiguration_s& mainNotificationConfiguration)
{
- logVerbose(__func__,"sinkID", sinkID);
+ logVerbose(__METHOD_NAME__,"sinkID", sinkID);
return (mDatabaseHandler->changeMainSinkNotificationConfigurationDB(sinkID,mainNotificationConfiguration));
}
am_Error_e CAmControlReceiver::changeMainSourceNotificationConfigurationDB(const am_sourceID_t sourceID, const am_NotificationConfiguration_s& mainNotificationConfiguration)
{
- logVerbose(__func__,"sourceID", sourceID);
+ logVerbose(__METHOD_NAME__,"sourceID", sourceID);
return (mDatabaseHandler->changeMainSourceNotificationConfigurationDB(sourceID,mainNotificationConfiguration));
}
am_Error_e CAmControlReceiver::getListMainSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_MainSoundProperty_s>& listSoundproperties) const
{
- logVerbose(__func__,"sinkID", sinkID);
+ logVerbose(__METHOD_NAME__,"sinkID", sinkID);
return (mDatabaseHandler->getListMainSinkSoundProperties(sinkID,listSoundproperties));
}
am_Error_e CAmControlReceiver::getListMainSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_MainSoundProperty_s>& listSoundproperties) const
{
- logVerbose(__func__,"sourceID", sourceID);
+ logVerbose(__METHOD_NAME__,"sourceID", sourceID);
return (mDatabaseHandler->getListMainSourceSoundProperties(sourceID, listSoundproperties));
}
am_Error_e CAmControlReceiver::getListSinkSoundProperties(const am_sinkID_t sinkID, std::vector<am_SoundProperty_s>& listSoundproperties) const
{
- logVerbose(__func__,"sinkID", sinkID);
+ logVerbose(__METHOD_NAME__,"sinkID", sinkID);
return (mDatabaseHandler->getListSinkSoundProperties(sinkID,listSoundproperties));
}
am_Error_e CAmControlReceiver::getListSourceSoundProperties(const am_sourceID_t sourceID, std::vector<am_SoundProperty_s>& listSoundproperties) const
{
- logVerbose(__func__,"sourceID", sourceID);
+ logVerbose(__METHOD_NAME__,"sourceID", sourceID);
return (mDatabaseHandler->getListSourceSoundProperties(sourceID, listSoundproperties));
}
am_Error_e CAmControlReceiver::getMainSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const
{
- logVerbose(__func__,"sinkID", sinkID);
+ logVerbose(__METHOD_NAME__,"sinkID", sinkID);
return (mDatabaseHandler->getMainSinkSoundPropertyValue(sinkID,propertyType,value));
}
am_Error_e CAmControlReceiver::getSinkSoundPropertyValue(const am_sinkID_t sinkID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const
{
- logVerbose(__func__,"sinkID", sinkID);
+ logVerbose(__METHOD_NAME__,"sinkID", sinkID);
return (mDatabaseHandler->getSinkSoundPropertyValue(sinkID,propertyType,value));
}
am_Error_e CAmControlReceiver::getMainSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomMainSoundPropertyType_t propertyType, int16_t& value) const
{
- logVerbose(__func__,"sourceID", sourceID);
+ logVerbose(__METHOD_NAME__,"sourceID", sourceID);
return (mDatabaseHandler->getMainSourceSoundPropertyValue(sourceID,propertyType,value));
}
am_Error_e CAmControlReceiver::getSourceSoundPropertyValue(const am_sourceID_t sourceID, const am_CustomSoundPropertyType_t propertyType, int16_t& value) const
{
- logVerbose(__func__,"sourceID", sourceID);
+ logVerbose(__METHOD_NAME__,"sourceID", sourceID);
return (mDatabaseHandler->getSourceSoundPropertyValue(sourceID,propertyType,value));
}
am_Error_e CAmControlReceiver::resyncConnectionState(const am_domainID_t domainID,std::vector<am_Connection_s>& listOfExistingConnections)
{
- logInfo(__func__,"domainID", domainID);
+ logInfo(__METHOD_NAME__,"domainID", domainID);
return (mRoutingSender->resyncConnectionState(domainID,listOfExistingConnections));
}
am_Error_e CAmControlReceiver::removeHandle(const am_Handle_s handle)
{
- logInfo(__func__,"handle", handle.handle);
+ logInfo(__METHOD_NAME__,"handle", handle.handle);
return (mRoutingSender->removeHandle(handle));
}
diff --git a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
index 187d165..0965a1d 100644
--- a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
+++ b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
@@ -34,6 +34,8 @@
#include "CAmRouter.h"
#include "CAmDltWrapper.h"
+#define __METHOD_NAME__ std::string (std::string("CAmDatabaseHandlerMap::") + __func__)
+
#ifdef WITH_DATABASE_CHANGE_CHECK
# define DB_COND_UPDATE_RIE(x,y) \
@@ -413,12 +415,12 @@ CAmDatabaseHandlerMap::CAmDatabaseHandlerMap(): mFirstStaticSink(true), //
mListConnectionFormat(), //
mMappedData()
{
- logVerbose(__func__,"Init ");
+ logVerbose(__METHOD_NAME__,"Init ");
}
CAmDatabaseHandlerMap::~CAmDatabaseHandlerMap()
{
- logVerbose(__func__,"Destroy");
+ logVerbose(__METHOD_NAME__,"Destroy");
mpDatabaseObserver = NULL;
}
@@ -426,17 +428,17 @@ am_Error_e CAmDatabaseHandlerMap::enterDomainDB(const am_Domain_s & domainData,
{
if(domainData.name.empty())
{
- logError(__func__,"DomainName must not be emtpy!");
+ logError(__METHOD_NAME__,"DomainName must not be emtpy!");
return (E_NOT_POSSIBLE);
}
if(domainData.busname.empty())
{
- logError(__func__,"Busname must not be emtpy!");
+ logError(__METHOD_NAME__,"Busname must not be emtpy!");
return (E_NOT_POSSIBLE);
}
if(!(domainData.state>=DS_UNKNOWN && domainData.state<=DS_MAX))
{
- logError(__func__,"State must not be valid!");
+ logError(__METHOD_NAME__,"State must not be valid!");
return (E_NOT_POSSIBLE);
}
//first check for a reserved domain
@@ -473,7 +475,7 @@ am_Error_e CAmDatabaseHandlerMap::enterDomainDB(const am_Domain_s & domainData,
else
{
domainID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (E_UNKNOWN);
}
}
@@ -503,22 +505,22 @@ am_Error_e CAmDatabaseHandlerMap::enterMainConnectionDB(const am_MainConnection_
{
if(mainConnectionData.mainConnectionID!=0)
{
- logError(__func__,"mainConnectionID must be 0!");
+ logError(__METHOD_NAME__,"mainConnectionID must be 0!");
return (E_NOT_POSSIBLE);
}
if(!(mainConnectionData.connectionState>=CS_UNKNOWN && mainConnectionData.connectionState<=CS_MAX))
{
- logError(__func__,"connectionState must be valid!");
+ logError(__METHOD_NAME__,"connectionState must be valid!");
return (E_NOT_POSSIBLE);
}
if(!existSink(mainConnectionData.sinkID))
{
- logError(__func__,"sinkID must be valid!");
+ logError(__METHOD_NAME__,"sinkID must be valid!");
return (E_NOT_POSSIBLE);
}
if(!existSource(mainConnectionData.sourceID))
{
- logError(__func__,"sourceID must be valid!");
+ logError(__METHOD_NAME__,"sourceID must be valid!");
return (E_NOT_POSSIBLE);
}
@@ -533,7 +535,7 @@ am_Error_e CAmDatabaseHandlerMap::enterMainConnectionDB(const am_MainConnection_
else
{
connectionID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (E_UNKNOWN);
}
@@ -576,7 +578,7 @@ bool CAmDatabaseHandlerMap::insertSinkDB(const am_Sink_s & sinkData, am_sinkID_t
else
{
sinkID = 0;
- logVerbose(__func__,"Max limit reached!");
+ logVerbose(__METHOD_NAME__,"Max limit reached!");
return (false);
}
}
@@ -585,28 +587,28 @@ am_Error_e CAmDatabaseHandlerMap::enterSinkDB(const am_Sink_s & sinkData, am_sin
{
if(sinkData.sinkID>DYNAMIC_ID_BOUNDARY)
{
- logError(__func__,"sinkID must be below:",DYNAMIC_ID_BOUNDARY);
+ logError(__METHOD_NAME__,"sinkID must be below:",DYNAMIC_ID_BOUNDARY);
return (E_NOT_POSSIBLE);
}
if(!existDomain(sinkData.domainID))
{
- logError(__func__,"domainID must be valid");
+ logError(__METHOD_NAME__,"domainID must be valid");
return (E_NOT_POSSIBLE);
}
if(sinkData.name.empty())
{
- logError(__func__,"sinkName must not be zero");
+ logError(__METHOD_NAME__,"sinkName must not be zero");
return (E_NOT_POSSIBLE);
}
if(!existSinkClass(sinkData.sinkClassID))
{
- logError(__func__,"sinkClass must be valid");
+ logError(__METHOD_NAME__,"sinkClass must be valid");
return (E_NOT_POSSIBLE);
}
if(!(sinkData.muteState>=MS_UNKNOWN && sinkData.muteState<=MS_MAX))
{
- logError(__func__,"muteState must be valid");
+ logError(__METHOD_NAME__,"muteState must be valid");
return (E_NOT_POSSIBLE);
}
@@ -673,7 +675,7 @@ bool CAmDatabaseHandlerMap::insertCrossfaderDB(const am_Crossfader_s & crossfade
else
{
crossfaderID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (false);
}
}
@@ -682,34 +684,34 @@ am_Error_e CAmDatabaseHandlerMap::enterCrossfaderDB(const am_Crossfader_s & cros
{
if(crossfaderData.crossfaderID>DYNAMIC_ID_BOUNDARY)
{
- logError(__func__,"crossfaderID must be below:",DYNAMIC_ID_BOUNDARY);
+ logError(__METHOD_NAME__,"crossfaderID must be below:",DYNAMIC_ID_BOUNDARY);
return (E_NOT_POSSIBLE);
}
if(!(crossfaderData.hotSink>=HS_UNKNOWN && crossfaderData.hotSink<=HS_MAX))
{
- logError(__func__,"hotSink must be valid");
+ logError(__METHOD_NAME__,"hotSink must be valid");
return (E_NOT_POSSIBLE);
}
if(crossfaderData.name.empty())
{
- logError(__func__,"crossfaderName must not be zero");
+ logError(__METHOD_NAME__,"crossfaderName must not be zero");
return (E_NOT_POSSIBLE);
}
if(!existSink(crossfaderData.sinkID_A))
{
- logError(__func__,"sinkID_A must exist");
+ logError(__METHOD_NAME__,"sinkID_A must exist");
return (E_NOT_POSSIBLE);
}
if(!existSink(crossfaderData.sinkID_B))
{
- logError(__func__,"sinkID_B must exist");
+ logError(__METHOD_NAME__,"sinkID_B must exist");
return (E_NOT_POSSIBLE);
}
if(!existSource(crossfaderData.sourceID))
{
- logError(__func__,"sourceID must exist");
+ logError(__METHOD_NAME__,"sourceID must exist");
return (E_NOT_POSSIBLE);
}
@@ -760,7 +762,7 @@ bool CAmDatabaseHandlerMap::insertGatewayDB(const am_Gateway_s & gatewayData, am
else
{
gatewayID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (false);
}
}
@@ -770,19 +772,19 @@ am_Error_e CAmDatabaseHandlerMap::enterGatewayDB(const am_Gateway_s & gatewayDat
if(gatewayData.gatewayID>DYNAMIC_ID_BOUNDARY)
{
- logError(__func__,"gatewayID must be below:",DYNAMIC_ID_BOUNDARY);
+ logError(__METHOD_NAME__,"gatewayID must be below:",DYNAMIC_ID_BOUNDARY);
return (E_NOT_POSSIBLE);
}
if(!existDomain(gatewayData.controlDomainID))
{
- logError(__func__,"controlDomainID must be exist");
+ logError(__METHOD_NAME__,"controlDomainID must be exist");
return (E_NOT_POSSIBLE);
}
if(gatewayData.name.empty())
{
- logError(__func__,"gatewayName must not be empty");
+ logError(__METHOD_NAME__,"gatewayName must not be empty");
return (E_NOT_POSSIBLE);
}
@@ -835,7 +837,7 @@ bool CAmDatabaseHandlerMap::insertConverterDB(const am_Converter_s & converteDat
else
{
converterID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (false);
}
}
@@ -844,31 +846,31 @@ am_Error_e CAmDatabaseHandlerMap::enterConverterDB(const am_Converter_s & conver
{
if(converterData.converterID>DYNAMIC_ID_BOUNDARY)
{
- logError(__func__,"converterID must be below:",DYNAMIC_ID_BOUNDARY);
+ logError(__METHOD_NAME__,"converterID must be below:",DYNAMIC_ID_BOUNDARY);
return (E_NOT_POSSIBLE);
}
if(!existSink(converterData.sinkID))
{
- logError(__func__,"sinkID must exists");
+ logError(__METHOD_NAME__,"sinkID must exists");
return (E_NOT_POSSIBLE);
}
if(!existSource(converterData.sourceID))
{
- logError(__func__,"sourceID must exists");
+ logError(__METHOD_NAME__,"sourceID must exists");
return (E_NOT_POSSIBLE);
}
if(!existDomain(converterData.domainID))
{
- logError(__func__,"domainID must exists");
+ logError(__METHOD_NAME__,"domainID must exists");
return (E_NOT_POSSIBLE);
}
if(converterData.name.empty())
{
- logError(__func__,"converterName must not be empty");
+ logError(__METHOD_NAME__,"converterName must not be empty");
return (E_NOT_POSSIBLE);
}
@@ -942,7 +944,7 @@ bool CAmDatabaseHandlerMap::insertSourceDB(const am_Source_s & sourceData, am_so
else
{
sourceID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (false);
}
}
@@ -951,28 +953,28 @@ am_Error_e CAmDatabaseHandlerMap::enterSourceDB(const am_Source_s & sourceData,
{
if(sourceData.sourceID>DYNAMIC_ID_BOUNDARY)
{
- logError(__func__,"sourceID must be below:",DYNAMIC_ID_BOUNDARY);
+ logError(__METHOD_NAME__,"sourceID must be below:",DYNAMIC_ID_BOUNDARY);
return (E_NOT_POSSIBLE);
}
if(!existDomain(sourceData.domainID))
{
- logError(__func__,"domainID must be valid");
+ logError(__METHOD_NAME__,"domainID must be valid");
return (E_NOT_POSSIBLE);
}
if(sourceData.name.empty())
{
- logError(__func__,"sourceName must not be zero");
+ logError(__METHOD_NAME__,"sourceName must not be zero");
return (E_NOT_POSSIBLE);
}
if(!existSourceClass(sourceData.sourceClassID))
{
- logError(__func__,"sourceClassID must be valid");
+ logError(__METHOD_NAME__,"sourceClassID must be valid");
return (E_NOT_POSSIBLE);
}
if(!(sourceData.sourceState>=SS_UNKNNOWN && sourceData.sourceState<=SS_MAX))
{
- logError(__func__,"sourceState must be valid");
+ logError(__METHOD_NAME__,"sourceState must be valid");
return (E_NOT_POSSIBLE);
}
@@ -1027,19 +1029,19 @@ am_Error_e CAmDatabaseHandlerMap::enterConnectionDB(const am_Connection_s& conne
{
if(connection.connectionID!=0)
{
- logError(__func__,"connectionID must be 0!");
+ logError(__METHOD_NAME__,"connectionID must be 0!");
return (E_NOT_POSSIBLE);
}
if(!existSink(connection.sinkID))
{
- logError(__func__,"sinkID must exist!");
+ logError(__METHOD_NAME__,"sinkID must exist!");
return (E_NOT_POSSIBLE);
}
if(!existSource(connection.sourceID))
{
- logError(__func__,"sourceID must exist!");
+ logError(__METHOD_NAME__,"sourceID must exist!");
return (E_NOT_POSSIBLE);
}
//connection format is not checked, because it's project specific
@@ -1054,7 +1056,7 @@ am_Error_e CAmDatabaseHandlerMap::enterConnectionDB(const am_Connection_s& conne
else
{
connectionID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (E_UNKNOWN);
}
@@ -1075,7 +1077,7 @@ bool CAmDatabaseHandlerMap::insertSinkClassDB(const am_SinkClass_s & sinkClass,
else
{
sinkClassID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (false);
}
}
@@ -1084,13 +1086,13 @@ am_Error_e CAmDatabaseHandlerMap::enterSinkClassDB(const am_SinkClass_s & sinkCl
{
if(sinkClass.sinkClassID>DYNAMIC_ID_BOUNDARY)
{
- logError(__func__,"sinkClassID must be <",DYNAMIC_ID_BOUNDARY);
+ logError(__METHOD_NAME__,"sinkClassID must be <",DYNAMIC_ID_BOUNDARY);
return (E_NOT_POSSIBLE);
}
if(sinkClass.name.empty())
{
- logError(__func__,"name must not be empty");
+ logError(__METHOD_NAME__,"name must not be empty");
return (E_NOT_POSSIBLE);
}
@@ -1140,7 +1142,7 @@ bool CAmDatabaseHandlerMap::insertSourceClassDB(am_sourceClass_t & sourceClassID
else
{
sourceClassID = 0;
- logVerbose(__func__,"Max limit reached.");
+ logVerbose(__METHOD_NAME__,"Max limit reached.");
return (false);
}
}
@@ -1149,13 +1151,13 @@ am_Error_e CAmDatabaseHandlerMap::enterSourceClassDB(am_sourceClass_t & sourceCl
{
if(sourceClass.sourceClassID>DYNAMIC_ID_BOUNDARY)
{
- logError(__func__,"sourceClassID must be <",DYNAMIC_ID_BOUNDARY);
+ logError(__METHOD_NAME__,"sourceClassID must be <",DYNAMIC_ID_BOUNDARY);
return (E_NOT_POSSIBLE);
}
if(sourceClass.name.empty())
{
- logError(__func__,"name must not be empty");
+ logError(__METHOD_NAME__,"name must not be empty");
return (E_NOT_POSSIBLE);
}
@@ -1199,7 +1201,7 @@ am_Error_e CAmDatabaseHandlerMap::enterSystemProperties(const std::vector<am_Sys
{
if(listSystemProperties.empty())
{
- logError(__func__,"listSystemProperties must not be empty");
+ logError(__METHOD_NAME__,"listSystemProperties must not be empty");
return (E_NOT_POSSIBLE);
}
@@ -1213,13 +1215,13 @@ am_Error_e CAmDatabaseHandlerMap::changeMainConnectionRouteDB(const am_mainConne
{
if(mainconnectionID==0)
{
- logError(__func__,"mainconnectionID must not be 0");
+ logError(__METHOD_NAME__,"mainconnectionID must not be 0");
return (E_NOT_POSSIBLE);
}
if (!existMainConnection(mainconnectionID))
{
- logError(__func__,"existMainConnection must exist");
+ logError(__METHOD_NAME__,"existMainConnection must exist");
return (E_NON_EXISTENT);
}
@@ -1239,19 +1241,19 @@ am_Error_e CAmDatabaseHandlerMap::changeMainConnectionStateDB(const am_mainConne
{
if(mainconnectionID==0)
{
- logError(__func__,"mainconnectionID must not be 0");
+ logError(__METHOD_NAME__,"mainconnectionID must not be 0");
return (E_NOT_POSSIBLE);
}
if(!(connectionState>=CS_UNKNOWN && connectionState<=CS_MAX))
{
- logError(__func__,"connectionState must be valid");
+ logError(__METHOD_NAME__,"connectionState must be valid");
return (E_NOT_POSSIBLE);
}
if (!existMainConnection(mainconnectionID))
{
- logError(__func__,"existMainConnection must exist");
+ logError(__METHOD_NAME__,"existMainConnection must exist");
return (E_NON_EXISTENT);
}
@@ -1267,7 +1269,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkMainVolumeDB(const am_mainVolume_t m
{
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must exist");
+ logError(__METHOD_NAME__,"sinkID must exist");
return (E_NON_EXISTENT);
}
@@ -1285,13 +1287,13 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkAvailabilityDB(const am_Availability
{
if (!(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX))
{
- logError(__func__,"availability must be valid");
+ logError(__METHOD_NAME__,"availability must be valid");
return (E_NOT_POSSIBLE);
}
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must exist");
+ logError(__METHOD_NAME__,"sinkID must exist");
return (E_NON_EXISTENT);
}
@@ -1309,13 +1311,13 @@ am_Error_e CAmDatabaseHandlerMap::changeDomainStateDB(const am_DomainState_e dom
if(!(domainState>=DS_UNKNOWN && domainState<=DS_MAX))
{
- logError(__func__,"domainState must be valid");
+ logError(__METHOD_NAME__,"domainState must be valid");
return (E_NOT_POSSIBLE);
}
if (!existDomain(domainID))
{
- logError(__func__,"domainID must exist");
+ logError(__METHOD_NAME__,"domainID must exist");
return (E_NON_EXISTENT);
}
@@ -1330,13 +1332,13 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkMuteStateDB(const am_MuteState_e mut
if(!(muteState>=MS_UNKNOWN && muteState<=MS_MAX))
{
- logError(__func__,"muteState must be valid");
+ logError(__METHOD_NAME__,"muteState must be valid");
return (E_NOT_POSSIBLE);
}
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must exist");
+ logError(__METHOD_NAME__,"sinkID must exist");
return (E_NON_EXISTENT);
}
@@ -1355,7 +1357,7 @@ am_Error_e CAmDatabaseHandlerMap::changeMainSinkSoundPropertyDB(const am_MainSou
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must exist");
+ logError(__METHOD_NAME__,"sinkID must exist");
return (E_NON_EXISTENT);
}
am_Sink_Database_s & sink = mMappedData.mSinkMap[sinkID];
@@ -1382,7 +1384,7 @@ am_Error_e CAmDatabaseHandlerMap::changeMainSourceSoundPropertyDB(const am_MainS
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must exist");
+ logError(__METHOD_NAME__,"sourceID must exist");
return (E_NON_EXISTENT);
}
am_Source_Database_s & source = mMappedData.mSourceMap.at(sourceID);
@@ -1409,13 +1411,13 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceAvailabilityDB(const am_Availabili
{
if(!(availability.availability>=A_UNKNOWN && availability.availability<=A_MAX))
{
- logError(__func__,"availability must be valid");
+ logError(__METHOD_NAME__,"availability must be valid");
return (E_NOT_POSSIBLE);
}
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must exist");
+ logError(__METHOD_NAME__,"sourceID must exist");
return (E_NON_EXISTENT);
}
@@ -1450,7 +1452,7 @@ am_Error_e CAmDatabaseHandlerMap::removeMainConnectionDB(const am_mainConnection
if (!existMainConnection(mainConnectionID))
{
- logError(__func__,"mainConnectionID must exist");
+ logError(__METHOD_NAME__,"mainConnectionID must exist");
return (E_NON_EXISTENT);
}
@@ -1470,7 +1472,7 @@ am_Error_e CAmDatabaseHandlerMap::removeSinkDB(const am_sinkID_t sinkID)
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must exist");
+ logError(__METHOD_NAME__,"sinkID must exist");
return (E_NON_EXISTENT);
}
@@ -1492,7 +1494,7 @@ am_Error_e CAmDatabaseHandlerMap::removeSourceDB(const am_sourceID_t sourceID)
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must exist");
+ logError(__METHOD_NAME__,"sourceID must exist");
return (E_NON_EXISTENT);
}
@@ -1514,7 +1516,7 @@ am_Error_e CAmDatabaseHandlerMap::removeGatewayDB(const am_gatewayID_t gatewayID
if (!existGateway(gatewayID))
{
- logError(__func__,"gatewayID must exist");
+ logError(__METHOD_NAME__,"gatewayID must exist");
return (E_NON_EXISTENT);
}
@@ -1531,7 +1533,7 @@ am_Error_e CAmDatabaseHandlerMap::removeConverterDB(const am_converterID_t conve
if (!existConverter(converterID))
{
- logError(__func__,"converterID must exist");
+ logError(__METHOD_NAME__,"converterID must exist");
return (E_NON_EXISTENT);
}
@@ -1548,7 +1550,7 @@ am_Error_e CAmDatabaseHandlerMap::removeCrossfaderDB(const am_crossfaderID_t cro
if (!existCrossFader(crossfaderID))
{
- logError(__func__,"crossfaderID must exist");
+ logError(__METHOD_NAME__,"crossfaderID must exist");
return (E_NON_EXISTENT);
}
mMappedData.mCrossfaderMap.erase(crossfaderID);
@@ -1564,7 +1566,7 @@ am_Error_e CAmDatabaseHandlerMap::removeDomainDB(const am_domainID_t domainID)
if (!existDomain(domainID))
{
- logError(__func__,"domainID must exist");
+ logError(__METHOD_NAME__,"domainID must exist");
return (E_NON_EXISTENT);
}
mMappedData.mDomainMap.erase(domainID);
@@ -1580,7 +1582,7 @@ am_Error_e CAmDatabaseHandlerMap::removeSinkClassDB(const am_sinkClass_t sinkCla
if (!existSinkClass(sinkClassID))
{
- logError(__func__,"sinkClassID must exist");
+ logError(__METHOD_NAME__,"sinkClassID must exist");
return (E_NON_EXISTENT);
}
@@ -1598,7 +1600,7 @@ am_Error_e CAmDatabaseHandlerMap::removeSourceClassDB(const am_sourceClass_t sou
if (!existSourceClass(sourceClassID))
{
- logError(__func__,"sourceClassID must exist");
+ logError(__METHOD_NAME__,"sourceClassID must exist");
return (E_NON_EXISTENT);
}
@@ -1613,7 +1615,7 @@ am_Error_e CAmDatabaseHandlerMap::removeConnection(const am_connectionID_t conne
{
if (!existConnectionID(connectionID))
{
- logError(__func__,"connectionID must exist",connectionID);
+ logError(__METHOD_NAME__,"connectionID must exist",connectionID);
return (E_NON_EXISTENT);
}
@@ -1628,7 +1630,7 @@ am_Error_e CAmDatabaseHandlerMap::getSourceClassInfoDB(const am_sourceID_t sourc
if (!existSource(sourceID))
{
- logWarning(__func__,"sourceID must exist");
+ logWarning(__METHOD_NAME__,"sourceID must exist");
return (E_NON_EXISTENT);
}
am_Source_Database_s source = mMappedData.mSourceMap.at(sourceID);
@@ -1649,7 +1651,7 @@ am_Error_e CAmDatabaseHandlerMap::getSinkInfoDB(const am_sinkID_t sinkID, am_Sin
if (!existSink(sinkID))
{
- logWarning(__func__,"sinkID",sinkID,"does not exist");
+ logWarning(__METHOD_NAME__,"sinkID",sinkID,"does not exist");
return (E_NON_EXISTENT);
}
@@ -1666,7 +1668,7 @@ am_Error_e CAmDatabaseHandlerMap::getSourceInfoDB(const am_sourceID_t sourceID,
if (!existSource(sourceID))
{
- logWarning(__func__,"sourceID",sourceID,"does not exist");
+ logWarning(__METHOD_NAME__,"sourceID",sourceID,"does not exist");
return (E_NON_EXISTENT);
}
@@ -1683,7 +1685,7 @@ am_Error_e am::CAmDatabaseHandlerMap::getMainConnectionInfoDB(const am_mainConne
{
if (!existMainConnection(mainConnectionID))
{
- logError(__func__,"mainConnectionID must exist");
+ logError(__METHOD_NAME__,"mainConnectionID must exist");
return (E_NON_EXISTENT);
}
am_MainConnection_s temp = mMappedData.mMainConnectionMap.at(mainConnectionID);
@@ -1696,14 +1698,14 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkClassInfoDB(const am_SinkClass_s& si
{
if(sinkClass.listClassProperties.empty())
{
- logError(__func__,"listClassProperties must not be empty");
+ logError(__METHOD_NAME__,"listClassProperties must not be empty");
return (E_NOT_POSSIBLE);
}
//check if the ID already exists
if (!existSinkClass(sinkClass.sinkClassID))
{
- logError(__func__,"sinkClassID must exist");
+ logError(__METHOD_NAME__,"sinkClassID must exist");
return (E_NON_EXISTENT);
}
@@ -1717,14 +1719,14 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceClassInfoDB(const am_SourceClass_s
{
if(sourceClass.listClassProperties.empty())
{
- logError(__func__,"listClassProperties must not be empty");
+ logError(__METHOD_NAME__,"listClassProperties must not be empty");
return (E_NOT_POSSIBLE);
}
//check if the ID already exists
if (!existSourceClass(sourceClass.sourceClassID))
{
- logError(__func__,"sourceClassID must exist");
+ logError(__METHOD_NAME__,"sourceClassID must exist");
return (E_NON_EXISTENT);
}
@@ -1739,7 +1741,7 @@ am_Error_e CAmDatabaseHandlerMap::getSinkClassInfoDB(const am_sinkID_t sinkID, a
if (!existSink(sinkID))
{
- logWarning(__func__,"sinkID must exist");
+ logWarning(__METHOD_NAME__,"sinkID must exist");
return (E_NON_EXISTENT);
}
am_Sink_Database_s sink = mMappedData.mSinkMap.at(sinkID);
@@ -1747,7 +1749,7 @@ am_Error_e CAmDatabaseHandlerMap::getSinkClassInfoDB(const am_sinkID_t sinkID, a
if (!existSinkClass(sinkClass.sinkClassID))
{
- logWarning(__func__,"sinkClassID must exist");
+ logWarning(__METHOD_NAME__,"sinkClassID must exist");
return (E_NON_EXISTENT);
}
am_SinkClass_s tmpSinkClass = mMappedData.mSinkClassesMap.at(sinkClass.sinkClassID);
@@ -1760,7 +1762,7 @@ am_Error_e CAmDatabaseHandlerMap::getGatewayInfoDB(const am_gatewayID_t gatewayI
{
if (!existGateway(gatewayID))
{
- logWarning(__func__,"gatewayID must exist");
+ logWarning(__METHOD_NAME__,"gatewayID must exist");
return (E_NON_EXISTENT);
}
@@ -1774,7 +1776,7 @@ am_Error_e CAmDatabaseHandlerMap::getConverterInfoDB(const am_converterID_t conv
{
if (!existConverter(converterID))
{
- logWarning(__func__,"converterID must exist");
+ logWarning(__METHOD_NAME__,"converterID must exist");
return (E_NON_EXISTENT);
}
@@ -1788,7 +1790,7 @@ am_Error_e CAmDatabaseHandlerMap::getCrossfaderInfoDB(const am_crossfaderID_t cr
{
if (!existCrossFader(crossfaderID))
{
- logWarning(__func__,"crossfaderID must exist");
+ logWarning(__METHOD_NAME__,"crossfaderID must exist");
return (E_NON_EXISTENT);
}
@@ -1802,7 +1804,7 @@ am_Error_e CAmDatabaseHandlerMap::getListSinksOfDomain(const am_domainID_t domai
listSinkID.clear();
if (!existDomain(domainID))
{
- logWarning(__func__,"domainID must exist");
+ logWarning(__METHOD_NAME__,"domainID must exist");
return (E_NON_EXISTENT);
}
@@ -1820,7 +1822,7 @@ am_Error_e CAmDatabaseHandlerMap::getListSourcesOfDomain(const am_domainID_t dom
listSourceID.clear();
if (!existDomain(domainID))
{
- logWarning(__func__,"domainID must exist");
+ logWarning(__METHOD_NAME__,"domainID must exist");
return (E_NON_EXISTENT);
}
CAmMapSource::const_iterator elementIterator = mMappedData.mSourceMap.begin();
@@ -1838,7 +1840,7 @@ am_Error_e CAmDatabaseHandlerMap::getListCrossfadersOfDomain(const am_domainID_t
listCrossfader.clear();
if (!existDomain(domainID))
{
- logWarning(__func__,"domainID must exist");
+ logWarning(__METHOD_NAME__,"domainID must exist");
return (E_NON_EXISTENT);
}
@@ -1865,7 +1867,7 @@ am_Error_e CAmDatabaseHandlerMap::getListGatewaysOfDomain(const am_domainID_t do
listGatewaysID.clear();
if (!existDomain(domainID))
{
- logWarning(__func__,"domainID must exist");
+ logWarning(__METHOD_NAME__,"domainID must exist");
return (E_NON_EXISTENT);
}
@@ -1883,7 +1885,7 @@ am_Error_e CAmDatabaseHandlerMap::getListConvertersOfDomain(const am_domainID_t
listConvertersID.clear();
if (!existDomain(domainID))
{
- logWarning(__func__,"domainID must exist");
+ logWarning(__METHOD_NAME__,"domainID must exist");
return (E_NON_EXISTENT);
}
@@ -2074,7 +2076,7 @@ am_Error_e CAmDatabaseHandlerMap::getListMainSinkSoundProperties(const am_sinkID
{
if (!existSink(sinkID))
{
- logWarning(__func__,"sinkID must exist");
+ logWarning(__METHOD_NAME__,"sinkID must exist");
return E_NON_EXISTENT;
}
@@ -2088,7 +2090,7 @@ am_Error_e CAmDatabaseHandlerMap::getListMainSourceSoundProperties(const am_sour
{
if (!existSource(sourceID))
{
- logWarning(__func__,"sourceID must exist");
+ logWarning(__METHOD_NAME__,"sourceID must exist");
return E_NON_EXISTENT;
}
const am_Source_s & source = mMappedData.mSourceMap.at(sourceID);
@@ -2101,7 +2103,7 @@ am_Error_e CAmDatabaseHandlerMap::getListSinkSoundProperties(const am_sinkID_t s
{
if (!existSink(sinkID))
{
- logWarning(__func__,"sinkID must exist");
+ logWarning(__METHOD_NAME__,"sinkID must exist");
return E_NON_EXISTENT;
}
@@ -2115,7 +2117,7 @@ am_Error_e CAmDatabaseHandlerMap::getListSourceSoundProperties(const am_sourceID
{
if (!existSource(sourceID))
{
- logWarning(__func__,"sourceID must exist");
+ logWarning(__METHOD_NAME__,"sourceID must exist");
return E_NON_EXISTENT;
}
@@ -2135,7 +2137,7 @@ am_Error_e am::CAmDatabaseHandlerMap::getListSinkConnectionFormats(const am_sink
{
if (!existSink(sinkID))
{
- logWarning(__func__,"sinkID must exist");
+ logWarning(__METHOD_NAME__,"sinkID must exist");
return E_NON_EXISTENT;
}
const am_Sink_s & sink = mMappedData.mSinkMap.at(sinkID);
@@ -2148,7 +2150,7 @@ am_Error_e am::CAmDatabaseHandlerMap::getListSourceConnectionFormats(const am_so
{
if (!existSource(sourceID))
{
- logWarning(__func__,"sourceID must exist");
+ logWarning(__METHOD_NAME__,"sourceID must exist");
return E_NON_EXISTENT;
}
const am_Source_s & source = mMappedData.mSourceMap.at(sourceID);
@@ -2161,7 +2163,7 @@ am_Error_e am::CAmDatabaseHandlerMap::getListGatewayConnectionFormats(const am_g
{
if (!existGateway(gatewayID))
{
- logWarning(__func__,"gatewayID must exist");
+ logWarning(__METHOD_NAME__,"gatewayID must exist");
return E_NON_EXISTENT;
}
ListConnectionFormat::const_iterator iter = mListConnectionFormat.begin();
@@ -2181,7 +2183,7 @@ am_Error_e CAmDatabaseHandlerMap::getTimingInformation(const am_mainConnectionID
{
if (!existMainConnection(mainConnectionID))
{
- logWarning(__func__,"mainConnectionID must exist");
+ logWarning(__METHOD_NAME__,"mainConnectionID must exist");
return E_NON_EXISTENT;
}
delay = -1;
@@ -2199,7 +2201,7 @@ am_Error_e CAmDatabaseHandlerMap::changeDelayMainConnection(const am_timeSync_t
{
if (!existMainConnection(connectionID))
{
- logError(__func__,"connectionID must exist");
+ logError(__METHOD_NAME__,"connectionID must exist");
return E_NON_EXISTENT;
}
DB_COND_UPDATE_RIE(mMappedData.mMainConnectionMap[connectionID].delay, delay);
@@ -2417,7 +2419,7 @@ am_Error_e CAmDatabaseHandlerMap::changeConnectionTimingInformation(const am_con
{
if(!existConnectionID(connectionID))
{
- logError(__func__,"connectionID must exist");
+ logError(__METHOD_NAME__,"connectionID must exist");
return (E_NON_EXISTENT);
}
@@ -2449,7 +2451,7 @@ am_Error_e CAmDatabaseHandlerMap::changeConnectionFinal(const am_connectionID_t
mMappedData.mConnectionMap.at(connectionID).reserved = false;
return E_OK;
}
- logError(__func__,"connectionID must exist");
+ logError(__METHOD_NAME__,"connectionID must exist");
return (E_NON_EXISTENT);
}
@@ -2490,7 +2492,7 @@ bool CAmDatabaseHandlerMap::sourceVisible(const am_sourceID_t sourceID) const
{
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must exist");
+ logError(__METHOD_NAME__,"sourceID must exist");
return false;
}
am_Source_Database_s source = mMappedData.mSourceMap.at(sourceID);
@@ -2574,7 +2576,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceState(const am_sourceID_t sourceID
{
if(!(sourceState>=SS_UNKNNOWN && sourceState<=SS_MAX))
{
- logError(__func__,"sourceState must be valid");
+ logError(__METHOD_NAME__,"sourceState must be valid");
return (E_NOT_POSSIBLE);
}
@@ -2583,7 +2585,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceState(const am_sourceID_t sourceID
mMappedData.mSourceMap.at(sourceID).sourceState = sourceState;
return (E_OK);
}
- logError(__func__,"sourceID must exist");
+ logError(__METHOD_NAME__,"sourceID must exist");
return (E_NON_EXISTENT);
}
@@ -2597,7 +2599,7 @@ am_Error_e CAmDatabaseHandlerMap::getSinkMainVolume(const am_sinkID_t sinkID, am
return (E_OK);
}
mainVolume = -1;
- logWarning(__func__,"sinkID must be valid");
+ logWarning(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
@@ -2611,7 +2613,7 @@ am_Error_e CAmDatabaseHandlerMap::getSinkVolume(const am_sinkID_t sinkID, am_vol
return (E_OK);
}
volume = -1;
- logWarning(__func__,"sinkID must be valid");
+ logWarning(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
@@ -2624,7 +2626,7 @@ am_Error_e CAmDatabaseHandlerMap::getSourceVolume(const am_sourceID_t sourceID,
return (E_OK);
}
volume = -1;
- logWarning(__func__,"sourceID must be valid");
+ logWarning(__METHOD_NAME__,"sourceID must be valid");
return (E_NON_EXISTENT);
}
@@ -2648,7 +2650,7 @@ am_Error_e CAmDatabaseHandlerMap::getSinkSoundPropertyValue(const am_sinkID_t si
}
}
value = -1;
- logWarning(__func__,"sinkID must be valid");
+ logWarning(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
@@ -2671,7 +2673,7 @@ am_Error_e CAmDatabaseHandlerMap::getSourceSoundPropertyValue(const am_sourceID_
}
}
value = -1;
- logWarning(__func__,"sourceID must be valid");
+ logWarning(__METHOD_NAME__,"sourceID must be valid");
return (E_NON_EXISTENT);
}
@@ -2694,7 +2696,7 @@ am_Error_e CAmDatabaseHandlerMap::getMainSinkSoundPropertyValue(const am_sinkID_
}
}
value = -1;
- logWarning(__func__,"sinkID must be valid");
+ logWarning(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
@@ -2719,7 +2721,7 @@ am_Error_e CAmDatabaseHandlerMap::getMainSourceSoundPropertyValue(const am_sourc
}
value = -1;
- logWarning(__func__,"sourceID must be valid");
+ logWarning(__METHOD_NAME__,"sourceID must be valid");
return (E_NON_EXISTENT);
}
@@ -2733,7 +2735,7 @@ am_Error_e CAmDatabaseHandlerMap::getDomainState(const am_domainID_t domainID, a
return (E_OK);
}
state = DS_UNKNOWN;
- logWarning(__func__,"domainID must be valid");
+ logWarning(__METHOD_NAME__,"domainID must be valid");
return (E_NON_EXISTENT);
}
@@ -2837,7 +2839,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkVolume(const am_sinkID_t sinkID, con
{
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must be valid");
+ logError(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
@@ -2849,7 +2851,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceVolume(const am_sourceID_t sourceI
{
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must be valid");
+ logError(__METHOD_NAME__,"sourceID must be valid");
return (E_NON_EXISTENT);
}
mMappedData.mSourceMap[sourceID].volume = volume;
@@ -2861,7 +2863,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceSoundPropertyDB(const am_SoundProp
{
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must be valid");
+ logError(__METHOD_NAME__,"sourceID must be valid");
return (E_NON_EXISTENT);
}
@@ -2877,7 +2879,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceSoundPropertyDB(const am_SoundProp
return (E_OK);
}
}
- logError(__func__,"soundproperty type must be valid source:",sourceID,"type",soundProperty.type);
+ logError(__METHOD_NAME__,"soundproperty type must be valid source:",sourceID,"type",soundProperty.type);
return (E_NON_EXISTENT);
}
@@ -2886,7 +2888,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkSoundPropertyDB(const am_SoundProper
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must be valid");
+ logError(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
am_Sink_Database_s & sink = mMappedData.mSinkMap[sinkID];
@@ -2901,7 +2903,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkSoundPropertyDB(const am_SoundProper
return (E_OK);
}
}
- logError(__func__,"soundproperty type must be valid sinkID:",sinkID,"type",soundProperty.type);
+ logError(__METHOD_NAME__,"soundproperty type must be valid sinkID:",sinkID,"type",soundProperty.type);
return (E_NON_EXISTENT);
}
@@ -2910,7 +2912,7 @@ am_Error_e CAmDatabaseHandlerMap::changeCrossFaderHotSink(const am_crossfaderID_
if (!existCrossFader(crossfaderID))
{
- logError(__func__,"crossfaderID must be valid");
+ logError(__METHOD_NAME__,"crossfaderID must be valid");
return (E_NON_EXISTENT);
}
@@ -2966,7 +2968,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceDB(const am_sourceID_t sourceID, c
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must be valid");
+ logError(__METHOD_NAME__,"sourceID must be valid");
return (E_NON_EXISTENT);
}
@@ -3042,7 +3044,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkDB(const am_sinkID_t sinkID, const a
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must be valid");
+ logError(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
@@ -3108,7 +3110,7 @@ am_Error_e CAmDatabaseHandlerMap::getListMainSinkNotificationConfigurations(cons
if (!existSink(sinkID))
{
- logWarning(__func__,"sinkID must be valid");
+ logWarning(__METHOD_NAME__,"sinkID must be valid");
return (E_DATABASE_ERROR);
}
listMainNotificationConfigurations.clear();
@@ -3123,7 +3125,7 @@ am_Error_e CAmDatabaseHandlerMap::getListMainSourceNotificationConfigurations(co
if (!existSource(sourceID))
{
- logWarning(__func__,"sourceID must be valid");
+ logWarning(__METHOD_NAME__,"sourceID must be valid");
return (E_DATABASE_ERROR);
}
@@ -3156,7 +3158,7 @@ am_Error_e CAmDatabaseHandlerMap::changeMainSinkNotificationConfigurationDB(cons
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must be valid");
+ logError(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
if(!changeMainNotificationConfiguration(mMappedData.mSinkMap.at(sinkID).listMainNotificationConfigurations, mainNotificationConfiguration))
@@ -3174,7 +3176,7 @@ am_Error_e CAmDatabaseHandlerMap::changeMainSourceNotificationConfigurationDB(co
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must be valid");
+ logError(__METHOD_NAME__,"sourceID must be valid");
return (E_NON_EXISTENT);
}
@@ -3193,7 +3195,7 @@ am_Error_e CAmDatabaseHandlerMap::changeGatewayDB(const am_gatewayID_t gatewayID
if (!existGateway(gatewayID))
{
- logError(__func__,"gatewayID must be valid");
+ logError(__METHOD_NAME__,"gatewayID must be valid");
return (E_NON_EXISTENT);
}
@@ -3224,7 +3226,7 @@ am_Error_e CAmDatabaseHandlerMap::changeConverterDB(const am_converterID_t conve
if (!existConverter(converterID))
{
- logError(__func__,"converterID must be valid");
+ logError(__METHOD_NAME__,"converterID must be valid");
return (E_NON_EXISTENT);
}
@@ -3271,7 +3273,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSinkNotificationConfigurationDB(const am
if (!existSink(sinkID))
{
- logError(__func__,"sinkID must be valid");
+ logError(__METHOD_NAME__,"sinkID must be valid");
return (E_NON_EXISTENT);
}
if(!changeNotificationConfiguration(mMappedData.mSinkMap.at(sinkID).listNotificationConfigurations, notificationConfiguration))
@@ -3288,7 +3290,7 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceNotificationConfigurationDB(const
if (!existSource(sourceID))
{
- logError(__func__,"sourceID must be valid");
+ logError(__METHOD_NAME__,"sourceID must be valid");
return (E_NON_EXISTENT);
}
diff --git a/AudioManagerCore/src/CAmDatabaseObserver.cpp b/AudioManagerCore/src/CAmDatabaseObserver.cpp
index acac639..d9ced92 100644
--- a/AudioManagerCore/src/CAmDatabaseObserver.cpp
+++ b/AudioManagerCore/src/CAmDatabaseObserver.cpp
@@ -29,7 +29,6 @@
#include <sys/ioctl.h>
#include "CAmCommandSender.h"
#include "CAmRoutingSender.h"
-#include "CAmTelnetServer.h"
#include "CAmDltWrapper.h"
#include "CAmSerializer.h"
diff --git a/AudioManagerCore/src/CAmRoutingReceiver.cpp b/AudioManagerCore/src/CAmRoutingReceiver.cpp
index 103d35c..587cbf4 100644
--- a/AudioManagerCore/src/CAmRoutingReceiver.cpp
+++ b/AudioManagerCore/src/CAmRoutingReceiver.cpp
@@ -30,6 +30,8 @@
#include "CAmDltWrapper.h"
#include "CAmSocketHandler.h"
+#define __METHOD_NAME__ std::string (std::string("CAmRoutingReceiver::") + __func__)
+
namespace am
{
@@ -92,7 +94,7 @@ void CAmRoutingReceiver::handleCallback(const am_Handle_s handle, const am_Error
void CAmRoutingReceiver::ackConnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"connectionID=",connectionID,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"connectionID=",connectionID,"error=",error);
if (error == am_Error_e::E_OK)
{
mpRoutingSender->writeToDatabaseAndRemove(handle);
@@ -111,7 +113,7 @@ void CAmRoutingReceiver::ackConnect(const am_Handle_s handle, const am_connectio
void CAmRoutingReceiver::ackDisconnect(const am_Handle_s handle, const am_connectionID_t connectionID, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"connectionID=",connectionID,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"connectionID=",connectionID,"error=",error);
//only remove connection of handle was found
if(mpRoutingSender->removeHandle(handle) == 0)
{
@@ -122,7 +124,7 @@ void CAmRoutingReceiver::ackDisconnect(const am_Handle_s handle, const am_connec
void CAmRoutingReceiver::ackSetSinkVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"volume=",volume,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"volume=",volume,"error=",error);
if(error == E_OK)
{
mpRoutingSender->checkVolume(handle,volume);
@@ -141,7 +143,7 @@ void CAmRoutingReceiver::ackSetSinkVolumeChange(const am_Handle_s handle, const
void CAmRoutingReceiver::ackSetSourceVolumeChange(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"volume=",volume,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"volume=",volume,"error=",error);
if(error == E_OK)
{
mpRoutingSender->checkVolume(handle,volume);
@@ -160,55 +162,55 @@ void CAmRoutingReceiver::ackSetSourceVolumeChange(const am_Handle_s handle, cons
void CAmRoutingReceiver::ackSetSourceState(const am_Handle_s handle, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckSetSourceState(handle, error);
}
void CAmRoutingReceiver::ackSetSinkSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckSetSinkSoundProperty(handle, error);
}
void am::CAmRoutingReceiver::ackSetSinkSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckSetSinkSoundProperties(handle, error);
}
void CAmRoutingReceiver::ackSetSourceSoundProperty(const am_Handle_s handle, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckSetSourceSoundProperty(handle, error);
}
void am::CAmRoutingReceiver::ackSetSourceSoundProperties(const am_Handle_s handle, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckSetSourceSoundProperties(handle, error);
}
void CAmRoutingReceiver::ackCrossFading(const am_Handle_s handle, const am_HotSink_e hotSink, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"hotsink=",hotSink,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"hotsink=",hotSink,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckCrossFade(handle, hotSink, error);
}
void CAmRoutingReceiver::ackSourceVolumeTick(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume)
{
- logInfo(__func__,"handle=",handle,"sourceID=",sourceID,"volume=",volume);
+ logInfo(__METHOD_NAME__,"handle=",handle,"sourceID=",sourceID,"volume=",volume);
mpControlSender->hookSystemSourceVolumeTick(handle, sourceID, volume);
}
void CAmRoutingReceiver::ackSinkVolumeTick(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume)
{
- logInfo(__func__,"handle=",handle,"sinkID=",sinkID,"volume=",volume);
+ logInfo(__METHOD_NAME__,"handle=",handle,"sinkID=",sinkID,"volume=",volume);
mpControlSender->hookSystemSinkVolumeTick(handle, sinkID, volume);
}
@@ -396,14 +398,14 @@ void am::CAmRoutingReceiver::waitOnStartup(bool startup)
void CAmRoutingReceiver::ackSinkNotificationConfiguration(const am_Handle_s handle, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckSetSinkNotificationConfiguration(handle,error);
}
void CAmRoutingReceiver::ackSourceNotificationConfiguration(const am_Handle_s handle, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckSetSourceNotificationConfiguration(handle,error);
}
@@ -430,20 +432,20 @@ am_Error_e CAmRoutingReceiver::updateSource(const am_sourceID_t sourceID, const
void CAmRoutingReceiver::ackSetVolumes(const am_Handle_s handle, const std::vector<am_Volumes_s>& listvolumes, const am_Error_e error)
{
- logInfo(__func__,"handle=",handle,"error=",error);
+ logInfo(__METHOD_NAME__,"handle=",handle,"error=",error);
handleCallback(handle,error);
mpControlSender->cbAckSetVolume(handle,listvolumes,error);
}
void CAmRoutingReceiver::hookSinkNotificationDataChange(const am_sinkID_t sinkID, const am_NotificationPayload_s& payload)
{
- logInfo("CAmRoutingReceiver::hookSinkNotificationDataChange received, sinkID=",sinkID,"type=",payload.type,"notificationValue=",payload.value);
+ logInfo(__METHOD_NAME__,"sinkID=",sinkID,"type=",payload.type,"notificationValue=",payload.value);
mpControlSender->hookSinkNotificationDataChanged(sinkID,payload);
}
void CAmRoutingReceiver::hookSourceNotificationDataChange(const am_sourceID_t sourceID, const am_NotificationPayload_s& payload)
{
- logInfo("CAmRoutingReceiver::hookSourceNotificationDataChange received, sinkID=",sourceID,"type=",payload.type,"notificationValue=",payload.value);
+ logInfo(__METHOD_NAME__,"sinkID=",sourceID,"type=",payload.type,"notificationValue=",payload.value);
mpControlSender->hookSourceNotificationDataChanged(sourceID,payload);
}
diff --git a/AudioManagerCore/src/CAmRoutingSender.cpp b/AudioManagerCore/src/CAmRoutingSender.cpp
index 06456f5..fc0953f 100644
--- a/AudioManagerCore/src/CAmRoutingSender.cpp
+++ b/AudioManagerCore/src/CAmRoutingSender.cpp
@@ -43,6 +43,8 @@ namespace am
#define REQUIRED_INTERFACE_VERSION_MAJOR 1 //!< major interface version. All versions smaller than this will be rejected
#define REQUIRED_INTERFACE_VERSION_MINOR 0 //!< minor interface version. All versions smaller than this will be rejected
+#define __METHOD_NAME__ std::string (std::string("CAmRoutingSender::") + __func__)
+
CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginDirectories, IAmDatabaseHandler* databaseHandler) :
mHandleCount(0), //
mlistActiveHandles(), //
@@ -58,7 +60,7 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
if (listOfPluginDirectories.empty())
{
- logError(__func__,"List of routingplugins is empty");
+ logError(__METHOD_NAME__,"List of routingplugins is empty");
}
std::vector<std::string> sharedLibraryNameList;
@@ -69,12 +71,12 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
for (; dirIter < dirIterEnd; ++dirIter)
{
const char* directoryName = dirIter->c_str();
- logInfo("Searching for HookPlugins in", directoryName);
+ logInfo(__METHOD_NAME__,"Searching for HookPlugins in", directoryName);
DIR *directory = opendir(directoryName);
if (!directory)
{
- logError("RoutingSender::RoutingSender Error opening directory: ", directoryName);
+ logError(__METHOD_NAME__,"Error opening directory: ", directoryName);
continue;
}
@@ -94,7 +96,7 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
struct stat buf;
if (stat(fullName.c_str(), &buf)) {
- logInfo(__PRETTY_FUNCTION__,"Failed to stat file: ", entryName, errno);
+ logInfo(__METHOD_NAME__,"Failed to stat file: ", entryName, errno);
continue;
}
@@ -103,13 +105,13 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
if (regularFile && sharedLibExtension)
{
- logInfo("RoutingSender::RoutingSender adding file: ", entryName);
+ logInfo(__METHOD_NAME__,"adding file: ", entryName);
std::string name(directoryName);
sharedLibraryNameList.push_back(name + "/" + entryName);
}
else
{
- logInfo("RoutingSender::RoutingSender PluginSearch ignoring file :", entryName);
+ logInfo(__METHOD_NAME__, "plugin search ignoring file :", entryName);
}
}
@@ -122,7 +124,7 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
for (; iter != iterEnd; ++iter)
{
- logInfo("RoutingSender::RoutingSender try loading: ", *iter);
+ logInfo(__METHOD_NAME__,"try loading: ", *iter);
IAmRoutingSend* (*createFunc)();
void* tempLibHandle = NULL;
@@ -130,7 +132,7 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
if (!createFunc)
{
- logError("RoutingSender::RoutingSender Entry point of RoutingPlugin not found");
+ logError(__METHOD_NAME__,"Entry point of RoutingPlugin not found");
continue;
}
@@ -138,7 +140,7 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
if (!router)
{
- logError("RoutingSender::RoutingSender RoutingPlugin initialization failed. Entry Function not callable");
+ logError(__METHOD_NAME__,"initialization of plugin ",*iter,"failed. Entry Function not callable");
dlclose(tempLibHandle);
continue;
}
@@ -159,7 +161,7 @@ CAmRoutingSender::CAmRoutingSender(const std::vector<std::string>& listOfPluginD
if (majorVersion < cMajorVersion || ((majorVersion == cMajorVersion) && (minorVersion > cMinorVersion)))
{
- logError("Routing initialization failed. Version of Interface to old");
+ logError(__METHOD_NAME__,"Routing initialization failed. Version of Interface to old");
dlclose(tempLibHandle);
continue;
}
@@ -180,7 +182,7 @@ CAmRoutingSender::~CAmRoutingSender()
//every open handle is assumed to be an error...
for (; it != mlistActiveHandles.end(); ++it)
{
- logError(__func__,"The action for the handle",it->first,"is still open");
+ logError(__METHOD_NAME__,"The action for the handle",it->first,"is still open");
}
}
@@ -207,10 +209,10 @@ am_Error_e CAmRoutingSender::asyncAbort(const am_Handle_s& handle)
auto iter (mlistActiveHandles.find(handle));
if (iter == mlistActiveHandles.end())
{
- logError(__func__,"Could not find handle",handle);
+ logError(__METHOD_NAME__,"Could not find handle",handle);
return (E_NON_EXISTENT);
}
- logInfo(__func__," handle", handle);
+ logInfo(__METHOD_NAME__," handle", handle);
return (iter->second->returnInterface()->asyncAbort(handle));
}
@@ -219,7 +221,7 @@ am_Error_e CAmRoutingSender::asyncConnect(am_Handle_s& handle, am_connectionID_t
auto iter (mMapSinkInterface.find(sinkID));
if (iter == mMapSinkInterface.end())
{
- logError(__func__,"Could not find sink",sinkID);
+ logError(__METHOD_NAME__,"Could not find sink",sinkID);
return (E_NON_EXISTENT);
}
@@ -227,11 +229,11 @@ am_Error_e CAmRoutingSender::asyncConnect(am_Handle_s& handle, am_connectionID_t
{
if (handle.handleType==am_Handle_e::H_CONNECT)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -255,12 +257,12 @@ am_Error_e CAmRoutingSender::asyncConnect(am_Handle_s& handle, am_connectionID_t
handle = createHandle(handleData, am_Handle_e::H_CONNECT);
}
- logInfo(__func__,"connectionID=",connectionID,"connectionFormat=", connectionFormat, "sourceID=", sourceID, "sinkID=", sinkID,"handle=",handle);
+ logInfo(__METHOD_NAME__,"connectionID=",connectionID,"connectionFormat=", connectionFormat, "sourceID=", sourceID, "sinkID=", sinkID,"handle=",handle);
am_Error_e syncError(iter->second->asyncConnect(handle, connectionID, sourceID, sinkID, connectionFormat));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling connect connectionID:",connectionID,"sourceID:",sourceID,"sinkID:",sinkID,"connectionFormat:",connectionFormat,"handle",handle);
+ logError(__METHOD_NAME__,"Error while calling connect connectionID:",connectionID,"sourceID:",sourceID,"sinkID:",sinkID,"connectionFormat:",connectionFormat,"handle",handle);
mpDatabaseHandler->removeConnection(connectionID);
}
return(syncError);
@@ -271,7 +273,7 @@ am_Error_e CAmRoutingSender::asyncDisconnect(am_Handle_s& handle, const am_conne
auto iter(mMapConnectionInterface.find(connectionID));
if (iter == mMapConnectionInterface.end())
{
- logError(__func__,"Could not find connection",connectionID);
+ logError(__METHOD_NAME__,"Could not find connection",connectionID);
return (E_NON_EXISTENT);
}
@@ -279,11 +281,11 @@ am_Error_e CAmRoutingSender::asyncDisconnect(am_Handle_s& handle, const am_conne
{
if (handle.handleType==am_Handle_e::H_DISCONNECT)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -293,12 +295,12 @@ am_Error_e CAmRoutingSender::asyncDisconnect(am_Handle_s& handle, const am_conne
handle = createHandle(handleData, am_Handle_e::H_DISCONNECT);
}
- logInfo(__func__,"connectionID=", connectionID, "handle=",handle);
+ logInfo(__METHOD_NAME__,"connectionID=", connectionID, "handle=",handle);
am_Error_e syncError(iter->second->asyncDisconnect(handle, connectionID));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling disconnect connectionID:",connectionID,"handle",handle);
+ logError(__METHOD_NAME__,"Error while calling disconnect connectionID:",connectionID,"handle",handle);
}
return(syncError);
}
@@ -308,7 +310,7 @@ am_Error_e CAmRoutingSender::asyncSetSinkVolume(am_Handle_s& handle, const am_si
auto iter (mMapSinkInterface.find(sinkID));
if (iter == mMapSinkInterface.end())
{
- logError(__func__,"Could not find sink",sinkID);
+ logError(__METHOD_NAME__,"Could not find sink",sinkID);
return (E_NON_EXISTENT);
}
@@ -316,11 +318,11 @@ am_Error_e CAmRoutingSender::asyncSetSinkVolume(am_Handle_s& handle, const am_si
{
if (handle.handleType==am_Handle_e::H_SETSINKVOLUME)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -330,12 +332,12 @@ am_Error_e CAmRoutingSender::asyncSetSinkVolume(am_Handle_s& handle, const am_si
handle = createHandle(handleData, H_SETSINKVOLUME);
}
- logInfo(__func__,"sinkID=", sinkID, "volume=", volume, "ramp=", ramp, "time=", time,"handle=",handle);
+ logInfo(__METHOD_NAME__,"sinkID=", sinkID, "volume=", volume, "ramp=", ramp, "time=", time,"handle=",handle);
am_Error_e syncError(iter->second->asyncSetSinkVolume(handle, sinkID, volume, ramp, time));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSinkVolume sinkID:",sinkID,"handle:",handle,"volume:",volume,"ramp:",ramp,"time:",time);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSinkVolume sinkID:",sinkID,"handle:",handle,"volume:",volume,"ramp:",ramp,"time:",time);
}
return(syncError);
}
@@ -345,7 +347,7 @@ am_Error_e CAmRoutingSender::asyncSetSourceVolume(am_Handle_s& handle, const am_
auto iter (mMapSourceInterface.find(sourceID));
if (iter == mMapSourceInterface.end())
{
- logError(__func__,"Could not find sourceID",sourceID);
+ logError(__METHOD_NAME__,"Could not find sourceID",sourceID);
return (E_NON_EXISTENT);
}
@@ -353,11 +355,11 @@ am_Error_e CAmRoutingSender::asyncSetSourceVolume(am_Handle_s& handle, const am_
{
if (handle.handleType==am_Handle_e::H_SETSOURCEVOLUME)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -367,12 +369,12 @@ am_Error_e CAmRoutingSender::asyncSetSourceVolume(am_Handle_s& handle, const am_
handle = createHandle(handleData, H_SETSOURCEVOLUME);
}
- logInfo(__func__,"sourceID=", sourceID,"volume=", volume, "ramp=", ramp, "time=", time,"handle=",handle);
+ logInfo(__METHOD_NAME__,"sourceID=", sourceID,"volume=", volume, "ramp=", ramp, "time=", time,"handle=",handle);
am_Error_e syncError(iter->second->asyncSetSourceVolume(handle, sourceID, volume, ramp, time));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSourceVolume sourceID:",sourceID,"handle:",handle,"volume:",volume,"ramp:",ramp,"time:",time);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSourceVolume sourceID:",sourceID,"handle:",handle,"volume:",volume,"ramp:",ramp,"time:",time);
}
return(syncError);
}
@@ -382,7 +384,7 @@ am_Error_e CAmRoutingSender::asyncSetSourceState(am_Handle_s& handle, const am_s
auto iter (mMapSourceInterface.find(sourceID));
if (iter == mMapSourceInterface.end())
{
- logError(__func__,"Could not find sourceID",sourceID);
+ logError(__METHOD_NAME__,"Could not find sourceID",sourceID);
return (E_NON_EXISTENT);
}
@@ -390,11 +392,11 @@ am_Error_e CAmRoutingSender::asyncSetSourceState(am_Handle_s& handle, const am_s
{
if (handle.handleType==am_Handle_e::H_SETSOURCESTATE)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -403,12 +405,12 @@ am_Error_e CAmRoutingSender::asyncSetSourceState(am_Handle_s& handle, const am_s
auto handleData = std::make_shared<handleSourceState>(iter->second,sourceID,state,mpDatabaseHandler);
handle = createHandle(handleData, H_SETSOURCESTATE);
}
- logInfo(__func__,"sourceID=", sourceID, "state=", state,"handle=",handle);
+ logInfo(__METHOD_NAME__,"sourceID=", sourceID, "state=", state,"handle=",handle);
am_Error_e syncError(iter->second->asyncSetSourceState(handle, sourceID, state));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSourceState sourceID:",sourceID,"handle:",handle,"state:",state);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSourceState sourceID:",sourceID,"handle:",handle,"state:",state);
}
return(syncError);
}
@@ -418,7 +420,7 @@ am_Error_e CAmRoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, cons
auto iter (mMapSinkInterface.find(sinkID));
if (iter == mMapSinkInterface.end())
{
- logError(__func__,"Could not find sink",sinkID);
+ logError(__METHOD_NAME__,"Could not find sink",sinkID);
return (E_NON_EXISTENT);
}
@@ -426,11 +428,11 @@ am_Error_e CAmRoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, cons
{
if (handle.handleType==am_Handle_e::H_SETSINKSOUNDPROPERTY)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -440,12 +442,12 @@ am_Error_e CAmRoutingSender::asyncSetSinkSoundProperty(am_Handle_s& handle, cons
handle = createHandle(handleData, H_SETSINKSOUNDPROPERTY);
}
- logInfo(__func__,"sinkID=", sinkID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value,"handle=",handle);
+ logInfo(__METHOD_NAME__,"sinkID=", sinkID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value,"handle=",handle);
am_Error_e syncError(iter->second->asyncSetSinkSoundProperty(handle, sinkID, soundProperty));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSinkSoundProperty sinkID:",sinkID,"handle:",handle,"soundProperty:",soundProperty.type,soundProperty.value);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSinkSoundProperty sinkID:",sinkID,"handle:",handle,"soundProperty:",soundProperty.type,soundProperty.value);
}
return(syncError);
}
@@ -455,7 +457,7 @@ am_Error_e CAmRoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, co
auto iter (mMapSourceInterface.find(sourceID));
if (iter == mMapSourceInterface.end())
{
- logError(__func__,"Could not find sourceID",sourceID);
+ logError(__METHOD_NAME__,"Could not find sourceID",sourceID);
return (E_NON_EXISTENT);
}
@@ -463,11 +465,11 @@ am_Error_e CAmRoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, co
{
if (handle.handleType==am_Handle_e::H_SETSOURCESOUNDPROPERTY)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -476,12 +478,12 @@ am_Error_e CAmRoutingSender::asyncSetSourceSoundProperty(am_Handle_s& handle, co
auto handleData = std::make_shared<handleSourceSoundProperty>(iter->second,sourceID,soundProperty,mpDatabaseHandler);
handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTY);
}
- logInfo(__func__,"sourceID=", sourceID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value,"handle=",handle);
+ logInfo(__METHOD_NAME__,"sourceID=", sourceID, "soundProperty.Type=", soundProperty.type, "soundProperty.value=", soundProperty.value,"handle=",handle);
am_Error_e syncError(iter->second->asyncSetSourceSoundProperty(handle, sourceID, soundProperty));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSourceSoundProperty sourceID:",sourceID,"handle:",handle,"soundProperty:",soundProperty.type,soundProperty.value);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSourceSoundProperty sourceID:",sourceID,"handle:",handle,"soundProperty:",soundProperty.type,soundProperty.value);
}
return(syncError);
}
@@ -491,7 +493,7 @@ am_Error_e CAmRoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle,
auto iter (mMapSourceInterface.find(sourceID));
if (iter == mMapSourceInterface.end())
{
- logError(__func__,"Could not find sourceID",sourceID);
+ logError(__METHOD_NAME__,"Could not find sourceID",sourceID);
return (E_NON_EXISTENT);
}
@@ -499,11 +501,11 @@ am_Error_e CAmRoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle,
{
if (handle.handleType==am_Handle_e::H_SETSOURCESOUNDPROPERTIES)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -513,12 +515,12 @@ am_Error_e CAmRoutingSender::asyncSetSourceSoundProperties(am_Handle_s& handle,
handle = createHandle(handleData, H_SETSOURCESOUNDPROPERTIES);
}
- logInfo(__func__,"sourceID=", sourceID);
+ logInfo(__METHOD_NAME__,"sourceID=", sourceID);
am_Error_e syncError(iter->second->asyncSetSourceSoundProperties(handle, sourceID, listSoundProperties));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSourceSoundProperties sourceID:",sourceID,"handle:",handle);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSourceSoundProperties sourceID:",sourceID,"handle:",handle);
}
return(syncError);
}
@@ -528,7 +530,7 @@ am_Error_e CAmRoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, co
auto iter (mMapSinkInterface.find(sinkID));
if (iter == mMapSinkInterface.end())
{
- logError(__func__,"Could not find sink",sinkID);
+ logError(__METHOD_NAME__,"Could not find sink",sinkID);
return (E_NON_EXISTENT);
}
@@ -536,11 +538,11 @@ am_Error_e CAmRoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, co
{
if (handle.handleType==am_Handle_e::H_SETSINKSOUNDPROPERTIES)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -550,12 +552,12 @@ am_Error_e CAmRoutingSender::asyncSetSinkSoundProperties(am_Handle_s& handle, co
handle = createHandle(handleData, H_SETSINKSOUNDPROPERTIES);
}
- logInfo(__func__,"sinkID=", sinkID,"handle=",handle);
+ logInfo(__METHOD_NAME__,"sinkID=", sinkID,"handle=",handle);
am_Error_e syncError(iter->second->asyncSetSinkSoundProperties(handle, sinkID, listSoundProperties));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSinkSoundProperties sinkID:",sinkID,"handle:",handle);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSinkSoundProperties sinkID:",sinkID,"handle:",handle);
}
return(syncError);
}
@@ -565,7 +567,7 @@ am_Error_e CAmRoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossf
auto iter (mMapCrossfaderInterface.find(crossfaderID));
if (iter == mMapCrossfaderInterface.end())
{
- logError(__func__,"Could not find crossfaderID",crossfaderID);
+ logError(__METHOD_NAME__,"Could not find crossfaderID",crossfaderID);
return (E_NON_EXISTENT);
}
@@ -573,11 +575,11 @@ am_Error_e CAmRoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossf
{
if (handle.handleType==am_Handle_e::H_CROSSFADE)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -587,7 +589,7 @@ am_Error_e CAmRoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossf
handle = createHandle(handleData, H_CROSSFADE);
}
- logInfo(__func__,"hotSource=", hotSink, "crossfaderID=", crossfaderID, "rampType=", rampType, "rampTime=", time,"handle=",handle);
+ logInfo(__METHOD_NAME__,"hotSource=", hotSink, "crossfaderID=", crossfaderID, "rampType=", rampType, "rampTime=", time,"handle=",handle);
am_Error_e syncError(iter->second->asyncCrossFade(handle, crossfaderID, hotSink, rampType, time));
if (syncError)
{
@@ -598,7 +600,7 @@ am_Error_e CAmRoutingSender::asyncCrossFade(am_Handle_s& handle, const am_crossf
am_Error_e CAmRoutingSender::setDomainState(const am_domainID_t domainID, const am_DomainState_e domainState)
{
- logInfo(__func__,"domainID=", domainID, "domainState=", domainState);
+ logInfo(__METHOD_NAME__,"domainID=", domainID, "domainState=", domainState);
DomainInterfaceMap::iterator iter = mMapDomainInterface.begin();
iter = mMapDomainInterface.find(domainID);
if (iter != mMapDomainInterface.end())
@@ -760,7 +762,7 @@ am_Error_e CAmRoutingSender::removeHandle(const am_Handle_s& handle)
{
return (E_OK);
}
- logError(__func__,"Could not remove handle",handle.handle);
+ logError(__METHOD_NAME__,"Could not remove handle",handle.handle);
return (E_NON_EXISTENT);
}
@@ -793,7 +795,7 @@ am_Handle_s CAmRoutingSender::createHandle(std::shared_ptr<handleDataBase> handl
{
logInfo("CAmRoutingSender::createHandle warning: too many open handles, number of handles: ", mlistActiveHandles.size());
}
- logInfo(__func__,handle.handle, handle.handleType);
+ logInfo(__METHOD_NAME__,handle.handle, handle.handleType);
return (handle);
}
@@ -876,7 +878,7 @@ am_Error_e CAmRoutingSender::asyncSetVolumes(am_Handle_s& handle, const std::vec
auto handleData = std::make_shared<handleSetVolumes>(pRoutingInterface,listVolumes,mpDatabaseHandler);
handle = createHandle(handleData, H_SETVOLUMES);
- logInfo(__func__, "handle=", handle);
+ logInfo(__METHOD_NAME__, "handle=", handle);
am_Error_e syncError(pRoutingInterface->asyncSetVolumes(handle, listVolumes));
if (syncError)
{
@@ -891,7 +893,7 @@ am_Error_e CAmRoutingSender::asyncSetSinkNotificationConfiguration(am_Handle_s&
auto iter (mMapSinkInterface.find(sinkID));
if (iter == mMapSinkInterface.end())
{
- logError(__func__,"Could not find sink",sinkID);
+ logError(__METHOD_NAME__,"Could not find sink",sinkID);
return (E_NON_EXISTENT);
}
@@ -899,11 +901,11 @@ am_Error_e CAmRoutingSender::asyncSetSinkNotificationConfiguration(am_Handle_s&
{
if (handle.handleType==am_Handle_e::H_SETSINKNOTIFICATION)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -913,12 +915,12 @@ am_Error_e CAmRoutingSender::asyncSetSinkNotificationConfiguration(am_Handle_s&
handle = createHandle(handleData, H_SETSINKNOTIFICATION);
}
- logInfo(__func__,"sinkID=",sinkID,"notificationConfiguration.type=",notificationConfiguration.type,"notificationConfiguration.status",notificationConfiguration.status,"notificationConfiguration.parameter",notificationConfiguration.parameter);
+ logInfo(__METHOD_NAME__,"sinkID=",sinkID,"notificationConfiguration.type=",notificationConfiguration.type,"notificationConfiguration.status",notificationConfiguration.status,"notificationConfiguration.parameter",notificationConfiguration.parameter);
am_Error_e syncError(iter->second->asyncSetSinkNotificationConfiguration(handle, sinkID, notificationConfiguration));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSinkNotificationConfiguration sinkID:",sinkID,"handle:",handle);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSinkNotificationConfiguration sinkID:",sinkID,"handle:",handle);
}
return(syncError);
}
@@ -928,7 +930,7 @@ am_Error_e CAmRoutingSender::asyncSetSourceNotificationConfiguration(am_Handle_s
auto iter (mMapSourceInterface.find(sourceID));
if (iter == mMapSourceInterface.end())
{
- logError(__func__,"Could not find sourceID",sourceID);
+ logError(__METHOD_NAME__,"Could not find sourceID",sourceID);
return (E_NON_EXISTENT);
}
@@ -936,11 +938,11 @@ am_Error_e CAmRoutingSender::asyncSetSourceNotificationConfiguration(am_Handle_s
{
if (handle.handleType==am_Handle_e::H_SETSOURCENOTIFICATION)
{
- logInfo(__func__,"Resending for handle",handle);
+ logInfo(__METHOD_NAME__,"Resending for handle",handle);
}
else
{
- logError(__func__,"Handle exists but wrong type",handle);
+ logError(__METHOD_NAME__,"Handle exists but wrong type",handle);
return(E_UNKNOWN);
}
}
@@ -950,12 +952,12 @@ am_Error_e CAmRoutingSender::asyncSetSourceNotificationConfiguration(am_Handle_s
handle = createHandle(handleData, H_SETSOURCENOTIFICATION);
}
- logInfo(__func__,"sourceID=",sourceID,"notificationConfiguration.type=",notificationConfiguration.type,"notificationConfiguration.status",notificationConfiguration.status,"notificationConfiguration.parameter",notificationConfiguration.parameter);
+ logInfo(__METHOD_NAME__,"sourceID=",sourceID,"notificationConfiguration.type=",notificationConfiguration.type,"notificationConfiguration.status",notificationConfiguration.status,"notificationConfiguration.parameter",notificationConfiguration.parameter);
am_Error_e syncError(iter->second->asyncSetSourceNotificationConfiguration(handle, sourceID, notificationConfiguration));
if (syncError)
{
removeHandle(handle);
- logError(__func__,"Error while calling asyncSetSourceNotificationConfiguration sourceID:",sourceID,"handle:",handle);
+ logError(__METHOD_NAME__,"Error while calling asyncSetSourceNotificationConfiguration sourceID:",sourceID,"handle:",handle);
}
return(syncError);
}
@@ -1002,7 +1004,7 @@ am_Error_e CAmRoutingSender::writeToDatabaseAndRemove(const am_Handle_s handle)
mlistActiveHandles.erase(handle);
return (error);
}
- logError(__func__,"could not find handle data for handle",handle);
+ logError(__METHOD_NAME__,"could not find handle data for handle",handle);
return (am_Error_e::E_NON_EXISTENT);
}
@@ -1014,11 +1016,11 @@ void CAmRoutingSender::checkVolume(const am_Handle_s handle, const am_volume_t v
handleVolumeBase* basePtr = static_cast<handleVolumeBase*>(it->second.get());
if (basePtr->returnVolume()!=volume)
{
- logError(__func__,"volume returned for handle does not match: ",volume,"expected:",basePtr->returnVolume());
+ logError(__METHOD_NAME__,"volume returned for handle does not match: ",volume,"expected:",basePtr->returnVolume());
}
return;
}
- logError(__func__,"could not find handle data for handle",handle);
+ logError(__METHOD_NAME__,"could not find handle data for handle",handle);
}
bool CAmRoutingSender::handleExists(const am_Handle_s handle)
diff --git a/AudioManagerCore/src/CAmTelnetMenuHelper.cpp b/AudioManagerCore/src/CAmTelnetMenuHelper.cpp
deleted file mode 100644
index 2aae4f5..0000000
--- a/AudioManagerCore/src/CAmTelnetMenuHelper.cpp
+++ /dev/null
@@ -1,1438 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011,2012
- * \author Frank Herchet, frank.fh.herchet@bmw.de BMW 2012
- *
- * \file CAmTelnetMenuHelper.cpp
- * For further information see http://www.genivi.org/.
- *
- */
-
-#include "CAmTelnetMenuHelper.h"
-#include <cassert>
-#include "audiomanagerconfig.h"
-#include "CAmRouter.h"
-#include "CAmTelnetServer.h"
-#include "IAmDatabaseHandler.h"
-#include "CAmControlSender.h"
-#include "CAmCommandSender.h"
-#include "CAmRoutingSender.h"
-#include "CAmRoutingReceiver.h"
-#include "CAmCommandReceiver.h"
-#include "CAmControlReceiver.h"
-#include "CAmDltWrapper.h"
-
-static const std::string COLOR_WELCOME("\033[1;33m\033[44m");
-static const std::string COLOR_HEAD("\033[1m\033[42m");
-static const std::string COLOR_DEFAULT("\033[0m");
-
-
-namespace am {
-
-CAmTelnetMenuHelper* CAmTelnetMenuHelper::instance = NULL;
-
-/****************************************************************************/
-CAmTelnetMenuHelper::CAmTelnetMenuHelper(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, IAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, CAmTelnetServer *iTelnetServer)
-/****************************************************************************/
-:mpTelenetServer(iTelnetServer), mpSocketHandler(iSocketHandler), mpCommandSender(iCommandSender), mpCommandReceiver(iCommandReceiver), mpRoutingSender(iRoutingSender), mpRoutingReceiver(iRoutingReceiver), mpControlSender(iControlSender), mpControlReceiver(iControlReceiver), mpDatabasehandler(iDatabasehandler), mpRouter(iRouter)
-{
- instance = this;
- createCommandMaps();
-}
-
-/****************************************************************************/
-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("crfader", 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("mainconn", sCommandPrototypeInfo("list all main connections", &CAmTelnetMenuHelper::listMainConnectionsCommand)));
- mListCommands.insert(std::make_pair("mainsinks", sCommandPrototypeInfo("list all main sinks", &CAmTelnetMenuHelper::listMainSinksCommand)));
- mListCommands.insert(std::make_pair("mainsources", sCommandPrototypeInfo("list all main sources", &CAmTelnetMenuHelper::listMainSourcesCommand)));
- 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)));
- mSetCommands.insert(std::make_pair("sinkvolume", sCommandPrototypeInfo("use 'sinkvolume sinkID volume' to set \n\t absorption in db of sink", &CAmTelnetMenuHelper::setSinkVolume)));
- mSetCommands.insert(std::make_pair("sinkvolstep", sCommandPrototypeInfo("use 'sinkvolstep sinkID volumestep' to increment \n\t or decrement volume", &CAmTelnetMenuHelper::setVolumeStep)));
- mSetCommands.insert(std::make_pair("sinkprop", sCommandPrototypeInfo("use 'sinkprop type value' to set \n\t a specific sinksoundproperty", &CAmTelnetMenuHelper::setSinkSoundProperty)));
- mSetCommands.insert(std::make_pair("sinkmute", sCommandPrototypeInfo("use 'sinkmute sinkid mutestate' to mute \n\t or unmute", &CAmTelnetMenuHelper::setSinkMuteState)));
- mSetCommands.insert(std::make_pair("sourceprop", sCommandPrototypeInfo("use 'sourceprop type value' to set \n\t a specific sinksoundproperty", &CAmTelnetMenuHelper::setSourceSoundProperty)));
- // 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("dump", sCommandPrototypeInfo("create a database dump of currently used data", &CAmTelnetMenuHelper::infoDumpCommand)));
- 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::newSocketConnection(int filedescriptor)
-/****************************************************************************/
-{
- 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.begin();
- // insert new socket connection
- mCurrentMainStateMap.insert(it, std::make_pair(filedescriptor, state));
- // Send welcome message
- welcome << COLOR_WELCOME << "Welcome to GENIVI AudioManager " << DAEMONVERSION << COLOR_DEFAULT << "\n>";
- assert(send(filedescriptor, welcome.str().c_str(), welcome.str().size(), 0)>=0);
- logInfo("[TN] New connection: ", filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::socketConnectionsClosed(int filedescriptor)
-/****************************************************************************/
-{
- std::map<int, EMainState>::iterator it;
- it = mCurrentMainStateMap.find(filedescriptor);
- if (it != mCurrentMainStateMap.end())
- {
- mCurrentMainStateMap.erase(it);
- }
- else
- {
- logError("[TN] socketConnectionsClosed, fd not found, ", filedescriptor);
- }
-}
-
-/****************************************************************************/
-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:
- cmditer = mRootCommands.find(cmd);
- if (mRootCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
- else
- sendError(filedescriptor, "Command not found\n");
-
- break;
- case eListState:
- cmditer = mListCommands.find(cmd);
- if (mListCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
- else
- sendError(filedescriptor, "Command not found\n");
-
- break;
- case eInfoState:
- cmditer = mInfoCommands.find(cmd);
- if (mInfoCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
- else
- sendError(filedescriptor, "Command not found\n");
-
- break;
- case eGetState:
- cmditer = mGetCommands.find(cmd);
- if (mGetCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
- else
- sendError(filedescriptor, "Command not found\n");
-
- break;
- case eSetState:
- cmditer = mSetCommands.find(cmd);
- if (mSetCommands.end() != cmditer)
- cmditer->second.CommandPrototype(CmdQueue, filedescriptor);
- else
- sendError(filedescriptor, "Command not found\n");
-
- break;
- default:
- break;
- }
- }
-
- sendCurrentCmdPrompt(filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::sendError(int& filedescriptor, std::string error_string)
-/****************************************************************************/
-{
- assert(send(filedescriptor, error_string.c_str(), error_string.size(), 0)>=0);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::sendTelnetLine(int& filedescriptor, std::stringstream& line)
-/****************************************************************************/
-{
- assert(send(filedescriptor, line.str().c_str(), line.str().size(), 0)>=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 << "\\>";
- break;
- case eListState:
- outputstream << "\\List>";
- break;
- case eGetState:
- outputstream << "\\Get>";
- break;
- case eSetState:
- outputstream << "\\Set>";
- break;
- case eInfoState:
- outputstream << "\\Info>";
- break;
- default:
- break;
- }
- assert(send(filedescriptor, outputstream.str().c_str(), outputstream.str().size(), 0)>=0);
- }
- else
- {
- logInfo("[TN] sendCurrentCmdPrompt, fd not found: ", filedescriptor);
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::exitCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->exitCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::oneStepBackCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::map<int, EMainState>::iterator it;
- it = mCurrentMainStateMap.find(filedescriptor);
- if (it != mCurrentMainStateMap.end())
- {
- switch (it->second)
- {
- case eRootState:
- it->second = eRootState;
- break;
- case eListState:
- it->second = eRootState;
- ;
- break;
- case eGetState:
- it->second = eRootState;
- ;
- break;
- case eSetState:
- it->second = eRootState;
- ;
- break;
- case eInfoState:
- it->second = eRootState;
- ;
- break;
- default:
- it->second = eRootState;
- break;
- }
- logInfo("[TN] oneStepBackCommandExec, state: ", it->second);
- }
-
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::oneStepBackCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->oneStepBackCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::exitCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::map<int, EMainState>::iterator it;
- std::stringstream line;
- std::stringstream output;
- // Sending a last message to the client
- output << "bye!" << COLOR_DEFAULT << std::endl;
- sendTelnetLine(filedescriptor, output);
- tCommandMap::iterator iter;
- it = mCurrentMainStateMap.find(filedescriptor);
- if (it != mCurrentMainStateMap.end())
- {
- if (NULL != mpTelenetServer)
- {
- logInfo("[TN] exitCommandExec, removing fd ", filedescriptor);
- mpTelenetServer->disconnectClient(filedescriptor);
- mCurrentMainStateMap.erase(it);
- }
- else
- {
- logError("[TN] exitCommandExec, mpTelenetServer == NULL, fd ", filedescriptor);
- }
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::helpCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->helpCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::helpCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::map<int, EMainState>::iterator it;
- std::stringstream line;
- tCommandMap::iterator cmdIter;
- it = mCurrentMainStateMap.find(filedescriptor);
- if (it != mCurrentMainStateMap.end())
- {
- line << COLOR_HEAD << "###################################################" << COLOR_DEFAULT << std::endl;
- line << COLOR_HEAD << "###### The following commands are supported: ######" << COLOR_DEFAULT << std::endl;
- line << COLOR_HEAD << "###################################################" << COLOR_DEFAULT << std::endl << std::endl;
- switch (it->second)
- {
- case eRootState:
- cmdIter = mRootCommands.begin();
- while (cmdIter != mRootCommands.end())
- {
- line << cmdIter->first << "\t\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
- }
- break;
- case eListState:
- cmdIter = mListCommands.begin();
- while (cmdIter != mListCommands.end())
- {
- line << cmdIter->first << "\t\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
- }
- break;
- case eGetState:
- cmdIter = mGetCommands.begin();
- while (cmdIter != mGetCommands.end())
- {
- line << cmdIter->first << "\t\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
- }
- break;
- case eSetState:
- cmdIter = mSetCommands.begin();
- while (cmdIter != mSetCommands.end())
- {
- line << cmdIter->first << "\t\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
- }
- break;
- case eInfoState:
- cmdIter = mInfoCommands.begin();
- while (cmdIter != mInfoCommands.end())
- {
- line << cmdIter->first << "\t\t- " << cmdIter->second.info << std::endl;
- cmdIter++;
- }
- break;
- default:
- break;
- }
-
- sendTelnetLine(filedescriptor, line);
- }
-
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::rootGetCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->rootGetCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::rootGetCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (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);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::rootSetCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (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);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::rootListCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (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);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::rootInfoCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (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);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listConnectionsCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_Connection_s > listConnections;
- if (E_OK == mpDatabasehandler->getListConnections(listConnections))
- {
- std::stringstream output;
- output << "\tConnections: " << listConnections.size() << std::endl;
- for (std::vector<am_Connection_s>::iterator iter(listConnections.begin()); iter < listConnections.end(); iter++)
- {
- output << "\tID: " << iter->connectionID << "\tSrcID: " << iter->sourceID << "\tSinkID: " << iter->sinkID << "\tFormat: " << iter->connectionFormat << "\tdelay: " << iter->delay << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListConnections");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listSourcesCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listSourcesCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listSourcesCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_Source_s > listSources;
- if (E_OK == mpDatabasehandler->getListSources(listSources))
- {
- std::stringstream output;
- output << "\tSources: " << listSources.size() << std::endl;
- for (std::vector<am_Source_s>::iterator iter(listSources.begin()); iter < listSources.end(); iter++)
- {
- output << "\tID: " << iter->sourceID << "\tName: " << iter->name << "\tDomainID: " << iter->domainID << "\tState: " << iter->sourceState << "\tVolume: " << iter->volume << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListSources");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listSinksCommands(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listSinksCommandsExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listSinksCommandsExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_Sink_s > listSinks;
- if (E_OK == mpDatabasehandler->getListSinks(listSinks))
- {
- std::stringstream output;
- output << "\tSinks: " << listSinks.size() << std::endl;
- for (std::vector<am_Sink_s>::iterator iter(listSinks.begin()); iter < listSinks.end(); iter++)
- {
- output << "\tID: " << iter->sinkID << "\tDomainID: " << iter->domainID << "\tName: " << iter->name << "\tAvailable: " << iter->available.availability << "\tVolume: " << iter->volume << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListSinks");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listCrossfaders(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listCrossfadersExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listCrossfadersExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_Crossfader_s > listCrossfaders;
- if (E_OK == mpDatabasehandler->getListCrossfaders(listCrossfaders))
- {
- std::stringstream output;
- output << "\tCrossfader: " << listCrossfaders.size() << std::endl;
- for (std::vector<am_Crossfader_s>::iterator iter(listCrossfaders.begin()); iter < listCrossfaders.end(); iter++)
- {
- output << "\tID: " << iter->crossfaderID << "\tName: " << iter->name << "\tSinkA: " << iter->sinkID_A << "\tSinkB: " << iter->sinkID_B << "\tSourceID: " << iter->sourceID << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListCrossfaders");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listDomainsCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listDomainsCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listDomainsCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_Domain_s > listDomains;
- if (E_OK == mpDatabasehandler->getListDomains(listDomains))
- {
- std::stringstream output;
- output << "\tDomains: " << listDomains.size() << std::endl;
- for (std::vector<am_Domain_s>::iterator iter(listDomains.begin()); iter < listDomains.end(); iter++)
- {
- output << "\tID: " << iter->domainID << "\tName: " << iter->name << "\tBusname: " << iter->busname << "\tNodename: " << iter->nodename << "\tState: " << static_cast<int>(iter->state) << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListDomains");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listGatewaysCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listGatewaysCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listGatewaysCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_Gateway_s > listGateways;
- if (E_OK == mpDatabasehandler->getListGateways(listGateways))
- {
- std::stringstream output;
- output << "\tGateways: " << listGateways.size();
- for (std::vector<am_Gateway_s>::iterator iter(listGateways.begin()); iter < listGateways.end(); iter++)
- {
- output << "\tID: " << iter->gatewayID << "\tName: " << iter->name << "\tSourceID: " << iter->sourceID << "\tSinkID: " << iter->sinkID << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListGateways");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::getRoutingCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->getRoutingCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::getRoutingCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- (void) (filedescriptor);
-//TODO: fill with function
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::getSenderversionCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->getSenderversionCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::getSenderversionCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::stringstream output;
- std::string versionCommand;
- std::string versionRouting;
- std::string versionControl;
- mpControlSender->getInterfaceVersion(versionControl);
- mpRoutingSender->getInterfaceVersion(versionRouting);
- mpCommandSender->getInterfaceVersion(versionCommand);
- output << "\tSender versions:" << std::endl << "\tCtrl: " << versionControl << " | " << "Cmd: " << versionCommand << " | " << "Routing: " << versionRouting << std::endl;
- sendTelnetLine(filedescriptor, output);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::getReceiverversionCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->getReceiverversionCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::getReceiverversionCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::stringstream output;
- std::string versionCommand;
- std::string versionRouting;
- std::string versionControl;
- mpControlReceiver->getInterfaceVersion(versionControl);
- mpRoutingReceiver->getInterfaceVersion(versionRouting);
- mpCommandReceiver->getInterfaceVersion(versionCommand);
- output << "\tReceiver versions:" << std::endl << "\tCtrl: " << versionControl << " | " << "Cmd: " << versionCommand << " | " << "Routing: " << versionRouting << std::endl;
- sendTelnetLine(filedescriptor, output);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::infoSystempropertiesCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->infoSystempropertiesCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::infoDumpCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->infoDumpCommandExec(CmdQueue, filedescriptor);
-}
-
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setVolumeStep(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->setSinkVolumeExec(CmdQueue,filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setVolumeStepExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- if (CmdQueue.size() >= 2)
- {
- int16_t volumestep = 0;
- am_sinkID_t sinkID = 0;
- bool error = false;
- std::istringstream istream_sinkID(CmdQueue.front());
- CmdQueue.pop();
- std::istringstream istream_volumestep(CmdQueue.front());
- CmdQueue.pop();
- if (!(istream_volumestep >> volumestep))
- error = true;
-
- if (!(istream_sinkID >> sinkID))
- error = true;
-
- if (error)
- {
- sendError(filedescriptor, "Error parsing setVolumeStep 'sinkID' or 'volumestep'");
- return;
- }
- if (E_OK == mpCommandReceiver->volumeStep(sinkID,volumestep))
- {
- std::stringstream output;
- output << "SetSinkVolumeStep set: " << sinkID << "->" << volumestep << std::endl;
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "Error SetSinkVolumeStep");
- }
- }
- else
- {
- sendError(filedescriptor, "Not enough arguments to set SetSinkVolumeStep, please enter 'sinkID' and 'volumestep' after command");
- return;
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setSinkMuteState(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->setSinkMuteStateExec(CmdQueue,filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setSinkMuteStateExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- if (CmdQueue.size() >= 2)
- {
- u_int16_t tmp = 0;
- am_MuteState_e MuteState = MS_UNKNOWN;
- am_sinkID_t sinkID = 0;
- bool error = false;
- std::istringstream istream_sinkID(CmdQueue.front());
- CmdQueue.pop();
- std::istringstream istream_mutestate(CmdQueue.front());
- CmdQueue.pop();
- if (!(istream_mutestate >> tmp))
- error = true;
-
- if (!(istream_sinkID >> sinkID))
- error = true;
-
- if(tmp < MS_MAX)
- {
- MuteState = static_cast<am_MuteState_e>(tmp);
- }
- else
- {
- sendError(filedescriptor, "You tried to set an invalid am_MuteState_e");
- error = true;
- }
-
- if (error)
- {
- sendError(filedescriptor, "Error parsing setSinkMuteState 'sinkID' or 'mutestate'");
- return;
- }
- if (E_OK == mpCommandReceiver->setSinkMuteState(sinkID,MuteState))
- {
- std::stringstream output;
- output << "setSinkMuteState set: " << sinkID << "->" << MuteState << std::endl;
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "Error setSinkMuteState");
- }
- }
- else
- {
- sendError(filedescriptor, "Not enough arguments to set setSinkMuteState, please enter 'sinkID' and 'mutestate' after command");
- return;
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setSourceSoundProperty(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->setSourceSoundPropertiesExec(CmdQueue,filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setSourceSoundPropertyExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- 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;
-
- am_MainSoundProperty_s soundProperty;
- soundProperty.type = static_cast<am_CustomMainSoundPropertyType_t>(tmpType);
-
- if (!(istream_value >> soundProperty.value))
- error = true;
-
- am_sourceID_t sourceID = 0;
- if (!(istream_sourceID >> sourceID))
- error = true;
-
- if (error)
- {
- sendError(filedescriptor, "Error parsing setMainSourceSoundProperty 'type', 'value' or 'sourceID'");
- return;
- }
- if (E_OK == mpCommandReceiver->setMainSourceSoundProperty(soundProperty, sourceID))
- {
- std::stringstream output;
- output << "setMainSourceSoundProperty set: " << soundProperty.type << "->" << soundProperty.value << std::endl;
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "Error setMainSourceSoundProperty");
- }
- }
- else
- {
- sendError(filedescriptor, "Not enough arguments to set setMainSourceSoundProperty, please enter 'sourceID', 'type' and 'value' after command");
- return;
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::infoSystempropertiesCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_SystemProperty_s > listSystemProperties;
- if (E_OK == mpDatabasehandler->getListSystemProperties(listSystemProperties))
- {
- std::stringstream output;
- output << "\tSystemproperties: " << listSystemProperties.size() << std::endl;
- std::vector<am_SystemProperty_s>::iterator it;
- for (it = listSystemProperties.begin(); it < listSystemProperties.end(); it++)
- {
- output << "\tType: " << it->type << " Value: " << it->value << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListSystemProperties");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::infoDumpCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
-
- std::stringstream *pOutput = new std::stringstream();
-
- mpDatabasehandler->dump(*pOutput);
-
- sendTelnetLine(filedescriptor, *pOutput);
-
- delete pOutput;
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setRoutingCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->setRoutingCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setRoutingCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- if (CmdQueue.size() >= 2)
- {
- bool error = false;
- std::istringstream istream_sourceID(CmdQueue.front());
- CmdQueue.pop();
- std::istringstream istream_sinkID(CmdQueue.front());
- CmdQueue.pop();
- am_sourceID_t sourceID = 0;
- if (!(istream_sourceID >> sourceID))
- error = true;
-
- am_sinkID_t sinkID = 0;
- if (!(istream_sinkID >> sinkID))
- error = true;
-
- if (error)
- {
- sendError(filedescriptor, "Error parsing sourcID and sinkID");
- return;
- }
- std::vector < am_Route_s > routingList;
- if (E_OK == mpRouter->getRoute(true, sourceID, sinkID, routingList))
- {
- std::stringstream output;
- 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++)
- {
- output << ">(" << reIter->sourceID << ")->--[D:" << reIter->domainID << "][F:" << reIter->connectionFormat << "]-->-(" << reIter->sinkID << ")" << std::endl;
- }
- rlCnt++;
- }
-
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "Error getting route");
- }
- }
- else
- {
- if (!CmdQueue.empty())
- CmdQueue.pop();
-
- sendError(filedescriptor, "Not enough arguments to set routing. Please enter sourceID and sinkID after command");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setConnection(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->setConnectionExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setConnectionExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- 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();
- am_sourceID_t sourceID = 0;
- if (!(istream_sourceID >> sourceID))
- error = true;
-
- am_sinkID_t sinkID = 0;
- if (!(istream_sinkID >> sinkID))
- error = true;
-
- if (error)
- {
- sendError(filedescriptor, "Error parsing sinkID and/or sourceID");
- return;
- }
-// Try to set up connection
- am_mainConnectionID_t connID = 0;
- rError = mpCommandReceiver->connect(sourceID, sinkID, connID);
- if (E_OK == rError)
- {
- std::stringstream output;
- output << "ConnID: " << connID << "\tSrc: " << sourceID << " ---> Sink: " << sinkID << std::endl;
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "Error connecting sourceID and sinkID");
- }
- }
- else
- {
-// remove 1 element if list is not empty
- if (!CmdQueue.empty())
- 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);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setDisconnectConnIdExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- 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 = mpCommandReceiver->disconnect(connID);
- if (E_OK == rError)
- {
- std::stringstream output;
- 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);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setSourceSoundPropertiesExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- if (CmdQueue.size() >= 3)
- {
- bool error = false;
- std::istringstream istream_sourceID(CmdQueue.front());
- CmdQueue.pop();
- std::istringstream istream_type(CmdQueue.front());
- CmdQueue.pop();
- std::istringstream istream_value(CmdQueue.front());
- CmdQueue.pop();
- unsigned int tmpType = 0;
- if (!(istream_type >> tmpType))
- error = true;
-
- am_MainSoundProperty_s soundProperty;
- soundProperty.type = static_cast<am_CustomMainSoundPropertyType_t>(tmpType);
-
- if (!(istream_value >> soundProperty.value))
- error = true;
-
- am_sinkID_t sourceID = 0;
- if (!(istream_sourceID >> sourceID))
- error = true;
-
- if (error)
- {
- sendError(filedescriptor, "Error parsing MainSinkSoundProperty 'type', 'value' or 'sourceID'");
- return;
- }
- if (E_OK == mpCommandReceiver->setMainSourceSoundProperty(soundProperty, sourceID))
- {
- std::stringstream output;
- 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::setSinkSoundProperty(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->setSinkSoundPropertyExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setSinkSoundPropertyExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- 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;
-
- am_MainSoundProperty_s soundProperty;
- soundProperty.type = static_cast<am_CustomMainSoundPropertyType_t>(tmpType);
-
- if (!(istream_value >> soundProperty.value))
- error = true;
-
- am_sinkID_t sinkID = 0;
- if (!(istream_sinkID >> sinkID))
- error = true;
-
- if (error)
- {
- sendError(filedescriptor, "Error parsing MainSinkSoundProperty 'type', 'value' or 'sinkID'");
- return;
- }
- if (E_OK == mpCommandReceiver->setMainSinkSoundProperty(soundProperty, sinkID))
- {
- std::stringstream output;
- 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::setSinkVolume(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->setSinkVolumeExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::setSinkVolumeExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- if (CmdQueue.size() >= 2)
- {
- am_volume_t volume = 0;
- am_sinkID_t sinkID = 0;
- bool error = false;
- std::istringstream istream_sinkID(CmdQueue.front());
- CmdQueue.pop();
- std::istringstream istream_volume(CmdQueue.front());
- CmdQueue.pop();
- if (!(istream_volume >> volume))
- error = true;
-
- if (!(istream_sinkID >> sinkID))
- error = true;
-
- if (error)
- {
- sendError(filedescriptor, "Error parsing SetSinkVolume 'sinkID' or 'volume'");
- return;
- }
- if (E_OK == mpCommandReceiver->setVolume(sinkID,volume))
- {
- std::stringstream output;
- output << "setVolume set: " << sinkID << "->" << volume << std::endl;
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "Error setVolume");
- }
- }
- else
- {
- sendError(filedescriptor, "Not enough arguments to set setVolume, please enter 'sinkID' and 'volume' after command");
- return;
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listPluginsCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listPluginsCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listPluginsCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < std::string > PlugInNames;
- std::vector<std::string>::iterator iter;
- std::stringstream output;
- if (E_OK == mpCommandSender->getListPlugins(PlugInNames))
- {
- output << "\tCommandSender Plugins loaded: " << PlugInNames.size() << std::endl;
- for (iter = PlugInNames.begin(); iter < PlugInNames.end(); iter++)
- {
- output << iter->c_str() << std::endl;
- }
- }
- else
- {
- sendError(filedescriptor, "ERROR: mCommandSender->getListPlugins");
- }
- if (E_OK == mpRoutingSender->getListPlugins(PlugInNames))
- {
- output << std::endl << "\tRoutingSender Plugins loaded: " << PlugInNames.size() << std::endl;
- for (iter = PlugInNames.begin(); iter < PlugInNames.end(); iter++)
- {
- output << iter->c_str() << std::endl;
- }
- }
- else
- {
- sendError(filedescriptor, "ERROR: mRoutingSender->getListPlugins");
- }
- sendTelnetLine(filedescriptor, output);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listMainSourcesCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listMainSourcesCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listMainSourcesCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_SourceType_s > listMainSources;
- if (E_OK == mpDatabasehandler->getListMainSources(listMainSources))
- {
- std::stringstream output;
- output << std::endl << "\tMainSources: " << listMainSources.size() << std::endl;
- std::vector<am_SourceType_s>::iterator iter;
- for (iter = listMainSources.begin(); iter < listMainSources.end(); iter++)
- {
- output << "\tID: " << iter->sourceID << "\tName: " << iter->name << "\tsourceClassID: " << iter->sourceClassID << "\tavailability: " << iter->availability.availability << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListMainSources");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listMainSinksCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listMainSinksCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listMainSinksCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector < am_SinkType_s > listMainSinks;
- if (E_OK == mpDatabasehandler->getListMainSinks(listMainSinks))
- {
- std::stringstream output;
- output << std::endl << "\tMainSinks: " << listMainSinks.size() << std::endl;
- std::vector<am_SinkType_s>::iterator iter;
- for (iter = listMainSinks.begin(); iter < listMainSinks.end(); iter++)
- {
- output << "\tID: " << iter->sinkID << "\tsinkClassID: " << iter->sinkClassID << "\tName: " << iter->name << "\tAvailable: " << iter->availability.availability << "\tVolume: " << iter->volume << std::endl;
- }
- sendTelnetLine(filedescriptor, output);
- }
- else
- {
- sendError(filedescriptor, "ERROR: mDatabasehandler->getListMainSinks");
- }
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listMainConnectionsCommand(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- instance->listMainConnectionsCommandExec(CmdQueue, filedescriptor);
-}
-
-/****************************************************************************/
-void CAmTelnetMenuHelper::listMainConnectionsCommandExec(std::queue<std::string>& CmdQueue, int& filedescriptor)
-/****************************************************************************/
-{
- (void) (CmdQueue);
- std::vector<am_MainConnection_s> listMainConnections;
-
- if(E_OK == mpDatabasehandler->getListMainConnections(listMainConnections))
- {
- std::stringstream output;
- output << std::endl << "\tMainConnections: " << listMainConnections.size() << std::endl;
-
- std::vector<am_MainConnection_s>::iterator iter;
- for (iter = listMainConnections.begin(); iter < listMainConnections.end(); iter++)
- {
- output << "\tID: " << iter->mainConnectionID
- << "\tState: " << iter->connectionState
- << "\tDelay: " << iter->delay
- << "\tsourceID: " << iter->sourceID
- << "\tsinkID: " << iter->sinkID << std::endl;
-
- output << "ConnectionIDs: ";
- std::vector<am_connectionID_t>::iterator list_connIDs_iter = iter->listConnectionID.begin();
- for(;list_connIDs_iter < iter->listConnectionID.end();list_connIDs_iter++)
- {
- output << *list_connIDs_iter << " ";
- }
-
- output << std::endl;
- }
- sendTelnetLine(filedescriptor,output);
- }
- else
- {
- sendError(filedescriptor,"ERROR: mDatabasehandler->getListMainSinks");
- }
-}
-}
-
-
-
-
-
diff --git a/AudioManagerCore/src/CAmTelnetServer.cpp b/AudioManagerCore/src/CAmTelnetServer.cpp
deleted file mode 100755
index 22f7b0e..0000000
--- a/AudioManagerCore/src/CAmTelnetServer.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/**
- * SPDX license identifier: MPL-2.0
- *
- * Copyright (C) 2012, BMW AG
- *
- * This file is part of GENIVI Project AudioManager.
- *
- * Contributions are licensed to the GENIVI Alliance under one or more
- * Contribution License Agreements.
- *
- * \copyright
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * \author Christian Linke, christian.linke@bmw.de BMW 2011,2012
- * \author Frank Herchet, frank.fh.herchet@bmw.de BMW 2012
- *
- * \file CAmTelnetServer.cpp
- * For further information see http://www.genivi.org/.
- *
- */
-
-#include "CAmTelnetServer.h"
-#include <cassert>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <netdb.h>
-#include <audiomanagerconfig.h>
-#include <errno.h>
-#include <sstream>
-#include <istream>
-#include <iostream>
-#include <iterator>
-#include <unistd.h>
-#include <stdexcept>
-#include <cstdlib>
-#include "CAmRoutingSender.h"
-#include "CAmTelnetMenuHelper.h"
-#include "CAmDltWrapper.h"
-
-namespace am
-{
-
-CAmTelnetServer* CAmTelnetServer::mpInstance = NULL;
-
-#define PRINT_BOOL(var) var ? output+="true\t\t" : output+="false\t\t";
-
-CAmTelnetServer::CAmTelnetServer(CAmSocketHandler *iSocketHandler, CAmCommandSender *iCommandSender, CAmCommandReceiver *iCommandReceiver, CAmRoutingSender *iRoutingSender, CAmRoutingReceiver *iRoutingReceiver, CAmControlSender *iControlSender, CAmControlReceiver *iControlReceiver, IAmDatabaseHandler *iDatabasehandler, CAmRouter *iRouter, unsigned int servPort, unsigned int maxConnections) :
- telnetConnectFiredCB(this, &CAmTelnetServer::connectSocket), //
- telnetReceiveFiredCB(this, &CAmTelnetServer::receiveData), //
- telnetDispatchCB(this, &CAmTelnetServer::dispatchData), //
- telnetCheckCB(this, &CAmTelnetServer::check), //
- mpSocketHandler(iSocketHandler), //
- mpCommandSender(iCommandSender), //
- mpCommandReceiver(iCommandReceiver), //
- mpRoutingSender(iRoutingSender), //
- mpRoutingReceiver(iRoutingReceiver), //
- mpControlSender(iControlSender), //
- mpControlReceiver(iControlReceiver), //
- mpDatabasehandler(iDatabasehandler), //
- mpRouter(iRouter), //
- mConnecthandle(), //
- mListMessages(), //
- mListConnections(), //
- mConnectFD(0), //
- mServerPort(servPort), //
- mMaxConnections(maxConnections), //
- mTelnetMenuHelper(iSocketHandler, iCommandSender, iCommandReceiver, iRoutingSender, iRoutingReceiver, iControlSender, iControlReceiver, iDatabasehandler, iRouter, this)
-{
- assert(mpSocketHandler!=NULL);
- assert(mpCommandReceiver!=NULL);
- assert(mpCommandSender!=NULL);
- assert(mpControlSender!=NULL);
- assert(mpControlReceiver!=NULL);
- assert(mpRoutingSender!=NULL);
- assert(mpRoutingReceiver!=NULL);
- assert(mpDatabasehandler!=NULL);
- assert(mpRouter!=NULL);
- assert(servPort!=0);
- assert(mMaxConnections!=0);
-
- mpInstance = this;
- //mTelnetMenuHelper.setTelnetServer(this);
-
- int yes = 1;
- struct sockaddr_in servAddr;
-
- //setup the port Listener
- mConnectFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
- assert (mConnectFD>0);
- assert(setsockopt(mConnectFD, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int))==0);
- memset(&servAddr, 0, sizeof(servAddr));
- servAddr.sin_family = AF_INET;
- servAddr.sin_addr.s_addr = INADDR_ANY;
- servAddr.sin_port = htons(servPort);
- if(bind(mConnectFD, (struct sockaddr *) &servAddr, sizeof(servAddr))!=0)
- {
- logError("CAmTelnetServer::CAmTelnetServer bind failed, error",errno);
- throw std::runtime_error("CAmTelnetServer::CAmTelnetServer bind failed");
- }
-
- if (listen(mConnectFD, mMaxConnections) < 0)
- {
- logError("TelnetServer::TelnetServerk cannot listen ", errno);
- throw std::runtime_error("CAmTelnetServer::CAmTelnetServer bind failed");
- }
- else
- logInfo("TelnetServer::TelnetServer started listening on port", mServerPort);
-
- int a = 1;
- ioctl(mConnectFD, FIONBIO, (char *) &a);
- setsockopt(mConnectFD, SOL_SOCKET, SO_KEEPALIVE, (char *) &a, sizeof(a));
-
- short events = 0;
- events |= POLLIN;
- mpSocketHandler->addFDPoll(mConnectFD, events, NULL, &telnetConnectFiredCB, NULL, NULL, NULL, mConnecthandle);
-}
-
-CAmTelnetServer::~CAmTelnetServer()
-{
-}
-
-void CAmTelnetServer::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);
- connection_s connection;
- connection.handle = 0;
- connection.filedescriptor = accept(pfd.fd, (struct sockaddr*) &answer, &len);
-
- assert(connection.filedescriptor>0);
-
- // Notiy menuhelper
- mTelnetMenuHelper.newSocketConnection(connection.filedescriptor);
-
- //set the correct event:
- short event = 0;
- event |= POLLIN;
-
- //add the filedescriptor to the sockethandler and register the callbacks for receiving the data
- mpSocketHandler->addFDPoll(connection.filedescriptor, event, NULL, &telnetReceiveFiredCB, &telnetCheckCB, &telnetDispatchCB, NULL, connection.handle);
- mListConnections.push_back(connection);
-}
-
-void CAmTelnetServer::disconnectClient(int filedescriptor)
-{
- std::vector<connection_s>::iterator iter = mListConnections.begin();
- while (iter != mListConnections.end())
- {
- if (filedescriptor == iter->filedescriptor)
- {
- if (E_OK == mpSocketHandler->removeFDPoll(iter->handle))
- {
- mListConnections.erase(iter);
- close(filedescriptor);
- }
- else
- {
- // TODO: Handle error
- }
-
- break;
- }
- iter++;
- }
-}
-
-void CAmTelnetServer::receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
-{
- (void) handle;
- (void) userData;
- //initialize buffer
- char buffer[100];
- //read until buffer is full or no more data is there
- int read = recv(pollfd.fd, buffer, 100, 0);
- if (read > 1)
- {
- //read the message and store it in a queue - its a telnet connection so data will be sent on enter !
- std::string msg = std::string(buffer, read);
- mListMessages.push(msg);
- }
-}
-
-bool CAmTelnetServer::dispatchData(const sh_pollHandle_t handle, void *userData)
-{
- (void) userData;
- std::vector<connection_s>::iterator iterator = mListConnections.begin();
- for (; iterator != mListConnections.end(); ++iterator)
- {
- if (iterator->handle == handle)
- break;
- }
- if (iterator==mListConnections.end())
- {
- logError("CAmTelnetServer::dispatchData could not find handle !");
- return (false);
- }
-
- std::string command;
- std::queue<std::string> MsgQueue;
- if (!mListMessages.empty())
- {
- sliceCommand(mListMessages.front(), command, MsgQueue);
- mListMessages.pop();
- mTelnetMenuHelper.enterCmdQueue(MsgQueue, iterator->filedescriptor);
- }
- else
- {
- logError("CAmTelnetServer::dispatchData Message queue was empty!");
- }
-
- // must return false to stop endless polling
- return (false);
-}
-
-bool CAmTelnetServer::check(const sh_pollHandle_t handle, void *userData)
-{
- (void) handle;
- (void) userData;
- if (mListMessages.size() != 0)
- return (true);
- return (false);
-}
-
-void am::CAmTelnetServer::sliceCommand(const std::string & string, std::string & command, std::queue<std::string> & MsgQueue)
-{
- (void) command;
- std::stringstream stream(string);
- std::istream_iterator<std::string> begin(stream);
- std::istream_iterator<std::string> end;
- std::string cmd;
- bool endOfStream = false;
-
- int c = 0;
-
- while (!endOfStream)
- {
- cmd = *begin;
- MsgQueue.push(cmd);
- begin++;
-
- if (begin == end)
- {
- endOfStream = true;
- }
- c++;
- }
-}
-}
-