Jaahas.OpcUa.JsonEncoding
0.1.0
dotnet add package Jaahas.OpcUa.JsonEncoding --version 0.1.0
NuGet\Install-Package Jaahas.OpcUa.JsonEncoding -Version 0.1.0
<PackageReference Include="Jaahas.OpcUa.JsonEncoding" Version="0.1.0" />
paket add Jaahas.OpcUa.JsonEncoding --version 0.1.0
#r "nuget: Jaahas.OpcUa.JsonEncoding, 0.1.0"
// Install Jaahas.OpcUa.JsonEncoding as a Cake Addin #addin nuget:?package=Jaahas.OpcUa.JsonEncoding&version=0.1.0 // Install Jaahas.OpcUa.JsonEncoding as a Cake Tool #tool nuget:?package=Jaahas.OpcUa.JsonEncoding&version=0.1.0
About
Jaahas.OpcUa.JsonEncoding provides an OPC UA JSON encoder and decoder for the Workstation.UaClient .NET OPC UA client library using System.Text.Json. The encoder supports both the reversible and non-reversible forms of the OPC UA JSON encoding.
Getting Started
The JsonEncoder
and JsonDecoder
classes implement the Workstation.UaClient
IEncoder
and IDecoder
interfaces respectively. The JsonEncodingProvider
class implements IEncodingProvider
.
Example:
var provider = new JsonEncodingProvider(encoderOptions: new JsonEncoderOptions() {
UseReversibleEncoding = false,
WriteIndented = true
});
using var ms = new MemoryStream();
using (var encoder = provider.CreateEncoder(ms, context: null, keepStreamOpen: true)) {
encoder.WriteRequest(new ReadRequest() {
MaxAge = 1000,
NodesToRead = [
new ReadValueId() {
NodeId = NodeId.Parse("ns=2;s=Demo.Static.Scalar.UInt32"),
AttributeId = AttributeIds.Value
},
new ReadValueId() {
NodeId = NodeId.Parse("ns=2;s=Demo.Static.Scalar.String"),
AttributeId = AttributeIds.Value
}
],
TimestampsToReturn = TimestampsToReturn.Both,
RequestHeader = new RequestHeader() {
AuditEntryId = "Test",
RequestHandle = 42
}
});
}
Console.WriteLine(Encoding.UTF8.GetString(ms.ToArray()));
The above code produces the following output using the non-reversible form of the OPC UA JSON encoding:
{
"RequestHeader": {
"AuthenticationToken": null,
"Timestamp": "0001-01-01T00:00:00",
"RequestHandle": 42,
"ReturnDiagnostics": 0,
"AuditEntryId": "Test",
"TimeoutHint": 0,
"AdditionalHeader": null
},
"MaxAge": 1000,
"TimestampsToReturn": "Both_2",
"NodesToRead": [
{
"NodeId": {
"IdType": 1,
"Id": "Demo.Static.Scalar.UInt32",
"Namespace": 2
},
"AttributeId": 13,
"IndexRange": null,
"DataEncoding": null
},
{
"NodeId": {
"IdType": 1,
"Id": "Demo.Static.Scalar.String",
"Namespace": 2
},
"AttributeId": 13,
"IndexRange": null,
"DataEncoding": null
}
]
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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 is compatible. |
.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
- System.Text.Json (>= 8.0.4)
- Workstation.UaClient (>= 3.2.3)
-
.NETStandard 2.1
- System.Text.Json (>= 8.0.4)
- Workstation.UaClient (>= 3.2.3)
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 |
---|---|---|
0.1.0 | 107 | 8/2/2024 |