Package jmri.jmris
Class AbstractThrottleServer
- java.lang.Object
-
- jmri.jmris.AbstractThrottleServer
-
- All Implemented Interfaces:
java.util.EventListener,ThrottleListener
- Direct Known Subclasses:
JmriSRCPThrottleServer
public abstract class AbstractThrottleServer extends java.lang.Object implements ThrottleListener
Abstract interface between the JMRI Throttles and a network connection
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classAbstractThrottleServer.ThrottlePropertyChangeListener-
Nested classes/interfaces inherited from interface jmri.ThrottleListener
ThrottleListener.DecisionType
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<Throttle>throttleList
-
Constructor Summary
Constructors Constructor Description AbstractThrottleServer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidnotifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)No steal or share decisions made locallyvoidnotifyFailedThrottleRequest(LocoAddress address, java.lang.String reason)Get notification that an attempt to request a throttle has failed.voidnotifyThrottleFound(DccThrottle t)Get notification that a throttle has been found as requested.abstract voidparsecommand(java.lang.String statusString)voidreleaseThrottle(LocoAddress l)voidrequestThrottle(LocoAddress l)abstract voidsendErrorStatus()abstract voidsendStatus(LocoAddress address)abstract voidsendThrottleFound(LocoAddress address)abstract voidsendThrottleReleased(LocoAddress address)protected voidsetFunctionsByThrottle(Throttle t, java.util.ArrayList<java.lang.Boolean> fList)Set Throttle Functions on/off.voidsetThrottleFunctions(LocoAddress l, java.util.ArrayList<java.lang.Boolean> fList)Set Throttle Functions on/off.voidsetThrottleSpeedAndDirection(LocoAddress l, float speed, boolean isForward)
-
-
-
Field Detail
-
throttleList
protected java.util.ArrayList<Throttle> throttleList
-
-
Constructor Detail
-
AbstractThrottleServer
public AbstractThrottleServer()
-
-
Method Detail
-
sendStatus
public abstract void sendStatus(LocoAddress address) throws java.io.IOException
- Throws:
java.io.IOException
-
sendErrorStatus
public abstract void sendErrorStatus() throws java.io.IOException
- Throws:
java.io.IOException
-
sendThrottleFound
public abstract void sendThrottleFound(LocoAddress address) throws java.io.IOException
- Throws:
java.io.IOException
-
sendThrottleReleased
public abstract void sendThrottleReleased(LocoAddress address) throws java.io.IOException
- Throws:
java.io.IOException
-
parsecommand
public abstract void parsecommand(java.lang.String statusString) throws JmriException, java.io.IOException
- Throws:
JmriExceptionjava.io.IOException
-
setThrottleSpeedAndDirection
public void setThrottleSpeedAndDirection(LocoAddress l, float speed, boolean isForward)
-
setThrottleFunctions
public void setThrottleFunctions(LocoAddress l, java.util.ArrayList<java.lang.Boolean> fList)
Set Throttle Functions on/off.- Parameters:
l- LocoAddress of the locomotive to change speed of.fList- an ArrayList of boolean values indicating whether the function is active or not.
-
setFunctionsByThrottle
protected void setFunctionsByThrottle(Throttle t, java.util.ArrayList<java.lang.Boolean> fList)
Set Throttle Functions on/off.- Parameters:
t- Throttle to change speed of.fList- an ArrayList of boolean values indicating whether the function is active or not.
-
requestThrottle
public void requestThrottle(LocoAddress l)
-
releaseThrottle
public void releaseThrottle(LocoAddress l)
-
notifyThrottleFound
public void notifyThrottleFound(DccThrottle t)
Get notification that a throttle has been found as requested.- Specified by:
notifyThrottleFoundin interfaceThrottleListener- Parameters:
t- the throttle with the requested address
-
notifyFailedThrottleRequest
public void notifyFailedThrottleRequest(LocoAddress address, java.lang.String reason)
Get notification that an attempt to request a throttle has failed.- Specified by:
notifyFailedThrottleRequestin interfaceThrottleListener- Parameters:
address- address of the failed requestreason- failure cause
-
notifyDecisionRequired
public void notifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)
No steal or share decisions made locallyGet notification that a throttle request is in use by another device, and a "steal", "share", or "steal/share" decision may be required.
- Specified by:
notifyDecisionRequiredin interfaceThrottleListener- Parameters:
address- The LocoAddress that needs the decision.question- The question being asked, steal / cancel, share / cancel, steal / share / cancel
-
-