Class MqttThrottle

    • Constructor Detail

      • MqttThrottle

        public MqttThrottle​(MqttSystemConnectionMemo memo,
                            java.lang.String sendThrottleTopic,
                            java.lang.String rcvThrottleTopic,
                            java.lang.String sendDirectionTopic,
                            java.lang.String rcvDirectionTopic,
                            java.lang.String sendFunctionTopic,
                            java.lang.String rcvFunctionTopic)
      • MqttThrottle

        public MqttThrottle​(MqttSystemConnectionMemo memo,
                            java.lang.String sendThrottleTopic,
                            java.lang.String rcvThrottleTopic,
                            java.lang.String sendDirectionTopic,
                            java.lang.String rcvDirectionTopic,
                            java.lang.String sendFunctionTopic,
                            java.lang.String rcvFunctionTopic,
                            LocoAddress address)
        Constructor.
        Parameters:
        memo - system connection
        sendThrottleTopic - MQTT topic for sending speed
        rcvThrottleTopic - MQTT topic for receiving speed
        sendDirectionTopic - MQTT topic for sending direction
        rcvDirectionTopic - MQTT topic for receiving direction
        sendFunctionTopic - MQTT topic for sending function values
        rcvFunctionTopic - MQTT topic for receiving function values
        address - loco address to set on throttle
    • Method Detail

      • setSpeedSetting

        public void setSpeedSetting​(float speed)
        setSpeedSetting - Implementing functions should override this function, but should either make a call to super.setSpeedSetting() to notify the listeners at the end of their work, or should notify the listeners themselves.
        Specified by:
        setSpeedSetting in interface Throttle
        Overrides:
        setSpeedSetting in class AbstractThrottle
        Parameters:
        speed - the speed as a 0.0 -> 1.0. fraction of maximum possible speed or -1 for emergency stop.
      • sendFunctionGroup

        public void sendFunctionGroup​(int functionNum,
                                      boolean momentary)
        Send whole (DCC) Function Group for a particular function number.
        Overrides:
        sendFunctionGroup in class AbstractThrottle
        Parameters:
        functionNum - Function Number
        momentary - False to send normal function status, true to send momentary.
      • throttleDispose

        protected void throttleDispose()
        Dispose when finished with this object. After this, further usage of this Throttle object will result in a JmriException. This is quite problematic, because a using object doesn't know when it's the last user.
        Specified by:
        throttleDispose in class AbstractThrottle
      • getLocoAddress

        public LocoAddress getLocoAddress()
        Description copied from interface: Throttle
        Locomotive address. The exact format is defined by the specific implementation, as subclasses of LocoAddress will contain different information.

        This is an unbound property.

        Specified by:
        getLocoAddress in interface Throttle
        Returns:
        The locomotive address