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) ...

Get End to End GUI Development with Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.