mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
populate zeroconf/avahi/bonjour records via json api (#419)
* start of integrating a bonkour service browser * some experiments * blub * bonjour browser via jsonrpc ... * fix indention * - make leddevice as component - extend sysinfo with domain - add more data for bonjour browser (e.g. split domain and hostname) * code cleanup * add translation * use component names instead of ids * fix compile
This commit is contained in:
@@ -48,6 +48,8 @@
|
||||
|
||||
using namespace hyperion;
|
||||
|
||||
int _connectionCounter = 0;
|
||||
|
||||
JsonClientConnection::JsonClientConnection(QTcpSocket *socket)
|
||||
: QObject()
|
||||
, _socket(socket)
|
||||
@@ -577,6 +579,7 @@ void JsonClientConnection::handleSysInfoCommand(const QJsonObject&, const QStrin
|
||||
system["productVersion"] = data.productVersion;
|
||||
system["prettyName" ] = data.prettyName;
|
||||
system["hostName" ] = data.hostName;
|
||||
system["domainName" ] = data.domainName;
|
||||
info["system"] = system;
|
||||
|
||||
QJsonObject hyperion;
|
||||
@@ -619,22 +622,21 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
|
||||
}
|
||||
|
||||
item["owner"] = QString(hyperion::componentToIdString(priorityInfo.componentId));
|
||||
item["componentId"] = priorityInfo.componentId;
|
||||
item["componentId"] = QString(hyperion::componentToIdString(priorityInfo.componentId));
|
||||
item["origin"] = priorityInfo.origin;
|
||||
item["component"] = QString(hyperion::componentToString(priorityInfo.componentId));
|
||||
item["active"] = true;
|
||||
item["visible"] = (priority == currentPriority);
|
||||
foreach(auto const &entry, priorityRegister)
|
||||
|
||||
// remove item from prio register, because we have more valuable information via active priority
|
||||
QList<QString> prios = priorityRegister.keys(priority);
|
||||
if (! prios.empty())
|
||||
{
|
||||
if (entry.second == priority)
|
||||
{
|
||||
item["owner"] = entry.first;
|
||||
priorityRegister.erase(entry.first);
|
||||
break;
|
||||
}
|
||||
item["owner"] = prios[0];
|
||||
priorityRegister.remove(prios[0]);
|
||||
}
|
||||
|
||||
if(priorityInfo.componentId == 9)
|
||||
if(priorityInfo.componentId == hyperion::COMP_COLOR)
|
||||
{
|
||||
QJsonObject LEDcolor;
|
||||
|
||||
@@ -679,14 +681,15 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
|
||||
// priorities[priorities.size()] = item;
|
||||
priorities.append(item);
|
||||
}
|
||||
|
||||
foreach(auto const &entry, priorityRegister)
|
||||
|
||||
// append left over priorities
|
||||
for(auto key : priorityRegister.keys())
|
||||
{
|
||||
QJsonObject item;
|
||||
item["priority"] = entry.second;
|
||||
item["priority"] = priorityRegister[key];
|
||||
item["active"] = false;
|
||||
item["visible"] = false;
|
||||
item["owner"] = entry.first;
|
||||
item["owner"] = key;
|
||||
priorities.append(item);
|
||||
}
|
||||
|
||||
@@ -827,6 +830,22 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
|
||||
QJsonObject hyperion;
|
||||
hyperion["config_modified" ] = _hyperion->configModified();
|
||||
hyperion["config_writeable"] = _hyperion->configWriteable();
|
||||
|
||||
// sessions
|
||||
QJsonArray sessions;
|
||||
for (auto session: _hyperion->getHyperionSessions())
|
||||
{
|
||||
if (session.port<0) continue;
|
||||
QJsonObject item;
|
||||
item["name"] = session.serviceName;
|
||||
item["type"] = session.registeredType;
|
||||
item["domain"] = session.replyDomain;
|
||||
item["host"] = session.hostName;
|
||||
item["port"] = session.port;
|
||||
sessions.append(item);
|
||||
}
|
||||
hyperion["sessions"] = sessions;
|
||||
|
||||
info["hyperion"] = hyperion;
|
||||
|
||||
// send the result
|
||||
|
@@ -21,7 +21,7 @@
|
||||
"component":
|
||||
{
|
||||
"type" : "string",
|
||||
"enum" : ["SMOOTHING", "BLACKBORDER", "KODICHECKER", "FORWARDER", "UDPLISTENER", "BOBLIGHTSERVER", "GRABBER", "V4L"],
|
||||
"enum" : ["SMOOTHING", "BLACKBORDER", "KODICHECKER", "FORWARDER", "UDPLISTENER", "BOBLIGHTSERVER", "GRABBER", "V4L", "LEDDEVICE"],
|
||||
"required": true
|
||||
},
|
||||
"state":
|
||||
|
Reference in New Issue
Block a user