4 ms·
So how would you send a single non-zero byte this way? Or is that why you need the zero byte to delimit your messages? Also it seems that if you wanted to pause
by layoutIfNeeded 6y ago
So how would you send a single non-zero byte this way? Or is that why you need the zero byte to delimit your messages? Also it seems that if you wanted to pause your transmission you can’t really “flush” the incomplete COBS frame unless it happens to end with a zero...
- lifthrasiir 6y ago> COBS first takes its input data and logically appends a single zero byte. (It is not necessary actually to add this zero byte to the end of the packet in memory; the encoding routine simply has to behave as if the added zero were there.) So it's `02 xx`. By the way, a single zero byte would be `01 01`.
- layoutIfNeeded 6y agoAh, thanks, I've missed that part.
- jevinskie 6y agohttps://github.com/cmcqueen/cobs-python/blob/68cebe6b49dfa196773c8ae7c9fd6b3c9a52b11e/python3/cobs/cobs/test.py#L32-L47 https://github.com/cmcqueen/cobs-python/blob/68cebe6b49dfa19...
- geeB 6y agoAs per the siblings, the encoding for that would be 02 xx (also figure 1 in the paper). As for delimiters, it's not so much that to use COBS you need the delimiter, but the causality usually goes the other way, i.e. you want to send packets over an unreliable stream where every symbol is valid data, so you use 00 as the packet delimiter, and encode the actual packets with COBS (so the encoded packets won't have zeros). So in general you won't need to "flush" partial data, because the natural way to interface to this type of channel is to send whole packets. If you don't know in what state the channel is, you can always send out a 00 before the start of packet to make sure the previous packet gets terminated. And usually the packets themselves will have some additional validation like CRC, so the previous incomplete packet will be ignored.