Class AccessoryOpsModeProgrammerFacade
- All Implemented Interfaces:
EventListener,Disposable,ProgListener,Programmer
(Eventually implements four modes, passing all others to underlying programmer:
- OPSACCBYTEMODE
- OPSACCBITMODE
- OPSACCEXTBYTEMODE
- OPSACCEXTBITMODE
Used through the String write/read/confirm interface. Accepts integers as addresses, but then emits NMRA DCC packets through the default CommandStation interface (which must be present)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enumNested classes/interfaces inherited from interface jmri.Programmer
Programmer.Configurator, Programmer.WriteConfirmMode -
Field Summary
FieldsModifier and TypeFieldDescription(package private) String(package private) AddressedProgrammer(package private) String(package private) int(package private) int(package private) Programmer(package private) ProgrammingMode(package private) AccessoryOpsModeProgrammerFacade.ProgStateFields inherited from class jmri.jmrix.AbstractProgrammerFacade
progFields inherited from interface jmri.ProgListener
CommError, ConfirmFailed, FailedTimeout, NoAck, NoLocoDetected, NotImplemented, OK, ProgrammerBusy, ProgrammingShort, SequenceError, UnknownError, UserAborted -
Constructor Summary
ConstructorsConstructorDescriptionAccessoryOpsModeProgrammerFacade(Programmer prog, String addrType, int delay, AddressedProgrammer baseProg) Programmer facade for access to Accessory Decoder Ops Mode programming. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfirmCV(String cv, int val, ProgListener p) Confirm the value of a CV using the specified programming mode.booleanChecks the general read capability, regardless of modebooleangetCanRead(String addr) Checks the general read capability, regardless of mode, for a specific addressbooleanChecks the general write capability, regardless of modebooleangetCanWrite(String addr) Checks the general write capability, regardless of mode, for a specific addressGet the list ofProgrammingModesupported by this Programmer.voidprogrammingOpReply(int value, int status) Receive a callback at the end of a programming operation.voidreadCV(String cv, ProgListener p) Perform a CV read in the system-specific manner, and using the specified programming mode.voidreadCV(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.voidDon't pass this mode through, as the underlying doesn't have it (although we should check).protected voidInternal method to remember who's using the programmer.voidwriteCV(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, getMode, getWriteConfirmMode, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.Programmer
dispose, getConfigurator, notifyProgListenerEnd
-
Field Details
-
Constructor Details
-
AccessoryOpsModeProgrammerFacade
public AccessoryOpsModeProgrammerFacade(Programmer prog, @Nonnull String addrType, int delay, AddressedProgrammer baseProg) Programmer facade for access to Accessory Decoder Ops Mode programming.- Parameters:
prog- The (possibly already decorated) programmer we are piggybacking on.addrType- A string. "accessory" or "output" causes the address to be interpreted as an 11 bit accessory output address. "decoder" causes the address to be interpreted as a 9 bit accessory decoder address "signal" causes the address to be interpreted as an 11 bit signal decoder address.delay- A string representing the desired delay between programming operations, in milliseconds.baseProg- The underlying undecorated Ops Mode Programmer we are piggybacking on.
-
-
Method Details
-
getSupportedModes
Description copied from class:AbstractProgrammerFacadeGet the list ofProgrammingModesupported by this Programmer. If the order is significant, earlier modes are better.- Specified by:
getSupportedModesin interfaceProgrammer- Overrides:
getSupportedModesin classAbstractProgrammerFacade- Returns:
- the list of supported modes or an empty list
-
setMode
Don't pass this mode through, as the underlying doesn't have it (although we should check).- Specified by:
setModein interfaceProgrammer- Overrides:
setModein classAbstractProgrammerFacade- Parameters:
p- The desired programming mode
-
getCanRead
Description copied from class:AbstractProgrammerFacadeChecks the general read capability, regardless of mode- Specified by:
getCanReadin interfaceProgrammer- Overrides:
getCanReadin classAbstractProgrammerFacade- Returns:
- true if the programmer is capable of reading; false otherwise
-
getCanRead
Description copied from class:AbstractProgrammerFacadeChecks the general read capability, regardless of mode, for a specific address- Specified by:
getCanReadin interfaceProgrammer- Overrides:
getCanReadin classAbstractProgrammerFacade- Parameters:
addr- the address to read- Returns:
- true if the address can be read; false otherwise
-
getCanWrite
Description copied from class:AbstractProgrammerFacadeChecks the general write capability, regardless of mode- Specified by:
getCanWritein interfaceProgrammer- Overrides:
getCanWritein classAbstractProgrammerFacade- Returns:
- true if the programmer is capable of writing; false otherwise
-
getCanWrite
Description copied from class:AbstractProgrammerFacadeChecks the general write capability, regardless of mode, for a specific address- Specified by:
getCanWritein interfaceProgrammer- Overrides:
getCanWritein classAbstractProgrammerFacade- Parameters:
addr- the address to write to- Returns:
- true if the address can be written to; false otherwise
-
writeCV
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
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
-
readCV
Description copied from interface:ProgrammerPerform 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:
readCVin 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
Description copied from class:AbstractProgrammerFacadeConfirm 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:
confirmCVin interfaceProgrammer- Overrides:
confirmCVin classAbstractProgrammerFacade- Parameters:
cv- the CV to confirmval- the value to confirmp- the listener that will be notified of the confirmation- Throws:
ProgrammerException- if unable to communicate
-
useProgrammer
Internal method to remember who's using the programmer.- Parameters:
p- the programmer- Throws:
ProgrammerException- if p is already in use
-
programmingOpReply
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.
-