This stores the number of valid bytes in lastread. Having access to this
information allows transmitting binary data as well, containing embedded
nul bytes.
The lastread array stores the data bytes of the most recently read
received packet. It was previously declared as an array of pointers to
uint8_t, instead of an array of uint8_t, which obviously was not the
intention. Because the examples explicitely cast to (char*) for printing
(because Print::println(uint8_t[]) is not defined) and a pointer is at
least as big as uint8_t and memcpy uses void*, this problem did not show
up before.
This method contained a loop that checked for an existing subscription,
but it only printed a debug message if so. Now, it immediately returns
true if the subscription is already registered.
When this method succesfully adds a subscription, it was documented to
return true, but the actual code did not return anything in this case,
resulting in a compiler warning. In practice, on AVR, the value of the
first argument would be returned, which likely evaluates as true, so
it is likely it actually seemed to work fine.
The payload data is never modified by the library, so using const is
possible without any further changes. Using const allows using a string
literal, or String::c_str() as the payload.