O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the constructor and init method

Upon creation and initialization of the HTTP Receiver, we should perform the following things:

  1. Instantiate a network access manager to perform HTTP requests
  2. Set up a timer to perform requests at regular intervals
  3. Connect the timer's timeout with the issuing of an HTTP request
  4. Connect the network access manager's finished signal, containing the reply, to the receiveReadings slot
  5. Start the timer

We decided to put the first four steps of the preceding list in the class constructor, and start the timer in the init method. The choice, of course, is up to you, depending on your specific requirements. The constructor for ReceiverHttp will thus look as follows:

// receiver_http.cpp#include "receiver_http.h" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required