Skip to content

Class jac::Mux

template <class Encoder class Encoder>

ClassList > jac > Mux

A multiplexer that creates 256 channels on a single stream connection. More...

  • #include <mux.h>

Inherits the following classes: jac::DataLinkTx

Public Functions

Type Name
Mux (std::unique_ptr< Duplex > stream)
Mux (const Mux &) = delete
Mux (Mux &&) = delete
void bindRx (std::unique_ptr< DataLinkRx > receiver)
Bind a receiver to this mux. Received packets will be forwarded to the receiver.
virtual std::unique_ptr< Packet > buildPacket (uint8_t channel) override
Build a packet for the given channel.
virtual size_t maxPacketSize () override const
Get the maximum packet size for this mux.
void setErrorHandler (std::function< void(MuxError, std::any)> handler)
Set the error handler for this mux.

Public Functions inherited from jac::DataLinkTx

See jac::DataLinkTx

Type Name
DataLinkTx () = default
DataLinkTx (const DataLinkTx &) = delete
DataLinkTx (DataLinkTx &&) = delete
virtual std::unique_ptr< Packet > buildPacket (uint8_t channel) = 0
Build a packet for the given channel.
virtual size_t maxPacketSize () const = 0
Get the maximum packet size for the given channel.
DataLinkTx & operator= (const DataLinkTx &) = delete
DataLinkTx & operator= (DataLinkTx &&) = delete

Detailed Description

Template parameters:

  • Encoder the encoder to use

Public Functions Documentation

function Mux [1/3]

inline jac::Mux::Mux (
    std::unique_ptr< Duplex > stream
) 

function Mux [2/3]

jac::Mux::Mux (
    const Mux &
) = delete

function Mux [3/3]

jac::Mux::Mux (
    Mux &&
) = delete

function bindRx

Bind a receiver to this mux. Received packets will be forwarded to the receiver.

inline void jac::Mux::bindRx (
    std::unique_ptr< DataLinkRx > receiver
) 

Parameters:

  • receiver the receiver to bind

function buildPacket

Build a packet for the given channel.

inline virtual std::unique_ptr< Packet > jac::Mux::buildPacket (
    uint8_t channel
) override

Parameters:

  • channel the channel

Returns:

The packet

Implements jac::DataLinkTx::buildPacket

function maxPacketSize

Get the maximum packet size for this mux.

inline virtual size_t jac::Mux::maxPacketSize () override const

Returns:

The maximum packet size

Implements jac::DataLinkTx::maxPacketSize

function setErrorHandler

Set the error handler for this mux.

inline void jac::Mux::setErrorHandler (
    std::function< void(MuxError, std::any)> handler
) 

Parameters:

  • handler the error handler

The documentation for this class was generated from the following file src/jac/link/mux.h