【发布时间】:2014-11-07 09:16:57
【问题描述】:
我已经实现了通过在 Android 中使用多个 BluetoothGatt parameter 来连接到多个 BLE device。
我使用 mBluetoothGatt.readRemoteRssi(); 读取 RSSI ,并通过 BroadcastReceiver 接收 RSSI 值,如下代码:
private final BroadcastReceiver mGattreceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
final String action = intent.getAction();
if(BluetoothLeService.EXTRA_RSSI.equalsIgnoreCase(action)){
int rssi = intent.getIntExtra(BluetoothLeService.EXTRA_RSSI, 0);
Log.i(TAG, "mGattreceiver BroadcastReceiver---rssi = " + rssi);
}
}
};
我可以通过上面的代码得到RSSI,我也看到了类似下面的日志
11-07 17:09:29.595: D/BluetoothGatt(16612): onReadRemoteRssi() - Device=20:73:20:00:6C:C5 rssi=-56 status=0
但是如果有多个 BLE device ,我会得到多个 RSSI 值但没有 BLE address BroadcastReceiver
如何获取我正在为 RSSI 阅读的 address of BLE device ?
我可以在 BroadcastReceiver 中获取 address 吗?
提前致谢。
【问题讨论】:
-
检查this link的sn-p
标签: android bluetooth-lowenergy rssi