TTNet.Data
6.2.1
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package TTNet.Data --version 6.2.1
NuGet\Install-Package TTNet.Data -Version 6.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TTNet.Data" Version="6.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TTNet.Data --version 6.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TTNet.Data, 6.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TTNet.Data as a Cake Addin #addin nuget:?package=TTNet.Data&version=6.2.1 // Install TTNet.Data as a Cake Tool #tool nuget:?package=TTNet.Data&version=6.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TTNet.Data
A .NET library for The Things Stack MQTT Data API
Install
Available at NuGet:
dotnet add package TTNet.Data
Usage
Create an instance:
var app = new App("Your app ID");
Listen to events:
app.Connected += (s, e) => Console.WriteLine("Connected");
app.Up += (s, e) =>
{
Console.WriteLine(e.DeviceID);
foreach (JsonProperty f in e.Message.UplinkMessage.DecodedPayload.EnumerateObject())
Console.WriteLine($"\t{f.Name}: {f.Value}");
// Or you can convert it to your data type
var myObject = e.Message.UplinkMessage.DecodedPayload.Deserialize<MyClass>();
};
Listen to specific devices:
app["deviceId"].Up += (s, e) =>
{
foreach (JsonProperty f in e.Message.UplinkMessage.DecodedPayload.EnumerateObject())
Console.WriteLine($"\t{f.Name}: {f.Value}");
};
Connect:
var c = await app.ConnectAsync(cluster, port, withTls, username, apiKey);
Example:
var c = await app.ConnectAsync("eu1.cloud.thethings.network", 8883, true, "username@ttn", "XXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
You can add or remove events wether connected or disconnected.
Publish messages:
// Raw payload
await app[deviceID].PublishAsync(new Downlink {
FPort = port,
FrmPayload = new byte[] { 0x10, 0xF1 }
}, default(CancellationToken));
// JSON payload
await app[deviceID].PublishAsync(new Downlink {
FPort = port,
DecodedPayload = JsonSerializer.SerializeToElement(myObject)
}, default(CancellationToken));
Managed
Managed mode is also available. The client is started once and will mantain the connection automatically including reconnecting.
Create a managed instance:
var app = new ManagedApp("Your app ID");
Use StartAsync/StopAsync
instead of ConnectAsync/DisconnectAsync
:
await app.StartAsync(cluster, port, withTls, username, apiKey, autoReconnectDelay);
Publish messages:
// Raw payload
await app[deviceID].PublishAsync(new Downlink {
FPort = port,
FrmPayload = new byte[] { 0x10, 0xF1 }
});
// JSON payload
await app[deviceID].PublishAsync(new Downlink {
FPort = port,
DecodedPayload = JsonSerializer.SerializeToElement(myObject)
});
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- MQTTnet (>= 4.3.6.1152)
- MQTTnet.Extensions.ManagedClient (>= 4.3.6.1152)
- System.Text.Json (>= 8.0.4)
-
net6.0
- MQTTnet (>= 4.3.6.1152)
- MQTTnet.Extensions.ManagedClient (>= 4.3.6.1152)
- System.Text.Json (>= 8.0.4)
-
net8.0
- MQTTnet (>= 4.3.6.1152)
- MQTTnet.Extensions.ManagedClient (>= 4.3.6.1152)
- System.Text.Json (>= 8.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.2.2 | 110 | 10/9/2024 |
6.2.1 | 127 | 8/15/2024 |
6.2.0 | 175 | 12/29/2023 |
6.2.0-rc.1 | 92 | 12/12/2023 |
6.1.4 | 361 | 1/4/2023 |
6.1.3 | 366 | 10/31/2022 |
6.1.2 | 440 | 7/26/2022 |
6.1.1 | 422 | 7/8/2022 |
6.1.0 | 493 | 1/17/2022 |
6.1.0-beta.4 | 181 | 12/29/2021 |
6.1.0-beta.3 | 127 | 12/27/2021 |
6.1.0-beta.2 | 138 | 12/23/2021 |
6.1.0-beta.1 | 129 | 12/21/2021 |
6.0.0-rc.2 | 3,079 | 11/24/2021 |
6.0.0-rc.1 | 140 | 10/15/2021 |
5.0.1 | 1,456 | 12/15/2020 |
5.0.0 | 384 | 11/19/2020 |
3.3.0 | 424 | 10/1/2020 |
3.2.1 | 479 | 6/17/2020 |
3.2.1-rc.1 | 281 | 6/16/2020 |
3.2.0 | 471 | 5/19/2020 |
3.2.0-rc.2 | 248 | 5/18/2020 |
3.2.0-rc.1 | 314 | 5/17/2020 |
3.1.0 | 481 | 5/16/2020 |
3.1.0-rc.2 | 247 | 5/16/2020 |
3.1.0-rc.1 | 248 | 5/15/2020 |
3.0.0 | 569 | 1/3/2020 |