|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.automat.AbstractAutomaton
jmri.jmrit.automat.SampleAutomaton3
public class SampleAutomaton3
This sample Automaton runs a locomotive back and forth on a piece of track by watching two sensors.
The sensors and locomotive are hardcoded, as this is an example of just the Automaton function. Adding a GUI to configure these would be straight-forward. The values could be passed via the constructor, or the constructor (which can run in any required thread) could invoke a dialog.
For test purposes, one of these objects can be created and invoked by a SampleAutomaton3Action.
SampleAutomaton3Action| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class jmri.jmrit.automat.AbstractAutomaton |
|---|
AbstractAutomaton.MsgFrame |
| Field Summary | |
|---|---|
(package private) Sensor |
fwdSensor
References the sensor the locomotive will enter when it moves forward to the limit. |
(package private) String |
fwdSensorName
By default, monitors sensor "182" for the forward end of the track |
(package private) int |
fwdState
|
(package private) boolean |
locoLong
|
(package private) int |
locoNumber
By default, controls locomotive 77(short). |
(package private) static org.slf4j.Logger |
log
|
(package private) boolean |
moveFwd
|
(package private) Sensor |
revSensor
References the sensor the locomotive will enter when it moves backward to the limit. |
(package private) String |
revSensorName
By default, monitors sensor "178" for the reverse end of the track |
(package private) int |
revState
|
(package private) DccThrottle |
throttle
References the locomotive decoder to be controlled |
| Fields inherited from class jmri.jmrit.automat.AbstractAutomaton |
|---|
currentThread, debugWaitFrame, message, messageFrame, promptOnWait, summary |
| Constructor Summary | |
|---|---|
SampleAutomaton3()
|
|
| Method Summary | |
|---|---|
protected boolean |
handle()
Watch the sensors, and change direction to match. |
protected void |
init()
User-provided initialization routine. |
| Methods inherited from class jmri.jmrit.automat.AbstractAutomaton |
|---|
defaultName, done, getCount, getName, getThrottle, getThrottle, readServiceModeCV, run, setName, setTurnouts, start, stop, wait, waitChange, waitMsec, waitSensorActive, waitSensorActive, waitSensorChange, waitSensorChange, waitSensorInactive, waitSensorInactive, waitSensorState, waitSensorState, waitTurnoutConsistent, writeOpsModeCV, writeServiceModeCV |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
DccThrottle throttle
Sensor fwdSensor
Sensor revSensor
String fwdSensorName
String revSensorName
int locoNumber
boolean locoLong
boolean moveFwd
int fwdState
int revState
static org.slf4j.Logger log
| Constructor Detail |
|---|
public SampleAutomaton3()
| Method Detail |
|---|
protected void init()
AbstractAutomaton
init in class AbstractAutomatonprotected boolean handle()
handle in class AbstractAutomaton
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||