Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::StreamTransport Class Reference

Collects the objects needed to support streams on an OpenLCB interface. More...

#include <StreamTransport.hxx>

Inheritance diagram for openlcb::StreamTransport:
Destructable openlcb::StreamTransportCan

Public Member Functions

 StreamTransport (If *iface)
 Constructor.
 
 ~StreamTransport ()
 Destructor.
 
uint8_t get_send_stream_id ()
 
void release_send_stream_id (uint8_t stream_id)
 
TypedQAsync< StreamSender > * sender_allocator ()
 Stream sender flows.
 
uint8_t get_next_stream_receive_id ()
 

Protected Attributes

TypedQAsync< StreamSendersenders_
 Stream Sender objects.
 
uint8_t nextReceiveStreamId_ {0x50}
 Stream ID to be given out to the next stream receiver that we create.
 

Private Attributes

unsigned inUseSendStreamIds_: 27
 Bits are 1 if the respective stream ID is in use (for transmit streams).
 
unsigned nextSendStreamId_: 5
 Index of the next bit to check in the inUseSendStreamIds_.
 

Static Private Attributes

static constexpr uint8_t MAX_SEND_STREAM_ID = 26
 Largest stream ID we will be using for transmit stream's local IDs.
 

Detailed Description

Collects the objects needed to support streams on an OpenLCB interface.

Definition at line 51 of file StreamTransport.hxx.

Constructor & Destructor Documentation

◆ StreamTransport()

openlcb::StreamTransport::StreamTransport ( If iface)

Constructor.

Parameters
ifaceOpenLCB interface object.

Definition at line 42 of file StreamTransport.cxx.

◆ ~StreamTransport()

openlcb::StreamTransport::~StreamTransport ( )

Destructor.

Definition at line 49 of file StreamTransport.cxx.

Member Function Documentation

◆ get_next_stream_receive_id()

uint8_t openlcb::StreamTransport::get_next_stream_receive_id ( )
inline
Returns
the next (unused) stream receive ID (i.e., stream DID for streams that are targeting this node/interface). This should only be used for constructors, one time per lifetime of an application.

Definition at line 103 of file StreamTransport.hxx.

◆ get_send_stream_id()

uint8_t openlcb::StreamTransport::get_send_stream_id ( )
inline
Returns
an unused transmit stream source ID. If all transmit stream source IDs are in use, then returns 0xFF (which is an invalid stream ID).

Definition at line 65 of file StreamTransport.hxx.

◆ release_send_stream_id()

void openlcb::StreamTransport::release_send_stream_id ( uint8_t  stream_id)
inline
Parameters
stream_ida transmit stream source ID which was previously allocated using { } and no longer used.

Definition at line 85 of file StreamTransport.hxx.

◆ sender_allocator()

TypedQAsync< StreamSender > * openlcb::StreamTransport::sender_allocator ( )
inline

Stream sender flows.

These flows implement transmitting streams to a rmeote destination node. When the flow is complete, the caller must return it to this allocator.

Definition at line 95 of file StreamTransport.hxx.

Member Data Documentation

◆ inUseSendStreamIds_

unsigned openlcb::StreamTransport::inUseSendStreamIds_
private

Bits are 1 if the respective stream ID is in use (for transmit streams).

Definition at line 117 of file StreamTransport.hxx.

◆ MAX_SEND_STREAM_ID

constexpr uint8_t openlcb::StreamTransport::MAX_SEND_STREAM_ID = 26
staticconstexprprivate

Largest stream ID we will be using for transmit stream's local IDs.

Definition at line 114 of file StreamTransport.hxx.

◆ nextReceiveStreamId_

uint8_t openlcb::StreamTransport::nextReceiveStreamId_ {0x50}
protected

Stream ID to be given out to the next stream receiver that we create.

Definition at line 123 of file StreamTransport.hxx.

◆ nextSendStreamId_

unsigned openlcb::StreamTransport::nextSendStreamId_
private

Index of the next bit to check in the inUseSendStreamIds_.

Definition at line 119 of file StreamTransport.hxx.

◆ senders_

TypedQAsync<StreamSender> openlcb::StreamTransport::senders_
protected

Stream Sender objects.

Definition at line 110 of file StreamTransport.hxx.


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