Skip to content

Commit

Permalink
Merge pull request #16 from 0pen-dash/format
Browse files Browse the repository at this point in the history
code formatting
  • Loading branch information
avereha authored Mar 2, 2021
2 parents f404505 + 0523f7c commit db47554
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ data class MessagePacket(
ackNumber = ackNumber,
source = Id(payload.copyOfRange(8, 12)),
destination = Id(payload.copyOfRange(12, 16)),
payload = payload.copyOfRange(16, payloadEnd),
payload = payload.copyOfRange(16, payloadEnd)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ internal class PayloadSplitter(private val payload: ByteArray) {
totalFragments = 0,
payload = payload.copyOfRange(0, end),
size = payload.size.toByte(),
crc32 = crc32,
crc32 = crc32
)
)
if (payload.size > FirstBlePacket.CAPACITY_WITHOUT_MIDDLE_PACKETS) {
ret.add(
LastOptionalPlusOneBlePacket(
index = 1,
payload = payload.copyOfRange(end, payload.size),
size = (payload.size - end).toByte(),
size = (payload.size - end).toByte()
)
)
}
Expand All @@ -40,7 +40,7 @@ internal class PayloadSplitter(private val payload: ByteArray) {
ret.add(
FirstBlePacket(
totalFragments = (middleFragments + 1).toByte(),
payload = payload.copyOfRange(0, FirstBlePacket.CAPACITY_WITH_MIDDLE_PACKETS),
payload = payload.copyOfRange(0, FirstBlePacket.CAPACITY_WITH_MIDDLE_PACKETS)
)
)
for (i in 1..middleFragments) {
Expand All @@ -58,7 +58,7 @@ internal class PayloadSplitter(private val payload: ByteArray) {
ret.add(
MiddleBlePacket(
index = i.toByte(),
payload = p,
payload = p
)
)
}
Expand All @@ -71,7 +71,7 @@ internal class PayloadSplitter(private val payload: ByteArray) {
middleFragments * MiddleBlePacket.CAPACITY + FirstBlePacket.CAPACITY_WITH_MIDDLE_PACKETS,
middleFragments * MiddleBlePacket.CAPACITY + FirstBlePacket.CAPACITY_WITH_MIDDLE_PACKETS + end
),
crc32 = crc32,
crc32 = crc32
)
)
if (rest > LastBlePacket.CAPACITY) {
Expand All @@ -82,7 +82,7 @@ internal class PayloadSplitter(private val payload: ByteArray) {
payload = payload.copyOfRange(
middleFragments * MiddleBlePacket.CAPACITY + FirstBlePacket.CAPACITY_WITH_MIDDLE_PACKETS + LastBlePacket.CAPACITY,
payload.size
),
)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ internal class LTKExchanger(private val aapsLogger: AAPSLogger, private val msgI
private fun sp1sp2(sp1: ByteArray, sp2: ByteArray): PairMessage {
val payload = StringLengthPrefixEncoding.formatKeys(
arrayOf(SP1, SP2),
arrayOf(sp1, sp2),
arrayOf(sp1, sp2)
)
return PairMessage(
sequenceNumber = seq,
Expand All @@ -95,7 +95,7 @@ internal class LTKExchanger(private val aapsLogger: AAPSLogger, private val msgI
private fun sps1(): PairMessage {
val payload = StringLengthPrefixEncoding.formatKeys(
arrayOf("SPS1="),
arrayOf(pdmPublic + pdmNonce),
arrayOf(pdmPublic + pdmNonce)
)
return PairMessage(
sequenceNumber = seq,
Expand All @@ -119,7 +119,7 @@ internal class LTKExchanger(private val aapsLogger: AAPSLogger, private val msgI
private fun sps2(): PairMessage {
val payload = StringLengthPrefixEncoding.formatKeys(
arrayOf(SPS2),
arrayOf(pdmConf),
arrayOf(pdmConf)
)
return PairMessage(
sequenceNumber = seq,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class HistoryMapper {
tempBasalRecord = historyRecord.record as? TempBasalRecord,
bolusRecord = historyRecord.record as? BolusRecord,
resolvedResult = historyRecord.resolvedResult,
resolvedAt = historyRecord.resolvedAt,
resolvedAt = historyRecord.resolvedAt
)

fun entityToDomain(entity: HistoryRecordEntity): HistoryRecord =
Expand Down

0 comments on commit db47554

Please sign in to comment.