Skip to content

add support airpods max 2 & fix airpods max - #238

Merged
d4rken merged 1 commit into
d4rken-org:mainfrom
b4shtirk1n:main
Nov 8, 2024
Merged

d4rken merged 1 commit into
d4rken-org:mainfrom
b4shtirk1n:main

Conversation

@b4shtirk1n

Copy link
Copy Markdown
Contributor

No description provided.

@d4rken

d4rken commented Nov 7, 2024

Copy link
Copy Markdown
Member

Thanks, do you have some test data so we can add some tests?

@b4shtirk1n

Copy link
Copy Markdown
Contributor Author

Thanks, do you have some test data so we can add some tests?

AirPods Max 2
Address: 08:FF:44:43:DE:70
Vendor ID: 0x004C
Product ID: 0x201F
Firmware Version: 7A291
Minor Type: Headphones
RSSI: -29
Serial Number: MV5DF9H7JK
Services: 0x980019 < HFP AVRCP A2DP AACP GATT ACL >

AirPods Max
Address: 90:9C:4A:ED:53:03
Vendor ID: 0x004C
Product ID: 0x200A
Firmware Version: 6A326
Minor Type: Headphones
Serial Number: H0YGW17FP3WF

@d4rken

d4rken commented Nov 7, 2024

Copy link
Copy Markdown
Member

I mean a BLE broadcast where we know the headphones state, so we can create something like this:

@Test
fun `default AirPods Max`() = runTest {
create<AirPodsMax>("07 19 01 0A 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()
rawDeviceModel shouldBe 0x0A20.toUShort()
rawStatus shouldBe 0x62.toUByte()
rawPodsBattery shouldBe 0x04.toUByte()
rawFlags shouldBe 0x8.toUShort()
rawCaseBattery shouldBe 0x0.toUShort()
rawCaseLidState shouldBe 0x01.toUByte()
rawDeviceColor shouldBe 0x0F.toUByte()
rawSuffix shouldBe 0x40.toUByte()
batteryHeadsetPercent shouldBe 0.4f
isHeadsetBeingCharged shouldBe false
model shouldBe PodDevice.Model.AIRPODS_MAX
}
}

@b4shtirk1n

Copy link
Copy Markdown
Contributor Author

I mean a BLE broadcast where we know the headphones state, so we can create something like this:

@Test
fun `default AirPods Max`() = runTest {
create<AirPodsMax>("07 19 01 0A 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()
rawDeviceModel shouldBe 0x0A20.toUShort()
rawStatus shouldBe 0x62.toUByte()
rawPodsBattery shouldBe 0x04.toUByte()
rawFlags shouldBe 0x8.toUShort()
rawCaseBattery shouldBe 0x0.toUShort()
rawCaseLidState shouldBe 0x01.toUByte()
rawDeviceColor shouldBe 0x0F.toUByte()
rawSuffix shouldBe 0x40.toUByte()
batteryHeadsetPercent shouldBe 0.4f
isHeadsetBeingCharged shouldBe false
model shouldBe PodDevice.Model.AIRPODS_MAX
}
}

sorry, how ?)

@d4rken

d4rken commented Nov 7, 2024

Copy link
Copy Markdown
Member

Does it show the device with some hex numbers in the list as unknown device? The hex numbers are the ble broadcast that we need to decode. Just put those in a new test case and check that the values make sense.

@b4shtirk1n

Copy link
Copy Markdown
Contributor Author

Does it show the device with some hex numbers in the list as unknown device?

the device was detected

@d4rken d4rken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@d4rken
d4rken merged commit 663e2d3 into d4rken-org:main Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants