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 HTTP BroadcasterChannel

Now that we have an HTTP server library in our project, we can use it to create an HTTP-based BroadcasterChannel that sends sensor data over HTTP.

In the usual way, we create a new class called channels::BroadcasterHttp that inherits from channels::BrodcasterChannel, just like channels::BroadcasterBt did. The following is the API that we will want to provide specific implementations for:

// broadcaster_http.h#ifndef BROADCASTER_HTTP_H#define BROADCASTER_HTTP_H#include "broadcaster_channel.h"namespace channels {class BroadcasterHttp : public BroadcasterChannel{public:    explicit BroadcasterHttp(QObject* parent = nullptr);    bool init() override;public slots: void sendReadings(QList<QVariantMap> readings) ...

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