SocketMobile / swift-package-capturesdk

CaptureSDK is the easiest solution for adding barcode scanning and RFID/NFC reading capability to an iOS application
Other
6 stars 1 forks source link

Battery level always 1677745664 on S700 #11

Closed 2blane closed 1 year ago

2blane commented 1 year ago

When calling getBatteryLevelWithCompletionHandler it always returns 1677745664 as the battery level. I've tried calling it from multiple places. Does this number mean something or why is it returning this? What is the expected range of battery level (0-100)?

self.scanner?.getBatteryLevelWithCompletionHandler({ result, batteryLevel in
    if result == SKTCaptureErrors.E_NOERROR {
        print("Battery Level: \(batteryLevel ?? 0)")
    }
})
2blane commented 1 year ago

Ahh, figured it out. There is a conversion: let percentage = SKTHelper.getCurrentLevel(fromBatteryLevel: Int(batteryLevel))