|
SatCat5
|
The PacketCombiner class combines packets written to it into a single packet, and forwards it to a Writeable destination.
The write is finalized when the destination is full.
An optional timeout can be enabled using set_timeout() to force the data to be forwarded after a period of time regardless of whether the destination is full.
Definition at line 24 of file pkt_combiner.h.
#include <pkt_combiner.h>
Public Member Functions | |
| PacketCombiner (satcat5::io::Writeable *dst, u8 *buff, unsigned buffbytes) | |
| Create an object that combines packets. | |
| void | send_now () |
| Send the buffer now. | |
| void | set_timeout (unsigned msec) |
| Set a timeout for automatic data forwarding after a period, if the buffer is not yet full. More... | |
| unsigned | get_write_space () const override |
| How many bytes can be written without blocking? More... | |
| void | write_abort () override |
| If possible, abort the current partially-written packet. More... | |
| void | write_bytes (unsigned nbytes, const void *src) override |
| Write 0 or more bytes from a buffer. More... | |
| bool | write_finalize () override |
| Mark end of frame and release temporary working data. More... | |
| void | write_u8 (u8 data) |
| One of many functions for writing integer/floating point values, see details. More... | |
| void | write_str (const char *str) |
| Write the contents of a null-terminated string. More... | |
| template<class T > | |
| void | write_obj (const T &obj) |
Templated wrapper for any object with the following method: void write_to(satcat5::io::Writeable* wr) const; | |
| virtual void | data_unlink (satcat5::io::Readable *src) |
| Unlink this EventListener from the designated source, because the designated Readable object is being destroyed. More... | |
| void | timer_once (unsigned msec) |
| Configure a one-time notification after X milliseconds. | |
| void | timer_every (unsigned msec) |
| Configure a repeating notification every X milliseconds. | |
| void | timer_stop () |
| Stop all future notifications. | |
| unsigned | timer_interval () const |
| Accessor for recurring timer interval, if one is set. | |
| unsigned | timer_remaining () const |
| Accessor for time to next event, if one is set. | |
Static Public Member Functions | |
| static unsigned | count_timer () |
| Count all objects of this type, including idle timers. | |
Protected Member Functions | |
| void | data_rcvd (satcat5::io::Readable *src) override |
| The data_rcvd() callback is polled whenever data is available. More... | |
| void | timer_event () override |
| Child class MUST override this method. | |
| void | write_next (u8 data) override |
| Write the next byte to the underlying buffer or device. More... | |
| void | write_overflow () override |
| Optional error handling for write overflow. More... | |
| void | write_dst (satcat5::io::Writeable *dst) |
Protected Attributes | |
| satcat5::io::Writeable * | m_dst |
| satcat5::io::PacketBuffer | m_buff |
| unsigned | m_timeout |
| friend | WriteableRedirect |
| friend | LimitedWrite |
| friend | WriteableBroadcast |
Private Member Functions | |
| void | query (unsigned elapsed_msec) |
Private Attributes | |
| satcat5::poll::Timer * | m_next |
| unsigned | m_trem |
| unsigned | m_tnext |
|
overrideprotectedvirtual |
The data_rcvd() callback is polled whenever data is available.
A pointer is provided to assist handlers with multiple sources. Child objects of io::EventListener MUST override this method.
Implements satcat5::io::EventListener.
Definition at line 39 of file pkt_combiner.cc.
|
inlinevirtualinherited |
Unlink this EventListener from the designated source, because the designated Readable object is being destroyed.
Child objects of io::EventListener MAY override this method if action is required.
Reimplemented in satcat5::io::Override, satcat5::io::MuxUp, satcat5::io::MuxDown, satcat5::io::BufferedPackets, satcat5::io::BufferedStream, satcat5::io::BufferedCopy, satcat5::eth::SwitchLogReader, satcat5::eth::Dispatch, satcat5::ccsds_spp::Dispatch, satcat5::ccsds_aos::Dispatch, satcat5::ccsds_aos::Channel, satcat5::test::MockOffload::Port, and satcat5::freertos::MessageCopy.
Definition at line 54 of file io_readable.h.
|
overridevirtualinherited |
How many bytes can be written without blocking?
Child objects of io::Writeable MUST override this method.
Implements satcat5::io::Writeable.
Definition at line 236 of file io_writeable.cc.
| void PacketCombiner::set_timeout | ( | unsigned | msec | ) |
Set a timeout for automatic data forwarding after a period, if the buffer is not yet full.
A timeout of zero disables this function.
Definition at line 30 of file pkt_combiner.cc.
|
overridevirtualinherited |
If possible, abort the current partially-written packet.
Child objects of io::Writeable SHOULD override this method if it is practical to prevent in-progress data from being relayed downstream.
Reimplemented from satcat5::io::Writeable.
Definition at line 239 of file io_writeable.cc.
|
overridevirtualinherited |
Write 0 or more bytes from a buffer.
Child objects of io::Writeable MAY override write_bytes as needed for performance.
Reimplemented from satcat5::io::Writeable.
Definition at line 242 of file io_writeable.cc.
|
overridevirtualinherited |
Mark end of frame and release temporary working data.
Child objects of io::Writeable SHOULD override this method to mark frame bounds.
Reimplemented from satcat5::io::Writeable.
Definition at line 245 of file io_writeable.cc.
|
overrideprotectedvirtualinherited |
Write the next byte to the underlying buffer or device.
Child objects of io::Writeable MUST override this method.
Implements satcat5::io::Writeable.
Definition at line 248 of file io_writeable.cc.
|
overrideprotectedvirtualinherited |
Optional error handling for write overflow.
Child objects of io::Writeable MAY override this method for error handling.
Reimplemented from satcat5::io::Writeable.
Definition at line 251 of file io_writeable.cc.
|
inherited |
Write the contents of a null-terminated string.
Note: Null-termination is not copied to the output.
Definition at line 180 of file io_writeable.cc.
|
inherited |
One of many functions for writing integer/floating point values, see details.
Several functions are provided for reading and writing scalar types to/from io::Readable and io::Writeable instances. Since there are many of these that are frequently inherited, they are hidden from documentation. These functions follow a shared template:
read_ or write_ prefix.u for unsigned, s for signed, f for floating-point.l suffix if little-endian, no suffix if big-endian.Example: write_s48l is "Write 48 bits (6 bytes) to this
io::Writeable as a signed value in little-endian order".
Definition at line 20 of file io_writeable.cc.