Using the Zebra RFID API SDK with RFD8500

// Expert user has replied.
D Dave Westerman 2 years 10 months ago
13 1 0

I'm trying to look at some of the information in the different config objects for a Zebra RFD8500 using the RFID API 3 SDK (2.0.1.34). But the data I'm trying to log has me puzzled.
Here's a snippet of my code (the `debugLog()` log method just does an `ObjectMapper.writeValueAsString(object)` call to show the object as JSON):
```
Readers readers = new Readers();
debugLog(METHOD_NAME, "readers", readers); // NOTE 1
try {
ArrayList readerDevices = readers.GetAvailableRFIDReaderList(); // NOTE 2
for (ReaderDevice readerDevice : readerDevices) {
debugLog(METHOD_NAME, "readerDevice", readerDevice);
RFIDReader rfidReader = readerDevice.getRFIDReader();
debugLog(METHOD_NAME, "rfidReader", rfidReader);
Config config = rfidReader.Config; // NOTE 3
debugLog(METHOD_NAME, "config", config);
Antennas antennas = config.Antennas; // NOTE 4
```
NOTE 1: `readers` is always displayed as a `null`.
NOTE 2: However, this line never gets an NPE, it works, and I can see the `readerDevice` and `rfidFReader` in the log!
NOTE 3: `config` is always null.
NOTE 4: This line usually throws an NPE. However, I've seen it work on occasion, even though `config` is always null!
Here is my log:
```
D/Rfd8500Module: .showRfd8500Info(): readers = null
D/Rfd8500Module: .showRfd8500Info(): readerDevice = {"address":"60:77:71:BA:C5:62","name":"RFD850020281520100269","password":null,"rfidreader":{"Actions":null,"Config":null,"Events":null,"ReaderCapabilities":null,"SecureConnectionInfo":null,"hostName":"RFD850020281520100269","password":null,"port":0,"timeout":0,"capabilitiesReceived":true,"connected":false}}
D/Rfd8500Module: .showRfd8500Info(): rfidReader = {"Actions":null,"Config":null,"Events":null,"ReaderCapabilities":null,"SecureConnectionInfo":null,"hostName":"RFD850020281520100269","password":null,"port":0,"timeout":0,"capabilitiesReceived":true,"connected":false}
D/Rfd8500Module: .showRfd8500Info(): config = null
E/Rfd8500Module: .showRfd8500Info(): exception encountered - Attempt to read from field 'com.zebra.rfid.api3.Antennas com.zebra.rfid.api3.Config.Antennas' on a null object reference
```
Is all this stuff async? Is there something I need to do to make sure I've got the data before I continue to the next step?

Please register or login to post a reply

1 Replies

J James Swinton-Bland

Hi Dave,

I would recommend trying the quick-start sample in our RFID Developers Guide - you can find the sample on Page 53: https://www.zebra.com/content/dam/zebra_new_ia/en-us/manuals/barcode-sca...

From a quick glance, to answer your notes:

Note 1 & 2: Perhaps ObjectMapper.writeValueAsString(object) can't convert the Reader object to JSON, and so returns null?

Note 3: You need to connect to the reader before performing any configuration

Note 4: Again, I would question if ObjectMapper API is causing a red-herring here.

As you will see in our Developer Guide the GetAvailableRFIDReaderList() API and subsequent calls are Async, so this will need to be performed on a background thread. 

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