mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
added skeleton for the json connection server
This commit is contained in:
39
libsrc/jsonserver/JsonClientConnection.h
Normal file
39
libsrc/jsonserver/JsonClientConnection.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
// stl includes
|
||||
#include <string>
|
||||
|
||||
// Qt includes
|
||||
#include <QByteArray>
|
||||
#include <QTcpSocket>
|
||||
|
||||
// jsoncpp includes
|
||||
#include <json/json.h>
|
||||
|
||||
class JsonClientConnection : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
JsonClientConnection(QTcpSocket * socket);
|
||||
~JsonClientConnection();
|
||||
|
||||
signals:
|
||||
void connectionClosed(JsonClientConnection * connection);
|
||||
|
||||
private slots:
|
||||
void readData();
|
||||
void socketClosed();
|
||||
|
||||
private:
|
||||
void handleMessage(const std::string & message);
|
||||
void handleNotImplemented(const Json::Value & message);
|
||||
|
||||
void sendMessage(const Json::Value & message);
|
||||
void sendErrorReply(const std::string & error);
|
||||
|
||||
private:
|
||||
QTcpSocket * _socket;
|
||||
|
||||
QByteArray _receiveBuffer;
|
||||
};
|
Reference in New Issue
Block a user