Package jmri.jmrit
Class AbstractIdentify
- java.lang.Object
-
- jmri.jmrit.AbstractIdentify
-
- All Implemented Interfaces:
java.util.EventListener,ProgListener
- Direct Known Subclasses:
IdentifyDecoder,IdentifyLoco
public abstract class AbstractIdentify extends java.lang.Object implements ProgListener
Abstract base for common code ofIdentifyLocoandIdentifyDecoder, 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
Rostermember function) to simplify use ofProgrammercallbacks.- See Also:
CombinedLocoSelPane,NewLocoSelPane
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.StringcvToRead(package private) java.lang.StringcvToWrite(package private) intlastValue(package private) booleanoptionalCv(package private) Programmerprogrammer(package private) intretry(package private) static intRETRY_COUNT(package private) ProgrammingModesavedMode(package private) intstateState 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 Modifier Constructor Description protectedAbstractIdentify(Programmer p)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiderror()Abstract routine to notify of errors.protected voididentifyDone()Stop the identification state machine.booleanisOptionalCv()Check the current status of theoptionalCvflag.booleanisRunning()To 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 voidreadCV(java.lang.String cv)Read 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(java.lang.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 voidwriteCV(java.lang.String cv, int value)Write a single CV for the next step.
-
-
-
Field Detail
-
RETRY_COUNT
static final int RETRY_COUNT
- See Also:
- Constant Field Values
-
programmer
Programmer programmer
-
savedMode
ProgrammingMode savedMode
-
state
int state
State of the internal sequence.
-
retry
int retry
-
lastValue
int lastValue
-
optionalCv
boolean optionalCv
-
cvToRead
java.lang.String cvToRead
-
cvToWrite
java.lang.String cvToWrite
-
-
Constructor Detail
-
AbstractIdentify
protected AbstractIdentify(Programmer p)
-
-
Method Detail
-
test1
public abstract boolean test1()
-
test2
public abstract boolean test2(int value)
-
test3
public abstract boolean test3(int value)
-
test4
public abstract boolean test4(int value)
-
test5
public abstract boolean test5(int value)
-
test6
public abstract boolean test6(int value)
-
test7
public abstract boolean test7(int value)
-
test8
public abstract boolean test8(int value)
-
test9
public abstract boolean test9(int value)
-
statusUpdate
protected abstract void statusUpdate(java.lang.String status)
Update the status field (if any). Invoked with "Done" when the results are in.- Parameters:
status- the new status
-
start
public void start()
Start the identification state machine.
-
identifyDone
protected void 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
public void programmingOpReply(int value, int status)
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
protected abstract void error()
Abstract routine to notify of errors.
-
isRunning
public boolean isRunning()
To check if running now.- Returns:
- true if running; false otherwise
-
readCV
protected void readCV(java.lang.String cv)
Read a single CV for the next step.- Parameters:
cv- the CV to read
-
writeCV
protected void writeCV(java.lang.String cv, int value)
Write a single CV for the next step.- Parameters:
cv- the CV to writevalue- to write to the CV
-
isOptionalCv
public boolean 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
public void setOptionalCv(boolean flag)
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.
-
-