Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
how to add PDU encoder and PDU decoder in below code?
-----------------------------------------------------------------------------------
VB
Sub SendSMS()

        If Modem.IsOpen = False Then
            MsgBox("Port not Open!!")
            Exit Sub
        End If
        If Me.TxtTo.Text = "" Then
            MsgBox("No recepient number!!")
            Exit Sub

        End If

        If Me.TxtSMS.Text = "" Then
            MsgBox("Blank text message are not allowed!!")
            Exit Sub

        End If

        sendbutton.Enabled = False
        Sending = True
        SendAttempt = 0
        Do
            ATSend("AT+CMGF=1")
            Result = ATRead(1000)
        Loop While Result.Contains("COMMAND NOT SUPPORT")
        Do
            ATSend("AT+CSMP=17,167,0,0")
            Result = ATRead(1000)
        Loop While Result.Contains("COMMAND NOT SUPPORT")
        Do
            Do
                ATSend("AT+CMGS=""" & TxtTo.Text & """")
                Result = ATRead(1000)
            Loop While Result.Contains("COMMAND NOT SUPPORT")
            ATSend(TxtSMS.Text & Char.ConvertFromUtf32(26) & vbCr)
            'ATSend(MyMessage & Char.ConvertFromUtf32(26) & vbCr)
            'ATSend(MyMessage & vbCrLf & Chr(26))

            Result = ATRead(10000)
            SendAttempt += 1
        Loop While Result.Contains("COMMAND NOT SUPPORT") Or (Result.Contains("ERROR") And SendAttempt < 5)
        If Result.EndsWith(vbCrLf & "OK" & vbCrLf) Then
            TxtSMS.Text = ""
            TxtTo.Text = ""
            '  MsgBox("Message Successfully Sent")
        Else
            '  MsgBox("Message Could Not Be Sent", MsgBoxStyle.Critical, "Error")
        End If
        sendbutton.Enabled = True
        Sending = False


    End Sub

-----------------------------------------------------------------------------------
VB

Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900