PP + Battery Support

Applicable Devices : RFD40, RFD90

Overview

Gets detailed battery information from a reader that uses a PowerPrecision+ (PP+) battery, using srfidGetBatteryStatus. For the charge level and charging state only, use the battery event described in Knowing Battery Status.

Details

The srfidGetBatteryStatus:batteryStatusArray:aStatusMessage: method returns the battery information as an array of srfidRfidBatteryStatusInformation objects. Each object holds one item: call getBatteryStatusTittle to get its name and getBatterStatusValue to get its value, both as strings. The array contains items such as the following:

  • GIFTED_BATTERY_PERCENTAGE: charge level
  • GIFTED_BATTERY_STATE_OF_HEALTH: battery health
  • GIFTED_BATTERY_CYCLE_COUNT: number of charge cycles
  • GIFTED_BATTERY_VOLTAGE, GIFTED_BATTERY_CURRENT and GIFTED_BATTERY_PACK_TEMPERATURE
  • GIFTED_BATTERY_DESIGN_CAPACITY, GIFTED_BATTERY_FULL_CHARGE_CAPACITY and GIFTED_BATTERY_REMAINING_CAPACITY
  • GIFTED_BATTERY_CHARGING_Y_N, GIFTED_BATTERY_CHARGE_STATUS and GIFTED_BATTERY_TIME_TO_FULL_CHARGE
  • GIFTED_BATTERY_MODEL_NUMBER, GIFTED_BATTERY_MANUFACTURE_DATE, GIFTED_BATTERY_SERIAL_NUMBER and GIFTED_BATTERY_ID

The statusMessage parameter returns a status message from the reader when the call does not succeed.


/// Get battery status
/// @param readerID The reader id
/// @param statusMessage The status message
-(SRFID_RESULT)getBatteryStatus:(int)readerID  aStatusMessage:(NSString**)statusMessage {

    NSMutableArray *batteryStatusValueList = [[NSMutableArray alloc] init];
    SRFID_RESULT srfid_result = SRFID_RESULT_FAILURE;

    for(int i = 0; i < 3; i++)
    {
        srfid_result = [apiInstance srfidGetBatteryStatus:readerID batteryStatusArray:&batteryStatusValueList aStatusMessage:statusMessage];

        if ((srfid_result != SRFID_RESULT_RESPONSE_TIMEOUT) && (srfid_result != SRFID_RESULT_FAILURE))
        {
            break;
        }
    }

    if (srfid_result == SRFID_RESULT_SUCCESS)
    {
        for (srfidRfidBatteryStatusInformation *info in batteryStatusValueList) {
            NSLog(@"%@: %@", [info getBatteryStatusTittle], [info getBatterStatusValue]);
        }
    }
    else if(srfid_result == SRFID_RESULT_RESPONSE_ERROR)
    {
        NSLog(@"Get battery status: response error");
    }
    else if(srfid_result == SRFID_RESULT_FAILURE || srfid_result == SRFID_RESULT_RESPONSE_TIMEOUT)
    {
        NSLog(@"Get battery status: failure or timeout");
    }
    return srfid_result;
}