class documentation

class Cab(MQTTAgent):

Constructor: Cab(topic_filter, qos)

View In Hierarchy

Cab Agent

This agent's subscription is used to handle publications to the cab topic. It is not used to publish a cab message, but to handle the cab message when it is received from the broker.

Cab commands are passed to the DCC system for encodeing and transmission.

This is a singleton and receives all cab messages. Singularity is not enforced.

A valid DCC speed command requires both direction and speed, but these are in separate MQTT publications. DCC speed commands are not issued until valid MQTT publicatons have been received for both speed and direction.

Method __init__ Initialise the cab subscription
Method handle_publication Handle a publication This method is called by the MQTT client when a publication is received.
Constant DIR_DECODE Direction decode for decoder direction commands
Method _create_pub_check Overrides version in base class
Method _handle_dir_pub Undocumented
Method _handle_fn_pub Undocumented
Method _handle_ns_pub Undocumented
Method _handle_spd_pub Undocumented
Async Method _pub_check Check for publication.
Constant _CAB_CMD Undocumented
Class Variable _cab Undocumented
Instance Variable _dcc Undocumented
Instance Variable _rc2 Undocumented
def __init__(self, topic_filter, qos):

Initialise the cab subscription

Parameters
topic_filterthe topic filter to match against received topics
qosthe Quality of Service for this subscription. Must be either MQTTClient.QOS0 or MQTTClient.QOS1
def handle_publication(self, topic, dup_flag, ret_flag, payload):

Handle a publication This method is called by the MQTT client when a publication is received.

Parameters
topicthe topic of the publication
dup_flagTrue if this is a duplicate publication
ret_flagTrue if this is a retained publication
payloadthe payload of the publication as a string
DIR_DECODE =

Direction decode for decoder direction commands

Value
{'FORWARD': DCCCommand.FWD, 'STOP': DCCCommand.STOP, 'REVERSE': DCCCommand.REV}
def _create_pub_check(self):

Overrides version in base class

def _handle_dir_pub(self, address, topic3, payload):

Undocumented

def _handle_fn_pub(self, address, topic3, payload):

Undocumented

def _handle_ns_pub(self, address, topic3, payload):

Undocumented

def _handle_spd_pub(self, address, topic3, payload):

Undocumented

async def _pub_check(self):

Check for publication.

Publish the RailCom dynamic info

_CAB_CMD =

Undocumented

Value
{'throttle': _handle_spd_pub,
 'direction': _handle_dir_pub,
 'function': _handle_fn_pub,
 'consist': _handle_ns_pub}
_cab: dict =

Undocumented

_dcc =

Undocumented

_rc2 =

Undocumented