BADeviceDefaultImpl

open class BADeviceDefaultImpl(var peripheralData: BluetoothPeripheral, var deviceConfig: BADeviceConfig, var lastSample: Int = 0, var batteryLevel: Float = -1.0f, var connectionState: MutableStateFlow<ConnectionStatus> = MutableStateFlow(ConnectionStatus.DISCONNECTED)) : BADevice

Default implementation of the BADevice interface.

Inheritors

Constructors

Link copied to clipboard
constructor(peripheralData: BluetoothPeripheral, deviceConfig: BADeviceConfig, lastSample: Int = 0, batteryLevel: Float = -1.0f, connectionState: MutableStateFlow<ConnectionStatus> = MutableStateFlow(ConnectionStatus.DISCONNECTED))

Properties

Link copied to clipboard
open override var batteryLevel: Float

Current battery level of the device.

Link copied to clipboard
open override var connectionState: MutableStateFlow<ConnectionStatus>

State flow representing the current connection status.

Link copied to clipboard
open override var deviceConfig: BADeviceConfig

Configuration settings for the device.

Link copied to clipboard
open override var lastSample: Int

Index of the last received data sample.

Link copied to clipboard
open override var peripheralData: BluetoothPeripheral

The BluetoothPeripheral representing the connected device.

Functions

Link copied to clipboard
open override fun annotate()

Adds an annotation (not yet implemented).

Link copied to clipboard
open override fun configure(config: BADeviceConfig)

Sends a new configuration to the device.

Link copied to clipboard
open override fun connect(): CompatabilityStatus

Connects to the device and performs initial MTU setup and battery read.

Link copied to clipboard
open override fun disconnect()

Disconnects from the device and stops all streaming or battery operations.

Link copied to clipboard
open override fun getName(): String

Returns the name of the Bluetooth device or "Unknown" if not available.

Link copied to clipboard
open override fun getUUID(): String

Returns the UUID of the Bluetooth device.

Link copied to clipboard
open override fun startBatteryAcquisition()

Starts battery level acquisition from the device.

Link copied to clipboard
open override fun startStream()

Starts streaming data from the device.

Link copied to clipboard
open override fun stopBatteryAcquisition()

Stops battery level acquisition from the device.

Link copied to clipboard
open override fun stopStream()

Stops data streaming from the device.