This is the traditional model, “natural” to many software developers. Its advantage is that you have high level of control over what is happening, and you can structure the code the way you like it. The disadvantage is that you may end up writing more code than it’s necessary, compared to other models.
There is nothing too surprising here. Generally, your code will do the following steps:
We have paid great attention to design the API for easy use by the developer. As a result, with QuickOPC you can write short and readable code, for example:
// Read item value and display it in a message box
"", "OPCLabs.KitServer.2", "Demo.Single").ToString());
While the underlying OPC mechanisms are intrinsically connection-based, the QuickOPC API gives you a totally connection-less "feeling" of OPC. The connections are managed internally by the component. You just call the methods to perform the operations you need. QuickOPC takes care of creating and destroying the connections, detecting connection problems, and automatic reconnections.
This is valid even with subscriptions: When you subscribe to something, you declare an intent to be subscribed; the subscription remains valid until you explicitly unsubscribe, and it "survives" any connection problems in between. Even if the subscription cannot be made at the moment, the call succeeds, just giving you a notification of the problem over the usual channel. If the connection is established later, the data will start flowing.
The connection-less nature of the QuickOPC API is a great advantage over other toolkits or libraries that work on much lower level, and force you to write the connection management and housekeeping code.
QuickOPC provides wide range of developer productivity features: Intellisense, ReSharper annotations, Code Contracts, serialization support, and many more.