Added radio interface utilities used to complete device info and fill error related parameters.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6242 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2017-06-27 11:21:39 +00:00
parent c8c680e8bc
commit c1b2ebd845
2 changed files with 40 additions and 0 deletions

View File

@ -346,6 +346,30 @@ const String& RadioInterface::toString() const
return m_name;
}
void RadioInterface::completeDevInfo(NamedList& p, bool full, bool retData)
{
if (retData)
p.setParam(new NamedPointer("interface",this,m_name));
else
p.addParam("interface",m_name);
}
void RadioInterface::setError(NamedList& p, unsigned int code, const char* str)
{
if (!code)
return;
p.setParam(YSTRING("code"),String(code));
p.setParam(YSTRING("reason"),errorName(code));
if (TelEngine::null(str))
p.clearParam(YSTRING("error"));
else
p.setParam(YSTRING("error"),str);
unsigned int tmp = code & NoAutoRestartMask;
p.setParam(YSTRING("canretry"),String::boolText(!tmp));
if (!tmp)
p.setParam(YSTRING("fatal"),String::boolText(code & FatalErrorMask));
}
const TokenDict* RadioInterface::errorNameDict()
{
return s_errorName;

View File

@ -787,6 +787,22 @@ public:
*/
virtual const String& toString() const;
/**
* Complete device info parameters
* @param p Destination list
* @param full Put full device info
* @param retData True to set out pointer in destination, false to add name only
*/
virtual void completeDevInfo(NamedList& p, bool full = false, bool retData = false);
/**
* Fill (set) error related parameters
* @param p Destination list
* @param code Error code
* @param str Optional error string (not error name)
*/
virtual void setError(NamedList& p, unsigned int code, const char* str = 0);
/**
* Retrieve the error string associated with a specific code
* @param code Error code