Skip to content

Samples

locka99 edited this page Nov 14, 2017 · 2 revisions

At this point the API is in development and this page is TODO but the basic's of development are fairly straight forward.

Crates

The following crates are defined for OPC UA for Rust

  1. opcua-types. Types, structs and enums for OPC UA data. Many types are auto-generated from OPC UA schemas
  2. opcua-core. Core functionality shared by client and server such as crypto, pki, chunking, secure-channel management
  3. opcua-server. Server side functionality, TCP transport, service implementations, subscriptions and address space.
  4. opcua-client. Client side functionality, TCP transport, subscriptions.
  5. 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.

Client

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.

Server

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.

Samples

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 to simple-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.
Clone this wiki locally