ModelEventHandler

abstract class ModelEventHandler

Defines the functionality of a Model on the Local Node.

This event handler is assigned to the models when setting up the MeshNetworkManager.localElements.

The event handler must declare a map of mesh message type supported by this Model. Whenever a message matching any of the declared op codes is received, and the model is bound to an Application Key used to encrypt the message, one of the following events can be observed using the modelEventFlow depending on the type of the message.

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Defines the model supports subscription.

Link copied to clipboard
abstract val meshNetwork: MeshNetwork
Link copied to clipboard

Map of supported message types.

Link copied to clipboard
val modelEventFlow: SharedFlow<ModelEvent>

Flow of model events.

Link copied to clipboard

Lambda function that returns a MeshMessage to be published.

Functions

Link copied to clipboard
suspend fun publish(manager: MeshNetworkManager): MessageHandle?
suspend fun publish(message: MeshMessage, manager: MeshNetworkManager): MessageHandle?