Slide 67
Slide 67 text
fun BluetoothDevice.connectGatt(context: Context, autoConnect: Boolean) =
channelFlow {
val gatt = connectGatt(context, autoConnect, object : BluetoothGattCallback(){
override fun onConnectionStateChange(
gatt: BluetoothGatt,
status: Int, newState: Int
) {
trySend(BluetoothGattEvent.ConnectionStateChange(gatt, status, newState))
}
override fun onServicesDiscovered(
gatt: BluetoothGatt,
status: Int
) {
trySend(BluetoothGattEvent.ServicesDiscovered(gatt, status))
}
// ུ
})
}
BluetoothDevice#connectGatt