getPassivTargetId method
Before you read MiFare-Cards you should call the setSamConfiguration
function to configure the PN532 properly!
Implementation
List<int> getPassivTargetId(
{int cardBaudrate = pn532MifareIso14443A,
int timeout = pn532StandardTimeout}) {
// Send passive read command for 1 card. Expect at most a 7 byte UUID.
List<int> parameters = [0x01, cardBaudrate];
List<int> response = callPN532Function(pn532CommandInListPassiveTarget,
parameters: parameters, responseLength: 19, timeout: timeout);
// Check only 1 card with up to a 7 byte UID is present.
final int numberOfTagsFound = response[0];
if (numberOfTagsFound != 1) {
throw PN532MoreThenOneTagsFoundException();
}
final int lengthOfUid = response[5];
if (lengthOfUid > 7) {
throw PN532BadResponseException(
response: response,
additionalInformation: "Found card with unexpectedly long UID!",
);
}
List<int> uid = response.sublist(6, 6 + lengthOfUid);
return uid;
}