Hi, I’m trying to record the data from the SMS like this:
/* We get a -1. This means that there is some problem in the received SMS and actual
error has been copied in the DataBuffer. We just need to send the response SMS to
the number present in the phoneNum array */
case BAD_PARAM_OR_CONFIG:
adl_tmrSubscribe(FALSE,TimerValue,ADL_TMR_TYPE_100MS,SendRespSMS);
bRet = FALSE;
break;
/* We get a 3. This means that the configuration SMS is correct and we need to use IP
as the bearer for making the connection. */
case USE_IP_BEARER:
adl_atSendResponse(ADL_AT_RSP,"Espacio en Flash:\r\n");
PrintCurrentAvailableMem();
/* Subscribe flash ID */
subscripcion = adl_flhSubscribe((ascii *)FlashHandle_1, MAX_OBJ_IDS);
TRACE((2,"Subscribe to flash = %d",subscripcion));
/* Get the count of IDs and print the same */
wm_sprintf(RspBuffer,"\r\nCurrent Count of Flash: %d\r\n", adl_flhGetIDCount((ascii *)FlashHandle_1));
/* Send the response */
adl_atSendResponsePort(ADL_AT_UNS,CurrentPort, RspBuffer);
/* Step 4: Print the current memory status */
PrintCurrentAvailableMem();
if (subscripcion== ADL_RET_ERR_ALREADY_SUBSCRIBED){
TRACE((2,"Subscribe to flash = %d",sRet));
adl_atSendResponse(ADL_AT_RSP,"OK, SUBSCRITO A FLAHS\r\n");
IPLength = adl_flhExist((ascii *)FlashHandle_1, IP);
//SI NO EXISTE EL OBJETO
if (IPLength==OK){
wm_sprintf(IpAddr, "IP%d\r\n", IP);//LO ESCRIBO
escribirIp=adl_flhWrite((ascii *)FlashHandle_1, IP, wm_strlen(IpAddr)+1, (u8 *)IpAddr);
if(escribirIp==OK){//SI ESCRIBE BIEN
adl_atSendResponse(ADL_AT_RSP,"\nObjeto Escrito correctamente\r\n");
TRACE((3,"Write to flash,OBJ%d",IP));
IPLength = adl_flhExist((ascii *)FlashHandle_1, IP);
TRACE((3,"El valor de la longitud del obj%d es:%d",IP,IPLength));
/* Print the current memory status */
PrintCurrentAvailableMem();
}
else{//SI NO ESCRIBE BIEN
adl_atSendResponse(ADL_AT_RSP,"Objeto no escrito correctamente\r\n");
TRACE((3,"NO Write to flash, OK = %d",escribirIp));
if (sRet == ADL_RET_ERR_PARAM)
adl_atSendResponse ( ADL_AT_UNS, "\r\n Un parametro es erroneo\r\n");
else if (sRet == ADL_RET_ERR_UNKNOWN_HDL)
adl_atSendResponse ( ADL_AT_UNS, "\r\n Handle desconocida\r\n");
else if (sRet == ADL_FLH_RET_ERR_ID_OUT_OF_RANGE)
adl_atSendResponse ( ADL_AT_UNS, "\r\n Id fuera de rango\r\n");
else if (sRet == ADL_FLH_RET_ERR_OBJ_NOT_EXIST)
adl_atSendResponse ( ADL_AT_UNS, "\r\n El objeto no existe\r\n");
}
}
This to save the ip for example.
And then to read it to start the application running:
/* Subscribe flash ID */
subscripcion = adl_flhSubscribe((ascii *)FlashHandle_1, MAX_OBJ_IDS);
/* Check if the SIM pin is available in the object area */
if (subscripcion == ADL_RET_ERR_ALREADY_SUBSCRIBED)
{
// LEER IP
s32 ipLength=0;
/* Check the length of the SIM PIN */
ipLength = adl_flhExist((ascii *)FlashHandle_1, IP);
if (ipLength > 0)
{
/* Read from the flash */
sRet=adl_flhRead((ascii *)FlashHandle_1, IP, ipLength,(u8 *) IpAddr);
if (sRet == OK){
adl_atSendResponse ( ADL_AT_UNS, "\r\n Ip leida correctamente\r\n");
contador++;
TRACE (( APP_MSG_TRACE_LEVEL, "Flash Write return value is: %d", subscripcion ));
}
else {//SI NO LEE BIEN
adl_atSendResponse(ADL_AT_RSP,"NO LEIDO objeto\r\n");
TRACE((3,"NO read from flash = %d",sRet));
if (sRet == ADL_RET_ERR_PARAM)
adl_atSendResponse ( ADL_AT_UNS, "\r\n Un parametro es erroneo\r\n");
else if (sRet == ADL_RET_ERR_UNKNOWN_HDL)
adl_atSendResponse ( ADL_AT_UNS, "\r\n Handle desconocida\r\n");
else if (sRet == ADL_FLH_RET_ERR_ID_OUT_OF_RANGE)
adl_atSendResponse ( ADL_AT_UNS, "\r\n Id fuera de rango\r\n");
else if (sRet == ADL_FLH_RET_ERR_OBJ_NOT_EXIST)
adl_atSendResponse ( ADL_AT_UNS, "\r\n El objeto no existe\r\n");
}
//adl_simSubscribe(SimHandler, FlashPin);
}
else
{
adl_atSendResponse ( ADL_AT_UNS, "\r\n No hay IPS\r\n");
}
// FIN LECTURA IP
For example to read the ip.
After reading all the data i start the ipbearer but I do not think that sends the data to the server. What I do wrong?