@@ -10,7 +10,7 @@ using MQTTnet.Core.Exceptions; | |||
namespace MQTTnet.Implementations | |||
{ | |||
public class MqttTcpChannel : IMqttCommunicationChannel, IDisposable | |||
public sealed class MqttTcpChannel : IMqttCommunicationChannel, IDisposable | |||
{ | |||
private readonly Socket _socket; | |||
private SslStream _sslStream; | |||
@@ -10,7 +10,7 @@ using MQTTnet.Core.Exceptions; | |||
namespace MQTTnet.Implementations | |||
{ | |||
public class MqttTcpChannel : IMqttCommunicationChannel, IDisposable | |||
public sealed class MqttTcpChannel : IMqttCommunicationChannel, IDisposable | |||
{ | |||
private readonly Socket _socket; | |||
private SslStream _sslStream; | |||
@@ -13,7 +13,7 @@ using MQTTnet.Core.Exceptions; | |||
namespace MQTTnet.Implementations | |||
{ | |||
public class MqttTcpChannel : IMqttCommunicationChannel, IDisposable | |||
public sealed class MqttTcpChannel : IMqttCommunicationChannel, IDisposable | |||
{ | |||
private readonly StreamSocket _socket; | |||
@@ -42,11 +42,10 @@ namespace MQTTnet.Implementations | |||
if (!options.SslOptions.CheckCertificateRevocation) | |||
{ | |||
_socket.Control.IgnorableServerCertificateErrors.Add(ChainValidationResult.Revoked); | |||
_socket.Control.IgnorableServerCertificateErrors.Add(ChainValidationResult.IncompleteChain); | |||
_socket.Control.IgnorableServerCertificateErrors.Add(ChainValidationResult.RevocationInformationMissing); | |||
} | |||
await _socket.ConnectAsync(new HostName(options.Server), options.GetPort().ToString(), SocketProtectionLevel.Tls12); | |||
} | |||
} | |||
@@ -90,7 +89,7 @@ namespace MQTTnet.Implementations | |||
try | |||
{ | |||
await _socket.InputStream.ReadAsync(buffer.AsBuffer(), (uint)buffer.Length, InputStreamOptions.Partial); | |||
await _socket.InputStream.ReadAsync(buffer.AsBuffer(), (uint)buffer.Length, InputStreamOptions.None); | |||
} | |||
catch (SocketException exception) | |||
{ | |||
@@ -26,6 +26,7 @@ | |||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
<NoWarn>CS1591</NoWarn> | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
@@ -35,13 +36,14 @@ | |||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
<NoWarn>CS1591</NoWarn> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | |||
<PlatformTarget>x86</PlatformTarget> | |||
<DebugSymbols>true</DebugSymbols> | |||
<OutputPath>bin\x86\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | |||
<NoWarn>;2008</NoWarn> | |||
<NoWarn>;2008,CS1591</NoWarn> | |||
<DebugType>full</DebugType> | |||
<PlatformTarget>x86</PlatformTarget> | |||
<UseVSHostingProcess>false</UseVSHostingProcess> | |||
@@ -52,7 +54,7 @@ | |||
<OutputPath>bin\x86\Release\</OutputPath> | |||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | |||
<Optimize>true</Optimize> | |||
<NoWarn>;2008</NoWarn> | |||
<NoWarn>;2008,CS1591</NoWarn> | |||
<DebugType>pdbonly</DebugType> | |||
<PlatformTarget>x86</PlatformTarget> | |||
<UseVSHostingProcess>false</UseVSHostingProcess> | |||
@@ -64,7 +66,7 @@ | |||
<DebugSymbols>true</DebugSymbols> | |||
<OutputPath>bin\ARM\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | |||
<NoWarn>;2008</NoWarn> | |||
<NoWarn>;2008,CS1591</NoWarn> | |||
<DebugType>full</DebugType> | |||
<PlatformTarget>ARM</PlatformTarget> | |||
<UseVSHostingProcess>false</UseVSHostingProcess> | |||
@@ -75,7 +77,7 @@ | |||
<OutputPath>bin\ARM\Release\</OutputPath> | |||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | |||
<Optimize>true</Optimize> | |||
<NoWarn>;2008</NoWarn> | |||
<NoWarn>;2008,CS1591</NoWarn> | |||
<DebugType>pdbonly</DebugType> | |||
<PlatformTarget>ARM</PlatformTarget> | |||
<UseVSHostingProcess>false</UseVSHostingProcess> | |||
@@ -87,7 +89,7 @@ | |||
<DebugSymbols>true</DebugSymbols> | |||
<OutputPath>bin\x64\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | |||
<NoWarn>;2008</NoWarn> | |||
<NoWarn>;2008,CS1591</NoWarn> | |||
<DebugType>full</DebugType> | |||
<PlatformTarget>x64</PlatformTarget> | |||
<UseVSHostingProcess>false</UseVSHostingProcess> | |||
@@ -98,7 +100,7 @@ | |||
<OutputPath>bin\x64\Release\</OutputPath> | |||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> | |||
<Optimize>true</Optimize> | |||
<NoWarn>;2008</NoWarn> | |||
<NoWarn>;2008,CS1591</NoWarn> | |||
<DebugType>pdbonly</DebugType> | |||
<PlatformTarget>x64</PlatformTarget> | |||
<UseVSHostingProcess>false</UseVSHostingProcess> | |||
@@ -3,10 +3,10 @@ | |||
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" | |||
}, | |||
"frameworks": { | |||
"uap10.0": {}, | |||
"netstandard1.1": {} | |||
"uap10.0": {} | |||
}, | |||
"runtimes": { | |||
"win10": {}, | |||
"win10-arm": {}, | |||
"win10-arm-aot": {}, | |||
"win10-x86": {}, | |||
@@ -74,6 +74,7 @@ namespace MQTTnet.Core.Client | |||
var response = await SendAndReceiveAsync<MqttConnAckPacket>(connectPacket); | |||
if (response.ConnectReturnCode != MqttConnectReturnCode.ConnectionAccepted) | |||
{ | |||
await DisconnectAsync(); | |||
throw new MqttConnectingFailedException(response.ConnectReturnCode); | |||
} | |||
@@ -190,7 +191,7 @@ namespace MQTTnet.Core.Client | |||
} | |||
} | |||
private async void ProcessReceivedPacket(MqttBasePacket mqttPacket) | |||
private async void ProcessReceivedPacketAsync(MqttBasePacket mqttPacket) | |||
{ | |||
try | |||
{ | |||
@@ -355,7 +356,7 @@ namespace MQTTnet.Core.Client | |||
MqttTrace.Information(nameof(MqttClient), $"Received <<< {mqttPacket}"); | |||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed | |||
Task.Run(() => ProcessReceivedPacket(mqttPacket), cancellationToken); | |||
Task.Run(() => ProcessReceivedPacketAsync(mqttPacket), cancellationToken); | |||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed | |||
} | |||
} | |||
@@ -28,10 +28,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MQTTnet.TestApp.UniversalWi | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Any CPU|Any CPU = Any CPU|Any CPU | |||
Any CPU|ARM = Any CPU|ARM | |||
Any CPU|x64 = Any CPU|x64 | |||
Any CPU|x86 = Any CPU|x86 | |||
Debug|Any CPU = Debug|Any CPU | |||
Debug|ARM = Debug|ARM | |||
Debug|x64 = Debug|x64 | |||
@@ -42,14 +38,6 @@ Global | |||
Release|x86 = Release|x86 | |||
EndGlobalSection | |||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Any CPU|Any CPU.ActiveCfg = Any CPU|Any CPU | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Any CPU|Any CPU.Build.0 = Any CPU|Any CPU | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Any CPU|ARM.ActiveCfg = Any CPU|Any CPU | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Any CPU|ARM.Build.0 = Any CPU|Any CPU | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Any CPU|x64.ActiveCfg = Any CPU|x64 | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Any CPU|x64.Build.0 = Any CPU|x64 | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Any CPU|x86.ActiveCfg = Any CPU|x86 | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Any CPU|x86.Build.0 = Any CPU|x86 | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
@@ -66,14 +54,6 @@ Global | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Release|x64.Build.0 = Release|x64 | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Release|x86.ActiveCfg = Release|x86 | |||
{A7FF0C91-25DE-4BA6-B39E-F54E8DADF1CC}.Release|x86.Build.0 = Release|x86 | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Any CPU|Any CPU.ActiveCfg = Any CPU|Any CPU | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Any CPU|Any CPU.Build.0 = Any CPU|Any CPU | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Any CPU|ARM.ActiveCfg = Any CPU|Any CPU | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Any CPU|ARM.Build.0 = Any CPU|Any CPU | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Any CPU|x64.ActiveCfg = Any CPU|x64 | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Any CPU|x64.Build.0 = Any CPU|x64 | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Any CPU|x86.ActiveCfg = Any CPU|x86 | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Any CPU|x86.Build.0 = Any CPU|x86 | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
@@ -90,16 +70,7 @@ Global | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Release|x64.Build.0 = Release|x64 | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Release|x86.ActiveCfg = Release|x86 | |||
{A480EF90-0EAA-4D9A-B271-47A9C47F6F7D}.Release|x86.Build.0 = Release|x86 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Any CPU|Any CPU.ActiveCfg = Any CPU|Any CPU | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Any CPU|Any CPU.Build.0 = Any CPU|Any CPU | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Any CPU|ARM.ActiveCfg = Any CPU|ARM | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Any CPU|ARM.Build.0 = Any CPU|ARM | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Any CPU|x64.ActiveCfg = Any CPU|x64 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Any CPU|x64.Build.0 = Any CPU|x64 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Any CPU|x86.ActiveCfg = Any CPU|x86 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Any CPU|x86.Build.0 = Any CPU|x86 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Debug|ARM.ActiveCfg = Debug|ARM | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Debug|ARM.Build.0 = Debug|ARM | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Debug|x64.ActiveCfg = Debug|x64 | |||
@@ -107,21 +78,12 @@ Global | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Debug|x86.ActiveCfg = Debug|x86 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Debug|x86.Build.0 = Debug|x86 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Release|ARM.ActiveCfg = Release|ARM | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Release|ARM.Build.0 = Release|ARM | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Release|x64.ActiveCfg = Release|x64 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Release|x64.Build.0 = Release|x64 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Release|x86.ActiveCfg = Release|x86 | |||
{BD60C727-D8E8-40C3-B8E3-C95A864AE611}.Release|x86.Build.0 = Release|x86 | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Any CPU|Any CPU.ActiveCfg = Any CPU|Any CPU | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Any CPU|Any CPU.Build.0 = Any CPU|Any CPU | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Any CPU|ARM.ActiveCfg = Any CPU|Any CPU | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Any CPU|ARM.Build.0 = Any CPU|Any CPU | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Any CPU|x64.ActiveCfg = Any CPU|x64 | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Any CPU|x64.Build.0 = Any CPU|x64 | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Any CPU|x86.ActiveCfg = Any CPU|x86 | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Any CPU|x86.Build.0 = Any CPU|x86 | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
@@ -138,14 +100,6 @@ Global | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Release|x64.Build.0 = Release|x64 | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Release|x86.ActiveCfg = Release|x86 | |||
{2ECB99E4-72D0-4C23-99BA-93D511D3967D}.Release|x86.Build.0 = Release|x86 | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Any CPU|Any CPU.ActiveCfg = Any CPU|Any CPU | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Any CPU|Any CPU.Build.0 = Any CPU|Any CPU | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Any CPU|ARM.ActiveCfg = Any CPU|Any CPU | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Any CPU|ARM.Build.0 = Any CPU|Any CPU | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Any CPU|x64.ActiveCfg = Any CPU|x64 | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Any CPU|x64.Build.0 = Any CPU|x64 | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Any CPU|x86.ActiveCfg = Any CPU|x86 | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Any CPU|x86.Build.0 = Any CPU|x86 | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
@@ -162,43 +116,23 @@ Global | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Release|x64.Build.0 = Release|x64 | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Release|x86.ActiveCfg = Release|x86 | |||
{1A1B7F51-5328-4395-9D9C-07D70965825E}.Release|x86.Build.0 = Release|x86 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Any CPU|Any CPU.ActiveCfg = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Any CPU|Any CPU.Build.0 = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Any CPU|ARM.ActiveCfg = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Any CPU|ARM.Build.0 = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Any CPU|x64.ActiveCfg = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Any CPU|x64.Build.0 = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Any CPU|x86.ActiveCfg = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Any CPU|x86.Build.0 = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|x64.Build.0 = Debug|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|x86.Build.0 = Debug|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|x64.ActiveCfg = Debug|x64 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|x64.Build.0 = Debug|x64 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|x86.ActiveCfg = Debug|x86 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Debug|x86.Build.0 = Debug|x86 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|ARM.Build.0 = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|x64.ActiveCfg = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|x64.Build.0 = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|x86.ActiveCfg = Release|Any CPU | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|x86.Build.0 = Release|Any CPU | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|Any CPU.ActiveCfg = Release|x64 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|Any CPU.Build.0 = Release|x64 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|Any CPU.Deploy.0 = Release|x64 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|ARM.ActiveCfg = Release|ARM | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|ARM.Build.0 = Release|ARM | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|ARM.Deploy.0 = Release|ARM | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|x64.ActiveCfg = Release|x64 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|x64.Build.0 = Release|x64 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|x64.Deploy.0 = Release|x64 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|x86.ActiveCfg = Release|x86 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|x86.Build.0 = Release|x86 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Any CPU|x86.Deploy.0 = Release|x86 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Debug|Any CPU.ActiveCfg = Debug|x86 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|x64.ActiveCfg = Release|x64 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|x64.Build.0 = Release|x64 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|x86.ActiveCfg = Release|x86 | |||
{D9D74F33-6943-49B2-B765-7BD589082098}.Release|x86.Build.0 = Release|x86 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Debug|ARM.ActiveCfg = Debug|ARM | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Debug|ARM.Build.0 = Debug|ARM | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Debug|ARM.Deploy.0 = Debug|ARM | |||
@@ -208,7 +142,7 @@ Global | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Debug|x86.ActiveCfg = Debug|x86 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Debug|x86.Build.0 = Debug|x86 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Debug|x86.Deploy.0 = Debug|x86 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Release|Any CPU.ActiveCfg = Release|x86 | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Release|ARM.ActiveCfg = Release|ARM | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Release|ARM.Build.0 = Release|ARM | |||
{FF1F72D6-9524-4422-9497-3CC0002216ED}.Release|ARM.Deploy.0 = Release|ARM | |||
@@ -31,6 +31,46 @@ | |||
<ErrorReport>prompt</ErrorReport> | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | |||
<DebugSymbols>true</DebugSymbols> | |||
<OutputPath>bin\x86\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE</DefineConstants> | |||
<DebugType>full</DebugType> | |||
<PlatformTarget>x86</PlatformTarget> | |||
<ErrorReport>prompt</ErrorReport> | |||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||
<Prefer32Bit>true</Prefer32Bit> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | |||
<OutputPath>bin\x86\Release\</OutputPath> | |||
<DefineConstants>TRACE</DefineConstants> | |||
<Optimize>true</Optimize> | |||
<DebugType>pdbonly</DebugType> | |||
<PlatformTarget>x86</PlatformTarget> | |||
<ErrorReport>prompt</ErrorReport> | |||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||
<Prefer32Bit>true</Prefer32Bit> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | |||
<DebugSymbols>true</DebugSymbols> | |||
<OutputPath>bin\x64\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE</DefineConstants> | |||
<DebugType>full</DebugType> | |||
<PlatformTarget>x64</PlatformTarget> | |||
<ErrorReport>prompt</ErrorReport> | |||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||
<Prefer32Bit>true</Prefer32Bit> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | |||
<OutputPath>bin\x64\Release\</OutputPath> | |||
<DefineConstants>TRACE</DefineConstants> | |||
<Optimize>true</Optimize> | |||
<DebugType>pdbonly</DebugType> | |||
<PlatformTarget>x64</PlatformTarget> | |||
<ErrorReport>prompt</ErrorReport> | |||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||
<Prefer32Bit>true</Prefer32Bit> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="System" /> | |||
<Reference Include="System.Core" /> | |||
@@ -121,7 +121,7 @@ namespace MQTTnet.TestApp.NetFramework | |||
} | |||
} | |||
private static async Task RunServerAsync(string[] arguments) | |||
private static void RunServerAsync(string[] arguments) | |||
{ | |||
MqttTrace.TraceMessagePublished += (s, e) => | |||
{ | |||
@@ -1,10 +1,10 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
<PropertyGroup> | |||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> | |||
<ProjectGuid>{ff1f72d6-9524-4422-9497-3cc0002216ed}</ProjectGuid> | |||
<ProjectGuid>{FF1F72D6-9524-4422-9497-3CC0002216ED}</ProjectGuid> | |||
<OutputType>AppContainerExe</OutputType> | |||
<AppDesignerFolder>Properties</AppDesignerFolder> | |||
<RootNamespace>MQTTnet.TestApp.UniversalWindows</RootNamespace> | |||
@@ -17,9 +17,7 @@ | |||
<FileAlignment>512</FileAlignment> | |||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | |||
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview> | |||
<PackageCertificateKeyFile>MQTTnet.TestApp.UniversalWindows_TemporaryKey.pfx</PackageCertificateKeyFile> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | |||
<DebugSymbols>true</DebugSymbols> | |||
@@ -90,12 +88,10 @@ | |||
<Prefer32Bit>true</Prefer32Bit> | |||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included --> | |||
<None Include="project.json" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="App.xaml.cs"> | |||
<DependentUpon>App.xaml</DependentUpon> | |||
@@ -109,9 +105,7 @@ | |||
<AppxManifest Include="Package.appxmanifest"> | |||
<SubType>Designer</SubType> | |||
</AppxManifest> | |||
<None Include="MQTTnet.TestApp.UniversalWindows_TemporaryKey.pfx" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="Properties\Default.rd.xml" /> | |||
@@ -133,11 +127,45 @@ | |||
<SubType>Designer</SubType> | |||
</Page> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\..\Frameworks\MQTTnet.UniversalWindows\MQTTnet.UniversalWindows.csproj"> | |||
<Project>{bd60c727-d8e8-40c3-b8e3-c95a864ae611}</Project> | |||
<Name>MQTTnet.UniversalWindows</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\..\MQTTnet.Core\MQTTnet.Core.csproj"> | |||
<Project>{2ecb99e4-72d0-4c23-99ba-93d511d3967d}</Project> | |||
<Name>MQTTnet.Core</Name> | |||
</ProjectReference> | |||
</ItemGroup> | |||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' "> | |||
<VisualStudioVersion>14.0</VisualStudioVersion> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> | |||
<DebugSymbols>true</DebugSymbols> | |||
<OutputPath>bin\Debug\</OutputPath> | |||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS</DefineConstants> | |||
<NoWarn>;2008</NoWarn> | |||
<NoStdLib>true</NoStdLib> | |||
<DebugType>full</DebugType> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
<UseVSHostingProcess>false</UseVSHostingProcess> | |||
<ErrorReport>prompt</ErrorReport> | |||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||
<Prefer32Bit>true</Prefer32Bit> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> | |||
<OutputPath>bin\Release\</OutputPath> | |||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS</DefineConstants> | |||
<Optimize>true</Optimize> | |||
<NoWarn>;2008</NoWarn> | |||
<NoStdLib>true</NoStdLib> | |||
<DebugType>pdbonly</DebugType> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
<UseVSHostingProcess>false</UseVSHostingProcess> | |||
<ErrorReport>prompt</ErrorReport> | |||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||
<Prefer32Bit>true</Prefer32Bit> | |||
</PropertyGroup> | |||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> | |||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
Other similar extension points exist, see Microsoft.Common.targets. | |||
@@ -146,4 +174,4 @@ | |||
<Target Name="AfterBuild"> | |||
</Target> | |||
--> | |||
</Project> | |||
</Project> |
@@ -7,7 +7,33 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
mc:Ignorable="d"> | |||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="Auto" /> | |||
<RowDefinition Height="*" /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Grid.Row="0" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | |||
<TextBlock>Server:</TextBlock> | |||
<TextBox x:Name="Server"></TextBox> | |||
<TextBlock>User:</TextBlock> | |||
<TextBox x:Name="User"></TextBox> | |||
<TextBlock>Password:</TextBlock> | |||
<TextBox x:Name="Password"></TextBox> | |||
<TextBlock>ClientId:</TextBlock> | |||
<TextBox x:Name="ClientId"></TextBox> | |||
<CheckBox x:Name="UseSsl">Use SSL</CheckBox> | |||
<Button Click="Connect">Connect</Button> | |||
<TextBlock>Trace:</TextBlock> | |||
</StackPanel> | |||
<ScrollViewer Grid.Row="1" Background="Black" Foreground="WhiteSmoke" FontFamily="Consolas" HorizontalScrollMode="Enabled" VerticalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"> | |||
<TextBlock x:Name="Trace"></TextBlock> | |||
</ScrollViewer> | |||
</Grid> | |||
</Page> |
@@ -1,30 +1,63 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Runtime.InteropServices.WindowsRuntime; | |||
using Windows.Foundation; | |||
using Windows.Foundation.Collections; | |||
using Windows.UI.Core; | |||
using Windows.UI.Xaml; | |||
using Windows.UI.Xaml.Controls; | |||
using Windows.UI.Xaml.Controls.Primitives; | |||
using Windows.UI.Xaml.Data; | |||
using Windows.UI.Xaml.Input; | |||
using Windows.UI.Xaml.Media; | |||
using Windows.UI.Xaml.Navigation; | |||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 | |||
using MQTTnet.Core.Client; | |||
using MQTTnet.Core.Diagnostics; | |||
namespace MQTTnet.TestApp.UniversalWindows | |||
{ | |||
/// <summary> | |||
/// An empty page that can be used on its own or navigated to within a Frame. | |||
/// </summary> | |||
public sealed partial class MainPage : Page | |||
public sealed partial class MainPage | |||
{ | |||
private MqttClient _mqttClient; | |||
public MainPage() | |||
{ | |||
this.InitializeComponent(); | |||
InitializeComponent(); | |||
MqttTrace.TraceMessagePublished += OnTraceMessagePublished; | |||
} | |||
private async void OnTraceMessagePublished(object sender, MqttTraceMessagePublishedEventArgs e) | |||
{ | |||
await Trace.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => | |||
{ | |||
var text = $"[{DateTime.Now:O}] [{e.Level}] [{e.Source}] [{e.ThreadId}] [{e.Message}]{Environment.NewLine}"; | |||
if (e.Exception != null) | |||
{ | |||
text += $"{e.Exception}{Environment.NewLine}"; | |||
} | |||
Trace.Text += text; | |||
}); | |||
} | |||
private async void Connect(object sender, RoutedEventArgs e) | |||
{ | |||
var options = new MqttClientOptions | |||
{ | |||
Server = Server.Text, | |||
UserName = User.Text, | |||
Password = Password.Text, | |||
ClientId = ClientId.Text | |||
}; | |||
options.SslOptions.UseSsl = UseSsl.IsChecked == true; | |||
try | |||
{ | |||
if (_mqttClient != null) | |||
{ | |||
await _mqttClient.DisconnectAsync(); | |||
} | |||
var factory = new MqttClientFactory(); | |||
_mqttClient = factory.CreateMqttClient(options); | |||
await _mqttClient.ConnectAsync(); | |||
} | |||
catch (Exception exception) | |||
{ | |||
Trace.Text += exception + Environment.NewLine; | |||
} | |||
} | |||
} | |||
} |
@@ -6,6 +6,7 @@ | |||
"uap10.0": {} | |||
}, | |||
"runtimes": { | |||
"win10": {}, | |||
"win10-arm": {}, | |||
"win10-arm-aot": {}, | |||
"win10-x86": {}, | |||