32 bool write_max_age =
true)
43 u8 type,
Code code, u16 msg_id,
44 u64 token = 0, u8 tkl = 0);
54 bool write_option(u16
id,
unsigned len,
const void* data);
72 bool write_optid(u16
id,
unsigned len);
73 void write_varint(u64 x,
unsigned len);
74 void insert_max_age(u16 next_id = 0);
CoAP request/response handling for a single client-server connection.
Message formatting for the Constrained Applications Protocol (CoAP).
constexpr Writer(satcat5::io::Writeable *dst, bool write_max_age=true)
Create this object and set the destination.
bool write_uri(u16 id, const char *str)
Convert a URI to consecutive Uri-Path options.
bool m_insert_max_age
Add Max-Age=0 to disable caching.
bool ready() const
Is this object ready for writing? Note: This is the only safe method if m_dst is null.
bool write_finalize()
After the last option, finish with an empty message.
bool write_option(u16 id, unsigned len, const void *data)
Write option(s) one at a time, in various formats.
satcat5::io::Writeable * write_data()
After the last option, start writing message data.
bool write_header(u8 type, Code code, u16 msg_id, u64 token=0, u8 tkl=0)
Always start by writing the header, with optional token.
u16 m_last_opt
Previous option-ID.
Abstract API for writing byte-streams and packets.
virtual unsigned get_write_space() const =0
How many bytes can be written without blocking?
virtual bool write_finalize()
Mark end of frame and release temporary working data.
Constants relating to the Constrained Applications Protocol (CoAP)
Message parsing for the Constrained Applications Protocol (CoAP)
"Writeable" I/O interface core definitions
CoAP message header CODE field (Section 12.1).