From a80bd6cbad8151c11201c6384ba83e51ca65ac0a Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 15 Jul 2019 10:05:29 +0100 Subject: [PATCH] Intelisense improvements (#4) --- M2Mqtt/Exceptions/MqttClientException.cs | 2 +- M2Mqtt/Exceptions/MqttConnectionException.cs | 5 +++ M2Mqtt/MqttSettings.cs | 32 +++++++++++++++----- M2Mqtt/Net/MqttNetworkChannel.cs | 11 ++++++- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/M2Mqtt/Exceptions/MqttClientException.cs b/M2Mqtt/Exceptions/MqttClientException.cs index cd8303fc..45cab48e 100644 --- a/M2Mqtt/Exceptions/MqttClientException.cs +++ b/M2Mqtt/Exceptions/MqttClientException.cs @@ -26,7 +26,7 @@ public class MqttClientException : Exception /// /// Constructor /// - /// Error code + /// Error code public MqttClientException(MqttClientErrorCode errorCode) { this.errorCode = errorCode; diff --git a/M2Mqtt/Exceptions/MqttConnectionException.cs b/M2Mqtt/Exceptions/MqttConnectionException.cs index 3203c7ef..37ebd646 100644 --- a/M2Mqtt/Exceptions/MqttConnectionException.cs +++ b/M2Mqtt/Exceptions/MqttConnectionException.cs @@ -23,6 +23,11 @@ namespace uPLibrary.Networking.M2Mqtt.Exceptions /// public class MqttConnectionException : Exception { + /// + /// Connection to the broker exception + /// + /// A friendly message of the exception that occured + /// Detail on why the exception occured public MqttConnectionException(string message, Exception innerException) : base(message, innerException) { diff --git a/M2Mqtt/MqttSettings.cs b/M2Mqtt/MqttSettings.cs index 516c0d60..046726bc 100644 --- a/M2Mqtt/MqttSettings.cs +++ b/M2Mqtt/MqttSettings.cs @@ -21,19 +21,37 @@ namespace uPLibrary.Networking.M2Mqtt /// public class MqttSettings { - // default port for MQTT protocol + /// + /// Default port for the MQTT protocol + /// public const int MQTT_BROKER_DEFAULT_PORT = 1883; + /// + /// Default SSL port for the MQTT protocol + /// public const int MQTT_BROKER_DEFAULT_SSL_PORT = 8883; - // default timeout on receiving from client + /// + /// Default timeout on receiving from client + /// public const int MQTT_DEFAULT_TIMEOUT = 30000; - // max publish, subscribe and unsubscribe retry for QoS Level 1 or 2 + /// + /// Max publish, subscribe and unsubscribe retry for QoS Level 1 or 2 + /// public const int MQTT_ATTEMPTS_RETRY = 3; - // delay for retry publish, subscribe and unsubscribe for QoS Level 1 or 2 + /// + /// Delay for retry publish, subscribe and unsubscribe for QoS Level 1 or 2 + /// public const int MQTT_DELAY_RETRY = 10000; - // broker need to receive the first message (CONNECT) - // within a reasonable amount of time after TCP/IP connection + /// + /// Connection Timeout + /// + /// + /// The broker needs to receive the first message (CONNECT) + /// within a reasonable amount of time after the initial TCP/IP connection + /// public const int MQTT_CONNECT_TIMEOUT = 30000; - // default inflight queue size + /// + /// The default inflight queue size + /// public const int MQTT_MAX_INFLIGHT_QUEUE_SIZE = int.MaxValue; /// diff --git a/M2Mqtt/Net/MqttNetworkChannel.cs b/M2Mqtt/Net/MqttNetworkChannel.cs index bee7c55f..f11cb69c 100644 --- a/M2Mqtt/Net/MqttNetworkChannel.cs +++ b/M2Mqtt/Net/MqttNetworkChannel.cs @@ -467,6 +467,12 @@ public static AddressFamily GetAddressFamily(this IPAddress ipAddress) /// public static class MqttSslUtility { + /// + /// Defines the possible versions of Secure Sockets Layer (SSL). + /// + /// + /// Note: Following the recommendation of the .NET documentation, nanoFramework implementation does not have SSL3 nor Default because those are deprecated and unsecure. + /// #if (!MF_FRAMEWORK_VERSION_V4_2 && !MF_FRAMEWORK_VERSION_V4_3 && !COMPACT_FRAMEWORK) public static SslProtocols ToSslPlatformEnum(MqttSslProtocols mqttSslProtocol) { @@ -484,7 +490,10 @@ public static SslProtocols ToSslPlatformEnum(MqttSslProtocols mqttSslProtocol) return SslProtocols.Tls11; case MqttSslProtocols.TLSv1_2: return SslProtocols.Tls12; - default: +#if !(NANOFRAMEWORK_1_0) + case MqttSslProtocols.SSLv3: +#endif + default: throw new ArgumentException("SSL/TLS protocol version not supported"); } }