Helper Class Reference  1.1
HomeGenie - Automation Programs' Engine SDK
Public Member Functions | List of all members
MqttClientHelper Class Reference

MQTT client helper. Class instance accessor: MqttClient More...

Public Member Functions

MqttClientHelper Service (string server)
 Sets the MQTT server to use. More...
 
MqttClientHelper Connect (string clientId)
 Connects to the MQTT server using the default port (1883) and the specified client identifier. More...
 
MqttClientHelper Connect (int port, string clientId)
 Connects to the MQTT server using the specified port and client identifier. More...
 
MqttClientHelper Connect (int port, string clientId, Action callback)
 Connects to the MQTT server using the specified port and client identifier and a callback function in case of lost connection. More...
 
MqttClientHelper Disconnect ()
 Disconnects from the MQTT server. More...
 
MqttClientHelper Subscribe (string topic, Action< string, string > callback)
 Subscribe the specified topic. More...
 
MqttClientHelper Publish (string topic, string message)
 Publish a message to the specified topic. More...
 
MqttClientHelper Publish (string topic, byte[] message)
 Publish a message to the specified topic. More...
 
MqttClientHelper WithCredentials (string user, string pass)
 Use provided credentials when connecting. More...
 

Detailed Description

MQTT client helper. Class instance accessor: MqttClient

Member Function Documentation

MqttClientHelper Service ( string  server)

Sets the MQTT server to use.

Parameters
serverMQTT server address.
MqttClientHelper Connect ( string  clientId)

Connects to the MQTT server using the default port (1883) and the specified client identifier.

Parameters
clientIdThe client identifier.
MqttClientHelper Connect ( int  port,
string  clientId 
)

Connects to the MQTT server using the specified port and client identifier.

Parameters
portMQTT server port.
clientIdThe client identifier.
MqttClientHelper Connect ( int  port,
string  clientId,
Action  callback 
)

Connects to the MQTT server using the specified port and client identifier and a callback function in case of lost connection.

Parameters
portMQTT server port.
clientIdThe client identifier.
callbackThe name of callback function, like RefreshConnection

Action RefreshConnection = () => {...}

MqttClientHelper Disconnect ( )

Disconnects from the MQTT server.

MqttClientHelper Subscribe ( string  topic,
Action< string, string >  callback 
)

Subscribe the specified topic.

Parameters
topicTopic name.
callbackCallback for receiving the subscribed topic messages.
MqttClientHelper Publish ( string  topic,
string  message 
)

Publish a message to the specified topic.

Parameters
topicTopic name.
messageMessage text.
MqttClientHelper Publish ( string  topic,
byte[]  message 
)

Publish a message to the specified topic.

Parameters
topicTopic name.
messageMessage text as byte array.
MqttClientHelper WithCredentials ( string  user,
string  pass 
)

Use provided credentials when connecting.

Returns
NetHelper.
Parameters
userUsername.
passPassword.

The documentation for this class was generated from the following file: