open62541 1.5.7+3 copy "open62541: ^1.5.7+3" to clipboard
open62541: ^1.5.7+3 copied to clipboard

Dart FFI bindings to the open62541 OPC UA stack. Provides client and server APIs for OPC UA over TCP, with subscriptions, custom types and mbedTLS encryption.

example/example.dart

import 'dart:io';

import 'package:open62541/open62541.dart';

/// Minimal open62541 client: connect to an OPC UA server and read the
/// current server time.
///
/// Usage:
///   dart run example/example.dart opc.tcp://localhost:4840
void main(List<String> args) async {
  if (args.isEmpty) {
    print('Usage: dart run example/example.dart <endpoint>');
    print('Example: dart run example/example.dart opc.tcp://localhost:4840');
    exit(1);
  }
  final endpoint = args[0];

  final client = Client();

  print('Connecting to $endpoint ...');
  client.connect(endpoint);

  // Drive the client event loop in the background.
  () async {
    while (client.runIterate(Duration(milliseconds: 10))) {
      await Future.delayed(Duration(milliseconds: 10));
    }
  }();

  await client.awaitConnect();
  print('Connected!');

  final serverTime = await client.read(NodeId.serverStatusCurrentTime);
  print('Server time: ${serverTime.asDateTime}');

  client.disconnect();
  await client.delete();
}
0
likes
160
points
65
downloads

Documentation

API reference

Publisher

verified publishercentroid.is

Weekly Downloads

Dart FFI bindings to the open62541 OPC UA stack. Provides client and server APIs for OPC UA over TCP, with subscriptions, custom types and mbedTLS encryption.

Repository (GitHub)
View/report issues

Topics

#network #industrial #opcua #open62541 #hmi

License

MIT (license)

Dependencies

archive, binarize, code_assets, crypto, ffi, hooks, http, logging, native_toolchain_cmake

More

Packages that depend on open62541