Hi,
Today I want to talk about how to use cellular api simply. OK, follow our guide of developer website:
https://doc.rakwireless.com/developer-tools/developer-tools/-
In cellular part, the most important api is:
- RUI_RETURN_STATUS rui_cellular_send(uint8_t *cmd)
- RUI_RETURN_STATUS rui_cellular_response(uint8_t *rsp, uint32_t len, uint32_t timeout)
The rui_cellular_send is for sending AT command to BG96 with Quectel format, not send data to any server.You could use like:
rui_cellular_send(“ATI”)
The rui_cellular_response is for recieving AT response from BG96 with Quectel format. You can use like:
uint8_t tmp[256] = {0};
rui_cellular_send(“AT+CPIN?”);
rui_cellular_response(tmp, 256, 1000);
The timeout depends on different AT response time of BG96. All log about this part will send via uart, usb, RTT log. So do not use rui_uart_send send response to uart anymore.
OK, end here today!!
Notes:
If AT of bg96 is like this:
AT+QIOPEN=1,0,“TCP”,"","",0,1
This command will response soon:
OK
And then responese severals seconds if connected ok!!:
+QIOPEN:0,0
So you should do as below:
rui_cellular_send(“AT+QIOPEN=1,0,“TCP”,“ip”,“port”,0,1”)
rui_cellular_response(tmp, 256, 1000);// wait ok
memset(tmp,0,256);
rui_cellular_response(tmp, 256, 10000);//wait for next!!!
It is the same with all AT of BG96 responses more than once!!!