当前位置:七七站长网网页编程Mobile开发 → 编程内容

CMPP DELIVER

减小字体 增大字体 作者:佚名  来源:不详  发布时间:2007-11-19 21:57:00

bool CSmsCmpp::DecodeDeliver(string& sMsgID, string& sDestID, string& sServiceID, int& nTP_pid, int& nTP_udhi,
    int& nMsgFmt, string& sSrc_terminalID, int& nRegDel, int& nMsgLen, vector<BYTE>& sMsgContent,vector<BYTE>& vMsgID)
{    
    if(int(m_Body.size())<64) {
        gRunInfo.error_package(m_Body);
        return false;
    }
    std::copy(m_Body.begin(),m_Body.begin()+8,back_inserter(vMsgID));
    sMsgID = gtMsgID(vMsgID);    
    sDestID = FetchOct(8,21);
    sServiceID = FetchOct(29,10);
    nTP_pid = FetchInt8(39);
    nTP_udhi = FetchInt8(40);
    nMsgFmt = FetchInt8(41);
    sSrc_terminalID = FetchOct(42,21);
    if(strlen(sSrc_terminalID.c_str()) == 13) {
        sSrc_terminalID = sSrc_terminalID.substr(2,11);        
    }
    nRegDel = FetchInt8(63);
    nMsgLen = FetchInt8(64);
    if(nMsgLen>160||nMsgLen<0) return false;
    if(int(m_Body.size()) >= (65+nMsgLen+8))
    {
        std::copy(m_Body.begin()+65,m_Body.begin()+65+nMsgLen,back_inserter(sMsgContent));        
    }
    else {
        gRunInfo.error_package(m_Body);
        return false;
    }
    return true;
}