Class OlcbProgrammerManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.managers.DefaultProgrammerManager
-
- jmri.jmrix.openlcb.OlcbProgrammerManager
-
- All Implemented Interfaces:
AddressedProgrammerManager
,PropertyChangeFirer
,PropertyChangeProvider
,GlobalProgrammerManager
public class OlcbProgrammerManager extends DefaultProgrammerManager
Get access to availableProgrammer
objects.Programmers come in two types:
- Global, previously "Service Mode" or on a programming track. Request
these from an instance of
GlobalProgrammerManager
. - Addressed, previously "Ops Mode" also known as "programming on the main". Request these from an instance of this interface.
Programmer
object from a ProgrammerManager, which in turn can be located from theInstanceManager
.This interface also provides a reserve/release system for tools that want to pretend they have exclusive use of a Programmer. This is a cooperative reservation; both tools (first and second reserver) must be using the reserve/release interface.
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:
Programmer
-
-
Field Summary
Fields Modifier and Type Field Description static ProgrammingMode
OPENLCBMODE
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description OlcbProgrammerManager(SystemConnectionMemo system)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AddressedProgrammer
getAddressedProgrammer(boolean pLongAddress, int pAddress)
Gain access to a Addressed Mode Programmer without reservation.java.util.List<ProgrammingMode>
getDefaultModes()
Get the list ofProgrammingMode
(generally) supported by Programmers provided by this Manager.java.lang.String
getUserName()
Provides the human-readable representation for including ProgrammerManagers directly in user interface components, so it should return a user-provided name for this particular one.boolean
isAddressedModePossible()
Convenience method to check whether you'll be able to get an Addressed Mode programmer.void
releaseAddressedProgrammer(AddressedProgrammer p)
Return access to an Addressed Mode Programmer, so that it can be used elsewhere.AddressedProgrammer
reserveAddressedProgrammer(boolean pLongAddress, int pAddress)
Gain access to a (the) Addressed Mode Programmer, in the process reserving it for yourself.java.lang.String
toString()
toString() provides the human-readable representation for including ProgrammerManagers directly in user interface components, so it should return a user-provided name for this particular one.-
Methods inherited from class jmri.managers.DefaultProgrammerManager
dispose, getGlobalProgrammer, isAddressedModePossible, isGlobalProgrammerAvailable, releaseGlobalProgrammer, reserveGlobalProgrammer
-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.AddressedProgrammerManager
getAddressedProgrammer, reserveAddressedProgrammer
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
OPENLCBMODE
public static final ProgrammingMode OPENLCBMODE
-
-
Constructor Detail
-
OlcbProgrammerManager
public OlcbProgrammerManager(SystemConnectionMemo system)
-
-
Method Detail
-
getAddressedProgrammer
public AddressedProgrammer getAddressedProgrammer(boolean pLongAddress, int pAddress)
Gain access to a Addressed Mode Programmer without reservation.- Specified by:
getAddressedProgrammer
in interfaceAddressedProgrammerManager
- Overrides:
getAddressedProgrammer
in classDefaultProgrammerManager
- Parameters:
pLongAddress
- true if this is a long (14 bit) address, else falsepAddress
- Specific decoder address to use.- Returns:
- null only if there isn't an Ops Mode Programmer in the system
-
reserveAddressedProgrammer
public AddressedProgrammer reserveAddressedProgrammer(boolean pLongAddress, int pAddress)
Gain access to a (the) Addressed Mode Programmer, in the process reserving it for yourself.- Specified by:
reserveAddressedProgrammer
in interfaceAddressedProgrammerManager
- Overrides:
reserveAddressedProgrammer
in classDefaultProgrammerManager
- Parameters:
pLongAddress
- true if this is a long (14 bit) address, else falsepAddress
- Specific decoder address to use.- Returns:
- null if the address is in use by a reserved programmer
-
releaseAddressedProgrammer
public void releaseAddressedProgrammer(@Nonnull AddressedProgrammer p)
Return access to an Addressed Mode Programmer, so that it can be used elsewhere.- Specified by:
releaseAddressedProgrammer
in interfaceAddressedProgrammerManager
- Overrides:
releaseAddressedProgrammer
in classDefaultProgrammerManager
- Parameters:
p
- the programmer to release
-
isAddressedModePossible
public boolean isAddressedModePossible()
Convenience method to check whether you'll be able to get an Addressed Mode programmer.- Specified by:
isAddressedModePossible
in interfaceAddressedProgrammerManager
- Overrides:
isAddressedModePossible
in classDefaultProgrammerManager
- Returns:
- false if there's no chance of getting one
-
getDefaultModes
@Nonnull public java.util.List<ProgrammingMode> getDefaultModes()
Get the list ofProgrammingMode
(generally) supported by Programmers provided by this Manager.Use this to enquire about modes before you're ready to request a specific programmer.
If the order is significant, earlier modes are better.
- Specified by:
getDefaultModes
in interfaceAddressedProgrammerManager
- Overrides:
getDefaultModes
in classDefaultProgrammerManager
- Returns:
- a default list of programming modes that most
AddressedProgrammer
s make available
-
getUserName
@Nonnull public java.lang.String getUserName()
Provides the human-readable representation for including ProgrammerManagers directly in user interface components, so it should return a user-provided name for this particular one.- Specified by:
getUserName
in interfaceAddressedProgrammerManager
- Specified by:
getUserName
in interfaceGlobalProgrammerManager
- Overrides:
getUserName
in classDefaultProgrammerManager
- Returns:
- the name for the programmer
-
toString
@Nonnull public java.lang.String toString()
toString() provides the human-readable representation for including ProgrammerManagers directly in user interface components, so it should return a user-provided name for this particular one.- Specified by:
toString
in interfaceAddressedProgrammerManager
- Specified by:
toString
in interfaceGlobalProgrammerManager
- Overrides:
toString
in classDefaultProgrammerManager
- Returns:
- the name for the programmer
-
-