mirror of
https://github.com/adolfintel/OpenPods.git
synced 2026-09-14 14:56:11 -04:00
Fixed some Airpods Pro 2 not being correctly detected
This commit is contained in:
@@ -27,18 +27,17 @@ import com.dosse.airpods.pods.models.RegularPods;
|
||||
* 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 model
|
||||
*
|
||||
* <p>
|
||||
* Notes:
|
||||
* 1) - isFlipped set by bit 1 of 10th character in the string; seems to be related to in-ear detection;
|
||||
*/
|
||||
public class PodsStatus {
|
||||
|
||||
public static final PodsStatus DISCONNECTED = new PodsStatus();
|
||||
|
||||
private IPods pods;
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
private IPods mPods;
|
||||
private final long mTimestamp = System.currentTimeMillis();
|
||||
|
||||
public PodsStatus () {
|
||||
private PodsStatus() {
|
||||
}
|
||||
|
||||
public PodsStatus(String status) {
|
||||
@@ -74,31 +73,31 @@ public class PodsStatus {
|
||||
|
||||
// Detect which model
|
||||
if ("0220".equals(idFull)) {
|
||||
pods = new AirPods1(leftPod, rightPod, casePod); // Airpods 1st gen
|
||||
mPods = new AirPods1(leftPod, rightPod, casePod); // Airpods 1st gen
|
||||
} else if ("0F20".equals(idFull)) {
|
||||
pods = new AirPods2(leftPod, rightPod, casePod); // Airpods 2nd gen
|
||||
mPods = new AirPods2(leftPod, rightPod, casePod); // Airpods 2nd gen
|
||||
} else if ("1320".equals(idFull)) {
|
||||
pods = new AirPods3(leftPod, rightPod, casePod); // Airpods 3rd gen
|
||||
mPods = new AirPods3(leftPod, rightPod, casePod); // Airpods 3rd gen
|
||||
} else if ("0E20".equals(idFull)) {
|
||||
pods = new AirPodsPro(leftPod, rightPod, casePod); // Airpods Pro
|
||||
} else if ("1420".equals(idFull)) {
|
||||
pods = new AirPodsPro2(leftPod, rightPod, casePod); // Airpods Pro 2
|
||||
mPods = new AirPodsPro(leftPod, rightPod, casePod); // Airpods Pro
|
||||
} else if ("1420".equals(idFull) || "2420".equals(idFull)) {
|
||||
mPods = new AirPodsPro2(leftPod, rightPod, casePod); // Airpods Pro 2
|
||||
} else if ('A' == idSingle) {
|
||||
pods = new AirPodsMax(singlePod); // Airpods Max
|
||||
mPods = new AirPodsMax(singlePod); // Airpods Max
|
||||
} else if ('B' == idSingle) {
|
||||
pods = new PowerbeatsPro(leftPod, rightPod, casePod); // Powerbeats Pro
|
||||
mPods = new PowerbeatsPro(leftPod, rightPod, casePod); // Powerbeats Pro
|
||||
} else if ("0520".equals(idFull)) {
|
||||
pods = new BeatsX(singlePod); // Beats X
|
||||
mPods = new BeatsX(singlePod); // Beats X
|
||||
} else if ("1020".equals(idFull)) {
|
||||
pods = new BeatsFlex(singlePod); // Beats Flex
|
||||
mPods = new BeatsFlex(singlePod); // Beats Flex
|
||||
} else if ("0620".equals(idFull)) {
|
||||
pods = new BeatsSolo3(singlePod); // Beats Solo 3
|
||||
mPods = new BeatsSolo3(singlePod); // Beats Solo 3
|
||||
} else if ('9' == idSingle) {
|
||||
pods = new BeatsStudio3(singlePod); // Beats Studio 3
|
||||
mPods = new BeatsStudio3(singlePod); // Beats Studio 3
|
||||
} else if ("0320".equals(idFull)) {
|
||||
pods = new Powerbeats3(singlePod); // Powerbeats 3
|
||||
mPods = new Powerbeats3(singlePod); // Powerbeats 3
|
||||
} else {
|
||||
pods = new RegularPods(leftPod, rightPod, casePod); // Unknown
|
||||
mPods = new RegularPods(leftPod, rightPod, casePod); // Unknown
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,18 +106,18 @@ public class PodsStatus {
|
||||
}
|
||||
|
||||
public IPods getAirpods() {
|
||||
return pods;
|
||||
return mPods;
|
||||
}
|
||||
|
||||
public boolean isAllDisconnected() {
|
||||
if (this == DISCONNECTED)
|
||||
if (this == DISCONNECTED) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return pods.isDisconnected();
|
||||
return mPods.isDisconnected();
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
return mTimestamp;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user