mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Add Aurora Integration
This commit is contained in:
parent
ba83843d3d
commit
72fac77bb0
@ -1,15 +1,6 @@
|
|||||||
|
|
||||||
// Local-Hyperion includes
|
// Local-Hyperion includes
|
||||||
#include "LedDeviceAurora.h"
|
#include "LedDeviceAurora.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
// qt includes
|
// qt includes
|
||||||
@ -17,6 +8,8 @@
|
|||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
|
#define ll ss
|
||||||
|
|
||||||
struct addrinfo vints, *serverinfo, *pt;
|
struct addrinfo vints, *serverinfo, *pt;
|
||||||
//char udpbuffer[1024];
|
//char udpbuffer[1024];
|
||||||
int sockfp;
|
int sockfp;
|
||||||
@ -50,10 +43,6 @@ bool LedDeviceAurora::init(const QJsonObject &deviceConfig) {
|
|||||||
|
|
||||||
QJsonObject json = doc.object();
|
QJsonObject json = doc.object();
|
||||||
|
|
||||||
//Debug
|
|
||||||
//Json::FastWriter fastWriter;
|
|
||||||
//std::cout << fastWriter.write(json);
|
|
||||||
|
|
||||||
panelCount = json["numPanels"].toInt();
|
panelCount = json["numPanels"].toInt();
|
||||||
std::cout << panelCount << std::endl;
|
std::cout << panelCount << std::endl;
|
||||||
QJsonObject positionDataJson = doc.object()["positionData"].toObject();
|
QJsonObject positionDataJson = doc.object()["positionData"].toObject();
|
||||||
@ -75,24 +64,28 @@ bool LedDeviceAurora::init(const QJsonObject &deviceConfig) {
|
|||||||
// Set Aurora to UDP Mode
|
// Set Aurora to UDP Mode
|
||||||
QByteArray modeResponse = changeMode(hostname, key, "effects");
|
QByteArray modeResponse = changeMode(hostname, key, "effects");
|
||||||
QJsonDocument configDoc = QJsonDocument::fromJson(modeResponse, &error);
|
QJsonDocument configDoc = QJsonDocument::fromJson(modeResponse, &error);
|
||||||
|
|
||||||
|
//Debug
|
||||||
|
//QString strConf(configDoc.toJson(QJsonDocument::Compact));
|
||||||
|
//std::cout << strConf.toUtf8().constData() << std::endl;
|
||||||
|
|
||||||
if (error.error != QJsonParseError::NoError)
|
if (error.error != QJsonParseError::NoError)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Could not change mode");
|
throw std::runtime_error("Could not change mode");
|
||||||
}
|
}
|
||||||
QJsonObject configJson = doc.object();
|
|
||||||
|
|
||||||
// Get UDP port
|
// Get UDP port
|
||||||
port = configJson["streamControlPort"].toString();
|
port = QString::number(configDoc.object()["streamControlPort"].toInt());
|
||||||
|
|
||||||
std::cout << "hostname " << hostname.toStdString() << " port " << port.toStdString() << std::endl;
|
std::cout << "hostname " << hostname.toStdString() << " port " << port.toStdString() << std::endl;
|
||||||
/*
|
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
memset(&vints, 0, sizeof vints);
|
memset(&vints, 0, sizeof vints);
|
||||||
vints.ai_family = AF_UNSPEC;
|
vints.ai_family = AF_UNSPEC;
|
||||||
vints.ai_socktype = SOCK_DGRAM;
|
vints.ai_socktype = SOCK_DGRAM;
|
||||||
|
|
||||||
if ((rv = getaddrinfo(hostname.c_str() , port.c_str(), &vints, &serverinfo)) != 0) {
|
if ((rv = getaddrinfo(hostname.toUtf8().constData() , port.toUtf8().constData(), &vints, &serverinfo)) != 0) {
|
||||||
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
|
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
|
||||||
assert(rv==0);
|
assert(rv==0);
|
||||||
}
|
}
|
||||||
@ -111,7 +104,7 @@ bool LedDeviceAurora::init(const QJsonObject &deviceConfig) {
|
|||||||
if (pt == NULL) {
|
if (pt == NULL) {
|
||||||
fprintf(stderr, "talker: failed to create socket\n");
|
fprintf(stderr, "talker: failed to create socket\n");
|
||||||
assert(pt!=NULL);
|
assert(pt!=NULL);
|
||||||
}*/
|
}
|
||||||
std::cout << "Started successfully ";
|
std::cout << "Started successfully ";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
// STL includes
|
|
||||||
#include <string>
|
|
||||||
#include <cmath>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
// Leddevice includes
|
// Leddevice includes
|
||||||
#include <leddevice/LedDevice.h>
|
#include <leddevice/LedDevice.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user