I am trying to setup a GPRS bearer, and my handler never receives any events. I’m a little unsure of the exact process to open a bearer, so I’ve tried to setup the bearer in two ways:
1: I wait for SIM_EVENT_FULL_INIT, connect to the GPRS network using adl_gprsSetup(), once my gprsHandler gets the ADL_GPRS_EVENT_ACTIVATE_OK event, I send a message to another task to start the bearer setup.
2: I wait for SIM_EVENT_FULL_INIT, then send a message to another task to go through the bearer setup.
With method 1, after I connect to the GPRS network, adl_gprsGetCidInformations() tells me I have an IP address, two DNS addresses, but my default gateway is 0.
Here is how I setup the bearer with both methods:
/*** In task entry point ***/
wip_logEvents = TRUE;
wip_netInitOpts(WIP_NET_OPT_DEBUG_PORT, WIP_NET_DEBUG_PORT_TRACE,
WIP_NET_OPT_END);
wip_netInit();
/*** In a message handler once GPRS has already been connected(method 1) or after FULL_INIT(method 2) ***/
wip_bearer_t b;
int ctx = 1;
ret = wip_bearerOpen( &b, "GPRS", (wip_bearerHandler_f)evh_bearer, &ctx);
TRACE((1, "Bearer open %d", ret));
ret = wip_bearerSetOpts( b, WIP_BOPT_GPRS_APN, "myAPN",
WIP_BOPT_END);
TRACE((1,"setOpts %d", ret));
ret = wip_bearerStart( b);
if( ret == WIP_BERR_OK_INPROGRESS ) TRACE((1, "Bearer is connecting"));
TRACE((1, "Bearer start %d", ret));
/*** My event handler ***/
void evh_bearer( wip_bearer_t b, s8 event, void *ctx)
{
TRACE((1, "IN BEARER, %d", event));
}
Here are my traces when I go through the procedure:
10/04/26,10:08:57:812 ADL 1 [GPRS]: open: -> DISCONNECTED
10/04/26,10:08:57:822 ADL 1 Bearer open 0
10/04/26,10:08:57:822 ADL 1 setOpts 0
10/04/26,10:08:57:822 ADL 27 Call subs 00267409 : 0
10/04/26,10:08:57:822 ADL 31 Gprs subs 00270181 : 0
10/04/26,10:08:57:832 ADL 16 [ADL port] IsAvailable(80) : 1
10/04/26,10:08:57:892 ATI 1 AT+CGDCONT=1,"IP","myAPN",,0,0
10/04/26,10:08:58:433 ATI 1 OK
10/04/26,10:08:58:473 ADL 31 Gprs setup 1 : 0
10/04/26,10:08:58:483 ADL 1 [GPRS]: start: -> CONNECTING
10/04/26,10:08:58:493 ADL 1 Bearer is connecting
10/04/26,10:08:58:513 ADL 1 Bearer start -27
10/04/26,10:08:58:533 ATI 1 +WIND: 7
10/04/26,10:08:58:563 ATI 1 +CREG: 1,"2715","8113"
10/04/26,10:08:58:673 ATI 1 +WIND: 15,1,"ATT",2,"ATT",4,"10/04/26,17:06:17-16",6,"1"
I get the WIP_BERR_OK_INPROGRESS return from wip_bearerStart(), and then I get nothing else. I let it sit while I went to lunch, and still no events. I was expecting to see my "IN BEARER " trace, with at least some sort of failure event. But I don’t get any further. What am I missing from this?