Sending data using GPRS based on timer


#1

Hi all,
I am trying to send data through GPRS for every 10second. I subscribed to the cyclic timer for this.

    This procedure is not working. Please tell me where i am doing wrong. Is there anyway to meet my requirement.

Thanks & Reagards
nlysspk.


#2

Hi nlysspk,

how about posting your code? It’s quite hard to tell what’s wrong based on the information contained in your post…

Best Regards,
Jan


#3

And what does that actually mean? :unamused:

That’s like saying, “My car won’t go - what is wrong with it?”

What exactly is “not working”
Does your code fail to build?
Does it fail to download to the module?
Does the application fail to start?
Does your timer subscription fail?
Is your timer handler not called?
etc, etc, etc…


#4

Some other kind of important information would be which OpenAT version / core firmware version / TCP/IP library(?) / gsm module are you using???

Best Regards,
Jan


#5

Hi Jan & Awneil,
Sorry for not giving enough data.
I am using,
OpenAT version - 3.12
core firmware version - 657
TCP/IP library- WIP libraries
gsm module - Q2501B.

     I am subscribing for GPRS connection and setting APN parameters.
After bearer connection is completed, In WIP_CEV_WRITE case of wip_eventhandle, i am subscribing cyclic timer. 
     In the timer handler, i am writing data to the channel.

      My code is successfully build and my timer subscription and calling handler is successful, but unable to send data.

I hope that i am clear, Please tell me where i am doing mistake.

My requirement is i have to send data for every 10 seconds to the server.

Thanks & Regards
nlysspk


#6

Hi nlysspk,

Unortunately, I have only used edLib so far for TCP/IP communication. But I sure think it should be possible to send data every 10 seconds…

Best Regards,
Jan


#7

Better, but still what does “unable to send data” mean? :unamused:

Show the code that you use to send the data.

Does the code return any error results?
Or does it seem that the data is sent OK, but it just doesn’t arrive at the receiver?

How do you know that the data is not being sent?
Maybe it’s being sent OK, but there’s a bug is in the Server receiving it?
Maybe it’s being sent OK, but there’s a routing problem somewhere, so it just doesn’t reach the server?

etc, etc,…


#8

I confirm that it is working with the wip library. It is quite stable :wink:
I don’t have seen data that are not sent when the wip_write returns a positive result. You can try to connect to a netcat in server mode and wireshark to see what’s wrong.

Good luck

Best regards,

gdt


#9

Hi awneil and gdt,
My code is like this,

ascii Buffer[200]="Hello Server, client is sending the message based on timer";
void evHandler( wip_event_t *ev, enum state *ctx)
{
	wip_channel_t c = ev->channel;
	
	switch (ev->kind)
	{
	case WIP_CEV_DONE:
		break;
	case WIP_CEV_ERROR:
		adl_atSendResponse(ADL_AT_RSP, "WIP_CEV_ERROR");
		break;
	case WIP_CEV_OPEN:
		adl_atSendResponse(ADL_AT_RSP, "WIP_CEV_OPEN");
		break;
	case WIP_CEV_PEER_CLOSE:
		adl_atSendResponse(ADL_AT_RSP, "WIP_CEV_PEER_CLOSE");
		break;
	case WIP_CEV_PING:
		break;
	case WIP_CEV_READ:
		
		break;
	case WIP_CEV_WRITE:
		adl_atSendResponse(ADL_AT_RSP, "WIP_CEV_WRITE");
adl_tmrSubscribe(TRUE, 100, ADL_TMR_TYPE_100MS, (adl_tmrHandler_t)Timerhdl1 );
                 break;		
	default:
		break;
	}
}

void Timerhdl1( u8 ID)
{
	adl_atSendResponse(ADL_AT_RSP, "START TIMER Handler");
                wip_write( c, Buffer, strlen(Buffer));
}

#10

You are not checking the return value from wip_write

What events are you seeing in your evHandler?

For debugging purposes, You should report all values of ev->kind - including undefined ones (add a default case).


#11

awneil,
Initially I am seeing
WIP_CEV_OPEN and WIP_CEV_WRITE events.


#12

What are you using
wip_channel_t c = ev->channel;
for in the event handler?

In your timer handler you treat c as a global variable, but c is only local for the event handler.


#13

tobias,

yes, i am declaring c as a global variable like this,
wip_channel_t c;


#14

tobias:
very good! I am convinced, too, that this is the problem…

nlysspk:
you are declaring another local variable with the same name! and the global does not get assigned!

Best Regards,
Jan


#15

Jan:
I will change the variable, but in this case how to assign the value.
for example,
wip_channel_t c; // global declaration

    wip_channel_t d = ev->channel;  // in the event handler

    Please tell me.

#16

just use

c = ev->channel;

in the event handler, that will assign the value to the global variable…


#17

I did the same , but i am getting the following error,

syntax error : missing ‘;’ before ‘type’


#18

This is basic ‘C’ programming:

int global_variable;

void read_from_the_global_variable( void )
{
   int local_variable = global_variable;
}

void write_to_the_global_variable( void )
{
   global_variable = 3;
}

#19

That is a syntax error in your ‘C’ source text.

Fix the syntax error - possibly, as the message says, you have missed a semicolon somewhere!


#20

awneil:
If i declare like this in the evHandler, i am not getting the error.
wip_channel_t c = ev->channel;

             If i declare like this , i am getting the above error,
                               c = ev->channel;