add http jsonrpc (#450)

This commit is contained in:
brindosch
2017-07-05 23:19:52 +02:00
committed by GitHub
parent a99b7c5f59
commit 622a171808
4 changed files with 59 additions and 19 deletions

View File

@@ -38,7 +38,7 @@ using namespace hyperion;
std::map<hyperion::Components, bool> JsonProcessor::_componentsPrevState;
JsonProcessor::JsonProcessor(QString peerAddress)
JsonProcessor::JsonProcessor(QString peerAddress, bool noListener)
: QObject()
, _peerAddress(peerAddress)
, _log(Logger::getInstance("JSONRPCPROCESSOR"))
@@ -51,8 +51,12 @@ JsonProcessor::JsonProcessor(QString peerAddress)
connect(this, &JsonProcessor::forwardJsonMessage, _hyperion, &Hyperion::forwardJsonMessage);
// notify hyperion about a push emit
connect(this, &JsonProcessor::pushReq, _hyperion, &Hyperion::hyperionStateChanged);
// listen for sendServerInfo pushes from hyperion
connect(_hyperion, &Hyperion::sendServerInfo, this, &JsonProcessor::forceServerInfo);
if(!noListener)
{
// listen for sendServerInfo pushes from hyperion
connect(_hyperion, &Hyperion::sendServerInfo, this, &JsonProcessor::forceServerInfo);
}
// led color stream update timer
_timer_ledcolors.setSingleShot(false);
@@ -65,8 +69,11 @@ JsonProcessor::~JsonProcessor()
}
void JsonProcessor::handleMessage(const QString& messageString)
void JsonProcessor::handleMessage(const QString& messageString, const QString peerAddress)
{
if(!peerAddress.isNull())
_peerAddress = peerAddress;
QString errors;
try