Bluetooth RSSI values are always in dBm in all Android devices?

陌路散爱 提交于 2019-12-04 03:41:40

问题


I'm new to Android and my app uses Bluetooth to receive data from a small load cell amplifier. While in some devices (Samsung ones) the BT signal strength (RSSI) vary as expected (from around -20, at short distance, to around -80, at 10m), in some others (one LG model, at least) the RSSI are quite weird, as around 200 (positive value!) at short distance. I'm supposing that LG phone is not giving RSSI values in dBm. In all cases Samsung tablets and LG phones were always connected to the same remote device (the amplifier sample that my customer is developing). Actually my question is if it is normal, in this case, that different Android devices (or different Android versions) answer differently to the same API call.


回答1:


The RSSI is an 8-bit signed two's complement integer(-128 to 127). If you read the value as a byte then you will get the correct value range for any device. If you read it as an integer or a string you might end up with correct values on some devices but incorrect on some other...

200 as an 8-bit signed two's complement integer equals -56



来源:https://stackoverflow.com/questions/21609544/bluetooth-rssi-values-are-always-in-dbm-in-all-android-devices

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