Subscribe to text commands (e.g +CMGS)


#1

Hello,

Anyone know howto subscribe and collect all the parametrs from a text command like for example AT+CMGS?

Its no problem to get the firs parameter but the text after the CR is a bit more complicated…

I want to susbscribe to the +CMGS and collect its parameters and change some of them before actually sending away the SMS.

Many thanks in advance for any hints.

/H


#2

Why not just use the ADL SMS Service - it’s there so that you don’t have to mess about with the AT commands! :smiley:


#3

Hmm, I wish the world could be simple but unfortunately its not…

The thing is that the OpenAT application must filter an incoming +CMGS and to forward it slightly changed.
So, to get this working I need to parse a
"AT+CMGS="number"CR

text message CTRL-Z"
…to another message and to send it out.

/H


#4

Try using it to receive an SMS with the text OK and nothing more… might work with ERROR as well… :imp:


#5

I think there are some misunderstandings so I’ll be as clear as I can to describe my problem:

External application sends on serial UART1:
AT+CMGS="+31123456789"CR

this is the textmessage CTRL-Z

I want my OpenAT application to catch this in some way.
The best way should be to susbcribe on the +CMGS command and to get an Event when its received, but that does not seem to work since the CR terminates the command and the part after CR (“textmessage”) is not received as a parameter (It would work if the CTRL-Z was the terminator of the command.)

I want the complete command-string received in my Application (from +CMGS to CTRL-Z) for further handling.

Basically thats what my problem is all about.
Then after having the external applications +CMGS command I can do whatever I want with it, eg: modify it and send it to network or do anything b else but thats not relevant…

/H


#6

I see.

The ADL user guide talks about sending text-mode stuff like this, but not receiving them :cry:

Perhaps you’ll have to resort to the Basic API…?


#7

This is slightly complicated but worth a try :smiley:

  1. Subscribe to FCM service
  2. Capture the AT+CMGS command
  3. Block the command. Do not execute it. Switch the flow to DATA mode. Once the flow is switched send the ‘>’ character
  4. User enters data. Capture data until CTRL-Z.
  5. Switch the flow back to AT mode.
    Now you can process the AT+CMGS command any way you like… 8)

#8

Ok,

Now It’s solved. None of the proposed solutions above were useful so I tried a different one:

  1. Subscribed to FCM.
  2. Change to data mode.
  3. Capture all characters and write a command parser to get the commands you want to get hold of. All other commands are piped through to the internal command API and the response handlers are also forwarding the results to the physical serial channel.

…some negative aspect are that none of the standard command API can be used :frowning: and that the DCD is always ON since the serial UART is in “Data mode”.

Thanks for all ideas and comments.

/H