MultiTech's official mbed team.

[mDot][AT] +RECV command should not use the payload buffer as a string

28 Jun 2017

This post is about the Dot-AT-Firmware project.

The AT+RECV command in the CmdReceiveOnce.cpp file transform the payload uint8_t buffer to a string to print the payload in the serial communication.

Concerned line

CommandTerminal::Serial()->writef("%s\r\n", CommandTerminal::formatPacketData(data, CommandTerminal::Dot()->getRxOutput()).c_str());

The problem with that is when the payload has the data 0x00 in it. Indeed, the AT+RECV command will stop to print data when one occurence of 0x00 is reached even if there is other bytes to read after. It is something that can happen often in a payload buffer. The solution would be to replace the concerned line by this:

Correction

for (size_t i = 0; i < data.size(); i++) {
    CommandTerminal::Serial()->writef("%c", data[i]);
}
CommandTerminal::Serial()->writef("\r\n");

You should add this fix to the Dot-AT-Firmware project for user like me that want read all the payload.

Regards, Julien