AT Commands over GPRS


#1

Hi all,

I was just wondering, is it possible to send/receive AT commands over GPRS connection just like you do through UART1?

I’ve been trying to use adl_fcmSubscribe to subscribe to GPRS and ADL_FCM_EVENT_V24_AT_MODE but when I do, GPRS connection does not seem to respond at all.

Thanks in advance :slight_smile:


#2

You’ll have to devise your own protocol for transporting the commands & responses over GPRS, but once you’ve done that, adl_atCmdCreate can be used to issue the command and subscribe to the repsonses…


#3

I need to run some commands directly on the modem, how can I do this for my application to it, run these commands?

Using adl_atCmdCreate?

How to get the answer to this command?


#4

My code:

void MyResponseHandler ( adl_atResponse_t * ReceivedRsp ) {
    wip_debug(ReceivedRsp);
    //wm_strcat(buffer,ADL_GET_PARAM(ReceivedRsp,0));
    wip_debug( "Opening FTP connection...\n");
    if( ! dst_ftp_cx){ 
        dst_ftp_cx = wip_FTPCreateOpts (
        DST_SERVER,  evh_cx, NULL,
        WIP_COPT_USER,     DST_USER,
        WIP_COPT_PASSWORD, DST_PASSWORD,
        WIP_COPT_PASSIVE,  DST_ISPASSIVE,
        WIP_COPT_END);
    }
    offset=0; 
    if( ! dst_ftp_cx) { wip_debug( "Can't open dst FTP connection\n"); return; }
}

adl_atCmdCreate ( "MILOS", FALSE, MyResponseHandler, NULL, NULL );
adl_atCmdCreate ( "OPEN", FALSE, MyResponseHandler, NULL, NULL );
adl_atCmdCreate ( "SHOW CLIMA10", FALSE, MyResponseHandler, "MILOS:", NULL );

#5

adl_atCmdCreate can only be used with standard commands - it cannot be used with custom commands that you have created yourself.

To call custom commands that you have created yourself, you will have to implement your own scheme to recognise the command and initiate the appropriate action.


#6

Thanks for replay!

But when my modem connected to my station, when i type MILOS in hyperterminal he comunnicated automatic with station…

I just want to write a function that allows commands directly as if through HyperTerminal … And then wanted to record the results of this command in a variable…

You can help me?


#7

I use this code:

adl_atCmdSubscribe("SHOW CLIMA10", (adl_atCmdHandler_t)MILOS_Handler, ADL_CMD_TYPE_TEST | ADL_CMD_TYPE_READ | ADL_CMD_TYPE_ACT | ADL_CMD_TYPE_PARA | 0x0011);

void MILOS_Handler(adl_atCmdPreParser_t * ReceivedCmd) {
    wm_strcat(buffer,ADL_GET_PARAM(ReceivedCmd,0));
    wip_debug( "Opening FTP connection...\n");
    if( ! dst_ftp_cx){ 
        dst_ftp_cx = wip_FTPCreateOpts (
        DST_SERVER,  evh_cx, NULL,
        WIP_COPT_USER,     DST_USER,
        WIP_COPT_PASSWORD, DST_PASSWORD,
        WIP_COPT_PASSIVE,  DST_ISPASSIVE,
        WIP_COPT_END);
    }
    offset=0; 
    if( ! dst_ftp_cx) { wip_debug( "Can't open dst FTP connection\n"); return; }
}

void appli_entry_point() {    
    //wip_debug( "teste25\n");
    wip_debug("MILOS\n");
    wip_debug("OPEN\n");
    wip_debug("SHOW CLIMA10\n");
}

I want to enter these commands to get inside my station, download the data and passes them to a variable to send to the web… But I am not able… :frowning:


#8

Ok. Do what you want. Enter these commands, download the data etc. Just do not use AT commands for it and it will be an easy task.

For example if your station with GSM module listens for incoming data over GPRS, choose some sequence (it can be “123” or “start” or “AT+MILO”) and listen for it. If you’ve found it - start FTP connection or anything you want.


#9

Of course you can - that is the whole point of creating your own custom AT commands!

But, what I keep telling you is: you cannot issued these custom AT commands using adl_adCommandCreate!

So you need to write you own function that looks at the incoming data and recognises your commands;
When it sees one of your commands, it calls the same “action” function that the custom AT Command would have called

You will have to work out a scheme to do that!


#10

Yes, but I just want to make a direct command, because the station can interpret the command Milos, so I think I just need to know how to send commands directly by modem, anyone know how?

Thanks for all replay!!


#11

When you receive the command from server, just simply send it using adl_atSendResponse if you don’t have subscribtion to FCM, or adl_fcmSendData if you are using FCM.
If in your application WIP library is managing connection with server you can receive data in TCPClientHandler in case WIP_CEV_READ. You can then simply find if data from server is command that you want send to device ( wm_strncmp( receivedData, “MILO”, 4 ) ) and if yes pass it to this device.
You don’t have to use any subscription to AT commands.
If you want to receive answer you have to subscribe to UART1 (I assume that you are using serial port to communicate with device). And then in its data handler your application is receiving answers.
For more informations read Flow Control Manager section.


#12

:bulb: Aha! so you’re not talking about AT Commands at all, then?! :unamused:

AT Commands are the commands that you issue to the modem in order to instruct the modem to do stuff; eg

  • ATD instructs the modem to dial a number;
  • AT+CSQ instructs the modem to give its signal strength reading;

etc, etc,…

You are talking about issuing commands from the Modem to some external device that is wired to the modem’s serial port (you call this external device your “station”) - is that right?

eg,

  • MILOS instructs the station to do something;
  • OPEN instructs the station to do something else;
  • SHOW CLIMA10 instructs the station to do another thing.

And you want your program to send these commands to the station - is that it :question:


#13

awneil yes i want my program send these commands to the station its possible?

My station comunicated with modem with port serial, and i for open comunication i need type this commands in hyperterminal:

MILOS [enter]
OPEN [enter]
SHOW CLIMA10 [enter] - i want get result of this command and put this result in buffer of my data.txt for send to webserver.

my question is how send automatic direct command in my modem? what is the function that I use to send commands directly to my station?

please help

thanks for all replay!


#14

and you now understand that this has nothing whatsoever to do with AT Commands?

To send and received arbitrary data over the serial port, you need to use FCM - the Open-AT Flow Control Manager - as mpasinski mentioned.

See the ADL User Guide for details, and the sample projects included in the SDK.


#15

Ok thanks very much!! :slight_smile:
I will read!