【发布时间】:2014-11-05 10:13:51
【问题描述】:
我正在Android 中开发BLE(蓝牙)。我通过谷歌找到了信息。似乎Android 可以通过使用多个BluetoothGatt 连接到multiple BLE device,如下面的伪代码。
我有多个 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 设备的智能方法吗?
【问题讨论】:
-
你能找到任何相同的例子吗?你能指导我如何连接多个BLE设备
标签: android bluetooth-lowenergy