i’m using mc60 and OpenCPU for my project and now i’m trying to write a custom function for GPRS and socket with ril API (Ql_RIL_SendATCmd).
there’s a question that how can i use this function for command ‘AT+QISEND=’ ?
after that i’m sending this command i got ‘>’ and app is waiting for data but i can’t find any function to send data.
Maybe you can just put the data in the sendATCmd
without AT+…QI_RIL_SendATCmd(Data_string, len_of_data, Calback_if_need, NULL, time_for_wate)…
I am doing a similar task now, but have not done so yet.
Hi Mohammad ,
If you are using OCPU then it would always be better to use the APIs of TCP for sending DATA .
you can efere example_tcpclient.c .
In case you want to send data after the QISEND then best option is to use Ql_UARTWriet() instead of send AT command API .
I hope this will help you .
Again I will ask to use APIs of TCP instead of using AT command .,
Best of luck for your project .
Thank you dear Allapan for your replay
I got an error when i used QI_RIL_SendATCmd function to send data.
I wrote the code below and that was worked for me:
typedef struct
{
uint16_t len;
uint8_t data[2048];
}xGPRSData_t;
bool GPRS_Send(xGPRSData_t *data)
{
char pstrBuff[128]={0};
int AtHeadlen = Ql_sprintf(pstrBuff,"AT+QISEND=%d",data->len); // Active Gprs
if(Ql_RIL_SendATCmd(pstrBuff, AtHeadlen, QGPRS_QISENDResponse_Handler, data, (30000))!=RIL_ATRSP_SUCCESS)
{
debug("Er: AT+QISEND");
return false;
}
return true;
}
static s32 QGPRS_QISENDResponse_Handler(char* line, u32 len, void* userData)
{
xGPRSData_t *xdata =(xGPRSData_t*) userData;
//debug("$S %s -> %i",line,len);
if (Ql_RIL_FindString(line, len, ">"))
{
Ql_RIL_WriteDataToCore(xdata->data,xdata->len);
return RIL_ATRSP_CONTINUE; //continue wait
}
else if (Ql_RIL_FindLine(line, len, "SEND OK"))
{
return RIL_ATRSP_SUCCESS;
}
else if (Ql_RIL_FindLine(line, len, "ERROR"))
{
return RIL_ATRSP_FAILED;
}
else if (Ql_RIL_FindString(line, len, "+CME ERROR"))
{
return RIL_ATRSP_FAILED;
}
else if (Ql_RIL_FindString(line, len, "SEND FAIL"))
{
return RIL_ATRSP_FAILED;
}
return RIL_ATRSP_CONTINUE; //continue wait
}
Hi Ratan,
Thank you for your replay.
Yes, i use OCPU, when i use OCPU TCP API’s in thread, my app go to reset after a few hours,
but when use that code in timer work with out problem
I think this API(SDK V1.6) has bug.
Thanks for your work. I think it will be very useful for me.