try to add cross device stuff

This commit is contained in:
Kavish Devar
2025-01-21 21:29:16 +05:30
parent 3a3074f592
commit 938278b0b5
4 changed files with 31 additions and 1 deletions

View File

@@ -240,6 +240,31 @@ For left bud
00 0080 3F 00 0080 3F
<same for the right bud> <same for the right bud>
``` ```
<!-- demo packet
52 18 00 00 00 00 00 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 00 00 80 3f 00 00 80 3f 00 00 80 3f 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 62 10 DA 41 00 00 80 3f 00 00 80 3f 00 00 80 3f
-->
<!--
5218 0000 0080 3F62 10DA 413D 0AF0 4160
E50C 42AC 9C1E 421B 2F29 429E 6F33 4293
1846 4293 1846 4206 9476 BF00 576E BB00
0080 3F00 0080 3F62 10DA 413D 0AF0 4160
E50C 42AC 9C1E 421B 2F29 429E 6F33 4293
1846 4293 1846 4200 0080 BF00 576E BB00
0080 3F00 0080 3F
-->
<!--
5218 0000 0000 0062 10DA 413D 0AF0 4160
E50C 42AC 9C1E 421B 2F29 429E 6F33 4293
1846 4293 1846 4206 9476 BF00 576E BB00
0080 3F00 0080 3F62 10DA 413D 0AF0 4160
E50C 42AC 9C1E 421B 2F29 429E 6F33 4293
1846 4293 1846 4200 0080 BF00 576E BB00
0080 3F00 0080 3F
-->
All values are formatted as Little Endian from float values. All values are formatted as Little Endian from float values.
| Data | Type | Value range | | Data | Type | Value range |
|---------------------|---------------|-------------| |---------------------|---------------|-------------|

View File

@@ -45,7 +45,7 @@ object CrossDevice {
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
fun startServer() { fun startServer() {
serverSocket = bluetoothAdapter.listenUsingRfcommWithServiceRecord("AirPodsSwitch", uuid) serverSocket = bluetoothAdapter.listenUsingRfcommWithServiceRecord("ALNCrossDevice", uuid)
Log.d("AirPodsQuickSwitchService", "Server started") Log.d("AirPodsQuickSwitchService", "Server started")
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
while (serverSocket != null) { while (serverSocket != null) {

BIN
libbluetooth_jni_juan.so Normal file

Binary file not shown.

View File

@@ -322,6 +322,11 @@ public slots:
socket->close(); socket->close();
socket = nullptr; socket = nullptr;
} }
if (phoneSocket && phoneSocket->isOpen()) {
QByteArray airpodsDisconnectedPacket = QByteArray::fromHex("00010000");
phoneSocket->write(airpodsDisconnectedPacket);
LOG_DEBUG("AIRPODS_DISCONNECTED packet written: " << airpodsDisconnectedPacket.toHex());
}
} }
void connectToDevice(const QBluetoothDeviceInfo &device) { void connectToDevice(const QBluetoothDeviceInfo &device) {