jmri.jmrix.acela
Class AcelaNode

java.lang.Object
  extended by jmri.jmrix.AbstractNode
      extended by jmri.jmrix.acela.AcelaNode

public class AcelaNode
extends AbstractNode

Models a Acela node.

Nodes are numbered from 0. The first watchman node carries the first 8 sensors 0 to 7, etc.

The array of sensor states is used to update sensor known state only when there's a change on the serial bus. This allows for the sensor state to be updated within the program, keeping this updated state until the next change on the serial bus. E.g. you can manually change a state via an icon, and not have it change back the next time that node is polled.

Same applies to the outputs (Dash-8s and Signalmen)

Author:
Bob Jacobsen Copyright (C) 2003, Bob Jacobsen, Dave Duchamp, multiNode extensions, 2004, Bob Coleman Copyright (C) 2007, 2008 Based on CMRI serial example, modified to establish Acela support.

Field Summary
static byte AC
           
static byte D8
           
protected  int endingOutputAddress
           
protected  int endingSensorAddress
           
protected  boolean hasActiveSensors
           
protected  int lastUsedSensor
           
static String[] moduleNames
           
protected  boolean needInit
           
protected  int nodeType
           
protected  byte[] outputArray
           
protected  int outputbitsPerCard
           
static byte SC
           
protected  Sensor[] sensorArray
           
protected  int sensorbitsPerCard
           
protected  boolean[] sensorInit
           
protected  int[] sensorLastSetting
           
protected  int[] sensorTempSetting
           
static byte SM
           
protected  int startingOutputAddress
           
protected  int startingSensorAddress
           
static byte SW
           
static byte SY
           
static byte TB
           
protected  int transmissionDelay
           
static byte UN
           
static byte WM
           
static byte YM
           
 
Fields inherited from class jmri.jmrix.AbstractNode
nodeAddress
 
Constructor Summary
AcelaNode()
          Assumes a node address of 0, and a node type of NO_CARD If this constructor is used, actual node address must be set using setNodeAddress, and actual node type using 'setNodeType'
AcelaNode(int address, int type)
          Creates a new AcelaNode and initialize default instance variables address - Address of first bit on Acela bus (0-1023) type - D8, SM, WM
 
Method Summary
 boolean checkNodeAddress(int address)
          Public method to set the node address.
 AbstractMRMessage createInitPacket()
          Create an initialization packet if needed
 AbstractMRMessage createOutPacket()
          Public Method to create an Transmit packet (SerialMessage)
 int getEndingOutputAddress()
          Public method getting ending output addresss Used to help linear address search
 int getEndingSensorAddress()
          Public method getting ending sensor addresss Used to help linear address search
 int getNodeType()
          Public method to return node type
 int getNumOutputBitsPerCard()
          Public method to return number of bits per card.
 int getNumSensorBitsPerCard()
           
 boolean getOutputBit(int bitNumber)
          Public method get the current state of an output bit.
 int getSensorBitsPerCard()
          Public method to return the number of sensor bits per node.
 int getStartingOutputAddress()
          Public method getting starting output addresss Used to help linear address search
 int getStartingSensorAddress()
          Public method getting starting sensor addresss Used to help linear address search
 int getTransmissionDelay()
          Public method to return transmission delay.
 boolean handleTimeout(AbstractMRMessage m)
          Deal with a timeout in the transmission controller.
 void markChanges(AcelaReply l)
          Use the contents of the poll reply to mark changes
 void registerSensor(Sensor s, int rawaddr)
          The numbers here are 0 to MAXSENSORBITS, not 1 to MAXSENSORBITS.
 void resetTimeout(AbstractMRMessage m)
          A reply was received, so there was not timeout, do any needed processing.
 boolean sensorsActive()
          Public method to return state of Sensors.
 void setEndingOutputAddress(int endingAddress)
          Public method setting ending output addresss Used to help linear address search
 void setEndingSensorAddress(int endingAddress)
          Public method setting ending sensor addresss Used to help linear address search
 void setNodeType(int type)
          Public method to set node type
 void setOutputBit(int bitNumber, boolean state)
          Public method setting an output bit.
 void setStartingOutputAddress(int startingAddress)
          Public method setting starting output addresss Used to help linear address search
 void setStartingSensorAddress(int startingAddress)
          Public method setting starting sensor addresss Used to help linear address search
 void setTransmissionDelay(int delay)
          Public method to set transmission delay.
 
Methods inherited from class jmri.jmrix.AbstractNode
getNodeAddress, mustSend, resetMustSend, setMustSend, setNodeAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AC

public static final byte AC
See Also:
Constant Field Values

TB

public static final byte TB
See Also:
Constant Field Values

D8

public static final byte D8
See Also:
Constant Field Values

WM

public static final byte WM
See Also:
Constant Field Values

SM

public static final byte SM
See Also:
Constant Field Values

SC

public static final byte SC
See Also:
Constant Field Values

SW

public static final byte SW
See Also:
Constant Field Values

YM

public static final byte YM
See Also:
Constant Field Values

SY

public static final byte SY
See Also:
Constant Field Values

UN

public static final byte UN
See Also:
Constant Field Values

moduleNames

public static final String[] moduleNames

nodeType

protected int nodeType

outputbitsPerCard

protected int outputbitsPerCard

sensorbitsPerCard

protected int sensorbitsPerCard

transmissionDelay

protected int transmissionDelay

needInit

protected boolean needInit

outputArray

protected byte[] outputArray

hasActiveSensors

protected boolean hasActiveSensors

lastUsedSensor

protected int lastUsedSensor

sensorArray

protected Sensor[] sensorArray

sensorInit

protected boolean[] sensorInit

sensorLastSetting

protected int[] sensorLastSetting

sensorTempSetting

protected int[] sensorTempSetting

startingOutputAddress

protected int startingOutputAddress

endingOutputAddress

protected int endingOutputAddress

startingSensorAddress

protected int startingSensorAddress

endingSensorAddress

protected int endingSensorAddress
Constructor Detail

AcelaNode

public AcelaNode()
Assumes a node address of 0, and a node type of NO_CARD If this constructor is used, actual node address must be set using setNodeAddress, and actual node type using 'setNodeType'


AcelaNode

public AcelaNode(int address,
                 int type)
Creates a new AcelaNode and initialize default instance variables address - Address of first bit on Acela bus (0-1023) type - D8, SM, WM

Method Detail

setStartingOutputAddress

public void setStartingOutputAddress(int startingAddress)
Public method setting starting output addresss Used to help linear address search


getStartingOutputAddress

public int getStartingOutputAddress()
Public method getting starting output addresss Used to help linear address search


setEndingOutputAddress

public void setEndingOutputAddress(int endingAddress)
Public method setting ending output addresss Used to help linear address search


getEndingOutputAddress

public int getEndingOutputAddress()
Public method getting ending output addresss Used to help linear address search


setStartingSensorAddress

public void setStartingSensorAddress(int startingAddress)
Public method setting starting sensor addresss Used to help linear address search


getStartingSensorAddress

public int getStartingSensorAddress()
Public method getting starting sensor addresss Used to help linear address search


setEndingSensorAddress

public void setEndingSensorAddress(int endingAddress)
Public method setting ending sensor addresss Used to help linear address search


getEndingSensorAddress

public int getEndingSensorAddress()
Public method getting ending sensor addresss Used to help linear address search


setOutputBit

public void setOutputBit(int bitNumber,
                         boolean state)
Public method setting an output bit. Note: state = 'true' for 0, 'false' for 1


getOutputBit

public boolean getOutputBit(int bitNumber)
Public method get the current state of an output bit. Note: returns 'true' for 0, 'false' for 1 bits are numbered from 0 for Acela


sensorsActive

public boolean sensorsActive()
Public method to return state of Sensors. Note: returns 'true' if at least one sensor is active for this node

Specified by:
sensorsActive in class AbstractNode

getNodeType

public int getNodeType()
Public method to return node type


setNodeType

public void setNodeType(int type)
Public method to set node type


getNumOutputBitsPerCard

public int getNumOutputBitsPerCard()
Public method to return number of bits per card.


getNumSensorBitsPerCard

public int getNumSensorBitsPerCard()

checkNodeAddress

public boolean checkNodeAddress(int address)
Public method to set the node address.

Specified by:
checkNodeAddress in class AbstractNode
Returns:
true if valid

getSensorBitsPerCard

public int getSensorBitsPerCard()
Public method to return the number of sensor bits per node.


getTransmissionDelay

public int getTransmissionDelay()
Public method to return transmission delay.


setTransmissionDelay

public void setTransmissionDelay(int delay)
Public method to set transmission delay. delay - delay between bytes on receive (units of 10 microsec.) Note: two bytes are used, so range is 0-65,535. If delay is out of range, it is restricted to the allowable range


createInitPacket

public AbstractMRMessage createInitPacket()
Create an initialization packet if needed

Specified by:
createInitPacket in class AbstractNode

createOutPacket

public AbstractMRMessage createOutPacket()
Public Method to create an Transmit packet (SerialMessage)

Specified by:
createOutPacket in class AbstractNode

markChanges

public void markChanges(AcelaReply l)
Use the contents of the poll reply to mark changes

Parameters:
l - Reply to a poll operation

registerSensor

public void registerSensor(Sensor s,
                           int rawaddr)
The numbers here are 0 to MAXSENSORBITS, not 1 to MAXSENSORBITS.

Parameters:
s - - Sensor object
rawaddr - - 0 to MAXSENSORBITS number of sensor's input bit on this node

handleTimeout

public boolean handleTimeout(AbstractMRMessage m)
Description copied from class: AbstractNode
Deal with a timeout in the transmission controller.

Specified by:
handleTimeout in class AbstractNode
Parameters:
m - message that didn't receive a reply
Returns:
true if initialization required

resetTimeout

public void resetTimeout(AbstractMRMessage m)
Description copied from class: AbstractNode
A reply was received, so there was not timeout, do any needed processing.

Specified by:
resetTimeout in class AbstractNode


Copyright © 1997 - 2008 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: SourceForge_Logo