From 6a8236923eef7a41c5a178c6f7e85644e3cf69a8 Mon Sep 17 00:00:00 2001 From: Electric1447 Date: Fri, 27 Aug 2021 00:41:16 +0300 Subject: [PATCH] cleanup --- .../com/dosse/airpods/pods/PodsService.java | 34 +------------------ .../dosse/airpods/pods/data/SinglePods.java | 4 --- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/OpenPods/app/src/main/java/com/dosse/airpods/pods/PodsService.java b/OpenPods/app/src/main/java/com/dosse/airpods/pods/PodsService.java index e73577e..c4bc43a 100644 --- a/OpenPods/app/src/main/java/com/dosse/airpods/pods/PodsService.java +++ b/OpenPods/app/src/main/java/com/dosse/airpods/pods/PodsService.java @@ -43,38 +43,6 @@ import java.util.Objects; */ public class PodsService extends Service { - /** - * The following method (startAirPodsScanner) creates a bluetooth LE scanner. - * This scanner receives all beacons from nearby BLE devices (not just your devices!) so we need to do 3 things: - * - Check that the beacon comes from something that looks like a pair of AirPods - * - Make sure that it is YOUR pair of AirPods - * - Decode the beacon to get the status - *

- * On a normal OS, we would use the bluetooth address of the device to filter out beacons from other devices. - * UNFORTUNATELY, someone at google was so concerned about privacy (yea, as if they give a shit) that he decided it was a good idea to not allow access to the bluetooth address of incoming BLE beacons. - * As a result, we have no reliable way to make sure that the beacon comes from YOUR airpods and not the guy sitting next to you on the bus. - * What we did to workaround this issue is this: - * - When a beacon arrives that looks like a pair of AirPods, look at the other beacons received in the last 10 seconds and get the strongest one - * - If the strongest beacon's fake address is the same as this, use this beacon; otherwise use the strongest beacon - * - Filter for signals stronger than -60db - * - Decode... - *

- * Decoding the beacon: - * This was done through reverse engineering. Hopefully it's correct. - * - The beacon coming from a pair of AirPods contains a manufacturer specific data field n°76 of 27 bytes - * - We convert this data to a hexadecimal string - * - The 12th and 13th characters in the string represent the charge of the left and right pods. Under unknown circumstances[1], they are right and left instead (see isFlipped). Values between 0 and 10 are battery 0-100%; Value 15 means it's disconnected - * - The 15th character in the string represents the charge of the case. Values between 0 and 10 are battery 0-100%; Value 15 means it's disconnected - * - The 14th character in the string represents the "in charge" status. Bit 0 (LSB) is the left pod; Bit 1 is the right pod; Bit 2 is the case. Bit 3 might be case open/closed but I'm not sure and it's not used - * - The 11th character in the string represents the in-ear detection status. Bit 1 is the left pod; Bit 3 is the right pod. - * - The 7th character in the string represents the AirPods model (E=AirPods pro) - *

- * After decoding a beacon, the status is written to leftStatus, rightStatus, caseStatus, maxStatus, chargeL, chargeR, chargeCase, inEarL, inEarR so that the NotificationThread can use the information - *

- * Notes: - * 1) - isFlipped set by bit 1 of 10th character in the string; seems to be related to in-ear detection; - */ - private BluetoothLeScanner btScanner; private PodsStatus status = PodsStatus.DISCONNECTED; @@ -346,7 +314,7 @@ public class PodsService extends Service { return START_STICKY; } - // Foreground service background notification (confusing I know). + // Foreground service for background notification (confusing I know). // Only enabled for API30+ @RequiresApi(api = Build.VERSION_CODES.O) private Notification createBackgroundNotification () { diff --git a/OpenPods/app/src/main/java/com/dosse/airpods/pods/data/SinglePods.java b/OpenPods/app/src/main/java/com/dosse/airpods/pods/data/SinglePods.java index b479597..6d3d87c 100644 --- a/OpenPods/app/src/main/java/com/dosse/airpods/pods/data/SinglePods.java +++ b/OpenPods/app/src/main/java/com/dosse/airpods/pods/data/SinglePods.java @@ -20,10 +20,6 @@ public abstract class SinglePods implements IPods { return pod.parseStatus(); } - public int getInEarVisibility () { - return pod.inEarVisibility(); - } - public int getBatImgVisibility () { return pod.batImgVisibility(); }