jmri.jmrix.acela
Class AcelaNode

Show UML class diagram
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)


Field Summary
static byte AC
           
static int BLINK
           
static int BPOLAR
           
static byte D8
           
static int DOUBLE
           
static String[] moduleNames
           
static String[] moduleTips
           
static String moduleTypes
           
static String[] nodeNames
           
static int ONOFF
           
static String outputInits
           
static String outputLEN0
           
static String outputNO
           
static String outputONOFF
           
static String outputSignalHeadTypes
           
static String outputTypes
           
static String outputWireds
           
static int PULSE
           
static byte SC
           
static String sensorPolarities
           
static String sensorTypes
           
static byte SM
           
static byte SW
           
static byte SY
           
static byte TB
           
static int TRIPLE
           
static int UKNOWN
           
static byte UN
           
static int WIGWAG
           
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
 String getNodeTypeString()
           
 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 getOutputInit(int circuitnum)
           
 String getOutputInitString(int circuitnum)
           
 int getOutputLength(int circuitnum)
           
 int getOutputSignalHeadType(int circuitnum)
           
 String getOutputSignalHeadTypeString(int circuitnum)
           
 int getOutputSpecial(int circuitnum)
           
 int getOutputType(int circuitnum)
           
 String getOutputTypeString(int circuitnum)
           
 int getOutputWired(int circuitnum)
          Public method to set and return Output configuration values
 String getOutputWiredString(int circuitnum)
           
 int getSensorBitsPerCard()
          Public method to return the number of sensor bits per node.
 int getSensorPolarity(int circuitnum)
           
 String getSensorPolarityString(int circuitnum)
           
 boolean getSensorsActive()
          Public method to return state of Sensors.
 int getSensorThreshold(int circuitnum)
           
 int getSensorType(int circuitnum)
          Public method to set and return Sensor configuration values
 String getSensorTypeString(int circuitnum)
           
 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, AbstractMRListener l)
          Deal with a timeout in the transmission controller.
 void initNode()
           
 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.
 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)
           
 void setNodeTypeString(String stringtype)
          Public method to set node type
 void setOutputBit(int bitNumber, boolean state)
          Public method setting an output bit.
 void setOutputInit(int circuitnum, int type)
           
 void setOutputInitString(int circuitnum, String stringtype)
           
 void setOutputLength(int circuitnum, int newlength)
           
 void setOutputSignalHeadType(int circuitnum, int type)
           
 void setOutputSignalHeadTypeString(int circuitnum, String stringtype)
           
 void setOutputSpecial(int circuitnum, int type)
           
 void setOutputType(int circuitnum, int type)
           
 void setOutputTypeString(int circuitnum, String stringtype)
           
 void setOutputWired(int circuitnum, int type)
           
 void setOutputWiredString(int circuitnum, String stringtype)
           
 void setSensorPolarity(int circuitnum, int polarity)
           
 void setSensorPolarityString(int circuitnum, String stringpolarity)
           
 void setSensorThreshold(int circuitnum, int threshold)
           
 void setSensorType(int circuitnum, int type)
           
 void setSensorTypeString(int circuitnum, String stringtype)
           
 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
equals, 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

moduleTypes

public static final String moduleTypes
See Also:
Constant Field Values

nodeNames

public static final String[] nodeNames

moduleNames

public static final String[] moduleNames

moduleTips

public static final String[] moduleTips

sensorTypes

public static final String sensorTypes
See Also:
Constant Field Values

sensorPolarities

public static final String sensorPolarities
See Also:
Constant Field Values

outputWireds

public static final String outputWireds
See Also:
Constant Field Values

outputInits

public static final String outputInits
See Also:
Constant Field Values

outputTypes

public static final String outputTypes
See Also:
Constant Field Values

ONOFF

public static final int ONOFF
See Also:
Constant Field Values

PULSE

public static final int PULSE
See Also:
Constant Field Values

BLINK

public static final int BLINK
See Also:
Constant Field Values

outputSignalHeadTypes

public static final String outputSignalHeadTypes
See Also:
Constant Field Values

UKNOWN

public static final int UKNOWN
See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
See Also:
Constant Field Values

TRIPLE

public static final int TRIPLE
See Also:
Constant Field Values

BPOLAR

public static final int BPOLAR
See Also:
Constant Field Values

WIGWAG

public static final int WIGWAG
See Also:
Constant Field Values

outputONOFF

public static final String outputONOFF
See Also:
Constant Field Values

outputLEN0

public static final String outputLEN0
See Also:
Constant Field Values

outputNO

public static final String outputNO
See Also:
Constant Field Values
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

initNode

public void initNode()

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


getSensorsActive

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

Specified by:
getSensorsActive in class AbstractNode

getOutputWired

public int getOutputWired(int circuitnum)
Public method to set and return Output configuration values


getOutputWiredString

public String getOutputWiredString(int circuitnum)

setOutputWired

public void setOutputWired(int circuitnum,
                           int type)

setOutputWiredString

public void setOutputWiredString(int circuitnum,
                                 String stringtype)

getOutputInit

public int getOutputInit(int circuitnum)

getOutputInitString

public String getOutputInitString(int circuitnum)

setOutputInit

public void setOutputInit(int circuitnum,
                          int type)

setOutputInitString

public void setOutputInitString(int circuitnum,
                                String stringtype)

getOutputType

public int getOutputType(int circuitnum)

getOutputTypeString

public String getOutputTypeString(int circuitnum)

setOutputType

public void setOutputType(int circuitnum,
                          int type)

setOutputTypeString

public void setOutputTypeString(int circuitnum,
                                String stringtype)

getOutputLength

public int getOutputLength(int circuitnum)

setOutputLength

public void setOutputLength(int circuitnum,
                            int newlength)

getOutputSpecial

public int getOutputSpecial(int circuitnum)

setOutputSpecial

public void setOutputSpecial(int circuitnum,
                             int type)

getOutputSignalHeadType

public int getOutputSignalHeadType(int circuitnum)

getOutputSignalHeadTypeString

public String getOutputSignalHeadTypeString(int circuitnum)

setOutputSignalHeadType

public void setOutputSignalHeadType(int circuitnum,
                                    int type)

setOutputSignalHeadTypeString

public void setOutputSignalHeadTypeString(int circuitnum,
                                          String stringtype)

getSensorType

public int getSensorType(int circuitnum)
Public method to set and return Sensor configuration values


getSensorTypeString

public String getSensorTypeString(int circuitnum)

setSensorType

public void setSensorType(int circuitnum,
                          int type)

setSensorTypeString

public void setSensorTypeString(int circuitnum,
                                String stringtype)

getSensorPolarity

public int getSensorPolarity(int circuitnum)

getSensorPolarityString

public String getSensorPolarityString(int circuitnum)

setSensorPolarity

public void setSensorPolarity(int circuitnum,
                              int polarity)

setSensorPolarityString

public void setSensorPolarityString(int circuitnum,
                                    String stringpolarity)

getSensorThreshold

public int getSensorThreshold(int circuitnum)

setSensorThreshold

public void setSensorThreshold(int circuitnum,
                               int threshold)

getNodeType

public int getNodeType()
Public method to return node type


getNodeTypeString

public String getNodeTypeString()

setNodeTypeString

public void setNodeTypeString(String stringtype)
Public method to set node type


setNodeType

public void setNodeType(int 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.

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,
                             AbstractMRListener l)
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
l - listener that sent the message
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 - 2010 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