Class LnReporter
- All Implemented Interfaces:
Comparable<NamedBean>,PropertyChangeProvider,CollectingReporter,IdTagListener,NamedBean,PhysicalLocationReporter,Reporter
This implementation reports Transponding messages from LocoNet-based "Reporters".
For LocoNet connections, a "Reporter" represents either a Digitrax "transponding zone", a
Lissy "measurement zone" or a Lissy RFID reader location.
The messages from these Reporters are handled by this code.
The LnReporterManager is responsible for decode of appropriate LocoNet messages
and passing only those messages to the Reporter which match its Reporter address.
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. Based on the report, for new tags a new Id Tag is created by the LnReporter.
Reports are Strings, formatted as
- NNNN enter - locomotive address NNNN entered the transponding zone. Short vs long address is indicated by the NNNN value
- NNNN exits - locomotive address NNNN left the transponding zone.
- NNNN seen northbound - LISSY measurement
- NNNN seen southbound - LISSY measurement
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameExceptionNested classes/interfaces inherited from interface jmri.PhysicalLocationReporter
PhysicalLocationReporter.Direction -
Field Summary
FieldsFields inherited from class jmri.implementation.AbstractReporter
_currentReport, _lastReportFields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWNFields inherited from interface jmri.Reporter
PROPERTY_CURRENT_REPORT, PROPERTY_LAST_REPORT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDirection(String rep) Gets the direction (ENTER/EXIT) of the report.getLocoAddress(String rep) Get the locomotive address we're reporting about from the current report.intextract long or short address from transponding message Assumes that the LocoNet message is a valid transponding message.intGet the PhysicalLocation of the Reporter Reports its own location, for now.Get the PhysicalLocation of the Reporter.intgetState()Provide an int value for use in scripts, etc.final booleanCheck if message is a Transponding Find Report message A Transponding Location Report message is sent by transponding hardware in response to a Transponding Find Request message when the addressed decoder is within a transponding zone and the decoder is transponding-enabled.final booleanCheck if message is a Transponding Location Report message A Transponding Location Report message is sent by transponding hardware when a transponding mobile decoder enters or leaves a transponding zone.(package private) voidHandle LISSY message(package private) voidHandle LISSY RFID-7 and RFID-5 messagesvoidProcess LocoNet message handed to us from the LnReporterManagervoidsetState(int s) Provide generic access to internal state.(package private) voidHandle transponding message passed to us by the LnReporting Manager Assumes that the LocoNet message is a valid transponding message.Methods inherited from class jmri.implementation.AbstractIdTagReporter
describeState, notifyMethods inherited from class jmri.implementation.AbstractReporter
getBeanType, getCurrentReport, getLastReport, setReportMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, dispose, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef, vetoableChangeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChangeMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.Reporter
getCurrentReport, getLastReport, setReport
-
Field Details
-
lastLoco
int lastLoco
-
-
Constructor Details
-
LnReporter
-
-
Method Details
-
getNumber
- Returns:
- the LocoNet address number for this reporter.
-
messageFromManager
Process LocoNet message handed to us from the LnReporterManager- Parameters:
l- - a LocoNetMessage.
-
isTranspondingLocationReport
Check if message is a Transponding Location Report message A Transponding Location Report message is sent by transponding hardware when a transponding mobile decoder enters or leaves a transponding zone.- Parameters:
l- LocoNet message to check- Returns:
- true if message is a Transponding Location Report, else false.
-
isTranspondingFindReport
Check if message is a Transponding Find Report message A Transponding Location Report message is sent by transponding hardware in response to a Transponding Find Request message when the addressed decoder is within a transponding zone and the decoder is transponding-enabled.- Parameters:
l- LocoNet message to check- Returns:
- true if message is a Transponding Find Report, else false.
-
transpondingReport
Handle transponding message passed to us by the LnReporting Manager Assumes that the LocoNet message is a valid transponding message.- Parameters:
l- - incoming loconetmessage
-
getLocoAddrFromTranspondingMsg
extract long or short address from transponding message Assumes that the LocoNet message is a valid transponding message.- Parameters:
l- LocoNet message- Returns:
- loco address
-
lissyReport
Handle LISSY message- Parameters:
l- Message from which to extract LISSY content
-
lissyRfidReport
Handle LISSY RFID-7 and RFID-5 messages- Parameters:
l- Message from which to extract RFID content (UID)
-
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! -
setState
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:
setStatein interfaceNamedBean- Overrides:
setStatein classAbstractIdTagReporter- Parameters:
s- the state
-
getLocoAddress
Get the locomotive address we're reporting about from the current report.- Specified by:
getLocoAddressin interfacePhysicalLocationReporter- Overrides:
getLocoAddressin classAbstractIdTagReporter- Parameters:
rep- ignored, IdTag Reporters don't send String type reports.
-
getDirection
Gets the direction (ENTER/EXIT) of the report.Because of the way IdTag Reporters work, all reports are ENTER type.
- Specified by:
getDirectionin interfacePhysicalLocationReporter- Overrides:
getDirectionin classAbstractIdTagReporter
-
getPhysicalLocation
Get the PhysicalLocation of the Reporter Reports its own location, for now. Not sure if that's the right thing or not. NOT DONE YET- Specified by:
getPhysicalLocationin interfacePhysicalLocationReporter- Overrides:
getPhysicalLocationin classAbstractIdTagReporter
-
getPhysicalLocation
Get the PhysicalLocation of the Reporter.- Specified by:
getPhysicalLocationin interfacePhysicalLocationReporter- Overrides:
getPhysicalLocationin classAbstractIdTagReporter- Parameters:
s- unused.
-
getCollection
- Specified by:
getCollectionin interfaceCollectingReporter- Returns:
- the collection of elements associated with this reporter.
-