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