问题
I want to read a GATT characteristic value by the way of notification.
This means I need to set that characteristic to notify and then read the data.
I wish to do this in a function from an onclick.
When I run my activity the characteristics are found and added to this arraylist
private ArrayList<ArrayList<BluetoothGattCharacteristic>> mGattCharacteristics =
new ArrayList<ArrayList<BluetoothGattCharacteristic>>();
I have the UUIDs of the service and characteristic values how do I get a characteristic out of this?
What I want is something like below:
BluetoothGattCharacteristic mycharacterisic;
mycharacterisic = mGattCharacteristics.get(1).get(1);
mBluetoothLeService.setCharacteristicNotification(mycharacterisic, true);
//output to a text box via notification
The get(1).get(1) are just random parameters I have entered. How do I do it via the UUIDs?
Thanks
来源:https://stackoverflow.com/questions/60992229/reading-a-gatt-characteristic-value-in-android-studio-notification