Example #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);
   }
 }
Example #2
0
 @Override
 public synchronized void removeAllTriggers() {
   for (GpioPin pin : this.pins) {
     if (pin instanceof GpioPinInput) {
       ((GpioPinInput) pin).removeAllTriggers();
     }
   }
 }
Example #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);
    }
  }