金笛工业手机论坛  

返回   金笛工业手机论坛 > 开发者乐园 > 短信开发资料

短信开发资料 短信开发技巧,代码分析

 
 
LinkBack 主题工具 显示模式
旧 2009-10-12   #1 (permalink)
高级会员
 
注册日期: 2009-07-09
住址: 北京海淀
帖子: 192
lihb 正向着好的方向发展
默认 SMS开发-终端发送

使用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
在终端,看起来就象下面:
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
lihb 当前离线   回复时引用此帖
 

书签


当前查看此主题的会员: 1 (0 位会员和 1 位游客)
 

发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
Trackbacks are 启用
Pingbacks are 启用
Refbacks are 启用



所有时间均为北京时间。现在的时间是 09:36


Powered by vBulletin® 版本 3.8.3
版权所有 ©2000 - 2024,Jelsoft Enterprises Ltd.