TTNet.Data
5.0.1
See the version list below for details.
dotnet add package TTNet.Data --version 5.0.1
NuGet\Install-Package TTNet.Data -Version 5.0.1
<PackageReference Include="TTNet.Data" Version="5.0.1" />
paket add TTNet.Data --version 5.0.1
#r "nuget: TTNet.Data, 5.0.1"
// Install TTNet.Data as a Cake Addin #addin nuget:?package=TTNet.Data&version=5.0.1 // Install TTNet.Data as a Cake Tool #tool nuget:?package=TTNet.Data&version=5.0.1
TTNet.Data
A .NET library for The Things Network 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.MessageReceived += (s, e) =>
{
Console.WriteLine(e.DeviceID);
foreach (var f in e.Message.PayloadFields.EnumerateObject())
Console.WriteLine($"\t{f.Name}: {f.Value}");
// Or you can convert it to your data type
var myObject = e.Message.PayloadFields.ConvertTo<MyClass>();
};
Connect:
var c = await app.Connect(accessKey, region, CancellationToken.None);
Example:
var c = await app.Connect("ttn-account-v2.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "eu", CancellationToken.None);
You can add or remove events wether connected or disconnected.
Publish messages:
// Raw payload
await app.Publish(deviceID, new byte[] { 0x10, 0xF1 }, port, CancellationToken.None);
// JSON payload
await app.Publish(deviceID, myObject, port, CancellationToken.None);
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 App("Your app ID", true);
Use Start/Stop
instead of Connect/Disconnect
:
await app.Start(accessKey, region, autoReconnectDelay);
Publish messages:
// Raw payload
await app.Publish(deviceID, new byte[] { 0x10, 0xF1 }, port);
// JSON payload
await app.Publish(deviceID, myObject, port);
JSON Payload
Only properties are converted from and to JSON, and they can be private.
The property name can be overriden with JsonPropertyName attribute.
If JsonIgnore attribute is set, the property will be ignored.
Example:
class MyClass
{
public bool MyBoolean { get; private set; }
[JsonPropertyName("my_int")]
public int MyInt { get; private set; }
[JsonIgnore]
public string MyString { get; set; }
}
Result JSON:
{"MyBoolean":false,"my_int":0}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
-
.NETStandard 2.0
- MQTTnet (>= 3.0.13)
- MQTTnet.Extensions.ManagedClient (>= 3.0.13)
- System.Text.Json (>= 5.0.0)
-
net5.0
- MQTTnet (>= 3.0.13)
- MQTTnet.Extensions.ManagedClient (>= 3.0.13)
- System.Text.Json (>= 5.0.0)
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 | 100 | 10/9/2024 |
6.2.1 | 122 | 8/15/2024 |
6.2.0 | 170 | 12/29/2023 |
6.2.0-rc.1 | 89 | 12/12/2023 |
6.1.4 | 355 | 1/4/2023 |
6.1.3 | 361 | 10/31/2022 |
6.1.2 | 435 | 7/26/2022 |
6.1.1 | 417 | 7/8/2022 |
6.1.0 | 488 | 1/17/2022 |
6.1.0-beta.4 | 178 | 12/29/2021 |
6.1.0-beta.3 | 124 | 12/27/2021 |
6.1.0-beta.2 | 135 | 12/23/2021 |
6.1.0-beta.1 | 126 | 12/21/2021 |
6.0.0-rc.2 | 3,076 | 11/24/2021 |
6.0.0-rc.1 | 135 | 10/15/2021 |
5.0.1 | 1,451 | 12/15/2020 |
5.0.0 | 379 | 11/19/2020 |
3.3.0 | 419 | 10/1/2020 |
3.2.1 | 474 | 6/17/2020 |
3.2.1-rc.1 | 276 | 6/16/2020 |
3.2.0 | 466 | 5/19/2020 |
3.2.0-rc.2 | 245 | 5/18/2020 |
3.2.0-rc.1 | 311 | 5/17/2020 |
3.1.0 | 476 | 5/16/2020 |
3.1.0-rc.2 | 242 | 5/16/2020 |
3.1.0-rc.1 | 245 | 5/15/2020 |
3.0.0 | 564 | 1/3/2020 |