Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. override processRequest in QModbusTcpServer
Forum Updated to NodeBB v4.3 + New Features

override processRequest in QModbusTcpServer

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 275 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.
  • B Offline
    B Offline
    Bjorn.Gurnett
    wrote on last edited by
    #1

    Hi

    We are trying to delay the response time for a modbusTcpServer connection. We want to do this in order to not get flooded by requests from any client that connects to our device. The idea we have is to simply delay the response from our device. What we are doing is subclassing the QModbusTcpServer class and overriding the processRequest function. However, our override does not seem to be called at all (based on no debug code being shown). In the subclass header we have

    protected:
    QModbusResponse processRequest(const QModbusPdu &request) override;

    and

    QModbusResponse ModbusTcpServer::processRequest(const QModbusPdu &request)
    {
    qDebug() << Q_FUNC_INFO;
    .
    // code to delay return so as to slow down response to client
    .
    return QModbusTcpServer::processRequest(request);
    }

    The entire modbus code is running in a separate thread and is working fine with the exception that the override is not be called.

    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      Please use the code formatting tags provided in the composition widnow to format your code. Makes it so much easier to read and saves the time of volunteers trying to help you.

      The override syntax is correct. Virtual dispatch gets skipped in the class constructor. That could be one reason. Another reason could be, that the object isn't a ModbusTcpServer. Put some more qDebug() << Q_FUNC_INFO; e.g. in the class constructor.
      You could also make the override public and see what happens when you call it directly.

      Software Engineer
      The Qt Company, Oslo

      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