Skip to content

Commit 686a3fa

Browse files
unknownunknown
authored andcommitted
initial commit
1 parent e689a21 commit 686a3fa

File tree

91 files changed

+6622
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+6622
-0
lines changed

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# =============== #
2+
# Unity generated #
3+
# =============== #
4+
Temp/
5+
Obj/
6+
UnityGenerated/
7+
Library/
8+
9+
# ===================================== #
10+
# Visual Studio / MonoDevelop generated #
11+
# ===================================== #
12+
ExportedObj/
13+
*.svd
14+
*.userprefs
15+
*.csproj
16+
*.pidb
17+
*.suo
18+
*.sln
19+
*.user
20+
*.unityproj
21+
*.booproj
22+
23+
# ============ #
24+
# OS generated #
25+
# ============ #
26+
.DS_Store
27+
.DS_Store?
28+
._*
29+
.Trashes
30+
Icon?
31+
ehthumbs.db
32+
Thumbs.db

Assets/MQTT.meta

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MQTT/scripts.meta

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MQTT/scripts/Exceptions.meta

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
M2Mqtt Project - MQTT Client Library for .Net and GnatMQ MQTT Broker for .NET
3+
Copyright (c) 2014, Paolo Patierno, All rights reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 3.0 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library.
17+
*/
18+
19+
using System;
20+
21+
namespace uPLibrary.Networking.M2Mqtt.Exceptions
22+
{
23+
/// <summary>
24+
/// MQTT client exception
25+
/// </summary>
26+
public class MqttClientException : ApplicationException
27+
{
28+
/// <summary>
29+
/// Constructor
30+
/// </summary>
31+
/// <param name="code">Error code</param>
32+
public MqttClientException(MqttClientErrorCode errorCode)
33+
{
34+
this.errorCode = errorCode;
35+
}
36+
37+
// error code
38+
private MqttClientErrorCode errorCode;
39+
40+
/// <summary>
41+
/// Error code
42+
/// </summary>
43+
public MqttClientErrorCode ErrorCode
44+
{
45+
get { return this.errorCode; }
46+
set { this.errorCode = value; }
47+
}
48+
}
49+
50+
/// <summary>
51+
/// MQTT client erroro code
52+
/// </summary>
53+
public enum MqttClientErrorCode
54+
{
55+
/// <summary>
56+
/// Will topic length error
57+
/// </summary>
58+
WillTopicWrong = 1,
59+
60+
/// <summary>
61+
/// Keep alive period too large
62+
/// </summary>
63+
KeepAliveWrong,
64+
65+
/// <summary>
66+
/// Topic contains wildcards
67+
/// </summary>
68+
TopicWildcard,
69+
70+
/// <summary>
71+
/// Topic length wrong
72+
/// </summary>
73+
TopicLength,
74+
75+
/// <summary>
76+
/// QoS level not allowed
77+
/// </summary>
78+
QosNotAllowed,
79+
80+
/// <summary>
81+
/// Topics list empty for subscribe
82+
/// </summary>
83+
TopicsEmpty,
84+
85+
/// <summary>
86+
/// Qos levels list empty for subscribe
87+
/// </summary>
88+
QosLevelsEmpty,
89+
90+
/// <summary>
91+
/// Topics / Qos Levels not match in subscribe
92+
/// </summary>
93+
TopicsQosLevelsNotMatch,
94+
95+
/// <summary>
96+
/// Wrong message from broker
97+
/// </summary>
98+
WrongBrokerMessage,
99+
100+
/// <summary>
101+
/// Wrong Message Id
102+
/// </summary>
103+
WrongMessageId
104+
}
105+
}

Assets/MQTT/scripts/Exceptions/MqttClientException.cs.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
M2Mqtt Project - MQTT Client Library for .Net and GnatMQ MQTT Broker for .NET
3+
Copyright (c) 2014, Paolo Patierno, All rights reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 3.0 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library.
17+
*/
18+
19+
using System;
20+
21+
namespace uPLibrary.Networking.M2Mqtt.Exceptions
22+
{
23+
/// <summary>
24+
/// Exception due to error communication with broker on socket
25+
/// </summary>
26+
public class MqttCommunicationException : ApplicationException
27+
{
28+
/// <summary>
29+
/// Default constructor
30+
/// </summary>
31+
public MqttCommunicationException()
32+
{
33+
}
34+
35+
/// <summary>
36+
/// Constructor
37+
/// </summary>
38+
/// <param name="e">Inner Exception</param>
39+
public MqttCommunicationException(Exception e)
40+
: base(String.Empty, e)
41+
{
42+
}
43+
}
44+
}

Assets/MQTT/scripts/Exceptions/MqttCommunicationException.cs.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
M2Mqtt Project - MQTT Client Library for .Net and GnatMQ MQTT Broker for .NET
3+
Copyright (c) 2014, Paolo Patierno, All rights reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 3.0 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library.
17+
*/
18+
19+
using System;
20+
21+
namespace uPLibrary.Networking.M2Mqtt.Exceptions
22+
{
23+
/// <summary>
24+
/// Connection to the broker exception
25+
/// </summary>
26+
public class MqttConnectionException : ApplicationException
27+
{
28+
public MqttConnectionException(string message, Exception innerException)
29+
: base(message, innerException)
30+
{
31+
}
32+
}
33+
}

Assets/MQTT/scripts/Exceptions/MqttConnectionException.cs.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
M2Mqtt Project - MQTT Client Library for .Net and GnatMQ MQTT Broker for .NET
3+
Copyright (c) 2014, Paolo Patierno, All rights reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 3.0 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library.
17+
*/
18+
19+
using System;
20+
21+
namespace uPLibrary.Networking.M2Mqtt.Exceptions
22+
{
23+
/// <summary>
24+
/// Timeout on receiving from broker exception
25+
/// </summary>
26+
public class MqttTimeoutException : ApplicationException
27+
{
28+
}
29+
}

Assets/MQTT/scripts/Exceptions/MqttTimeoutException.cs.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
M2Mqtt Project - MQTT Client Library for .Net and GnatMQ MQTT Broker for .NET
3+
Copyright (c) 2014, Paolo Patierno, All rights reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 3.0 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library.
17+
*/
18+
19+
using System;
20+
using System.Text;
21+
22+
namespace uPLibrary.Networking.M2Mqtt
23+
{
24+
/// <summary>
25+
/// Interface for channel under MQTT library
26+
/// </summary>
27+
public interface IMqttNetworkChannel
28+
{
29+
/// <summary>
30+
/// Data available on channel
31+
/// </summary>
32+
bool DataAvailable { get; }
33+
34+
/// <summary>
35+
/// Receive data from the network channel
36+
/// </summary>
37+
/// <param name="buffer">Data buffer for receiving data</param>
38+
/// <returns>Number of bytes received</returns>
39+
int Receive(byte[] buffer);
40+
41+
/// <summary>
42+
/// Send data on the network channel to the broker
43+
/// </summary>
44+
/// <param name="buffer">Data buffer to send</param>
45+
/// <returns>Number of byte sent</returns>
46+
int Send(byte[] buffer);
47+
48+
/// <summary>
49+
/// Close the network channel
50+
/// </summary>
51+
void Close();
52+
53+
/// <summary>
54+
/// Connect to remote server
55+
/// </summary>
56+
void Connect();
57+
}
58+
}

Assets/MQTT/scripts/IMqttNetworkChannel.cs.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MQTT/scripts/Messages.meta

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)