react native - zpl - zebra ZT411 - rfid - get tag id after write

// Expert user has replied.
G Giorgio Zett 2 years 2 months ago
194 2 0

Hi all!
I have a react native app where I can print rfid tags. I found some example, and I can get a bluetooth connection to the printer and print the tags correctly.
But I need to get the tag id, too. I use zpl language in order to set how to print the tag, and I read about to use RI command to get RFID tag ID. But I can't understand how to get it.
This is the code I'm speaking about:
<code>
Connection printerConnection = null;
ZebraPrinter printer = null;

printerConnection = new BluetoothConnection(macAddress);

try {
printerConnection.open();

if (printerConnection.isConnected()) {
printer = ZebraPrinterFactory.getInstance(printerConnection);
PrinterLanguage printerLanguage = printer.getPrinterControlLanguage();
byte[] testLabel = getTestLabel(printerLanguage);
printerConnection.write(testLabel);
}
</code>
I expected <code> printerConnection.write(testLabel);</code> could return the tag id, but it seems return only void.
Do I have to listen some events in order to get that id?
How can I get it?
Thanks in advance :-)

Please register or login to post a reply

2 Replies

S Steven Si

First of all, to read from RFID, we use the ^RF command in the RFID Programming Guide. The ^RI command in the ZPL Programming Guide is obsolete. Refer to the RFID Programming Guide for all RFID related commands. There are examples about how to read the TID and how to return the value to the host.

Once you have successfully read the TID and returned the TID to the host with the RFID commands, then use the SendAndWaitForResponse API in the Connection class to send the RFID related ZPL commands to the printer, so that the application can get the TID.

 

G Giorgio Zett

thanks for your suggestions.
we found <code> SendAndWaitForResponse </code> and it works great in android

CONTACT
Can’t find what you’re looking for?