|
M2MqttUnity
1.0
M2MQTT for Unity
|
Generic MonoBehavior wrapping a MQTT client, using a double buffer to postpone message processing in the main thread. More...
Public Member Functions | |
| virtual void | Connect () |
| Connect to the broker using current settings. More... | |
| virtual void | Disconnect () |
| Disconnect from the broker, if connected. More... | |
Public Attributes | |
| string | brokerAddress = "localhost" |
| int | brokerPort = 1883 |
| bool | isEncrypted = false |
| int | connectionDelay = 500 |
| int | timeoutOnConnection = MqttSettings.MQTT_CONNECT_TIMEOUT |
| bool | autoConnect = false |
Protected Member Functions | |
| virtual void | OnConnecting () |
| Ovverride this method to take some actions before connection (e.g. More... | |
| virtual void | OnConnected () |
| Override this method to take some actions if the connection succeeded. More... | |
| virtual void | OnConnectionFailed (string errorMessage) |
| Override this method to take some actions if the connection failed. More... | |
| virtual void | SubscribeTopics () |
| Ovverride this method to subscribe to MQTT topics. More... | |
| virtual void | UnsubscribeTopics () |
| Ovverride this method to unsubscribe to MQTT topics (they should be the same you subscribed to with SubscribeTopics() ). More... | |
| virtual void | OnApplicationQuit () |
| Disconnect before the application quits. More... | |
| virtual void | Awake () |
| Initialize MQTT message queue Remember to call base.Awake() if you override this method. More... | |
| virtual void | Start () |
| Connect on startup if autoConnect is set to true. More... | |
| virtual void | DecodeMessage (string topic, byte[] message) |
| Override this method for each received message you need to process. More... | |
| virtual void | OnDisconnected () |
| Override this method to take some actions when disconnected. More... | |
| virtual void | OnConnectionLost () |
| Override this method to take some actions when the connection is closed. More... | |
| virtual void | Update () |
| Processing of income messages and events is postponed here in the main thread. More... | |
| virtual void | ProcessMqttEvents () |
Protected Attributes | |
| MqttClient | client |
| Wrapped MQTT client More... | |
Events | |
| Action | ConnectionSucceeded |
| Event fired when a connection is successfully estabilished More... | |
| Action | ConnectionFailed |
| Event fired when failing to connect More... | |
Generic MonoBehavior wrapping a MQTT client, using a double buffer to postpone message processing in the main thread.
|
protectedvirtual |
Initialize MQTT message queue Remember to call base.Awake() if you override this method.
|
virtual |
Connect to the broker using current settings.
|
protectedvirtual |
Override this method for each received message you need to process.
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
virtual |
Disconnect from the broker, if connected.
|
protectedvirtual |
Disconnect before the application quits.
|
protectedvirtual |
Override this method to take some actions if the connection succeeded.
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
protectedvirtual |
Ovverride this method to take some actions before connection (e.g.
display a message)
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
protectedvirtual |
Override this method to take some actions if the connection failed.
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
protectedvirtual |
Override this method to take some actions when the connection is closed.
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
protectedvirtual |
Override this method to take some actions when disconnected.
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
protectedvirtual |
|
protectedvirtual |
Connect on startup if autoConnect is set to true.
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
protectedvirtual |
Ovverride this method to subscribe to MQTT topics.
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
protectedvirtual |
Ovverride this method to unsubscribe to MQTT topics (they should be the same you subscribed to with SubscribeTopics() ).
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
|
protectedvirtual |
Processing of income messages and events is postponed here in the main thread.
Remember to call ProcessMqttEvents() in Update() method if you override it.
Reimplemented in M2MqttUnity.Examples.M2MqttUnityTest.
| bool M2MqttUnity.M2MqttUnityClient.autoConnect = false |
| string M2MqttUnity.M2MqttUnityClient.brokerAddress = "localhost" |
| int M2MqttUnity.M2MqttUnityClient.brokerPort = 1883 |
|
protected |
Wrapped MQTT client
| int M2MqttUnity.M2MqttUnityClient.connectionDelay = 500 |
| bool M2MqttUnity.M2MqttUnityClient.isEncrypted = false |
| int M2MqttUnity.M2MqttUnityClient.timeoutOnConnection = MqttSettings.MQTT_CONNECT_TIMEOUT |
| Action M2MqttUnity.M2MqttUnityClient.ConnectionFailed |
Event fired when failing to connect
| Action M2MqttUnity.M2MqttUnityClient.ConnectionSucceeded |
Event fired when a connection is successfully estabilished