Class AddressedHighCvProgrammerFacade
- java.lang.Object
-
- jmri.jmrix.AbstractProgrammerFacade
-
- jmri.implementation.AddressedHighCvProgrammerFacade
-
- All Implemented Interfaces:
java.util.EventListener
,Disposable
,ProgListener
,Programmer
public class AddressedHighCvProgrammerFacade extends AbstractProgrammerFacade implements ProgListener
Programmer facade, at this point just an example.This is for decoders that have an alternate high-CV access method for command stations that can't address all 1024. It falls back to that mode if the CS can't directly address an requested CV address. In the fall back, CVs from 0 to "top" are addressed directly. (Top being a supplied parameter) Above the top CV, the upper part of the CV address written to a specific CV, followed by an write with just the lower part to a second CV, then access to a 3rd CV for the value read/write. The upper and lower parts are calculated using a supplied modulus, e.g. 100.
This method is used by some ESU decoders.
- See Also:
ProgrammerFacadeSelector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
AddressedHighCvProgrammerFacade.ProgState
-
Nested classes/interfaces inherited from interface jmri.Programmer
Programmer.WriteConfirmMode
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
_cv
(package private) Programmer
_prog
(package private) int
_startVal
(package private) int
_val
(package private) java.lang.String
addrCVhigh
(package private) java.lang.String
addrCVlow
(package private) int
modulo
(package private) AddressedHighCvProgrammerFacade.ProgState
state
(package private) int
top
(package private) java.lang.String
valueCV
-
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 AddressedHighCvProgrammerFacade(Programmer prog, java.lang.String top, java.lang.String addrCVhigh, java.lang.String addrCVlow, java.lang.String valueCV, java.lang.String modulo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getCanRead()
Checks the general read capability, regardless of modeboolean
getCanRead(java.lang.String addr)
Checks the general read capability, regardless of mode, for a specific addressboolean
getCanWrite()
Checks the general write capability, regardless of modeboolean
getCanWrite(java.lang.String addr)
Checks the general write capability, regardless of mode, for a specific addressvoid
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, confirmCV, decodeErrorCode, 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
-
top
int top
-
addrCVhigh
java.lang.String addrCVhigh
-
addrCVlow
java.lang.String addrCVlow
-
valueCV
java.lang.String valueCV
-
modulo
int modulo
-
_prog
Programmer _prog
-
_val
int _val
-
_cv
int _cv
-
_startVal
int _startVal
-
-
Constructor Detail
-
AddressedHighCvProgrammerFacade
public AddressedHighCvProgrammerFacade(Programmer prog, java.lang.String top, java.lang.String addrCVhigh, java.lang.String addrCVlow, java.lang.String valueCV, java.lang.String modulo)
- Parameters:
prog
- the programmer associated with this facadetop
- CVs above this use the indirect methodaddrCVhigh
- CV to which the high part of address is to be writtenaddrCVlow
- CV to which the low part of address is to be writtenvalueCV
- Value read/written here once address has been writtenmodulo
- Modulus for determining high/low address parts
-
-
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
-
useProgrammer
protected void useProgrammer(ProgListener p) throws ProgrammerException
- Throws:
ProgrammerException
-
programmingOpReply
public void programmingOpReply(int value, int status)
Description copied from interface:ProgListener
Receive a callback at the end of a programming 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.
-
getCanRead
public boolean getCanRead()
Description copied from class:AbstractProgrammerFacade
Checks the general read capability, regardless of mode- Specified by:
getCanRead
in interfaceProgrammer
- Overrides:
getCanRead
in classAbstractProgrammerFacade
- Returns:
- true if the programmer is capable of reading; false otherwise
-
getCanRead
public boolean getCanRead(java.lang.String addr)
Description copied from class:AbstractProgrammerFacade
Checks the general read capability, regardless of mode, for a specific address- Specified by:
getCanRead
in interfaceProgrammer
- Overrides:
getCanRead
in classAbstractProgrammerFacade
- Parameters:
addr
- the address to read- Returns:
- true if the address can be read; false otherwise
-
getCanWrite
public boolean getCanWrite()
Description copied from class:AbstractProgrammerFacade
Checks the general write capability, regardless of mode- Specified by:
getCanWrite
in interfaceProgrammer
- Overrides:
getCanWrite
in classAbstractProgrammerFacade
- Returns:
- true if the programmer is capable of writing; false otherwise
-
getCanWrite
public boolean getCanWrite(java.lang.String addr)
Description copied from class:AbstractProgrammerFacade
Checks the general write capability, regardless of mode, for a specific address- Specified by:
getCanWrite
in interfaceProgrammer
- Overrides:
getCanWrite
in classAbstractProgrammerFacade
- Parameters:
addr
- the address to write to- Returns:
- true if the address can be written to; false otherwise
-
-