mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
Compare commits
4
Commits
v2.3.1-rc0
...
v2.4.0-rc0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
454d76e305 | ||
|
|
51fb4c7a29 | ||
|
|
0b27cb55dc | ||
|
|
9e836eef69 |
@@ -104,11 +104,14 @@ interface PodDevice {
|
|||||||
@Json(name = "beats.powerbeats.pro") POWERBEATS_PRO(
|
@Json(name = "beats.powerbeats.pro") POWERBEATS_PRO(
|
||||||
"Power Beats Pro"
|
"Power Beats Pro"
|
||||||
),
|
),
|
||||||
@Json(name = "fakes.tws.i99999") TWS_I99999(
|
@Json(name = "fakes.tws.i99999") FAKE_AIRPODS_GEN1(
|
||||||
"TWS i99999"
|
"AirPods (Gen 1)? \uD83C\uDFAD"
|
||||||
),
|
),
|
||||||
@Json(name = "fakes.varunr.airpodspro") VARUNR_AIRPODS_PRO(
|
@Json(name = "fakes.varunr.airpodspro") FAKE_AIRPODS_PRO(
|
||||||
"Fake AirPods Pro"
|
"AirPods Pro? \uD83C\uDFAD"
|
||||||
|
),
|
||||||
|
@Json(name = "fakes.generic.airpods.gen3") FAKE_AIRPODS_GEN3(
|
||||||
|
"AirPods (Gen 3)? \uD83C\uDFAD"
|
||||||
),
|
),
|
||||||
@Json(name = "unknown") UNKNOWN(
|
@Json(name = "unknown") UNKNOWN(
|
||||||
"Unknown"
|
"Unknown"
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import dagger.hilt.components.SingletonComponent
|
|||||||
import dagger.multibindings.IntoSet
|
import dagger.multibindings.IntoSet
|
||||||
import eu.darken.capod.pods.core.apple.airpods.*
|
import eu.darken.capod.pods.core.apple.airpods.*
|
||||||
import eu.darken.capod.pods.core.apple.beats.*
|
import eu.darken.capod.pods.core.apple.beats.*
|
||||||
import eu.darken.capod.pods.core.apple.misc.Twsi99999
|
import eu.darken.capod.pods.core.apple.misc.FakeAirPodsGen1
|
||||||
import eu.darken.capod.pods.core.apple.misc.VarunrAirPodsPro
|
import eu.darken.capod.pods.core.apple.misc.FakeAirPodsGen3
|
||||||
|
import eu.darken.capod.pods.core.apple.misc.FakeAirPodsPro
|
||||||
|
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
@Module
|
@Module
|
||||||
@@ -29,7 +30,7 @@ abstract class AppleFactoryModule {
|
|||||||
@Binds @IntoSet abstract fun powerBeats3(factory: PowerBeats3.Factory): ApplePodsFactory<out ApplePods>
|
@Binds @IntoSet abstract fun powerBeats3(factory: PowerBeats3.Factory): ApplePodsFactory<out ApplePods>
|
||||||
@Binds @IntoSet abstract fun powerBeatsPro(factory: PowerBeatsPro.Factory): ApplePodsFactory<out ApplePods>
|
@Binds @IntoSet abstract fun powerBeatsPro(factory: PowerBeatsPro.Factory): ApplePodsFactory<out ApplePods>
|
||||||
|
|
||||||
@Binds @IntoSet abstract fun fakesTwsi999999(factory: Twsi99999.Factory): ApplePodsFactory<out ApplePods>
|
@Binds @IntoSet abstract fun fakeAirPodsGen1(factory: FakeAirPodsGen1.Factory): ApplePodsFactory<out ApplePods>
|
||||||
@Binds @IntoSet
|
@Binds @IntoSet abstract fun fakeAirPodsPro(factory: FakeAirPodsPro.Factory): ApplePodsFactory<out ApplePods>
|
||||||
abstract fun fakesVarunrAirPodsPro(factory: VarunrAirPodsPro.Factory): ApplePodsFactory<out ApplePods>
|
@Binds @IntoSet abstract fun fakeAirPodsGen3(factory: FakeAirPodsGen3.Factory): ApplePodsFactory<out ApplePods>
|
||||||
}
|
}
|
||||||
+6
-5
@@ -19,8 +19,9 @@ import javax.inject.Inject
|
|||||||
/**
|
/**
|
||||||
* Basically an AirPods GEN1 clone
|
* Basically an AirPods GEN1 clone
|
||||||
* Similar data structure but a lot of placeholder values or hardcoded values
|
* Similar data structure but a lot of placeholder values or hardcoded values
|
||||||
|
* Marketed as TWS i99999
|
||||||
*/
|
*/
|
||||||
data class Twsi99999 constructor(
|
data class FakeAirPodsGen1 constructor(
|
||||||
override val identifier: PodDevice.Id = PodDevice.Id(),
|
override val identifier: PodDevice.Id = PodDevice.Id(),
|
||||||
override val seenLastAt: Instant = Instant.now(),
|
override val seenLastAt: Instant = Instant.now(),
|
||||||
override val seenFirstAt: Instant = Instant.now(),
|
override val seenFirstAt: Instant = Instant.now(),
|
||||||
@@ -32,7 +33,7 @@ data class Twsi99999 constructor(
|
|||||||
private val cachedBatteryPercentage: Float? = null,
|
private val cachedBatteryPercentage: Float? = null,
|
||||||
) : ApplePods, DualPodDevice, HasDualMicrophone, HasCase {
|
) : ApplePods, DualPodDevice, HasDualMicrophone, HasCase {
|
||||||
|
|
||||||
override val model: PodDevice.Model = PodDevice.Model.TWS_I99999
|
override val model: PodDevice.Model = PodDevice.Model.FAKE_AIRPODS_GEN1
|
||||||
|
|
||||||
override val rssi: Int
|
override val rssi: Int
|
||||||
get() = rssiAverage ?: super<ApplePods>.rssi
|
get() = rssiAverage ?: super<ApplePods>.rssi
|
||||||
@@ -109,7 +110,7 @@ data class Twsi99999 constructor(
|
|||||||
override val isCaseCharging: Boolean
|
override val isCaseCharging: Boolean
|
||||||
get() = rawFlags.isBitSet(2)
|
get() = rawFlags.isBitSet(2)
|
||||||
|
|
||||||
class Factory @Inject constructor() : ApplePodsFactory<Twsi99999>(TAG) {
|
class Factory @Inject constructor() : ApplePodsFactory<FakeAirPodsGen1>(TAG) {
|
||||||
|
|
||||||
override fun isResponsible(message: ProximityPairing.Message): Boolean = message.run {
|
override fun isResponsible(message: ProximityPairing.Message): Boolean = message.run {
|
||||||
// Official message length is 19HEX, i.e. binary 25, did they copy this wrong?
|
// Official message length is 19HEX, i.e. binary 25, did they copy this wrong?
|
||||||
@@ -117,7 +118,7 @@ data class Twsi99999 constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun create(scanResult: BleScanResult, message: ProximityPairing.Message): ApplePods {
|
override fun create(scanResult: BleScanResult, message: ProximityPairing.Message): ApplePods {
|
||||||
var basic = Twsi99999(scanResult = scanResult, proximityMessage = message)
|
var basic = FakeAirPodsGen1(scanResult = scanResult, proximityMessage = message)
|
||||||
val result = searchHistory(basic)
|
val result = searchHistory(basic)
|
||||||
|
|
||||||
if (result != null) basic = basic.copy(identifier = result.id)
|
if (result != null) basic = basic.copy(identifier = result.id)
|
||||||
@@ -139,6 +140,6 @@ data class Twsi99999 constructor(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val DEVICE_CODE = 0x0220.toUShort()
|
private val DEVICE_CODE = 0x0220.toUShort()
|
||||||
private val TAG = logTag("PodDevice", "Apple", "TWS", "i99999")
|
private val TAG = logTag("PodDevice", "Apple", "Fake", "AirPods", "Gen1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
package eu.darken.capod.pods.core.apple.misc
|
||||||
|
|
||||||
|
import eu.darken.capod.common.bluetooth.BleScanResult
|
||||||
|
import eu.darken.capod.common.debug.logging.log
|
||||||
|
import eu.darken.capod.common.debug.logging.logTag
|
||||||
|
import eu.darken.capod.common.isBitSet
|
||||||
|
import eu.darken.capod.common.lowerNibble
|
||||||
|
import eu.darken.capod.common.upperNibble
|
||||||
|
import eu.darken.capod.pods.core.*
|
||||||
|
import eu.darken.capod.pods.core.apple.ApplePods
|
||||||
|
import eu.darken.capod.pods.core.apple.ApplePodsFactory
|
||||||
|
import eu.darken.capod.pods.core.apple.protocol.ProximityPairing
|
||||||
|
import java.time.Instant
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AirPods Gen3 clone
|
||||||
|
* Shorter data structure.
|
||||||
|
* https://discord.com/channels/548521543039189022/927235844127993866/1054404630118924308
|
||||||
|
*/
|
||||||
|
data class FakeAirPodsGen3 constructor(
|
||||||
|
override val identifier: PodDevice.Id = PodDevice.Id(),
|
||||||
|
override val seenLastAt: Instant = Instant.now(),
|
||||||
|
override val seenFirstAt: Instant = Instant.now(),
|
||||||
|
override val seenCounter: Int = 1,
|
||||||
|
override val scanResult: BleScanResult,
|
||||||
|
override val proximityMessage: ProximityPairing.Message,
|
||||||
|
override val confidence: Float = PodDevice.BASE_CONFIDENCE,
|
||||||
|
private val rssiAverage: Int? = null,
|
||||||
|
private val cachedBatteryPercentage: Float? = null,
|
||||||
|
) : ApplePods, DualPodDevice, HasDualMicrophone, HasCase, HasChargeDetectionDual {
|
||||||
|
|
||||||
|
override val model: PodDevice.Model = PodDevice.Model.FAKE_AIRPODS_GEN3
|
||||||
|
|
||||||
|
override val rssi: Int
|
||||||
|
get() = rssiAverage ?: super<ApplePods>.rssi
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normally values for the left pod are in the lower nibbles, if the left pod is primary (microphone)
|
||||||
|
* If the right pod is the primary, the values are flipped.
|
||||||
|
*/
|
||||||
|
val areValuesFlipped: Boolean
|
||||||
|
get() = !rawStatus.isBitSet(5)
|
||||||
|
|
||||||
|
override val batteryLeftPodPercent: Float?
|
||||||
|
get() {
|
||||||
|
val value = when (areValuesFlipped) {
|
||||||
|
true -> rawPodsBattery.upperNibble.toInt()
|
||||||
|
false -> rawPodsBattery.lowerNibble.toInt()
|
||||||
|
}
|
||||||
|
return when (value) {
|
||||||
|
15 -> null
|
||||||
|
else -> if (value > 10) {
|
||||||
|
log { "Left pod: Above 100% battery: $value" }
|
||||||
|
1.0f
|
||||||
|
} else {
|
||||||
|
(value / 10f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override val batteryRightPodPercent: Float?
|
||||||
|
get() {
|
||||||
|
val value = when (areValuesFlipped) {
|
||||||
|
true -> rawPodsBattery.lowerNibble.toInt()
|
||||||
|
false -> rawPodsBattery.upperNibble.toInt()
|
||||||
|
}
|
||||||
|
return when (value) {
|
||||||
|
15 -> null
|
||||||
|
else -> if (value > 10) {
|
||||||
|
log { "Right pod: Above 100% battery: $value" }
|
||||||
|
1.0f
|
||||||
|
} else {
|
||||||
|
value / 10f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override val isLeftPodCharging: Boolean
|
||||||
|
get() = when (areValuesFlipped) {
|
||||||
|
false -> rawFlags.isBitSet(0)
|
||||||
|
true -> rawFlags.isBitSet(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
override val isRightPodCharging: Boolean
|
||||||
|
get() = when (areValuesFlipped) {
|
||||||
|
false -> rawFlags.isBitSet(1)
|
||||||
|
true -> rawFlags.isBitSet(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
val isThisPodInThecase: Boolean
|
||||||
|
get() = rawStatus.isBitSet(6)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The data flip bit is set if the left pod is primary.
|
||||||
|
* For the pod that is in the case, this is flipped again though.
|
||||||
|
*/
|
||||||
|
override val isLeftPodMicrophone: Boolean
|
||||||
|
get() = rawStatus.isBitSet(5) xor isThisPodInThecase
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The data flip bit is UNset if the right pod is primary.
|
||||||
|
* For the pod that is in the case, this is flipped again though.
|
||||||
|
*/
|
||||||
|
override val isRightPodMicrophone: Boolean
|
||||||
|
get() = !rawStatus.isBitSet(5) xor isThisPodInThecase
|
||||||
|
|
||||||
|
override val batteryCasePercent: Float?
|
||||||
|
get() = when (val value = rawCaseBattery.toInt()) {
|
||||||
|
15 -> cachedBatteryPercentage
|
||||||
|
else -> if (value > 10) {
|
||||||
|
log { "Case: Above 100% battery: $value" }
|
||||||
|
1.0f
|
||||||
|
} else {
|
||||||
|
value / 10f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override val isCaseCharging: Boolean
|
||||||
|
get() = rawFlags.isBitSet(2)
|
||||||
|
|
||||||
|
class Factory @Inject constructor() : ApplePodsFactory<FakeAirPodsGen3>(TAG) {
|
||||||
|
|
||||||
|
override fun isResponsible(message: ProximityPairing.Message): Boolean = message.run {
|
||||||
|
// Official message length is 19HEX, i.e. binary 25, did they copy this wrong?
|
||||||
|
getModelInfo().full == DEVICE_CODE && length == 19
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun create(scanResult: BleScanResult, message: ProximityPairing.Message): ApplePods {
|
||||||
|
var basic = FakeAirPodsGen3(scanResult = scanResult, proximityMessage = message)
|
||||||
|
val result = searchHistory(basic)
|
||||||
|
|
||||||
|
if (result != null) basic = basic.copy(identifier = result.id)
|
||||||
|
updateHistory(basic)
|
||||||
|
|
||||||
|
if (result == null) return basic
|
||||||
|
|
||||||
|
return basic.copy(
|
||||||
|
identifier = result.id,
|
||||||
|
seenFirstAt = result.seenFirstAt,
|
||||||
|
seenLastAt = scanResult.receivedAt,
|
||||||
|
seenCounter = result.seenCounter,
|
||||||
|
confidence = result.confidence,
|
||||||
|
cachedBatteryPercentage = result.getLatestCaseBattery(),
|
||||||
|
rssiAverage = result.averageRssi(basic.rssi),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val DEVICE_CODE = 0x1320.toUShort()
|
||||||
|
private val TAG = logTag("PodDevice", "Apple", "Fake", "AirPods", "Gen3")
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-5
@@ -19,8 +19,9 @@ import javax.inject.Inject
|
|||||||
/**
|
/**
|
||||||
* AirPods Pro clone similar to Twsi999999.
|
* AirPods Pro clone similar to Twsi999999.
|
||||||
* Shorter data structure.
|
* Shorter data structure.
|
||||||
|
* https://discord.com/channels/548521543039189022/927235844127993866/962068944196358234
|
||||||
*/
|
*/
|
||||||
data class VarunrAirPodsPro constructor(
|
data class FakeAirPodsPro constructor(
|
||||||
override val identifier: PodDevice.Id = PodDevice.Id(),
|
override val identifier: PodDevice.Id = PodDevice.Id(),
|
||||||
override val seenLastAt: Instant = Instant.now(),
|
override val seenLastAt: Instant = Instant.now(),
|
||||||
override val seenFirstAt: Instant = Instant.now(),
|
override val seenFirstAt: Instant = Instant.now(),
|
||||||
@@ -32,7 +33,7 @@ data class VarunrAirPodsPro constructor(
|
|||||||
private val cachedBatteryPercentage: Float? = null,
|
private val cachedBatteryPercentage: Float? = null,
|
||||||
) : ApplePods, DualPodDevice, HasDualMicrophone, HasCase {
|
) : ApplePods, DualPodDevice, HasDualMicrophone, HasCase {
|
||||||
|
|
||||||
override val model: PodDevice.Model = PodDevice.Model.VARUNR_AIRPODS_PRO
|
override val model: PodDevice.Model = PodDevice.Model.FAKE_AIRPODS_PRO
|
||||||
|
|
||||||
override val rssi: Int
|
override val rssi: Int
|
||||||
get() = rssiAverage ?: super<ApplePods>.rssi
|
get() = rssiAverage ?: super<ApplePods>.rssi
|
||||||
@@ -109,7 +110,7 @@ data class VarunrAirPodsPro constructor(
|
|||||||
override val isCaseCharging: Boolean
|
override val isCaseCharging: Boolean
|
||||||
get() = rawFlags.isBitSet(2)
|
get() = rawFlags.isBitSet(2)
|
||||||
|
|
||||||
class Factory @Inject constructor() : ApplePodsFactory<VarunrAirPodsPro>(TAG) {
|
class Factory @Inject constructor() : ApplePodsFactory<FakeAirPodsPro>(TAG) {
|
||||||
|
|
||||||
override fun isResponsible(message: ProximityPairing.Message): Boolean = message.run {
|
override fun isResponsible(message: ProximityPairing.Message): Boolean = message.run {
|
||||||
// Official message length is 19HEX, i.e. binary 25, did they copy this wrong?
|
// Official message length is 19HEX, i.e. binary 25, did they copy this wrong?
|
||||||
@@ -117,7 +118,7 @@ data class VarunrAirPodsPro constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun create(scanResult: BleScanResult, message: ProximityPairing.Message): ApplePods {
|
override fun create(scanResult: BleScanResult, message: ProximityPairing.Message): ApplePods {
|
||||||
var basic = VarunrAirPodsPro(scanResult = scanResult, proximityMessage = message)
|
var basic = FakeAirPodsPro(scanResult = scanResult, proximityMessage = message)
|
||||||
val result = searchHistory(basic)
|
val result = searchHistory(basic)
|
||||||
|
|
||||||
if (result != null) basic = basic.copy(identifier = result.id)
|
if (result != null) basic = basic.copy(identifier = result.id)
|
||||||
@@ -139,6 +140,6 @@ data class VarunrAirPodsPro constructor(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val DEVICE_CODE = 0x0E20.toUShort()
|
private val DEVICE_CODE = 0x0E20.toUShort()
|
||||||
private val TAG = logTag("PodDevice", "Apple", "Varunr", "AirPodsPro")
|
private val TAG = logTag("PodDevice", "Apple", "Fake", "AirPods", "Pro")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.airpods
|
package eu.darken.capod.pods.core.apple.airpods
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import eu.darken.capod.pods.core.apple.DualAirPods
|
import eu.darken.capod.pods.core.apple.DualAirPods
|
||||||
import eu.darken.capod.pods.core.apple.HasAppleColor
|
import eu.darken.capod.pods.core.apple.HasAppleColor
|
||||||
@@ -39,6 +40,8 @@ class AirPodsGen1Test : BaseAirPodsTest() {
|
|||||||
state shouldBe DualAirPods.ConnectionState.DISCONNECTED
|
state shouldBe DualAirPods.ConnectionState.DISCONNECTED
|
||||||
|
|
||||||
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.AIRPODS_GEN1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.airpods
|
package eu.darken.capod.pods.core.apple.airpods
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import eu.darken.capod.pods.core.apple.DualAirPods
|
import eu.darken.capod.pods.core.apple.DualAirPods
|
||||||
import eu.darken.capod.pods.core.apple.HasAppleColor
|
import eu.darken.capod.pods.core.apple.HasAppleColor
|
||||||
@@ -38,6 +39,8 @@ class AirPodsGen2Test : BaseAirPodsTest() {
|
|||||||
state shouldBe DualAirPods.ConnectionState.MUSIC
|
state shouldBe DualAirPods.ConnectionState.MUSIC
|
||||||
|
|
||||||
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.AIRPODS_GEN2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.airpods
|
package eu.darken.capod.pods.core.apple.airpods
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import eu.darken.capod.pods.core.apple.DualAirPods
|
import eu.darken.capod.pods.core.apple.DualAirPods
|
||||||
import eu.darken.capod.pods.core.apple.HasAppleColor
|
import eu.darken.capod.pods.core.apple.HasAppleColor
|
||||||
@@ -38,6 +39,8 @@ class AirPodsGen3Test : BaseAirPodsTest() {
|
|||||||
state shouldBe DualAirPods.ConnectionState.IDLE
|
state shouldBe DualAirPods.ConnectionState.IDLE
|
||||||
|
|
||||||
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.AIRPODS_GEN3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.airpods
|
package eu.darken.capod.pods.core.apple.airpods
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
@@ -26,6 +27,8 @@ class AirPodsMaxTest : BaseAirPodsTest() {
|
|||||||
isHeadsetBeingCharged shouldBe false
|
isHeadsetBeingCharged shouldBe false
|
||||||
|
|
||||||
isHeadphonesBeingWorn shouldBe true
|
isHeadphonesBeingWorn shouldBe true
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.AIRPODS_MAX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.airpods
|
package eu.darken.capod.pods.core.apple.airpods
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import eu.darken.capod.pods.core.apple.HasAppleColor
|
import eu.darken.capod.pods.core.apple.HasAppleColor
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
@@ -40,6 +41,8 @@ class AirPodsPro2Test : BaseAirPodsTest() {
|
|||||||
batteryCasePercent shouldBe 0.9f
|
batteryCasePercent shouldBe 0.9f
|
||||||
|
|
||||||
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.AIRPODS_PRO2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.airpods
|
package eu.darken.capod.pods.core.apple.airpods
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import eu.darken.capod.pods.core.apple.HasAppleColor
|
import eu.darken.capod.pods.core.apple.HasAppleColor
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
@@ -34,6 +35,8 @@ class AirPodsProTest : BaseAirPodsTest() {
|
|||||||
batteryCasePercent shouldBe 0.5f
|
batteryCasePercent shouldBe 0.5f
|
||||||
|
|
||||||
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.AIRPODS_PRO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.beats
|
package eu.darken.capod.pods.core.apple.beats
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
@@ -22,6 +23,8 @@ class BeatsFlexText : BaseAirPodsTest() {
|
|||||||
rawSuffix shouldBe 0x00.toUByte()
|
rawSuffix shouldBe 0x00.toUByte()
|
||||||
|
|
||||||
batteryHeadsetPercent shouldBe 0.4f
|
batteryHeadsetPercent shouldBe 0.4f
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.BEATS_FLEX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.beats
|
package eu.darken.capod.pods.core.apple.beats
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
@@ -22,6 +23,8 @@ class BeatsSolo3Test : BaseAirPodsTest() {
|
|||||||
rawSuffix shouldBe 0x40.toUByte()
|
rawSuffix shouldBe 0x40.toUByte()
|
||||||
|
|
||||||
batteryHeadsetPercent shouldBe 0.4f
|
batteryHeadsetPercent shouldBe 0.4f
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.BEATS_SOLO_3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.beats
|
package eu.darken.capod.pods.core.apple.beats
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
@@ -22,6 +23,8 @@ class BeatsStudio3Test : BaseAirPodsTest() {
|
|||||||
rawSuffix shouldBe 0x40.toUByte()
|
rawSuffix shouldBe 0x40.toUByte()
|
||||||
|
|
||||||
batteryHeadsetPercent shouldBe 0.4f
|
batteryHeadsetPercent shouldBe 0.4f
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.BEATS_STUDIO_3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.beats
|
package eu.darken.capod.pods.core.apple.beats
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
@@ -22,6 +23,8 @@ class BeatsXTest : BaseAirPodsTest() {
|
|||||||
rawSuffix shouldBe 0x00.toUByte()
|
rawSuffix shouldBe 0x00.toUByte()
|
||||||
|
|
||||||
batteryHeadsetPercent shouldBe 0.5f
|
batteryHeadsetPercent shouldBe 0.5f
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.BEATS_X
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.beats
|
package eu.darken.capod.pods.core.apple.beats
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
@@ -22,6 +23,8 @@ class PowerBeats3Test : BaseAirPodsTest() {
|
|||||||
rawSuffix shouldBe 0x40.toUByte()
|
rawSuffix shouldBe 0x40.toUByte()
|
||||||
|
|
||||||
batteryHeadsetPercent shouldBe 0.4f
|
batteryHeadsetPercent shouldBe 0.4f
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.POWERBEATS_3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.darken.capod.pods.core.apple.beats
|
package eu.darken.capod.pods.core.apple.beats
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import eu.darken.capod.pods.core.apple.HasAppleColor
|
import eu.darken.capod.pods.core.apple.HasAppleColor
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
@@ -34,6 +35,8 @@ class PowerBeatsProTest : BaseAirPodsTest() {
|
|||||||
batteryCasePercent shouldBe 0.5f
|
batteryCasePercent shouldBe 0.5f
|
||||||
|
|
||||||
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
podStyle.identifier shouldBe HasAppleColor.DeviceColor.WHITE.name
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.POWERBEATS_PRO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-2
@@ -1,15 +1,16 @@
|
|||||||
package eu.darken.capod.pods.core.apple.misc
|
package eu.darken.capod.pods.core.apple.misc
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class Twsi99999Test : BaseAirPodsTest() {
|
class FakeAirPodsGen1Test : BaseAirPodsTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `charging in box`() = runTest {
|
fun `charging in box`() = runTest {
|
||||||
create<Twsi99999>("07 13 01 02 20 71 AA 37 32 00 10 00 64 64 FF 00 00 00 00 00 00") {
|
create<FakeAirPodsGen1>("07 13 01 02 20 71 AA 37 32 00 10 00 64 64 FF 00 00 00 00 00 00") {
|
||||||
rawPrefix shouldBe 0x01.toUByte()
|
rawPrefix shouldBe 0x01.toUByte()
|
||||||
rawDeviceModel shouldBe 0x0220.toUShort()
|
rawDeviceModel shouldBe 0x0220.toUShort()
|
||||||
rawStatus shouldBe 0x71.toUByte()
|
rawStatus shouldBe 0x71.toUByte()
|
||||||
@@ -26,6 +27,8 @@ class Twsi99999Test : BaseAirPodsTest() {
|
|||||||
isCaseCharging shouldBe false
|
isCaseCharging shouldBe false
|
||||||
|
|
||||||
batteryCasePercent shouldBe 0.7f
|
batteryCasePercent shouldBe 0.7f
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.FAKE_AIRPODS_GEN1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package eu.darken.capod.pods.core.apple.misc
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
|
import io.kotest.matchers.shouldBe
|
||||||
|
import kotlinx.coroutines.test.runTest
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
class FakeAirPodsGen3Test : BaseAirPodsTest() {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `charging in case`() = runTest {
|
||||||
|
create<FakeAirPodsGen3>("07 13 01 13 20 75 AA 37 34 00 10 00 E4 E4 64 00 00 00 00 00 00") {
|
||||||
|
rawPrefix shouldBe 0x01.toUByte()
|
||||||
|
rawDeviceModel shouldBe 0x1320.toUShort()
|
||||||
|
rawStatus shouldBe 0x75.toUByte()
|
||||||
|
rawPodsBattery shouldBe 0xAA.toUByte()
|
||||||
|
rawFlags shouldBe 0x3.toUShort()
|
||||||
|
rawCaseBattery shouldBe 0x7.toUShort()
|
||||||
|
rawCaseLidState shouldBe 0x34.toUByte()
|
||||||
|
rawDeviceColor shouldBe 0x00.toUByte()
|
||||||
|
rawSuffix shouldBe 0x10.toUByte()
|
||||||
|
|
||||||
|
batteryLeftPodPercent shouldBe 1f
|
||||||
|
batteryRightPodPercent shouldBe 1f
|
||||||
|
|
||||||
|
isCaseCharging shouldBe false
|
||||||
|
isLeftPodCharging shouldBe true
|
||||||
|
isRightPodCharging shouldBe true
|
||||||
|
|
||||||
|
batteryCasePercent shouldBe 0.7f
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.FAKE_AIRPODS_GEN3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-2
@@ -1,15 +1,16 @@
|
|||||||
package eu.darken.capod.pods.core.apple.misc
|
package eu.darken.capod.pods.core.apple.misc
|
||||||
|
|
||||||
|
import eu.darken.capod.pods.core.PodDevice
|
||||||
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
import eu.darken.capod.pods.core.apple.BaseAirPodsTest
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class VarunrAirPodsProTest : BaseAirPodsTest() {
|
class FakeAirPodsProTest : BaseAirPodsTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `guessed data`() = runTest {
|
fun `guessed data`() = runTest {
|
||||||
create<VarunrAirPodsPro>("07 13 01 0E 20 71 AA 37 36 00 10 00 FF 64 FF 00 00 00 00 00 00") {
|
create<FakeAirPodsPro>("07 13 01 0E 20 71 AA 37 36 00 10 00 FF 64 FF 00 00 00 00 00 00") {
|
||||||
rawPrefix shouldBe 0x01.toUByte()
|
rawPrefix shouldBe 0x01.toUByte()
|
||||||
rawDeviceModel shouldBe 0x0E20.toUShort()
|
rawDeviceModel shouldBe 0x0E20.toUShort()
|
||||||
rawStatus shouldBe 0x71.toUByte()
|
rawStatus shouldBe 0x71.toUByte()
|
||||||
@@ -26,6 +27,8 @@ class VarunrAirPodsProTest : BaseAirPodsTest() {
|
|||||||
isCaseCharging shouldBe false
|
isCaseCharging shouldBe false
|
||||||
|
|
||||||
batteryCasePercent shouldBe 0.7f
|
batteryCasePercent shouldBe 0.7f
|
||||||
|
|
||||||
|
model shouldBe PodDevice.Model.FAKE_AIRPODS_PRO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
<string name="general_close_action">Chiudi</string>
|
<string name="general_close_action">Chiudi</string>
|
||||||
<string name="upgrade_capod_label">Aggiorna CAPod</string>
|
<string name="upgrade_capod_label">Aggiorna CAPod</string>
|
||||||
<string name="upgrade_capod_description">Ottieni funzionalità aggiuntive e supporta lo sviluppatore.</string>
|
<string name="upgrade_capod_description">Ottieni funzionalità aggiuntive e supporta lo sviluppatore.</string>
|
||||||
|
<string name="settings_monitor_mode_label">Modalità monitor</string>
|
||||||
<string name="settings_monitor_mode_description">Sotto quali circostanze questa applicazione monitora i dati Bluetooth.</string>
|
<string name="settings_monitor_mode_description">Sotto quali circostanze questa applicazione monitora i dati Bluetooth.</string>
|
||||||
<string name="settings_scanner_mode_label">Modalità di scansione</string>
|
<string name="settings_scanner_mode_label">Modalità di scansione</string>
|
||||||
<string name="settings_scanner_mode_description">Il bluetooth a basso consumo energetico dovrebbe dare priorità alle performance o al risparmio della batteria?</string>
|
<string name="settings_scanner_mode_description">Il bluetooth a basso consumo energetico dovrebbe dare priorità alle performance o al risparmio della batteria?</string>
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
<string name="settings_support_installid_desc">Le segnalazioni automatiche degli errori sono anonime. Condividi il tuo ID di installazione con lo sviluppatore se necessità di trovare la tua segnalazione all\'interno del registro segnalazioni.</string>
|
<string name="settings_support_installid_desc">Le segnalazioni automatiche degli errori sono anonime. Condividi il tuo ID di installazione con lo sviluppatore se necessità di trovare la tua segnalazione all\'interno del registro segnalazioni.</string>
|
||||||
<string name="settings_support_label">Supporto</string>
|
<string name="settings_support_label">Supporto</string>
|
||||||
<string name="settings_support_description">Se ti serve un aiuto.</string>
|
<string name="settings_support_description">Se ti serve un aiuto.</string>
|
||||||
|
<string name="issue_tracker_label">Tracker problemi</string>
|
||||||
<string name="issue_tracker_description">Un issue tracker pubblico per segnalare i problemi e le richieste per aggiungere nuove funzionalità (solo in inglese).</string>
|
<string name="issue_tracker_description">Un issue tracker pubblico per segnalare i problemi e le richieste per aggiungere nuove funzionalità (solo in inglese).</string>
|
||||||
<string name="discord_label">Discord</string>
|
<string name="discord_label">Discord</string>
|
||||||
<string name="discord_description">Un posto dove poter fare domande.</string>
|
<string name="discord_description">Un posto dove poter fare domande.</string>
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
### Updated by release.sh ###
|
### Updated by release.sh ###
|
||||||
project.versioning.major=2
|
project.versioning.major=2
|
||||||
project.versioning.minor=3
|
project.versioning.minor=4
|
||||||
project.versioning.patch=1
|
project.versioning.patch=0
|
||||||
project.versioning.build=0
|
project.versioning.build=0
|
||||||
#############################
|
#############################
|
||||||
|
|||||||
Reference in New Issue
Block a user