#opc-ua #plc #automation #safe-bindings #hardware #protocols #api-bindings

open62541

High-level, safe bindings for the C99 library open62541, an open source and free implementation of OPC UA (OPC Unified Architecture)

7 releases (4 breaking)

0.6.0-pre.2 Apr 12, 2024
0.6.0-pre.1 Apr 5, 2024
0.5.0 Mar 1, 2024
0.4.0 Feb 12, 2024
0.2.2 Jan 12, 2024

#514 in Network programming

Download history 23/week @ 2024-01-15 40/week @ 2024-01-22 33/week @ 2024-02-05 50/week @ 2024-02-12 79/week @ 2024-02-19 188/week @ 2024-02-26 39/week @ 2024-03-04 15/week @ 2024-03-11 63/week @ 2024-04-01 90/week @ 2024-04-08 8/week @ 2024-04-15

104 downloads per month

MPL-2.0 license

220KB
3.5K SLoC

open62541

crates.io Docs Dependencies Testing License: MPL 2.0

This crate provides high-level, safe bindings for the C99 library open62541, an open source and free implementation of OPC UA.


lib.rs:

Rust wrapper for the open62541 library.

Examples

Connect to server

use open62541::AsyncClient;

#
let client = AsyncClient::new("opc.tcp://opcuademo.sterfive.com:26543")?;
#

Read node's value attribute

use open62541::ua::NodeId;

#
#
let node_id = NodeId::numeric(0, 2258); // Server/ServerStatus/CurrentTime

let value = client.read_value(&node_id).await?;

println!("Received value: {value:?}");
#

Watch node for changes in value attribute

#
#
#
#
// Create subscription that receives the updates.
let subscription = client.create_subscription().await?;
// Create monitored item to receive node updates.
let mut monitored_item = subscription.create_monitored_item(&node_id).await?;

while let Some(value) = monitored_item.next().await {
    println!("Received value: {value:?}");
}
#

Dependencies

~8–12MB
~221K SLoC