Access user-defined AT commands via adl_atCmdCreate()


#1

Hi All,

There’s been a number of questions asked on the forum about how to access custom AT commands from within an application. The common response is along the lines of ‘why would you want to do that? Just call your functions directly’. I believe I have finally found a valid reason to want to access my user-defined custom AT commands via the internal adl_atCmdCreate() function.

I’ve built a small application to run on a Fastrack Supreme. This application toggles the GPIO lines at user defined intervals, and I’ve written a simple AT command to set up the parameters for the GPIO. This works fine when accessing the Fastrack over UART1 or the USB port, but now the client wants to be able to change the parameters remotely.

I looked at the ‘Remote Terminal’ sample provided with Open AT, and it does exactly what I want - answers an inbound GSM CSD call, reads the data from the GSM flow and then passes it over to the module using the adl_atCmdCreate() function call. All works fine - when calling the built-in AT commands. Trying to access my custom command returns ERROR (as is sort of documented in the API).

Now I have to write a ‘pre-parser’ to strip out calls to my own AT command(s) from the GSM input, parse the data from the string and then pass these calls off to my own functions (and capture the response), instead of relying on the internal AT command parser (which works well) to do it for me. All making sure that I don’t break the existing custom AT command functions…

Has anyone else had this issue, or have any thoughts about how to access custom AT commands using OpenAT provided API?

ciao, Dave


#2

Who would say a thing like that…? :wink:

So, you want to allow the user to execure any commands remotely - including your custom commands?

Note that Wavecom do provide the wm_strGetParameterString library functions for parsing AT Command & response text.

I think my approach would be something like:

  1. Check if the command is one of your “custom” commands;
  2. If it isn’t, pass it to adl_atCmdCreate;
  3. If it is, use wm_strGetParameterString to pick-out the parameters, and then call your handler direct…

#3

Hiya,

I have no idea… :unamused:

Well - especially my custom commands. Without filtering every command that comes in, all ‘built-in’ commands seem to be available via the adl_adCmdCreate() call. I haven’t tested this exhaustively though.

Ta for that. I haven’t visited that part of the API doco for a while and had forgotten that it existed. Was busy about to roll my own string parsing routine - this (hopefully) will save quite a bit of time.

Looks like great minds think alike - this is what I’ve done.

I guess i was just hoping for an easier way…

Thanks for your help.

ciao, Dave


#4

It might be wise to do some filtering of incoming commands; eg, to stop someone sending AT+WOPEN=0 - which will stop your application, and then leave you with no way to restart it without a site visit…! :open_mouth:


#5

Hiya,

Hmm - that’s a good idea. I’ll check with the client to see what they want to do.

Thanks got the thoughts.

ciao, Dave


#6

This is exactly what i want to do…some sort of simple remote controlling!
but when using adl_atCmdCreate, the modem doesn’t response to my custome-made AT command…it doesn’t recognize it and gives error

thank god i found this thread.
u r right awneil, i also have concern in case the user know e.g the AT+Wopen=0 command (this is like a “backdoor”, quite dangerous :slight_smile: ).

i’ll try to test ur solution…thanks awneil and davidc.