| 7 | #include <QHostAddress> |
| 8 | |
| 9 | JsonClientConnection::JsonClientConnection(QTcpSocket* socket, bool localConnection) |
| 10 | : QObject() |
| 11 | , _socket(socket) |
| 12 | , _receiveBuffer() |
| 13 | , _log(Logger::getInstance("JSONCLIENTCONNECTION")) |
| 14 | { |
| 15 | connect(_socket, &QTcpSocket::disconnected, this, &JsonClientConnection::disconnected); |
| 16 | connect(_socket, &QTcpSocket::readyRead, this, &JsonClientConnection::readRequest); |
| 17 | // create a new instance of JsonAPI |
| 18 | _hyperAPI = new HyperAPI(socket->peerAddress().toString(), _log, localConnection, this); |
| 19 | // get the callback messages from JsonAPI and send it to the client |
| 20 | connect(_hyperAPI, &HyperAPI::SignalCallbackJsonMessage, this, &JsonClientConnection::sendMessage); |
| 21 | connect(_hyperAPI, &HyperAPI::SignalPerformClientDisconnection, this, [&]() { _socket->close(); }); |
| 22 | |
| 23 | _hyperAPI->initialize(); |
| 24 | } |
| 25 | |
| 26 | void JsonClientConnection::readRequest() |
| 27 | { |
nothing calls this directly
no test coverage detected