1
0
mirror of https://github.com/FreeOpcUa/freeopcua synced 2025-10-26 19:56:54 +08:00
Go to file
2021-01-07 16:22:06 +01:00
.github/workflows Add GitHub Actions CI config 2021-01-07 16:22:06 +01:00
debian Fix Debian build. 2017-10-02 18:59:56 +02:00
include/opc Merge pull request #366 from Sam071100/master 2021-01-07 16:02:50 +01:00
python Devel (#345) 2019-10-10 14:33:08 +02:00
schemas reduce stack impact of initialisation 2017-10-02 19:02:27 +02:00
src Merge pull request #356 from morxa/use-system-spdlog 2020-11-23 21:20:21 +01:00
tests Travis (#346) 2019-10-10 18:07:44 +02:00
.gitignore Devel (#345) 2019-10-10 14:33:08 +02:00
.travis.yml Travis (#346) 2019-10-10 18:07:44 +02:00
astylerc Consistent C++ styling (#243) 2017-05-30 21:20:57 +02:00
AUTHORS merge 2014-11-09 17:15:36 +01:00
autogen.sh removed files that can be generated by autotools. 2014-08-06 01:14:24 +04:00
build.sh Refactored headers. There were repitition in names: sunscriptions.h and subscription.h. I have moved all services headers into a corresponding folder. All high level wrappers are in the top sirectory.Fixed stopping of server: there was a deadlock on DbMutex at address space. I have removed locking it from destructor because object is invalid state and at this moment cannot process requests. 2014-08-11 00:58:10 +04:00
ChangeLog New sources structure. 2014-06-22 12:42:12 +04:00
CMakeLists.txt Use target compile options when adding compile options for spdlog 2020-04-23 11:30:28 +02:00
configure.ac cleanup autoreconf autogenerated files 2017-11-03 13:32:18 +01:00
COPYING New sources structure. 2014-06-22 12:42:12 +04:00
debian.soft New sources structure. 2014-06-22 12:42:12 +04:00
Dockerfile Adds a dockerfile 2015-07-03 15:34:17 +08:00
libopcuaclient.pc.in Add extra cflags to all pkgconfig file templates 2020-04-23 11:32:03 +02:00
libopcuacore.pc.in Add extra cflags to all pkgconfig file templates 2020-04-23 11:32:03 +02:00
libopcuaprotocol.pc.in Add extra cflags to all pkgconfig file templates 2020-04-23 11:32:03 +02:00
libopcuaserver.pc.in Add extra cflags to all pkgconfig file templates 2020-04-23 11:32:03 +02:00
make_deb.sh New sources structure. 2014-06-22 12:42:12 +04:00
Makefile.am debug errors with linux compilation 2017-11-03 13:32:18 +01:00
NEWS New sources structure. 2014-06-22 12:42:12 +04:00
README.md Consistent C++ styling (#243) 2017-05-30 21:20:57 +02:00
restyle Consistent C++ styling (#243) 2017-05-30 21:20:57 +02:00
StatusCodes.csv Node ids are generated. Updated standard address space to have predefined node ids in Server Object. 2014-11-14 10:13:21 +04:00

Open Source C++ OPC-UA Server and Client Library

Build Status

LGPL OPC-UA server and client library written in C++ and with a lot of code auto-generated from xml specification using python.

Python bindings can be found in the python directory.

code: https://github.com/FreeOpcUa/freeopcua
website: http://freeopcua.github.io/
mailing list: https://groups.google.com/forum/#!forum/freeopcua

Currently supported:

  • read, write, browse
  • translateBrowsePathToNodeId
  • DataChange Events
  • Events
  • Subscriptions
  • complete opc-ua address space generated from xml specification
  • Method call from client
  • Linux and Windows(VS13) support

Work in progress

  • StatusChange Events
  • Filtering
  • Documentation
  • Automatic generation of binary protocol from OPC schema files
    • Methods on server side

Not implemented yet (patches are welcome)

  • History
  • Security: Authentication, Certificates handling, ..

Usage

Documentation is sparse but several examples are availables:

C++ examples in https://github.com/FreeOpcUa/freeopcua/tree/master/src/examples
Python examples in https://github.com/FreeOpcUa/freeopcua/tree/master/python/src
https://github.com/FreeOpcUa/freeopcua/blob/master/python/tests/test_highlevel.py can also be a usefull source of information

Example minimal client in python

  client = opcua.Client(False)
  client.connect("opc.tcp://10.10.10.4:4841/OPCUA/AnyServer/")

  objects = client.get_objects_node()
  print("Children of objects are: ", objects.get_children())

  var = objects.get_child(["3:AnObject", "AVariable"])
  print("Value of variable is: ", var.get_value())
  
  client.disconnect()

Tested clients and servers with default settings

  • uaexperts client application
  • node-opcua (client and server tested)
  • ignition server
  • Beckhoff PLC (seems to be some issues, but mostly working)
  • ignition open-source sdk (server tested)
  • quickopc client sdk
  • prosysopc demo client
  • prosysopc demo server
  • unified automation sdk (client and server tested)

Installation

An environment supporting c++11 is necessary: gcc-4.8+, clang 3.4 or VS2013

Ubuntu (Debians)

There is a script debian.soft in the root for installing all required soft to build all repositories.

Using GNU autotools

autoreconf -f -i
./configure --prefix=/path/to/server
make 
make check
make install
cd /path/to/server
LD_LIBRARY_PATH=./lib ./bin/opcuaserver

Using cmake

Linux

mkdir build
cd build
cmake ..
make
make test

Windows

Boost and libxml2 are necessary

rem compiling
mkdir build
cd build
cmake .. -DBOOST_ROOT=c:\boost_1_56
cmake --build
ctest -C Debug
cd bin\Debug
example_server.exe

Docker

docker build .

Developement

C++ style

  • 2 spaces not tab
  • CamelCase
  • Local variables start with small letter
  • Global/member variables starts with capital letters
  • Use provided automatic formatter (Artistic Style) by invoking ./restyle

python code and API should follows PEP8 (many places should be fixed)

Address space and most protocol code are auto-generated and should not be modified directly. Every auto-generated file starts with a mention that it should not be edited. There's a lot of old hand written protocol code left that should use the auto-generated code. This is done by uncommenting struct names in schemas/generate_protocol.py and removing old code and files in src/protocol and include/opc/ua/protocol/