format: klintFormat
This commit is contained in:
parent
ada3560f49
commit
c9beb21404
8 changed files with 25 additions and 29 deletions
|
@ -21,7 +21,8 @@ class BleDiscoveredDevice(val scanResult: ScanResult, private val scanRecord: Sc
|
||||||
throw DiscoveredInvalidPodException(
|
throw DiscoveredInvalidPodException(
|
||||||
"The first exposed service UUID should be 4024, got " + extractUUID16(
|
"The first exposed service UUID should be 4024, got " + extractUUID16(
|
||||||
serviceUuids[0]
|
serviceUuids[0]
|
||||||
), serviceUuids
|
),
|
||||||
|
serviceUuids
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// TODO understand what is serviceUUIDs[1]. 0x2470. Alarms?
|
// TODO understand what is serviceUUIDs[1]. 0x2470. Alarms?
|
||||||
|
|
|
@ -94,7 +94,6 @@ data class EapAkaAttributeRes(val payload: ByteArray) : EapAkaAttribute() {
|
||||||
|
|
||||||
override fun toByteArray(): ByteArray {
|
override fun toByteArray(): ByteArray {
|
||||||
return byteArrayOf(EapAkaAttributeType.AT_RES.type, SIZE, 0, PAYLOAD_SIZE_BITS) + payload
|
return byteArrayOf(EapAkaAttributeType.AT_RES.type, SIZE, 0, PAYLOAD_SIZE_BITS) + payload
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -73,12 +73,11 @@ class EapAkaExchanger(private val aapsLogger: AAPSLogger, private val msgIO: Mes
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processChallengeResponse(challengeResponse: MessagePacket) {
|
private fun processChallengeResponse(challengeResponse: MessagePacket) {
|
||||||
//TODO verify that identifier matches identifer from the Challenge
|
// TODO verify that identifier matches identifer from the Challenge
|
||||||
val eapMsg = EapMessage.parse(aapsLogger, challengeResponse.payload)
|
val eapMsg = EapMessage.parse(aapsLogger, challengeResponse.payload)
|
||||||
if (eapMsg.attributes.size != 2) {
|
if (eapMsg.attributes.size != 2) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "EAP-AKA: got RES message: $eapMsg")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "EAP-AKA: got RES message: $eapMsg")
|
||||||
throw SessionEstablishmentException("Expecting two attributes, got: ${eapMsg.attributes.size}")
|
throw SessionEstablishmentException("Expecting two attributes, got: ${eapMsg.attributes.size}")
|
||||||
|
|
||||||
}
|
}
|
||||||
for (attr in eapMsg.attributes) {
|
for (attr in eapMsg.attributes) {
|
||||||
when (attr) {
|
when (attr) {
|
||||||
|
@ -89,10 +88,9 @@ class EapAkaExchanger(private val aapsLogger: AAPSLogger, private val msgIO: Mes
|
||||||
is EapAkaAttributeCustomIV ->
|
is EapAkaAttributeCustomIV ->
|
||||||
nodeIV = attr.payload.copyOfRange(0, IV_SIZE)
|
nodeIV = attr.payload.copyOfRange(0, IV_SIZE)
|
||||||
else ->
|
else ->
|
||||||
throw SessionEstablishmentException("Unknown attribute received: ${attr}")
|
throw SessionEstablishmentException("Unknown attribute received: $attr")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun eapSuccess(): MessagePacket {
|
private fun eapSuccess(): MessagePacket {
|
||||||
|
@ -119,4 +117,3 @@ class EapAkaExchanger(private val aapsLogger: AAPSLogger, private val msgIO: Mes
|
||||||
private const val IV_SIZE = 4
|
private const val IV_SIZE = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,5 +47,4 @@ class MilenageTest {
|
||||||
Assert.assertEquals(m.ck.toHex(), "8dd4b3ceb849a01766e37f9d86045c39")
|
Assert.assertEquals(m.ck.toHex(), "8dd4b3ceb849a01766e37f9d86045c39")
|
||||||
Assert.assertEquals(m.autn.toHex(), "0e0264d056fcb9b9752227365a090955")
|
Assert.assertEquals(m.autn.toHex(), "0e0264d056fcb9b9752227365a090955")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue