50 unsigned byte_count(
bool reset =
true)
override;
57 inline void frame_incr(
unsigned incr)
59 inline void error_incr(
unsigned incr)
87 void write_bytes(
unsigned nbytes,
const void* src)
override;
Define a generic API for reporting traffic statistics.
virtual unsigned error_count(bool reset=true)
(Optional) Error events since the last query.
virtual unsigned frame_count(bool reset=true)=0
Frames transferred since the last query.
virtual unsigned byte_count(bool reset=true)=0
Bytes transferred since the last query.
Overlay class for adding counters to any Writeable interface.
void write_next(u8 data) override
Write the next byte to the underlying buffer or device.
bool write_finalize() override
Mark end of frame and release temporary working data.
constexpr CounterInline(satcat5::io::Writeable *dst)
Link this object to its ultimate destination.
void write_abort() override
If possible, abort the current partially-written packet.
void write_bytes(unsigned nbytes, const void *src) override
Write 0 or more bytes from a buffer.
Simple implementation of the Counter API.
unsigned m_err_ct
Cumulative error count.
unsigned error_count(bool reset=true) override
(Optional) Error events since the last query.
unsigned m_frm_ct
Cumulative frame count.
unsigned frame_count(bool reset=true) override
Frames transferred since the last query.
constexpr CounterSimple()
Constructor is only accessible to the child object.
unsigned m_frm_len
Length of current frame.
void byte_incr(unsigned incr)
Increment any of the internal counters.
unsigned byte_count(bool reset=true) override
Bytes transferred since the last query.
unsigned m_byte_ct
Cumulative byte count.
Abstract API for writing byte-streams and packets.
Wrapper class for forwarding writes to another object.
"Writeable" I/O interface core definitions
Data structure for combined transmit and receive statistics.
bool any() const
Nonzero activity on any of the counters?
unsigned rcvd_bytes
Bytes received from remote device.
static TrafficStats query(satcat5::io::Counter &rx, satcat5::io::Counter &tx)
Read updated statistics from a transmit/receive pair.
unsigned sent_frames
Frames sent to remote device.
unsigned sent_bytes
Bytes sent to remote device.
unsigned rcvd_errors
Invalid frames received from device.
unsigned rcvd_frames
Valid frames received from device.