mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-09-12 17:26:53 +02:00
EN: Don't adjust tx power by TX_POWER_LOW (-15)
The exposure-notifications-internal suggests that this is the thing to do, but the actual implementaton doesn't.
This commit is contained in:
parent
128ca58bfe
commit
a3d6f1aed5
@ -117,13 +117,13 @@ class AdvertiserService : LifecycleService() {
|
||||
val aemBytes = when (version) {
|
||||
VERSION_1_0 -> byteArrayOf(
|
||||
version, // Version and flags
|
||||
(currentDeviceInfo.txPowerCorrection + TX_POWER_LOW).toByte(), // TX power
|
||||
currentDeviceInfo.txPowerCorrection, // TX power
|
||||
0x00, // Reserved
|
||||
0x00 // Reserved
|
||||
)
|
||||
VERSION_1_1 -> byteArrayOf(
|
||||
(version + currentDeviceInfo.confidence.toByte() * 4).toByte(), // Version and flags
|
||||
(currentDeviceInfo.txPowerCorrection + TX_POWER_LOW).toByte(), // TX power
|
||||
currentDeviceInfo.txPowerCorrection, // TX power
|
||||
0x00, // Reserved
|
||||
0x00 // Reserved
|
||||
)
|
||||
@ -175,7 +175,7 @@ class AdvertiserService : LifecycleService() {
|
||||
Since: ${Date(startTime)}
|
||||
RPI: $uuid
|
||||
Version: 0x${version.toString(16)}
|
||||
TX Power: ${currentDeviceInfo.txPowerCorrection + TX_POWER_LOW}
|
||||
TX Power: ${currentDeviceInfo.txPowerCorrection}
|
||||
AEM: 0x${aem.toLong().let { if (it < 0) 0x100000000L + it else it }.toString(16)}
|
||||
""".trimIndent())
|
||||
} catch (e: Exception) {
|
||||
|
@ -490,7 +490,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit
|
||||
}.mapNotNull {
|
||||
val decrypted = key.cryptAem(it.rpi, it.aem)
|
||||
val version = (decrypted[0] and 0xf0.toByte())
|
||||
val txPower = if (decrypted.size >= 4 && version >= VERSION_1_0) decrypted[1].toInt() else (averageDeviceInfo.txPowerCorrection + TX_POWER_LOW)
|
||||
val txPower = if (decrypted.size >= 4 && version >= VERSION_1_0) decrypted[1].toInt() else averageDeviceInfo.txPowerCorrection.toInt()
|
||||
val confidence = if (decrypted.size >= 4 && version >= VERSION_1_1) ((decrypted[0] and 0xc) / 4) else (averageDeviceInfo.confidence)
|
||||
if (version > VERSION_1_1) {
|
||||
Log.w(TAG, "Unknown AEM version: 0x${version.toString(16)}")
|
||||
|
Loading…
Reference in New Issue
Block a user