From 38e2ae90d8e10ed62f599a79ce01fab439cf3224 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 20 Jul 2020 15:09:01 +0200 Subject: [PATCH] fix parsing RS password --- .../java/info/nightscout/androidaps/danars/services/BLEComm.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt b/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt index e3e0bc4db0..1e0e5f088b 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/services/BLEComm.kt @@ -554,7 +554,7 @@ class BLEComm @Inject internal constructor( val size = decryptedBuffer.size var pass: Int = (decryptedBuffer[size - 1].toInt() and 0x000000FF shl 8) + (decryptedBuffer[size - 2].toInt() and 0x000000FF) pass = pass xor 3463 - danaPump.rsPassword = Integer.toHexString(pass) + danaPump.rsPassword = String.format("%04X", pass) aapsLogger.debug(LTag.PUMPBTCOMM, "Pump user password: " + danaPump.rsPassword) if (!danaPump.isRSPasswordOK) { aapsLogger.error(LTag.PUMPBTCOMM, "Wrong pump password")