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. OPCUA - match callback to read request
Forum Updated to NodeBB v4.3 + New Features

OPCUA - match callback to read request

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 253 Views 2 Watching
  • 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.
  • _ Offline
    _ Offline
    _Henning_
    wrote on last edited by
    #1

    Hi,

    I am trying to read values using the QOpcUaClient readNodeAttributes method and readNodeAttributesFinished signal.

    We only have one QOpcUaClient instance in our app but multiple source code locations where we read data (and therefore have connected multiple slots to the readNodeAttributesFinished). This is obviously wrong because the reading of one item will (of course) trigger all slots and not just the one I want. The thing is: looking at the signal there seems no (easy) way to match the request to the response. Am I supposed to disconnect/connect signals all the time ? What if I have multiple operation in parallel ? Should I compare all nodeids I receive and hope that a match is unique ? Should I create multiple instances of QOpcUaClient (which is probably quite expensive) ?

    Either I am missing something (obvious ?) or the QT OPC UA API is flawed.

    To me it seems that the signal/slot mechanism is not well suited for this type of problem. Using signal / slot I would at least like to have a 'handle' to match requests and responses easily. Or better not use signal / slot at all and provide a lambda to the readNodeAttributes call.

    Any help is appreciated.

    Henning

    Pablo J. RoginaP 1 Reply Last reply
    0
    • _ _Henning_

      Hi,

      I am trying to read values using the QOpcUaClient readNodeAttributes method and readNodeAttributesFinished signal.

      We only have one QOpcUaClient instance in our app but multiple source code locations where we read data (and therefore have connected multiple slots to the readNodeAttributesFinished). This is obviously wrong because the reading of one item will (of course) trigger all slots and not just the one I want. The thing is: looking at the signal there seems no (easy) way to match the request to the response. Am I supposed to disconnect/connect signals all the time ? What if I have multiple operation in parallel ? Should I compare all nodeids I receive and hope that a match is unique ? Should I create multiple instances of QOpcUaClient (which is probably quite expensive) ?

      Either I am missing something (obvious ?) or the QT OPC UA API is flawed.

      To me it seems that the signal/slot mechanism is not well suited for this type of problem. Using signal / slot I would at least like to have a 'handle' to match requests and responses easily. Or better not use signal / slot at all and provide a lambda to the readNodeAttributes call.

      Any help is appreciated.

      Henning

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by Pablo J. Rogina
      #2

      @_Henning_

      I would at least like to have a 'handle' to match requests and responses easily

      It looks like your looking for QObject::sender() function, see documentation about signals & slots...

      For cases where you may require information on the sender of the signal, Qt provides the QObject::sender() function, which returns a pointer to the object that sent the signal.

      Or better not use signal / slot at all

      Mmm, it doesn't seem a good idea. Signals/slots are a very strong feature of Qt framework...

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2

      • Login

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