Class OlcbReporter

All Implemented Interfaces:
Comparable<NamedBean>, PropertyChangeProvider, CollectingReporter, IdTagListener, NamedBean, PhysicalLocationReporter, Reporter

public final class OlcbReporter extends AbstractIdTagReporter implements CollectingReporter
Implement jmri.AbstractReporter for OpenLCB protocol.
Since:
5.3.5
  • Field Details

  • Constructor Details

  • Method Details

    • hasExitReports

      public boolean hasExitReports()
      Indicates whether the underlying hardware sends messages determining when an Id is no longer in this reporter (e.g. RailCom block occupancy exit events).

      When false (e.g. RFID point detectors), seeing a tag elsewhere implies it has departed this reporter. When true, departure is strictly governed by hardware exit/clear messages.

      OpenLCB provides explicit exit events and section-cleared messages.

      Overrides:
      hasExitReports in class AbstractIdTagReporter
      Returns:
      true if hardware sends explicit exit/departure messages; false otherwise.
    • finishLoad

      void finishLoad()
      Helper function that will be invoked after construction once the properties have been loaded. Used specifically for preventing double initialization when loading sensors from XML.
    • setUserName

      Updates event table entries when the user name changes.
      Specified by:
      setUserName in interface NamedBean
      Overrides:
      setUserName in class AbstractNamedBean
      Parameters:
      s - new user name
      Throws:
      NamedBean.BadUserNameException - see NamedBean
    • dispose

      public void dispose()
      Description copied from class: AbstractNamedBean
      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
    • getCollection

      Specified by:
      getCollection in interface CollectingReporter
      Returns:
      the collection of elements associated with this reporter.
    • compareSystemNameSuffix

      Compare the suffix of this NamedBean's name with the suffix of the argument NamedBean's name for the NamedBean.compareTo(jmri.NamedBean) operation. This is intended to be a system-specific comparison that understands the various formats, etc. By default, does an alphanumeric-by-chunks comparison. Sorts by decoded EventID(s)
      Specified by:
      compareSystemNameSuffix in interface NamedBean
      Overrides:
      compareSystemNameSuffix in class AbstractNamedBean
      Parameters:
      suffix1 - The suffix for the 1st bean in the comparison
      suffix2 - The suffix for the 2nd bean in the comparison
      n - The other (second) NamedBean in the comparison
      Returns:
      -1,0,+1 for ordering if the names are well-formed; may not provide proper ordering if the names are not well-formed.
    • getState

      public int getState()
      State is always an integer, which is the numeric value from the last loco address that we reported, or -1 if the last update was an exit.
      Specified by:
      getState in interface NamedBean
      Specified by:
      getState in interface Reporter
      Overrides:
      getState in class AbstractIdTagReporter
      Returns:
      loco address number or -1 if the last message specified exiting
    • setState

      public void setState(int s)
      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
    • notifySeenElsewhere

      public void notifySeenElsewhere(IdTag tag, Reporter newReporter)
      Informs this reporter that a tag previously reported here has been seen at another reporter.

      Default implementation is a no-op for generic reporters.

      Specified by:
      notifySeenElsewhere in interface Reporter
      Overrides:
      notifySeenElsewhere in class AbstractIdTagReporter
      Parameters:
      tag - the tag seen elsewhere
      newReporter - the reporter where the tag was newly detected