From 7dd8fc1bf68e2d716e1bff8e0af9a6a7a88d1e41 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Sat, 6 Mar 2021 21:16:03 +0100 Subject: [PATCH] dash/ble: ktlintFormat --- .../plugins/pump/omnipod/dash/driver/comm/Id.kt | 2 +- .../omnipod/dash/driver/comm/pair/LTKExchanger.kt | 1 - .../pump/omnipod/dash/driver/comm/pair/PairResult.kt | 1 - .../omnipod/dash/driver/comm/session/EapMessage.kt | 1 - .../dash/driver/comm/session/SessionEstablisher.kt | 4 ++-- .../driver/pod/state/OmnipodDashPodStateManager.kt | 2 +- .../pod/state/OmnipodDashPodStateManagerImpl.kt | 12 ++++++------ .../omnipod/dash/ui/OmnipodDashOverviewFragment.kt | 1 - 8 files changed, 10 insertions(+), 14 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/Id.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/Id.kt index b78aa5ecc5..6907557287 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/Id.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/Id.kt @@ -37,7 +37,7 @@ data class Id(val address: ByteArray) { return Id(ByteBuffer.allocate(4).putInt(v).array()) } fun fromLong(v: Long): Id { - return Id(ByteBuffer.allocate(8).putLong(v).array().copyOfRange(4,8)) + return Id(ByteBuffer.allocate(8).putLong(v).array().copyOfRange(4, 8)) } } } 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 5965d11745..0530aac607 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 @@ -5,7 +5,6 @@ import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Id -import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.OmnipodDashBleManagerImpl import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.MessageIOException import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessageIO import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessagePacket diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/PairResult.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/PairResult.kt index c23be1d0a5..900065aaa4 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/PairResult.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/PairResult.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.pair -import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Id import info.nightscout.androidaps.utils.extensions.toHex data class PairResult(val ltk: ByteArray, val msgSeq: Byte) { diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessage.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessage.kt index d25802c079..a627391612 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessage.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessage.kt @@ -4,7 +4,6 @@ import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.MessageIOException import info.nightscout.androidaps.utils.extensions.toHex -import okio.ByteString.Companion.toByteString import java.nio.ByteBuffer enum class EapCode(val code: Byte) { diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/SessionEstablisher.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/SessionEstablisher.kt index e8b89cc73c..a3c17a19f4 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/SessionEstablisher.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/SessionEstablisher.kt @@ -27,8 +27,8 @@ class SessionEstablisher( private val milenage = Milenage(aapsLogger, ltk, eapSqn) init { - require(eapSqn.size == 6) {"EAP-SQN has to be 6 bytes long"} - require(ltk.size == 16) {"LTK has to be 16 bytes long"} + require(eapSqn.size == 6) { "EAP-SQN has to be 6 bytes long" } + require(ltk.size == 16) { "LTK has to be 16 bytes long" } aapsLogger.debug(LTag.PUMPBTCOMM, "Starting EAP-AKA") val random = SecureRandom() diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManager.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManager.kt index 49d3aceb79..75ec144593 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManager.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManager.kt @@ -48,7 +48,7 @@ interface OmnipodDashPodStateManager { val basalProgram: BasalProgram? fun increaseMessageSequenceNumber() - fun increaseEapAkaSequenceNumber():ByteArray + fun increaseEapAkaSequenceNumber(): ByteArray fun commitEapAkaSequenceNumber() fun updateFromDefaultStatusResponse(response: DefaultStatusResponse) fun updateFromVersionResponse(response: VersionResponse) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt index c535536726..f8f05c729f 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt @@ -159,13 +159,13 @@ class OmnipodDashPodStateManagerImpl @Inject constructor( } override var ltk: ByteArray? - get() = podState.ltk - set(value) { - podState.ltk = value - store() - } + get() = podState.ltk + set(value) { + podState.ltk = value + store() + } - override fun increaseEapAkaSequenceNumber():ByteArray { + override fun increaseEapAkaSequenceNumber(): ByteArray { podState.eapAkaSequenceNumber++ return ByteBuffer.allocate(8) .putLong(podState.eapAkaSequenceNumber) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 275e995c91..749f0d0de5 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -325,7 +325,6 @@ class OmnipodDashOverviewFragment : DaggerFragment() { } podInfoBinding.podActiveAlerts.text = PLACEHOLDER - } if (errors.size == 0) {