예제 #1
0
 @Override
 public synchronized void removeTrigger(GpioTrigger trigger, GpioPinInput... pin) {
   if (pin == null || pin.length == 0) {
     throw new IllegalArgumentException("Missing pin argument.");
   }
   for (GpioPinInput p : pin) {
     // ensure the requested pin has been provisioned
     if (!pins.contains(p)) {
       throw new GpioPinNotProvisionedException(p.getPin());
     }
     p.removeTrigger(trigger);
   }
 }
예제 #2
0
 @Override
 public synchronized void removeAllTriggers() {
   for (GpioPin pin : this.pins) {
     if (pin instanceof GpioPinInput) {
       ((GpioPinInput) pin).removeAllTriggers();
     }
   }
 }
예제 #3
0
  @Override
  public void unprovisionPin(GpioPin... pin) {
    if (pin == null || pin.length == 0) {
      throw new IllegalArgumentException("Missing pin argument.");
    }
    for (int index = (pin.length - 1); index >= 0; index--) {
      GpioPin p = pin[index];

      // ensure the requested pin has been provisioned
      if (!pins.contains(p)) {
        throw new GpioPinNotProvisionedException(p.getPin());
      }
      // remove all listeners and triggers
      if (p instanceof GpioPinInput) {
        ((GpioPinInput) p).removeAllListeners();
        ((GpioPinInput) p).removeAllTriggers();
      }

      // remove this pin instance from the managed collection
      pins.remove(p);
    }
  }