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:
Marvin W 2020-12-10 16:55:19 +01:00
parent 128ca58bfe
commit a3d6f1aed5
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
2 changed files with 4 additions and 4 deletions

View File

@ -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) {

View File

@ -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)}")