如何从短信接收器接收文本 [英] how to receive Text from sms receiver
本文介绍了如何从短信接收器接收文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我需要一些想法来接收来自短信接收器的文字.net
我将从某些修复手机号码接收短信。
接收器(我现在没有它)将由usb连接到我的电脑。
我必须把这些短信显示在屏幕上
提前谢谢你
Hello
I need some idea to receive text from sms receiver in .net
I will be receiving sms from some fix mobile number .
A receiver (i dont have it right now)will be attached to my computer by usb.
I have to take these sms and display it on screen
Thank u in advance
推荐答案
谷歌是你的朋友:好好经常拜访他。他可以比在这里发布问题更快地回答问题......
快速搜索 使用您的主题作为搜索词 提供了超过四十万个结果: Google从.net接收来自sms接收器的文本 [ ^ ]
将来,请尝试自己做至少基础研究,不要浪费你的时间或我们的时间。
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...
A very quick search using your subject as the search term gave over four hundred thousand results: Google "receive text from sms receiver in .net"[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
嗨
我认为您需要使用SMS Gateway硬件。通过.net中的串口(工具箱中的SerialPort activex)与计算机进行通信。
并使用ATCommand将命令发送到串口。
您可以在vb.net中尝试以下示例代码
Hi
I think you need to use SMS Gateway hardware. and making communication with a computer via serial port in .net (SerialPort activex in the toolbox).
and send command to serial using ATCommand.
You can try the following example code in vb.net
Dim readBuffer As String
Private Sub btnConnect_Click(sender As System.Object, e As System.EventArgs) Handles btnConnect.Click
With SerialPort1
.ParityReplace = &H3B
.PortName = "COM1" 'your com serial port
.BaudRate = 115200
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
.Handshake = IO.Ports.Handshake.None
.RtsEnable = False
.ReceivedBytesThreshold = 1
.NewLine = vbCr
.ReadTimeout = 10000
End With
Try
SerialPort1.Open()
Catch ex As Exception
MsgBox("Error Open: " & ex.Message)
End Try
btnConnect.Enabled = Not SerialPort1.IsOpen
btnDisconnect.Enabled = SerialPort1.IsOpen
btnATCommandSend.Enabled = SerialPort1.IsOpen
End Sub
Private Sub btnDisconnect_Click(sender As System.Object, e As System.EventArgs) Handles btnDisconnect.Click
If SerialPort1.IsOpen = True Then
SerialPort1.DiscardInBuffer()
SerialPort1.Close()
End If
btnConnect.Enabled = Not SerialPort1.IsOpen
btnDisconnect.Enabled = SerialPort1.IsOpen
btnATCommandSend.Enabled = SerialPort1.IsOpen
End Sub
Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, _
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles SerialPort1.DataReceived
Try
readBuffer = SerialPort1.ReadLine()
Me.Invoke(New EventHandler(AddressOf DoUpdate))
Catch ex As Exception
MsgBox("read " & ex.Message)
End Try
End Sub
Private Sub DoUpdate(ByVal sender As Object, ByVal e As System.EventArgs)
TextBox1.Text = readBuffer
End Sub
Private Sub btnATCommandSend_Click(sender As System.Object, e As System.EventArgs) Handles btnATCommandSend.Click
'AT For read message by index= AT+CMGR=1 'sms index
'PLEASE REFER ATCOMMAND for more command
SerialPort1.WriteLine(TextBox2.Text)
End Sub
这篇关于如何从短信接收器接收文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文