MockBluetoothServer

class MockBluetoothServer(initialStatus: ServerStatus = ServerStatus.AVAILABLE, setupMocks: Boolean = true) : BluetoothServer

A mock implementation of BluetoothServer. The status, isAdvertising and services flows are backed by MutableStateFlows the test can update directly, while the methods are mocked using the Kaluga mocking library so calls can be stubbed and verified.

Parameters

initialStatus

the initial ServerStatus

setupMocks

if true the mocks are configured with sensible default behaviour

Constructors

Link copied to clipboard
constructor(initialStatus: ServerStatus = ServerStatus.AVAILABLE, setupMocks: Boolean = true)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val isAdvertising: StateFlow<Boolean>
Link copied to clipboard
val isAdvertisingState: MutableStateFlow<Boolean>

The MutableStateFlow backing isAdvertising

Link copied to clipboard
Link copied to clipboard
open override val services: StateFlow<List<LocalService>>
Link copied to clipboard
val servicesState: MutableStateFlow<List<LocalService>>

The MutableStateFlow backing services

Link copied to clipboard
open override val status: StateFlow<ServerStatus>
Link copied to clipboard
val statusState: MutableStateFlow<ServerStatus>

The MutableStateFlow backing status

Functions

Link copied to clipboard
open suspend override fun add(uuid: UUID, service: LocalService.DSL.Primary.() -> Unit): LocalService?
Link copied to clipboard
open suspend override fun advertise(data: AdvertiseData.Builder.() -> Unit): Boolean
Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override fun remove(service: LocalService): Boolean
Link copied to clipboard
open suspend override fun removeAllServices(): Boolean
Link copied to clipboard
open override fun stopAdvertising()