Class LnSensor

  • All Implemented Interfaces:
    java.lang.Comparable<NamedBean>, PropertyChangeProvider, DigitalIO, NamedBean, Sensor

    public class LnSensor
    extends AbstractSensor
    Extend jmri.AbstractSensor for LocoNet layouts.

    Some of the message formats used in this class are Copyright Digitrax, Inc. and used with permission as part of the JMRI project. That permission does not extend to uses in other software products. If you wish to use this code, algorithm or these message formats outside of JMRI, please contact Digitrax Inc for separate permission.

    • Method Detail

      • requestUpdateFromLayout

        public void requestUpdateFromLayout()
        Request an update on status by sending a LocoNet message. The only known way to do this from LocoNet is to request the status of _all_ devices, which is here considered too heavyweight. See LnSensorManager.updateAll()
      • setKnownState

        public void setKnownState​(int s)
                           throws JmriException
        User request to set the state, which means that we need to broadcast the new state over the loconet so that other attached devices. The incoming message will in turn, be processed by the SensorManager.
        Specified by:
        setKnownState in interface Sensor
        Overrides:
        setKnownState in class AbstractSensor
        Parameters:
        s - the state to set
        Throws:
        JmriException - if unable to set the state
      • messageFromManager

        public void messageFromManager​(LocoNetMessage l)
        implementing classes will typically have a function/listener to get updates from the layout, which will then call public void firePropertyChange(String propertyName, Object oldValue, Object newValue) _once_ if anything has changed state (or set the commanded state directly)
        Parameters:
        l - LocoNet message from manager.