CMGW sample

Added by admin 3 months ago

Dear Sir,

Do you have any sample using AT+CMGS for sending msg in PDU MODE... Can you help me determine the USER DATE if it is long message, ref no, total parts, seq no...

As I check to your library you used AT+CMGW for sending CMGW save my message to memory and I want to disregard it.... I hope you can give me an option not save my message sent and use AT+CMGS..

Thanks and God Bless...


Replies (4)

RE: CMGW sample - Added by admin 3 months ago

Hi,

The library by default uses AT+CMGS for message sending. You can see all the commands in the log file under verbose mode.

thanks
Regards
admin

RE: CMGW sample - Added by jtyambao 3 months ago

This what I found sir... My device is PDU Supported... This where my message use to send a message...
Sorry sir for any inconvenience...

Private Function SendTextSMS( _
ByVal destinationNumber As String, _
ByVal textMessage As String) _
As String

If commandHandler.Is_AT_CMGF_0_Supported Then
Try
Dim responses() As String
Dim response As String
response = serialDriver.SendCmd(ATHandler.CMGF_COMMAND & "=0", ATHandler.RESPONSE_OK)
responses = ParseATResponse(response)
If responses(0).Trim() = ATHandler.RESPONSE_OK Then
Dim pduObject As New PDU
Dim PDUCodes() As String = pduObject.GetPDU( _
"", destinationNumber, ENUM_TP_DCS.DefaultAlphabet, _
Me.Validity, 1, Me.isDeliveryReport, _
textMessage)
Dim i, j, ATLength As Integer
For i = 0 To PDUCodes.Length - 1
ATLength = pduObject.GetATLength(PDUCodes(i))
For j = 0 To 3
response = serialDriver.SendCmd(ATHandler.CMGW_COMMAND & "=" & ATLength & "", ">")
If response Is Nothing Or response = String.Empty Then
response = serialDriver.SendCmd(ATHandler.CMGW_COMMAND & "=" & ATLength & "", ">")
Else
Exit For
End If
Next
responses = ParseATResponse(serialDriver.SendCmd(PDUCodes(i) & Chr(26), ATHandler.RESPONSE_OK))
If responses.Length > 1 Then
Dim line As String = responses(0)
Dim cols() As String = line.Split(":")
If (cols.Length > 1) Then
Dim index As Integer = cols(1).Trim
responses = ParseATResponse(serialDriver.SendCmd(ATHandler.CMSS_COMMAND & "=" & index & "", ATHandler.RESPONSE_OK))
If responses.Length > 1 Then
line = responses(0)
cols = line.Split(":")
If (cols.Length > 1) Then
response = cols(1).Trim
If isAutoDeleteSentMessage Then
Try
DeleteSMS(index)
Catch ex As Exception
isAutoDeleteSentMessage = False
End Try
End If
Return response
End If
End If
End If
End If
Next
End If
Return String.Empty
Catch ex As System.Exception
Throw New InvalidOpException("Error sending SMS message: " + ex.Message, ex)
End Try
Else
Try
Dim response As String = serialDriver.SendCmd(ATHandler.CMGF_COMMAND & "=1", ATHandler.RESPONSE_OK)
response = serialDriver.SendCmd(ATHandler.CMGS_COMMAND & "=""" & destinationNumber & """")
Dim responses() As String = ParseATResponse(serialDriver.SendCmd(textMessage & Chr(26), ATHandler.CMGS_RESPONSE))
'Dim responses() As String = ParseATResponse(serialDriver.SendCmd(textMessage & Chr(26)))
If responses.Length > 1 Then
If Not responses(0) Is Nothing Then
Dim line As String = responses(0)
Dim cols() As String = line.Split(":")
If (cols.Length > 1) Then
Return cols(1).Trim
End If
End If
End If
Return String.Empty
Catch ex As System.Exception
Throw New InvalidOpException("Error sending SMS message: " + ex.Message, ex)
End Try
End If
End Function

RE: CMGW sample - Added by jtyambao 3 months ago

how to send long message in PDU mode that will return ref no, total parts, sequence of the concatenated message... thanks

RE: CMGW sample - Added by admin 3 months ago

Hi,

You should look at the messagingtoolkit library sample source after installing the library.

Thanks
Regards
admin

(1-4/4)