JsPeripheral

class JsPeripheral : Peripheral

Functions

connect
Link copied to clipboard
js
open suspend override fun connect()
Initiates a connection, suspending until connected, or failure occurs.
disconnect
Link copied to clipboard
js
open suspend override 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
js
open override fun observe(characteristic: Characteristic, onSubscription: OnSubscriptionAction): Flow<ByteArray>
Observes changes to the specified Characteristic.
observeDataView
Link copied to clipboard
js
fun observeDataView(characteristic: Characteristic, onSubscription: OnSubscriptionAction = {}): Flow<DataView>
read
Link copied to clipboard
js
open suspend override fun read(characteristic: Characteristic): ByteArray
open suspend override fun read(descriptor: Descriptor): ByteArray
readAsDataView
Link copied to clipboard
js
suspend fun readAsDataView(characteristic: Characteristic): DataView
suspend fun readAsDataView(descriptor: Descriptor): DataView
rssi
Link copied to clipboard
js
open suspend override fun rssi(): Int
toString
Link copied to clipboard
js
open override fun toString(): String
write
Link copied to clipboard
js
open suspend override fun write(descriptor: Descriptor, data: ByteArray)
open suspend override fun write(characteristic: Characteristic, data: ByteArray, writeType: WriteType)

Properties

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