初试 Qt OPC UA with open62541

目录 Content
[hide]

一、技术背景

1、关于 open62541

open62541 是一个开源C的 OPC UA 实现,基于 MPL 授权(商业软件可以使用,也可以修改MPL协议的代码,但修改后的代码版权归软件的发起者)。

2、Qt OPC UA

Qt OPC  UA  Module 通过 Qt API 和 第三方的 OPC UA 栈交互。

Qt OPC  UA  Module 的授权:

The Qt OPC UA module is available under commercial licenses from The Qt Company. In addition, it is available under free software licenses. These free software licenses are GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt Licensing for further details.

Furthermore Qt OPC UA contains plugins under following licenses:

Open62541
The Open62541 plugin is available under the same licenses as Qt OPC UA. The Open62541 library itself is licensed under Mozilla Public License v2.0.

版权有待理解。

二、编译安装

按照下篇这个文章所描述的步骤进行编译安装。注意编译需要 Perl ,可在安装 Qt 时选择安装。

1、编译插件

使用 VS2015 编译器,运行 “Qt 5.12.3 (MSVC 2015 64-bit)” 命令行快捷方式:

git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 5.12
mkdir build
cd build
qmake ..
nmake
nmake install

即可编译和安装成功。

D:\qtopcua\build>qmake ..
Info: creating stash file D:\qtopcua\build\.qmake.stash
Info: creating cache file D:\qtopcua\build\.qmake.cache

Running configuration tests...
Checking for Open62541... no
Checking for Unified Automation C++ SDK... no
Done running configuration tests.

Configure summary:

Qt Opcua:
  Open62541 .............................. yes
  Unified Automation C++ SDK ............. no
  Support for namespace 0 NodeId names ... yes
  Namespace 0 NodeIds generator .......... no

Qt is now configured for building. Just run 'nmake'.
Once everything is built, you must run 'nmake install'.
Qt will be installed into 'C:\Qt\Qt5.12.3\5.12.3\msvc2015_64'.

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

2、创建文档

在此命令行接着运行下面命令,即可创建文档。

nmake docs
nmake install_docs

3、构建例程

在此命令行接着运行下面命令,即可构建例程。

nmake sub-examples

包含两个例子,可直接在命令行里运行测试

  • opcuaviewer
  • waterpump

 

延伸阅读

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.