getFeatureReport method

Future<Uint8List?> getFeatureReport(
  1. int index, {
  2. dynamic buffLen = 1024,
})

Implementation

Future<Uint8List?> getFeatureReport(int index, { buffLen: 1024 }) async {
  assert(index < 256);

  Uint8List? res = null;

  using((Arena arena) {
    Pointer<Uint8> buffer = arena<Uint8>(buffLen);
    buffer.asTypedList(buffLen).fillRange(0, buffLen, 0);
    buffer[0] = index;

    int ret = _getFeatureReport(this._device, buffer, buffLen);

    if(ret > 0) {
      res = Uint8List.fromList(buffer.asTypedList(ret));
    }
  });

  return res;
}