#include “adl_global.h”
#include “adl_fcm.h”
//#include “Cmd_handlr.h”
/***********************************************************************/
/ Mandatory variables /
/-------------------------------------------------------------------------/
/ wm_apmCustomStackSize /
/-------------------------------------------------------------------------/
/**************************************************************************/
const u16 wm_apmCustomStackSize = 10243;
bool tec_CtrlHandler(u8 event);
bool tec_DataHandler(u16 datlength,u8* data);
bool ipr_rsphdl (adl_atResponse_t *Params);
s8 uart_handler;
ascii result;
/**************************************************************************/
/ Uart Callbacks /
/**************************************************************************/
bool ipr_rsphdl(adl_atResponse_t *Params)
{
adl_atSendResponse(1,“IN IPR RESPONSE HANDLER”);
return TRUE;
}
// this is to read data.
bool tec_DataHandler(u16 datlength,u8* data){
adl_atSendResponse(1,“IN TO DATA MODE”);
ascii NewText [ 20 ],txt[20];
u16 i;
result=*data;
for ( i = 0 ; i < datlength ; i++ )
{
if ( data [ i ] == ‘~’ )
{
adl_fcmUnsubscribe(uart_handler);
}
else
{
txt[i]=data[i];
wm_sprintf ( NewText, “%c”, txt[i] );
adl_atSendResponse(ADL_AT_UNS, NewText);//to send received data and display using uart1.
//adl_fcmSendData ( FCM_Handler, NewText, datlength );
}
}
return TRUE;
}
bool tec_CtrlHandler(u8 event){
adl_atSendResponse(1,“in control handler \n”);
switch(event){
case ADL_FCM_EVENT_FLOW_OPENNED:
adl_atSendResponse(1,“about to tune uart 2 \n”);
adl_atCmdCreate(“AT+IPR=9600;&w”, ADL_AT_PORT_TYPE ( ADL_PORT_UART2, ADL_AT_RSP ),(adl_atRspHandler_t)ipr_rsphdl,NULL);
adl_atSendResponse(1,“UART2 HAS BEEN OPENNED”);
adl_fcmSwitchV24State(uart_handler,ADL_FCM_V24_STATE_DATA);//to receive data
break;
case ADL_FCM_EVENT_FLOW_CLOSED:
adl_atSendResponse(1,“UART2 CLOSED”);
break;
case ADL_FCM_EVENT_V24_DATA_MODE:
adl_atSendResponse(1,“ALREADY IN DATA MODE”);
break;
default:
adl_atSendResponse(2,“UNKNOWN EVENT OCCURED”);
break;
}
return TRUE;
}
main function
void adl_main(adl_InitType_e InitType)
{
if(adl_fcmIsAvailable( ADL_FCM_FLOW_V24_UART2)==TRUE)
{
adl_atSendResponse(1,“IN MAIN FUNCTION\n”);
uart_handler = adl_fcmSubscribe (ADL_FCM_FLOW_V24_UART2, (adl_fcmCtrlHdlr_f) tec_CtrlHandler, (adl_fcmDataHdlr_f) tec_DataHandler );
}
else
{
adl_atSendResponse(1,“UART2 NOT AVAILABLE”);
}
}
here in the above program with respect Q2687 in M2M studio 1.0 . In my hardware the uart2 port is connected to the GPS module and and i am receiving data from uart2 and has to send to uart1. In my program the uart2 is not responding .