Overview
This Tutorial provides a walk-through of the steps to fetch PP+ battery statistics using RFID3 APIRFID3 API
Create The Project
- Start by creating a new project in Android Studio. For help, see the Android Studio tutorial.
- Refer Hello RFID to prepare basic setup to work with RFID Reader and then follow this guide
Details
BatteryStatistics provide following battery information
- Battery Asset Information
- Charge cycles consumed
- Battery Status
- State of health
Setting it up
BatteryStatistics batteryStats = new BatteryStatistics();
private void fetchAndUpdateBatteryStats() {
try {
batteryStats = mConnectedReader.Config.getBatteryStats();
} catch (OperationFailureException | InvalidUsageException | NullPointerException e) {
Log.e(TAG, e.getStackTrace()[0].toString());
}
String header = "Battery Asset Information";
Log.i(TAG, "Manufacture Date : " + batteryStats.getManufactureDate() );
Log.i(TAG, "Model Number : " + batteryStats.getModelNumber());
Log.i(TAG, "Battery ID : " + batteryStats.getBatteryId() );
String header1 = "Battery Life Statistics";
Log.i(TAG, "State of Health : " + batteryStats.getHealth() +"%" );
Log.i (TAG, “Charge Cycles Consumed : " + String.valueOf(batteryStats.getCycleCount()));
String header2 = "Battery Status";
Log.i(TAG, "Charge Percentage : " + batteryStats.getPercentage() +"%");
Log.i(TAG, "Charge Status : " + String.valueOf(batteryStats.getChargeStatus()) );
String header3 = "Battery Temperature";
Log.i(TAG, "Present : " + batteryStats.getPercentage() +"\u00B0"+"C");
}