Last active
April 17, 2020 03:38
-
-
Save charlesmuchene/58c63827ba330f52c3272d48d032ca39 to your computer and use it in GitHub Desktop.
Android Gatt server - Peripheral
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
// Starts GattServer to serve remote Central requests | |
private val gattServer: BluetoothGattServer by lazyNone { | |
bluetoothManager.openGattServer(this.applicationContext, GattServerCallback()) | |
} | |
private class GattServerCallback : BluetoothGattServerCallback() { | |
override fun onConnectionStateChange(device: BluetoothDevice, status: Int, newState: Int) { ... } | |
override fun onCharacteristicReadRequest(device: BluetoothDevice, requestId: Int, offset: Int, characteristic: BluetoothGattCharacteristic) { | |
// Respond with TraceCharacteristic value from given offset | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment