Class OlcbProgrammer
- All Implemented Interfaces:
AddressedProgrammer,PropertyChangeFirer,PropertyChangeProvider,Disposable,Programmer
Programmers come in multiple types:
- Global, previously "Service Mode" or on a programming track
- Addressed, previously "Ops Mode" also known as "programming on the main"
- DCC CV programming, on service mode track or on the main
- CBUS Node Variable programmers
- LocoNet System Variable programmers
- LocoNet Op Switch programmers
- etc
You get a Programmer object from a AddressedProgrammer, which in turn
can be located from the InstanceManager.
Starting in JMRI 3.5.5, the CV addresses are Strings for generality. The methods that use ints for CV addresses will later be deprecated.
This file is part of JMRI.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- Since:
- 4.1.1
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface jmri.Programmer
Programmer.Configurator, Programmer.WriteConfirmMode -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final EventID(package private) NodeIDstatic final intFields inherited from class jmri.jmrix.AbstractProgrammer
LONG_TIMEOUT, SHORT_TIMEOUTFields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionOlcbProgrammer(OlcbInterface system, boolean isLong, int address) Creates an addressed programmer for a train node given by a DCC address.OlcbProgrammer(OlcbInterface system, NodeID nid) Creates a programmer for a given OpenLCB node. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfirmCV(String CV, int val, ProgListener p) Confirm the value of a CV using the specified programming mode.intbooleanGet the list ofProgrammingModesupported by this Programmer.voidreadCV(String CV, ProgListener p) Perform a CV read in the system-specific manner, and using the specified programming mode.protected voidtimeout()Internal routine to handle a timeout, should be synchronized!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.AbstractProgrammer
decodeErrorCode, getBestMode, getCanRead, getCanRead, getCanWrite, getCanWrite, getMode, getWriteConfirmMode, registerFromCV, restartTimer, setMode, startLongTimer, startShortTimer, stopTimerMethods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.Programmer
addPropertyChangeListener, decodeErrorCode, dispose, getCanRead, getCanRead, getCanWrite, getCanWrite, getConfigurator, getMode, getWriteConfirmMode, notifyProgListenerEnd, readCV, removePropertyChangeListener, setMode
-
Field Details
-
SPACE_DCC_CV
- See Also:
-
IS_PROGRAMMINGTRACK_EVENT
-
ERROR_NO_LOCO
- See Also:
-
ERROR_FAILED_VERIFY
- See Also:
-
ERROR_NO_RAILCOM
- See Also:
-
ERROR_INVALID_RESPONSE
- See Also:
-
ERROR_PGM_SHORT
- See Also:
-
ERROR_UNIMPLEMENTED_CMD
- See Also:
-
ERROR_INVALID_ARGUMENTS
- See Also:
-
ERROR_PGM_DISABLED
- See Also:
-
nid
-
-
Constructor Details
-
OlcbProgrammer
Creates a programmer for a given OpenLCB node.- Parameters:
system- system connection memonid- the target node to use for DCC CV programming. This can be a train node or a program track node.
-
OlcbProgrammer
Creates an addressed programmer for a train node given by a DCC address.- Parameters:
system- system connection memoisLong- dcc address typeaddress- dcc address number
-
-
Method Details
-
getSupportedModes
Get the list ofProgrammingModesupported by this Programmer. If the order is significant, earlier modes are better.- Specified by:
getSupportedModesin interfaceProgrammer- Specified by:
getSupportedModesin classAbstractProgrammer- Returns:
- the list of supported modes or an empty list
-
timeout
Internal routine to handle a timeout, should be synchronized!- Specified by:
timeoutin classAbstractProgrammer
-
writeCV
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:
writeCVin interfaceProgrammer- Specified by:
writeCVin classAbstractProgrammer- 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
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:
readCVin interfaceProgrammer- Specified by:
readCVin classAbstractProgrammer- Parameters:
CV- the CV to readp- the listener that will be notified of the read- Throws:
ProgrammerException- if unable to communicate
-
confirmCV
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:
confirmCVin interfaceProgrammer- Specified by:
confirmCVin classAbstractProgrammer- 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
-
getLongAddress
- Specified by:
getLongAddressin interfaceAddressedProgrammer
-
getAddressNumber
- Specified by:
getAddressNumberin interfaceAddressedProgrammer
-
getAddress
- Specified by:
getAddressin interfaceAddressedProgrammer
-