Peripheral

interface Peripheral

Functions

connect
Link copied to clipboard
common
abstract suspend fun connect()
Initiates a connection, suspending until connected, or failure occurs.
disconnect
Link copied to clipboard
common
abstract suspend fun disconnect()
Disconnects the active connection, or cancels an in-flight connection attempt, suspending until Peripheral has settled on a disconnected state.
observe
Link copied to clipboard
common
abstract fun observe(characteristic: Characteristic, onSubscription: OnSubscriptionAction = {}): Flow<ByteArray>
Observes changes to the specified Characteristic.
read
Link copied to clipboard
common
abstract suspend fun read(characteristic: Characteristic): ByteArray
abstract suspend fun read(descriptor: Descriptor): ByteArray
rssi
Link copied to clipboard
common
abstract suspend fun rssi(): Int
write
Link copied to clipboard
common
abstract suspend fun write(descriptor: Descriptor, data: ByteArray)
abstract suspend fun write(characteristic: Characteristic, data: ByteArray, writeType: WriteType = WithoutResponse)

Properties

services
Link copied to clipboard
common
abstract val services: List<DiscoveredService>?
state
Link copied to clipboard
common
abstract val state: Flow<State>
Provides a conflated Flow of the Peripheral's State.

Inheritors

AndroidPeripheral
Link copied to clipboard
ApplePeripheral
Link copied to clipboard
JsPeripheral
Link copied to clipboard