GithubHelp home page GithubHelp logo

jurihock / reopen62541 Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 208 KB

C++ and C++/CLI extension for the open62541.org implementation of OPC UA

License: Mozilla Public License 2.0

CMake 6.30% C++ 84.93% Batchfile 0.17% C# 8.45% C 0.14%
opc opcua opc-ua open62541 iec-62541 cpp cpp17 server client cpp-cli csharp

reopen62541's Introduction

reopen62541

reopen62541 is an attempt to extend the great open62541 by the C++17 and C++/CLI interfaces, to hopefully minimize the syntactic overhead as well as provide a certain syntactic uniformity in C++ and C# environments. The goal is however not to support the complete feature set of the open62541 implementation or even all specified OPC UA nuances. In other words, reopen62541 is not designed for complexity, but for simplicity.

Features

  • Basic server and client instance management
  • Callback based log message forwarding
  • Callback based variable and method binding
  • Template/generics based data type conversion
  • Support of main data types like boolean, integers, floats and strings
  • Support of scalars and vectors
  • Unicode string handling

Examples

Create server and client instances

C++ C#
ua::server server;
server.run_async(); server.shutdown();
ua::client client;
client.connect(); client.disconnect();
var server = new UA.Server();
server.RunAsync(); server.Shutdown();
var client = new UA.Client();
client.Connect(); client.Disconnect();

Create objects and folders

C++ C#
server.add_object(
  "MyObject",
  "The root object");
server.add_folder( "MyFolder", "Folder inside object", { "MyObject" });
server.AddObject(
  "MyObject",
  "The root object");
server.AddFolder( "MyFolder", "Folder inside object", new[] { "MyObject" });

Implement variables on the server side

C++ C#
int variable = 0;
server.add_variable<int>( "MyVariable", "Variable inside folder", { "MyObject", "MyFolder" }, [&](ua::variant& output) { output.set<int>(variable); }, [&](const ua::variant& input) { variable = input.get<int>(); });
int variable = 0;
server.AddVariable<int>( "MyVariable", "Variable inside folder", new[] { "MyObject", "MyFolder" }, output => { output.Set<int>(variable); }, input => { variable = input.Get<int>(); });

Access variables on the client side

C++ C#
int variable = 0;
variable = client.get<int>( "MyVariable", { "MyObject", "MyFolder" });
client.set<int>( "MyVariable", { "MyObject", "MyFolder" }, variable);
int variable = 0;
variable = client.Get<int>( "MyVariable", new[] { "MyObject", "MyFolder" });
client.Set<int>( "MyVariable", new[] { "MyObject", "MyFolder" }, variable);

License

This Source Code Form is subject to the terms of the Mozilla Public License 2.0. The file LICENSE contains a copy of the MPL. Alternatively obtain another one at https://mozilla.org/MPL/2.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.