mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
45 lines
795 B
C++
45 lines
795 B
C++
#pragma once
|
|
|
|
// stl includes
|
|
#include <string>
|
|
|
|
// Qt includes
|
|
#include <QByteArray>
|
|
#include <QTcpSocket>
|
|
|
|
// jsoncpp includes
|
|
#include <json/json.h>
|
|
|
|
// util includes
|
|
#include <utils/jsonschema/JsonSchemaChecker.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;
|
|
|
|
JsonSchemaChecker _schemaChecker;
|
|
|
|
QByteArray _receiveBuffer;
|
|
};
|