Compare commits

...
3 Commits
Author SHA1 Message Date
darken 48fd3543e3 Release: 2.7.2-rc0 2023-01-30 13:38:53 +01:00
Matthias Urhahn 41985794c2 Adjust supported AirPods Max features. (#86)
Remove state detection (was UNKNOWN when it should have been MUSIC).
Add PodStyle detection.
2023-01-30 13:37:40 +01:00
Matthias Urhahn 87a92fd001 Fix feature display for single pods inside the app. (#87) 2023-01-30 13:37:31 +01:00
5 changed files with 33 additions and 8 deletions
+1 -1
View File
@@ -1 +1 @@
2.7.1-rc1 20701010 2.7.2-rc0 20702000
@@ -6,6 +6,7 @@ import eu.darken.capod.common.isBitSet
import eu.darken.capod.pods.core.HasEarDetection import eu.darken.capod.pods.core.HasEarDetection
import eu.darken.capod.pods.core.PodDevice import eu.darken.capod.pods.core.PodDevice
import eu.darken.capod.pods.core.apple.ApplePods import eu.darken.capod.pods.core.apple.ApplePods
import eu.darken.capod.pods.core.apple.HasAppleColor
import eu.darken.capod.pods.core.apple.SingleApplePods import eu.darken.capod.pods.core.apple.SingleApplePods
import eu.darken.capod.pods.core.apple.SingleApplePodsFactory import eu.darken.capod.pods.core.apple.SingleApplePodsFactory
import eu.darken.capod.pods.core.apple.protocol.ProximityPairing import eu.darken.capod.pods.core.apple.protocol.ProximityPairing
@@ -21,7 +22,7 @@ data class AirPodsMax(
override val proximityMessage: ProximityPairing.Message, override val proximityMessage: ProximityPairing.Message,
override val confidence: Float = PodDevice.BASE_CONFIDENCE, override val confidence: Float = PodDevice.BASE_CONFIDENCE,
private val rssiAverage: Int? = null, private val rssiAverage: Int? = null,
) : SingleApplePods, HasEarDetection, HasStateDetectionAirPods { ) : SingleApplePods, HasEarDetection, HasAppleColor {
override val model: PodDevice.Model = PodDevice.Model.AIRPODS_MAX override val model: PodDevice.Model = PodDevice.Model.AIRPODS_MAX
@@ -2,6 +2,7 @@ package eu.darken.capod.pods.core.apple.airpods
import eu.darken.capod.pods.core.PodDevice import eu.darken.capod.pods.core.PodDevice
import eu.darken.capod.pods.core.apple.BaseAirPodsTest import eu.darken.capod.pods.core.apple.BaseAirPodsTest
import eu.darken.capod.pods.core.apple.HasAppleColor
import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldBe
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@@ -53,4 +54,27 @@ class AirPodsMaxTest : BaseAirPodsTest() {
isHeadphonesBeingWorn shouldBe true isHeadphonesBeingWorn shouldBe true
} }
} }
@Test
fun `some dude at the gym`() = runTest {
create<AirPodsMax>("07 19 01 0A 20 23 07 80 03 03 65 1F 28 32 D0 D9 71 43 00 9A 40 E7 6B EA 6C 2C FB") {
rawPrefix shouldBe 0x01.toUByte()
rawDeviceModel shouldBe 0x0A20.toUShort()
rawStatus shouldBe 0x23.toUByte()
rawPodsBattery shouldBe 0x07.toUByte()
rawFlags shouldBe 0x8.toUShort()
rawCaseBattery shouldBe 0x0.toUShort()
rawCaseLidState shouldBe 0x03.toUByte()
rawDeviceColor shouldBe 0x03.toUByte()
rawSuffix shouldBe 0x65.toUByte()
batteryHeadsetPercent shouldBe 0.7f
isHeadsetBeingCharged shouldBe false
isHeadphonesBeingWorn shouldBe true
podStyle shouldBe HasAppleColor.DeviceColor.BLUE
}
}
} }
@@ -42,8 +42,8 @@ class SinglePodsCardVH(parent: ViewGroup) :
// Charge state // Charge state
device.apply { device.apply {
if (this is HasChargeDetection) { if (this is HasChargeDetection) {
chargingIcon.isInvisible = isHeadsetBeingCharged chargingIcon.isInvisible = !isHeadsetBeingCharged
chargingLabel.isInvisible = isHeadsetBeingCharged chargingLabel.isInvisible = !isHeadsetBeingCharged
} else { } else {
chargingIcon.isGone = true chargingIcon.isGone = true
chargingLabel.isGone = true chargingLabel.isGone = true
@@ -53,8 +53,8 @@ class SinglePodsCardVH(parent: ViewGroup) :
// Has ear detection // Has ear detection
device.apply { device.apply {
if (this is HasEarDetection) { if (this is HasEarDetection) {
wearIcon.isInvisible = isBeingWorn wearIcon.isInvisible = !isBeingWorn
wearLabel.isInvisible = isBeingWorn wearLabel.isInvisible = !isBeingWorn
} else { } else {
wearIcon.isGone = true wearIcon.isGone = true
wearLabel.isGone = true wearLabel.isGone = true
+2 -2
View File
@@ -1,6 +1,6 @@
### Updated by release.sh ### ### Updated by release.sh ###
project.versioning.major=2 project.versioning.major=2
project.versioning.minor=7 project.versioning.minor=7
project.versioning.patch=1 project.versioning.patch=2
project.versioning.build=1 project.versioning.build=0
############################# #############################