What does Toybox.Ant.Message.length mean?
public function onMessage(msg as Message) as Void {
var payload = msg.getPayload() as Array<Number>;
log("0x" + msg.messageId.format("%02X") + payload2hex(payload) + ", l:" + msg.length);
}
hidden function payload2hex(payload as Array<Number>) as Void {
var hex = "[";
for (var i = 0; i < payload.size(); i++) {
if (i > 0) {
hex += ",";
}
hex += (payload[i] & 0xFF).format("%02X");
}
hex += "]";
return hex;
}
I get results like:
0x40[01,02,2E,62,CB,2D,70,60], l:3
0x4E[04,00,B2,BF,E0,C2,32,49], l:19
why the message length is 3 or 19 when the payload.size() is 3 or 19?