Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support airpods max 2 & fix airpods max #238

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

b4shtirk1n
Copy link
Contributor

No description provided.

@d4rken
Copy link
Member

d4rken commented Nov 7, 2024

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

@b4shtirk1n
Copy link
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
Copy link
Member

d4rken commented Nov 7, 2024

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
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
Copy link
Member

d4rken commented Nov 7, 2024

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
Contributor Author

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

the device was detected

Copy link
Member

@d4rken d4rken left a comment

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
7 checks passed
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