|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.AbstractNode
jmri.jmrix.cmri.serial.SerialNode
public class SerialNode
Models a serial C/MRI node, consisting of a (S)USIC and attached cards.
Nodes are numbered ala the UA number, from 1 to 63. Node number 1 carries sensors 1 to 999, node 2 1001 to 1999 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.
The SMINI is defined as having 1 input and 2 outputs cards.
USIC/SUSIC nodes can have 0-63 inputs and 0-63 output cards, but no
more than 64 total cards.
| Field Summary | |
|---|---|
protected int |
bitsPerCard
|
protected byte[] |
cardTypeLocation
|
protected boolean |
hasActiveSensors
|
static byte |
INPUT_CARD
|
protected int |
lastUsedSensor
|
protected byte[] |
locSearchLightBits
|
static int |
MAXCARDLOCATIONBYTES
|
static int |
MAXSEARCHLIGHTBYTES
|
static byte |
NO_CARD
|
protected int |
nodeType
|
protected int |
num2LSearchLights
|
static byte |
OUTPUT_CARD
|
protected byte[] |
outputArray
|
protected int |
pulseWidth
|
protected Sensor[] |
sensorArray
|
protected int[] |
sensorLastSetting
|
protected int[] |
sensorTempSetting
|
static int |
SMINI
|
protected int |
transmissionDelay
|
static int |
USIC_SUSIC
|
| Fields inherited from class jmri.jmrix.AbstractNode |
|---|
nodeAddress |
| Constructor Summary | |
|---|---|
SerialNode()
Assumes a node address of 0, and a node type of SMINI If this constructor is used, actual node address must be set using setNodeAddress, and actual node type using 'setNodeType' |
|
SerialNode(int address,
int type)
Creates a new SerialNode and initialize default instance variables address - Address of node on CMRI serial bus (0-127) type - SMINI, USIC_SUSIC, |
|
| Method Summary | |
|---|---|
protected boolean |
checkNodeAddress(int address)
Check valid node address, must match value in dip switches (0 - 127) |
void |
clear2LeadSearchLight(int bit)
Public Method to clear location of SearchLightBits (SMINI only) bit - bitNumber of the low bit of an oscillating search light bit pair Notes: Bits are numbered from 0 Two bits are cleared by each call - bit and bit + 1. |
AbstractMRMessage |
createInitPacket()
Public Method to create an Initialization packet (SerialMessage) for this node |
AbstractMRMessage |
createOutPacket()
Public Method to create an Transmit packet (SerialMessage) |
byte[] |
getCardTypeLocation()
|
int |
getInputCardIndex(int cardNum)
Public method to return 'Input Card Index' Returns the index this input card would have in an array of input cards for this node. |
byte[] |
getLocSearchLightBits()
|
int |
getNodeType()
Public method to return node type Current types are: SMINI, USIC_SUSIC, |
int |
getNum2LSearchLights()
|
int |
getNumBitsPerCard()
Public method to return number of bits per card. |
boolean |
getOutputBit(int bitNumber)
Public method get the current state of an output bit. |
int |
getOutputCardIndex(int cardNum)
Public method to return 'Output Card Index' Returns the index this output card would have in an array of output cards for this node. |
int |
getPulseWidth()
Public method to return pulse width. |
boolean |
getSensorsActive()
Public method to return state of Sensors. |
int |
getTransmissionDelay()
Public method to return transmission delay. |
boolean |
handleTimeout(AbstractMRMessage m,
AbstractMRListener l)
Deal with a timeout in the transmission controller. |
boolean |
isInputCard(int cardNum)
Public method to test for INPUT_CARD type. |
boolean |
isOutputCard(int cardNum)
Public method to test for OUTPUT_CARD type. |
boolean |
isSearchLightBit(int bit)
Public Method to query SearchLightBits by bit number (SMINI only) bit - bitNumber of the either bit of an oscillating search light bit pair Note: returns 'true' if bit is an oscillating SearchLightBit, otherwise 'false' is returned |
void |
markChanges(SerialReply l)
Use the contents of the poll reply to mark changes |
int |
numInputCards()
Public method to return number of input cards. |
int |
numOutputCards()
Public method to return number of output cards. |
void |
registerSensor(Sensor s,
int i)
The numbers here are 0 to MAXSENSORS, not 1 to MAXSENSORS. |
void |
resetTimeout(AbstractMRMessage m)
A reply was received, so there was not timeout, do any needed processing. |
void |
set2LeadSearchLight(int bit)
Public Method to set location of SearchLightBits (SMINI only) bit - bitNumber of the low bit of an oscillating search light bit pair Notes: Bits are numbered from 0 Two bits are set by each call - bit and bit + 1. |
void |
setCardTypeByAddress(int address,
int type)
Public method to set the type of one card. |
void |
setCardTypeLocation(int num,
int value)
|
void |
setLocSearchLightBits(int num,
int value)
|
void |
setNodeType(int type)
Public method to set node type Current types are: SMINI, USIC_SUSIC, For SMINI, also sets cardTypeLocation[] and bitsPerCard For USIC_SUSIC, also clears cardTypeLocation |
void |
setNum2LSearchLights(int n)
|
void |
setNumBitsPerCard(int bits)
Public method to set number of bits per card. |
void |
setOutputBit(int bitNumber,
boolean state)
Public method setting an output bit. |
void |
setPulseWidth(int width)
Public method to set pulse width. |
void |
setSensorsActive(boolean flag)
Public method to set state of Sensors. |
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 |
|---|
public static final int MAXSEARCHLIGHTBYTES
public static final int MAXCARDLOCATIONBYTES
public static final int SMINI
public static final int USIC_SUSIC
public static final byte INPUT_CARD
public static final byte OUTPUT_CARD
public static final byte NO_CARD
protected int nodeType
protected int bitsPerCard
protected int transmissionDelay
protected int pulseWidth
protected int num2LSearchLights
protected byte[] locSearchLightBits
protected byte[] cardTypeLocation
protected byte[] outputArray
protected boolean hasActiveSensors
protected int lastUsedSensor
protected Sensor[] sensorArray
protected int[] sensorLastSetting
protected int[] sensorTempSetting
| Constructor Detail |
|---|
public SerialNode()
public SerialNode(int address,
int type)
| Method Detail |
|---|
public int getNum2LSearchLights()
public void setNum2LSearchLights(int n)
public byte[] getLocSearchLightBits()
public void setLocSearchLightBits(int num,
int value)
public byte[] getCardTypeLocation()
public void setCardTypeLocation(int num,
int value)
public void setOutputBit(int bitNumber,
boolean state)
public boolean getOutputBit(int bitNumber)
public boolean getSensorsActive()
getSensorsActive in class AbstractNodepublic void setSensorsActive(boolean flag)
public int numInputCards()
public int numOutputCards()
public int getNodeType()
public void setNodeType(int type)
public int getNumBitsPerCard()
public void setNumBitsPerCard(int bits)
protected boolean checkNodeAddress(int address)
checkNodeAddress in class AbstractNodepublic int getTransmissionDelay()
public void setTransmissionDelay(int delay)
public int getPulseWidth()
public void setPulseWidth(int width)
public void setCardTypeByAddress(int address,
int type)
public boolean isOutputCard(int cardNum)
public boolean isInputCard(int cardNum)
public int getOutputCardIndex(int cardNum)
public int getInputCardIndex(int cardNum)
public void set2LeadSearchLight(int bit)
public void clear2LeadSearchLight(int bit)
public boolean isSearchLightBit(int bit)
public AbstractMRMessage createInitPacket()
createInitPacket in class AbstractNodepublic AbstractMRMessage createOutPacket()
createOutPacket in class AbstractNodepublic void markChanges(SerialReply l)
l - Reply to a poll operation
public void registerSensor(Sensor s,
int i)
s - - Sensor objecti - - 0 to MAXSENSORS number of sensor's input bit on this node
public boolean handleTimeout(AbstractMRMessage m,
AbstractMRListener l)
AbstractNode
handleTimeout in class AbstractNodem - message that didn't receive a replyl - listener that sent the message
public void resetTimeout(AbstractMRMessage m)
AbstractNode
resetTimeout in class AbstractNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||