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

This class listens for incoming CAN messages, and if it sees a local alias conflict, then takes the appropriate action: More...

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

Public Member Functions

 AliasConflictHandler (IfCan *service)
 
Action entry () override
 Handler callback for incoming messages.
 
Action send_reserved_alias ()
 Sends an RID with the alias alias_.
 
Action send_release_alias ()
 Sends an AMR (alias mapping release) frame with the alias alias_ and the local node ID that we have for it.
 
- 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

unsigned alias_: 12
 Alias being checked.
 

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.
 
- 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 messages, and if it sees a local alias conflict, then takes the appropriate action:

. if the conflict happened in alias check, it responds with an AMD frame.

. if the conflict is with an allocated alias, kicks it out of the local cache, forcing an alias reallocation for that node.

. if the conflict is with a reserved but unused alias, kicks it out of the cache. This condition will be detected when a new node tries using that alias.

Definition at line 95 of file IfCan.cxx.

Constructor & Destructor Documentation

◆ AliasConflictHandler()

openlcb::AliasConflictHandler::AliasConflictHandler ( IfCan service)
inline

Definition at line 98 of file IfCan.cxx.

◆ ~AliasConflictHandler()

openlcb::AliasConflictHandler::~AliasConflictHandler ( )
inline

Definition at line 105 of file IfCan.cxx.

Member Function Documentation

◆ entry()

Action openlcb::AliasConflictHandler::entry ( )
inlineoverridevirtual

Handler callback for incoming messages.

@TODO(balazs.racz) this is wrong. it IS an openlcb frame.

Implements TypedStateFlow< MessageType, Base >.

Definition at line 112 of file IfCan.cxx.

◆ send_release_alias()

Action openlcb::AliasConflictHandler::send_release_alias ( )
inline

Sends an AMR (alias mapping release) frame with the alias alias_ and the local node ID that we have for it.

Then deletes the mapping from the local node table.

This is done in response to an alias conflict seen from the bus with the given alias.

Definition at line 184 of file IfCan.cxx.

◆ send_reserved_alias()

Action openlcb::AliasConflictHandler::send_reserved_alias ( )
inline

Sends an RID with the alias alias_.

This is done in response to a CID frame seen from the bus with the given alias.

Definition at line 168 of file IfCan.cxx.

Member Data Documentation

◆ alias_

unsigned openlcb::AliasConflictHandler::alias_
private

Alias being checked.

Definition at line 210 of file IfCan.cxx.


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