问题
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