MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / JsonClientConnection

Method JsonClientConnection

sources/jsonserver/JsonClientConnection.cpp:9–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <QHostAddress>
8
9JsonClientConnection::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
26void JsonClientConnection::readRequest()
27{

Callers

nothing calls this directly

Calls 3

initializeMethod · 0.80
toStringMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected