How to get battery level of Kontakt ibeacons

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 20:55:58

问题


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

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.


回答1:


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:

http://altbeacon.github.io/android-beacon-library/javadoc/org/altbeacon/beacon/Beacon.html#getDataFields()

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.



来源:https://stackoverflow.com/questions/25885659/how-to-get-battery-level-of-kontakt-ibeacons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!