【发布时间】:2021-09-04 22:24:59
【问题描述】:
当从带有 TLM 信标的 Eddystone UID 获取测距更新时,即使应该每秒调用一次 didRangeBeaconsInRegion(),更新也不定期。我偶尔会在日志上看到更新,有时甚至 8-10 秒没有更新,然后偶尔会再次出现。
以下日志的一部分显示了从检测到信标的那一刻起 D/RangingActivity 的零星性质;
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: Stop Scan
D/BluetoothLeScanner: Start Scan
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
STATE_ON
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
I/ScanHelper: Non-distinct packets detected in a single scan. Restarting scans unecessary.
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 16.9709421436514 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 37.302382194318774 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 31.25429550588763 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 28.936042431918796 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 26.86915572611937 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 18.93489852744025 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 398 seconds, has a battery level of 3320 mV, and has transmitted 77 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 18.93489852744025 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 419 seconds, has a battery level of 3320 mV, and has transmitted 81 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 35.47854961599127 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 449 seconds, has a battery level of 3320 mV, and has transmitted 87 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
我的代码与以下文档中描述的相同:
https://developer.radiusnetworks.com/2015/07/14/building-apps-with-eddystone#
https://altbeacon.github.io/android-beacon-library/eddystone-how-to.html
我尝试了不同的信标广告周期,但问题仍然存在。 有什么方法可以定期(即每秒)获取测距更新?
提前谢谢...
【问题讨论】: