Skip to content

//classic/dev.atick.bluetooth.classic/BluetoothClassic

BluetoothClassic

[androidJvm]\ @Singleton

class BluetoothClassic@Injectconstructor(bluetoothAdapter: BluetoothAdapter?, context: Context, ioDispatcher: CoroutineDispatcher) : BluetoothUtils, BluetoothManager, BluetoothDataSource

Implementation of BluetoothUtils, BluetoothManager, and BluetoothDataSource interfaces for managing Bluetooth operations.

Constructors

BluetoothClassic [androidJvm]
@Inject
constructor(bluetoothAdapter: BluetoothAdapter?, context: Context, ioDispatcher: CoroutineDispatcher)

Types

Name Summary
Companion [androidJvm]
object Companion

Functions

Name Summary
closeConnection [androidJvm]
open suspend override fun closeConnection(): Result<Unit>
Closes the Bluetooth connection.
connect [androidJvm]
open suspend override fun connect(address: String): Result<Unit>
Connects to a Bluetooth device with the specified address.
getBluetoothDataStream [androidJvm]
open override fun getBluetoothDataStream(): StateFlow<BtMessage?>
Retrieves the data stream of incoming Bluetooth messages.
getBluetoothState [androidJvm]
open override fun getBluetoothState(): StateFlow<BtState>
Retrieves the state of the Bluetooth adapter.
getConnectedDeviceState [androidJvm]
open override fun getConnectedDeviceState(): StateFlow<BtDevice?>
Retrieves the state of the connected Bluetooth device.
getPairedDevices [androidJvm]
open override fun getPairedDevices(): StateFlow<List<BtDevice>>
Retrieves the list of paired Bluetooth devices.
getScannedDevices [androidJvm]
open override fun getScannedDevices(): StateFlow<List<BtDevice>>
Retrieves the list of scanned Bluetooth devices.
sendDataToBluetoothDevice [androidJvm]
open suspend override fun sendDataToBluetoothDevice(data: String): Result<Unit>
Sends data to the connected Bluetooth device.
stopDiscovery [androidJvm]
open override fun stopDiscovery()
Stops the device discovery process.