Reputation: 134
We have a background service, which has the single purpose of getting recent data from a server.
Now the server should be an OPC-UA server. Unfortunaly, the SDKs and examples I found to connect to this are limited/only explained in ways that are heavily integrated with a classic windows forms application. Up to the point where its impossible to separate GUI from business logic.
At this point I'm wondering if we are misusing the client functionality and should opt for a different way?
Ideally I'd like to wrap the whole OPC-UA Logic inside a class library and just call GetData(), is that impossible?
Upvotes: 1
Views: 1969
Reputation: 101
You might find Tutorials for Client development, specifically Console Client useful. This is a much better SDK than the one from the OPC Foundation. You will find full C# samples including a console client application (no GUI).
You might want to re-evalute your needs for
Ideally I'd like to wrap the whole OPC-UA Logic inside a class library and just call GetData(), is that impossible?
It is totally possible, but with OPC-UA, you have to keep in mind that it is recommended to get data using a subscription model (Monitored Items) instead of performing an explicit Read for a value (unless you just want to read an attribute once). So, I would make sure that however you are building your client-side class makes sense for the needs of your application.
Upvotes: 1
Reputation: 1608
You are probably referring to the "SDK" provided by the OPC Foundation - but you have not stated that explicitly in your question; in fact, you used the term "SDKs", in plural. There certainly are also commercial SDKs which might be better in this respect.
Here is one (QuickOPC), together with one-liner example of reading the OPC UA data: https://www.opclabs.com/products/quickopc/opc-specifications/unified-architecture/generic-data . Disclaimer: This is a self-promotion.
Upvotes: 2