Class VerifyWriteProgrammerFacade
- java.lang.Object
-
- jmri.jmrix.AbstractProgrammerFacade
-
- jmri.implementation.VerifyWriteProgrammerFacade
-
- All Implemented Interfaces:
java.util.EventListener,Disposable,ProgListener,Programmer
public class VerifyWriteProgrammerFacade extends AbstractProgrammerFacade implements ProgListener
Programmer facade which verifies each write via a read, if possible.If the underlying programmer (1) can read and (2) is not already doing a read verify, each write operation is followed by a readback. If the value doesn't match, an error is signaled.
State Diagram for read and write operations (click to magnify):

- See Also:
ProgrammerFacadeSelector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classVerifyWriteProgrammerFacade.ProgState-
Nested classes/interfaces inherited from interface jmri.Programmer
Programmer.Configurator, Programmer.WriteConfirmMode
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String_cv(package private) int_val(package private) VerifyWriteProgrammerFacade.ProgStatestate-
Fields inherited from class jmri.jmrix.AbstractProgrammerFacade
prog
-
Fields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted
-
-
Constructor Summary
Constructors Constructor Description VerifyWriteProgrammerFacade(Programmer prog)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Programmer.WriteConfirmModegetWriteConfirmMode(java.lang.String addr)This facade ensures thatProgrammer.WriteConfirmMode.ReadAfterWriteis done, so long as it has permission to read the CV after writing.voidprogrammingOpReply(int value, int status)Receive a callback at the end of a programming operation.voidreadCV(java.lang.String CV, ProgListener p)Perform a CV read in the system-specific manner, and using the specified programming mode.protected voiduseProgrammer(ProgListener p)voidwriteCV(java.lang.String CV, int val, ProgListener p)Perform a CV write in the system-specific manner, and using the specified programming mode.-
Methods inherited from class jmri.jmrix.AbstractProgrammerFacade
addPropertyChangeListener, confirmCV, decodeErrorCode, getCanRead, getCanRead, getCanWrite, getCanWrite, getMode, getSupportedModes, removePropertyChangeListener, setMode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.Programmer
dispose, getConfigurator, notifyProgListenerEnd, readCV
-
-
-
-
Constructor Detail
-
VerifyWriteProgrammerFacade
public VerifyWriteProgrammerFacade(Programmer prog)
- Parameters:
prog- the programmer to which this facade is attached
-
-
Method Detail
-
writeCV
public void writeCV(java.lang.String CV, int val, ProgListener p) throws ProgrammerException
Description copied from class:AbstractProgrammerFacadePerform a CV write in the system-specific manner, and using the specified programming mode.Handles a general address space through a String address. Each programmer defines the acceptable formats.
Note that this returns before the write is complete; you have to provide a ProgListener to hear about completion. For simplicity, expect the return to be on the GUI thread.
Exceptions will only be thrown at the start, not during the actual programming sequence. A typical exception would be due to an invalid mode (though that should be prevented earlier)
- Specified by:
writeCVin interfaceProgrammer- Overrides:
writeCVin classAbstractProgrammerFacade- Parameters:
CV- the CV to writeval- the value to writep- the listener that will be notified of the write- Throws:
ProgrammerException- if unable to communicate
-
readCV
public void readCV(java.lang.String CV, ProgListener p) throws ProgrammerException
Description copied from class:AbstractProgrammerFacadePerform a CV read in the system-specific manner, and using the specified programming mode.Handles a general address space through a String address. Each programmer defines the acceptable formats.
Note that this returns before the write is complete; you have to provide a ProgListener to hear about completion. For simplicity, expect the return to be on the GUI thread.
Exceptions will only be thrown at the start, not during the actual programming sequence. A typical exception would be due to an invalid mode (though that should be prevented earlier)
- Specified by:
readCVin interfaceProgrammer- Overrides:
readCVin classAbstractProgrammerFacade- Parameters:
CV- the CV to readp- the listener that will be notified of the read- Throws:
ProgrammerException- if unable to communicate
-
getWriteConfirmMode
@Nonnull public Programmer.WriteConfirmMode getWriteConfirmMode(java.lang.String addr)
This facade ensures thatProgrammer.WriteConfirmMode.ReadAfterWriteis done, so long as it has permission to read the CV after writing.- Specified by:
getWriteConfirmModein interfaceProgrammer- Overrides:
getWriteConfirmModein classAbstractProgrammerFacade- Parameters:
addr- A CV address to check (in case this varies with CV range) or null for any- Returns:
- The confirmation behavior that can be counted on (might be better in some cases)
-
useProgrammer
protected void useProgrammer(ProgListener p) throws ProgrammerException
- Throws:
ProgrammerException
-
programmingOpReply
public void programmingOpReply(int value, int status)
Description copied from interface:ProgListenerReceive a callback at the end of a programming operation.- Specified by:
programmingOpReplyin interfaceProgListener- Parameters:
value- Value from a read operation, or value written on a writestatus- Denotes the completion code. Note that this is a bitwise combination of the various status coded defined in this interface.
-
-