AndroidPeripheral

class AndroidPeripheral : Peripheral

Functions

connect
Link copied to clipboard
open suspend override fun connect()
Initiates a connection, suspending until connected, or failure occurs.
disconnect
Link copied to clipboard
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
open override fun observe(characteristic: Characteristic, onSubscription: OnSubscriptionAction): Flow<ByteArray>
Observes changes to the specified Characteristic.
read
Link copied to clipboard
open suspend override fun read(characteristic: Characteristic): ByteArray
open suspend override fun read(descriptor: Descriptor): ByteArray
requestConnectionPriority
Link copied to clipboard
fun requestConnectionPriority(priority: Priority): Boolean
requestMtu
Link copied to clipboard
suspend fun requestMtu(mtu: Int): Int
Requests that the current connection's MTU be changed.
rssi
Link copied to clipboard
open suspend override fun rssi(): Int
toString
Link copied to clipboard
open override fun toString(): String
write
Link copied to clipboard
open suspend override fun write(descriptor: Descriptor, data: ByteArray)
open suspend override fun write(characteristic: Characteristic, data: ByteArray, writeType: WriteType)

Properties

mtu
Link copied to clipboard
val mtu: StateFlow<Int?>
StateFlow of the most recently negotiated MTU.
services
Link copied to clipboard
open override val services: List<DiscoveredService>?
state
Link copied to clipboard
open override val state: Flow<State>
Provides a conflated Flow of the Peripheral's State.