Class DefaultRailCom
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractIdTag
-
- jmri.implementation.DefaultIdTag
-
- jmri.implementation.DefaultRailCom
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,AddressedIdTag
,PropertyChangeProvider
,IdTag
,NamedBean
,RailCom
,Reportable
public class DefaultRailCom extends DefaultIdTag implements RailCom
Concrete implementation of theRailCom
interface.
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.
- Since:
- 2.99.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Hashtable<java.lang.Integer,java.lang.Integer>
cvValues
-
Fields inherited from class jmri.implementation.DefaultIdTag
PROPERTY_WHEN_LAST_SEEN, PROPERTY_WHERE_LAST_SEEN
-
Fields inherited from class jmri.implementation.AbstractIdTag
prefix, whenLastSeen, whereLastSeen
-
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
-
Fields inherited from interface jmri.RailCom
CONSIST_ADDRESS, LONG_ADDRESS, NO_ADDRESS, ORIENTA, ORIENTB, SHORT_ADDRESS
-
-
Constructor Summary
Constructors Constructor Description DefaultRailCom(java.lang.String systemName)
DefaultRailCom(java.lang.String systemName, java.lang.String userName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getActualLoad()
Gets the actual load reported by decoder the RailCom device.int
getActualSpeed()
Gets the actual speed reported by the RailCom device as a representation 128 speed stepsint
getActualTemperature()
Gets the actual temperate reported by the RailCom device.int
getCV(int cv)
Gets the value of a CV reported back from the RailCom device.java.util.List<java.lang.Integer>
getCVList()
Get a list of the CVs last seen for this RailCom device.int
getExpectedCv()
Get the expected CV to be returned in a RailCom Packet.int
getFuelLevel()
Gets the remaining fuel level as a % Fuel level CV879 (RP.9.3.2)int
getLocation()
Gets the Last Location that the RailCom device was identified in Location is configured in CV876 (RP.9.3.2)int
getOrientation()
Gets the Orientation of the Rail Com device on the trackint
getRoutingNo()
Gets the routing number that the RailCom device wishes to travel.int
getState()
Provide generic access to internal state.int
getWaterLevel()
Gets the remaining fuel level as a % Water level CV878 (RP.9.3.2)void
setActualLoad(int type)
Method for a RailCom Reader to set the Actual Load back from a device.void
setActualSpeed(int type)
Method for a RailCom Reader to set the Actual speed reported back from a devicevoid
setActualTemperature(int type)
Method for a RailCom Reader to set the actual temperate reported back from a device.void
setCV(int cv, int value)
Sets the value of a CV reported back from the decoder.void
setCvValue(int value)
Set the value of the CV that has been read from the RailCom packet.void
setExpectedCv(int cv)
Set the CV number of the next expected value to be returned in a RailCom Packet.void
setFuelLevel(int type)
Method for a RailCom Reader to set the fuel level reported back from a device.void
setLocation(int type)
Method for a RailCom Reader to set the location reported back from a device.void
setOrientation(int type)
Method for a RailCom Reader to set the orientation reported back from a devicevoid
setRoutingNo(int type)
Method for a RailCom Reader to set the routing number reported back from a device.void
setState(int s)
Provide generic access to internal state.void
setWaterLevel(int type)
Method for a RailCom Reader to set the water level reported back from a device.java.lang.String
toReportString()
The IDTag version of toReportString returns a string consisting of the user name (if defined) or Tag ID followed by the associated list of property values.-
Methods inherited from class jmri.implementation.DefaultIdTag
compareTo, load, setWhereLastSeen, store
-
Methods inherited from class jmri.implementation.AbstractIdTag
getBeanType, getTagID, getWhenLastSeen, getWhereLastSeen
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, 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, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.AddressedIdTag
getLocoAddress
-
Methods inherited from interface jmri.IdTag
getTagID, getWhenLastSeen, getWhereLastSeen, load, setWhereLastSeen, store
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, dispose, getBeanType, 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
-
cvValues
java.util.Hashtable<java.lang.Integer,java.lang.Integer> cvValues
-
-
Constructor Detail
-
DefaultRailCom
public DefaultRailCom(java.lang.String systemName)
-
DefaultRailCom
public DefaultRailCom(java.lang.String systemName, java.lang.String userName)
-
-
Method Detail
-
setState
public void setState(int s) throws JmriException
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 is provided to make scripts access easier to read.
- Specified by:
setState
in interfaceNamedBean
- Overrides:
setState
in classDefaultIdTag
- Parameters:
s
- the state- Throws:
JmriException
- general error when setting the state fails
-
getState
public int getState()
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. getCommandedState in Turnout). This is provided to make scripts easier to read.
- Specified by:
getState
in interfaceNamedBean
- Overrides:
getState
in classDefaultIdTag
- Returns:
- the state
-
setOrientation
public void setOrientation(int type)
Description copied from interface:RailCom
Method for a RailCom Reader to set the orientation reported back from a device- Specified by:
setOrientation
in interfaceRailCom
- Parameters:
type
- the orientation to set
-
getOrientation
public int getOrientation()
Description copied from interface:RailCom
Gets the Orientation of the Rail Com device on the track- Specified by:
getOrientation
in interfaceRailCom
- Returns:
- current orientation
-
setActualSpeed
public void setActualSpeed(int type)
Description copied from interface:RailCom
Method for a RailCom Reader to set the Actual speed reported back from a device- Specified by:
setActualSpeed
in interfaceRailCom
- Parameters:
type
- the speed
-
getActualSpeed
public int getActualSpeed()
Description copied from interface:RailCom
Gets the actual speed reported by the RailCom device as a representation 128 speed steps- Specified by:
getActualSpeed
in interfaceRailCom
- Returns:
- -1 if not set.
-
setActualLoad
public void setActualLoad(int type)
Description copied from interface:RailCom
Method for a RailCom Reader to set the Actual Load back from a device.- Specified by:
setActualLoad
in interfaceRailCom
- Parameters:
type
- the load
-
getActualLoad
public int getActualLoad()
Description copied from interface:RailCom
Gets the actual load reported by decoder the RailCom device.- Specified by:
getActualLoad
in interfaceRailCom
- Returns:
- -1 if not set.
-
setActualTemperature
public void setActualTemperature(int type)
Description copied from interface:RailCom
Method for a RailCom Reader to set the actual temperate reported back from a device.- Specified by:
setActualTemperature
in interfaceRailCom
- Parameters:
type
- the temperature
-
getActualTemperature
public int getActualTemperature()
Description copied from interface:RailCom
Gets the actual temperate reported by the RailCom device. Location is configured in CV876 (RP.9.3.2)- Specified by:
getActualTemperature
in interfaceRailCom
- Returns:
- -1 if not set.
-
setWaterLevel
public void setWaterLevel(int type)
Description copied from interface:RailCom
Method for a RailCom Reader to set the water level reported back from a device.- Specified by:
setWaterLevel
in interfaceRailCom
- Parameters:
type
- the water level
-
getWaterLevel
public int getWaterLevel()
Description copied from interface:RailCom
Gets the remaining fuel level as a % Water level CV878 (RP.9.3.2)- Specified by:
getWaterLevel
in interfaceRailCom
- Returns:
- -1 if not set.
-
setFuelLevel
public void setFuelLevel(int type)
Description copied from interface:RailCom
Method for a RailCom Reader to set the fuel level reported back from a device.- Specified by:
setFuelLevel
in interfaceRailCom
- Parameters:
type
- the fuel level
-
getFuelLevel
public int getFuelLevel()
Description copied from interface:RailCom
Gets the remaining fuel level as a % Fuel level CV879 (RP.9.3.2)- Specified by:
getFuelLevel
in interfaceRailCom
- Returns:
- -1 if not set.
-
setLocation
public void setLocation(int type)
Description copied from interface:RailCom
Method for a RailCom Reader to set the location reported back from a device.- Specified by:
setLocation
in interfaceRailCom
- Parameters:
type
- the location
-
getLocation
public int getLocation()
Description copied from interface:RailCom
Gets the Last Location that the RailCom device was identified in Location is configured in CV876 (RP.9.3.2)- Specified by:
getLocation
in interfaceRailCom
- Returns:
- -1 if not set.
-
setRoutingNo
public void setRoutingNo(int type)
Description copied from interface:RailCom
Method for a RailCom Reader to set the routing number reported back from a device.- Specified by:
setRoutingNo
in interfaceRailCom
- Parameters:
type
- the routing number
-
getRoutingNo
public int getRoutingNo()
Description copied from interface:RailCom
Gets the routing number that the RailCom device wishes to travel. Route Number is configured in CV874 (RP.9.3.2)- Specified by:
getRoutingNo
in interfaceRailCom
- Returns:
- -1 if not set.
-
setExpectedCv
public void setExpectedCv(int cv)
Description copied from interface:RailCom
Set the CV number of the next expected value to be returned in a RailCom Packet.- Specified by:
setExpectedCv
in interfaceRailCom
- Parameters:
cv
- the expected CV
-
getExpectedCv
public int getExpectedCv()
Description copied from interface:RailCom
Get the expected CV to be returned in a RailCom Packet.- Specified by:
getExpectedCv
in interfaceRailCom
- Returns:
- the expected CV
-
setCvValue
public void setCvValue(int value)
Description copied from interface:RailCom
Set the value of the CV that has been read from the RailCom packet.- Specified by:
setCvValue
in interfaceRailCom
- Parameters:
value
- the CV value
-
getCV
public int getCV(int cv)
Description copied from interface:RailCom
Gets the value of a CV reported back from the RailCom device.
-
setCV
public void setCV(int cv, int value)
Description copied from interface:RailCom
Sets the value of a CV reported back from the decoder.
-
getCVList
public java.util.List<java.lang.Integer> getCVList()
Description copied from interface:RailCom
Get a list of the CVs last seen for this RailCom device.
-
toReportString
public java.lang.String toReportString()
Description copied from class:AbstractIdTag
The IDTag version of toReportString returns a string consisting of the user name (if defined) or Tag ID followed by the associated list of property values.- Specified by:
toReportString
in interfaceReportable
- Overrides:
toReportString
in classAbstractIdTag
- Returns:
- a report string representing the Object.
-
-