From 5ef07dd0beea8845d8a76b312f23c11101db230b Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Mon, 1 Mar 2021 13:52:43 +0100 Subject: [PATCH] detekt resolve a few more --- .../pump/omnipod/dash/driver/comm/io/BleIO.kt | 1 + .../dash/driver/comm/pair/LTKExchanger.kt | 22 +++++++++---------- .../pump/omnipod/dash/history/DashHistory.kt | 1 + 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/io/BleIO.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/io/BleIO.kt index de2125a2b5..dbfc1ff344 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/io/BleIO.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/io/BleIO.kt @@ -1,3 +1,4 @@ +@file:Suppress("WildcardImport") package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io import android.bluetooth.BluetoothGatt diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/LTKExchanger.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/LTKExchanger.kt index a6cc8b3bb5..d43b8e0479 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/LTKExchanger.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/LTKExchanger.kt @@ -225,24 +225,24 @@ internal class LTKExchanger(private val aapsLogger: AAPSLogger, private val msgI companion object { - private val PUBLIC_KEY_SIZE = 32 - private val NONCE_SIZE = 16 - private val CONF_SIZE = 16 + private const val PUBLIC_KEY_SIZE = 32 + private const val NONCE_SIZE = 16 + private const val CONF_SIZE = 16 - private val CMAC_SIZE = 16 + private const val CMAC_SIZE = 16 private val INTERMEDIAR_KEY_MAGIC_STRING = "TWIt".toByteArray() private val PDM_CONF_MAGIC_PREFIX = "KC_2_U".toByteArray() private val POD_CONF_MAGIC_PREFIX = "KC_2_V".toByteArray() - private val GET_POD_STATUS_HEX_COMMAND = "ffc32dbd08030e0100008a" // TODO for now we are assuming this command is build out of constant parameters, use a proper command builder for that. + private const val GET_POD_STATUS_HEX_COMMAND = "ffc32dbd08030e0100008a" // TODO for now we are assuming this command is build out of constant parameters, use a proper command builder for that. - private val SP1 = "SP1=" - private val SP2 = ",SP2=" - private val SPS1 = "SPS1=" - private val SPS2 = "SPS2=" - private val SP0GP0 = "SP0,GP0" - private val P0 = "P0=" + private const val SP1 = "SP1=" + private const val SP2 = ",SP2=" + private const val SPS1 = "SPS1=" + private const val SPS2 = "SPS2=" + private const val SP0GP0 = "SP0,GP0" + private const val P0 = "P0=" private val UNKNOWN_P0_PAYLOAD = byteArrayOf(0xa5.toByte()) } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistory.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistory.kt index d8c9bf36c1..81cfa6475c 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistory.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/history/DashHistory.kt @@ -26,6 +26,7 @@ class DashHistory @Inject constructor( fun markFailure(id: String, date: Long): Completable = dao.markResolved(id, ResolvedResult.FAILURE, currentTimeMillis()) + @Suppress("ReturnCount") fun createRecord( commandType: OmnipodCommandType, date: Long,