Search in sources :

Example 6 with DccThrottle

use of jmri.DccThrottle in project JMRI by JMRI.

the class LnThrottleManager method notifyChangedSlot.

/**
     * Get notification that an address has changed slot. This method creates a
     * throttle for all ThrottleListeners of that address and notifies them via
     * the ThrottleListener.notifyThrottleFound method.
     */
@Override
public void notifyChangedSlot(LocoNetSlot s) {
    DccThrottle throttle = createThrottle((LocoNetSystemConnectionMemo) adapterMemo, s);
    notifyThrottleKnown(throttle, new DccLocoAddress(s.locoAddr(), isLongAddress(s.locoAddr())));
    //end the waiting thread since we got a response
    if (waitingForNotification.containsKey(s.locoAddr())) {
        waitingForNotification.get(s.locoAddr()).interrupt();
        waitingForNotification.remove(s.locoAddr());
    }
}
Also used : DccThrottle(jmri.DccThrottle) DccLocoAddress(jmri.DccLocoAddress)

Example 7 with DccThrottle

use of jmri.DccThrottle in project JMRI by JMRI.

the class UhlenbrockLnThrottleManager method notifyChangedSlot.

/**
     * SlotListener contract. Get notification that an address has changed slot.
     * This method creates a throttle for all ThrottleListeners of that address
     * and notifies them via the ThrottleListener.notifyThrottleFound method.
     */
@Override
public void notifyChangedSlot(LocoNetSlot s) {
    DccThrottle throttle = new LocoNetThrottle((LocoNetSystemConnectionMemo) adapterMemo, s);
    notifyThrottleKnown(throttle, new DccLocoAddress(s.locoAddr(), isLongAddress(s.locoAddr())));
    if (waitingForNotification.containsKey(s.locoAddr())) {
        Thread r = waitingForNotification.get(s.locoAddr());
        synchronized (r) {
            r.interrupt();
        }
        waitingForNotification.remove(s.locoAddr());
    }
}
Also used : LocoNetThrottle(jmri.jmrix.loconet.LocoNetThrottle) DccThrottle(jmri.DccThrottle) DccLocoAddress(jmri.DccLocoAddress)

Aggregations

DccThrottle (jmri.DccThrottle)7 DccLocoAddress (jmri.DccLocoAddress)3 ThrottleListener (jmri.ThrottleListener)3 ThrottleManager (jmri.ThrottleManager)2 BorderLayout (java.awt.BorderLayout)1 Point (java.awt.Point)1 BoxLayout (javax.swing.BoxLayout)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 SignalSpeedMap (jmri.implementation.SignalSpeedMap)1 LocoNetThrottle (jmri.jmrix.loconet.LocoNetThrottle)1