Example #1
0
 @Override
 public void unexportAll() {
   // un-export all GPIO pins that are currently exported
   for (GpioPin pin : pins) {
     if (pin.isExported()) {
       pin.unexport();
     }
   }
 }
Example #2
0
  /**
   * @param pin
   * @return
   *     <p>A value of 'true' is returned if the requested pin is exported.
   */
  @Override
  public boolean isExported(GpioPin... pin) {
    if (pin == null || pin.length == 0) {
      throw new IllegalArgumentException("Missing pin argument.");
    }
    for (GpioPin p : pin) {
      // ensure the requested pin has been provisioned
      if (!pins.contains(pin)) {
        throw new GpioPinNotProvisionedException(p.getPin());
      }
      if (!p.isExported()) {
        return false;
      }
    }

    // return the pin exported state
    return true;
  }