如何获取Kontakt ibeacons的电池电量 [英] How to get battery level of Kontakt ibeacons
问题描述
kontakt的ibeacon信标布局为
m:2-3 = 0215,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25
The ibeacon beaconlayout for kontakt is
m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25
我正在使用altbeacon 图书馆用于android进行检测,但无法获取信标的电池电量答案这里表示他们正在传输功率电平,但我无法获取.进一步评论
I am using altbeacon library for android for detecting it but i am unable get the battery level of the beacon an answer here says that they are transmitting the power level but i am unable to fetch it. Further the comment on this page (from line no 100 to 103) describes the byte structure hope this helps.
我如何从信标获取电池电量.
How can i get the battery level from the beacon.
推荐答案
如果您的信标布局表达式对该信标是正确的,则可以使用以下命令读取d25-25数据字段的电池值:
If your beaconlayout expression is correct for that beacon, then you can read the battery value for the d25-25 data field with:
long batteryLevel=beacon.getDataFields().get(0);
在此处查看有关读取数据字段的文档:
See documentation for reading data fields here:
但是,问题中的第一个链接提到该字段位于信标的扫描响应"中.如果该说法正确无误,则意味着电池电量根本不在广告中,因此,如果不单独轮询此信息,您将无法获得该电量.
However, the first link in your question mentions the field is in the "scan response" of the beacon. If that statement is true and not a misstatement, that means the battery level is not in the advertisement at all, so you will not be able to get it without separately polling for this info.
这篇关于如何获取Kontakt ibeacons的电池电量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!