Deskflow 1.26.0.207
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IpcServer.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2025-2026 Symless Ltd.
4 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
5 */
6
7#pragma once
8
9#include <QObject>
10#include <QSet>
11
12class QLocalServer;
13class QLocalSocket;
14
15namespace deskflow::core::ipc {
16
17class IpcServer : public QObject
18{
19 Q_OBJECT
20
21public:
22 explicit IpcServer(QObject *parent, const QString &serverName, const QString &typeName);
23 ~IpcServer() override;
24
25 void listen();
26 void broadcastCommand(const QString &command, const QString &args = "");
27
28Q_SIGNALS:
29 void logLevelChanged(const QString &logLevel);
30 void configFileChanged(const QString &configFile);
34
35protected:
42 void writeToClientSocket(QLocalSocket *&clientSocket, const QString &message) const;
43
44private:
45 void processMessage(QLocalSocket *clientSocket, const QString &message);
46 virtual void processCommand(QLocalSocket *clientSocket, const QString &command, const QStringList &parts) = 0;
47 void handleNewConnection();
48 void handleReadyRead();
49 void handleDisconnected();
50 void handleErrorOccurred();
51
52 QLocalServer *m_server;
53 QSet<QLocalSocket *> m_clients;
54 QString m_serverName;
55 QStringList m_pendingMessages;
56 QByteArray m_typeName;
57};
58
59} // namespace deskflow::core::ipc
void broadcastCommand(const QString &command, const QString &args="")
Definition IpcServer.cpp:157
IpcServer(QObject *parent, const QString &serverName, const QString &typeName)
Definition IpcServer.cpp:17
void listen()
Definition IpcServer.cpp:31
void configFileChanged(const QString &configFile)
void logLevelChanged(const QString &logLevel)
~IpcServer() override
Definition IpcServer.cpp:26
void writeToClientSocket(QLocalSocket *&clientSocket, const QString &message) const
Definition IpcServer.cpp:179
Definition DaemonApp.h:18