jmri.implementation
Class DefaultRailCom

Show UML class diagram
java.lang.Object
  extended by jmri.implementation.AbstractNamedBean
      extended by jmri.implementation.AbstractIdTag
          extended by jmri.implementation.DefaultIdTag
              extended by jmri.implementation.DefaultRailCom
All Implemented Interfaces:
Serializable, IdTag, NamedBean, RailCom

public class DefaultRailCom
extends DefaultIdTag
implements RailCom

Concrete implementation of the RailCom 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
See Also:
Serialized Form

Field Summary
(package private)  int actual_load
           
(package private)  int actual_speed
           
(package private)  int actual_temperature
           
(package private)  int addressTypeInt
           
(package private)  Hashtable<Integer,Integer> cvValues
           
(package private)  int expectedCV
           
(package private)  int fuelLevel
           
(package private)  int location
           
(package private) static org.slf4j.Logger log
           
(package private)  int orientation
           
(package private)  int routing_no
           
(package private)  int waterLevel
           
 
Fields inherited from class jmri.implementation.AbstractIdTag
_whenLastSeen, _whereLastSeen
 
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, mUserName, parameters, pcs, register
 
Fields inherited from interface jmri.RailCom
CONSIST_ADDRESS, LONG_ADDRESS, NO_ADDRESS, SHORT_ADDRESS
 
Fields inherited from interface jmri.IdTag
SEEN, UNSEEN
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
DefaultRailCom(String systemName)
           
DefaultRailCom(String systemName, String userName)
           
 
Method Summary
 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 steps
 int getActualTemperature()
          Gets the actual temperate reported by the RailCom device.
 int getAddressType()
          Gets the actual type of address reported back by the RailCom device
 String getAddressTypeAsString()
          Gets the actual address type as a String.
 int getCv(int cv)
          Gets the value of a CV reported back from the RailCom device.
 List<Integer> getCVList()
          returns a list of the CVs and values last seen for this Railcom device.
 DccLocoAddress getDccLocoAddress()
          Gets the address reported back as a jmri.DccLocoAddress
 int getExpectedCv()
          returns the CV that we are expecting 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 track
 int 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 device
 void setActualTemperature(int type)
          Method for a RailCom Reader to set the actual temperate reported back from a device
 void setAddressType(int type)
          Method for a RailCom Reader to set the Address type 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)
          Sets the value of the cv that has been read from the rail comm packet
 void setExpectedCv(int cv)
          This sets 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 device
 void 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
 
Methods inherited from class jmri.implementation.DefaultIdTag
load, setWhereLastSeen, store
 
Methods inherited from class jmri.implementation.AbstractIdTag
getBeanType, getTagID, getWhenLastSeen, getWhereLastSeen, toString
 
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, getComment, getDisplayName, getFullyFormattedDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removeProperty, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef, vetoableChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmri.IdTag
getTagID, getWhenLastSeen, getWhereLastSeen, load, setWhereLastSeen, store
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, dispose, getBeanType, getComment, getDisplayName, getFullyFormattedDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removeProperty, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef, vetoableChange
 

Field Detail

orientation

int orientation

addressTypeInt

int addressTypeInt

actual_speed

int actual_speed

actual_load

int actual_load

actual_temperature

int actual_temperature

waterLevel

int waterLevel

fuelLevel

int fuelLevel

location

int location

routing_no

int routing_no

expectedCV

int expectedCV

cvValues

Hashtable<Integer,Integer> cvValues

log

static org.slf4j.Logger log
Constructor Detail

DefaultRailCom

public DefaultRailCom(String systemName)

DefaultRailCom

public DefaultRailCom(String systemName,
                      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 provided to make Jython script access easier to read.

Specified by:
setState in interface NamedBean
Overrides:
setState in class DefaultIdTag
Throws:
JmriException - general error when cant do the needed operation

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 provided to make Jython script access easier to read.

Specified by:
getState in interface NamedBean
Overrides:
getState in class DefaultIdTag

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 interface RailCom

getOrientation

public int getOrientation()
Description copied from interface: RailCom
Gets the Orientation of the Rail Com device on the track

Specified by:
getOrientation in interface RailCom

getAddressTypeAsString

public String getAddressTypeAsString()
Description copied from interface: RailCom
Gets the actual address type as a String.

Specified by:
getAddressTypeAsString in interface RailCom

getDccLocoAddress

public DccLocoAddress getDccLocoAddress()
Description copied from interface: RailCom
Gets the address reported back as a jmri.DccLocoAddress

Specified by:
getDccLocoAddress in interface RailCom

setAddressType

public void setAddressType(int type)
Description copied from interface: RailCom
Method for a RailCom Reader to set the Address type reported back from a device

Specified by:
setAddressType in interface RailCom

getAddressType

public int getAddressType()
Description copied from interface: RailCom
Gets the actual type of address reported back by the RailCom device

Specified by:
getAddressType in interface RailCom
Returns:
-1 if not set.

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 interface RailCom

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 interface RailCom
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 interface RailCom

getActualLoad

public int getActualLoad()
Description copied from interface: RailCom
Gets the actual load reported by decoder the RailCom device.

Specified by:
getActualLoad in interface RailCom
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 interface RailCom

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 interface RailCom
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 interface RailCom

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 interface RailCom
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 interface RailCom

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 interface RailCom
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 interface RailCom

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 interface RailCom
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 interface RailCom

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 interface RailCom
Returns:
-1 if not set.

setExpectedCv

public void setExpectedCv(int cv)
Description copied from interface: RailCom
This sets the cv number of the next expected value to be returned in a RailCom Packet.

Specified by:
setExpectedCv in interface RailCom

getExpectedCv

public int getExpectedCv()
Description copied from interface: RailCom
returns the CV that we are expecting to be returned in a railcom packet

Specified by:
getExpectedCv in interface RailCom

setCvValue

public void setCvValue(int value)
Description copied from interface: RailCom
Sets the value of the cv that has been read from the rail comm packet

Specified by:
setCvValue in interface RailCom

getCv

public int getCv(int cv)
Description copied from interface: RailCom
Gets the value of a CV reported back from the RailCom device.

Specified by:
getCv in interface RailCom
Parameters:
cv - CV number that the value relates to.
Returns:
the value of the CV, or 0 if none has yet been collected

setCv

public void setCv(int cv,
                  int value)
Description copied from interface: RailCom
Sets the value of a CV reported back from the decoder.

Specified by:
setCv in interface RailCom
Parameters:
cv - CV number that the value relates to.
value - Value of the CV

getCVList

public List<Integer> getCVList()
Description copied from interface: RailCom
returns a list of the CVs and values last seen for this Railcom device.

Specified by:
getCVList in interface RailCom


Copyright © 1997-2014 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