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 class
AbstractThrottleServer.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 void
notifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)
No steal or share decisions made locallyvoid
notifyFailedThrottleRequest(LocoAddress address, java.lang.String reason)
Get notification that an attempt to request a throttle has failed.void
notifyThrottleFound(DccThrottle t)
Get notification that a throttle has been found as requested.abstract void
parsecommand(java.lang.String statusString)
void
releaseThrottle(LocoAddress l)
void
requestThrottle(LocoAddress l)
abstract void
sendErrorStatus()
abstract void
sendStatus(LocoAddress address)
abstract void
sendThrottleFound(LocoAddress address)
abstract void
sendThrottleReleased(LocoAddress address)
protected void
setFunctionsByThrottle(Throttle t, java.util.ArrayList<java.lang.Boolean> fList)
Set Throttle Functions on/off.void
setThrottleFunctions(LocoAddress l, java.util.ArrayList<java.lang.Boolean> fList)
Set Throttle Functions on/off.void
setThrottleSpeedAndDirection(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:
JmriException
java.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:
notifyThrottleFound
in 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:
notifyFailedThrottleRequest
in 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:
notifyDecisionRequired
in interfaceThrottleListener
- Parameters:
address
- The LocoAddress that needs the decision.question
- The question being asked, steal / cancel, share / cancel, steal / share / cancel
-
-