requestInput method

void requestInput({
  1. String? consumer,
  2. Bias bias = Bias.unknown,
  3. ActiveState activeState = ActiveState.high,
  4. Set<SignalEdge> triggers = const {},
})

Requests ownership of a GPIO line with the given configuration.

If ProxyGpiod.supportsBias is false, bias must be null, otherwise a UnsupportedError will be thrown.

Only a free line can be requested.

The ownership status in undefined until the Future returned by request completes.

Implementation

void requestInput(
    {String? consumer,
      Bias bias = Bias.unknown,
      ActiveState activeState = ActiveState.high,
      Set<SignalEdge> triggers = const {}}) {
  ArgumentError.checkNotNull(activeState, "activeState");
  ArgumentError.checkNotNull(triggers, "triggers");
  _checkSupportsBiasValue(bias);

  // we need to lock both info and ownership.
  /*return
    _synchronizedWrite(() async {
    if (_requested) {
      throw StateError("Can't request line because it is already requested.");
    }*/

    _ProxyGpiodPlatformSide.requestLine(
        lineHandle: _lineHandle,
        consumer: consumer,
        direction: LineDirection.input,
        bias: bias,
        activeState: activeState,
        triggers: triggers);

    _info = _ProxyGpiodPlatformSide.getLineInfo(_lineHandle);
//      _requested = true;
  //});
}