This repository was archived by the owner on Aug 30, 2022. It is now read-only.
File tree 2 files changed +17
-1
lines changed 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import java.util.UUID
15
15
import kotlinx.coroutines.CancellationException
16
16
import kotlinx.coroutines.ExecutorCoroutineDispatcher
17
17
import kotlinx.coroutines.FlowPreview
18
+ import kotlinx.coroutines.channels.BroadcastChannel
18
19
import kotlinx.coroutines.flow.asFlow
19
20
import kotlinx.coroutines.sync.Mutex
20
21
import kotlinx.coroutines.sync.withLock
@@ -36,8 +37,15 @@ class CoroutinesGatt internal constructor(
36
37
@FlowPreview
37
38
override val onConnectionStateChange = callback.onConnectionStateChange.asFlow()
38
39
40
+ @Deprecated(
41
+ message = " Will be removed when Kotlin/kotlinx.coroutines#2034 is closed; use onCharacteristicChanged instead." ,
42
+ replaceWith = ReplaceWith (expression = " onCharacteristicChanged" )
43
+ )
44
+ override val onCharacteristicChangedChannel: BroadcastChannel <OnCharacteristicChanged >
45
+ get() = callback.onCharacteristicChanged
46
+
39
47
@FlowPreview
40
- override val onCharacteristicChanged = callback.onCharacteristicChanged .asFlow()
48
+ override val onCharacteristicChanged = onCharacteristicChangedChannel .asFlow()
41
49
42
50
override val services: List <BluetoothGattService > get() = bluetoothGatt.services
43
51
override fun getService (uuid : UUID ): BluetoothGattService ? = bluetoothGatt.getService(uuid)
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import android.bluetooth.BluetoothGattService
12
12
import android.os.RemoteException
13
13
import java.util.UUID
14
14
import kotlinx.coroutines.FlowPreview
15
+ import kotlinx.coroutines.channels.BroadcastChannel
15
16
import kotlinx.coroutines.flow.Flow
16
17
17
18
/* *
@@ -50,6 +51,13 @@ interface GattIo {
50
51
val services: List <BluetoothGattService >
51
52
fun getService (uuid : UUID ): BluetoothGattService ?
52
53
54
+ /* * Will be removed when https://github.com/Kotlin/kotlinx.coroutines/issues/2034 is closed. */
55
+ @Deprecated(
56
+ message = " Will be removed when Kotlin/kotlinx.coroutines#2034 is closed; use onCharacteristicChanged instead." ,
57
+ replaceWith = ReplaceWith (expression = " onCharacteristicChanged" )
58
+ )
59
+ val onCharacteristicChangedChannel: BroadcastChannel <OnCharacteristicChanged >
60
+
53
61
@FlowPreview
54
62
val onCharacteristicChanged: Flow <OnCharacteristicChanged >
55
63
You can’t perform that action at this time.
0 commit comments