INNER CODE UNIT · Java
onConnectionStateChange
nic-delhi/AarogyaSetu_Android · app/src/main/java/nic/goi/aarogyasetu/GattClient.java:52
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
gatt.discoverServices();
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
stopClient();
}
}
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
if (status == BluetoothGatt.GATT_SUCCESS) {
BluetoothGattService service = gatt.getService(UUID.fromString(BuildConfig.SERVICE_UUID));
if (service != null) {
BluetoothGattCharacteristic probCharacteristic = service.getCharacteristic(UUID.fromString(BuildConfig.PINGER_UUID));
if (probCharacteristic != null) {
chars.add(probCharacteristic);