大家好,我试图使用AT命令从gsm调制解调器的收件箱中读取内容.当我运行此代码时,我得到的唯一响应是确定".但我应该从收件箱中收到消息.我的代码在下面:
私有Sub viewInBox_Load(ByVal发送者为System.Object,ByVal e为System.EventArgs)将MyBase.Load 处理为新的System.IO.Ports.SerialPort .PortName = QUOT; COM5"结果,.BaudRate = QUOT; 9600"结果,.StopBits = IO.Ports.StopBits.One结果.DataBits = 8结果,.Parity = IO.Ports.Parity.无的.ReadBufferSize = 10000 <.
.Open() .DiscardOutBuffer()读取短信
.DtrEnable = True
.Write("AT" + vbCr)在缓冲区上执行命令. ALL" + vbCr)
昏暗的传入字符串= .ReadExisting()
MsgBox(传入) .Close()
结尾为
作为例外捕获 MsgBox(ex.Message)结束尝试
结束子
我唯一的猜测是,它只会写出字符串的最后一部分.如果是这样,我如何将所有的弦乐部分合而为一?
解决方案
感谢您的发帖!我建议在一个MS论坛中发布您的问题,
MSDN论坛 » » Windows窗体常规 |
hi all,im trying to read from a gsm modem's inbox using AT commands. when i run this code, the only response i get is "OK" but i should be getting the message from the inbox. my code is bellow:
Private Sub viewInBox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim comSerial As New System.IO.Ports.SerialPort Try With comSerial .PortName = "COM5" .BaudRate = "9600" .StopBits = IO.Ports.StopBits.One .DataBits = 8 .Parity = IO.Ports.Parity.None .ReadBufferSize = 10000 .ReadTimeout = 1000 .WriteBufferSize = 10000 .WriteTimeout = 10000 .RtsEnable = True
.Open() .DiscardOutBuffer() 'for reading sms .DtrEnable = True
.Write("AT" + vbCr) 'execute command on buffer .Write("AT+CMGF=1" + vbCr) .Write("AT+CMGL=ALL" + vbCr)
Dim Incoming As String = .ReadExisting()
MsgBox(Incoming) .Close()
End With
Catch ex As Exception MsgBox(ex.Message) End Try
End Sub
my only guess would be that its only writting out the last part of the string. if so, how would i concat all the string parts into one? if thats not the problem, what is?
解决方案Hi,
Thank you for your post! I would suggest posting your question in one of the MS forums,
MSDN Forums » Windows Forms » Windows Forms General |
更多推荐
在命令处:从手机获取收件箱
发布评论