lacteApp
C++17 service for Lacte hardware
Loading...
Searching...
No Matches
RfbServer.hpp
Go to the documentation of this file.
1#pragma once
2#ifdef __linux__
3
4#include <atomic>
5#include <cstdint>
6#include <string>
7#include <thread>
8#include <vector>
9
12
57namespace lacte::vnc {
58
59class RfbServer {
60 public:
61 RfbServer(tinygui::FramebufferView& fb, TouchInputInjector& input,
62 tinygui::TouchCalibration touch_calibration, std::string bind_addr,
63 std::uint16_t port, std::string password);
64 ~RfbServer();
65
66 RfbServer(const RfbServer&) = delete;
67 auto operator=(const RfbServer&) -> RfbServer& = delete;
68
74 [[nodiscard]] auto start() -> std::string;
75
80 void stop();
81
82 private:
83 void accept_loop();
84 void handle_client(int client_fd) const;
85
86 tinygui::FramebufferView& fb_;
87 TouchInputInjector& input_;
88 tinygui::TouchCalibration touch_calibration_;
89 std::string bind_addr_;
90 std::uint16_t port_;
91 std::string password_;
92
93 int listen_fd_{-1};
94 std::atomic_bool running_{false};
95 std::thread accept_thread_;
96};
97
98} // namespace lacte::vnc
99
100#endif // __linux__