dash/ble: ktlintFormat

This commit is contained in:
Andrei Vereha 2021-03-06 21:16:03 +01:00
parent e7a9e24093
commit 7dd8fc1bf6
8 changed files with 10 additions and 14 deletions

View file

@ -37,7 +37,7 @@ data class Id(val address: ByteArray) {
return Id(ByteBuffer.allocate(4).putInt(v).array()) return Id(ByteBuffer.allocate(4).putInt(v).array())
} }
fun fromLong(v: Long): Id { 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))
} }
} }
} }

View file

@ -5,7 +5,6 @@ import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig 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.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.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.MessageIO
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessagePacket import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessagePacket

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.pair 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 import info.nightscout.androidaps.utils.extensions.toHex
data class PairResult(val ltk: ByteArray, val msgSeq: Byte) { data class PairResult(val ltk: ByteArray, val msgSeq: Byte) {

View file

@ -4,7 +4,6 @@ import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.MessageIOException import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.MessageIOException
import info.nightscout.androidaps.utils.extensions.toHex import info.nightscout.androidaps.utils.extensions.toHex
import okio.ByteString.Companion.toByteString
import java.nio.ByteBuffer import java.nio.ByteBuffer
enum class EapCode(val code: Byte) { enum class EapCode(val code: Byte) {

View file

@ -27,8 +27,8 @@ class SessionEstablisher(
private val milenage = Milenage(aapsLogger, ltk, eapSqn) private val milenage = Milenage(aapsLogger, ltk, eapSqn)
init { init {
require(eapSqn.size == 6) {"EAP-SQN has to be 6 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"} require(ltk.size == 16) { "LTK has to be 16 bytes long" }
aapsLogger.debug(LTag.PUMPBTCOMM, "Starting EAP-AKA") aapsLogger.debug(LTag.PUMPBTCOMM, "Starting EAP-AKA")
val random = SecureRandom() val random = SecureRandom()

View file

@ -48,7 +48,7 @@ interface OmnipodDashPodStateManager {
val basalProgram: BasalProgram? val basalProgram: BasalProgram?
fun increaseMessageSequenceNumber() fun increaseMessageSequenceNumber()
fun increaseEapAkaSequenceNumber():ByteArray fun increaseEapAkaSequenceNumber(): ByteArray
fun commitEapAkaSequenceNumber() fun commitEapAkaSequenceNumber()
fun updateFromDefaultStatusResponse(response: DefaultStatusResponse) fun updateFromDefaultStatusResponse(response: DefaultStatusResponse)
fun updateFromVersionResponse(response: VersionResponse) fun updateFromVersionResponse(response: VersionResponse)

View file

@ -159,13 +159,13 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
} }
override var ltk: ByteArray? override var ltk: ByteArray?
get() = podState.ltk get() = podState.ltk
set(value) { set(value) {
podState.ltk = value podState.ltk = value
store() store()
} }
override fun increaseEapAkaSequenceNumber():ByteArray { override fun increaseEapAkaSequenceNumber(): ByteArray {
podState.eapAkaSequenceNumber++ podState.eapAkaSequenceNumber++
return ByteBuffer.allocate(8) return ByteBuffer.allocate(8)
.putLong(podState.eapAkaSequenceNumber) .putLong(podState.eapAkaSequenceNumber)

View file

@ -325,7 +325,6 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
} }
podInfoBinding.podActiveAlerts.text = PLACEHOLDER podInfoBinding.podActiveAlerts.text = PLACEHOLDER
} }
if (errors.size == 0) { if (errors.size == 0) {