@Override
    public void setState(RelayState state) {

        // apply the new pin state
        switch(state) {
            case OPEN: {
                if(!isOpen()) {
                    pin.setState(openState);
                }
                break;
            }
            case CLOSED: {
                if(!isClosed()) {
                    pin.setState(closedState);
                }
                break;
            }
            default: {
                throw new UnsupportedOperationException("Cannot set power state: " + state.toString());
            }
        }
    }
@ Override public void setState ( RelayState state ) { switch ( state ) { case OPEN : { if ( ! isOpen ( ) ) { pin . setState ( openState ) ; } break ; } case CLOSED : { if ( ! isClosed ( ) ) { pin . setState ( closedState ) ; } break ; } default : { throw new UnsupportedOperationException ( "Cannot set power state: " + state . toString ( ) ) ; } } }
Set the current GPIO digital output pin state
based on the supplied power state

@param state new power state to apply