Class CbusReporter
- java.lang.Object
-
- 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
Nested classes/interfaces inherited from interface jmri.PhysicalLocationReporter
PhysicalLocationReporter.Direction
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
eraseOnTimeoutAll
Should all CbusReporters clear themselves after a timeout?boolean
eraseOnTimeoutThisReporter
Should this CbusReporter clear itself after a timeout?-
Fields inherited from class jmri.implementation.AbstractReporter
_currentReport, _lastReport
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description CbusReporter(java.lang.String address, CanSystemConnectionMemo memo)
Create a new CbusReporter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.java.lang.String
getCbusReporterType()
Get the Reporter Listener format type.boolean
getMaintainSensor()
Get if the Reporter should provide / update a CBUS Sensor, following Reporter Status.void
message(CanMessage m)
Called when an outgoing message is sent to the CAN Network.void
notify(IdTag id)
Resets report briefly back to null so Sensor Listeners are updated.void
reply(CanReply m)
Called when an incoming CanFrame is received from the CAN Network.void
setState(int s)
Set the CbusReporter State.-
Methods inherited from class jmri.implementation.AbstractRailComReporter
getLocoAddress
-
Methods inherited from class jmri.implementation.AbstractIdTagReporter
describeState, getDirection, getPhysicalLocation, getPhysicalLocation, getState
-
Methods inherited from class jmri.implementation.AbstractReporter
getBeanType, getCurrentReport, getLastReport, setReport
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, 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, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.can.CanListener
addTc, addTc, removeTc, removeTc
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
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 interfaceNamedBean
- Overrides:
setState
in classAbstractIdTagReporter
- Parameters:
s
- the state
-
notify
public void notify(IdTag id)
Resets report briefly back to null so Sensor Listeners are updated.- Specified by:
notify
in interfaceIdTagListener
- Overrides:
notify
in classAbstractIdTagReporter
-
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 interfaceCanListener
- 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 interfaceCanListener
- 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 interfaceNamedBean
- Overrides:
dispose
in classAbstractNamedBean
-
-