001package jmri.jmrix.roco.z21;
002
003import jmri.LocoAddress;
004import jmri.jmrix.lenz.XNetSystemConnectionMemo;
005import org.slf4j.Logger;
006import org.slf4j.LoggerFactory;
007
008/**
009 * z21XNet implementation of a ThrottleManager based on the
010 * AbstractThrottleManager.
011 *
012 * @author Paul Bender Copyright (C) 2002-2004
013 */
014public class Z21XNetThrottleManager extends jmri.jmrix.roco.RocoXNetThrottleManager {
015
016    /**
017     * Constructor.
018     * @param memo system connection.
019     */
020    public Z21XNetThrottleManager(XNetSystemConnectionMemo memo) {
021        super(memo);
022    }
023
024    /**
025     * Request a new throttle object be created for the address, and let the
026     * throttle listeners know about it.
027     */
028    @Override
029    public void requestThrottleSetup(LocoAddress address, boolean control) {
030        Z21XNetThrottle throttle;
031        log.debug("Requesting Throttle: {}",address);
032        if (throttles.containsKey(address)) {
033            notifyThrottleKnown(throttles.get(address), address);
034        } else {
035            throttle = new Z21XNetThrottle((XNetSystemConnectionMemo) adapterMemo, address, tc);
036            throttles.put(address, throttle);
037            notifyThrottleKnown(throttle, address);
038        }
039    }
040
041    private static final Logger log = LoggerFactory.getLogger(Z21XNetThrottleManager.class);
042
043}