Hello,
I’m trying to make an application that gets GPS position and sends it through an GPRS socket (created with WIP commands). So I created a proyect whit GPS and WIP plugins based on QueryApp sample. As far as I know, both of them use UART1 for sending data, so (correct me If I am wrong) I have to subscribe and unsubscribe every time I want to use one or another . When the GPS starts (AT+NMEA=1, AT+CGPS=2), it subscribes the UART1. So I get the NMEA frames without problems. I’ve made 4 new at commands in order to “free” the serial port. Here are them:
[i]static void C1CmdHandler (adl_atCmdPreParser_t *para)
{
s8 retVal;
int aux=0;
ascii RspStr [ 50 ];
retVal = adl_fcmSwitchV24State(DataTRACE_fcmHandle, ADL_FCM_V24_STATE_DATA);
aux = DataTRACE_fcmHandle;
if (retVal == OK) {
wm_sprintf ( RspStr, “Successful switch to DATA mode. Handle: %d”,aux);
adl_atSendResponsePort ( ADL_AT_INT, para->Port, RspStr );
adl_atSendStdResponsePort ( ADL_AT_RSP, para->Port, ADL_STR_OK );
} else {
wm_sprintf ( RspStr, "ERROR switching to DATA: %d. Handle: %d ",retVal,aux);
adl_atSendResponsePort ( ADL_AT_INT, para->Port, RspStr );
adl_atSendStdResponsePort ( ADL_AT_RSP, para->Port, ADL_STR_CME_ERROR );
}
}
static void C2CmdHandler (adl_atCmdPreParser_t *para)
{
s8 retVal;
ascii RspStr [ 50 ];
int aux=0;
retVal = adl_fcmSwitchV24State(DataTRACE_fcmHandle, ADL_FCM_V24_STATE_AT);
aux = DataTRACE_fcmHandle;
if (retVal == OK) {
wm_sprintf ( RspStr, “Successful switch to AT mode. Handle: %d”,aux);
adl_atSendResponsePort ( ADL_AT_INT, para->Port, RspStr );
adl_atSendStdResponsePort ( ADL_AT_RSP, para->Port, ADL_STR_OK );
} else {
wm_sprintf ( RspStr, "ERROR switching to AT: %d. Handle: %d ",retVal,aux);
adl_atSendResponsePort ( ADL_AT_INT, para->Port, RspStr );
adl_atSendStdResponsePort ( ADL_AT_RSP, para->Port, ADL_STR_CME_ERROR );
}
}
static void C3CmdHandler (adl_atCmdPreParser_t *para)
{
s8 retVal;
ascii RspStr [ 50 ];
int aux=0;
retVal = adl_fcmUnsubscribe(DataTRACE_fcmHandle);
aux = DataTRACE_fcmHandle;
if (retVal == OK) {
wm_sprintf ( RspStr, “Successful unsubscribed UART. Handle: %d”,aux);
adl_atSendResponsePort ( ADL_AT_INT, para->Port, RspStr );
adl_atSendStdResponsePort ( ADL_AT_RSP, para->Port, ADL_STR_OK );
} else {
wm_sprintf ( RspStr, "ERROR unsubscribing UART: %d. Handle: %d ",retVal,aux);
adl_atSendResponsePort ( ADL_AT_INT, para->Port, RspStr );
adl_atSendStdResponsePort ( ADL_AT_RSP, para->Port, ADL_STR_CME_ERROR );
}
}
static void C4CmdHandler (adl_atCmdPreParser_t *para)
{
NMEADebugSetting = 0;
AppStarted=FALSE;
UART_GPS = ADL_PORT_NONE;
}
[/i]
DataTRACE_fcmHandle is the handle I get when GPS subscribes to UART1. I think the fourth function is not necessary but it’s a desperate try. So when I want to open the socket I do as follows:
AT+C2
OK
Successful switch to AT mode. Handle: 0
OK
//this is because in data mode i can’t unsubscribe it
AT+C3
OK
Successful unsubscribed UART. Handle:0
OK
AT+C4
So, teorically, the UART is free and unsubscribed for wip commands to subscribe them. Then I try to create a socket:
AT+CGDCONT=1,“IP”,“something”
OK
AT+CGATT=1
OK
AT+WIPCFG=1
OK
AT+WIPBR=1,6
OK
AT+WIPBR=2,6,11,“something”
OK
AT+WIPBR=2,6,0,“something”
OK
AT+WIPBR=2,6,1,“something”
OK
AT+WIPBR=4,6,0
OK
AT+WIPCREATE=2,1,“someIP”,5678
+WIPREADY: 2,1
Until here everything OK, but then
AT+WIPDATA=2,1,1
+CME ERROR: 846
Wich is described as:
internal error: FCM subscribtion failure
Am I missing something?? Am I in the right way?? What happens??
Excuse me if it’s a silly question but I’m new in OpenAT and I’m really lost.
I hope I’ve explained well enough my problem, I’m not english.
Thank you very much in advance