Characteristic

An Attribute of a Bluetooth Characteristic

Parameters

initialValue

the initial ByteArray value of the characteristic

emitNewAction

method to call when a new DeviceConnectionManager.Event.AddAction event should take place

parentLogTag

the log tag used to modify the log tag of this characteristic

logger

the Logger to use for logging.

Constructors

Link copied to clipboard
constructor(wrapper: CharacteristicWrapper, initialValue: ByteArray? = null, emitNewAction: (DeviceConnectionManager.Event.AddAction) -> Unit, parentLogTag: String, logger: Logger)

Properties

Link copied to clipboard

The list of Descriptor associated with the characteristic

Link copied to clipboard

If true this characteristic has been set to automatically provide updates to its value

Link copied to clipboard
open override val uuid: UUID

The UUID of the attribute

Link copied to clipboard

the CharacteristicWrapper to access the platform characteristic

Functions

Link copied to clipboard

Gets the (Flow of) BaseAdvertisementData from a Flow of Device

Link copied to clipboard

Gets a (Flow of) the list Characteristic associated with the Service in a Flow

Link copied to clipboard
open suspend override fun collect(collector: FlowCollector<ByteArray?>): Nothing
Link copied to clipboard
suspend fun Flow<Device?>.connect(reconnectionSettings: ConnectionSettings.ReconnectionSettings? = null)

Attempts to connect to the Device from a Flow of Device When this method completes, the devices should be in a ConnectableDeviceState.Connected state

Link copied to clipboard

Gets a (Flow of) the list Descriptor associated with the Characteristic in a Flow

Link copied to clipboard

Disables notification or indication for this Characteristic

Link copied to clipboard
suspend fun Flow<Device?>.disconnect()

Attempts to disconnect to the Device from a Flow of Device When this method completes, the devices should be in a ConnectableDeviceState.Disconnected state

Link copied to clipboard
fun Flow<Device?>.distance(environmentalFactor: Double = 2.0, averageOver: Int = 5): Flow<Double>

Gets the (Flow of) the distance in meters between the scanner and a Flow of Device. To get a more stable result, this method will average the distance over the last averageOver results.

Link copied to clipboard

Enables notification or indication for this Characteristic.

Link copied to clipboard

Gets a (Flow of) AttributeType of a given UUID from a Flow of a list of AttributeType

@JvmName(name = "getService")
operator fun Flow<List<Service>>.get(uuid: UUID): Flow<Service?>

Gets a (Flow of) Service of a given UUID from a Flow of a list of Service

operator fun Flow<List<Device>>.get(identifier: Identifier): Flow<Device?>

Gets a (Flow of) Device with a given Identifier from a Flow of a list of Device.

Link copied to clipboard

Checks if the characteristic has a given CharacteristicProperties

Link copied to clipboard
fun Flow<Device?>.info(): Flow<DeviceInfo>

Gets the (Flow of) DeviceInfo from a Flow of Device

Link copied to clipboard
fun Flow<Device?>.mtu(): Flow<MTU?>

Gets the (Flow of) the MTU from a Flow of Device

Link copied to clipboard
suspend fun Flow<Device?>.pair()

Pairs a (Flow of) Device by waiting for it to become connected and calling [ConnectableDeviceState.Connected.pair]

Link copied to clipboard
Link copied to clipboard
suspend fun Flow<Device?>.requestMtu(mtu: MTU): Boolean

Attempts to request a MTU size for the Device from a Flow of Device When this method completes, the devices should have had ConnectableDeviceState.Connected.requestMtu called

Link copied to clipboard
fun Flow<Device?>.rssi(): Flow<RSSI>

Gets the (Flow of) the RSSI value from a Flow of Device

Link copied to clipboard
fun Flow<Device?>.services(): Flow<List<Service>>

Gets a (Flow of) the list of Service associated with the Device in a Flow This will automatically discover services if the device is in a ConnectableDeviceState.Connected.NoServices state.

Link copied to clipboard
fun Flow<Device?>.state(): Flow<DeviceState>

Gets a (Flow of) DeviceState from a Flow or Device

Link copied to clipboard
suspend fun Flow<Device?>.unpair()

Pairs a (Flow of) Device by calling [ConnectableDeviceState.unpair] on the first ConnectableDeviceState

Link copied to clipboard
suspend fun Flow<Device?>.updateRssi()

Attempts to request an update to the RSSI of the Device from a Flow of Device When this method completes, the devices should have had ConnectableDeviceState.Connected.readRssi called

Link copied to clipboard
open fun updateValue()

Notifies the attribute that a new value may be available

Link copied to clipboard
Link copied to clipboard

Creates and emits a WriteAction to write a given ByteArray