diff --git a/Build/MQTTnet.AspNetCore.nuspec b/Build/MQTTnet.AspNetCore.nuspec index 4245077..30abe1c 100644 --- a/Build/MQTTnet.AspNetCore.nuspec +++ b/Build/MQTTnet.AspNetCore.nuspec @@ -2,7 +2,7 @@ MQTTnet.AspNetCore - 2.7.5 + 0.0.0 Christian Kratky Christian Kratky https://github.com/chkr1011/MQTTnet/blob/master/LICENSE @@ -10,13 +10,13 @@ https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png false This is a support library to integrate MQTTnet into AspNetCore. - * Updated to MQTTnet 2.7.5. + * Updated to MQTTnet 2.8.0. Copyright Christian Kratky 2016-2018 MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin - + diff --git a/Build/MQTTnet.Extensions.ManagedClient.nuspec b/Build/MQTTnet.Extensions.ManagedClient.nuspec new file mode 100644 index 0000000..10835bf --- /dev/null +++ b/Build/MQTTnet.Extensions.ManagedClient.nuspec @@ -0,0 +1,53 @@ + + + + MQTTnet.Extensions.ManagedClient + 0.0.0 + Christian Kratky + Christian Kratky + https://github.com/chkr1011/MQTTnet/blob/master/LICENSE + https://github.com/chkr1011/MQTTnet + https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png + false + This is an extension library which provides a managed MQTT client with additional features using MQTTnet. + * Updated to MQTTnet 2.8.0. + + Copyright Christian Kratky 2016-2018 + MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/MQTTnet.Extensions.Rpc.nuspec b/Build/MQTTnet.Extensions.Rpc.nuspec index 8bca0b5..f1e2d3a 100644 --- a/Build/MQTTnet.Extensions.Rpc.nuspec +++ b/Build/MQTTnet.Extensions.Rpc.nuspec @@ -2,46 +2,46 @@ MQTTnet.Extensions.Rpc - 2.7.5 + 0.0.0 Christian Kratky Christian Kratky https://github.com/chkr1011/MQTTnet/blob/master/LICENSE https://github.com/chkr1011/MQTTnet https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png false - This is a extension library which allows executing synchronous device calls including a response using MQTTnet. - * Updated to MQTTnet 2.7.5. + This is an extension library which allows executing synchronous device calls including a response using MQTTnet. + * Updated to MQTTnet 2.8.0. Copyright Christian Kratky 2016-2018 MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin - + - + - + - + - + - + - + - + diff --git a/Build/MQTTnet.nuspec b/Build/MQTTnet.nuspec index e55f08f..8e09d92 100644 --- a/Build/MQTTnet.nuspec +++ b/Build/MQTTnet.nuspec @@ -2,7 +2,7 @@ MQTTnet - 2.8.0 + 0.0.0 Christian Kratky Christian Kratky https://github.com/chkr1011/MQTTnet/blob/master/LICENSE @@ -17,6 +17,9 @@ * [Core] The adapter now has an _Endpoint_ definition as string containing remote IP and port. * [Client] Received messages are now processed completely in the worker thread without creating new Tasks. * [Client] Fixed wrong calculation for sending keep alive packets (thanks to @cstichlberger) +* [Client] A clean disconnect (via DisconnectAsync) will no longer throw an exception. +* [ManagedClient] The managed client is moved to a separate nuget package. +* [ManagedClient] Added an own message format with extended properties like ID. * [ManagedClient] Fixed a loading issue of stored application messages (thanks to @JTrotta). * [Server] Added support for other WebSocket sub protocol formats like mqttv-3.1.1 (thanks to @israellot). * [Server] The takeover of an existing client sessions is now treated as a _clean_ disconnect of the previous client. diff --git a/Build/build.ps1 b/Build/build.ps1 index 021858f..1009db0 100644 --- a/Build/build.ps1 +++ b/Build/build.ps1 @@ -26,10 +26,18 @@ if ($path) { &$msbuild ..\Extensions\MQTTnet.Extensions.Rpc\MQTTnet.Extensions.Rpc.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="netstandard2.0" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=".\..\..\Build\codeSigningKey.pfx" &$msbuild ..\Extensions\MQTTnet.Extensions.Rpc\MQTTnet.Extensions.Rpc.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="uap10.0" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=".\..\..\Build\codeSigningKey.pfx" - Remove-Item .\NuGet -Force -Recurse -ErrorAction SilentlyContinue + # Build the Managed Client extension + &$msbuild ..\Extensions\MQTTnet.Extensions.ManagedClient\MQTTnet.Extensions.ManagedClient.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="net452" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=".\..\..\Build\codeSigningKey.pfx" + &$msbuild ..\Extensions\MQTTnet.Extensions.ManagedClient\MQTTnet.Extensions.ManagedClient.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="net461" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=".\..\..\Build\codeSigningKey.pfx" + &$msbuild ..\Extensions\MQTTnet.Extensions.ManagedClient\MQTTnet.Extensions.ManagedClient.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="netstandard1.3" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=".\..\..\Build\codeSigningKey.pfx" + &$msbuild ..\Extensions\MQTTnet.Extensions.ManagedClient\MQTTnet.Extensions.ManagedClient.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="netstandard2.0" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=".\..\..\Build\codeSigningKey.pfx" + &$msbuild ..\Extensions\MQTTnet.Extensions.ManagedClient\MQTTnet.Extensions.ManagedClient.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="uap10.0" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=".\..\..\Build\codeSigningKey.pfx" + + Remove-Item .\NuGet -Force -Recurse -ErrorAction SilentlyContinue New-Item -ItemType Directory -Force -Path .\NuGet .\NuGet.exe pack MQTTnet.nuspec -Verbosity detailed -Symbols -OutputDir "NuGet" -Version $nugetVersion .\NuGet.exe pack MQTTnet.AspNetCore.nuspec -Verbosity detailed -Symbols -OutputDir "NuGet" -Version $nugetVersion .\NuGet.exe pack MQTTnet.Extensions.Rpc.nuspec -Verbosity detailed -Symbols -OutputDir "NuGet" -Version $nugetVersion + .\NuGet.exe pack MQTTnet.Extensions.ManagedClient.nuspec -Verbosity detailed -Symbols -OutputDir "NuGet" -Version $nugetVersion } \ No newline at end of file diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/ApplicationMessageProcessedEventArgs.cs b/Extensions/MQTTnet.Extensions.ManagedClient/ApplicationMessageProcessedEventArgs.cs similarity index 93% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/ApplicationMessageProcessedEventArgs.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/ApplicationMessageProcessedEventArgs.cs index fa82c0a..6bc7004 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/ApplicationMessageProcessedEventArgs.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/ApplicationMessageProcessedEventArgs.cs @@ -1,6 +1,6 @@ using System; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public class ApplicationMessageProcessedEventArgs : EventArgs { diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClient.cs b/Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClient.cs similarity index 94% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClient.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClient.cs index 97cdeca..1e15daa 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClient.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClient.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using MQTTnet.Client; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public interface IManagedMqttClient : IApplicationMessageReceiver, IApplicationMessagePublisher, IDisposable { diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClientOptions.cs b/Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClientOptions.cs similarity index 84% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClientOptions.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClientOptions.cs index fbb87b7..77736c4 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClientOptions.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClientOptions.cs @@ -1,7 +1,7 @@ using System; using MQTTnet.Client; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public interface IManagedMqttClientOptions { diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClientStorage.cs b/Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClientStorage.cs similarity index 86% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClientStorage.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClientStorage.cs index 28bf570..2127054 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/IManagedMqttClientStorage.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/IManagedMqttClientStorage.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public interface IManagedMqttClientStorage { diff --git a/Extensions/MQTTnet.Extensions.ManagedClient/MQTTnet.Extensions.ManagedClient.csproj b/Extensions/MQTTnet.Extensions.ManagedClient/MQTTnet.Extensions.ManagedClient.csproj new file mode 100644 index 0000000..64bbf92 --- /dev/null +++ b/Extensions/MQTTnet.Extensions.ManagedClient/MQTTnet.Extensions.ManagedClient.csproj @@ -0,0 +1,31 @@ + + + + netstandard1.3;netstandard2.0;net452;net461;uap10.0 + 0.0.0.0 + 0.0.0.0 + + + + + 0.0.0.0 + + + + false + UAP,Version=v10.0 + UAP + 10.0.17134.0 + 10.0.10240.0 + .NETCore + v5.0 + $(DefineConstants);WINDOWS_UWP + en + $(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets + + + + + + + diff --git a/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttApplicationMessage.cs b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttApplicationMessage.cs new file mode 100644 index 0000000..bba73b0 --- /dev/null +++ b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttApplicationMessage.cs @@ -0,0 +1,11 @@ +using System; + +namespace MQTTnet.Extensions.ManagedClient +{ + public class ManagedMqttApplicationMessage + { + public Guid Id { get; set; } = Guid.NewGuid(); + + public MqttApplicationMessage ApplicationMessage { get; set; } + } +} diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClient.cs b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs similarity index 99% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClient.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs index 804b186..0303caf 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClient.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs @@ -10,7 +10,7 @@ using MQTTnet.Exceptions; using MQTTnet.Internal; using MQTTnet.Protocol; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public class ManagedMqttClient : IManagedMqttClient { diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientExtensions.cs b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientExtensions.cs similarity index 97% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientExtensions.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientExtensions.cs index 84b3785..ba5a16f 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientExtensions.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientExtensions.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using MQTTnet.Protocol; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public static class ManagedMqttClientExtensions { diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientOptions.cs b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientOptions.cs similarity index 88% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientOptions.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientOptions.cs index 813aee8..e07e2d6 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientOptions.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientOptions.cs @@ -1,7 +1,7 @@ using System; using MQTTnet.Client; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public class ManagedMqttClientOptions : IManagedMqttClientOptions { diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientOptionsBuilder.cs b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientOptionsBuilder.cs similarity index 98% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientOptionsBuilder.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientOptionsBuilder.cs index 4d65bdb..ef774c5 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientOptionsBuilder.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientOptionsBuilder.cs @@ -1,7 +1,7 @@ using System; using MQTTnet.Client; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public class ManagedMqttClientOptionsBuilder { diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientStorageManager.cs b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientStorageManager.cs similarity index 97% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientStorageManager.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientStorageManager.cs index 49eaae3..4d13c33 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientStorageManager.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/ManagedMqttClientStorageManager.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; using MQTTnet.Internal; -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public class ManagedMqttClientStorageManager { diff --git a/Extensions/MQTTnet.Extensions.ManagedClient/MqttFactoryExtensions.cs b/Extensions/MQTTnet.Extensions.ManagedClient/MqttFactoryExtensions.cs new file mode 100644 index 0000000..d2ad020 --- /dev/null +++ b/Extensions/MQTTnet.Extensions.ManagedClient/MqttFactoryExtensions.cs @@ -0,0 +1,24 @@ +using System; +using MQTTnet.Client; +using MQTTnet.Diagnostics; + +namespace MQTTnet.Extensions.ManagedClient +{ + public static class MqttFactoryExtensions + { + public static IManagedMqttClient CreateManagedMqttClient(this IMqttClientFactory factory) + { + if (factory == null) throw new ArgumentNullException(nameof(factory)); + + return new ManagedMqttClient(factory.CreateMqttClient(), new MqttNetLogger().CreateChildLogger()); + } + + public static IManagedMqttClient CreateManagedMqttClient(this IMqttClientFactory factory, IMqttNetLogger logger) + { + if (factory == null) throw new ArgumentNullException(nameof(factory)); + if (logger == null) throw new ArgumentNullException(nameof(logger)); + + return new ManagedMqttClient(factory.CreateMqttClient(), logger.CreateChildLogger()); + } + } +} diff --git a/Frameworks/MQTTnet.NetStandard/ManagedClient/ReconnectionResult.cs b/Extensions/MQTTnet.Extensions.ManagedClient/ReconnectionResult.cs similarity index 71% rename from Frameworks/MQTTnet.NetStandard/ManagedClient/ReconnectionResult.cs rename to Extensions/MQTTnet.Extensions.ManagedClient/ReconnectionResult.cs index 42566e3..fa876c3 100644 --- a/Frameworks/MQTTnet.NetStandard/ManagedClient/ReconnectionResult.cs +++ b/Extensions/MQTTnet.Extensions.ManagedClient/ReconnectionResult.cs @@ -1,4 +1,4 @@ -namespace MQTTnet.ManagedClient +namespace MQTTnet.Extensions.ManagedClient { public enum ReconnectionResult { diff --git a/Frameworks/MQTTnet.NetStandard/Client/IMqttClientFactory.cs b/Frameworks/MQTTnet.NetStandard/Client/IMqttClientFactory.cs index 444c16f..a15b499 100644 --- a/Frameworks/MQTTnet.NetStandard/Client/IMqttClientFactory.cs +++ b/Frameworks/MQTTnet.NetStandard/Client/IMqttClientFactory.cs @@ -1,5 +1,4 @@ using MQTTnet.Diagnostics; -using MQTTnet.ManagedClient; namespace MQTTnet.Client { @@ -8,9 +7,5 @@ namespace MQTTnet.Client IMqttClient CreateMqttClient(); IMqttClient CreateMqttClient(IMqttNetLogger logger); - - IManagedMqttClient CreateManagedMqttClient(); - - IManagedMqttClient CreateManagedMqttClient(IMqttNetLogger logger); } } \ No newline at end of file