Advertisement
Guest User

KK

a guest
Jan 21st, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.69 KB | None | 0 0
  1.  BluetoothGattCharacteristic charGM =
  2.                     mConnGatt.getService(UUID.fromString(BleUuid.SERVICE_GLUCOSE))
  3.                         .getCharacteristic(UUID.fromString(BleUuid.CHAR_GLUCOSE_MEASUREMENT_STRING));
  4.             mConnGatt.setCharacteristicNotification(charGM, enabled);
  5.             BluetoothGattDescriptor descGM = charGM.getDescriptor(UUID.fromString(BleUuid.CHAR_CLIENT_CHARACTERISTIC_CONFIG_STRING));
  6.             descGM.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
  7.             mConnGatt.writeDescriptor(descGM);
  8.  
  9.             BluetoothGattCharacteristic charGMC =
  10.                 mConnGatt.getService(UUID.fromString(BleUuid.SERVICE_GLUCOSE))
  11.                     .getCharacteristic(UUID.fromString(BleUuid.CHAR_GLUCOSE_MEASUREMENT_CONTEXT_STRING));
  12.             mConnGatt.setCharacteristicNotification(charGMC, enabled);
  13.             BluetoothGattDescriptor descGMC = charGMC.getDescriptor(UUID.fromString(BleUuid.CHAR_CLIENT_CHARACTERISTIC_CONFIG_STRING));
  14.             descGMC.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
  15.             mConnGatt.writeDescriptor(descGMC);
  16.  
  17.             BluetoothGattCharacteristic charRACP =
  18.                 mConnGatt.getService(UUID.fromString(BleUuid.SERVICE_GLUCOSE))
  19.                     .getCharacteristic(UUID.fromString(BleUuid.CHAR_RECORD_ACCESS_CONTROL_POINT_STRING));
  20.             mConnGatt.setCharacteristicNotification(charRACP, enabled);
  21.             BluetoothGattDescriptor descRACP = charRACP.getDescriptor(UUID.fromString(BleUuid.CHAR_CLIENT_CHARACTERISTIC_CONFIG_STRING));
  22.             descRACP.setValue(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE);
  23.             mConnGatt.writeDescriptor(descRACP);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement