Separated to new file

This commit is contained in:
hiar
2025-08-13 16:17:52 +02:00
committed by Himali Aryal
parent 8a7eb67d72
commit d7064ca619
2 changed files with 15 additions and 12 deletions

View File

@@ -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

View File

@@ -3,21 +3,10 @@ package no.nordicsemi.android.service.profile
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import no.nordicsemi.android.toolbox.profile.manager.ServiceManager 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.client.android.Peripheral
import no.nordicsemi.kotlin.ble.core.ConnectionState import no.nordicsemi.kotlin.ble.core.ConnectionState
import no.nordicsemi.kotlin.ble.core.WriteType 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 { interface ServiceApi {
/** Flow of connected devices. */ /** Flow of connected devices. */
@@ -45,7 +34,7 @@ interface ServiceApi {
* *
* @return the connection state flow. * @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. * Get the disconnection reason of the device with the given address.