-
Notifications
You must be signed in to change notification settings - Fork 191
Description
Platform on which you observed the bug:
- Android
- [ x] iOS
- Other
- Platform is not relevant for this bug
SDK version:
6.5.0
Customer app url
Link to app store https://apps.apple.com/cz/app/kardi-ai/id1620687198
Device on which you observed the bug:
- Grit X2 Pro
- Vantage V3
- Vantage M3
- Polar OH1
- Polar Verity Sense
- [x ] Polar H10
- Polar H9
- Polar 360
- Other
- Device is not relevant for this bug
Describe the bug
FirmwareUpdateApi.checkFirmwareUpdate returns failure, when the firmware is up to date. Polar API returns status code 204, if the firmware of the device is up to date. The 204 response has no body and it obviously cannot but parsed, but it shouldn't end up as a failure. The issue is here :
if var fwResponse = try? JSONDecoder().decode(FirmwareUpdateResponse.self, from: data) {
fwResponse.statusCode = statusCode
completion(.success(fwResponse))
} else {
BleLogger.error("Failed to decode client response")
completion(.failure(Failure.responseParseError))
}
The method returns the error : "Polar SDK log: [BLE][ERROR] Error checking firmware update: responseParseError"
If I am subscribed to statusCheck, then I get "checkFwUpdateFailed" from the enum CheckFirmwareUpdateStatus, instead of "checkFwUpdateNotAvailable"
How to Reproduce
Try to check the firmware version of up to date device.
Expected behavior
Subscribe should return CheckFirmwareUpdateStatus.checkFwUpdateNotAvailable and in FirmwareUpdateApi.checkFirmwareUpdate should return completion(.success(fwResponse)) after http status 204 from the Polar API.
Screenshots and logs
Log from FirmwareUpdateApi.checkFirmwareUpdate
Polar SDK log: [BLE] Request Method: POST
Polar SDK log: [BLE] Request Headers: ["Accept": "application/json", "Content-Type": "application/json"]
Polar SDK log: [BLE] Request Body: FirmwareUpdateRequest(clientId: "polar-sensor-data-collector-ios", uuid: "0e030000-0084-0000-0000-000094D2EE26", firmwareVersion: "3.3.1", hardwareCode: "00760690.03")
Polar SDK log: [BLE] Response Data:
Polar SDK log: [BLE][ERROR] Response status code: (204)
Polar SDK log: [BLE][ERROR] Failed to decode client response
Polar SDK log: [BLE][ERROR] Error checking firmware update: responseParseError
