SatCat5
satcat5::io::MuxDown Class Reference

Detailed Description

Multiplexer connecting a port to one of several controllers.

An example usage is operating a specific UART port in one of several different modes.

Multiplexers for selecting one of several I/O interfaces. We define a "port" as a Readable pointer paired with a Writeable pointer, representing input from and output to the same logical interface. Examples include a UART (cfg::Uart), or a MailMap object (port::Mailbox), or a UDP socket (udp::Socket).

A "controller" is anything that attaches to a port and begins issuing read and write commands, such as an Ethernet network interface (eth::Dispatch) or a port adapter (port::MailAdapter, port::SlipAdapter). Some objects act as both a port and a controller, such as BufferedIO (io::BufferedIO).

Definition at line 51 of file io_multiplexer.h.

#include <io_multiplexer.h>

Inheritance diagram for satcat5::io::MuxDown:
[legend]
Collaboration diagram for satcat5::io::MuxDown:
[legend]

Public Member Functions

void select (unsigned idx)
 Select the active controller index, or UINT_MAX for none.
 
satcat5::io::Readableport_rd (unsigned idx)
 Fetch the interface pointer for attaching the Nth controller.
 
satcat5::io::Writeableport_wr (unsigned idx)
 Fetch the interface pointer for attaching the Nth controller.
 

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...
 
 MuxDown (unsigned size, satcat5::io::MuxPort *ports, satcat5::io::Readable *src, satcat5::io::Writeable *dst)
 Constructor and destructor should only be called by children.
 
 ~MuxDown () SATCAT5_OPTIONAL_DTOR
 Constructor and destructor should only be called by children.
 

Protected Attributes

const unsigned m_size
 
unsigned m_index
 
satcat5::io::MuxPort *const m_ports
 
satcat5::io::Readablem_src
 
satcat5::io::Writeable *const m_dst
 

Member Function Documentation

◆ data_rcvd()

void MuxDown::data_rcvd ( satcat5::io::Readable src)
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 40 of file io_multiplexer.cc.

◆ data_unlink()

void MuxDown::data_unlink ( satcat5::io::Readable src)
overrideprotectedvirtual

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 45 of file io_multiplexer.cc.


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