Last active
January 5, 2024 09:09
-
-
Save tdcolvin/265ad7f5215afa410bc84528476ff473 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The saved list of services. The BluetoothGattService objects here can be used | |
// to list the characteristics in each service. | |
private var services: List<BluetoothGattService> = emptyList() | |
@RequiresPermission(PERMISSION_BLUETOOTH_CONNECT) | |
fun discoverServices() { | |
gatt?.discoverServices() | |
} | |
private val callback = object: BluetoothGattCallback() { | |
//Continuing our override of methods in this object from previous steps... | |
... | |
override fun onServicesDiscovered(gatt: BluetoothGatt, status: Int) { | |
super.onServicesDiscovered(gatt, status) | |
services = gatt.services | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment