天天看點

Android 藍牙強度Rssi

1.什麼是Rssi

RSSI(接收信号強度)Received Signal Strength Indicator

Rss=10logP,

隻需将接受到的信号功率P代入就是接收信号強度(靈敏度)。

[例1] 如果發射功率P為1mw,折算為dBm後為0dBm。

[例2] 對于40W的功率,按dBm機關進行折算後的值應為:

10lg(40W/1mw)=10lg(40000)=10lg4+10lg10+10lg1000=46dBm。

2.如何擷取BLE藍牙Rssi

try {
            return _bluetoothGatt.readRemoteRssi();
        }
        catch (Exception e)
        {

        }
           

BluetoothGatt對象調用readRemoteRssi方法

private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
        @Override
        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
         }

        @Override
        public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
            super.onReadRemoteRssi(gatt, rssi, status);
            if (status == BluetoothGatt.GATT_SUCCESS) {
                broadcastUpdate(status, rssi);
            }
        }
    };
           

Rssi強度會從BluetoothGattCallback的onReadRemoteRssi接口回調回來。

3.藍牙強度Rssi的取值範圍

Rssi和接收功率有關,機關是dBm,一般為負值,反應的是信号的衰減程度,理想狀态下(無衰減),Rssi = 0dBm,實際情況是,即使藍牙裝置挨得非常近,Rssi也隻有-50dBm的強度,在傳輸過程中,不可避免要損耗。 一般情況下,經典藍牙強度  -50 ~ 0dBm 信号強 -70 ~-50dBm信号中 <-70dBm      信号弱

低功耗藍牙分四級 -60 ~ 0   4 -70 ~ -60 3 -80 ~ -70 2 <-80 1

參考文章 http://www.cnblogs.com/lele/articles/2832885.html