@Override public synchronized void addListener(GpioPinListener listener, 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()); } // ensure the requested pin supports events (interrupts) if (!p.getPin().supportsPinEvents()) { throw new UnsupportedPinEventsException(p.getPin()); } p.addListener(listener); } }
@Override public synchronized void removeListener(GpioPinListener listener, 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()); } // ensure the requested pin supports events (interrupts) if (!p.getPin().supportsPinEvents()) { throw new UnsupportedPinEventsException(p.getPin()); } p.removeListener(listener); } }
@Override public synchronized void removeListener(GpioPinListener listener, 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()); } // ensure the requested pin supports events (interrupts) if (!p.getPin().supportsPinEvents()) { throw new UnsupportedPinEventsException(p.getPin()); } p.removeListener(listener); } }
@Override public synchronized void addListener(GpioPinListener listener, 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()); } // ensure the requested pin supports events (interrupts) if (!p.getPin().supportsPinEvents()) { throw new UnsupportedPinEventsException(p.getPin()); } p.addListener(listener); } }