first commit

This commit is contained in:
Maik Jurischka
2025-12-18 16:10:55 +01:00
commit 69e2f3ae1d
19 changed files with 2707 additions and 0 deletions

33
socketclient.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef SOCKETCLIENT_H
#define SOCKETCLIENT_H
#include <QObject>
#include <QString>
#include <QJsonDocument>
#include <QJsonObject>
#include <functional>
class SocketClient : public QObject
{
Q_OBJECT
public:
explicit SocketClient(const QString& socketPath = "/tmp/vizion_control.sock", QObject *parent = nullptr);
using ResponseCallback = std::function<void(const QJsonObject&)>;
using ErrorCallback = std::function<void(const QString&)>;
void sendCommand(const QString& command, const QJsonObject& params = QJsonObject(),
ResponseCallback onSuccess = nullptr, ErrorCallback onError = nullptr);
signals:
void commandSuccess(const QJsonObject& response);
void commandError(const QString& errorMessage);
void connectionError(const QString& errorMessage);
private:
QString m_socketPath;
QJsonObject executeCommand(const QString& command, const QJsonObject& params);
};
#endif // SOCKETCLIENT_H