openLineInfoEvents method

  1. @override
Future<GpioInfoReader> openLineInfoEvents(
  1. int chipFd
)
override

Opens a stream of raw line-info changes for a chip descriptor.

Separate from openEvents because it watches a different descriptor and yields a different record: ownership changes on the chip, not edges on a request.

Implementation

@override
Future<GpioInfoReader> openLineInfoEvents(int chipFd) async {
  if (!_chipFds.containsKey(chipFd)) {
    throw StateError('no such chip descriptor: $chipFd');
  }
  final controller = StreamController<RawInfoEvent>();
  _infoReaders[chipFd] = controller;
  return GpioInfoReader.forTesting(
    events: controller.stream,
    onClose: () async {
      _infoReaders.remove(chipFd);
      await controller.close();
    },
  );
}