【正文】
cations Standards Institute. ETSI GTS GSM . [13] European Telemunications Standards Institute. ETSI GTS GSM . [14] Atmel Corp. Atmega128 Data Book.[15] MCS Electronics. BASCOMAVR USER MANUAL. [16] Short Message Peer to Peer Protocol Specification .SMPP Developers .短消息在林務(wù)系統(tǒng)中的應(yīng)用24致謝,認(rèn)真細(xì)心的指導(dǎo)我們做課題,在學(xué)習(xí)上嚴(yán)格要求,,表示誠摯的敬意和衷心的感謝。在這四年中,還要特別感謝計科系的全體老師,是他們給我創(chuàng)造了許多實踐和鍛煉的機會。特別是胡坤融老師、王冬老師在計算機技術(shù)上給我的指導(dǎo),謝剛老師在思想教育方面的引導(dǎo)。在此向他們表示誠摯的敬意和衷心的感謝!最后向所有關(guān)心和幫助過我的人表示真心的感謝!西南林學(xué)院 2022 屆本科畢業(yè)論文25附件:手機短信收發(fā)系統(tǒng)程序核心代碼 39。****************查詢表smsac的數(shù)據(jù)******************* Function FunQuerysmsacdata() 39。*********檢核數(shù)據(jù)長度是否超過70個字************** Function FunStringLongCheck() = If strDataGroup(2).Length 70 Then Dim sect As Integer Dim inti As Integer sect = strDataGroup(2).Length \ 70 If (strDataGroup(2).Length sect * 70) = 0 Then For inti = 1 To sect strSendMsg = Mid(strDataGroup(2), 1 + 70 * (inti 1), 70) = + strSendMsg FunSendmessage() Sleep(2022) Next Else For inti = 1 To (sect + 1) strSendMsg = Mid(strDataGroup(2), 1 + 70 * (inti 1), 70) = + strSendMsg FunSendmessage() Sleep(2022) Next End If Else strSendMsg = strDataGroup(2) FunSendmessage() = strSendMsg End If End Function 39。**************發(fā)送短消息**************** Function FunSendmessage() Dim strALLSMSString As String Dim intMsgLong As Integer Dim inti As Integer Dim strChar As String strALLSMSString = strALLSMSString + 089168 strALLSMSString = strALLSMSString + Position_Transform(13800898500F) strALLSMSString = strALLSMSString + 11000D9168短消息在林務(wù)系統(tǒng)中的應(yīng)用26 strALLSMSString = strALLSMSString + Position_Transform(strDataGroup(1) + F) strALLSMSString = strALLSMSString + 0008A8 strALLSMSString = strALLSMSString + Hex( * 2).PadLeft(2, 0) intMsgLong = For inti = 1 To intMsgLong strChar = Mid(strSendMsg, inti, 1) If AscW(strChar) = 0 And AscW(strChar) = 127 Then strALLSMSString = strALLSMSString + 00 + Hex(AscW(strChar)) Else strALLSMSString = strALLSMSString + Hex(AscW(strChar)) End If Next = AT+CMGS= + Str(15 + intMsgLong * 2) amp。 Chr(13) amp。 Chr(10) Sleep(100) = strALLSMSString amp。 Chr(26) = 正在發(fā)送,請等待... Sleep(5000) 39。************************************************* Dim strInput As String Dim Sendtime As String strInput = If InStr(strInput, OK) 0 Then = 信息發(fā)送成功!??! = 0 Sendtime = Now Try nConnection = New SqlConnection(strSMS) () = nConnection = insert into smsad (smsad01,smsad02,smsad03) values(39。 amp。 strDataGroup(1) amp。 39。,39。 amp。 Sendtime amp。 39。,39。 amp。 strSendMsg amp。 39。) () = delete smsac where smsac01=39。 amp。 Trim(strDataGroup(0)) amp。 39。 () () Catch e As Exception End Try = strDataGroup(1) = Sendtime Else西南林學(xué)院 2022 屆本科畢業(yè)論文27 = 發(fā)送失敗,請重新發(fā)送! End If End Function 39。***********兩個字符的前后位置調(diào)換*************** Function Position_Transform(ByVal strString As String) Dim inti As Integer Dim strold2string As String Dim strnew2string As String Dim strnewstring As String For inti = 1 To Step 2 strold2string = Mid(strString, inti, 2) strnew2string = StrReverse(strold2string) strnewstring = strnewstring + strnew2string Next Return strnewstring End Function 39。*******讀SIM卡的短消息,保存數(shù)據(jù)庫并刪除。************** Function FunReadSIM() 39。***讀SIM卡的數(shù)據(jù)*** = AT+CMGR= amp。 SIMID amp。 Chr(13) amp。 Chr(10) Sleep(1500) strInput = 39。***判斷返回是否正確*** If InStr(strInput, OK) Then 39。***讀取SIM有用的數(shù)據(jù)*** lngPos = InStr(strInput, +CMGR:) If lngPos 0 Then intstart = InStr(lngPos, strInput, vbCr) + 2 intender = InStr(intstart, strInput, vbCr) If intender 0 Then strAllString = Mid(strInput, intstart, intender intstart) End If 39。***把數(shù)據(jù)分解*** If strAllString Then 39。***分解手機號碼*** intTelNumLong = CInt(amp。H amp。 Mid(strAllString, 21, 2)) 39。手機號碼的長度 InternationalOrNationalSign = Mid(strAllString, 23, 2) 39。國際(91)或國內(nèi)(A1)標(biāo)志 39。***讀取手機字符串*** If (intTelNumLong Mod 2) = 1 Then strTelNumString = Mid(strAllString, 25, intTelNumLong + 1) Else strTelNumString = Mid(strAllString, 25, intTelNumLong)短消息在林務(wù)系統(tǒng)中的應(yīng)用28 End If 39。***讀取真實手機號碼*** If InternationalOrNationalSign = 91 Then strTelnum = Mid(Position_Transform(strTelNumString), 3, intTelNumLong 2) ElseIf InternationalOrNationalSign = A1 Then strTelnum = Mid(Position_Transform(strTelNumString), 1, intTelNumLong) End If 39。***分解時間、編碼標(biāo)志、數(shù)據(jù)長度與數(shù)據(jù)*** If (intTelNumLong Mod 2) = 1 Then str