freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于gprs的短信發(fā)送和接收的實(shí)現(xiàn)畢業(yè)論文-資料下載頁

2025-06-18 17:08本頁面
  

【正文】 h。 // 內(nèi)部用的串長度 int nDstLength。 // 目標(biāo)PDU串長度 unsigned char buf[256]。 // 內(nèi)部用的緩沖區(qū) nLength = strlen(pSrcSCA)。 // SMSC地址字符串的長度 buf[0] = (char)((nLength amp。 1) == 0 ? nLength : nLength + 1) / 2 + 1。 buf[1] = 0x91。 // 固定: 用國際格式號碼 nDstLength = gsmBytes2String(buf, pDst, 2)。 // 轉(zhuǎn)換2個(gè)字節(jié)到目標(biāo)PDU串 nDstLength += gsmInvertNumbers(pSrcSCA, amp。pDst[nDstLength], nLength)。 nLength = strlen(pSrcTPA)。 // TPDA地址字符串的長度 buf[0] = 0x11。 buf[1] = 0。 // TPMR=0 buf[2] = (char)nLength。 // 目標(biāo)地址數(shù)字個(gè)數(shù)(TPDA地址字符串真實(shí)長度) buf[3] = 0x91。 // 固定: 用國際格式號碼 nDstLength += gsmBytes2String(buf, amp。pDst[nDstLength], 4)。 nDstLength += gsmInvertNumbers(pSrcTPA, amp。pDst[nDstLength], nLength)。 nLength = strlen(pSrcTP_UD)。 // 用戶信息字符串的長度 buf[0] = pSrcTP_PID。 // 協(xié)議標(biāo)識(TPPID) buf[1] = pSrcTP_DCS。 // 用戶信息編碼方式(TPDCS) buf[2] = 0。 // 有效期(TPVP)為5分鐘 if(pSrcTP_DCS == GSM_7BIT) { // 7bit編碼方式 buf[3] = nLength。 // 編碼前長度 nLength = gsmEncode7bit(pSrcTP_UD, amp。buf[4], nLength+1) + 4。 } else if(pSrcTP_DCS == GSM_UCS2) { // UCS2編碼方式 buf[3] = gsmEncodeUcs2(pSrcTP_UD, amp。buf[4], nLength)。 nLength = buf[3] + 4。 // nLength等于該段數(shù)據(jù)長度 } else { // 8bit編碼方式 buf[3] = gsmEncode8bit(pSrcTP_UD, amp。buf[4], nLength)。 nLength = buf[3] + 4。 // nLength等于該段數(shù)據(jù)長度 } nDstLength += gsmBytes2String(buf, amp。pDst[nDstLength], nLength)。 return nDstLength。 // 返回目標(biāo)字符串長度}// PDU解碼,int gsmDecodePdu(const char* pSrc, SM_PARAM* pDst){ int nDstLength。 // 目標(biāo)PDU串長度 unsigned char tmp。 // 內(nèi)部用的臨時(shí)字節(jié)變量 unsigned char buf[256]。 // 內(nèi)部用的緩沖區(qū) gsmString2Bytes(pSrc, amp。tmp, 2)。 // 取長度 tmp = (tmp 1) * 2。 // SMSC號碼串長度 pSrc += 4。 // 指針后移,忽略了SMSC地址格式 gsmSerializeNumbers(pSrc, pDstSCA, tmp)。 // 轉(zhuǎn)換SMSC號碼到目標(biāo)PDU串 pSrc += tmp。 // 指針后移 gsmString2Bytes(pSrc, amp。tmp, 2)。 // 取基本參數(shù) pSrc += 2。 // 指針后移 gsmString2Bytes(pSrc, amp。tmp, 2)。 // 取長度 if(tmp amp。 1) tmp += 1。 // 調(diào)整奇偶性 pSrc += 4。 // 指針后移,忽略了回復(fù)地址(TPRA)格式 gsmSerializeNumbers(pSrc, pDstTPA, tmp)。 // 取TPRA號碼 pSrc += tmp。 // 指針后移 gsmString2Bytes(pSrc, (unsigned char*)amp。pDstTP_PID, 2)。 pSrc += 2。 // 指針后移 gsmString2Bytes(pSrc, (unsigned char*)amp。pDstTP_DCS, 2)。 pSrc += 2。 // 指針后移 gsmSerializeNumbers(pSrc, pDstTP_SCTS, 14)。 pSrc += 14。 // 指針后移 gsmString2Bytes(pSrc, amp。tmp, 2)。 // 用戶信息長度(TPUDL) pSrc += 2。 // 指針后移 if(pDstTP_DCS == GSM_7BIT) { // 7bit解碼 nDstLength = gsmString2Bytes(pSrc, buf, tmp amp。 7 ? (int)tmp * 7 / 4 + 2 : (int)tmp * 7 / 4)。 // 格式轉(zhuǎn)換 gsmDecode7bit(buf, pDstTP_UD, nDstLength)。 // 轉(zhuǎn)換到TPDU nDstLength = tmp。 } else if(pDstTP_DCS == GSM_UCS2) { // UCS2解碼 nDstLength = gsmString2Bytes(pSrc, buf, tmp * 2)。 // 格式轉(zhuǎn)換 nDstLength = gsmDecodeUcs2(buf, pDstTP_UD, nDstLength)。 } else { // 8bit解碼 nDstLength = gsmString2Bytes(pSrc, buf, tmp * 2)。 // 格式轉(zhuǎn)換 nDstLength = gsmDecode8bit(buf, pDstTP_UD, nDstLength)。 } return nDstLength。 // 返回目標(biāo)字符串長度}// 發(fā)送短消息int gsmSendMessage(SM_PARAM* pSrc){ int nPduLength。 // PDU串長度 unsigned char nSmscLength。 // SMSC串長度 int nLength。 // 串口收到的數(shù)據(jù)長度 char cmd[16]。 // 命令串 char pdu[512]。 // PDU串 char ans[128]。 // 應(yīng)答串 nPduLength = gsmEncodePdu(pSrc, pdu)。 // 根據(jù)PDU參數(shù),編碼PDU串 strcat(pdu, \x01a)。 // 以CtrlZ結(jié)束 gsmString2Bytes(pdu, amp。nSmscLength, 2)。 // 取PDU串中的SMSC信息長度 nSmscLength++。 // 加上長度字節(jié)本身 sprintf(cmd, AT+CMGS=%d\r, nPduLength / 2 nSmscLength)。//生成命令 WriteComm(cmd, strlen(cmd))。 // 先輸出命令串 nLength = ReadComm(ans, 128)。 // 讀應(yīng)答數(shù)據(jù) if(nLength == 4 amp。amp。 strncmp(ans, \r\n , 4) == 0) { return WriteComm(pdu, strlen(pdu))。// 得到肯定回答,繼續(xù)輸出PDU串 } else { return 1。 } }//讀取短消息int gsmReadMessage(char ans[1024],int nLength,SM_PARAM* pMsg){ int nLength。//串口收到的數(shù)據(jù)長度 int nMsg。//短消息計(jì)數(shù)值 char* ptr。//內(nèi)部用的數(shù)據(jù)指針 char cmd[16]。//命令串 char ans[1024]。//應(yīng)答串 nMsg=0。 ptr=ans。 sprintf(cmd,AT+CMGL=0\r)。//生成命令 WriteComm(cmd,strlen(cmd))。//輸出命令串 nLength=ReadComm(ans,1024)。//讀應(yīng)答數(shù)據(jù) ReadComm(ans,1024)。 if(nLength0 amp。amp。 strncmp(ans,++CMS ERROR,10)!=0) { while((ptr = strstr(ptr, +CMGL:)) != NULL) { ptr += 6。 // 跳過+CMGL:, 定位到序號 sscanf(ptr, %d, amp。pMsgindex)。 // 讀取序號 ptr = strstr(ptr, \r\n)。 // 找下一行 if (ptr != NULL) { ptr += 2。 // 跳過\r\n, 定位到PDU gsmDecodePdu(ptr, pMsg)。 // PDU串解碼 pMsg++。 // 準(zhǔn)備讀下一條短消息 nMsg++。 // 短消息計(jì)數(shù)加1 } } } return nMsg。 }// 刪除短消息,僅發(fā)送命令,不讀取應(yīng)答int gsmDeleteMessage(int index){ char cmd[16]。 // 命令串 sprintf(cmd, AT+CMGD=%d\r, index)。 // 生成命令 return WriteComm(cmd, strlen(cmd))。}致 謝本次畢業(yè)設(shè)計(jì)的完成,首先感謝母?!憬I(yè)大學(xué)之江學(xué)院的辛勤培育,感謝信息工程分院提供了很好學(xué)習(xí)環(huán)境,并非常感謝我的指導(dǎo)老師周云水老師耐心的指導(dǎo)和諄諄教誨。經(jīng)過3個(gè)月的努力,我的畢業(yè)設(shè)計(jì)和論文終于完成。雖然過程是漫長和艱辛的,但是,看著成果,心里很是欣慰,生活覺得特別充實(shí)。畢業(yè)設(shè)計(jì)的完成,我獲得很多平時(shí)沒有學(xué)到的知識,進(jìn)一步拓寬了我的視野,收益匪淺。畢業(yè)設(shè)計(jì)是大學(xué)4年所學(xué)知識的綜合運(yùn)用,也是理論走向?qū)嵺`的第一步,為以后走向工作崗位奠定了基礎(chǔ)。經(jīng)過此次畢業(yè)設(shè)計(jì),使我對無線通信方面的知識和VC++。此次設(shè)計(jì)是在指導(dǎo)老師周云水老師的指導(dǎo)下完成的,指導(dǎo)老師周云水老師淵博的知識,在學(xué)習(xí)和生活上都給予我很大的幫助和照顧,同時(shí)還得到同學(xué)們的支持和幫助,使我度過了一個(gè)又一個(gè)的難關(guān)。鑒于我的水平有限,難免存在一些錯誤和漏洞,望各位老師不吝賜教,在此向大家表示忠心的感
點(diǎn)擊復(fù)制文檔內(nèi)容
研究報(bào)告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1