Package jmri.jmrit.withrottle
Class AbstractController
- java.lang.Object
-
- jmri.jmrit.withrottle.AbstractController
-
- Direct Known Subclasses:
ConsistController
,FastClockController
,RouteController
,TrackPowerController
,TurnoutController
public abstract class AbstractController extends java.lang.Object
Abstract for controllers that want to receive or send communications to a connected wi-fi device.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
canBuildList
(package private) boolean
isValid
(package private) java.util.ArrayList<ControllerInterface>
listeners
(package private) java.util.List<java.lang.String>
sysNameList
-
Constructor Summary
Constructors Constructor Description AbstractController()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addControllerListener(ControllerInterface listener)
Add a listener to handle: listener.sendPacketToDevice(message);void
buildList(Manager<?> manager)
Build list only if there are no controller listeners.void
checkCanBuildList()
If no listeners, clear sysNameList pointer and allow list to be re-built Manager can implement specifics in deregister().(package private) abstract void
deregister()
Deregister as listener of NamedBeansvoid
filterList()
(package private) abstract void
handleMessage(java.lang.String message, DeviceServer deviceServer)
Break down a message and use it.(package private) abstract void
register()
Register as listener of NamedBeans to be updated of changes.void
removeControllerListener(ControllerInterface listener)
(package private) abstract boolean
verifyCreation()
isValid is used to indicate if the Controller is created.
-
-
-
Field Detail
-
listeners
java.util.ArrayList<ControllerInterface> listeners
-
sysNameList
java.util.List<java.lang.String> sysNameList
-
isValid
boolean isValid
-
canBuildList
boolean canBuildList
-
-
Constructor Detail
-
AbstractController
public AbstractController()
-
-
Method Detail
-
verifyCreation
abstract boolean verifyCreation()
isValid is used to indicate if the Controller is created. If false, we can null the controller and reduce overhead.- Returns:
- isValid
-
handleMessage
abstract void handleMessage(java.lang.String message, DeviceServer deviceServer)
Break down a message and use it.- Parameters:
message
- message for controller to parse and take actiondeviceServer
- DeviceServer that sent this message, used to send response messages to proper client
-
register
abstract void register()
Register as listener of NamedBeans to be updated of changes.
-
deregister
abstract void deregister()
Deregister as listener of NamedBeans
-
buildList
public void buildList(Manager<?> manager)
Build list only if there are no controller listeners. This way the list is not changed while in use. This should only be called by a subclass of jmri.Manager *Manager can implement specifics in register().- Parameters:
manager
- which manager to get system names for.
-
filterList
public void filterList()
-
checkCanBuildList
public void checkCanBuildList()
If no listeners, clear sysNameList pointer and allow list to be re-built Manager can implement specifics in deregister().
-
addControllerListener
public void addControllerListener(ControllerInterface listener)
Add a listener to handle: listener.sendPacketToDevice(message);- Parameters:
listener
- listener to add to listeners list
-
removeControllerListener
public void removeControllerListener(ControllerInterface listener)
-
-