jmri
Interface ThrottleManager

All Known Implementing Classes:
AbstractThrottleManager, DebugThrottleManager, EasyDccThrottleManager, EliteXNetThrottleManager, LnPr2ThrottleManager, LnThrottleManager, NceThrottleManager, SerialThrottleManager, SprogCSThrottleManager, SprogThrottleManager, SRCPThrottleManager, ThrottleManager, XNetThrottleManager, XpaThrottleManager

public interface ThrottleManager

Interface for allocating Throttle objects.

"Address" is interpreted in the context of the DCC implementation. Different systems will distinquish between short and long addresses in different ways.

When the allocated Throttle is no longer needed, it is told that it's released. If a specific ThrottleManager and/or Throttle implementation needs to keep track of that operation, it is handled internally.


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.

Author:
Glen Oberhauser, Bob Jacobsen Copyright 2006

Method Summary
 boolean addressTypeUnique()
          Are there not any ambiguous addresses (short vs long) on this system?
 boolean canBeLongAddress(int address)
          Check to see if a specific number is a valid long address on this system
 boolean canBeShortAddress(int address)
          Check to see if a specific number is a valid short address on this system
 void cancelThrottleRequest(int address, boolean isLong, ThrottleListener l)
          Cancel a request for a throttle.
 void cancelThrottleRequest(int address, ThrottleListener l)
          Cancel a request for a throttle.
 boolean hasDispatchFunction()
          Check to see if the Dispatch Button should be enabled or not
 boolean requestThrottle(int address, boolean isLong, ThrottleListener l)
          Request a throttle, given a decoder address & whether it is a long or short DCC address.
 boolean requestThrottle(int address, ThrottleListener l)
          Request a throttle, given a decoder address.
 int supportedSpeedModes()
          What speed modes are supported by this system?
 

Method Detail

requestThrottle

boolean requestThrottle(int address,
                        ThrottleListener l)
Request a throttle, given a decoder address. When the decoder address is located, the ThrottleListener gets a callback via the ThrottleListener.notifyThrottleFound method.

This is a convenience version of the call, which uses system-specific logic to tell whether the address is a short or long form.

Parameters:
address - The decoder address desired.
l - The ThrottleListener awaiting notification of a found throttle.
Returns:
True if the request will continue, false if the request will not be made. False may be returned if a the throttle is already in use.

requestThrottle

boolean requestThrottle(int address,
                        boolean isLong,
                        ThrottleListener l)
Request a throttle, given a decoder address & whether it is a long or short DCC address. When the decoder address is located, the ThrottleListener gets a callback via the ThrottleListener.notifyThrottleFound method.

Parameters:
address - The decoder address desired.
isLong - True if this is a request for a DCC long (extended) address.
l - The ThrottleListener awaiting notification of a found throttle.
Returns:
True if the request will continue, false if the request will not be made. False may be returned if a the throttle is already in use.

cancelThrottleRequest

void cancelThrottleRequest(int address,
                           ThrottleListener l)
Cancel a request for a throttle.

This is a convenience version of the call, which uses system-specific logic to tell whether the address is a short or long form.

Parameters:
address - The decoder address desired.
l - The ThrottleListener cancelling request for a throttle.

cancelThrottleRequest

void cancelThrottleRequest(int address,
                           boolean isLong,
                           ThrottleListener l)
Cancel a request for a throttle.

Parameters:
address - The decoder address desired.
isLong - True if this is a request for a DCC long (extended) address.
l - The ThrottleListener cancelling request for a throttle.

hasDispatchFunction

boolean hasDispatchFunction()
Check to see if the Dispatch Button should be enabled or not


canBeLongAddress

boolean canBeLongAddress(int address)
Check to see if a specific number is a valid long address on this system


canBeShortAddress

boolean canBeShortAddress(int address)
Check to see if a specific number is a valid short address on this system


addressTypeUnique

boolean addressTypeUnique()
Are there not any ambiguous addresses (short vs long) on this system?


supportedSpeedModes

int supportedSpeedModes()
What speed modes are supported by this system? value should be xor of possible modes specifed in the throttle interface



Copyright © 1997 - 2008 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: SourceForge_Logo