MeshtasticBleDevice

class MeshtasticBleDevice(val address: String, val name: String? = null, val advertisement: Advertisement? = null) : BleDevice(source)

Unified BleDevice implementation for all BLE devices — scanned, bonded, or both.

When created from a live BLE scan, advertisement is populated and used for optimal peripheral construction via Peripheral(advertisement) with a direct (non-autoConnect) connection attempt.

Bonded-only devices (address only, advertisement null) can still be constructed for display in the device list and as a bounded fallback when fresh scans miss. In that fallback, Kable creates an address-only peripheral so Android can wait for the device to advertise through its autoConnect path while the transport keeps the connection attempt bounded.

Parameters

address

The device's MAC address (or platform identifier string).

name

The device's display name, if known.

advertisement

The Kable Advertisement from a live scan, or null for bonded-only devices.

Constructors

Link copied to clipboard
constructor(address: String, name: String? = null, advertisement: Advertisement? = null)

Properties

Link copied to clipboard
open override val address: String
Link copied to clipboard
val advertisement: Advertisement?
Link copied to clipboard
open override val isBonded: Boolean = true

Whether the device is bonded.

Link copied to clipboard
open override val isConnected: Boolean

Whether the device is currently connected.

Link copied to clipboard
open override val name: String?
Link copied to clipboard
open override val rssi: Int?

The RSSI reported by the most recent scan advertisement for this device, in dBm.

Link copied to clipboard
open override val state: StateFlow<BleConnectionState>

The current connection state of the device.

Functions

Link copied to clipboard
open suspend override fun bond()

Bond the device.

Link copied to clipboard
open suspend override fun readRssi(): Int

Reads the current RSSI value.