Package-level declarations

Types

Link copied to clipboard
data class AccessMessage(val opcode: MeshOpcode, val parameters: ByteArray, val isAcknowledged: Boolean = true)

An Access Layer message for application-level communication.

Link copied to clipboard
data class ApplicationKey(val index: KeyIndex, val key: ByteArray, val boundNetKeyIndex: KeyIndex, val name: String = "AppKey ") : MeshKey

Application Key bound to a Network Key.

Link copied to clipboard
data class CompositionDataUnavailable(val nodeAddress: MeshAddress.UnicastAddress, val recoveryHint: String = "Composition data not available. Verify the node is connected and configured.") : ConfigurationError
Link copied to clipboard
sealed interface ConfigurationError : MeshError

Errors returned by the Configuration Client.

Link copied to clipboard
data class ConfigurationRejected(val opcode: Int, val statusCode: UByte, val recoveryHint: String = "Configuration command was rejected by the node. Check that the operation is valid for this node.") : ConfigurationError
Link copied to clipboard
data class DecryptionFailed(val details: String, val recoveryHint: String = "Decryption failure. Possible IV Index mismatch, wrong key, or corrupted PDU.") : MeshCryptoError
Link copied to clipboard
data class DeviceAlreadyProvisioned(val uuid: String, val recoveryHint: String = "Device is already provisioned on another network. Reset the device first.") : ProvisioningError
Link copied to clipboard
data class DeviceKey(val key: ByteArray) : MeshKey

Device Key unique to a single node.

Link copied to clipboard

Element location descriptor as defined by the Bluetooth SIG.

Link copied to clipboard
data class EncryptionFailed(val details: String, val recoveryHint: String = "Encryption failure. Verify that the correct keys are configured for this network.") : MeshCryptoError
Link copied to clipboard
@RequiresOptIn(level = RequiresOptIn.Level.WARNING, message = "This BLE Mesh API is experimental and may change in future releases.")
annotation class ExperimentalMeshApi

Marks APIs that are experimental and may change without notice.

Link copied to clipboard

In-memory implementation of MeshStateStore for testing.

Link copied to clipboard
data class InvalidParameters(val message: String, val recoveryHint: String = "Invalid parameters for mesh operation.") : MeshError
Link copied to clipboard
value class IvIndex(val value: UInt)

Represents the current IV Index state of the mesh network.

Link copied to clipboard
value class KeyIndex(val value: UShort)

12-bit key index (0x000-0xFFF).

Link copied to clipboard

Key Refresh procedure phases for a NetworkKey.

Link copied to clipboard
sealed interface MeshAddress : Comparable<MeshAddress>

Address types used in BLE Mesh networking.

Link copied to clipboard
sealed interface MeshCryptoError : MeshError

Errors related to mesh cryptography.

Link copied to clipboard
annotation class MeshDsl

DSL marker to prevent invalid nesting in MeshNetworkBuilder.

Link copied to clipboard
data class MeshElement(val index: Int, val unicastAddress: MeshAddress.UnicastAddress, val location: ElementLocation = ElementLocation.UNKNOWN, val models: List<MeshModelId> = emptyList())

An addressable entity within a MeshNode.

Link copied to clipboard
sealed interface MeshError

Root of the BLE Mesh error hierarchy.

Link copied to clipboard
data class MeshException(val error: MeshError) : Exception

Exception wrapper for MeshError values, allowing them to be thrown.

Link copied to clipboard
sealed interface MeshKey

Base type for all mesh keys.

Link copied to clipboard
data class MeshMessage(val source: MeshAddress.UnicastAddress, val destination: MeshAddress, val opcode: MeshOpcode, val parameters: ByteArray, val appKey: ApplicationKey?)

A complete mesh message sent or received via the public API.

Link copied to clipboard
data class MeshMessageResponse(val opcode: MeshOpcode, val parameters: ByteArray)

Response to an acknowledged mesh message.

Link copied to clipboard
value class MeshModelId(val value: UInt)

Identifies a mesh model on an element.

Link copied to clipboard

A BLE Mesh network.

Link copied to clipboard

Builder DSL for MeshNetwork configuration.

Link copied to clipboard
data class MeshNetworkState(val ivIndex: IvIndex, val unicastAddress: MeshAddress.UnicastAddress, val networkKeys: List<NetworkKey>, val applicationKeys: List<ApplicationKey>, val nodes: List<PersistedNodeState>, val groupAddresses: List<MeshAddress.GroupAddress> = emptyList(), val lastUpdatedTimestamp: Long = 0)

Serializable snapshot of the complete mesh network state.

Link copied to clipboard
data class MeshNode(val unicastAddress: MeshAddress.UnicastAddress, val deviceKey: DeviceKey, val elements: List<MeshElement>, val features: NodeFeatures = NodeFeatures(), val ttl: UByte = DEFAULT_TTL, val networkKeys: List<NetworkKey> = emptyList(), val applicationKeys: List<ApplicationKey> = emptyList())

A provisioned node on the BLE Mesh network.

Link copied to clipboard
data class MeshNotSupported(val message: String = "BLE Mesh is not supported on this platform") : Exception, MeshError
Link copied to clipboard
value class MeshOpcode(val value: UInt)

Operation code for mesh model messages.

Link copied to clipboard
interface MeshStateStore

Persistence SPI for BLE Mesh network state.

Link copied to clipboard
sealed interface MeshTransportError : MeshError

Errors related to mesh transport (bearer, proxy, network).

Link copied to clipboard
data class MessageRejected(val reason: String, val recoveryHint: String = "The mesh message was rejected by the network layer (possible replay or key issue).") : MeshTransportError
Link copied to clipboard
data class MessageTimeout(val operation: String, val timeout: Duration, val recoveryHint: String = "No response received from mesh node. Check that the device is powered and in range.") : MeshTransportError
Link copied to clipboard
data class NetworkKey(val index: KeyIndex, val key: ByteArray, val name: String = "NetKey ", val phase: KeyRefreshPhase = KeyRefreshPhase.NORMAL) : MeshKey

Network Key shared by all nodes in a (sub)net.

Link copied to clipboard
data class NetworkPdu(val ivi: Int, val nid: Int, val ctl: Int, val ttl: Int, val seq: UInt, val src: MeshAddress.UnicastAddress, val dst: MeshAddress, val transportPdu: ByteArray, val netMic: ByteArray)

A complete Network PDU ready for transmission over a bearer.

Link copied to clipboard
data class NodeFeatures(val relay: Boolean = false, val proxy: Boolean = false, val friend: Boolean = false, val lowPower: Boolean = false)

Features supported by a mesh node.

Link copied to clipboard
data class NodeNotFound(val address: MeshAddress.UnicastAddress, val recoveryHint: String = "Node not found in network. Verify the unicast address.") : MeshError
Link copied to clipboard
data class OobAuthenticationFailed(val method: String, val recoveryHint: String = "Verify the OOB key matches the device, or try a different OOB method.") : ProvisioningError
Link copied to clipboard
data class PersistedNodeState(val unicastAddress: MeshAddress.UnicastAddress, val deviceKey: DeviceKey, val lastSequenceNumber: UInt, val features: NodeFeatures = NodeFeatures())

Per-node state that must be persisted across restarts.

Link copied to clipboard
sealed interface ProvisioningError : MeshError

Errors that occur during the provisioning process.

Link copied to clipboard
data class ProvisioningFailed(val phase: ProvisioningPhase, val reason: String, val recoveryHint: String = "Retry provisioning. Verify the device is in range and not already provisioned.") : ProvisioningError
Link copied to clipboard

Phases of the provisioning protocol for error reporting.

Link copied to clipboard
data class ProvisioningTimeout(val timeout: Duration, val recoveryHint: String = "Increase provisioning timeout or verify device responsiveness.") : ProvisioningError
Link copied to clipboard

A connection to a GATT Proxy node.

Link copied to clipboard
data class ProxyConnectionFailed(val reason: String, val recoveryHint: String = "Verify the proxy node is in range and has the proxy feature enabled.") : MeshTransportError
Link copied to clipboard
data class ProxyDisconnected(val reason: String, val recoveryHint: String = "Proxy connection lost. Reconnecting automatically if reconnection strategy is configured.") : MeshTransportError
Link copied to clipboard

Message type carried in a Proxy PDU.

Link copied to clipboard
data class ProxyPdu(val sar: ProxySarType, val messageType: ProxyMessageType, val data: ByteArray)

A Proxy PDU as carried over the GATT Proxy bearer.

Link copied to clipboard

Proxy SAR (Segmentation and Reassembly) type.

Link copied to clipboard
data class TransportPdu(val isSegmented: Boolean, val akf: Boolean, val aid: Int, val seqZero: Int, val segO: Int, val segN: Int, val payload: ByteArray, val transportMic: ByteArray)

A Transport PDU before network-layer encryption.

Functions

Link copied to clipboard
actual fun MeshNetwork(builder: MeshNetworkBuilder.() -> Unit): MeshNetwork

Android implementation of MeshNetwork factory.

expect fun MeshNetwork(builder: MeshNetworkBuilder.() -> Unit): MeshNetwork

Platform-specific factory for MeshNetwork.

actual fun MeshNetwork(builder: MeshNetworkBuilder.() -> Unit): MeshNetwork

iOS implementation of MeshNetwork factory.

actual fun MeshNetwork(builder: MeshNetworkBuilder.() -> Unit): MeshNetwork

JVM implementation -- BLE Mesh is not supported on JVM.