diff --git a/Build/MQTTnet.Extensions.Rpc.nuspec b/Build/MQTTnet.Extensions.Rpc.nuspec
new file mode 100644
index 0000000..ec09c1d
--- /dev/null
+++ b/Build/MQTTnet.Extensions.Rpc.nuspec
@@ -0,0 +1,47 @@
+
+
+
+ MQTTnet.Extensions.Rpc
+ 2.6.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.
+ * Initial version.
+
+ Copyright Christian Kratky 2016-2017
+ 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/build.ps1 b/Build/build.ps1
index 09eabf2..2b4ee5f 100644
--- a/Build/build.ps1
+++ b/Build/build.ps1
@@ -8,16 +8,26 @@ $path = &$vswhere -latest -products * -requires Microsoft.Component.MSBuild -pro
if ($path) {
$msbuild = join-path $path 'MSBuild\15.0\Bin\MSBuild.exe'
+ # Build the core library
&$msbuild ..\Frameworks\MQTTnet.Netstandard\MQTTnet.Netstandard.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="net452" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
&$msbuild ..\Frameworks\MQTTnet.Netstandard\MQTTnet.Netstandard.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="net461" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
&$msbuild ..\Frameworks\MQTTnet.Netstandard\MQTTnet.Netstandard.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="netstandard1.3" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
&$msbuild ..\Frameworks\MQTTnet.Netstandard\MQTTnet.Netstandard.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="netstandard2.0" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
&$msbuild ..\Frameworks\MQTTnet.Netstandard\MQTTnet.Netstandard.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="uap10.0" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
+ # Build the ASP.NET Core 2.0 extension
&$msbuild ..\Frameworks\MQTTnet.AspNetCore\MQTTnet.AspNetCore.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="netstandard2.0" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
+ # Build the RPC extension
+ &$msbuild ..\Extensions\MQTTnet.Extensions.Rpc\MQTTnet.Extensions.Rpc.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="net452" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
+ &$msbuild ..\Extensions\MQTTnet.Extensions.Rpc\MQTTnet.Extensions.Rpc.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="net461" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
+ &$msbuild ..\Extensions\MQTTnet.Extensions.Rpc\MQTTnet.Extensions.Rpc.csproj /t:Build /p:Configuration="Release" /p:TargetFramework="netstandard1.3" /p:FileVersion=$assemblyVersion /p:AssemblyVersion=$assemblyVersion /verbosity:m
+ &$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
+ &$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
+
Remove-Item .\NuGet -Force -Recurse
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
}
\ No newline at end of file
diff --git a/Extensions/MQTTnet.Extensions.Rpc/MqttRpcClient.cs b/Extensions/MQTTnet.Extensions.Rpc/MqttRpcClient.cs
index 6a9d1c1..938fcb4 100644
--- a/Extensions/MQTTnet.Extensions.Rpc/MqttRpcClient.cs
+++ b/Extensions/MQTTnet.Extensions.Rpc/MqttRpcClient.cs
@@ -9,7 +9,7 @@ namespace MQTTnet.Extensions.Rpc
{
public sealed class MqttRpcClient : IDisposable
{
- private const string ResponseTopic = "$RPC/+/+/response";
+ private const string ResponseTopic = "$MQTTnet.RPC/+/+/response";
private readonly ConcurrentDictionary> _waitingCalls = new ConcurrentDictionary>();
private readonly IMqttClient _mqttClient;
private bool _isEnabled;
diff --git a/Extensions/MQTTnet.Extensions.Rpc/SampleCCode.c b/Extensions/MQTTnet.Extensions.Rpc/SampleCCode.c
new file mode 100644
index 0000000..5f28270
--- /dev/null
+++ b/Extensions/MQTTnet.Extensions.Rpc/SampleCCode.c
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Frameworks/MQTTnet.NetStandard/Client/MqttClientExtensions.cs b/Frameworks/MQTTnet.NetStandard/Client/MqttClientExtensions.cs
index a1a89e3..73f4d40 100644
--- a/Frameworks/MQTTnet.NetStandard/Client/MqttClientExtensions.cs
+++ b/Frameworks/MQTTnet.NetStandard/Client/MqttClientExtensions.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using MQTTnet.Protocol;
namespace MQTTnet.Client
{
@@ -15,6 +16,14 @@ namespace MQTTnet.Client
return client.SubscribeAsync(topicFilters.ToList());
}
+ public static Task> SubscribeAsync(this IMqttClient client, string topic, MqttQualityOfServiceLevel qualityOfServiceLevel)
+ {
+ if (client == null) throw new ArgumentNullException(nameof(client));
+ if (topic == null) throw new ArgumentNullException(nameof(topic));
+
+ return client.SubscribeAsync(new TopicFilterBuilder().WithTopic(topic).WithQualityOfServiceLevel(qualityOfServiceLevel).Build());
+ }
+
public static Task UnsubscribeAsync(this IMqttClient client, params string[] topicFilters)
{
if (client == null) throw new ArgumentNullException(nameof(client));
diff --git a/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml b/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml
index 939061b..dcdee00 100644
--- a/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml
+++ b/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml
@@ -19,6 +19,8 @@
Server:
+ Port:
+
User:
Password:
diff --git a/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs b/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs
index ec42bac..a48b7ee 100644
--- a/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs
+++ b/Tests/MQTTnet.TestApp.UniversalWindows/MainPage.xaml.cs
@@ -78,6 +78,7 @@ namespace MQTTnet.TestApp.UniversalWindows
options.ChannelOptions = new MqttClientTcpOptions
{
Server = Server.Text,
+ Port = int.Parse(Port.Text),
TlsOptions = tlsOptions
};
}