Package jmri.jmrit
Class AbstractIdentify
java.lang.Object
jmri.jmrit.AbstractIdentify
- All Implemented Interfaces:
EventListener,ProgListener
- Direct Known Subclasses:
IdentifyDecoder,IdentifyLoco
Abstract base for common code of
IdentifyLoco and
IdentifyDecoder, the two classes that use a
programmer to match Roster entries to what's on the programming track.
This is a class (instead of a Roster member
function) to simplify use of Programmer callbacks.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String(package private) String(package private) int(package private) boolean(package private) Programmer(package private) int(package private) static final int(package private) ProgrammingMode(package private) intState of the internal sequence.Fields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voiderror()Abstract routine to notify of errors.protected voidStop the identification state machine.booleanCheck the current status of theoptionalCvflag.booleanTo check if running now.voidprogrammingOpReply(int value, int status) Internal method to handle the programmer callbacks, e.g. when a CV read request terminates.protected voidRead a single CV for the next step.voidsetOptionalCv(boolean flag) Specify whether the next CV read may legitimately fail in some cases.voidstart()Start the identification state machine.protected abstract voidstatusUpdate(String status) Update the status field (if any).abstract booleantest1()abstract booleantest2(int value) abstract booleantest3(int value) abstract booleantest4(int value) abstract booleantest5(int value) abstract booleantest6(int value) abstract booleantest7(int value) abstract booleantest8(int value) abstract booleantest9(int value) protected voidWrite a single CV for the next step.
-
Field Details
-
RETRY_COUNT
- See Also:
-
programmer
-
savedMode
-
state
int stateState of the internal sequence. -
retry
int retry -
lastValue
int lastValue -
optionalCv
boolean optionalCv -
cvToRead
-
cvToWrite
-
-
Constructor Details
-
AbstractIdentify
-
-
Method Details
-
test1
-
test2
-
test3
-
test4
-
test5
-
test6
-
test7
-
test8
-
test9
-
statusUpdate
Update the status field (if any). Invoked with "Done" when the results are in.- Parameters:
status- the new status
-
start
Start the identification state machine. -
identifyDone
Stop the identification state machine. This also stops the identification process. Its invoked when a testN returns true; that routine should _not_ have invoked a read or write that will result in a callback. -
programmingOpReply
Internal method to handle the programmer callbacks, e.g. when a CV read request terminates. Each will reduce (if possible) the list of consistent decoders, and starts the next step.- Specified by:
programmingOpReplyin interfaceProgListener- Parameters:
value- the value returnedstatus- the status reported
-
error
Abstract routine to notify of errors. -
isRunning
To check if running now.- Returns:
- true if running; false otherwise
-
readCV
Read a single CV for the next step.- Parameters:
cv- the CV to read
-
writeCV
Write a single CV for the next step.- Parameters:
cv- the CV to writevalue- to write to the CV
-
isOptionalCv
Check the current status of theoptionalCvflag.- If
true, prevents the next CV read from aborting the identification process. - Always
falseafter a successful read.
- Returns:
- the current status of the
optionalCvflag
- If
-
setOptionalCv
Specify whether the next CV read may legitimately fail in some cases.- Parameters:
flag- Settrueto indicate that the next read may fail. A successful read will automatically set tofalse.
-