Added qDebug() statements to log the JSON commands being sent to Hyperion for debugging purposes.
28 lines
617 B
C++
28 lines
617 B
C++
#include "hgx11net.h"
|
|
|
|
// public
|
|
|
|
hgx11net::hgx11net(QString host, ushort port, QString priority)
|
|
{
|
|
_sock_p = new QTcpSocket(this);
|
|
_sock_p->setReadBufferSize(1);
|
|
_host_m = host;
|
|
_port_m = port;
|
|
_priority_m = priority;
|
|
_connectHost();
|
|
}
|
|
|
|
hgx11net::~hgx11net()
|
|
{
|
|
clearLeds();
|
|
if (_sock_p->state() == QAbstractSocket::ConnectedState) {
|
|
while(_sock_p->waitForBytesWritten()) {}
|
|
_sock_p->disconnectFromHost();
|
|
}
|
|
delete _sock_p;
|
|
}
|
|
|
|
void hgx11net::clearLeds()
|
|
{
|
|
_cmd_m.clear();
|
|
_cmd_m.append("{\"command\": \"clearall\",").append(_priority_m.toUtf8()).append( |