Skip to content

Instantly share code, notes, and snippets.

@don
Last active November 11, 2015 18:54
Show Gist options
  • Save don/619f01de5c15d08fc670 to your computer and use it in GitHub Desktop.
Save don/619f01de5c15d08fc670 to your computer and use it in GitHub Desktop.
// code to add to slides, not a complete implementation
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
if (newState == BluetoothGatt.STATE_CONNECTED) {
this.gatt = gatt;
gatt.discoverServices();
}
}
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
BluetoothGattService service = gatt.getService(SERVICE_UUID);
// TODO handler errors if null
switchCharacteristic = service.getCharacteristic(SWITCH_UUID);
brightnessCharacteristic = service.getCharacteristic(DIMMER_UUID);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment