Send binary data command is split into two steps:
Take the socket send command of reference port BG96 for example:
The first step sends the command "AT+QISEND=0,5" and waiting for the response "> ".
">" is a result code in the port to indicate that modem is ready to accept the binary data.
The second step send the binary data "test2" to the modem and waits for the response "SEND OK".
"SEND OK" is a result code in the port to indicate the modem successfully receives the data.
One thing to mentioned in the example is that cellular interface processes the response in line. The respone "> " does not contain line ending char. Cellular interface passes the response to the port through data send prefix callback function. The port may fix the input stream in the callback function. In this example, the response is fixed to ">\n" in the callback. Cellular interface can process the fixed input stream.
_Cellular_AtcmdDataSend is the general cellular common API to send binary data to cellular modem. BG96 port make use of this API to send binary data with the following parameters:
To adapt with various cellular modems AT command, cellular interface provides the following APIs in common layer to send binary stream to modem:
HL7802 socket send command reference port example
SARA-R4 socket send command reference port example