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

This class listens for incoming CAN frames of regular addressed OpenLCB messages destined for local nodes, then translates them in a generic way into a message, computing its MTI. More...

Inheritance diagram for openlcb::FrameToAddressedMessageParser:
openlcb::CanFrameStateFlow StateFlow< Buffer< CanMessageData >, QList< 1 > > TypedStateFlow< MessageType, Base > FlowInterface< MessageType >

Public Types

enum  { CAN_FILTER , CAN_MASK }
 
- Public Types inherited from TypedStateFlow< MessageType, Base >
typedef Base::Action Action
 Allows using Action without having StateFlowBase:: prefix in front of it.
 
- Public Types inherited from FlowInterface< MessageType >
typedef MessageType message_type
 Stores the message template type for external reference.
 

Public Member Functions

 FrameToAddressedMessageParser (IfCan *service)
 
Action entry () override
 Handler entry for incoming messages.
 
Action send_to_if ()
 
- Public Member Functions inherited from openlcb::CanFrameStateFlow
 CanFrameStateFlow (IfCan *service)
 
IfCanif_can ()
 
- Public Member Functions inherited from StateFlow< Buffer< CanMessageData >, QList< 1 > >
 StateFlow (Service *service)
 Constructor.
 
- Public Member Functions inherited from TypedStateFlow< MessageType, Base >
 TypedStateFlow (Service *service)
 Constructor.
 
virtual ~TypedStateFlow ()
 Destructor.
 
void send (MessageType *msg, unsigned priority=UINT_MAX) OVERRIDE
 Sends a message to the state flow for processing.
 
- Public Member Functions inherited from FlowInterface< MessageType >
virtual Poolpool ()
 
virtual MessageType * type_helper ()
 This function is never user in the code, but GDB can use it to infer the correct message types.
 
MessageType * alloc ()
 Synchronously allocates a message buffer from the pool of this flow.
 
void alloc_async (Executable *target)
 Asynchronously allocates a message buffer from the pool of this flow.
 

Private Attributes

uint32_t id_
 
string buf_
 
NodeHandle dstHandle_
 
StlMap< uint32_t, PayloadpendingBuffers_
 Reassembly buffers for multi-frame messages.
 

Additional Inherited Members

- Static Public Member Functions inherited from FlowInterface< MessageType >
static MessageType * cast_alloc (QMember *entry)
 Down casts and initializes an asynchronous allocation result to the appropriate flow's buffer type.
 
- Protected Member Functions inherited from TypedStateFlow< MessageType, Base >
void release () OVERRIDE
 Unrefs the current buffer.
 
void return_buffer ()
 For state flows that are operated using invoke_subflow_and_wait this is a way to hand back the buffer to the caller.
 
MessageType * message ()
 
MessageType * transfer_message ()
 Releases ownership of the current message.
 

Detailed Description

This class listens for incoming CAN frames of regular addressed OpenLCB messages destined for local nodes, then translates them in a generic way into a message, computing its MTI.

The resulting message is then passed to the generic If for dispatching.

Definition at line 566 of file IfCan.cxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Definition at line 569 of file IfCan.cxx.

Constructor & Destructor Documentation

◆ FrameToAddressedMessageParser()

openlcb::FrameToAddressedMessageParser::FrameToAddressedMessageParser ( IfCan service)
inline

Definition at line 582 of file IfCan.cxx.

◆ ~FrameToAddressedMessageParser()

openlcb::FrameToAddressedMessageParser::~FrameToAddressedMessageParser ( )
inline

Definition at line 589 of file IfCan.cxx.

Member Function Documentation

◆ entry()

Action openlcb::FrameToAddressedMessageParser::entry ( )
inlineoverridevirtual

Handler entry for incoming messages.

Todo:
(balazs.racz): handle the error cases here, like when we get a middle frame out of the blue etc.

Frame not needed anymore. If we want to save the reserved bits from the first octet, we need to revise this.

Implements TypedStateFlow< MessageType, Base >.

Definition at line 596 of file IfCan.cxx.

◆ send_to_if()

Action openlcb::FrameToAddressedMessageParser::send_to_if ( )
inline

Definition at line 678 of file IfCan.cxx.

Member Data Documentation

◆ buf_

string openlcb::FrameToAddressedMessageParser::buf_
private

Definition at line 702 of file IfCan.cxx.

◆ dstHandle_

NodeHandle openlcb::FrameToAddressedMessageParser::dstHandle_
private

Definition at line 703 of file IfCan.cxx.

◆ id_

uint32_t openlcb::FrameToAddressedMessageParser::id_
private

Definition at line 701 of file IfCan.cxx.

◆ pendingBuffers_

StlMap<uint32_t, Payload> openlcb::FrameToAddressedMessageParser::pendingBuffers_
private

Reassembly buffers for multi-frame messages.

Definition at line 705 of file IfCan.cxx.


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