- prepare general way to send (proto) messages. currently only incomming protomessages are forwarded

- begin impl. of json server


Former-commit-id: 8f9237cd57ada1e84dc05e60b9ad723e47fd57b1
This commit is contained in:
redpanther
2016-02-15 18:25:18 +01:00
parent 5dc59344c4
commit b01b5eb005
12 changed files with 287 additions and 104 deletions

View File

@@ -20,7 +20,7 @@
// project includes
#include "ProtoClientConnection.h"
ProtoClientConnection::ProtoClientConnection(QTcpSocket *socket, Hyperion * hyperion, QStringList forwardClientList) :
ProtoClientConnection::ProtoClientConnection(QTcpSocket *socket, Hyperion * hyperion) :
QObject(),
_socket(socket),
_imageProcessor(ImageProcessorFactory::getInstance().newImageProcessor()),
@@ -30,22 +30,11 @@ ProtoClientConnection::ProtoClientConnection(QTcpSocket *socket, Hyperion * hype
// connect internal signals and slots
connect(_socket, SIGNAL(disconnected()), this, SLOT(socketClosed()));
connect(_socket, SIGNAL(readyRead()), this, SLOT(readData()));
for (int i = 0; i < forwardClientList.size(); ++i) {
std::cout << "Proto forward to " << forwardClientList.at(i).toLocal8Bit().constData() << std::endl;
ProtoConnection* p = new ProtoConnection("127.0.0.1:19445");
p->setSkipReply(true);
_proxy_connections << p;
}
}
ProtoClientConnection::~ProtoClientConnection()
{
delete _socket;
while (!_proxy_connections.isEmpty())
delete _proxy_connections.takeFirst();
}
void ProtoClientConnection::readData()
@@ -93,8 +82,7 @@ void ProtoClientConnection::socketClosed()
void ProtoClientConnection::handleMessage(const proto::HyperionRequest & message)
{
// forward messages
for (int i = 0; i < _proxy_connections.size(); ++i)
_proxy_connections.at(i)->sendMessage(message);
emit newMessage(&message);
switch (message.command())
{