|
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; } |