我必须将至少两个设备连接到一个Android设备。但我不知道如何连接多个连接和多个命令发送。 PLZ帮助我...我真的不知道....BLE - 连接多和写特性多重
我只是可以连接一个BLE设备到一个Android设备。
首先,我在像例如,一个服务连接的两个设备(相同的UUID,不同地址)
BluetoothDevice device = mBluetoothAdapter.getRemoteDevice("aa:12:12:33");
mGatt = device.connectGatt(mContext, false, mGattCallback);
BluetoothDevice device = mBluetoothAdapter.getRemoteDevice("bb:18:66:44");
mGatt = device.connectGatt(mContext, false, mGattCallback);
我可以听的每个设备的动作(它们有一个按钮),GattCallback的回调来自两个设备的动作,但我无法将BluetoothGatt.writeCahracteristic发送给两个设备。
我真的研究了近两周,但我不知道.. –
你的问题是什么?您只需在多个BluetoothDevice对象上执行connectGatt方法即可。 – Emil
@Emil重写我的文章。我无法一次向两个设备发送writeCharacteristic ... –