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. Monitoring OpcUa nodes does not work always
Qt 6.11 is out! See what's new in the release blog

Monitoring OpcUa nodes does not work always

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

    I'm trying to enable the monitoring of the value of several QpcUa nodes, but I receive the handleAttribute slot only for one.

    Here I set up my nodes:

    typedef struct
    {
        QOpcUaNode *node;
        QVariant value;
        bool updated;
        bool enableRead;
    } Node_t;
    
    void MyOpcUa::insertNode(QString key, QString id, bool enableRead)
    {
        Node_t node; // my internal struct
        node.node = _opcUaClient->node(id); // the actual OpcUa node
        node.value = QVariant();
        node.updated = false;
        node.enableRead = enableRead;
    
        Q_ASSERT(node.node); // check the node is valid
        _mapOpcNodes.insert(key, node);
        connect(node.node, &QOpcUaNode::attributeRead, this, &MyOpcUa::handleAttributes);
        connect(node.node, &QOpcUaNode::attributeUpdated, this, &MyOpcUa::handleAttributes);
    }
    

    After connection, I enable the monitoring:

    void MyOpcUa::enableMonitoring()
    {
       QMapIterator<QString, Node_t> i(_mapOpcNodes);
        while (i.hasNext())
        {
            i.next();
            Node_t node = i.value();
            if (node.enableRead)
            {
                qDebug() << node.node->enableMonitoring(QOpcUa::NodeAttribute::Value, QOpcUaMonitoringParameters(1000));
            }
        }
    }
    

    all the calls for enableMonitoring() return true.
    But, say, I enable the monitoring for 5 nodes, only one is actually read periodically.

    All of the nodes are of class variable hence they support monitoring. Furthermore using Qt OPA UA Viewer example application I can monitoring them.

    Instead with my application I can monitor only one, the others are not periodically read. Of course I can read them manually.

    I don't see any differences among them:

    c7acb009-518e-4b05-b46c-f605663eb985-immagine.png

    I can monitor only udiActualOrderLengthRT with my application.

    M 1 Reply Last reply
    0
    • M Mark81

      I'm trying to enable the monitoring of the value of several QpcUa nodes, but I receive the handleAttribute slot only for one.

      Here I set up my nodes:

      typedef struct
      {
          QOpcUaNode *node;
          QVariant value;
          bool updated;
          bool enableRead;
      } Node_t;
      
      void MyOpcUa::insertNode(QString key, QString id, bool enableRead)
      {
          Node_t node; // my internal struct
          node.node = _opcUaClient->node(id); // the actual OpcUa node
          node.value = QVariant();
          node.updated = false;
          node.enableRead = enableRead;
      
          Q_ASSERT(node.node); // check the node is valid
          _mapOpcNodes.insert(key, node);
          connect(node.node, &QOpcUaNode::attributeRead, this, &MyOpcUa::handleAttributes);
          connect(node.node, &QOpcUaNode::attributeUpdated, this, &MyOpcUa::handleAttributes);
      }
      

      After connection, I enable the monitoring:

      void MyOpcUa::enableMonitoring()
      {
         QMapIterator<QString, Node_t> i(_mapOpcNodes);
          while (i.hasNext())
          {
              i.next();
              Node_t node = i.value();
              if (node.enableRead)
              {
                  qDebug() << node.node->enableMonitoring(QOpcUa::NodeAttribute::Value, QOpcUaMonitoringParameters(1000));
              }
          }
      }
      

      all the calls for enableMonitoring() return true.
      But, say, I enable the monitoring for 5 nodes, only one is actually read periodically.

      All of the nodes are of class variable hence they support monitoring. Furthermore using Qt OPA UA Viewer example application I can monitoring them.

      Instead with my application I can monitor only one, the others are not periodically read. Of course I can read them manually.

      I don't see any differences among them:

      c7acb009-518e-4b05-b46c-f605663eb985-immagine.png

      I can monitor only udiActualOrderLengthRT with my application.

      M Offline
      M Offline
      Mark81
      wrote on last edited by
      #2

      @Mark81 I tried to check the signal enableMonitoringFinished and I get a success:

      void MyOpcUa::enableMonitoringFinished(QOpcUa::NodeAttribute attr, QOpcUa::UaStatusCode statusCode)
      {
          qDebug() << attr << statusCode;
      }
      
      QOpcUa::NodeAttribute::Value QOpcUa::Good
      
      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