Android蓝牙Gatt连续扫描

时间:2019-09-16 22:30:15

标签: android bluetooth

是否可以连续扫描连接的蓝牙设备,询问其RSSI?

我实现了:

private BluetoothMessageReceivedListener bluetoothMessageReceivedListener = new BluetoothMessageReceivedListener() {
    @Override
    public void onBluetoothMessageReceived(final String message) {


        BluetoothManager bluetoothManager = new BluetoothManager();



            BluetoothManager bluetoothManager = new BluetoothManager();
            BluetoothAdapter mBluetoothAdapter = bluetoothManager.getAdapter();
            BluetoothGatt gatt;
            BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(deviceAddress);
            BluetoothGatt bluetoothGatt = getBluetoothGatt(device);

            if (bluetoothGatt == null) {
                return false;
            }
            boolean rdRemoteRssi = bluetoothGatt.readRemoteRssi();
            Log.d(FTAG, "BluetoothGatt readRemoteRssi : " + rdRemoteRssi);
            return true;
}
};

失败,因为bluetoothmanagerandroid.bluetooth.bluetoothmanager中未公开。什么是解决方案?

0 个答案:

没有答案