Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::GenMessage Struct Reference

This class is used in the dispatching of incoming or outgoing NMRAnet messages to the message handlers at the protocol-agnostic level (i.e. More...

#include <If.hxx>

Public Types

enum  DstFlags { WAIT_FOR_LOCAL_LOOPBACK = 1 , DSTFLAG_NOT_FIRST_MESSAGE = 2 , DSTFLAG_NOT_LAST_MESSAGE = 4 }
 
enum  SrcFlags
 
typedef uint32_t id_type
 

Public Member Functions

void clear ()
 
void reset (Defs::MTI mti, NodeID src, NodeHandle dst, string payload)
 
void reset (Defs::MTI mti, NodeID src, string payload)
 
unsigned get_flags_src ()
 
unsigned get_flags_dst ()
 
void set_flag_src (unsigned flags)
 
void clear_flag_src (unsigned flags)
 
bool has_flag_src (unsigned flags)
 Returns true if src flags has all the specified flags set.
 
void set_flag_dst (unsigned flags)
 
void clear_flag_dst (unsigned flags)
 
bool has_flag_dst (unsigned flags)
 Returns true if src flags has all the specified flags set.
 
id_type id () const
 
unsigned priority ()
 Returns the NMRAnet-defined priority band, in the range of 0..3.
 

Public Attributes

NodeHandle src
 Source node.
 
NodeHandle dst
 Destination node.
 
Defs::MTI mti
 OpenLCB MTI of the incoming message.
 
NodedstNode
 If the destination node is local, this value is non-NULL.
 
string payload
 Data content in the message body.
 
unsigned flagsSrc: 4
 
unsigned flagsDst: 4
 

Detailed Description

This class is used in the dispatching of incoming or outgoing NMRAnet messages to the message handlers at the protocol-agnostic level (i.e.

not CAN or TCP-specific).

TODO(balazs.racz) There shall be one instance of this class that will be sent to all handlers that expressed interest in that MTI. When all those handlers are done, the instance should be freed. Currently the instance is copied by the dispatcher separately for each handler.

Definition at line 71 of file If.hxx.

Member Typedef Documentation

◆ id_type

typedef uint32_t openlcb::GenMessage::id_type

Definition at line 144 of file If.hxx.

Member Enumeration Documentation

◆ DstFlags

Enumerator
WAIT_FOR_LOCAL_LOOPBACK 

Specifies that the stack should wait for the local loopback processing before invoking the done notifiable.

DSTFLAG_NOT_FIRST_MESSAGE 

Signals to the stack that we need to set the continuation bits in the outgoing message to indicate that this is not the first frame of a message.

DSTFLAG_NOT_LAST_MESSAGE 

Signals to the stack that we need to set the continuation bits in the outgoing message to indicate that this is not the last frame of a message.

Definition at line 156 of file If.hxx.

◆ SrcFlags

enum openlcb::GenMessage::SrcFlags

Definition at line 170 of file If.hxx.

Constructor & Destructor Documentation

◆ GenMessage()

openlcb::GenMessage::GenMessage ( )
inline

Definition at line 73 of file If.hxx.

Member Function Documentation

◆ clear()

void openlcb::GenMessage::clear ( )
inline

Definition at line 76 of file If.hxx.

◆ clear_flag_dst()

void openlcb::GenMessage::clear_flag_dst ( unsigned  flags)
inline

Definition at line 136 of file If.hxx.

◆ clear_flag_src()

void openlcb::GenMessage::clear_flag_src ( unsigned  flags)
inline

Definition at line 126 of file If.hxx.

◆ get_flags_dst()

unsigned openlcb::GenMessage::get_flags_dst ( )
inline

Definition at line 120 of file If.hxx.

◆ get_flags_src()

unsigned openlcb::GenMessage::get_flags_src ( )
inline

Definition at line 117 of file If.hxx.

◆ has_flag_dst()

bool openlcb::GenMessage::has_flag_dst ( unsigned  flags)
inline

Returns true if src flags has all the specified flags set.

Definition at line 140 of file If.hxx.

◆ has_flag_src()

bool openlcb::GenMessage::has_flag_src ( unsigned  flags)
inline

Returns true if src flags has all the specified flags set.

Definition at line 130 of file If.hxx.

◆ id()

id_type openlcb::GenMessage::id ( ) const
inline

Definition at line 145 of file If.hxx.

◆ priority()

unsigned openlcb::GenMessage::priority ( )
inline

Returns the NMRAnet-defined priority band, in the range of 0..3.

Definition at line 151 of file If.hxx.

◆ reset() [1/2]

void openlcb::GenMessage::reset ( Defs::MTI  mti,
NodeID  src,
NodeHandle  dst,
string  payload 
)
inline

Definition at line 81 of file If.hxx.

◆ reset() [2/2]

void openlcb::GenMessage::reset ( Defs::MTI  mti,
NodeID  src,
string  payload 
)
inline

Definition at line 92 of file If.hxx.

◆ set_flag_dst()

void openlcb::GenMessage::set_flag_dst ( unsigned  flags)
inline

Definition at line 133 of file If.hxx.

◆ set_flag_src()

void openlcb::GenMessage::set_flag_src ( unsigned  flags)
inline

Definition at line 123 of file If.hxx.

Member Data Documentation

◆ dst

NodeHandle openlcb::GenMessage::dst

Destination node.

Definition at line 106 of file If.hxx.

◆ dstNode

Node* openlcb::GenMessage::dstNode

If the destination node is local, this value is non-NULL.

Definition at line 110 of file If.hxx.

◆ flagsDst

unsigned openlcb::GenMessage::flagsDst

Definition at line 116 of file If.hxx.

◆ flagsSrc

unsigned openlcb::GenMessage::flagsSrc

Definition at line 115 of file If.hxx.

◆ mti

Defs::MTI openlcb::GenMessage::mti

OpenLCB MTI of the incoming message.

Definition at line 108 of file If.hxx.

◆ payload

string openlcb::GenMessage::payload

Data content in the message body.

Owned by the dispatcher.

Todo:
(balazs.racz) figure out a better container.

Definition at line 113 of file If.hxx.

◆ src

NodeHandle openlcb::GenMessage::src

Source node.

Definition at line 104 of file If.hxx.


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