re-organize folder structure

This commit is contained in:
Maik Jurischka
2025-12-19 13:08:28 +01:00
parent a2d2f256cf
commit bb9b5cc619
12 changed files with 43 additions and 31 deletions

View File

@@ -0,0 +1,37 @@
/*
* VizionStreamer - Unix Socket Server Interface
* Copyright (c) 2025 Maik Jurischka
*
* Licensed under CC BY-NC-SA 4.0
* https://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#pragma once
#include <string>
#include <functional>
#include <thread>
#include <atomic>
#include <memory>
class SocketServer {
public:
using CommandCallback = std::function<std::string(const std::string&)>;
explicit SocketServer(const std::string& socketPath);
~SocketServer();
bool start(CommandCallback callback);
void stop();
bool isRunning() const { return running_; }
private:
void serverLoop();
void handleClient(int clientFd);
std::string socketPath_;
int serverFd_;
std::atomic<bool> running_;
std::unique_ptr<std::thread> serverThread_;
CommandCallback commandCallback_;
};