我正在Android
的BLE
(蓝牙)上工作。我通过Google找到了信息。看起来Android
可以通过使用多个BluetoothGatt
连接到multiple BLE device
像下面的伪代码。有更好的方式连接到Android中的多个BLE设备吗?
我有多个BLE设备。我想我需要首先定义多个BluetoothGatt
参数。
private BluetoothGatt mBluetoothGattA = null,
mBluetoothGattB = null , mBluetoothGattC = null;
第一个BLE设备连接。
final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address_A);
mBluetoothGattA = device.connectGatt(this, false, mGattCallback);
尝试连接到第二个BLE设备。
final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address_B);
mBluetoothGattB = device.connectGatt(this, false, mGattCallback);
对吗?如果我连接到6个BLE设备,我应该定义6个BluetoothGatt
参数吗?
是否有智能的方式连接到多个BLE设备?