add netcore and refactoring

This commit is contained in:
2019-11-26 15:34:16 +01:00
parent 57f343c908
commit bd6472e5e4
47 changed files with 4897 additions and 5569 deletions
+96 -109
View File
@@ -16,117 +16,104 @@ Contributors:
using System;
namespace uPLibrary.Networking.M2Mqtt.Exceptions
{
namespace uPLibrary.Networking.M2Mqtt.Exceptions {
/// <summary>
/// MQTT client exception
/// </summary>
public class MqttClientException : Exception {
/// <summary>
/// MQTT client exception
/// Constructor
/// </summary>
public class MqttClientException : Exception
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="code">Error code</param>
public MqttClientException(MqttClientErrorCode errorCode)
{
this.errorCode = errorCode;
}
// error code
private MqttClientErrorCode errorCode;
/// <summary>
/// Error code
/// </summary>
public MqttClientErrorCode ErrorCode
{
get { return this.errorCode; }
set { this.errorCode = value; }
}
}
/// <param name="code">Error code</param>
public MqttClientException(MqttClientErrorCode errorCode) => this.ErrorCode = errorCode;
/// <summary>
/// MQTT client erroro code
/// Error code
/// </summary>
public enum MqttClientErrorCode
{
/// <summary>
/// Will error (topic, message or QoS level)
/// </summary>
WillWrong = 1,
/// <summary>
/// Keep alive period too large
/// </summary>
KeepAliveWrong,
/// <summary>
/// Topic contains wildcards
/// </summary>
TopicWildcard,
/// <summary>
/// Topic length wrong
/// </summary>
TopicLength,
/// <summary>
/// QoS level not allowed
/// </summary>
QosNotAllowed,
/// <summary>
/// Topics list empty for subscribe
/// </summary>
TopicsEmpty,
/// <summary>
/// Qos levels list empty for subscribe
/// </summary>
QosLevelsEmpty,
/// <summary>
/// Topics / Qos Levels not match in subscribe
/// </summary>
TopicsQosLevelsNotMatch,
/// <summary>
/// Wrong message from broker
/// </summary>
WrongBrokerMessage,
/// <summary>
/// Wrong Message Id
/// </summary>
WrongMessageId,
/// <summary>
/// Inflight queue is full
/// </summary>
InflightQueueFull,
// [v3.1.1]
/// <summary>
/// Invalid flag bits received
/// </summary>
InvalidFlagBits,
// [v3.1.1]
/// <summary>
/// Invalid connect flags received
/// </summary>
InvalidConnectFlags,
// [v3.1.1]
/// <summary>
/// Invalid client id
/// </summary>
InvalidClientId,
// [v3.1.1]
/// <summary>
/// Invalid protocol name
/// </summary>
InvalidProtocolName
}
public MqttClientErrorCode ErrorCode { get; set; }
}
/// <summary>
/// MQTT client erroro code
/// </summary>
public enum MqttClientErrorCode {
/// <summary>
/// Will error (topic, message or QoS level)
/// </summary>
WillWrong = 1,
/// <summary>
/// Keep alive period too large
/// </summary>
KeepAliveWrong,
/// <summary>
/// Topic contains wildcards
/// </summary>
TopicWildcard,
/// <summary>
/// Topic length wrong
/// </summary>
TopicLength,
/// <summary>
/// QoS level not allowed
/// </summary>
QosNotAllowed,
/// <summary>
/// Topics list empty for subscribe
/// </summary>
TopicsEmpty,
/// <summary>
/// Qos levels list empty for subscribe
/// </summary>
QosLevelsEmpty,
/// <summary>
/// Topics / Qos Levels not match in subscribe
/// </summary>
TopicsQosLevelsNotMatch,
/// <summary>
/// Wrong message from broker
/// </summary>
WrongBrokerMessage,
/// <summary>
/// Wrong Message Id
/// </summary>
WrongMessageId,
/// <summary>
/// Inflight queue is full
/// </summary>
InflightQueueFull,
// [v3.1.1]
/// <summary>
/// Invalid flag bits received
/// </summary>
InvalidFlagBits,
// [v3.1.1]
/// <summary>
/// Invalid connect flags received
/// </summary>
InvalidConnectFlags,
// [v3.1.1]
/// <summary>
/// Invalid client id
/// </summary>
InvalidClientId,
// [v3.1.1]
/// <summary>
/// Invalid protocol name
/// </summary>
InvalidProtocolName
}
}
+17 -21
View File
@@ -16,27 +16,23 @@ Contributors:
using System;
namespace uPLibrary.Networking.M2Mqtt.Exceptions
{
namespace uPLibrary.Networking.M2Mqtt.Exceptions {
/// <summary>
/// Exception due to error communication with broker on socket
/// </summary>
public class MqttCommunicationException : Exception {
/// <summary>
/// Exception due to error communication with broker on socket
/// Default constructor
/// </summary>
public class MqttCommunicationException : Exception
{
/// <summary>
/// Default constructor
/// </summary>
public MqttCommunicationException()
{
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="e">Inner Exception</param>
public MqttCommunicationException(Exception e)
: base(String.Empty, e)
{
}
}
public MqttCommunicationException() {
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="e">Inner Exception</param>
public MqttCommunicationException(Exception e)
: base(String.Empty, e) {
}
}
}
+9 -12
View File
@@ -16,16 +16,13 @@ Contributors:
using System;
namespace uPLibrary.Networking.M2Mqtt.Exceptions
{
/// <summary>
/// Connection to the broker exception
/// </summary>
public class MqttConnectionException : Exception
{
public MqttConnectionException(string message, Exception innerException)
: base(message, innerException)
{
}
}
namespace uPLibrary.Networking.M2Mqtt.Exceptions {
/// <summary>
/// Connection to the broker exception
/// </summary>
public class MqttConnectionException : Exception {
public MqttConnectionException(String message, Exception innerException)
: base(message, innerException) {
}
}
}
+6 -8
View File
@@ -16,12 +16,10 @@ Contributors:
using System;
namespace uPLibrary.Networking.M2Mqtt.Exceptions
{
/// <summary>
/// Timeout on receiving from broker exception
/// </summary>
public class MqttTimeoutException : Exception
{
}
namespace uPLibrary.Networking.M2Mqtt.Exceptions {
/// <summary>
/// Timeout on receiving from broker exception
/// </summary>
public class MqttTimeoutException : Exception {
}
}