Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::TractionThrottleInterface Class Referenceabstract
Inheritance diagram for openlcb::TractionThrottleInterface:
openlcb::TrainImpl openlcb::TractionThrottleBase openlcb::TractionThrottle

Public Member Functions

virtual void toggle_fn (uint32_t fn)=0
 Flips a function on<>off.
 
virtual void query_fn (uint32_t fn)
 Sends a query for a function to the server.
 
virtual bool is_train_assigned ()=0
 Determine if a train is currently assigned to this trottle.
 
virtual openlcb::Nodethrottle_node ()=0
 
virtual void set_throttle_listener (std::function< void(int fn)> update_callback)=0
 Sets up a callback for listening for remote throttle updates.
 
virtual openlcb::NodeID target_node ()=0
 
- Public Member Functions inherited from openlcb::TrainImpl
virtual void set_speed (SpeedType speed)=0
 Sets the speed of the locomotive.
 
virtual SpeedType get_speed ()=0
 
virtual SpeedType get_commanded_speed ()
 
virtual SpeedType get_actual_speed ()
 Returns the actual speed of the locomotive, as provided by feedback from the decoder.
 
virtual void set_emergencystop ()=0
 Sets the train to emergency stop.
 
virtual bool get_emergencystop ()=0
 Get the current E-Stop state.
 
virtual void set_fn (uint32_t address, uint16_t value)=0
 Sets the value of a function.
 
virtual uint16_t get_fn (uint32_t address)=0
 
virtual uint32_t legacy_address ()=0
 
virtual dcc::TrainAddressType legacy_address_type ()=0
 

Detailed Description

Definition at line 174 of file TractionThrottleInterface.hxx.

Member Function Documentation

◆ is_train_assigned()

virtual bool openlcb::TractionThrottleInterface::is_train_assigned ( )
pure virtual

Determine if a train is currently assigned to this trottle.

Returns
true if a train is assigned, else false

Implemented in openlcb::TractionThrottle.

◆ query_fn()

virtual void openlcb::TractionThrottleInterface::query_fn ( uint32_t  fn)
inlinevirtual

Sends a query for a function to the server.

The response will be asynchronously reported by the throttle listener update callback.

Parameters
fnfunction number.

Reimplemented in openlcb::TractionThrottle.

Definition at line 183 of file TractionThrottleInterface.hxx.

◆ set_throttle_listener()

virtual void openlcb::TractionThrottleInterface::set_throttle_listener ( std::function< void(int fn)>  update_callback)
pure virtual

Sets up a callback for listening for remote throttle updates.

When a different throttle modifies the train node's state, and the ASSIGN_TRAIN command was executed with "listen==true" parameter, we will get notifications about those remote changes. The notifications update the cached state in TractionThrottle, and call this update callback. Repeat with nullptr if the callbacks are not desired anymore.

Parameters
update_callbackwill be executed when a different throttle changes the train state. fn is the function number changed, or -1 for speed update.

Implemented in openlcb::TractionThrottle.

◆ target_node()

virtual openlcb::NodeID openlcb::TractionThrottleInterface::target_node ( )
pure virtual
Returns
the controlled node (the train node) ID.
Todo:
this function should not be here

Implemented in openlcb::TractionThrottle.

◆ throttle_node()

virtual openlcb::Node * openlcb::TractionThrottleInterface::throttle_node ( )
pure virtual
Returns
the controlling node (virtual node of the throttle, i.e., us.)
Todo:
this function should not be here

Implemented in openlcb::TractionThrottle.

◆ toggle_fn()

virtual void openlcb::TractionThrottleInterface::toggle_fn ( uint32_t  fn)
pure virtual

Flips a function on<>off.

Implemented in openlcb::TractionThrottle.


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