-
Notifications
You must be signed in to change notification settings - Fork 139
Samples
At this point the API is in development and this page is TODO but the basic's of development are fairly straight forward.
The following crates are defined for OPC UA for Rust
-
opcua-types
. Types, structs and enums for OPC UA data. Many types are auto-generated from OPC UA schemas -
opcua-core
. Core functionality shared by client and server such as crypto, pki, chunking, secure-channel management -
opcua-server
. Server side functionality, TCP transport, service implementations, subscriptions and address space. -
opcua-client
. Client side functionality, TCP transport, subscriptions. -
opcua-certificate-creator
. Standalone tool for creating OPC UA compatible SSL certificates.
Versioned crates are intermittently published. Functionality has matured substantially from > 0.2 so crates below that version are not recommended.
A client will first construct a Client
using a ClientConfig
. The configuration describes the information that a client needs to connect to a server. When the client is ready, it then creates a new Session
to the server. The session maintains state and has functions that send OPC UA messages to the server allowing it to read nodes, write values, browse the address space etc.
A server will first construct a Server
using a ServerConfig
. The configuration describes the endpoints the server supports, pki settings, users etc. The server listens for connections and creates a Session
for each that handles client connections. The server developer can add new nodes like variables to the server address space and attach push / poll functionality to update values. It is expected that the implementation will map variables onto some data which clients are interested in.
Refer to the samples/
folder for example code:
-
simple-server
demonstrates a very simple OPC UA server. -
simple-client
demonstrates a very simple OPC UA client that connects tosimple-server
-
chess-server
is an OPC UA server that plays chess against itself, exposing game state via node ids. Refer to the README.md in the folder for more information.