001package jmri.jmrix.lenz.hornbyelite;
002
003import jmri.LocoAddress;
004import jmri.jmrix.lenz.XNetSystemConnectionMemo;
005import org.slf4j.Logger;
006import org.slf4j.LoggerFactory;
007
008/**
009 * XNet implementation of a ThrottleManager based on the
010 * AbstractThrottleManager.
011 *
012 * @author Paul Bender Copyright (C) 2008
013 */
014public class EliteXNetThrottleManager extends jmri.jmrix.lenz.XNetThrottleManager {
015
016    /**
017     * Constructor.
018     * @param memo system connection.
019     */
020    public EliteXNetThrottleManager(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        EliteXNetThrottle throttle;
031        log.debug("Requesting Throttle: {}", address);
032        if (throttles.containsKey(address)) {
033            notifyThrottleKnown(throttles.get(address), address);
034        } else {
035            throttle = new EliteXNetThrottle((XNetSystemConnectionMemo) adapterMemo, address, tc);
036            throttles.put(address, throttle);
037            notifyThrottleKnown(throttle, address);
038        }
039    }
040
041    private static final Logger log = LoggerFactory.getLogger(EliteXNetThrottleManager.class);
042
043}