transmitDirect method

Future<List<int>> transmitDirect({
  1. required List<int> data,
})

Transmits a direct command to the RFID reader and returns the response.

Sends a raw APDU command directly to the RFID reader, bypassing higher-level abstractions. This method allows for custom commands to be executed, providing flexibility for advanced operations.

Parameters

  • data: A list of integers representing the command to be transmitted to the reader.

Returns

A list of integers representing the reader's response to the command.

Throws

  • Exceptions if the APDU command fails to transmit or if the response format is unexpected.

Example

var response = await transmitDirect(data: [0x00, 0xA4, 0x04, 0x00, 0x08]);
print('Direct command response: $response');

Note: Use with caution, as direct commands require detailed knowledge of the RFID reader's protocol.

Implementation

Future<List<int>> transmitDirect({required List<int> data}) async {
  return (await transmitApdu(
    ApduHeader(
      classNumber: 0xFF,
      instruction: 0x00,
      p1: 0x00,
      p2: 0x00,
    ),
    data: data,
  ))
      .data;
}