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 theRailCominterface.
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_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, 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 intgetActualLoad()Gets the actual load reported by decoder the RailCom device.intgetActualSpeed()Gets the actual speed reported by the RailCom device as a representation 128 speed stepsintgetActualTemperature()Gets the actual temperate reported by the RailCom device.intgetCV(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.intgetExpectedCv()Get the expected CV to be returned in a RailCom Packet.intgetFuelLevel()Gets the remaining fuel level as a % Fuel level CV879 (RP.9.3.2)intgetLocation()Gets the Last Location that the RailCom device was identified in Location is configured in CV876 (RP.9.3.2)intgetOrientation()Gets the Orientation of the Rail Com device on the trackintgetRoutingNo()Gets the routing number that the RailCom device wishes to travel.intgetState()Provide generic access to internal state.intgetWaterLevel()Gets the remaining fuel level as a % Water level CV878 (RP.9.3.2)voidsetActualLoad(int type)Method for a RailCom Reader to set the Actual Load back from a device.voidsetActualSpeed(int type)Method for a RailCom Reader to set the Actual speed reported back from a devicevoidsetActualTemperature(int type)Method for a RailCom Reader to set the actual temperate reported back from a device.voidsetCV(int cv, int value)Sets the value of a CV reported back from the decoder.voidsetCvValue(int value)Set the value of the CV that has been read from the RailCom packet.voidsetExpectedCv(int cv)Set the CV number of the next expected value to be returned in a RailCom Packet.voidsetFuelLevel(int type)Method for a RailCom Reader to set the fuel level reported back from a device.voidsetLocation(int type)Method for a RailCom Reader to set the location reported back from a device.voidsetOrientation(int type)Method for a RailCom Reader to set the orientation reported back from a devicevoidsetRoutingNo(int type)Method for a RailCom Reader to set the routing number reported back from a device.voidsetState(int s)Provide generic access to internal state.voidsetWaterLevel(int type)Method for a RailCom Reader to set the water level reported back from a device.java.lang.StringtoReportString()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, getRecommendedToolTip, 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:NamedBeanProvide 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 classDefaultIdTag- Parameters:
s- the state- Throws:
JmriException- general error when setting the state fails
-
getState
public int getState()
Description copied from interface:NamedBeanProvide 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:
getStatein interfaceNamedBean- Overrides:
getStatein classDefaultIdTag- Returns:
- the state
-
setOrientation
public void setOrientation(int type)
Description copied from interface:RailComMethod for a RailCom Reader to set the orientation reported back from a device- Specified by:
setOrientationin interfaceRailCom- Parameters:
type- the orientation to set
-
getOrientation
public int getOrientation()
Description copied from interface:RailComGets the Orientation of the Rail Com device on the track- Specified by:
getOrientationin interfaceRailCom- Returns:
- current orientation
-
setActualSpeed
public void setActualSpeed(int type)
Description copied from interface:RailComMethod for a RailCom Reader to set the Actual speed reported back from a device- Specified by:
setActualSpeedin interfaceRailCom- Parameters:
type- the speed
-
getActualSpeed
public int getActualSpeed()
Description copied from interface:RailComGets the actual speed reported by the RailCom device as a representation 128 speed steps- Specified by:
getActualSpeedin interfaceRailCom- Returns:
- -1 if not set.
-
setActualLoad
public void setActualLoad(int type)
Description copied from interface:RailComMethod for a RailCom Reader to set the Actual Load back from a device.- Specified by:
setActualLoadin interfaceRailCom- Parameters:
type- the load
-
getActualLoad
public int getActualLoad()
Description copied from interface:RailComGets the actual load reported by decoder the RailCom device.- Specified by:
getActualLoadin interfaceRailCom- Returns:
- -1 if not set.
-
setActualTemperature
public void setActualTemperature(int type)
Description copied from interface:RailComMethod for a RailCom Reader to set the actual temperate reported back from a device.- Specified by:
setActualTemperaturein interfaceRailCom- Parameters:
type- the temperature
-
getActualTemperature
public int getActualTemperature()
Description copied from interface:RailComGets the actual temperate reported by the RailCom device. Location is configured in CV876 (RP.9.3.2)- Specified by:
getActualTemperaturein interfaceRailCom- Returns:
- -1 if not set.
-
setWaterLevel
public void setWaterLevel(int type)
Description copied from interface:RailComMethod for a RailCom Reader to set the water level reported back from a device.- Specified by:
setWaterLevelin interfaceRailCom- Parameters:
type- the water level
-
getWaterLevel
public int getWaterLevel()
Description copied from interface:RailComGets the remaining fuel level as a % Water level CV878 (RP.9.3.2)- Specified by:
getWaterLevelin interfaceRailCom- Returns:
- -1 if not set.
-
setFuelLevel
public void setFuelLevel(int type)
Description copied from interface:RailComMethod for a RailCom Reader to set the fuel level reported back from a device.- Specified by:
setFuelLevelin interfaceRailCom- Parameters:
type- the fuel level
-
getFuelLevel
public int getFuelLevel()
Description copied from interface:RailComGets the remaining fuel level as a % Fuel level CV879 (RP.9.3.2)- Specified by:
getFuelLevelin interfaceRailCom- Returns:
- -1 if not set.
-
setLocation
public void setLocation(int type)
Description copied from interface:RailComMethod for a RailCom Reader to set the location reported back from a device.- Specified by:
setLocationin interfaceRailCom- Parameters:
type- the location
-
getLocation
public int getLocation()
Description copied from interface:RailComGets the Last Location that the RailCom device was identified in Location is configured in CV876 (RP.9.3.2)- Specified by:
getLocationin interfaceRailCom- Returns:
- -1 if not set.
-
setRoutingNo
public void setRoutingNo(int type)
Description copied from interface:RailComMethod for a RailCom Reader to set the routing number reported back from a device.- Specified by:
setRoutingNoin interfaceRailCom- Parameters:
type- the routing number
-
getRoutingNo
public int getRoutingNo()
Description copied from interface:RailComGets the routing number that the RailCom device wishes to travel. Route Number is configured in CV874 (RP.9.3.2)- Specified by:
getRoutingNoin interfaceRailCom- Returns:
- -1 if not set.
-
setExpectedCv
public void setExpectedCv(int cv)
Description copied from interface:RailComSet the CV number of the next expected value to be returned in a RailCom Packet.- Specified by:
setExpectedCvin interfaceRailCom- Parameters:
cv- the expected CV
-
getExpectedCv
public int getExpectedCv()
Description copied from interface:RailComGet the expected CV to be returned in a RailCom Packet.- Specified by:
getExpectedCvin interfaceRailCom- Returns:
- the expected CV
-
setCvValue
public void setCvValue(int value)
Description copied from interface:RailComSet the value of the CV that has been read from the RailCom packet.- Specified by:
setCvValuein interfaceRailCom- Parameters:
value- the CV value
-
getCV
public int getCV(int cv)
Description copied from interface:RailComGets the value of a CV reported back from the RailCom device.
-
setCV
public void setCV(int cv, int value)
Description copied from interface:RailComSets the value of a CV reported back from the decoder.
-
getCVList
public java.util.List<java.lang.Integer> getCVList()
Description copied from interface:RailComGet a list of the CVs last seen for this RailCom device.
-
toReportString
public java.lang.String toReportString()
Description copied from class:AbstractIdTagThe 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:
toReportStringin interfaceReportable- Overrides:
toReportStringin classAbstractIdTag- Returns:
- a report string representing the Object.
-
-