react native - zpl - zebra ZT411 - rfid - multiple print

G Giorgio Zett 1 year 11 months ago
54 1 0

Hi all!
I have a react native app and I have to print multiple tags.
I also need to get all the TagIds provided by this zpl command:
<code>^XA^RFR,H,0,12,2^FN1^FS^HV1,,^FS^XZ</code> (the label is empty, it's just as example to show how I get the tag id)
I used a public <a href="https://github.com/anmoljain10/react-native-zebra-bluetooth-printer">re… lib</a> to address it
but when I try to print multiple labels with an async loop, it seems that 1 label works , but the next one fails. And it repeat this behaviour.
It seems it loose bluetooth connection.
So, I'm trying your <a href="https://github.com/ZebraDevs/Zebra-Printer-Samples/tree/ZSDKRCTDevDemo"… app</a>
I can patch the android code in order to get the tag id value back in the javascript code:
<code>
+ byte[] configLabel = getConfigLabel(zebraPrinter, label);
+ byte[] tid = connection.sendAndWaitForResponse(configLabel, 2000, 2000, null);
+ success = true;
+ loading = false;
+ String sTid = new String(tid);
+ Log.d("sTid", sTid);
+ promise.resolve(sTid);
</code>
but I can't manage an async loop to print multiple tags.
Is there any ZPL command that could help me to print multiple tags with only one command, and get back all the tag ids?
I found a <a href="https://developer.zebra.com/thread/34828">discussion</a&gt; that could be interesting, but I'm doubtful if there can be a better and faster option. Do you have any suggestions?
thanks a lot

Please register or login to post a reply

1 Replies

G Giorgio Zett

Just to keep notes for the future, I resolved it in this way:
<code>
WritableArray resultList = Arguments.createArray();
...
for (int i=0; i &lt; counter; i++) {
byte[] tid = printerConnection.sendAndWaitForResponse(testLabel, 2000, 2000, null);
String sTid = new String(tid);
Log.d("sTid", sTid);
resultList.pushString(sTid);
}
promise.resolve(resultList);
</code>
Counter is a params from js that indicates how many labels I want to print

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