35#ifndef _OPENLCB_TRACTIONTHROTTLEINTERFACE_HXX_
36#define _OPENLCB_TRACTIONTHROTTLEINTERFACE_HXX_
46struct TractionThrottleInput;
112 void reset(
const TractionThrottleCommands::AssignTrain &,
const NodeID &
dst,
115 cmd = CMD_ASSIGN_TRAIN;
117 this->
flags = listen ? 1 : 0;
120 void reset(
const TractionThrottleCommands::ReleaseTrain &)
122 cmd = CMD_RELEASE_TRAIN;
125 void reset(
const TractionThrottleCommands::LoadState &)
127 cmd = CMD_LOAD_STATE;
130 void reset(
const TractionThrottleCommands::ConsistAdd &,
NodeID slave,
133 cmd = CMD_CONSIST_ADD;
138 void reset(
const TractionThrottleCommands::ConsistDel &,
NodeID slave)
140 cmd = CMD_CONSIST_DEL;
144 void reset(
const TractionThrottleCommands::ConsistQry &)
146 cmd = CMD_CONSIST_QRY;
150 void reset(
const TractionThrottleCommands::ConsistQry &, uint8_t ofs)
152 cmd = CMD_CONSIST_QRY;
205 std::function<
void(
int fn)> update_callback) = 0;
int listen(int socket, int backlog)
Mark a connection-mode socket, specified by the socket argument, as accepting connections.
Collection of related state machines that pend on incoming messages.
Base class for NMRAnet nodes conforming to the asynchronous interface.
@ FN_NOT_KNOWN
Returned from get_fn() when we don't have a cahced value for a function.
virtual openlcb::Node * throttle_node()=0
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 openlcb::NodeID target_node()=0
virtual bool is_train_assigned()=0
Determine if a train is currently assigned to this trottle.
virtual void set_throttle_listener(std::function< void(int fn)> update_callback)=0
Sets up a callback for listening for remote throttle updates.
Abstract base class for train implementations.
uint64_t NodeID
48-bit NMRAnet Node ID type
All callable flow request objects have to derive from this struct.
C++ Namespace for collecting all commands that can be sent to the TractionThrottle flow.