本文整理汇总了C++中NamedList::setParam方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedList::setParam方法的具体用法?C++ NamedList::setParam怎么用?C++ NamedList::setParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamedList
的用法示例。
在下文中一共展示了NamedList::setParam方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stats
void RTPReceiver::stats(NamedList& stat) const
{
if (m_session)
stat.setParam("remoteip",m_session->UDPSession::transport()->remoteAddr().host());
stat.setParam("lostpkts",String(m_ioLostPkt));
stat.setParam("synclost",String(m_syncLost));
stat.setParam("wrongssrc",String(m_wrongSSRC));
stat.setParam("seqslost",String(m_seqLost));
}
示例2: getStats
void RTPSession::getStats(NamedList& stats) const
{
if (m_send)
m_send->stats(stats);
if (m_recv)
m_recv->stats(stats);
stats.setParam("wrongsrc",String(m_wrongSrc));
}
示例3: fillParam
void CallInfo::fillParam(NamedList& target, const String& name, bool clear)
{
NamedString* param = getParam(name);
if (param)
target.setParam(name,param->c_str());
else if (clear)
target.clearParam(name);
}
示例4: fillParams
void CallInfo::fillParams(NamedList& target)
{
unsigned int n = length();
for (unsigned int i = 0; i < n; i++) {
NamedString* param = getParam(i);
if (param)
target.setParam(param->name(),param->c_str());
}
}
示例5: putMedia
// Put the list of net media in a parameter list
void SDPSession::putMedia(NamedList& msg, ObjList* mList, bool putPort)
{
if (!mList)
return;
bool audio = false;
bool other = false;
for (mList = mList->skipNull(); mList; mList = mList->skipNext()) {
SDPMedia* m = static_cast<SDPMedia*>(mList->get());
m->putMedia(msg,putPort);
if (m->isAudio())
audio = true;
else
other = true;
}
if (other && !audio)
msg.setParam("media",String::boolText(false));
}
示例6: evaluate
int ExpEvaluator::evaluate(NamedList& results, unsigned int index, const char* prefix) const
{
ObjList stack;
if (!evaluate(stack))
return -1;
String idx(prefix);
if (index)
idx << index << ".";
int column = 0;
for (ObjList* r = stack.skipNull(); r; r = r->skipNext()) {
column++;
const ExpOperation* res = static_cast<const ExpOperation*>(r->get());
String name = res->name();
if (name.null())
name = column;
results.setParam(idx+name,*res);
}
return column;
}
示例7: appendParam
// Append a parameter to a buffer
// Truncate it or set error if fail is true and parameter length exceeds maxLen
// Return: 0 if the parameter is missing
// -1 if the parameter is too long
// 1 on success
int appendParam(ObjList& msg, NamedList& params, unsigned char value,
unsigned char maxLen, bool fail)
{
NamedString* ns = params.getParam(lookup(value,ETSIModem::s_msgParams));
if (!ns)
return 0;
unsigned char len = ns->length();
if (len > maxLen) {
if (fail) {
params.setParam("error",ns->name() + "-too-long");
return -1;
}
len = maxLen;
}
DataBlock* data = new DataBlock;
unsigned char a[2] = {value,len};
FSKModem::addRaw(*data,a,sizeof(a));
FSKModem::addRaw(*data,(void*)ns->c_str(),len);
msg.append(data);
return 1;
}
示例8: createMsg
// Create a buffer containing the byte representation of a message to be sent
// and another one with the header
bool ETSIModem::createMsg(NamedList& params, DataBlock& data)
{
int type = lookup(params,s_msg);
switch (type) {
case MsgCallSetup:
break;
case MsgMWI:
case MsgCharge:
case MsgSMS:
Debug(this,DebugStub,"Create message '%s' not implemented [%p]",
params.c_str(),this);
return false;
default:
Debug(this,DebugNote,"Can't create unknown message '%s' [%p]",
params.c_str(),this);
return false;
}
ObjList msg;
bool fail = !params.getBoolValue("force-send",true);
// DateTime - ETSI EN 300 659-3 - 5.4.1
String datetime = params.getValue("datetime");
unsigned char dt[4];
bool ok = false;
if (datetime.isBoolean())
if (datetime.toBoolean())
ok = getDateTime(dt);
else ;
else
ok = getDateTime(dt,&datetime);
if (ok) {
DataBlock* dtParam = new DataBlock(0,10);
unsigned char* d = (unsigned char*)dtParam->data();
d[0] = DateTime;
d[1] = 8;
// Set date and time: %.2d%.2d%.2d%.2d month:day:hour:minute
for (int i = 0, j = 2; i < 4; i++, j += 2) {
d[j] = '0' + dt[i] / 10;
d[j+1] = '0' + dt[i] % 10;
}
msg.append(dtParam);
}
else
DDebug(this,DebugInfo,"Can't set datetime parameter from '%s' [%p]",
datetime.c_str(),this);
// CallerId/CallerIdReason - ETSI EN 300 659-3 - 5.4.2: Max caller id 20
// Parameter is missing: append reason (default caller absence: 0x4f: unavailable)
int res = appendParam(msg,params,CallerId,20,fail);
if (res == -1)
return false;
if (!res)
appendParam(msg,params,CallerIdReason,s_dict_callerAbsence,0x4f);
// CallerName/CallerNameReason - ETSI EN 300 659-3 - 5.4.5: Max caller name 50
// Parameter is missing: append reason (default callername absence: 0x4f: unavailable)
res = appendParam(msg,params,CallerName,50,fail);
if (res == -1)
return false;
if (!res)
appendParam(msg,params,CallerNameReason,s_dict_callerAbsence,0x4f);
// Build message
unsigned char len = 0;
unsigned char hdr[2] = {type};
data.assign(&hdr,sizeof(hdr));
for (ObjList* o = msg.skipNull(); o; o = o->skipNext()) {
DataBlock* msgParam = static_cast<DataBlock*>(o->get());
if (len + msgParam->length() > 255) {
if (!fail) {
Debug(this,DebugNote,"Trucating %s message length to %u bytes [%p]",
params.c_str(),data.length(),this);
break;
}
params.setParam("error","message-too-long");
return false;
}
len += msgParam->length();
data += *msgParam;
}
if (!len) {
params.setParam("error","empty-message");
return false;
}
unsigned char* buf = ((unsigned char*)(data.data()));
buf[1] = len;
m_chksum = 0;
for (unsigned int i = 0; i < data.length(); i++)
m_chksum += buf[i];
unsigned char crcVal = 256 - (m_chksum & 0xff);
FSKModem::addRaw(data,&crcVal,1);
return true;
}