jmri.jmrix.loconet
Class LnReporter

java.lang.Object
  extended by jmri.implementation.AbstractNamedBean
      extended by jmri.implementation.AbstractReporter
          extended by jmri.jmrix.loconet.LnReporter
All Implemented Interfaces:
Serializable, EventListener, LocoNetListener, NamedBean, Reporter

public class LnReporter
extends AbstractReporter
implements LocoNetListener

Extend jmri.AbstractReporter for LocoNet layouts

This implementation reports transponding messages.

Each transponding message creates a new current report. The last report is always available, and is the same as the contents of the last transponding message received.

Reports are Strings, formatted as

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.

Author:
Bob Jacobsen Copyright (C) 2001, 2007
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
LnReporter(int number)
           
 
Method Summary
 void dispose()
          Deactivate this object, so that it releases as many resources as possible and no longer effects others.
 int getNumber()
           
 int getState()
          Provide an int value for use in scripts, etc.
 void message(LocoNetMessage l)
          Member function that will be invoked by a LocoNetInterface implementation to forward a LocoNet message from the layout.
 void setState(int s)
          Provide generic access to internal state.
 
Methods inherited from class jmri.implementation.AbstractReporter
getCurrentReport, getLastReport, setReport
 
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, firePropertyChange, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName
 

Constructor Detail

LnReporter

public LnReporter(int number)
Method Detail

getNumber

public int getNumber()

message

public void message(LocoNetMessage l)
Description copied from interface: LocoNetListener
Member function that will be invoked by a LocoNetInterface implementation to forward a LocoNet message from the layout.

Specified by:
message in interface LocoNetListener
Parameters:
l - The received LocoNet message. Note that this same object may be presented to multiple users. It should not be modified here.

getState

public int getState()
Provide an int value for use in scripts, etc. This will be the numeric locomotive address last seen, unless the last message said the loco was exiting. Note that there may still some other locomotive in the transponding zone!

Specified by:
getState in interface NamedBean
Specified by:
getState in interface Reporter
Returns:
-1 if the last message specified exiting

setState

public void setState(int s)
Description copied from interface: NamedBean
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 provided to make Jython script access easier to read.

Specified by:
setState in interface NamedBean

dispose

public void dispose()
Description copied from interface: NamedBean
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


Copyright © 1997 - 2009 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads