0

I have a generic USB RFID card reader.

I am using code from How to read from a usb rfid reader? to read the data. It seems to read okay, however, the output is a byte array. What I want to get is the RFID number, the one that's printed on the card. How can I get this?

EDIT

I successfully retrieved the tag number by implementing a key logger. It seems that the reader does not directly send the tag number down the wire, but rather, sends a command to type the tag number out. This solution works but I'm still open to other, more direct approaches.

OJ Raqueño
  • 4,471
  • 2
  • 17
  • 30

1 Answers1

0

After successfully reading the RFID tag, all you need to do is to convert the byte array into a string. Please refer to the following line of code and this link for more details.

// readBuffer: The byte array containing the sequence of bytes to decode.
// 0: The index of the first byte to decode.
// bytesRead: The number of bytes to decode.
var strRfidTag = System.Text.Encoding.Default.GetString(readBuffer, 0, bytesRead);
kahveci
  • 1,429
  • 9
  • 23
  • I tried that, but the resulting text is gibberish. I think the input bytes do not represent the actual tag number, but rather, the command to type those out. – OJ Raqueño Mar 13 '18 at 02:57