Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
withrottle::ServerCommandLoco Class Reference

WiThrottle server command handler base object for multi, primary, and secondary locomotive. More...

#include <ServerCommandLoco.hxx>

Inheritance diagram for withrottle::ServerCommandLoco:
withrottle::ServerCommandBase StateFlow< Buffer< ThrottleCommand >, QList< 1 > > TypedStateFlow< MessageType, Base > FlowInterface< MessageType >

Public Member Functions

 ServerCommandLoco (ThrottleFlow *throttle)
 Constructor.
 
 ~ServerCommandLoco ()
 Destructor.
 
- Public Member Functions inherited from StateFlow< Buffer< ThrottleCommand >, 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 Member Functions

StateFlowBase::Action entry () override
 Entry point to the state machine.
 
StateFlowBase::Action address_long ()
 Handle a DCC long address sub-command.
 
StateFlowBase::Action assign_train ()
 Handle succes or failure of assigning the train, including getting the latest train state.
 
StateFlowBase::Action load_state ()
 Update the LCD display with the trains current state.
 
 DISALLOW_COPY_AND_ASSIGN (ServerCommandLoco)
 

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 withrottle::ServerCommandBase
 ServerCommandBase (ThrottleFlow *throttle, CommandType type)
 Constructor.
 
 ~ServerCommandBase ()
 Destructor.
 
- 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 inherited from withrottle::ServerCommandBase
ThrottleFlowthrottle
 pointer to parent throttle
 

Detailed Description

WiThrottle server command handler base object for multi, primary, and secondary locomotive.

Definition at line 39 of file ServerCommandLoco.hxx.

Constructor & Destructor Documentation

◆ ServerCommandLoco()

withrottle::ServerCommandLoco::ServerCommandLoco ( ThrottleFlow throttle)

Constructor.

Parameters
throttleparent throttle that this flow is acting on

Definition at line 41 of file ServerCommandLoco.cxx.

◆ ~ServerCommandLoco()

withrottle::ServerCommandLoco::~ServerCommandLoco ( )

Destructor.

Definition at line 51 of file ServerCommandLoco.cxx.

Member Function Documentation

◆ address_long()

StateFlowBase::Action withrottle::ServerCommandLoco::address_long ( )
private

Handle a DCC long address sub-command.

Returns
next state assign_train
Todo:
need to search for train

Definition at line 74 of file ServerCommandLoco.cxx.

◆ assign_train()

StateFlowBase::Action withrottle::ServerCommandLoco::assign_train ( )
private

Handle succes or failure of assigning the train, including getting the latest train state.

Returns
next state load_state()

Definition at line 96 of file ServerCommandLoco.cxx.

◆ entry()

StateFlowBase::Action withrottle::ServerCommandLoco::entry ( )
overrideprivatevirtual

Entry point to the state machine.

Returns
next state based on the CommandSubType

Implements TypedStateFlow< MessageType, Base >.

Definition at line 60 of file ServerCommandLoco.cxx.

◆ load_state()

StateFlowBase::Action withrottle::ServerCommandLoco::load_state ( )
private

Update the LCD display with the trains current state.

Returns
next state release_and_exit()

Definition at line 117 of file ServerCommandLoco.cxx.


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