Class MqttConsist

All Implemented Interfaces:
EventListener, Consist, ProgListener

public class MqttConsist extends DccConsist
This is the Consist definition for a consist on an MQTT system.
  • Field Details

  • Constructor Details

  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: Consist
      A method for cleaning up the consist
      Specified by:
      dispose in interface Consist
      Overrides:
      dispose in class DccConsist
    • setConsistType

      public void setConsistType(int consist_type)
      Description copied from interface: Consist
      Set the Consist Type.
      Specified by:
      setConsistType in interface Consist
      Overrides:
      setConsistType in class DccConsist
      Parameters:
      consist_type - the consist type
    • isAddressAllowed

      public boolean isAddressAllowed(DccLocoAddress address)
      Is this address allowed? On MQTT systems, all addresses but 0 can be used in a consist. Is this address allowed? Since address 00 is an analog locomotive, we can't program CV19 to include it in a consist, but all other addresses are ok.
      Specified by:
      isAddressAllowed in interface Consist
      Overrides:
      isAddressAllowed in class DccConsist
      Parameters:
      address - the address
      Returns:
      true if allowed; false otherwise
    • sizeLimit

      public int sizeLimit()
      Is there a size limit for this consist?
      Specified by:
      sizeLimit in interface Consist
      Overrides:
      sizeLimit in class DccConsist
      Returns:
      -1 for Controller Consists (no limit), 0 for any other consist type
    • contains

      public boolean contains(DccLocoAddress address)
      Does the consist contain the specified address? Does the consist contain the specified locomotive address?
      Specified by:
      contains in interface Consist
      Overrides:
      contains in class DccConsist
      Parameters:
      address - the address to check
      Returns:
      true if in consist; false otherwise
    • getLocoDirection

      public boolean getLocoDirection(DccLocoAddress address)
      Get the relative direction setting for a specific locomotive in the consist. Get the relative direction setting for a specific locomotive in the consist.
      Specified by:
      getLocoDirection in interface Consist
      Overrides:
      getLocoDirection in class DccConsist
      Parameters:
      address - the address to check
      Returns:
      true if locomotive is in consist in its normal direction of travel; false otherwise
    • add

      public void add(DccLocoAddress locoAddress, boolean directionNormal)
      Add a Locomotive to a Consist.
      Specified by:
      add in interface Consist
      Overrides:
      add in class DccConsist
      Parameters:
      locoAddress - is the Locomotive address to add to the locomotive
      directionNormal - is True if the locomotive is traveling the same direction as the consist, or false otherwise.
    • restore

      public void restore(DccLocoAddress locoAddress, boolean directionNormal)
      Restore a Locomotive to Consist, but don't write to the command station. This is used for restoring the consist from a file or adding a consist read from the command station.
      Specified by:
      restore in interface Consist
      Overrides:
      restore in class DccConsist
      Parameters:
      locoAddress - is the Locomotive address to add to the locomotive
      directionNormal - is True if the locomotive is traveling the same direction as the consist, or false otherwise.
    • remove

      public void remove(DccLocoAddress locoAddress)
      Remove a Locomotive from this Consist.
      Specified by:
      remove in interface Consist
      Overrides:
      remove in class DccConsist
      Parameters:
      locoAddress - is the Locomotive address to add to the locomotive
    • activate

      public void activate()
      Activates the consist for use with a throttle
    • deactivate

      public void deactivate()
      Deactivates and removes the consist from a throttle