Class TwoIndexTcsProgrammerFacade
- java.lang.Object
-
- jmri.jmrix.AbstractProgrammerFacade
-
- jmri.implementation.TwoIndexTcsProgrammerFacade
-
- All Implemented Interfaces:
java.util.EventListener
,Disposable
,ProgListener
,Programmer
public class TwoIndexTcsProgrammerFacade extends AbstractProgrammerFacade implements ProgListener
Programmer facade for single index multi-CV access.Used through the String write/read/confirm interface. Accepts address formats:
- T2CV.11.12
The write operation writes 11 to the first index CV (201), 12 to the 2nd index CV (202), then writes the data to CV 203 (MSB) and 204 (LSB).
The read operation is slightly different, writing 111 (100+11) to CV201, then 12 to the 2nd index CV (202), then writes 100 to CV204, then reads the two values from CV203 and CV204. - T3CV.11.12.13
The write operation writes 11 to the first index CV (201), the data to the 2nd index CV (202), then writes 12 to CV203 and 13 to CV204.
The read operation writes 11 to CV201, then 12 to CV203, then 13 to CV204, then reads from CV202.
- See Also:
ProgrammerFacadeSelector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
TwoIndexTcsProgrammerFacade.ProgState
-
Nested classes/interfaces inherited from interface jmri.Programmer
Programmer.WriteConfirmMode
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String
_cv
(package private) int
_startLSB
(package private) int
_startMSB
(package private) int
_startVal
(package private) int
_val
static int
delayInterval
(package private) static java.lang.String
format2Flag
(package private) static java.lang.String
format3Flag
(package private) static java.lang.String
indexPI
(package private) static java.lang.String
indexSI
(package private) static int
readOffset
(package private) static java.lang.String
readStrobe
(package private) TwoIndexTcsProgrammerFacade.ProgState
state
(package private) int
upperByte
(package private) static java.lang.String
valLSB
(package private) static java.lang.String
valMSB
(package private) int
valueLSB
(package private) int
valueMSB
(package private) int
valuePI
(package private) int
valueSI
-
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 TwoIndexTcsProgrammerFacade(Programmer prog)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
confirmCV(java.lang.String CV, int startVal, ProgListener p)
Confirm the value of a CV using the specified programming mode.protected void
processProgrammingOpReply(int value, int status)
void
programmingOpReply(int value, int status)
Receive a callback at the end of a programming operation.void
readCV(java.lang.String CV, ProgListener p)
Perform a CV read in the system-specific manner, and using the specified programming mode.void
readCV(java.lang.String CV, ProgListener p, int startVal)
Perform a CV read in the system-specific manner, and using the specified programming mode, possibly using a hint of the current value to speed up programming.protected void
useProgrammer(ProgListener p)
void
writeCV(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, decodeErrorCode, getCanRead, getCanRead, getCanWrite, getCanWrite, getMode, getSupportedModes, getWriteConfirmMode, 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, notifyProgListenerEnd
-
-
-
-
Field Detail
-
indexPI
static final java.lang.String indexPI
- See Also:
- Constant Field Values
-
indexSI
static final java.lang.String indexSI
- See Also:
- Constant Field Values
-
valMSB
static final java.lang.String valMSB
- See Also:
- Constant Field Values
-
valLSB
static final java.lang.String valLSB
- See Also:
- Constant Field Values
-
readStrobe
static final java.lang.String readStrobe
- See Also:
- Constant Field Values
-
format2Flag
static final java.lang.String format2Flag
- See Also:
- Constant Field Values
-
format3Flag
static final java.lang.String format3Flag
- See Also:
- Constant Field Values
-
readOffset
static final int readOffset
- See Also:
- Constant Field Values
-
_val
int _val
-
_cv
java.lang.String _cv
-
valuePI
int valuePI
-
valueSI
int valueSI
-
valueMSB
int valueMSB
-
valueLSB
int valueLSB
-
_startVal
int _startVal
-
_startMSB
int _startMSB
-
_startLSB
int _startLSB
-
upperByte
int upperByte
-
delayInterval
public static int delayInterval
-
-
Constructor Detail
-
TwoIndexTcsProgrammerFacade
public TwoIndexTcsProgrammerFacade(Programmer prog)
- Parameters:
prog
- the programmer this facade is attached to
-
-
Method Detail
-
writeCV
public void writeCV(java.lang.String CV, int val, ProgListener p) throws ProgrammerException
Description copied from class:AbstractProgrammerFacade
Perform 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:
writeCV
in interfaceProgrammer
- Overrides:
writeCV
in 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:AbstractProgrammerFacade
Perform 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:
readCV
in interfaceProgrammer
- Overrides:
readCV
in classAbstractProgrammerFacade
- Parameters:
CV
- the CV to readp
- the listener that will be notified of the read- Throws:
ProgrammerException
- if unable to communicate
-
readCV
public void readCV(java.lang.String CV, ProgListener p, int startVal) throws ProgrammerException
Description copied from interface:Programmer
Perform a CV read in the system-specific manner, and using the specified programming mode, possibly using a hint of the current value to speed up programming.Handles a general address space through a String address. Each programmer defines the acceptable formats.
On systems that support it, the startVal is a hint as to what the current value of the CV might be (e.g. the value from the roster). This could be verified immediately in direct byte mode to speed up the read process.
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.
Defaults to the normal read method if not overridden in a specific implementation.
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:
readCV
in interfaceProgrammer
- Parameters:
CV
- the CV to readp
- the listener that will be notified of the readstartVal
- a hint of what the current value might be, or 0- Throws:
ProgrammerException
- if unable to communicate
-
confirmCV
public void confirmCV(java.lang.String CV, int startVal, ProgListener p) throws ProgrammerException
Description copied from class:AbstractProgrammerFacade
Confirm the value of a CV using the specified programming mode. On some systems, this is faster than a read.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:
confirmCV
in interfaceProgrammer
- Overrides:
confirmCV
in classAbstractProgrammerFacade
- Parameters:
CV
- the CV to confirmstartVal
- the value to confirmp
- the listener that will be notified of the confirmation- Throws:
ProgrammerException
- if unable to communicate
-
useProgrammer
protected void useProgrammer(ProgListener p) throws ProgrammerException
- Throws:
ProgrammerException
-
programmingOpReply
public void programmingOpReply(int value, int status)
Receive a callback at the end of a programming operation. Note this assumes that there's only one phase to the operation- Specified by:
programmingOpReply
in 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.
-
processProgrammingOpReply
protected void processProgrammingOpReply(int value, int status)
-
-