?? 從終端設備向蜂窩電話發送短消息文本(httpwww.simpleteam.com0474.htm).txt
字號:
作者:asp2001
email: asp2001@163.net
日期:2000-10-13 17:24:00
從終端設備向蜂窩電話發送短消息文本是十分簡單的。以下的代碼片段就演示了這個過程。所使用的電話是Nokia 7100系列,并且ME (mobile equipment)是連接在計算的#1號通信端口上。
注意到Ctrl-Z是用來表示終結發送到移動設備的文本輸入。
使用Visual Basic來發送SMS文本到Nokia電話:
' Set up the communications port
MSComm1.CommPort = 1 ' Com Port 1
' Set for 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input is used
MSComm1.InputLen = 0
' Open the port
MSComm1.PortOpen = True
' Send an 'AT' command to the phone
MSComm1.Output = "AT" & Chr$(13) & Chr(10)
' The phone will respond with an 'OK'
' Set up the phone for a text message
MSComm1.Output = "AT+CMGF=1" & Chr$(13) & Chr(10)
' The phone will respond with an 'OK'
' Prep for SMS, give destination type and destination address.
' Enter the destination type and destination address to prep for SMS
' e.g. AT+CMGS="+2145551212",129
MSComm1.Output = "AT+CMGS= " & Chr(34) & "+2145551212" & Chr(34) & ",129" & Chr$(13) & Chr(10)
' The phone will return a'>' prompt, and await entry of the SMS message text.
' Now send the text to the phone and terminate with (Ctrl-Z)
MSComm1.Output = "This is a test. WOW! "
' The phone will respond with a conformation containing the 'message reference number' eg. +CMGS:
' Close the port
MSComm1.PortOpen = False
在終端,看起來就象下面:
AT
OK
AT+CMGF=1
OK
AT+CMGS="+15127752607",129
>This is a test. WOW!
+CMGS: 49
OK
想了解更多的有關發送SMS文本信息的內容,請參考GSM 07.05白皮書在ETSI Web site。想了解更多Nokia關于SMS的信息,請去http://www.forum.nokia.com,并登陸到Smart Messaging forum。
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -