How to read battery properties in RFID Scan for Zebra 8500 ?

G Gurpreet Gandhi 3 years 6 months ago
43 0 0

Hi Community,

I'm trying to get the battery properties from the Zebra 8500 in Rfid scan, I'm using Zebra_RFIDAPI3_SDK_2.0.0.2
what I'm trying to do is this (see the code below)

creating an RfidEventsListener  object
then subscribing to eventStatusNotify and trying to access the battery charging, level

But each time it gives me values as null seems there is some issue with  the RfidEventsListener.

Can some one assist me on this ?

                rfidReader.Events.setBatteryEvent(true);
                rfidReader.Config.getDeviceStatus(true, true, true);
                StatusEventData statusEventData = rfidReader.Events.GetStatusEventData(RFID_EVENT_TYPE.BATTERY_EVENT);
                RfidStatusEvents rfidReadEvents = new RfidStatusEvents(statusEventData);
                rfidReadEvents.setStatusEventData(statusEventData);
                rfidReader.Events.addEventsListener(eventHandler);
                eventHandler.eventStatusNotify(rfidStatusEvents);

                RfidEventsListener eventHandler = new RfidEventsListener() {

                    @Override
                    public void eventStatusNotify(RfidStatusEvents rfidStatusEvents) {
                            boolean charging = rfidStatusEvents.StatusEventData.BatteryData.getCharging();
                            int battery = rfidStatusEvents.StatusEventData.BatteryData.getLevel();
                            String batterycause = rfidStatusEvents.StatusEventData.BatteryData.getCause();
                            StatusEventData statusEventData = rfidReader.Events.GetStatusEventData(RFID_EVENT_TYPE.BATTERY_EVENT);
                            RfidStatusEvents rfidReadEvents = new RfidStatusEvents(statusEventData);
                            rfidReadEvents.setStatusEventData(statusEventData);
                        }
                    }

                    @Override
                    public void eventReadNotify(RfidReadEvents rfidReadEvents) {
                        Toast.makeText(context, "rfidReadEvents : ", Toast.LENGTH_SHORT).show();
                    }
                };
       

Thanks In advance,
Gurpreet Gandhi
gurpreetgandhi3@gmail.com

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