readData method

  1. @override
List<int> readData(
  1. int length
)
override

Implementation

@override
List<int> readData(int length) {
  int readyByte = i2c.readByte(pn532I2CAddress);
  if (readyByte != pn532I2CReady) {
    throw PN532NotReadyException();
  }

  List<int> response = i2c.readBytes(pn532I2CAddress, length + 1);

  // convert the int to a uint8 to get the actual value
  // (negative values are actually the only problem here)
  response = response.map((integer) => Uint8(integer).value).toList();

  return response.getRange(1, response.length).toList();
}