Class CbusReporter

  • All Implemented Interfaces:
    java.lang.Comparable<NamedBean>, java.util.EventListener, PropertyChangeProvider, IdTagListener, AbstractMRListener, CanListener, NamedBean, PhysicalLocationReporter, Reporter

    public class CbusReporter
    extends AbstractRailComReporter
    implements CanListener
    Extend jmri.AbstractRailComReporter for CBUS controls.
    This file is part of JMRI.

    JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

    JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    CBUS Reporters can accept 5-byte unique Classic RFID on DDES or ACDAT OPCs, CANRC522 / CANRCOM DDES OPCs.

    • Field Detail

      • eraseOnTimeoutAll

        public static boolean eraseOnTimeoutAll
        Should all CbusReporters clear themselves after a timeout?

        Default behavior is to not timeout; this is public access so it can be updated from a script

      • eraseOnTimeoutThisReporter

        public boolean eraseOnTimeoutThisReporter
        Should this CbusReporter clear itself after a timeout?

        Default behavior is to not timeout; this is public access so it can be updated from a script

    • Constructor Detail

      • CbusReporter

        public CbusReporter​(java.lang.String address,
                            CanSystemConnectionMemo memo)
        Create a new CbusReporter.
        Parameters:
        address - Reporter address, currently in String number format. No system prefix or type letter.
        memo - System connection.
    • Method Detail

      • setState

        public void setState​(int s)
        Set the CbusReporter State. May also provide / update a CBUS Sensor State, depending on property. Provide generic access to internal state.

        This generally shouldn't be used by Java code; use the class-specific form instead (e.g. setCommandedState in Turnout). This is provided to make scripts access easier to read.

        Specified by:
        setState in interface NamedBean
        Overrides:
        setState in class AbstractIdTagReporter
        Parameters:
        s - the state
      • message

        public void message​(CanMessage m)
        Called when an outgoing message is sent to the CAN Network. CBUS Reporters can respond to ACDAT or DDES OPC's.
        Specified by:
        message in interface CanListener
        Parameters:
        m - the CanMessage being sent.
      • reply

        public void reply​(CanReply m)
        Called when an incoming CanFrame is received from the CAN Network. CBUS Reporters can respond to ACDAT or DDES OPC's
        Specified by:
        reply in interface CanListener
        Parameters:
        m - the CanReply being received.
      • getCbusReporterType

        @Nonnull
        public java.lang.String getCbusReporterType()
        Get the Reporter Listener format type.

        Defaults to Classic RfID, 5 byte unique.

        Returns:
        reporter format type.
      • getMaintainSensor

        public boolean getMaintainSensor()
        Get if the Reporter should provide / update a CBUS Sensor, following Reporter Status.

        Defaults to false.

        Returns:
        true if the reporter should maintain the Sensor.
      • dispose

        public void dispose()
        Deactivate this object, so that it releases as many resources as possible and no longer effects others.

        For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.

        It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.

        Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.

        Specified by:
        dispose in interface NamedBean
        Overrides:
        dispose in class AbstractNamedBean