Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to connect to OpcUa Server using Qt library?

How to connect to OpcUa Server using Qt library?

Scheduled Pinned Locked Moved Unsolved General and Desktop
opc clientopcua
7 Posts 3 Posters 6.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • vishnuV Offline
    vishnuV Offline
    vishnu
    wrote on last edited by
    #1

    Hello All,

    I have a OpcUa Server running on a Codesys PLC. I need to implement a simple app that

    • Connects to the OpcUa server(i.e PLC).

    • Read the Data from the PLC and display it on the screen.

    • write the Data and send it to the server.

    Can any one throw some hints on How can I implement OpcUa client in Qt? Thanks

    In my research I have gone through these results:

    • https://blog.basyskom.com/2015/introducing-qtopcua/

    • https://github.com/FreeOpcUa/freeopcua

    • This compay has implemented OpcUa client in QML. but no s(. ce code :(.

    Thanks a lot :)

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kuzulis
      Qt Champions 2020
      wrote on last edited by
      #2

      http://code.qt.io/cgit/qt/qtopcua.git/ ?

      vishnuV 2 Replies Last reply
      0
      • K kuzulis

        http://code.qt.io/cgit/qt/qtopcua.git/ ?

        vishnuV Offline
        vishnuV Offline
        vishnu
        wrote on last edited by vishnu
        #3

        @kuzulis
        I couldn't find the code. All the urls mentioned in the link are resulted as 404. Do you have any piece of code? Thanks a lot.

        1 Reply Last reply
        0
        • K kuzulis

          http://code.qt.io/cgit/qt/qtopcua.git/ ?

          vishnuV Offline
          vishnuV Offline
          vishnu
          wrote on last edited by
          #4

          @kuzulis
          found the code Here. Since it is available from 5.7 I have downloaded from here.

          Now How Can I add the code that I have downloaded from github to my project?

          I tried adding external libraries but It didn't detect. Thanks

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            To get the code from the repository just clone it using git. All addresses are at the bottom of the page @kuzulis indicated.

            If you want to use the qtopcua module in your project, you have to add QT += opcua to your .pro file but first you have to compile and install the module. For that the usual combo applies: qmake, make, make install

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            vishnuV 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              To get the code from the repository just clone it using git. All addresses are at the bottom of the page @kuzulis indicated.

              If you want to use the qtopcua module in your project, you have to add QT += opcua to your .pro file but first you have to compile and install the module. For that the usual combo applies: qmake, make, make install

              vishnuV Offline
              vishnuV Offline
              vishnu
              wrote on last edited by
              #6

              @SGaist

              If you want to use the qtopcua module in your project, you have to add QT += opcua to your .pro file

              As you said it has resulted me Unknown module QT:opcua because i didn't compile and install the module.

              but first you have to compile and install the module. For that the usual combo applies: qmake, make, make install.

              I couldn't find the instructions on how to install this module using qmake, make, make install.
              **Could you point me to an example or tutorial? **

              FYI: Since Qtopcua is using freeopcua I think i need to add first freeopuca libraries first. Since freeopcua needs Boost and libxml2 for Windows( seen in README.md). So I need to add Boost and libxml2 to my Qt Creator and add it to my QOPCUAClient Project. Then install the module Qtopcua . Finally Run. Are my steps are correct ? Thank you so much.

              P.S: Sorry for late reply.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                The combo described is the list of commands you use to build a Qt module. Since you are on windows, make will be either nmake if you are using Visual Studio or mingw32-make if your MinGW.

                What do you mean by "add to Qt Creator" ? You will need to add the paths to their respective .dlls folder to the PATH environment variable in the Run part of the Project panel so they are found when running your application from Qt Creator.

                There should be no need to add them to your project, everything should be handled by the module itself.

                But no, you should first build and install the module and then build your project.

                On a side note, I wouldn't name a project with something that resembles to a Qt class unless you plan to submit it for inclusion in the module ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved