Skip to content

Commit

Permalink
remove System.Reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
trivalik committed Jan 17, 2023
1 parent 11f54d9 commit f19e841
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Supports .NET Core, Universal Windows Platform (UWP), Windows Presentation Frame

### Getting Started

Install package ``Workstation.UaClient`` from [Nuget](https://www.nuget.org/packages/Workstation.UaClient/) to get the latest release for your hmi project.
Install package ``Workstation.UaClient`` from [Nuget](https://www.nuget.org/packages/Workstation.UaClient/) to get the latest release for your HMI project.

Here's an example of reading the variable ``ServerStatus`` from a public OPC UA server.

Expand Down Expand Up @@ -40,7 +40,7 @@ public class Program
clientDescription,
null, // no x509 certificates
new AnonymousIdentity(), // no user identity
"opc.tcp://opcua.rocks:4840", // the public endpoint of a server at opcua.rocks.
"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", // the public endpoint
SecurityPolicyUris.None); // no encryption
try
{
Expand All @@ -58,8 +58,8 @@ public class Program
NodesToRead = new[] {
// construct a ReadValueId from a NodeId and AttributeId.
new ReadValueId {
// you can parse the nodeId from a string.
// e.g. NodeId.Parse("ns=2;s=Demo.Static.Scalar.Double")
// you can parse the NodeId from a string.
// e.g. NodeId.Parse("ns=2;i=10226")
NodeId = NodeId.Parse(VariableIds.Server_ServerStatus),
// variable class nodes have a Value attribute.
AttributeId = AttributeIds.Value
Expand All @@ -83,22 +83,24 @@ public class Program
Console.WriteLine($"\nClosing session '{channel.SessionId}'.");
await channel.CloseAsync();
}
catch(Exception ex)
catch (Exception ex)
{
await channel.AbortAsync();
await channel.AbortAsync();
Console.WriteLine(ex.Message);
}
}
}

// Server status:
// ProductName: open62541 OPC UA Server
// SoftwareVersion: 1.0.0-rc5-52-g04067153-dirty
// ManufacturerName: open62541
// ProductName: OPC UA SDK Samples
// SoftwareVersion: 1.2
// ManufacturerName: OPC Foundation
// State: Running
```

An example of subscribing for a variable by use of [System.Reactive](https://www.nuget.org/packages/System.Reactive/) can be found in our [sample repository](https://github.com/convertersystems/opc-ua-samples/tree/master/ConsoleApp/Program.cs#L122).

### Model, View, ViewModel (MVVM)

For HMI applications, you can use XAML bindings to connect your UI elements to live data.
Expand Down
1 change: 1 addition & 0 deletions UaClient.UnitTests/Workstation.UaClient.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.4.371.50" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
1 change: 0 additions & 1 deletion UaClient/Workstation.UaClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.1" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="7.0.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
Expand Down

0 comments on commit f19e841

Please sign in to comment.