【问题标题】:Getting ranging updates with Android Beacon Library not regularly from an Eddystone beacon不定期从 Eddystone 信标获取 Android 信标库的测距更新
【发布时间】: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

我尝试了不同的信标广告周期,但问题仍然存在。 有什么方法可以定期(即每秒)获取测距更新?

提前谢谢...

【问题讨论】:

    标签: android beacon eddystone


    【解决方案1】:

    我怀疑问题出在 Eddystone-TLM 框架本身。遥测帧是交错帧,其发送频率不如 UID 或主要 Eddystone 信标类型。遥测仅在新的 TLM 帧出现时更新,如您所描述的,这可能很少见。库的扫描间隔无法控制这一点——这只是 TLM 的工作方式,并且是硬件交错率的函数。

    不管上述情况如何,库始终会定期发送 didRangeBeacons 回调,但如果未检测到任何信标,则检测到的信标列表可能为空。您的 Eddystone-UID 检测率应该更加规律。尝试在您的 didRangeBeacons 回调中添加更多日志记录,包括时间戳和信标计数,以查看发生了什么。

    您可以尝试使用我修改过的 Android Beacon 库进行测试以确认,并在必要时查找您的代码中的任何差异。

    添加 beaconManager.setDebug(true);可以获得内部调试日志。

    【讨论】:

    • 嗨,大卫,感谢您的回复。你在那个库中是对的,它正在定期发送 didRangeBeacons 回调。问题是检测到的信标列表大部分时间都是空的。使用其他 BLE 扫描仪应用程序,我可以看到我的 TLM 数据使用相同的信标定期更新。并且还在我的代码中实现了另一个 BLE 库,我已经实现了定期更新。这样信标就没有问题了。知道为什么 Android 信标库大部分时间都检测不到信标吗?
    • 你能用beaconManager.setDebug(true);发布一个30秒的日志捕获吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多