commonMain.dev.bluefalcon.BlueFalcon.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blue-falcon Show documentation
Show all versions of blue-falcon Show documentation
Bluetooth Multiplatform Library
package dev.bluefalcon
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableStateFlow
expect class BlueFalcon(
log: Logger = PrintLnLogger,
context: ApplicationContext
) {
val scope: CoroutineScope
val delegates: MutableSet
var isScanning: Boolean
internal val _peripherals: MutableStateFlow>
val peripherals: NativeFlow>
fun connect(bluetoothPeripheral: BluetoothPeripheral, autoConnect: Boolean = false)
fun disconnect(bluetoothPeripheral: BluetoothPeripheral)
@Throws(
BluetoothUnknownException::class,
BluetoothResettingException::class,
BluetoothUnsupportedException::class,
BluetoothPermissionException::class,
BluetoothNotEnabledException::class
)
fun scan(serviceUUID: String? = null)
fun stopScanning()
fun readCharacteristic(
bluetoothPeripheral: BluetoothPeripheral,
bluetoothCharacteristic: BluetoothCharacteristic
)
fun notifyCharacteristic(
bluetoothPeripheral: BluetoothPeripheral,
bluetoothCharacteristic: BluetoothCharacteristic,
notify: Boolean
)
fun indicateCharacteristic(
bluetoothPeripheral: BluetoothPeripheral,
bluetoothCharacteristic: BluetoothCharacteristic,
indicate: Boolean
)
fun notifyAndIndicateCharacteristic(
bluetoothPeripheral: BluetoothPeripheral,
bluetoothCharacteristic: BluetoothCharacteristic,
enable: Boolean
)
fun writeCharacteristic(
bluetoothPeripheral: BluetoothPeripheral,
bluetoothCharacteristic: BluetoothCharacteristic,
value: String,
writeType: Int?
)
fun writeCharacteristic(
bluetoothPeripheral: BluetoothPeripheral,
bluetoothCharacteristic: BluetoothCharacteristic,
value: ByteArray,
writeType: Int?
)
fun writeCharacteristicWithoutEncoding(
bluetoothPeripheral: BluetoothPeripheral,
bluetoothCharacteristic: BluetoothCharacteristic,
value: ByteArray,
writeType: Int?
)
fun readDescriptor(
bluetoothPeripheral: BluetoothPeripheral,
bluetoothCharacteristic: BluetoothCharacteristic,
bluetoothCharacteristicDescriptor: BluetoothCharacteristicDescriptor
)
fun changeMTU(bluetoothPeripheral: BluetoothPeripheral, mtuSize: Int)
}