【发布时间】:2015-10-22 08:36:03
【问题描述】:
我正在 Android Studio 中处理一个 BLE 项目,并想读取我已经连接到的设备的 RSSI 值。到目前为止,我能够通过 LE Scan 发现新设备并从那里获取它们的 RSSI。但是,一旦我连接到设备,我就无法再运行扫描并获取 RSSI。
这是在连接到其中一个设备之前发现新设备的代码。但不确定它与我的问题有多大关系:
private BluetoothAdapter.LeScanCallback mLeScanCallback =
new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device,final int rssi, byte[] scanRecord) {
runOnUiThread(new Runnable() {
@Override
public void run() {
mLeDeviceListAdapter.addDevice(device, rssi);
//mLeDeviceListAdapter.notifyDataSetChanged();
try {
mLeDeviceListAdapter.notifyDataSetChanged();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
};
提前致谢
【问题讨论】:
-
你在配对吗?
标签: android android-studio bluetooth bluetooth-lowenergy rssi