Problem in showing SMS received

6

Talk about it!

I'm trying to show a SMS received in a text box on a Form that I have, but instead of showing me the message I receive in my SIM, it shows something such as + CMTI: "ME", 33 . I'll leave the code below:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO.Ports
Imports System.Text

Public Class Form1
Dim inputData As String = ""
Public Event DataReceived As IO.Ports.SerialDataReceivedEventHandler

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    SerialPort1.PortName = "COM5"
    SerialPort1.BaudRate = 9600
    SerialPort1.Parity = Parity.None
    SerialPort1.DataBits = 0
    SerialPort1.StopBits = StopBits.One
    SerialPort1.Handshake = Handshake.None
    SerialPort1.RtsEnable = True

    SerialPort1.Open()
End Sub



Private Sub SerialPort1_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
    inputData = SerialPort1.ReadExisting()
    Me.Invoke(New EventHandler(AddressOf DoUpdate))
End Sub

Public Sub DoUpdate()
    TextBox1.Text = TextBox1.Text & inputData
End Sub


End Class

Can someone help me with how to show the message in the plain text and not how it is showing?

NOTE: Both PortName and the rest are correct

    
asked by anonymous 14.06.2016 / 13:58

1 answer

1

+ CMTI: "ME", 33 is the GSM module indication that a message was received, you need to give a command to read the message. The commands may vary slightly depending on the module, but are often very similar.

You should:

  • You should wait for a: + CMTI: mem, index (mem-> message storage location, index-> message position in memory);
  • Give the SMS read command: AT + CMGR = index [ mode] (index-> message position in memory, mode-> read mode, 0 for normal) ;
  • Interpret the received message, it will come, + or-, in this pattern: + CMGR: "REC READ", "+ 85291234567", "07/02/18.00: 12: 05 + 32"
  • Hello, welcome to our SMS tutorial.

    OK

    Here is the datasheet of a very common GSM module, which may look like your: link

        
    19.08.2016 / 03:20