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