Hi,
Please can you confirm if the problem exists with the application below:
/*
* Bearerstart.c
*
* Created on:
* Author:
*/
#include "adl_global.h"
#include "wip.h"
const u16 wm_apmCustomStackSize =1024 ;
#define GPRS_APN "airtelgprs.com"
#define GPRS_USER "airtel"
#define GPRS_PASSWORD "tango"
static const ascii * START_CMD = "AT+START";
void BearHandler(wip_bearer_t Br_Id, s8 Event, void *context)
{
s8 close;
switch(Event)
{
case WIP_BEV_CONN_FAILED:
TRACE((1,"Bear conn failed"));
break;
case WIP_BEV_IP_DISCONNECTED:
TRACE((1,"IP communication terminated"));
break;
case WIP_BEV_IP_CONNECTED:
TRACE((1,"Bear ip connected"));
break;
case WIP_BEV_STOPPED:
TRACE((1,"Bear close, stopped"));
close = wip_bearerClose (Br_Id);
switch(close){
case WIP_BERR_BAD_STATE:
TRACE((1,"Bad state"));
break;
case WIP_BERR_BAD_HDL:
TRACE((1,"bad handle"));
break;
}
break;
case WIP_BERR_GPRS_FAILED:
TRACE((1,"GPRS failed"));
break;
case WIP_BERR_PIN_NOT_READY:
TRACE((1,"Pin error"));
break;
default:
TRACE((1,"Default: error: %d", Event));
break;
}
}
static void open_and_start_bearer(void)
{
wip_bearer_t Br_ID;
TRACE((1, "wip_bearerOpen()"));
if(wip_bearerOpen( &Br_ID, "GPRS", BearHandler, NULL) != 0)
{
TRACE((1, "wip_bearerOpen() : Fail"));
}
else{
TRACE((1, "wip_bearerSetOpts()"));
if(wip_bearerSetOpts( Br_ID, WIP_BOPT_GPRS_APN, GPRS_APN,
WIP_BOPT_LOGIN, GPRS_USER,
WIP_BOPT_PASSWORD, GPRS_PASSWORD,
WIP_BOPT_END) != 0)
{
TRACE((1, "wip_bearerSetOpts : Fail"));
wip_bearerClose(Br_ID);
}
else
{
if(wip_bearerStart(Br_ID) != 0)
{
TRACE((1, "wip_bearerStart : Fail"));
TRACE((1, "ERROR CODE: %d", wip_bearerStart(Br_ID)));
}
}
}
}
s8 gprsHandler (u16 event, u8 cid)
{
s8 status;
TRACE((1, "GPRS event %d", event));
switch (event)
{
case ADL_GPRS_EVENT_ACTIVATE_OK:
TRACE ((1, "ADL_GPRS_EVENT_ACTIVATE_OK"));
break;
case ADL_GPRS_EVENT_SETUP_OK:
TRACE ((1, "ADL_GPRS_EVENT_SETUP_OK"));
break;
case ADL_GPRS_EVENT_ME_ATTACH:
TRACE ((1, "ADL_GPRS_EVENT_ME_ATTACH"));
TRACE ((1, "Making call"));
status = adl_callSetup("9900488663", ADL_CALL_MODE_VOICE);
if (status == OK)
TRACE ((1, "adlCallSetup returned OK"));
else
TRACE ((1, "adl_callSetup returned error %d", status));
break;
}
return ADL_GPRS_NO_FORWARD;
}
// AT+H command handler
void HCmdHandler ( adl_atCmdPreParser_t * para )
{
adl_callHangup ( );
}
// Call events handler
s8 MyCallHdlr ( u16 event, u32 callID )
{
TRACE (( 1, "Call Event : %d, %d", event, callID ));
return ADL_CALL_NO_FORWARD;
}
void cbStartCmdHandler ( adl_atCmdPreParser_t * paras )
{
u32 uStart = 0;
uStart = wm_atoi ( ADL_GET_PARAM ( paras, 0 ) );
if ( uStart == 1 )
{
TRACE (( 1, "Application started"));
open_and_start_bearer();
}
else
{
TRACE (( 1, "Start the application"));
}
}
static void wip_init( void)
{
u8 wRet;
wip_logEvents = TRUE;
/* Command subscription to start parameters monitoring or provisioning */
adl_atCmdSubscribe ( ( ascii * ) START_CMD, cbStartCmdHandler,
ADL_CMD_TYPE_PARA | 0x11 );
// Subscribe to H command
adl_atCmdSubscribe ( "AT+H", HCmdHandler, ADL_CMD_TYPE_ACT );
// Subscribe to the call service
adl_callSubscribe ( MyCallHdlr );
wRet = wip_netInitOpts(WIP_NET_OPT_IP_FORWARD,FALSE,WIP_NET_OPT_DEBUG_PORT, WIP_NET_DEBUG_PORT_TRACE,WIP_NET_OPT_END);
if(wRet != 0)
{
TRACE (( 1, "wip_netInit error" ));
}
else
{
TRACE (( 1, "wip_netInit :)" ));
adl_atSendResponse ( ADL_AT_UNS, "wip_eventInit :)\r\n");
adl_gprsSubscribe(gprsHandler);
}
}
void adl_main ( adl_InitType_e InitType )
{
TRACE((1 ,"Main Application"));
wip_init();
}
Steps:
- Modify the application to set the phone number, APN, username and password
- Issue AT+START=1 to start the application
- Answer the call
- Issue AT+H to hangup the call
Attach the traces if possible.
Regards,
Rex