2013-10-16 66 views
0

我把mBluetoothGatt.readRemoteRssi();進入mGattCallback。爲什麼onReadRemoteRssi()回調的值是0?

private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { 
    @Override 
    public void onConnectionStateChange(BluetoothGatt gatt, int status, 
      int newState) { 
     // TODO Auto-generated method stub 
     String intentAction; 
     if(newState == BluetoothProfile.STATE_CONNECTED) { 
      intentAction = ACTION_GATT_CONNECTED; 
      mConnectionState = STATE_CONNECTED; 
      mBluetoothGatt.readRemoteRssi(); 
             . 
             . 
             . 

而且也把onReadRemoteRssiBluetoothGattCallback功能

             . 
             . 
             . 
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { 
      broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic); 
     } 

     public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) { 
      final Intent rssiIntent = new Intent(BluetoothLeService.this, DeviceControl.class); 
      rssiIntent.putExtra(DeviceControl.RSSI, rssi); 
     } 


     };//BluetoothGattCallback End 

它會調用readRemoteRssi()和onReadRemoteRssi(),但我不知道爲什麼RSSI爲0。 ..

日誌的樣子:

D/BluetoothGatt(3684): readRssi() - device: 90:59:AF:0B:8A:AB 
D/BtGatt.GattService(2463): readRemoteRssi() - address=90:59:AF:0B:8A:AB 
                 . 
                 . 
                 . 
D/BtGatt.GattService(2463): onReadRemoteRssi() - clientIf=4 address=90:59:AF:0B:8A:AB, rssi=0, status=0 
D/BluetoothGatt(3684): onReadRemoteRssi() - Device=90:59:AF:0B:8A:AB rssi=0 status=0 

我確定我的BLE設備是正常的。 但我不知道爲什麼rssi值是?

有人可以教我嗎?

謝謝!

回答

0

根據BT控制器的不同,值0可能意味着RSSI在「黃金接收功率範圍」內。如果該值爲負值,則表示該值小於-60 dB,如果該值爲正值,則該值大於-40 dB。

對於Bluetopia堆棧中的低層調用HCI_Read_RSSI()也是如此。我不確定這是否適用於您的情況。

查看這篇文章的末尾:http://www.palowireless.com/infotooth/tutorial/radio.asp它討論RSSI。

嘗試增加您的BLE設備的範圍,使RSSI退出黃金範圍,也許您將獲得非零值。

0

我相信在這種情況下RSSI比例從-100到0,其中0是最強的。嘗試移動你的藍牙設備,看看你是否得到一個非零數字。

相關問題