MQttConnection

AUTHOR
Version 
Sat Apr 16 2022 

Table of Contents

Table of contents

Namespace Index
Packages
Here are the packages with brief descriptions (if available):
MQttConnection  	pagenum

Hierarchical Index
Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically:
MQttConnection.Connector	pagenum
EventArgs
MQttConnection.Message	pagenum

Data Structure Index
Data Structures
Here are the data structures with brief descriptions:
MQttConnection.Connector (CLass Connector to connect MQTT Server ) 	pagenum
MQttConnection.Message  	pagenum

File Index
File List
Here is a list of all files with brief descriptions:
Connector.cs  	pagenum
Message.cs  	pagenum
obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs  	pagenum
obj/Debug/net6.0/MQttConnection.AssemblyInfo.cs  	pagenum
obj/Debug/net6.0/MQttConnection.GlobalUsings.g.cs  	pagenum
obj/Release/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs  	pagenum
obj/Release/net6.0/MQttConnection.AssemblyInfo.cs  	pagenum
obj/Release/net6.0/MQttConnection.GlobalUsings.g.cs  	pagenum

Namespace Documentation
MQttConnection Namespace Reference
Data Structures
class Connector
CLass Connector to connect MQTT Server class Message

Data Structure Documentation
MQttConnection.Connector Class Reference

CLass Connector to connect MQTT Server 
Public Member Functions
delegate void MessageHandler (Connector c, Message e)
Connector ()
default constructor 
Connector (string host, int port)
constructor with parameters 
Connector (string host, int port, string username, string password)
constructor with parameters 
async Task Initialize ()
Start Mqtt connection 
async Task< bool > CloseConnection ()
Close Mqtt connection 
async void UnsubscribeTopic (string topic)
Unsubscribe Mqtt Topic 
async void SubscribeTopic (string topic)
Subscribe Mqtt Topic 
async Task PublishAsync (string topic, string payload, bool retainFlag=true, int qos=1)
Publish asynchronusly 
Static Public Attributes
static IMqttClient client = new MqttFactory().CreateMqttClient()
Properties
string Host [get, set]
int Port [get, set]
string Payload [get, set]
bool Tls [get, set]
string topic [get, set]
string clientid [get, set]
Events
MessageHandler messagehandler
Private Member Functions
void ConnectionHandler (MqttClientConnectedEventArgs e)
Handler for connection 
void DisconnectHandler (MqttClientDisconnectedEventArgs e)
Handler for disconnection 
void MessageRecieved (MqttApplicationMessageReceivedEventArgs mq_message)
Message Handler 
IMqttClientOptions BuildClientOptions ()
Option Builder 
Private Attributes
string _host
int _port
bool _tls = true
string _username
string _password
string _payload
string _topic
string _clientid = "Client"
Static Private Attributes
static MqttClientOptionsBuilder mqttClientOptionsBuilder = new MqttClientOptionsBuilder()

Detailed Description
CLass Connector to connect MQTT Server 

Definition at line 14 of file Connector.cs.

Constructor & Destructor Documentation
MQttConnection.Connector.Connector ()

default constructor 

Definition at line 41 of file Connector.cs.
MQttConnection.Connector.Connector (string  host, int  port)

constructor with parameters 

Parameters:
host 	MQTT Hostname	
port 	Port	
Definition at line 53 of file Connector.cs.
MQttConnection.Connector.Connector (string  host, int  port, string  username, string  password)

constructor with parameters 

Parameters:
host 	MQTT Hostname	
port 	Port	
username 	Username	
password 	Password	
Definition at line 67 of file Connector.cs.

Member Function Documentation
IMqttClientOptions MQttConnection.Connector.BuildClientOptions ()[private]

Option Builder 

Returns:
IMqttClientOptions
Exceptions:
ArgumentException 		
Definition at line 185 of file Connector.cs.
async Task<bool> MQttConnection.Connector.CloseConnection ()

Close Mqtt connection 

Returns:
async Task of bool type</bool>
Definition at line 102 of file Connector.cs.
void MQttConnection.Connector.ConnectionHandler (MqttClientConnectedEventArgs  e)[private]

Handler for connection 

Parameters:
e 	Returns MqttClientConnectedEventArgs 	
Definition at line 147 of file Connector.cs.
void MQttConnection.Connector.DisconnectHandler (MqttClientDisconnectedEventArgs  e)[private]

Handler for disconnection 

Parameters:
e 	Returns MqttClientDisconnectedEventArgs	
Definition at line 160 of file Connector.cs.
async Task MQttConnection.Connector.Initialize ()

Start Mqtt connection 

Returns:
async Task
Definition at line 80 of file Connector.cs.
delegate void MQttConnection.Connector.MessageHandler (Connector  c, Message  e)
void MQttConnection.Connector.MessageRecieved (MqttApplicationMessageReceivedEventArgs  mq_message)[private]

Message Handler 

Parameters:
mq_message 	Message of type MqttApplicationMessageReceivedEventArgs	
Definition at line 171 of file Connector.cs.
async Task MQttConnection.Connector.PublishAsync (string  topic, string  payload, bool  retainFlag = true, int  qos = 1)

Publish asynchronusly 

Parameters:
topic 	Topic to publish	
payload 	Payload	
retainFlag 	default true	
qos 	default 1	
Returns:
async Task
async void MQttConnection.Connector.SubscribeTopic (string  topic)

Subscribe Mqtt Topic 

Parameters:
topic 	Topic to subscribe	
Definition at line 122 of file Connector.cs.
async void MQttConnection.Connector.UnsubscribeTopic (string  topic)

Unsubscribe Mqtt Topic 

Parameters:
topic 	Topic to unsubscribe	
Definition at line 112 of file Connector.cs.

Field Documentation
string MQttConnection.Connector._clientid = "Client"[private]

Definition at line 23 of file Connector.cs.
string MQttConnection.Connector._host[private]

Definition at line 16 of file Connector.cs.
string MQttConnection.Connector._password[private]

Definition at line 20 of file Connector.cs.
string MQttConnection.Connector._payload[private]

Definition at line 21 of file Connector.cs.
int MQttConnection.Connector._port[private]

Definition at line 17 of file Connector.cs.
bool MQttConnection.Connector._tls = true[private]

Definition at line 18 of file Connector.cs.
string MQttConnection.Connector._topic[private]

Definition at line 22 of file Connector.cs.
string MQttConnection.Connector._username[private]

Definition at line 19 of file Connector.cs.
IMqttClient MQttConnection.Connector.client = new MqttFactory().CreateMqttClient()[static]

Definition at line 26 of file Connector.cs.
MqttClientOptionsBuilder MQttConnection.Connector.mqttClientOptionsBuilder = new MqttClientOptionsBuilder()[static], [private]

Definition at line 36 of file Connector.cs.

Property Documentation
string MQttConnection.Connector.clientid[get], [set]

Definition at line 33 of file Connector.cs.
string MQttConnection.Connector.Host[get], [set]

Definition at line 28 of file Connector.cs.
string MQttConnection.Connector.Payload[get], [set]

Definition at line 30 of file Connector.cs.
int MQttConnection.Connector.Port[get], [set]

Definition at line 29 of file Connector.cs.
bool MQttConnection.Connector.Tls[get], [set]

Definition at line 31 of file Connector.cs.
string MQttConnection.Connector.topic[get], [set]

Definition at line 32 of file Connector.cs.

Event Documentation
MessageHandler MQttConnection.Connector.messagehandler

Definition at line 24 of file Connector.cs.

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

MQttConnection.Message Class Reference
Inheritance diagram for MQttConnection.Message:
IMAGE
Public Member Functions
override string ToString ()
Properties
string EventMessage [get, set]
Private Attributes
string _eventMessage = ""

Detailed Description
Definition at line 5 of file Message.cs.

Member Function Documentation
override string MQttConnection.Message.ToString ()

Definition at line 14 of file Message.cs.

Field Documentation
string MQttConnection.Message._eventMessage = ""[private]

Definition at line 7 of file Message.cs.

Property Documentation
string MQttConnection.Message.EventMessage[get], [set]

Definition at line 9 of file Message.cs.

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

File Documentation
Connector.cs File Reference
Data Structures
class MQttConnection.Connector
CLass Connector to connect MQTT Server Namespaces
namespace MQttConnection

Message.cs File Reference
Data Structures
class MQttConnection.Message
Namespaces
namespace MQttConnection

obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs File Reference

obj/Release/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs File Reference

obj/Debug/net6.0/MQttConnection.AssemblyInfo.cs File Reference

obj/Release/net6.0/MQttConnection.AssemblyInfo.cs File Reference

obj/Debug/net6.0/MQttConnection.GlobalUsings.g.cs File Reference

obj/Release/net6.0/MQttConnection.GlobalUsings.g.cs File Reference

Index
INDEX