MeshNetworkManager

class MeshNetworkManager(storage: Storage, networkProperties: NetworkPropertiesStorage, scope: CoroutineScope)

MeshNetworkManager is the entry point to the Mesh library.

Parameters

storage

Custom storage option allowing users to save the mesh network to a custom location.

networkProperties

Custom storage option allowing users to save the sequence number.

scope

The scope in which the mesh network will be created.

Constructors

Link copied to clipboard
constructor(storage: Storage, networkProperties: NetworkPropertiesStorage, scope: CoroutineScope)

Properties

Link copied to clipboard
Link copied to clipboard

The logger is responsible for logging mesh messages.

Link copied to clipboard

Mesh bearer is responsible for sending and receiving mesh messages.

Link copied to clipboard
val meshNetwork: SharedFlow<MeshNetwork>

Functions

Link copied to clipboard
suspend fun create(name: String = "Mesh Network", uuid: UUID = UUID.randomUUID(), provisionerName: String = "Mesh Provisioner"): MeshNetwork

Creates a Mesh Network with a given name and a UUID. If a UUID is not provided a random will be generated.

suspend fun create(name: String = "Mesh Network", uuid: UUID = UUID.randomUUID(), provisioner: Provisioner): MeshNetwork
Link copied to clipboard
suspend fun export(configuration: NetworkConfiguration = NetworkConfiguration.Full): ByteArray?

Exports a mesh network to a Json defined by the Mesh Configuration Database Profile based on the given configuration.

Link copied to clipboard
suspend fun import(array: ByteArray): MeshNetwork

Imports a Mesh Network from a byte array containing a Json defined by the Mesh Configuration Database profile.

Link copied to clipboard
suspend fun load(): Boolean

Loads the network from the storage provided by the user.

Link copied to clipboard
suspend fun publish(message: MeshMessage, model: Model): MessageHandle?

This method tries to publish the given message using the publication information set in the Model.

Link copied to clipboard
suspend fun save()

Saves the network in the local storage provided by the user.

Link copied to clipboard
suspend fun send(message: ProxyConfigurationMessage)

Sends the Proxy Configuration Message to the connected Proxy Node.

suspend fun send(message: AcknowledgedConfigMessage, destination: Address, initialTtl: UByte? = null): MeshMessage?

Sends Configuration Message to the Node with given destination Address.

suspend fun send(message: AcknowledgedConfigMessage, node: Node, initialTtl: UByte?): MeshMessage?

Sends a Configuration Message to the primary Element on the given Node and returns the received response.

suspend fun send(message: UnacknowledgedConfigMessage, destination: Address, initialTtl: UByte?)

Sends a Configuration Message to the Node with given destination address and returns the received response.

suspend fun send(message: UnacknowledgedConfigMessage, node: Node, initialTtl: UByte?)

Sends a Configuration Message to the primary Element on the given Node.

suspend fun send(message: AcknowledgedMeshMessage, localElement: Element?, model: Model, initialTtl: UByte?): MeshMessage?

Encrypts the message with the first Application Key bound to the given Model and a Network Key bound to it, and sends it to the Node to which the Model belongs to and returns the response.

suspend fun send(message: AcknowledgedMeshMessage, localModel: Model, model: Model, initialTtl: UByte?): MeshMessage

Encrypts the message with the common Application Key bound to both given Models and a Network Key bound to it, and sends it to the Node to which the target Model belongs to.

suspend fun send(message: UnacknowledgedMeshMessage, localElement: Element, model: Model, initialTtl: UByte?)

Encrypts the message with the first Application Key bound to the given Model and the Network Key bound to it, and sends it to the Node to which the Model belongs to.

suspend fun send(message: UnacknowledgedMeshMessage, localModel: Model, model: Model, initialTtl: UByte?)

Encrypts the message with the common Application Key bound to both given Models and the Network Key bound to it, and sends it to the Node to which the target Model belongs to.

suspend fun send(message: MeshMessage, localElement: Element, group: Group, initialTtl: UByte?, key: ApplicationKey)

Encrypts the message with the Application Key and a Network Key bound to it, and sends to the given Group.

suspend fun send(message: MeshMessage, localElement: Element?, destination: MeshAddress, initialTtl: UByte?, applicationKey: ApplicationKey)

Encrypts the message with the Application Key and the Network Key bound to it, and sends to the given destination address.

Link copied to clipboard

Sends the Configuration Message to the primary Element of the local Node and returns the received response.