SatCat5
satcat5::ccsds_aos::DispatchStatic< DSIZE > Class Template Reference

Detailed Description

template<unsigned DSIZE = 251>
class satcat5::ccsds_aos::DispatchStatic< DSIZE >

Dispatch with a statically-allocated working buffer.

(Optional template parameter specifies data-field size.)

Definition at line 224 of file ccsds_aos.h.

#include <ccsds_aos.h>

Inheritance diagram for satcat5::ccsds_aos::DispatchStatic< DSIZE >:
[legend]
Collaboration diagram for satcat5::ccsds_aos::DispatchStatic< DSIZE >:
[legend]

Public Member Functions

 DispatchStatic (satcat5::io::Readable *src, satcat5::io::Writeable *dst, bool insert_sync=false)
 
satcat5::io::Writeableopen_write (const satcat5::ccsds_aos::Header &hdr)
 Write CCSDS-AOS frame header and get Writeable object.
 
satcat5::io::TrafficStats stats ()
 Report packet statistics since the previous query.
 
unsigned dsize () const
 < Data field size
 
void error_incr ()
 
unsigned tsize () const
 < Total size = Header + Data
 
const satcat5::ccsds_aos::Headerrcvd_hdr () const
 Most recent received header.
 
void add (satcat5::net::Protocol *proto)
 Register a Protocol object.
 
void remove (satcat5::net::Protocol *proto)
 Unregister a Protocol object.
 
bool bound (const satcat5::net::Type &type) const
 Check if a given net::Type has a matching Protocol.
 

Protected Member Functions

void data_rcvd (satcat5::io::Readable *src) override
 The data_rcvd() callback is polled whenever data is available. More...
 
void data_unlink (satcat5::io::Readable *src) override
 Unlink this EventListener from the designated source, because the designated Readable object is being destroyed. More...
 
bool read_sync (satcat5::io::Readable *src)
 
bool read_data (satcat5::io::Readable *src)
 
satcat5::io::Writeableopen_reply (const satcat5::net::Type &type, unsigned len) override
 Open a reply to the sender of the most recent message by writing frame header(s) and returning a stream where the caller should write frame data, then call write_finalize(). More...
 
bool deliver (const satcat5::net::Type &type, satcat5::io::Readable *src, unsigned len)
 Deliver current message by calling Protocol::frame_rcvd(...). More...
 

Protected Attributes

const unsigned m_dsize
 
const bool m_insert
 
u8 m_sync_state
 
satcat5::io::Readablem_src
 
satcat5::io::Writeable *const m_dst
 
satcat5::io::ArrayWrite m_work
 
satcat5::crc16::XmodemRx m_crc_rx
 
satcat5::crc16::XmodemTx m_crc_tx
 
satcat5::ccsds_aos::Header m_rcvd_hdr
 
satcat5::util::List< satcat5::net::Protocolm_list
 Linked list of Protocol objects.
 

Private Attributes

u8 m_raw [DSIZE+6]
 

Member Function Documentation

◆ data_rcvd()

void Dispatch::data_rcvd ( satcat5::io::Readable src)
overrideprotectedvirtualinherited

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 325 of file ccsds_aos.cc.

◆ data_unlink()

void Dispatch::data_unlink ( satcat5::io::Readable src)
overrideprotectedvirtualinherited

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 from satcat5::io::EventListener.

Definition at line 347 of file ccsds_aos.cc.

◆ deliver()

bool Dispatch::deliver ( const satcat5::net::Type type,
satcat5::io::Readable src,
unsigned  len 
)
protectedinherited

Deliver current message by calling Protocol::frame_rcvd(...).

Note: Caller is responsible for read_finalize(), if required.

Returns
True if a matching Protocol is found.

Definition at line 25 of file net_dispatch.cc.

◆ open_reply()

Writeable * Dispatch::open_reply ( const satcat5::net::Type type,
unsigned  len 
)
overrideprotectedvirtualinherited

Open a reply to the sender of the most recent message by writing frame header(s) and returning a stream where the caller should write frame data, then call write_finalize().

The length argument is the number of bytes that will be written by the caller. (IPv4 and UDP require this information up-front.)

Returns zero if sending a reply is not currently possible.

Child MUST implement this method. Child SHOULD also provide an equivalent open_write(...) method for sending messages to other recipients, when practical. Child MAY ignore the "type" argument at its discretion.

Implements satcat5::net::Dispatch.

Definition at line 307 of file ccsds_aos.cc.


The documentation for this class was generated from the following file: