mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-18 23:14:22 +01:00
Separated to new file
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package no.nordicsemi.android.service.profile
|
||||
|
||||
import no.nordicsemi.android.ui.view.internal.DisconnectReason
|
||||
import no.nordicsemi.kotlin.ble.core.ConnectionState
|
||||
|
||||
/** Device disconnection reason. */
|
||||
sealed interface DeviceDisconnectionReason
|
||||
|
||||
/** Includes the [ConnectionState.Disconnected.Reason]. */
|
||||
data class StateReason(val reason: ConnectionState.Disconnected.Reason) : DeviceDisconnectionReason
|
||||
|
||||
/** Includes the custom made [DisconnectReason] to include other disconnection reasons which are not included in the [ConnectionState.Disconnected.Reason]. */
|
||||
data class CustomReason(val reason: DisconnectReason) :
|
||||
DeviceDisconnectionReason
|
||||
@@ -3,21 +3,10 @@ package no.nordicsemi.android.service.profile
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import no.nordicsemi.android.toolbox.profile.manager.ServiceManager
|
||||
import no.nordicsemi.android.ui.view.internal.DisconnectReason
|
||||
import no.nordicsemi.kotlin.ble.client.android.Peripheral
|
||||
import no.nordicsemi.kotlin.ble.core.ConnectionState
|
||||
import no.nordicsemi.kotlin.ble.core.WriteType
|
||||
|
||||
/** Device disconnection reason. */
|
||||
sealed interface DeviceDisconnectionReason
|
||||
|
||||
/** Includes the [ConnectionState.Disconnected.Reason]. */
|
||||
data class StateReason(val reason: ConnectionState.Disconnected.Reason) : DeviceDisconnectionReason
|
||||
|
||||
/** Includes the custom made [DisconnectReason] to include other disconnection reasons which are not included in the [ConnectionState.Disconnected.Reason]. */
|
||||
data class CustomReason(val reason: DisconnectReason) :
|
||||
DeviceDisconnectionReason
|
||||
|
||||
interface ServiceApi {
|
||||
|
||||
/** Flow of connected devices. */
|
||||
@@ -45,7 +34,7 @@ interface ServiceApi {
|
||||
*
|
||||
* @return the connection state flow.
|
||||
*/
|
||||
fun getConnectionState(address: String): StateFlow<ConnectionState>?
|
||||
fun connectionState(address: String): StateFlow<ConnectionState>?
|
||||
|
||||
/**
|
||||
* Get the disconnection reason of the device with the given address.
|
||||
|
||||
Reference in New Issue
Block a user