Class InputBits
- java.lang.Object
-
- jmri.jmrix.maple.InputBits
-
public class InputBits extends java.lang.Object
Utility Class supporting input from Maple HMI'sAll of the Maple HMI panels are configured with the same input bits. As each HMI is polled, the results are ORed together in an input array that is initialized to all 0 when a polling cycle is initiated. That way, if a bit is 1 in any of the HMI's, it will be 1 in the input array at the end of the polling cycle. At the end of each polling cycle, each input bit is compared to the input bit from the last polling cycle. If a bit has changed, or if this is the first polling cycle, the correspnding Sensor state is updated. No updating occurs if all panels timed out. Serial systems with unique input bits for each node keep their input array in each node. That code has been moved to this utility class for Maple Systems because all nodes share the same set of input bits. Coil bits within Maple Systems HMI's are divided into input (1-1000) and output (1001-9000), so input bits are read starting from HMI address 1, and output bits are written starting at HMI address 1001.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
MAXSENSORS
protected Sensor[]
sensorArray
protected int[]
sensorLastSetting
protected boolean[]
sensorORedSetting
protected int[]
sensorTempSetting
-
Constructor Summary
Constructors Constructor Description InputBits(SerialTrafficController _tc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
forceSensorsUnknown()
int
getLastSensor()
int
getMaxSensors()
static int
getNumInputBits()
static int
getTimeoutTime()
void
makeChanges()
This routine is invoked at the end of each polling cycle to change those Sensors that have changed during the polling cycle.void
markChanges(SerialReply l)
Use the contents of the poll reply to mark changes Bits from all the polled panels are ORed together.void
registerSensor(Sensor s, int i)
The numbers here are 0 to MAXSENSORS, not 1 to MAXSENSORS.static void
setNumInputBits(int n)
static void
setTimeoutTime(int n)
-
-
-
Field Detail
-
MAXSENSORS
static final int MAXSENSORS
- See Also:
- Constant Field Values
-
sensorArray
protected Sensor[] sensorArray
-
sensorLastSetting
protected int[] sensorLastSetting
-
sensorTempSetting
protected int[] sensorTempSetting
-
sensorORedSetting
protected boolean[] sensorORedSetting
-
-
Constructor Detail
-
InputBits
public InputBits(SerialTrafficController _tc)
-
-
Method Detail
-
setNumInputBits
public static void setNumInputBits(int n)
-
getNumInputBits
public static int getNumInputBits()
-
setTimeoutTime
public static void setTimeoutTime(int n)
-
getTimeoutTime
public static int getTimeoutTime()
-
getLastSensor
public int getLastSensor()
-
getMaxSensors
public int getMaxSensors()
-
forceSensorsUnknown
public void forceSensorsUnknown()
-
markChanges
public void markChanges(SerialReply l)
Use the contents of the poll reply to mark changes Bits from all the polled panels are ORed together. So if any panel has the bit on (after any inversion is provided for), the resulting bit will be on when the polling cycle is complete.- Parameters:
l
- Reply to a poll operation
-
makeChanges
public void makeChanges()
This routine is invoked at the end of each polling cycle to change those Sensors that have changed during the polling cycle. After making whatever changes are warranted, this routine clears the array for accumulating a new polling cycle. Only sensors that are actually defined are updated
-
registerSensor
public void registerSensor(Sensor s, int i)
The numbers here are 0 to MAXSENSORS, not 1 to MAXSENSORS.- Parameters:
s
- Sensor objecti
- 0 to MAXSENSORS number of sensor's input bit on this node
-
-