blob: 0fbd54dd323a38de2f9ca16b58c5aa09f80bc722 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#pragma once
// qt
#include <QHostAddress>
#include <QHttpServerResponse>
// #include <QObject>
class ICamera;
class QHttpServer;
class HttpServer // : public QObject
{
// Q_OBJECT
private:
struct Stats
{
uint64_t GET_pixels_us{0};
} m_stats{0};
public:
static constexpr auto DefaultAddress = QHostAddress::Any;
static constexpr uint16_t DefaultPort{8080};
public:
explicit HttpServer(ICamera *camera,
// QObject *parent = nullptr,
const QHostAddress &address = DefaultAddress,
const uint16_t port = DefaultPort);
// TODO: methods starting with GET_/POST_ will be routed automatically
public:
QHttpServerResponse GET_pixels();
private:
// std::weak_ptr<ICamera> m_camera;
ICamera *m_camera{nullptr};
QHostAddress m_address{DefaultAddress};
uint16_t m_port{DefaultPort};
std::shared_ptr<QHttpServer> m_server;
};
|