dash: ktlintFormat
This commit is contained in:
parent
ff6a67cc97
commit
14af90e9e3
6 changed files with 15 additions and 18 deletions
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
|
|||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Id
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.CouldNotParseMessageException
|
||||
import retrofit2.http.HEAD
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
/***
|
||||
|
|
|
@ -195,8 +195,7 @@ data class LastOptionalPlusOneBlePacket(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun ByteArray.assertSizeAtLeast(size: Int, index: Byte?=null) {
|
||||
private fun ByteArray.assertSizeAtLeast(size: Int, index: Byte? = null) {
|
||||
if (this.size < size) {
|
||||
throw IncorrectPacketException(this, index)
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ internal class LTKExchanger(
|
|||
val sps1 = sps1()
|
||||
throwOnSendError(sps1.messagePacket, "SP1")
|
||||
|
||||
|
||||
val podSps1 = msgIO.receiveMessage() ?: throw PairingException("Could not read SPS1")
|
||||
processSps1FromPod(podSps1)
|
||||
// now we have all the data to generate: confPod, confPdm, ltk and noncePrefix
|
||||
|
@ -45,7 +44,6 @@ internal class LTKExchanger(
|
|||
val sps2 = sps2()
|
||||
throwOnSendError(sps2.messagePacket, "SPS2")
|
||||
|
||||
|
||||
val podSps2 = msgIO.receiveMessage() ?: throw PairingException("Could not read SPS2")
|
||||
validatePodSps2(podSps2)
|
||||
|
||||
|
@ -53,7 +51,6 @@ internal class LTKExchanger(
|
|||
// send SP0GP0
|
||||
throwOnSendErrorSending(sp0gp0().messagePacket, "SP0GP0")
|
||||
|
||||
|
||||
// No exception throwing after this point. It is possible that the pod saved the LTK
|
||||
msgIO.receiveMessage()
|
||||
?.let { validateP0(it) }
|
||||
|
|
|
@ -116,9 +116,11 @@ class SessionEstablisher(
|
|||
when (attr) {
|
||||
is EapAkaAttributeRes ->
|
||||
if (!milenage.res.contentEquals(attr.payload)) {
|
||||
throw SessionEstablishmentException("RES mismatch." +
|
||||
throw SessionEstablishmentException(
|
||||
"RES mismatch." +
|
||||
"Expected: ${milenage.res.toHex()}." +
|
||||
"Actual: ${attr.payload.toHex()}.")
|
||||
"Actual: ${attr.payload.toHex()}."
|
||||
)
|
||||
}
|
||||
is EapAkaAttributeCustomIV ->
|
||||
nodeIV = attr.payload.copyOfRange(0, IV_SIZE)
|
||||
|
@ -146,7 +148,8 @@ class SessionEstablisher(
|
|||
private fun isResynchronization(eapMsg: EapMessage): EapSqn? {
|
||||
if (eapMsg.subType != EapMessage.SUBTYPE_SYNCRONIZATION_FAILURE ||
|
||||
eapMsg.attributes.size != 1 ||
|
||||
eapMsg.attributes[0] !is EapAkaAttributeAuts)
|
||||
eapMsg.attributes[0] !is EapAkaAttributeAuts
|
||||
)
|
||||
return null
|
||||
|
||||
val auts = eapMsg.attributes[0] as EapAkaAttributeAuts
|
||||
|
@ -175,7 +178,6 @@ class SessionEstablisher(
|
|||
)
|
||||
}
|
||||
return EapSqn(autsMilenage.synchronizationSqn)
|
||||
|
||||
}
|
||||
|
||||
private fun eapSuccess(): MessagePacket {
|
||||
|
|
Loading…
Reference in a new issue