Fix PowerBeats3 mapping

This commit is contained in:
darken
2022-01-04 19:20:22 +01:00
parent bfe6dc65fd
commit 7a5baed63a
2 changed files with 11 additions and 3 deletions
@@ -157,7 +157,7 @@ class AppleFactory @Inject constructor(
scanResult = scanResult, scanResult = scanResult,
proximityMessage = pm proximityMessage = pm
) )
dm == 0x0320.toUShort() -> PowerBeats3( dm == 0x1320.toUShort() -> PowerBeats3(
identifier = identifier, identifier = identifier,
scanResult = scanResult, scanResult = scanResult,
proximityMessage = pm proximityMessage = pm
@@ -10,9 +10,9 @@ class PowerBeats3Test : BaseAirPodsTest() {
// TODO This is handcrafted data, get actual data for tests // TODO This is handcrafted data, get actual data for tests
@Test @Test
fun `default PowerBeats3`() = runBlockingTest { fun `default PowerBeats3`() = runBlockingTest {
create<PowerBeats3>("07 19 01 03 20 62 04 80 01 0F 40 0D 70 50 16 F2 40 83 16 BF 10 16 34 9B 74 84 E8") { create<PowerBeats3>("07 19 01 13 20 62 04 80 01 0F 40 0D 70 50 16 F2 40 83 16 BF 10 16 34 9B 74 84 E8") {
rawPrefix shouldBe 0x01.toUByte() rawPrefix shouldBe 0x01.toUByte()
rawDeviceModel shouldBe 0x0320.toUShort() rawDeviceModel shouldBe 0x1320.toUShort()
rawStatus shouldBe 0x62.toUByte() rawStatus shouldBe 0x62.toUByte()
rawPodsBattery shouldBe 0x04.toUByte() rawPodsBattery shouldBe 0x04.toUByte()
rawCaseBattery shouldBe 0x80.toUByte() rawCaseBattery shouldBe 0x80.toUByte()
@@ -23,4 +23,12 @@ class PowerBeats3Test : BaseAirPodsTest() {
batteryHeadsetPercent shouldBe 0.4f batteryHeadsetPercent shouldBe 0.4f
} }
} }
// PowerBeats3 unconfirmed
@Test
fun `random guy at busstop`() = runBlockingTest {
create<PowerBeats3>("07 19 01 13 20 2B 88 8F 01 00 08 E2 0E 84 37 C5 98 16 D4 B7 37 ED 23 8B 08 EA A1") {
batteryHeadsetPercent shouldBe 0.8f
}
}
} }