Class OlcbProgrammer

All Implemented Interfaces:
AddressedProgrammer, PropertyChangeFirer, PropertyChangeProvider, Programmer

public class OlcbProgrammer
extends AbstractProgrammer
implements AddressedProgrammer
Provide access to the hardware DCC decoder programming capability.

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"
Different equipment may also require different programmers:
  • DCC CV programming, on service mode track or on the main
  • CBUS Node Variable programmers
  • LocoNet System Variable programmers
  • LocoNet Op Switch programmers
  • etc
Depending on which type you have, only certain modes can be set. Valid modes are specified by the class static constants.

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:
AddressedProgrammer
  • Constructor Details

  • Method Details

    • getSupportedModes

      Get the list of ProgrammingMode supported by this Programmer. If the order is significant, earlier modes are better.
      Specified by:
      getSupportedModes in interface Programmer
      Specified by:
      getSupportedModes in class AbstractProgrammer
      Returns:
      the list of supported modes or an empty list
    • timeout

      protected void timeout()
      Internal routine to handle a timeout, should be synchronized!
      Specified by:
      timeout in class AbstractProgrammer
    • writeCV

      public void writeCV​(String CV, int val, ProgListener p)
      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 interface Programmer
      Specified by:
      writeCV in class AbstractProgrammer
      Parameters:
      CV - the CV to write
      val - the value to write
      p - the listener that will be notified of the write
    • readCV

      public void readCV​(String CV, ProgListener p)
      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 interface Programmer
      Specified by:
      readCV in class AbstractProgrammer
      Parameters:
      CV - the CV to read
      p - the listener that will be notified of the read
    • confirmCV

      public void confirmCV​(String CV, int val, ProgListener p)
      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 interface Programmer
      Specified by:
      confirmCV in class AbstractProgrammer
      Parameters:
      CV - the CV to confirm
      val - the value to confirm
      p - the listener that will be notified of the confirmation
    • getLongAddress

      public boolean getLongAddress()
      Specified by:
      getLongAddress in interface AddressedProgrammer
    • getAddressNumber

      public int getAddressNumber()
      Specified by:
      getAddressNumber in interface AddressedProgrammer
    • getAddress

      public String getAddress()
      Specified by:
      getAddress in interface AddressedProgrammer