Add support for fake AirPods Gen3

This commit is contained in:
darken
2022-12-19 16:32:09 +01:00
committed by Matthias Urhahn
parent 07be4b8258
commit 9e836eef69
6 changed files with 125 additions and 12 deletions
@@ -0,0 +1,34 @@
package eu.darken.capod.pods.core.apple.misc
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
import eu.darken.capod.pods.core.apple.DualAirPods
import eu.darken.capod.pods.core.apple.HasAppleColor
import io.kotest.matchers.shouldBe
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Test
class FakeAirPodsGen3Test : BaseAirPodsTest() {
@Test
fun `charging in case`() = runTest {
create<FakeAirPodsGen3>("07 13 01 13 20 75 AA 37 34 00 10 00 E4 E4 64 00 00 00 00 00 00") {
batteryLeftPodPercent shouldBe 1f
batteryRightPodPercent shouldBe 1f
isCaseCharging shouldBe false
isLeftPodCharging shouldBe true
isRightPodCharging shouldBe true
isLeftPodInEar shouldBe false
isRightPodInEar shouldBe false
batteryCasePercent shouldBe 0.7f
caseLidState shouldBe DualAirPods.LidState.OPEN
state shouldBe DualAirPods.ConnectionState.UNKNOWN
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
}
}
}
@@ -5,11 +5,11 @@ import io.kotest.matchers.shouldBe
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Test
class VarunrAirPodsProTest : BaseAirPodsTest() {
class FakeAirPodsProTest : BaseAirPodsTest() {
@Test
fun `guessed data`() = runTest {
create<VarunrAirPodsPro>("07 13 01 0E 20 71 AA 37 36 00 10 00 FF 64 FF 00 00 00 00 00 00") {
create<FakeAirPodsPro>("07 13 01 0E 20 71 AA 37 36 00 10 00 FF 64 FF 00 00 00 00 00 00") {
rawPrefix shouldBe 0x01.toUByte()
rawDeviceModel shouldBe 0x0E20.toUShort()
rawStatus shouldBe 0x71.toUByte()