|
M2MqttUnity
1.0
M2MQTT for Unity
|
Script for testing M2MQTT with a Unity UI More...
Public Member Functions | |
| void | TestPublish () |
| void | SetBrokerAddress (string brokerAddress) |
| void | SetBrokerPort (string brokerPort) |
| void | SetEncrypted (bool isEncrypted) |
| void | SetUiMessage (string msg) |
| void | AddUiMessage (string msg) |
Public Member Functions inherited from M2MqttUnity.M2MqttUnityClient | |
| virtual void | Connect () |
| Connect to the broker using current settings. More... | |
| virtual void | Disconnect () |
| Disconnect from the broker, if connected. More... | |
Public Attributes | |
| bool | autoTest = false |
| InputField | consoleInputField |
| Toggle | encryptedToggle |
| InputField | addressInputField |
| InputField | portInputField |
| Button | connectButton |
| Button | disconnectButton |
| Button | testPublishButton |
| Button | clearButton |
Public Attributes inherited from M2MqttUnity.M2MqttUnityClient | |
| string | brokerAddress = "localhost" |
| int | brokerPort = 1883 |
| bool | isEncrypted = false |
| int | connectionDelay = 500 |
| int | timeoutOnConnection = MqttSettings.MQTT_CONNECT_TIMEOUT |
| bool | autoConnect = false |
Protected Member Functions | |
| override void | OnConnecting () |
| Ovverride this method to take some actions before connection (e.g. More... | |
| override void | OnConnected () |
| Override this method to take some actions if the connection succeeded. More... | |
| override void | SubscribeTopics () |
| Ovverride this method to subscribe to MQTT topics. More... | |
| override void | UnsubscribeTopics () |
| Ovverride this method to unsubscribe to MQTT topics (they should be the same you subscribed to with SubscribeTopics() ). More... | |
| override void | OnConnectionFailed (string errorMessage) |
| Override this method to take some actions if the connection failed. More... | |
| override void | OnDisconnected () |
| Override this method to take some actions when disconnected. More... | |
| override void | OnConnectionLost () |
| Override this method to take some actions when the connection is closed. More... | |
| override void | Start () |
| Connect on startup if autoConnect is set to true. More... | |
| override void | DecodeMessage (string topic, byte[] message) |
| Override this method for each received message you need to process. More... | |
| override void | Update () |
| Processing of income messages and events is postponed here in the main thread. More... | |
Protected Member Functions inherited from M2MqttUnity.M2MqttUnityClient | |
| 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 | ProcessMqttEvents () |
Additional Inherited Members | |
Protected Attributes inherited from M2MqttUnity.M2MqttUnityClient | |
| MqttClient | client |
| Wrapped MQTT client More... | |
Events inherited from M2MqttUnity.M2MqttUnityClient | |
| Action | ConnectionSucceeded |
| Event fired when a connection is successfully estabilished More... | |
| Action | ConnectionFailed |
| Event fired when failing to connect More... | |
Script for testing M2MQTT with a Unity UI
| void M2MqttUnity.Examples.M2MqttUnityTest.AddUiMessage | ( | string | msg | ) |
|
protectedvirtual |
Override this method for each received message you need to process.
Reimplemented from M2MqttUnity.M2MqttUnityClient.
|
protectedvirtual |
Override this method to take some actions if the connection succeeded.
Reimplemented from M2MqttUnity.M2MqttUnityClient.
|
protectedvirtual |
Ovverride this method to take some actions before connection (e.g.
display a message)
Reimplemented from M2MqttUnity.M2MqttUnityClient.
|
protectedvirtual |
Override this method to take some actions if the connection failed.
Reimplemented from M2MqttUnity.M2MqttUnityClient.
|
protectedvirtual |
Override this method to take some actions when the connection is closed.
Reimplemented from M2MqttUnity.M2MqttUnityClient.
|
protectedvirtual |
Override this method to take some actions when disconnected.
Reimplemented from M2MqttUnity.M2MqttUnityClient.
| void M2MqttUnity.Examples.M2MqttUnityTest.SetBrokerAddress | ( | string | brokerAddress | ) |
| void M2MqttUnity.Examples.M2MqttUnityTest.SetBrokerPort | ( | string | brokerPort | ) |
| void M2MqttUnity.Examples.M2MqttUnityTest.SetEncrypted | ( | bool | isEncrypted | ) |
| void M2MqttUnity.Examples.M2MqttUnityTest.SetUiMessage | ( | string | msg | ) |
|
protectedvirtual |
Connect on startup if autoConnect is set to true.
Reimplemented from M2MqttUnity.M2MqttUnityClient.
|
protectedvirtual |
Ovverride this method to subscribe to MQTT topics.
Reimplemented from M2MqttUnity.M2MqttUnityClient.
| void M2MqttUnity.Examples.M2MqttUnityTest.TestPublish | ( | ) |
|
protectedvirtual |
Ovverride this method to unsubscribe to MQTT topics (they should be the same you subscribed to with SubscribeTopics() ).
Reimplemented from M2MqttUnity.M2MqttUnityClient.
|
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 from M2MqttUnity.M2MqttUnityClient.
| InputField M2MqttUnity.Examples.M2MqttUnityTest.addressInputField |
| bool M2MqttUnity.Examples.M2MqttUnityTest.autoTest = false |
| Button M2MqttUnity.Examples.M2MqttUnityTest.clearButton |
| Button M2MqttUnity.Examples.M2MqttUnityTest.connectButton |
| InputField M2MqttUnity.Examples.M2MqttUnityTest.consoleInputField |
| Button M2MqttUnity.Examples.M2MqttUnityTest.disconnectButton |
| Toggle M2MqttUnity.Examples.M2MqttUnityTest.encryptedToggle |
| InputField M2MqttUnity.Examples.M2MqttUnityTest.portInputField |
| Button M2MqttUnity.Examples.M2MqttUnityTest.testPublishButton |