readBytes method

  1. @override
int readBytes(
  1. List<int> values
)
override

Read values.length # of bytes from the device (no register) into values where the values.length is between 1 and 32 inclusive. Return the # of bytes read.

Implementation

@override
int readBytes(List<int> values) {
  if (values.isEmpty || values.length > 32)
    throw I2CException('Expected values length between 1 and 32', address);
  var buf = _dylib.byteBufferOfLen34;
  var numBytesRead =
      _throwIfNegative(_dylib.readBytes(_fd, values.length, buf));
  for (var index = 0; index < numBytesRead; index++) {
    values[index] = buf.elementAt(index).value;
  }
  return numBytesRead;
}