本文整理汇总了C++中TLFrame::readField方法的典型用法代码示例。如果您正苦于以下问题:C++ TLFrame::readField方法的具体用法?C++ TLFrame::readField怎么用?C++ TLFrame::readField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLFrame
的用法示例。
在下文中一共展示了TLFrame::readField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
/** Parse a TL address field, including length. */
void TLAddress::parse(const TLFrame& src, size_t& rp)
{
// GSM 03.40.
// This is different from the BCD formats in GSM 04.08,
// even though it looks very similar.
// The difference is in the encoding of the length field.
size_t numDigits = src.readField(rp,8);
size_t length = numDigits/2 + (numDigits % 2);
if (src.readField(rp, 1) != 1) SMS_READ_ERROR;
mType = (TypeOfNumber)src.readField(rp, 3);
mPlan = (NumberingPlan)src.readField(rp, 4);
mDigits.parse(src,rp,length);
}
示例2: parseBody
void TLSubmit::parseBody(const TLFrame& src, size_t& rp)
{
parseRD(src);
parseVPF(src);
parseRP(src);
parseUDHI(src);
parseSRR(src);
mMR = src.readField(rp,8);
mDA.parse(src,rp);
mPI = src.readField(rp,8);
mDCS = src.readField(rp,8);
mVP.VPF(mVPF);
mVP.parse(src,rp);
mUD.DCS(mDCS);
mUD.parse(src,rp);
}
示例3: parseBody
void TLDeliver::parseBody(const TLFrame &src, size_t &rp)
{
// Note that offset is reversed, i'=7-i.
// Ignore MTI, we already know it is DELIVER.
// Note that these header fields come from src ignoring rp.
parseMMS(src);
parseRP(src);
parseUDHI(src);
parseSRI(src);
// Now the 'body'
assert(rp == 8);
mOA.parse(src,rp); // originating address.
mPID = src.readField(rp,8); // protocol id
mUD.DCS(src.readField(rp,8)); // data coding scheme, stored in the TLUserData.
mSCTS.parse(src,rp); // time stamp
mUD.parse(src,rp); // user data.
}
示例4: parse
void TLUserData::parse(const TLFrame& src, size_t& rp)
{
assert(!mUDHI); // We don't support user headers.
// The DCS is defined in GSM 03.38 4.
assert(mDCS<0x100); // Someone forgot to initialize the DCS.
unsigned numChar = src.readField(rp,8);
switch (mDCS) {
case 0:
case 244:
case 245:
case 246:
case 247:
{
// GSM 7-bit encoding, GSM 03.38 6.
// Check bounds.
if (numChar*7 > (src.size()-rp)) {
LOG(NOTICE) << "badly formatted TL-UD";
SMS_READ_ERROR;
}
BitVector chars(src.tail(rp));
chars.LSB8MSB();
size_t crp=0;
for (unsigned i=0; i<numChar; i++) {
char gsm = chars.readFieldReversed(crp,7);
mData[i] = decodeGSMChar(gsm);
}
mData[numChar]='\0';
if (crp%8) crp += 8 - crp%8;
rp += crp;
return;
}
default:
{
rp += numChar;
sprintf(mData,"unsupported DCS 0x%x", mDCS);
LOG(NOTICE) << mData;
SMS_READ_ERROR;
}
}
}