Problems sending Command with adl_atCmdCreate


#1

Hi everyone, this is something that I couldn´t find out… maybe you can help me out:

I´m working on “Socket Sample” of Wavecom Wismo Q2501.

I want to start the TCP connection automatically, instead of trying “at+SOCKETSTART=1” on a external program such as Hyper Terminal.

And also I want it to Close the socket after a defined response from the server and Open the Socket Once again after a certain time specified on the Timer Subscribe. This is something I´ll test after the problem above.

The thing is: On Socket_Init(); function I started a Timer after que “ma_Application” definitions, such as Start and Stop commands.

Time_Get_Request = 200;
	adl_tmrSubscribe(TRUE, Time_Get_Request, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t)Timer_T);

At the Timer´s Callback function I tryed the following code:

void Timer_T(u8 Id)
{

	    adl_atCmdCreate("at+SOCKETSTART= 1",TRUE, (adl_atRspHandler_t) NULL, NULL );
	}

}

But when I try to run the code, the time it calls the Timer_T(); it returns “ERROR”. I tryed to send “at+CMEE=1” first but no other information came.

Any ideas?

Thanks!

Henrique


#2

Hi Henrique,

the idea behind the user created AT commands is to use those from a terminal or other serial connection to interact with the internal application from the outside.

You don’t need to create a command (by using adl_atCmdCreate() function) from the internal application to call a user defined AT command since you can just call the function(s) that are called when the AT command handler for that function is executed. And if you don’t want to be able to call the function through a terminal program, you don’t even need to subscribe for the AT command (e.g AT+SOCKETSTART) at all…

Best Regards,
Jan


#3

Hi Jan, I understood but there´s something I don´t know:

I have to Call “Socket_Start();” function… but I have to send port parameter to it.

When I try the “at+SOCKETSTART=1” from a terminal, it calls the Socket_Start(u8 port) with a port I don´t know.

I didn´t find something to send as port.

What should I do instead?

Thanks,

Henrique


#4

Hello,

Or in other words, you can’t create a call with adl_atCmdCreate() to a user defined command (a command subscribed by the Open AT application).
The callback routine for the subscribed command in the Open AT application will never be called. The command created with adl_atCmdCreate() will only be handled by the standard GSM core software AT-command parser which will not recognise it and return ERROR.

/Snoooze


#5

Thanks for the replies!

I think there may have a mistake or something in Socket Sample as “Socket_start()” function neve uses “Port” parameter…

I just erased and used void as parameter.

Thanks!

Henrique


#6

Hi Henrique,

the way Socket_start was used as a function pointer in

ApplicationData->AppStart = Socket_start;

it might need the port parameter so that the type of the function is correct… ( but C isn’t really a strongly typed language, is it? :wink: )

But when you do only call this function directly you could of course drop the unnecessary argument…

Best Regards,
Jan


#7

Hi Jan! You know how much I appreciate your help and the others don´t you!? You really are Open AT expert! :slight_smile:

Can you give me another little hand here?

As you already know I want to post Coordinates to a webserver, right?

I want to post the coordinates every 10s so I´m trying to make TCP “connections” and “disconnections” using a timer.

The thing is: after the first connection and disconnection I can´t connect anymore.

I´m following the “Socket Sample” and it´s functions Socket_start and Socket_stop.

I start the application with a Timer Subscribe and a Flag set.
So… for the first time Socket_start will be called.

Everything works fine and when the application receives an specific answer from the Remote, it calls the Socket_stop function. And set the Flag once again.

But… when the timer ticks once again… Socket_start is called but it doens´t do what it have to.

The code is available at this URL:
bb.1asphost.com/bhmais/gps/socket.htm

Thanks!

Henrique


#8

Hi Henrique,

thank you for the compliment!

I’m not sure what the problem is, but I think you don’t need to stop the socket at all… The web server will close the connection once it has sent the response, so you don’t need to do an explicit stop.

Also, I think “ed_SocketLTCPStop()” is used only for listening sockets, which it was in the original example but now isn’t anymore…

Probably your program works OK when you remove the call to the stop function…

Best Regards,
Jan