INNER CODE UNIT · Java
onCharacteristicRead
nic-delhi/AarogyaSetu_Android · app/src/main/java/nic/goi/aarogyasetu/GattClient.java:89
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
readCounterCharacteristic(characteristic, gatt);
}
private void readCounterCharacteristic(BluetoothGattCharacteristic characteristic, BluetoothGatt gatt) {
if (UUID.fromString(BuildConfig.DID_UUID).equals(characteristic.getUuid())) {
byte[] data = characteristic.getValue();
String uniqueId = new String(data, StandardCharsets.UTF_8);
Logger.d("GattCLient", "Unique ID - " + uniqueId);
BluetoothModel bluetoothModel = new BluetoothModel(uniqueId,
uniqueId, mRssi, txPower, txPowerLevel);
storeDetectedUserDeviceInDB(bluetoothModel);
} else if (UUID.fromString(BuildConfig.PINGER_UUID).equals(characteristic.getUuid())) {
byte[] data = characteristic.getValue();
String uniqueId = new String(data, StandardCharsets.UTF_8);
Logger.d("GattCLient", "Pinger ID - " + uniqueId);
}
chars.remove(chars.get(chars.size() - 1));