短信使用gsm调制解调器VB.NET [英] SMS using gsm modem VB.NET
问题描述
我正在尝试使用SIMCOM 900A编写发送短信程序。使用我的下面的代码,我面临的问题......
1.
将串行端口接收数据发送为
I am trying to write a send SMS program using SIMCOM 900A. With My below code I am facing the problems...
1.
sending when getting serialport received-data as
> AT+CMGS="9674642260"
TESTING SMS-1
它发送的信息前面是整个串口收到的数据。
It is sending the message text preceded by the entire serialport received data.
message sent : <pre>ATAT+CMGS="9674642260"
TESTING SMS-1
2.
但是当收到数据
2.
But not sending SMS when received-data is
AT+CMGS="9674642260"
TESTING SMS-1
>
如果我再次点击发送按钮,那么它正在成功发送短信,但是再次使用整个命令集+消息文本。
任何人都可以帮我修改我当前的代码。此外,我需要将消息发送到多个号码。
先谢谢。
我尝试过:
if I click the send button again then it is sending the sms successfully but again with entire command set + message text.
can anyone help me where to modify my current code. Also I need to send the message to multiple numbers.
Thanks in Advance.
What I have tried:
my send button code:
<pre> If SerialPort1.IsOpen Then
SerialPort1.Close()
End If
SerialPort1.Open()
Try
With SerialPort1
.Write("AT" & vbCrLf)
Threading.Thread.Sleep(1000)
' .Write("AT+COPS?" & vbCrLf)
' Threading.Thread.Sleep(1000)
.Write("AT+CMGF=1" & vbCrLf)
Threading.Thread.Sleep(1000)
.Write("AT+CMGS=" & Chr(34) & txtNumber.Text & Chr(34) & vbCrLf)
.Write(txtMsg.Text & Chr(26))
Threading.Thread.Sleep(1000)
'.Write("AT" & vbCrLf)
End With
rcvData.Text = recData.ToString
SerialPort1.Close()
Catch ex As Exception
End Try
推荐答案
参见 AT CMGS - Google搜索 [ ^ ]。
这篇关于短信使用gsm调制解调器VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!