Basic interface¶
The framing methods are exposed through the PacketPrint and PacketStream interfaces.
-
class
packetio::
PacketPrint
: public Print¶ Augments arduino’s Print to add knowledge of packets.
Acts like a new Print for each packet. To stop printing to the current packet, and send new prints to the next one, call :func:end
This only concerns itself with the read parts of stream, and should not be used for writing.
Subclassed by packetio::COBSPrint, packetio::EscapedPrint< EscapeCodes >
-
class
packetio::
PacketStream
: public Stream¶ Augments arduino’s Stream to add knowledge of packets.
Acts like a new stream for each packet, but instead of returning EOF when the packet is over, it returns EOP. EOF is returned when there is nothing to read, but the packet is not complete.
This only concerns itself with the read parts of stream, and should not be used for writing.
Subclassed by packetio::COBSStream, packetio::EscapedStream< EscapeCodes >
Public Functions
-
virtual int
read
() = 0¶ Read a single byte from the current packet.
- Return
- The byte if available EOF if we have reached the end of the stream EOP if the current packet is complete
-
virtual int
peek
() = 0¶ Peek the next byte from the current packet.
- Return
- The byte if available EOF if we have reached the end of the stream EOP if the current packet is complete
-
virtual int
available
() = 0¶ - Return
- A lower bound on the number of bytes available. This count includes the EOP return value.
-
virtual int