adl_atCmdCreate problem with adl_atCmdSubscribe


#1

Hello,

Here is my problem:

I declared a new AT command AT+NTPSERV :
adl_atCmdSubscribe ( “AT+NTPSERV”, Cmd_NTPSERV_Handler, ADL_CMD_TYPE_READ | ADL_CMD_TYPE_PARA | 0x0011 );

When using AT+SERV from the UART1 port of the Q24plus (over the eval board), it works fine.

However when using:
adl_atCmdCreate( “AT+NTPSERV?\r”, FALSE, ManageNewMessage_Resp_Handler, “*”, NULL );

I received the ERROR message, while

adl_atCmdCreate( “AT+CSQ\r”, FALSE, ManageNewMessage_Resp_Handler, “*”, NULL ); works fine.

for info:
bool ManageNewMessage_Resp_Handler(adl_atResponse_t *paras)
{
adl_atSendResponse ( ADL_AT_UNS, paras->StrData );
return TRUE;
}//endprog

Any idea?
thank you for your help.

Laurent


#2

adl_atCmdCreate only works with the standard, built-in AT commands; You cannot use adl_atCmdCreate to issue your own custom commands.

What would be the point? Just have your application call the appropriate function(s) direct! 8)


#3

Thank you awneil for your help.

My application handles a proprietary serial protocol.
Serail frames start by “EA” (0x45 0x41) adn end by .
For this reason I switch the UART1 in data mode, but I would like to be able to send my custom AT commands while in data mode.

Thank you for your help.

Laurent


#4

If you really want to do this, you should write your own wrapper to handle your custom AT commands.


#5

Or adapt your “proprietary serial protocol” to allow access to these commands…


#6

I do have problem as well with atCmdCreate where i need to specify array pointer that will contain the value after the equal sign of the at comand.

This array sould be added the the cpbp at command.
If i use the name of the array as followes:

adl_atCmdCreate(“at+cpbp=“num””, FALSE, Handler, “*”, NULL);
With the above format I get search for the ascii vallue of -num- and not the value that is in the array pointer itself.

Adding the name of the array as follows after the comand itself will return an error.

adl_atCmdCreate(“at+cpbp”+num, FALSE, Handler, “*”, NULL);

Is there anyone knows how to add pointer to array in this adl ?


#7

This has nothing to do with ADL - what you are doing is just not valid in ‘C’!

You need to use sprintf or similar to build your command string first, and then pass that string to adl_cmdCreate…


#8

yes i know the second one is not valid. i have tried all other options.

this one doesnt work as well;

[quote]
wm_strcpy(b,“at+cpbp=”);
wm_memset(b+8,0x5c,1); \ 0x5c=
wm_memset(b+9,0x22,1); \ 0x22="
wm_strcpy(b+10,num);
wm_memset(b+20,0x5c,1);
wm_memset(b+21,0x22,1);
wm_memset(b+22,0x22,1);

[quote]


#9

Hiya,

why don’t you try something like this instead (assuming that num is an integer):

wm_sprintf(b, "at+cpbp=%c%c%d%c%c%c", 0x5c, 0x22, num, 0x5c, 0x22, 0x22);

Look up the printf() and sprintf() functions to see how to format the string.

I wouldn’t try to print the resulting string to the console though…the control chars may bollox things up.

ciao, Dave


#10

Or even:

The more complicated you make it, the less likely you are to get it right!


#11

Neither of those will work, because they both insert backslash characters into the string!

You don’t actually want the backslash characters in the string - you just want the double quotes.

The backslash is just there to “escape” the double quotes when you enter them as part of a string!


#12

it will take me days to find out that actually no one ever tried this before , but i am doubt about it…

can you please give an example how to put the at command ,concatenated with pointer to a buffer to the adl_CmdCreat?


#13

Again, this has nothing to do with Wavecom, OPen-AT or ADL. It’s basic, standard, textbook ANSI ‘C’ - use of sprintf.

Try doing it in a “normal” C compiler until you can get printf to display the string you want…


#14

Just sending the sprintf without relating it to the adl_atCmdCreat will not give me anything.
i did not understand what will sprintf contribute?

In order to use the at comand i need to specify the comand format in ascii to - ascii *atstr , is that correct?
as i said before adding the correct number to the at comand that i need to send is trivial ,
it is the format of the string itself and the why it appers inside the array returns the error after jumping into this adl on the debuugging stage.
I have tried to use b as the array that represents *atstr with the following options:

b[]="at+cpbp=“0123456"”
returns error

b[]="at+cpbp=“0123456"”
returns error as well


#15

Use sprintf to build the string that you require.

If you don’t know how to do that in a “normal” C program outside of Open-AT and ADL, then you obviously won’t be able to do it with the added complications of Open-AT and ADL!

So get it going in a plain, vanilla “ordinary” C application first.

Yes

That will give you a compiler error - it is not valid ‘C’ syntax

You haven’t specified a type for ‘b’

If you don’t specify a type, ‘C’ will always default to int , which is not what you require - so it will cause an error.

Again, this is standard ‘C’ stuff - nothing specifically to do with Wavecom, Open-AT, or ADL.


#16

You need to state clearly what, exactly, returns an eror - and what error, exactly, it returns!

eg:

  • An error in your ‘C’ syntax will cause the compiler to give an error;
  • An error in the way that you call adl_atCmdCreate may cause that function to return an error result code;
  • An error in the AT command itself will cause an ERROR response.

#17

Here is an example of using sprintf to build a string and subsequently using that string:

#include <stdio.h>

int main( int argc, char* argv[] )
{
    // Strings to be formed into the message
    char hello_string[] = "Hello";
    char world_string[] = "world";

    // Buffer into which to build the message
    char string_to_print[80];

    // Build the message
    sprintf( string_to_print, "%s, %s!\n", hello_string, world_string );

    // Print it!
    printf( string_to_print );

    // all done.
    return 0;
}

You should be able to build that using any standard ‘C’ compiler to run it on a standard host system (not Open-AT).

Then experiment with adapting it to form the AT Command that you require…

Once you have that working, then move it into your Open-AT application…


#18

The error is in the at command itself and it is +CME ERROR: 22 which means number is not existed.

I see it after a breakpoint that i put on the comand handler

bool Handler(adl_atResponse_t *paras)
{
    rs = (ascii *)adl_memGet(paras->StrLength); \\ Breakpoint is here 
    wm_strRemoveCRLF(rs, paras->StrData, paras->StrLength);
    wm_strcpy(buf,rs); \\buf = +CME ERROR: 22 
}

this is only an explenation of whats insid the srings that i send with the adl .


#19

So you searched for a number that isn’t in the Phonebook - what result do you expect other than the error code indicating that the number isn’t in the Phonebook?! :unamused:


#20

as a matter of fact it exists. sending the comand threw terminal provides the correct number