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). When created from the OS bonded device list (address only), advertisement is null and the peripheral is constructed via createPeripheral(address) with autoConnect = true.

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.