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

The addressed write flow is responsible for sending addressed messages to the CANbus. More...

#include <IfCanImpl.hxx>

Inheritance diagram for openlcb::AddressedCanMessageWriteFlow:
openlcb::CanMessageWriteFlow openlcb::WriteFlowBase StateFlow< Buffer< GenMessage >, QList< 4 > > TypedStateFlow< MessageType, Base > FlowInterface< MessageType > openlcb::CanDatagramWriteFlow

Classes

class  AliasDefListener
 This helper class listend for incoming CAN frames looking for alias mapping definitions. More...
 

Public Member Functions

 AddressedCanMessageWriteFlow (IfCan *if_can)
 
- Public Member Functions inherited from openlcb::CanMessageWriteFlow
 CanMessageWriteFlow (IfCan *if_can)
 
IfCanif_can ()
 
- Public Member Functions inherited from openlcb::WriteFlowBase
 WriteFlowBase (If *async_if)
 
- Public Member Functions inherited from StateFlow< Buffer< GenMessage >, QList< 4 > >
 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.
 

Protected Member Functions

Action entry () override
 Entry point of message handling flow.
 
Action send_to_hardware () override
 This function will be called (on the main executor) to initiate sending this message to the hardware.
 
Action find_remote_alias ()
 
Action send_ame_frame ()
 
Action send_verify_nodeid_global ()
 
Action fill_verify_nodeid_global ()
 
Action wait_looking_for_dst ()
 
virtual Action timeout_looking_for_dst ()
 
Action remote_alias_found ()
 
- Protected Member Functions inherited from openlcb::CanMessageWriteFlow
Action send_to_hardware () override
 This function will be called (on the main executor) to initiate sending this message to the hardware.
 
Action find_local_alias ()
 Performs the local alias lookup and branches depending on whether we found a local alias or not.
 
Action get_can_frame_buffer ()
 
- Protected Member Functions inherited from openlcb::WriteFlowBase
virtual Action send_to_local_node ()
 This state is called when an addressed message's destination is a node that is local to this interface.
 
virtual Action send_finished ()
 Virtual method called after the send is completed, i.e., all the frames are generated and sent to the hardware.
 
Ifasync_if ()
 
GenMessagenmsg ()
 Implementations shall call this function when they are done with sending the packet.
 
Action addressed_entry ()
 Addressed write flows should call this state BEFORE sending to the hardware.
 
Action global_entry ()
 Global write flows should return to this state AFTER sending the message to the hardware.
 
- 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.
 

Protected Attributes

openlcb::AddressedCanMessageWriteFlow::AliasDefListener this
 
StateFlowTimer timer_
 
- Protected Attributes inherited from openlcb::CanMessageWriteFlow
NodeAlias srcAlias_
 Source node alias.
 
NodeAlias dstAlias_
 Destination node alias.
 
uint8_t dataOffset_
 for continuation frames: which offset in the Buffer should we start the payload at.
 

Friends

class AliasDefListener
 

Additional Inherited Members

- 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.
 
- 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.
 

Detailed Description

The addressed write flow is responsible for sending addressed messages to the CANbus.

It uses some shared states from the generic CAN write flow base class, and extends it with destination alias lookup states.

Definition at line 227 of file IfCanImpl.hxx.

Constructor & Destructor Documentation

◆ AddressedCanMessageWriteFlow()

openlcb::AddressedCanMessageWriteFlow::AddressedCanMessageWriteFlow ( IfCan if_can)
inline

Definition at line 230 of file IfCanImpl.hxx.

Member Function Documentation

◆ entry()

Action openlcb::AddressedCanMessageWriteFlow::entry ( )
inlineoverrideprotectedvirtual

Entry point of message handling flow.

We start with the shared implementation. We may get back control at the send_to_hardware action.

Implements TypedStateFlow< MessageType, Base >.

Definition at line 240 of file IfCanImpl.hxx.

◆ fill_verify_nodeid_global()

Action openlcb::AddressedCanMessageWriteFlow::fill_verify_nodeid_global ( )
inlineprotected

Definition at line 351 of file IfCanImpl.hxx.

◆ find_remote_alias()

Action openlcb::AddressedCanMessageWriteFlow::find_remote_alias ( )
inlineprotected

Definition at line 309 of file IfCanImpl.hxx.

◆ remote_alias_found()

Action openlcb::AddressedCanMessageWriteFlow::remote_alias_found ( )
inlineprotected

Definition at line 382 of file IfCanImpl.hxx.

◆ send_ame_frame()

Action openlcb::AddressedCanMessageWriteFlow::send_ame_frame ( )
inlineprotected

Definition at line 325 of file IfCanImpl.hxx.

◆ send_to_hardware()

Action openlcb::AddressedCanMessageWriteFlow::send_to_hardware ( )
inlineoverrideprotectedvirtual

This function will be called (on the main executor) to initiate sending this message to the hardware.

The flow will then execute the returned action.

NOTE: it is possible that this functon will never be called for a given flow.

@TODO(balazs.racz) what should we do here? The caller said something different than the cache.

Implements openlcb::WriteFlowBase.

Definition at line 245 of file IfCanImpl.hxx.

◆ send_verify_nodeid_global()

Action openlcb::AddressedCanMessageWriteFlow::send_verify_nodeid_global ( )
inlineprotected

Definition at line 341 of file IfCanImpl.hxx.

◆ timeout_looking_for_dst()

virtual Action openlcb::AddressedCanMessageWriteFlow::timeout_looking_for_dst ( )
inlineprotectedvirtual
Todo:
: generate a terminate due to error response message.

Definition at line 376 of file IfCanImpl.hxx.

◆ wait_looking_for_dst()

Action openlcb::AddressedCanMessageWriteFlow::wait_looking_for_dst ( )
inlineprotected

Definition at line 362 of file IfCanImpl.hxx.

Friends And Related Symbol Documentation

◆ AliasDefListener

friend class AliasDefListener
friend

Definition at line 473 of file IfCanImpl.hxx.

Member Data Documentation

◆ timer_

StateFlowTimer openlcb::AddressedCanMessageWriteFlow::timer_
protected

Definition at line 475 of file IfCanImpl.hxx.


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