mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
refactor: Address (Windows) compile warnings (#840)
* Windows compile errors and (Qt 5.15 deprecation) warnings * Usability - Enable/Disable Instance button Co-authored-by: brindosch <edeltraud70@gmx.de>
This commit is contained in:
parent
e365a2839d
commit
bfb50b8d91
@ -52,8 +52,8 @@
|
||||
"dashboard_infobox_message_updatesuccess": "Spusťte nejnovější verzi Hyperionu.",
|
||||
"dashboard_infobox_label_statush": "Stav Hyperionu:",
|
||||
"dashboard_infobox_label_smartacc": "Inteligentní přístup",
|
||||
"dashboard_infobox_label_enableh": "Zapnout Hyperion",
|
||||
"dashboard_infobox_label_disableh": "Vypnout Hyperion",
|
||||
"dashboard_infobox_label_enableh": "Povolit Instance: $1",
|
||||
"dashboard_infobox_label_disableh": "Vypnout Instance $1",
|
||||
"dashboard_componentbox_label_title": "Stav komponent",
|
||||
"dashboard_componentbox_label_comp": "Komponenty",
|
||||
"dashboard_componentbox_label_status": "Status",
|
||||
|
@ -68,8 +68,8 @@
|
||||
"dashboard_infobox_message_updatesuccess": "Du nutzt die aktuellste Version von Hyperion.",
|
||||
"dashboard_infobox_label_statush": "Hyperion Status:",
|
||||
"dashboard_infobox_label_smartacc": "Schnellzugriff",
|
||||
"dashboard_infobox_label_enableh": "Aktiviere Hyperion",
|
||||
"dashboard_infobox_label_disableh": "Deaktiviere Hyperion",
|
||||
"dashboard_infobox_label_enableh" : "Aktiviere Instanz: $1",
|
||||
"dashboard_infobox_label_disableh" : "Deaktiviere Instanz: $1",
|
||||
"dashboard_componentbox_label_title": "Komponenten Status",
|
||||
"dashboard_componentbox_label_comp": "Komponente",
|
||||
"dashboard_componentbox_label_status": "Status",
|
||||
|
@ -68,8 +68,8 @@
|
||||
"dashboard_infobox_message_updatesuccess" : "You run the latest version of Hyperion.",
|
||||
"dashboard_infobox_label_statush" : "Hyperion status:",
|
||||
"dashboard_infobox_label_smartacc" : "Smart Access",
|
||||
"dashboard_infobox_label_enableh" : "Enable Hyperion",
|
||||
"dashboard_infobox_label_disableh" : "Disable Hyperion",
|
||||
"dashboard_infobox_label_enableh" : "Enable Instance: $1",
|
||||
"dashboard_infobox_label_disableh" : "Disable Instance: $1",
|
||||
"dashboard_componentbox_label_title" : "Components status",
|
||||
"dashboard_componentbox_label_comp" : "Component",
|
||||
"dashboard_componentbox_label_status" : "Status",
|
||||
|
@ -52,8 +52,8 @@
|
||||
"dashboard_infobox_message_updatesuccess": "Ejecutas la última versión de Hyperion.",
|
||||
"dashboard_infobox_label_statush": "Estado de Hyperion:",
|
||||
"dashboard_infobox_label_smartacc": "Acceso Inteligente",
|
||||
"dashboard_infobox_label_enableh": "Habilitar Hyperion",
|
||||
"dashboard_infobox_label_disableh": "Deshabilitar Hyperion",
|
||||
"dashboard_infobox_label_enableh": "Habilitar Instancia: $1",
|
||||
"dashboard_infobox_label_disableh": "Deshabilitar Instancia: $1",
|
||||
"dashboard_componentbox_label_title": "Estado de los componentes",
|
||||
"dashboard_componentbox_label_comp": "Estado de los componentes",
|
||||
"dashboard_componentbox_label_status": "Estado",
|
||||
|
@ -52,8 +52,8 @@
|
||||
"dashboard_infobox_message_updatesuccess": "Stai eseguendo l'ultima versione di Hyperion.",
|
||||
"dashboard_infobox_label_statush": "Status Hyperion:",
|
||||
"dashboard_infobox_label_smartacc": "Accesso Smart",
|
||||
"dashboard_infobox_label_enableh": "Abilita Hyperion",
|
||||
"dashboard_infobox_label_disableh": "Disabilita Hyperion",
|
||||
"dashboard_infobox_label_enableh": "Abilita Istanza: $1",
|
||||
"dashboard_infobox_label_disableh": "Disabilita Istanza: $1",
|
||||
"dashboard_componentbox_label_title": "Status componenti",
|
||||
"dashboard_componentbox_label_comp": "Componente",
|
||||
"dashboard_componentbox_label_status": "Status",
|
||||
|
@ -52,8 +52,8 @@
|
||||
"dashboard_infobox_message_updatesuccess": "Je draait de laatste versie van Hyperion",
|
||||
"dashboard_infobox_label_statush": "Hyperion status:",
|
||||
"dashboard_infobox_label_smartacc": "Slimme toegang",
|
||||
"dashboard_infobox_label_enableh": "Schakel Hyperion in",
|
||||
"dashboard_infobox_label_disableh": "Schakel Hyperion uit",
|
||||
"dashboard_infobox_label_enableh": "Schakel Instantie $1 in",
|
||||
"dashboard_infobox_label_disableh": "Schakel Instantie $1 uit",
|
||||
"dashboard_componentbox_label_title": "Componenten status",
|
||||
"dashboard_componentbox_label_comp": "Component",
|
||||
"dashboard_componentbox_label_status": "Status",
|
||||
|
@ -52,8 +52,8 @@
|
||||
"dashboard_infobox_message_updatesuccess": "Du använder den senaste versionen av Hyperion.",
|
||||
"dashboard_infobox_label_statush": "Hyperion-status:",
|
||||
"dashboard_infobox_label_smartacc": "Smart Åtkomst",
|
||||
"dashboard_infobox_label_enableh": "Aktivera Hyperion",
|
||||
"dashboard_infobox_label_disableh": "Inaktivera Hyperion",
|
||||
"dashboard_infobox_label_enableh": "Aktivera Instans: $1",
|
||||
"dashboard_infobox_label_disableh": "Inaktivera Instans: $1",
|
||||
"dashboard_componentbox_label_title": "Komponentstatus",
|
||||
"dashboard_componentbox_label_comp": "Komponent",
|
||||
"dashboard_componentbox_label_status": "Status",
|
||||
|
@ -69,8 +69,11 @@ $(document).ready( function() {
|
||||
}
|
||||
});
|
||||
|
||||
var instancename = window.currentHyperionInstanceName;
|
||||
console.log ("instancename: ",instancename);
|
||||
|
||||
$('#dash_statush').html(hyperion_enabled ? '<span style="color:green">'+$.i18n('general_btn_on')+'</span>' : '<span style="color:red">'+$.i18n('general_btn_off')+'</span>');
|
||||
$('#btn_hsc').html(hyperion_enabled ? '<button class="btn btn-sm btn-danger" onClick="requestSetComponentState(\'ALL\',false)">'+$.i18n('dashboard_infobox_label_disableh')+'</button>' : '<button class="btn btn-sm btn-success" onClick="requestSetComponentState(\'ALL\',true)">'+$.i18n('dashboard_infobox_label_enableh')+'</button>');
|
||||
$('#btn_hsc').html(hyperion_enabled ? '<button class="btn btn-sm btn-danger" onClick="requestSetComponentState(\'ALL\',false)">'+$.i18n('dashboard_infobox_label_disableh', instancename)+'</button>' : '<button class="btn btn-sm btn-success" onClick="requestSetComponentState(\'ALL\',true)">'+$.i18n('dashboard_infobox_label_enableh', instancename)+'</button>');
|
||||
}
|
||||
|
||||
// add more info
|
||||
|
@ -3,11 +3,11 @@
|
||||
/**
|
||||
* Enumeration of the possible video standards the grabber can be set to
|
||||
*/
|
||||
enum VideoStandard {
|
||||
VIDEOSTANDARD_PAL,
|
||||
VIDEOSTANDARD_NTSC,
|
||||
VIDEOSTANDARD_SECAM,
|
||||
VIDEOSTANDARD_NO_CHANGE
|
||||
enum class VideoStandard {
|
||||
PAL,
|
||||
NTSC,
|
||||
SECAM,
|
||||
NO_CHANGE
|
||||
};
|
||||
|
||||
inline VideoStandard parseVideoStandard(QString videoStandard)
|
||||
@ -17,17 +17,17 @@ inline VideoStandard parseVideoStandard(QString videoStandard)
|
||||
|
||||
if (videoStandard == "pal")
|
||||
{
|
||||
return VIDEOSTANDARD_PAL;
|
||||
return VideoStandard::PAL;
|
||||
}
|
||||
else if (videoStandard == "ntsc")
|
||||
{
|
||||
return VIDEOSTANDARD_NTSC;
|
||||
return VideoStandard::NTSC;
|
||||
}
|
||||
else if (videoStandard == "secam")
|
||||
{
|
||||
return VIDEOSTANDARD_SECAM;
|
||||
return VideoStandard::SECAM;
|
||||
}
|
||||
|
||||
// return the default NO_CHANGE
|
||||
return VIDEOSTANDARD_NO_CHANGE;
|
||||
return VideoStandard::NO_CHANGE;
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ private:
|
||||
/// buffer for leds (with adjustment)
|
||||
std::vector<ColorRgb> _ledBuffer;
|
||||
|
||||
VideoMode _currVideoMode = VIDEO_2D;
|
||||
VideoMode _currVideoMode = VideoMode::VIDEO_2D;
|
||||
|
||||
/// Boblight instance
|
||||
BoblightServer* _boblightServer;
|
||||
|
@ -15,7 +15,7 @@
|
||||
namespace Json { class Value; }
|
||||
|
||||
/// Enumeration containing the possible orders of device color byte data
|
||||
enum ColorOrder
|
||||
enum class ColorOrder
|
||||
{
|
||||
ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR
|
||||
};
|
||||
@ -24,17 +24,17 @@ inline QString colorOrderToString(const ColorOrder colorOrder)
|
||||
{
|
||||
switch (colorOrder)
|
||||
{
|
||||
case ORDER_RGB:
|
||||
case ColorOrder::ORDER_RGB:
|
||||
return "rgb";
|
||||
case ORDER_RBG:
|
||||
case ColorOrder::ORDER_RBG:
|
||||
return "rbg";
|
||||
case ORDER_GRB:
|
||||
case ColorOrder::ORDER_GRB:
|
||||
return "grb";
|
||||
case ORDER_BRG:
|
||||
case ColorOrder::ORDER_BRG:
|
||||
return "brg";
|
||||
case ORDER_GBR:
|
||||
case ColorOrder::ORDER_GBR:
|
||||
return "gbr";
|
||||
case ORDER_BGR:
|
||||
case ColorOrder::ORDER_BGR:
|
||||
return "bgr";
|
||||
default:
|
||||
return "not-a-colororder";
|
||||
@ -44,31 +44,31 @@ inline ColorOrder stringToColorOrder(const QString & order)
|
||||
{
|
||||
if (order == "rgb")
|
||||
{
|
||||
return ORDER_RGB;
|
||||
return ColorOrder::ORDER_RGB;
|
||||
}
|
||||
else if (order == "bgr")
|
||||
{
|
||||
return ORDER_BGR;
|
||||
return ColorOrder::ORDER_BGR;
|
||||
}
|
||||
else if (order == "rbg")
|
||||
{
|
||||
return ORDER_RBG;
|
||||
return ColorOrder::ORDER_RBG;
|
||||
}
|
||||
else if (order == "brg")
|
||||
{
|
||||
return ORDER_BRG;
|
||||
return ColorOrder::ORDER_BRG;
|
||||
}
|
||||
else if (order == "gbr")
|
||||
{
|
||||
return ORDER_GBR;
|
||||
return ColorOrder::ORDER_GBR;
|
||||
}
|
||||
else if (order == "grb")
|
||||
{
|
||||
return ORDER_GRB;
|
||||
return ColorOrder::ORDER_GRB;
|
||||
}
|
||||
|
||||
std::cout << "Unknown color order defined (" << order.toStdString() << "). Using RGB." << std::endl;
|
||||
return ORDER_RGB;
|
||||
return ColorOrder::ORDER_RGB;
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
|
||||
// STL includes
|
||||
#include <vector>
|
||||
@ -179,8 +180,8 @@ protected:
|
||||
QTimer* _refresh_timer;
|
||||
int _refresh_timer_interval;
|
||||
|
||||
/// timestamp of last write
|
||||
qint64 _last_write_time;
|
||||
/// Timestamp of last write
|
||||
QDateTime _lastWriteTime;
|
||||
|
||||
/// Time a device requires mandatorily between two writes
|
||||
int _latchTime_ms;
|
||||
|
@ -5,51 +5,59 @@
|
||||
|
||||
class QUdpSocket;
|
||||
|
||||
enum searchType{
|
||||
enum class searchType{
|
||||
STY_WEBSERVER,
|
||||
STY_FLATBUFSERVER,
|
||||
STY_JSONSERVER
|
||||
};
|
||||
|
||||
///
|
||||
/// @brief Search for SSDP sessions, used by standalone capture binaries
|
||||
/// @brief Search for SSDP sessions, used by stand-alone capture binaries
|
||||
///
|
||||
class SSDPDiscover : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
SSDPDiscover(QObject* parent = nullptr);
|
||||
|
||||
///
|
||||
/// @brief Search for specified service, results will be returned by signal newService(). Calling this method again will reset all found usns and search again
|
||||
/// @brief Search for specified service, results will be returned by signal newService(). Calling this method again will reset all found urns and search again
|
||||
/// @param st The service to search for
|
||||
///
|
||||
void searchForService(const QString& st = "urn:hyperion-project.org:device:basic:1");
|
||||
void searchForService(const QString &st = "urn:hyperion-project.org:device:basic:1");
|
||||
|
||||
///
|
||||
/// @brief Search for specified searchTarget, the method will block until a server has been found or a timeout happend
|
||||
/// @brief Search for specified searchTarget, the method will block until a server has been found or a timeout happened
|
||||
/// @param type The address type one of struct searchType
|
||||
/// @param st The service to search for
|
||||
/// @param timeout_ms The timeout in ms
|
||||
/// @return The address+port of webserver or empty if timed out
|
||||
/// @return The address+port of web-server or empty if timed out
|
||||
///
|
||||
const QString getFirstService(const searchType& type = STY_WEBSERVER,const QString& st = "urn:hyperion-project.org:device:basic:1", const int& timeout_ms = 3000);
|
||||
const QString getFirstService(const searchType &type = searchType::STY_WEBSERVER,const QString &st = "urn:hyperion-project.org:device:basic:1", const int &timeout_ms = 3000);
|
||||
|
||||
signals:
|
||||
///
|
||||
/// @brief Emits whenever a new service has ben found, search started with searchForService()
|
||||
/// @param webServer The address+port of webserver "192.168.0.10:8090"
|
||||
/// @brief Emits whenever a new service has been found, search started with searchForService()
|
||||
///
|
||||
void newService(const QString webServer);
|
||||
/// @param webServer The address+port of web-server "192.168.0.10:8090"
|
||||
///
|
||||
void newService(const QString &webServer);
|
||||
|
||||
private slots:
|
||||
void readPendingDatagrams();
|
||||
|
||||
private:
|
||||
void sendSearch(const QString& st);
|
||||
///
|
||||
/// @brief Execute ssdp discovery request
|
||||
///
|
||||
/// @param[in] st Search Target
|
||||
///
|
||||
void sendSearch(const QString &st);
|
||||
|
||||
private:
|
||||
|
||||
Logger* _log;
|
||||
QUdpSocket* _udpSocket;
|
||||
QString _searchTarget;
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
struct ColorRgb;
|
||||
|
||||
///
|
||||
@ -49,6 +51,19 @@ inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
|
||||
return os;
|
||||
}
|
||||
|
||||
///
|
||||
/// Stream operator to write ColorRgb to a QTextStream (format "'{'[red]','[green]','[blue]'}'")
|
||||
///
|
||||
/// @param os The output stream
|
||||
/// @param color The color to write
|
||||
/// @return The output stream (with the color written to it)
|
||||
///
|
||||
inline QTextStream& operator<<(QTextStream &os, const ColorRgb& color)
|
||||
{
|
||||
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'smaller' than another color
|
||||
inline bool operator<(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
|
@ -5,17 +5,17 @@
|
||||
/**
|
||||
* Enumeration of the possible pixel formats the grabber can be set to
|
||||
*/
|
||||
enum PixelFormat {
|
||||
PIXELFORMAT_YUYV,
|
||||
PIXELFORMAT_UYVY,
|
||||
PIXELFORMAT_BGR16,
|
||||
PIXELFORMAT_BGR24,
|
||||
PIXELFORMAT_RGB32,
|
||||
PIXELFORMAT_BGR32,
|
||||
enum class PixelFormat {
|
||||
YUYV,
|
||||
UYVY,
|
||||
BGR16,
|
||||
BGR24,
|
||||
RGB32,
|
||||
BGR32,
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
PIXELFORMAT_MJPEG,
|
||||
MJPEG,
|
||||
#endif
|
||||
PIXELFORMAT_NO_CHANGE
|
||||
NO_CHANGE
|
||||
};
|
||||
|
||||
inline PixelFormat parsePixelFormat(QString pixelFormat)
|
||||
@ -23,37 +23,37 @@ inline PixelFormat parsePixelFormat(QString pixelFormat)
|
||||
// convert to lower case
|
||||
pixelFormat = pixelFormat.toLower();
|
||||
|
||||
if (pixelFormat == "yuyv")
|
||||
if (pixelFormat.compare("yuyv") )
|
||||
{
|
||||
return PIXELFORMAT_YUYV;
|
||||
return PixelFormat::YUYV;
|
||||
}
|
||||
else if (pixelFormat == "uyvy")
|
||||
else if (pixelFormat.compare("uyvy") )
|
||||
{
|
||||
return PIXELFORMAT_UYVY;
|
||||
return PixelFormat::UYVY;
|
||||
}
|
||||
else if (pixelFormat == "bgr16")
|
||||
else if (pixelFormat.compare("bgr16") )
|
||||
{
|
||||
return PIXELFORMAT_BGR16;
|
||||
return PixelFormat::BGR16;
|
||||
}
|
||||
else if (pixelFormat == "bgr24")
|
||||
else if (pixelFormat.compare("bgr24") )
|
||||
{
|
||||
return PIXELFORMAT_BGR24;
|
||||
return PixelFormat::BGR24;
|
||||
}
|
||||
else if (pixelFormat == "rgb32")
|
||||
else if (pixelFormat.compare("rgb32") )
|
||||
{
|
||||
return PIXELFORMAT_RGB32;
|
||||
return PixelFormat::RGB32;
|
||||
}
|
||||
else if (pixelFormat == "bgr32")
|
||||
else if (pixelFormat.compare("bgr32") )
|
||||
{
|
||||
return PIXELFORMAT_BGR32;
|
||||
return PixelFormat::BGR32;
|
||||
}
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
else if (pixelFormat == "mjpeg")
|
||||
else if (pixelFormat.compare("mjpeg") )
|
||||
{
|
||||
return PIXELFORMAT_MJPEG;
|
||||
return PixelFormat::MJPEG;
|
||||
}
|
||||
#endif
|
||||
|
||||
// return the default NO_CHANGE
|
||||
return PIXELFORMAT_NO_CHANGE;
|
||||
return PixelFormat::NO_CHANGE;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace RGBW {
|
||||
|
||||
enum WhiteAlgorithm {
|
||||
enum class WhiteAlgorithm {
|
||||
INVALID,
|
||||
SUBTRACT_MINIMUM,
|
||||
SUB_MIN_WARM_ADJUST,
|
||||
|
@ -5,7 +5,7 @@
|
||||
/**
|
||||
* Enumeration of the possible modes in which video can be playing (2D, 3D)
|
||||
*/
|
||||
enum VideoMode
|
||||
enum class VideoMode
|
||||
{
|
||||
VIDEO_2D,
|
||||
VIDEO_3DSBS,
|
||||
@ -19,24 +19,24 @@ inline VideoMode parse3DMode(QString videoMode)
|
||||
|
||||
if (videoMode == "3DTAB")
|
||||
{
|
||||
return VIDEO_3DTAB;
|
||||
return VideoMode::VIDEO_3DTAB;
|
||||
}
|
||||
else if (videoMode == "3DSBS")
|
||||
{
|
||||
return VIDEO_3DSBS;
|
||||
return VideoMode::VIDEO_3DSBS;
|
||||
}
|
||||
|
||||
// return the default 2D
|
||||
return VIDEO_2D;
|
||||
return VideoMode::VIDEO_2D;
|
||||
}
|
||||
|
||||
inline QString videoMode2String(VideoMode mode)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case VIDEO_3DTAB: return "3DTAB";
|
||||
case VIDEO_3DSBS: return "3DSBS";
|
||||
case VIDEO_2D: return "2D";
|
||||
case VideoMode::VIDEO_3DTAB: return "3DTAB";
|
||||
case VideoMode::VIDEO_3DSBS: return "3DSBS";
|
||||
case VideoMode::VIDEO_2D: return "2D";
|
||||
default: return "INVALID";
|
||||
}
|
||||
}
|
||||
|
@ -90,8 +90,11 @@ void BoblightClientConnection::socketClosed()
|
||||
void BoblightClientConnection::handleMessage(const QString & message)
|
||||
{
|
||||
//std::cout << "boblight message: " << message.toStdString() << std::endl;
|
||||
|
||||
QStringList messageParts = message.split(" ", QString::SkipEmptyParts);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList messageParts = message.split(" ", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList messageParts = message.split(" ", QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
if (messageParts.size() > 0)
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ int AmlogicGrabber::grabFrame_amvideocap(Image<ColorRgb> & image)
|
||||
}
|
||||
|
||||
_useImageResampler = true;
|
||||
_imageResampler.processImage((const uint8_t*)_image_ptr, _width, _height, (_width << 1) + _width, PIXELFORMAT_BGR24, image);
|
||||
_imageResampler.processImage((const uint8_t*)_image_ptr, _width, _height, (_width << 1) + _width, PixelFormat::BGR24, image);
|
||||
_lastError = 0;
|
||||
|
||||
return 0;
|
||||
|
@ -114,15 +114,15 @@ int DispmanxFrameGrabber::grabFrame(Image<ColorRgb> & image)
|
||||
// calculate final image dimensions and adjust top/left cropping in 3D modes
|
||||
switch (_videoMode)
|
||||
{
|
||||
case VIDEO_3DSBS:
|
||||
case VideoMode::VIDEO_3DSBS:
|
||||
imageWidth /= 2;
|
||||
cropLeft /= 2;
|
||||
break;
|
||||
case VIDEO_3DTAB:
|
||||
case VideoMode::VIDEO_3DTAB:
|
||||
imageHeight /= 2;
|
||||
cropTop /= 2;
|
||||
break;
|
||||
case VIDEO_2D:
|
||||
case VideoMode::VIDEO_2D:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -44,12 +44,12 @@ int FramebufferFrameGrabber::grabFrame(Image<ColorRgb> & image)
|
||||
|
||||
switch (vinfo.bits_per_pixel)
|
||||
{
|
||||
case 16: pixelFormat = PIXELFORMAT_BGR16; break;
|
||||
case 24: pixelFormat = PIXELFORMAT_BGR24; break;
|
||||
case 16: pixelFormat = PixelFormat::BGR16; break;
|
||||
case 24: pixelFormat = PixelFormat::BGR24; break;
|
||||
#ifdef ENABLE_AMLOGIC
|
||||
case 32: pixelFormat = PIXELFORMAT_RGB32; break;
|
||||
case 32: pixelFormat = PixelFormat::PIXELFORMAT_RGB32; break;
|
||||
#else
|
||||
case 32: pixelFormat = PIXELFORMAT_BGR32; break;
|
||||
case 32: pixelFormat = PixelFormat::BGR32; break;
|
||||
#endif
|
||||
default:
|
||||
Error(_log, "Unknown pixel format: %d bits per pixel", vinfo.bits_per_pixel);
|
||||
|
@ -50,7 +50,7 @@ int OsxFrameGrabber::grabFrame(Image<ColorRgb> & image)
|
||||
dspWidth,
|
||||
dspHeight,
|
||||
CGImageGetBytesPerRow(dispImage),
|
||||
PIXELFORMAT_BGR32,
|
||||
PixelFormat::BGR32,
|
||||
image);
|
||||
|
||||
CFRelease(imgData);
|
||||
|
@ -146,7 +146,7 @@ int QtGrabber::updateScreenDimensions(const bool& force)
|
||||
// calculate final image dimensions and adjust top/left cropping in 3D modes
|
||||
switch (_videoMode)
|
||||
{
|
||||
case VIDEO_3DSBS:
|
||||
case VideoMode::VIDEO_3DSBS:
|
||||
_width = width /2;
|
||||
_height = height;
|
||||
_src_x = _cropLeft / 2;
|
||||
@ -154,7 +154,7 @@ int QtGrabber::updateScreenDimensions(const bool& force)
|
||||
_src_x_max = (_screenWidth / 2) - _cropRight;
|
||||
_src_y_max = _screenHeight - _cropBottom;
|
||||
break;
|
||||
case VIDEO_3DTAB:
|
||||
case VideoMode::VIDEO_3DTAB:
|
||||
_width = width;
|
||||
_height = height / 2;
|
||||
_src_x = _cropLeft;
|
||||
@ -162,7 +162,7 @@ int QtGrabber::updateScreenDimensions(const bool& force)
|
||||
_src_x_max = _screenWidth - _cropRight;
|
||||
_src_y_max = (_screenHeight / 2) - _cropBottom;
|
||||
break;
|
||||
case VIDEO_2D:
|
||||
case VideoMode::VIDEO_2D:
|
||||
default:
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
@ -591,7 +591,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
{
|
||||
switch (videoStandard)
|
||||
{
|
||||
case VIDEOSTANDARD_PAL:
|
||||
case VideoStandard::PAL:
|
||||
{
|
||||
standard.id = V4L2_STD_PAL;
|
||||
if (-1 == xioctl(VIDIOC_S_STD, &standard.id))
|
||||
@ -603,7 +603,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
}
|
||||
break;
|
||||
|
||||
case VIDEOSTANDARD_NTSC:
|
||||
case VideoStandard::NTSC:
|
||||
{
|
||||
standard.id = V4L2_STD_NTSC;
|
||||
if (-1 == xioctl(VIDIOC_S_STD, &standard.id))
|
||||
@ -615,7 +615,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
}
|
||||
break;
|
||||
|
||||
case VIDEOSTANDARD_SECAM:
|
||||
case VideoStandard::SECAM:
|
||||
{
|
||||
standard.id = V4L2_STD_SECAM;
|
||||
if (-1 == xioctl(VIDIOC_S_STD, &standard.id))
|
||||
@ -627,7 +627,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
}
|
||||
break;
|
||||
|
||||
case VIDEOSTANDARD_NO_CHANGE:
|
||||
case VideoStandard::NO_CHANGE:
|
||||
default:
|
||||
// No change to device settings
|
||||
break;
|
||||
@ -648,20 +648,20 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
// set the requested pixel format
|
||||
switch (_pixelFormat)
|
||||
{
|
||||
case PIXELFORMAT_UYVY:
|
||||
case PixelFormat::UYVY:
|
||||
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
|
||||
break;
|
||||
|
||||
case PIXELFORMAT_YUYV:
|
||||
case PixelFormat::YUYV:
|
||||
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
|
||||
break;
|
||||
|
||||
case PIXELFORMAT_RGB32:
|
||||
case PixelFormat::RGB32:
|
||||
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB32;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
case PIXELFORMAT_MJPEG:
|
||||
case PixelFormat::MJPEG:
|
||||
{
|
||||
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_ANY;
|
||||
@ -669,7 +669,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PIXELFORMAT_NO_CHANGE:
|
||||
case PixelFormat::NO_CHANGE:
|
||||
default:
|
||||
// No change to device settings
|
||||
break;
|
||||
@ -723,7 +723,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
{
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
{
|
||||
_pixelFormat = PIXELFORMAT_UYVY;
|
||||
_pixelFormat = PixelFormat::UYVY;
|
||||
_frameByteSize = _width * _height * 2;
|
||||
Debug(_log, "Pixel format=UYVY");
|
||||
}
|
||||
@ -731,7 +731,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
{
|
||||
_pixelFormat = PIXELFORMAT_YUYV;
|
||||
_pixelFormat = PixelFormat::YUYV;
|
||||
_frameByteSize = _width * _height * 2;
|
||||
Debug(_log, "Pixel format=YUYV");
|
||||
}
|
||||
@ -739,7 +739,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
|
||||
case V4L2_PIX_FMT_RGB32:
|
||||
{
|
||||
_pixelFormat = PIXELFORMAT_RGB32;
|
||||
_pixelFormat = PixelFormat::RGB32;
|
||||
_frameByteSize = _width * _height * 4;
|
||||
Debug(_log, "Pixel format=RGB32");
|
||||
}
|
||||
@ -748,7 +748,7 @@ void V4L2Grabber::init_device(VideoStandard videoStandard)
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
case V4L2_PIX_FMT_MJPEG:
|
||||
{
|
||||
_pixelFormat = PIXELFORMAT_MJPEG;
|
||||
_pixelFormat = PixelFormat::MJPEG;
|
||||
Debug(_log, "Pixel format=MJPEG");
|
||||
}
|
||||
break;
|
||||
@ -1016,7 +1016,7 @@ bool V4L2Grabber::process_image(const void *p, int size)
|
||||
{
|
||||
// We do want a new frame...
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
if (size < _frameByteSize && _pixelFormat != PIXELFORMAT_MJPEG)
|
||||
if (size < _frameByteSize && _pixelFormat != PixelFormat::MJPEG)
|
||||
#else
|
||||
if (size < _frameByteSize)
|
||||
#endif
|
||||
@ -1041,7 +1041,7 @@ void V4L2Grabber::process_image(const uint8_t * data, int size)
|
||||
* --------------------------------------------------------*/
|
||||
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
if (_pixelFormat == PIXELFORMAT_MJPEG)
|
||||
if (_pixelFormat == PixelFormat::MJPEG)
|
||||
{
|
||||
#endif
|
||||
#ifdef HAVE_JPEG
|
||||
|
@ -184,7 +184,7 @@ int X11Grabber::grabFrame(Image<ColorRgb> & image, bool forceUpdate)
|
||||
return -1;
|
||||
}
|
||||
|
||||
_imageResampler.processImage(reinterpret_cast<const uint8_t *>(_xImage->data), _xImage->width, _xImage->height, _xImage->bytes_per_line, PIXELFORMAT_BGR32, image);
|
||||
_imageResampler.processImage(reinterpret_cast<const uint8_t *>(_xImage->data), _xImage->width, _xImage->height, _xImage->bytes_per_line, PixelFormat::BGR32, image);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -244,19 +244,19 @@ int X11Grabber::updateScreenDimensions(bool force)
|
||||
// calculate final image dimensions and adjust top/left cropping in 3D modes
|
||||
switch (_videoMode)
|
||||
{
|
||||
case VIDEO_3DSBS:
|
||||
case VideoMode::VIDEO_3DSBS:
|
||||
_width = width /2;
|
||||
_height = height;
|
||||
_src_x = _cropLeft / 2;
|
||||
_src_y = _cropTop;
|
||||
break;
|
||||
case VIDEO_3DTAB:
|
||||
case VideoMode::VIDEO_3DTAB:
|
||||
_width = width;
|
||||
_height = height / 2;
|
||||
_src_x = _cropLeft;
|
||||
_src_y = _cropTop / 2;
|
||||
break;
|
||||
case VIDEO_2D:
|
||||
case VideoMode::VIDEO_2D:
|
||||
default:
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
@ -4,7 +4,7 @@
|
||||
Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom)
|
||||
: _imageResampler()
|
||||
, _useImageResampler(true)
|
||||
, _videoMode(VIDEO_2D)
|
||||
, _videoMode(VideoMode::VIDEO_2D)
|
||||
, _width(width)
|
||||
, _height(height)
|
||||
, _fps(15)
|
||||
@ -16,7 +16,7 @@ Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int c
|
||||
, _enabled(true)
|
||||
, _log(Logger::getInstance(grabberName))
|
||||
{
|
||||
Grabber::setVideoMode(VIDEO_2D);
|
||||
Grabber::setVideoMode(VideoMode::VIDEO_2D);
|
||||
Grabber::setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
||||
}
|
||||
|
||||
|
@ -568,24 +568,24 @@ void Hyperion::update()
|
||||
// correct the color byte order
|
||||
switch (_ledStringColorOrder.at(i))
|
||||
{
|
||||
case ORDER_RGB:
|
||||
case ColorOrder::ORDER_RGB:
|
||||
// leave as it is
|
||||
break;
|
||||
case ORDER_BGR:
|
||||
case ColorOrder::ORDER_BGR:
|
||||
std::swap(color.red, color.blue);
|
||||
break;
|
||||
case ORDER_RBG:
|
||||
case ColorOrder::ORDER_RBG:
|
||||
std::swap(color.green, color.blue);
|
||||
break;
|
||||
case ORDER_GRB:
|
||||
case ColorOrder::ORDER_GRB:
|
||||
std::swap(color.red, color.green);
|
||||
break;
|
||||
case ORDER_GBR:
|
||||
case ColorOrder::ORDER_GBR:
|
||||
std::swap(color.red, color.green);
|
||||
std::swap(color.green, color.blue);
|
||||
break;
|
||||
|
||||
case ORDER_BRG:
|
||||
case ColorOrder::ORDER_BRG:
|
||||
std::swap(color.red, color.blue);
|
||||
std::swap(color.green, color.blue);
|
||||
break;
|
||||
|
@ -14,6 +14,7 @@ MultiColorAdjustment::~MultiColorAdjustment()
|
||||
for (ColorAdjustment * adjustment : _adjustment)
|
||||
{
|
||||
delete adjustment;
|
||||
// BUG: Calling pop_back while iterating is invalid
|
||||
_adjustment.pop_back();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "hyperion/Hyperion.h"
|
||||
#include <utils/JsonUtils.h>
|
||||
@ -21,7 +22,7 @@ LedDevice::LedDevice(const QJsonObject& config, QObject* parent)
|
||||
, _deviceInError(false)
|
||||
, _refresh_timer(new QTimer(this))
|
||||
, _refresh_timer_interval(0)
|
||||
, _last_write_time(QDateTime::currentMSecsSinceEpoch())
|
||||
, _lastWriteTime(QDateTime::currentDateTime())
|
||||
, _latchTime_ms(0)
|
||||
, _componentRegistered(false)
|
||||
, _enabled(false)
|
||||
@ -140,7 +141,7 @@ bool LedDevice::init(const QJsonObject &deviceConfig)
|
||||
//Debug(_log, "Refresh interval = %dms",_refresh_timer_interval );
|
||||
_refresh_timer->setInterval( _refresh_timer_interval );
|
||||
|
||||
_last_write_time = QDateTime::currentMSecsSinceEpoch();
|
||||
_lastWriteTime = QDateTime::currentDateTime();
|
||||
|
||||
this->startRefreshTimer();
|
||||
}
|
||||
@ -170,12 +171,12 @@ int LedDevice::updateLeds(const std::vector<ColorRgb>& ledValues)
|
||||
}
|
||||
else
|
||||
{
|
||||
qint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() - _last_write_time;
|
||||
if (_latchTime_ms == 0 || elapsedTime >= _latchTime_ms)
|
||||
qint64 elapsedTimeMs = _lastWriteTime.msecsTo(QDateTime::currentDateTime());
|
||||
if (_latchTime_ms == 0 || elapsedTimeMs >= _latchTime_ms)
|
||||
{
|
||||
//std::cout << "LedDevice::updateLeds(), Elapsed time since last write (" << elapsedTime << ") ms > _latchTime_ms (" << _latchTime_ms << ") ms" << std::endl;
|
||||
//std::cout << "LedDevice::updateLeds(), Elapsed time since last write (" << elapsedTimeMs << ") ms > _latchTime_ms (" << _latchTime_ms << ") ms" << std::endl;
|
||||
retval = write(ledValues);
|
||||
_last_write_time = QDateTime::currentMSecsSinceEpoch();
|
||||
_lastWriteTime = QDateTime::currentDateTime();
|
||||
|
||||
// if device requires refreshing, save Led-Values and restart the timer
|
||||
if ( _refresh_enabled )
|
||||
@ -186,7 +187,7 @@ int LedDevice::updateLeds(const std::vector<ColorRgb>& ledValues)
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "LedDevice::updateLeds(), Skip write. _latchTime_ms (" << _latchTime_ms << ") ms > elapsedTime (" << elapsedTime << ") ms" << std::endl;
|
||||
//std::cout << "LedDevice::updateLeds(), Skip write. elapsedTime (" << elapsedTimeMs << ") ms < _latchTime_ms (" << _latchTime_ms << ") ms" << std::endl;
|
||||
if ( _refresh_enabled )
|
||||
{
|
||||
//Stop timer to allow for next non-refresh update
|
||||
@ -242,16 +243,16 @@ int LedDevice::rewriteLeds()
|
||||
|
||||
if ( _deviceReady )
|
||||
{
|
||||
// qint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() - _last_write_time;
|
||||
// std::cout << "LedDevice::rewriteLeds(): Rewrite Leds now, elapsedTime [" << elapsedTime << "] ms" << std::endl;
|
||||
// qint64 elapsedTimeMs = _lastWriteTime.msecsTo(QDateTime::currentDateTime());
|
||||
// std::cout << "LedDevice::rewriteLEDs(): Rewrite LEDs now, elapsedTime [" << elapsedTimeMs << "] ms" << std::endl;
|
||||
// //:TESTING: Inject "white" output records to differentiate from normal writes
|
||||
// _last_ledValues.clear();
|
||||
// _last_ledValues.resize(static_cast<unsigned long>(_ledCount), ColorRgb::WHITE);
|
||||
// printLedValues(_last_ledValues);
|
||||
// //:TESTING:
|
||||
//:TESTING:
|
||||
|
||||
retval = write(_last_ledValues);
|
||||
_last_write_time = QDateTime::currentMSecsSinceEpoch();
|
||||
_lastWriteTime = QDateTime::currentDateTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2,18 +2,20 @@
|
||||
#include "LedDeviceAtmoOrb.h"
|
||||
|
||||
// qt includes
|
||||
#include <QtNetwork>
|
||||
#include <QUdpSocket>
|
||||
|
||||
const quint16 MULTICAST_GROUPL_DEFAULT_PORT = 49692;
|
||||
const int LEDS_DEFAULT_NUMBER = 24;
|
||||
|
||||
LedDeviceAtmoOrb::LedDeviceAtmoOrb(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
, _networkmanager (nullptr)
|
||||
, _udpSocket (nullptr)
|
||||
, _multiCastGroupPort (49692)
|
||||
, joinedMulticastgroup (false)
|
||||
, _multiCastGroupPort (MULTICAST_GROUPL_DEFAULT_PORT)
|
||||
, _joinedMulticastgroup (false)
|
||||
, _useOrbSmoothing (false)
|
||||
, _transitiontime (0)
|
||||
, _skipSmoothingDiff (0)
|
||||
, _numLeds (24)
|
||||
, _numLeds (LEDS_DEFAULT_NUMBER)
|
||||
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
@ -27,25 +29,32 @@ LedDevice* LedDeviceAtmoOrb::construct(const QJsonObject &deviceConfig)
|
||||
|
||||
LedDeviceAtmoOrb::~LedDeviceAtmoOrb()
|
||||
{
|
||||
_networkmanager->deleteLater();
|
||||
_udpSocket->deleteLater();
|
||||
if ( _udpSocket != nullptr )
|
||||
{
|
||||
_udpSocket->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
bool LedDeviceAtmoOrb::init(const QJsonObject &deviceConfig)
|
||||
{
|
||||
bool isInitOK = LedDevice::init(deviceConfig);
|
||||
bool isInitOK = false;
|
||||
|
||||
if ( isInitOK )
|
||||
if ( LedDevice::init(deviceConfig) )
|
||||
{
|
||||
|
||||
_multicastGroup = deviceConfig["output"].toString().toStdString().c_str();
|
||||
_useOrbSmoothing = deviceConfig["useOrbSmoothing"].toBool(false);
|
||||
_transitiontime = deviceConfig["transitiontime"].toInt(0);
|
||||
_skipSmoothingDiff = deviceConfig["skipSmoothingDiff"].toInt(0);
|
||||
_multiCastGroupPort = static_cast<quint16>(deviceConfig["port"].toInt(49692));
|
||||
_numLeds = deviceConfig["numLeds"].toInt(24);
|
||||
_multiCastGroupPort = static_cast<quint16>(deviceConfig["port"].toInt(MULTICAST_GROUPL_DEFAULT_PORT));
|
||||
_numLeds = deviceConfig["numLeds"].toInt(LEDS_DEFAULT_NUMBER);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
const QStringList orbIds = deviceConfig["orbIds"].toString().simplified().remove(" ").split(",", Qt::SkipEmptyParts);
|
||||
#else
|
||||
const QStringList orbIds = deviceConfig["orbIds"].toString().simplified().remove(" ").split(",", QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
const QStringList orbIds = deviceConfig["orbIds"].toString().simplified().remove(" ").split(",", QString::SkipEmptyParts);
|
||||
_orbIds.clear();
|
||||
|
||||
foreach(auto & id_str, orbIds)
|
||||
@ -53,7 +62,12 @@ bool LedDeviceAtmoOrb::init(const QJsonObject &deviceConfig)
|
||||
bool ok;
|
||||
int id = id_str.toInt(&ok);
|
||||
if (ok)
|
||||
_orbIds.append(id);
|
||||
{
|
||||
if ( id < 1 || id > 255 )
|
||||
Warning(_log, "Skip orb id '%d'. IDs must be in range 1-255", id);
|
||||
else
|
||||
_orbIds.append(id);
|
||||
}
|
||||
else
|
||||
Error(_log, "orb id '%s' is not a number", QSTRING_CSTR(id_str));
|
||||
}
|
||||
@ -63,25 +77,15 @@ bool LedDeviceAtmoOrb::init(const QJsonObject &deviceConfig)
|
||||
this->setInError("No valid OrbIds found!");
|
||||
isInitOK = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_udpSocket = new QUdpSocket(this);
|
||||
isInitOK = true;
|
||||
}
|
||||
}
|
||||
return isInitOK;
|
||||
}
|
||||
|
||||
bool LedDeviceAtmoOrb::initNetwork()
|
||||
{
|
||||
bool isInitOK = true;
|
||||
|
||||
// TODO: Add Network-Error handling
|
||||
_networkmanager = new QNetworkAccessManager();
|
||||
_groupAddress = QHostAddress(_multicastGroup);
|
||||
|
||||
_udpSocket = new QUdpSocket(this);
|
||||
_udpSocket->bind(QHostAddress::AnyIPv4, _multiCastGroupPort, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
|
||||
|
||||
joinedMulticastgroup = _udpSocket->joinMulticastGroup(_groupAddress);
|
||||
return isInitOK;
|
||||
}
|
||||
|
||||
int LedDeviceAtmoOrb::open()
|
||||
{
|
||||
int retval = -1;
|
||||
@ -89,24 +93,56 @@ int LedDeviceAtmoOrb::open()
|
||||
|
||||
if ( init(_devConfig) )
|
||||
{
|
||||
if ( !initNetwork() )
|
||||
// Try to bind the UDP-Socket
|
||||
if ( _udpSocket != nullptr )
|
||||
{
|
||||
this->setInError( "Network error!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
_deviceReady = true;
|
||||
setEnable(true);
|
||||
retval = 0;
|
||||
_groupAddress = QHostAddress(_multicastGroup);
|
||||
if ( !_udpSocket->bind(QHostAddress::AnyIPv4, _multiCastGroupPort, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint) )
|
||||
{
|
||||
QString errortext = QString ("(%1) %2, MulticastGroup: (%3)").arg(_udpSocket->error()).arg(_udpSocket->errorString()).arg(_multicastGroup);
|
||||
this->setInError( errortext );
|
||||
}
|
||||
else
|
||||
{
|
||||
_joinedMulticastgroup = _udpSocket->joinMulticastGroup(_groupAddress);
|
||||
if ( !_joinedMulticastgroup )
|
||||
{
|
||||
QString errortext = QString ("(%1) %2, MulticastGroup: (%3)").arg(_udpSocket->error()).arg(_udpSocket->errorString()).arg(_multicastGroup);
|
||||
this->setInError( errortext );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Everything is OK, device is ready
|
||||
_deviceReady = true;
|
||||
setEnable(true);
|
||||
retval = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void LedDeviceAtmoOrb::close()
|
||||
{
|
||||
LedDevice::close();
|
||||
|
||||
if ( _udpSocket != nullptr )
|
||||
{
|
||||
// Test, if device requires closing
|
||||
if ( _udpSocket->isOpen() )
|
||||
{
|
||||
Debug(_log,"Close UDP-device: %s", QSTRING_CSTR( this->getActiveDeviceType() ) );
|
||||
_udpSocket->close();
|
||||
// Everything is OK -> device is closed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int LedDeviceAtmoOrb::write(const std::vector <ColorRgb> &ledValues)
|
||||
{
|
||||
// If not in multicast group return
|
||||
if (!joinedMulticastgroup)
|
||||
if (!_joinedMulticastgroup)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -179,20 +215,23 @@ void LedDeviceAtmoOrb::setColor(int orbId, const ColorRgb &color, int commandTyp
|
||||
bytes.fill('\0');
|
||||
|
||||
// Command identifier: C0FFEE
|
||||
bytes[0] = 0xC0;
|
||||
bytes[1] = 0xFF;
|
||||
bytes[2] = 0xEE;
|
||||
bytes[0] = static_cast<char>(0xC0);
|
||||
bytes[1] = static_cast<char>(0xFF);
|
||||
bytes[2] = static_cast<char>(0xEE);
|
||||
|
||||
// Command type
|
||||
bytes[3] = commandType;
|
||||
bytes[3] = static_cast<char>(commandType);
|
||||
|
||||
// Orb ID
|
||||
bytes[4] = orbId;
|
||||
bytes[4] = static_cast<char>(orbId);
|
||||
|
||||
// RED / GREEN / BLUE
|
||||
bytes[5] = color.red;
|
||||
bytes[6] = color.green;
|
||||
bytes[7] = color.blue;
|
||||
bytes[5] = static_cast<char>(color.red);
|
||||
bytes[6] = static_cast<char>(color.green);
|
||||
bytes[7] = static_cast<char>(color.blue);
|
||||
|
||||
// TODO: Why is the datagram _numLeds * 3 in size, if only bypes 5,6,7 are updated with the color?
|
||||
//std::cout << "Orb [" << orbId << "] Cmd [" << bytes.toHex(':').toStdString() <<"]"<< std::endl;
|
||||
|
||||
sendCommand(bytes);
|
||||
}
|
||||
|
@ -60,6 +60,13 @@ protected:
|
||||
///
|
||||
virtual int open() override;
|
||||
|
||||
///
|
||||
/// @brief Closes the output device.
|
||||
///
|
||||
/// @return Zero on success (i.e. device is closed), else negative
|
||||
///
|
||||
virtual void close() override;
|
||||
|
||||
private:
|
||||
|
||||
///
|
||||
@ -102,7 +109,7 @@ private:
|
||||
quint16 _multiCastGroupPort;
|
||||
|
||||
// Multicast status
|
||||
bool joinedMulticastgroup;
|
||||
bool _joinedMulticastgroup;
|
||||
|
||||
/// use Orbs own (external) smoothing algorithm
|
||||
bool _useOrbSmoothing;
|
||||
@ -116,9 +123,6 @@ private:
|
||||
/// Number of leds in Orb, used to determine buffer size
|
||||
int _numLeds;
|
||||
|
||||
|
||||
|
||||
|
||||
/// Array of the orb ids.
|
||||
QVector<int> _orbIds;
|
||||
|
||||
@ -127,7 +131,4 @@ private:
|
||||
QMap<int, int> lastColorGreenMap;
|
||||
QMap<int, int> lastColorBlueMap;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
@ -165,7 +165,7 @@ int LedDeviceFadeCandy::sendSysEx(uint8_t systemId, uint8_t commandId, QByteArra
|
||||
if ( isConnected() )
|
||||
{
|
||||
QByteArray sysExData;
|
||||
ssize_t data_size = msg.size() + 4;
|
||||
uint data_size = msg.size() + 4;
|
||||
sysExData.resize( 4 + OPC_HEADER_SIZE );
|
||||
|
||||
sysExData[0] = 0;
|
||||
|
@ -337,12 +337,12 @@ bool LedDeviceNanoleaf::discoverDevice()
|
||||
SSDPDiscover discover;
|
||||
|
||||
// Discover Canvas device
|
||||
address = discover.getFirstService(STY_WEBSERVER, SSDP_CANVAS, SSDP_TIMEOUT);
|
||||
address = discover.getFirstService(searchType::STY_WEBSERVER, SSDP_CANVAS, SSDP_TIMEOUT);
|
||||
|
||||
//No Canvas device not found
|
||||
if ( address.isEmpty() ) {
|
||||
// Discover Light Panels (Aurora) device
|
||||
address = discover.getFirstService(STY_WEBSERVER, SSDP_LIGHTPANELS, SSDP_TIMEOUT);
|
||||
address = discover.getFirstService(searchType::STY_WEBSERVER, SSDP_LIGHTPANELS, SSDP_TIMEOUT);
|
||||
|
||||
if ( address.isEmpty() ) {
|
||||
Warning(_log, "No Nanoleaf device discovered");
|
||||
@ -353,7 +353,12 @@ bool LedDeviceNanoleaf::discoverDevice()
|
||||
if ( ! address.isEmpty() ) {
|
||||
Info(_log, "Nanoleaf device discovered at [%s]", QSTRING_CSTR( address ));
|
||||
isDeviceFound = true;
|
||||
QStringList addressparts = address.split(":", QString::SkipEmptyParts);
|
||||
// Resolve hostname and port (or use default API port)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList addressparts = address.split(":", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList addressparts = address.split(":", QString::SkipEmptyParts);
|
||||
#endif
|
||||
_hostname = addressparts[0];
|
||||
_api_port = addressparts[1];
|
||||
}
|
||||
|
@ -282,7 +282,11 @@ bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig)
|
||||
|
||||
if ( !address.isEmpty() )
|
||||
{
|
||||
QStringList addressparts = address.split(":", QString::SkipEmptyParts);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList addressparts = address.split(":", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList addressparts = address.split(":", QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
_hostname = addressparts[0];
|
||||
if ( addressparts.size() > 1 )
|
||||
@ -402,7 +406,12 @@ void LedDevicePhilipsHueBridge::setBridgeConfig(QJsonDocument doc)
|
||||
_deviceFirmwareVersion = jsonConfigInfo[DEV_DATA_FIRMWAREVERSION].toString();
|
||||
_deviceAPIVersion = jsonConfigInfo[DEV_DATA_APIVERSION].toString();
|
||||
|
||||
QStringList apiVersionParts = _deviceAPIVersion.split(".", QString::SkipEmptyParts);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList apiVersionParts = _deviceAPIVersion.split(".", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList apiVersionParts = _deviceAPIVersion.split(".", QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
if ( !apiVersionParts.isEmpty() )
|
||||
{
|
||||
_api_major = apiVersionParts[0].toUInt();
|
||||
@ -483,7 +492,7 @@ bool LedDevicePhilipsHueBridge::discoverDevice()
|
||||
SSDPDiscover discover;
|
||||
|
||||
// Discover Philips Hue Bridge
|
||||
address = discover.getFirstService( STY_WEBSERVER, SSDP_ID, SSDP_TIMEOUT );
|
||||
address = discover.getFirstService( searchType::STY_WEBSERVER, SSDP_ID, SSDP_TIMEOUT );
|
||||
if ( address.isEmpty() )
|
||||
{
|
||||
Warning(_log, "No Philips Hue Bridge discovered" );
|
||||
@ -493,7 +502,13 @@ bool LedDevicePhilipsHueBridge::discoverDevice()
|
||||
// Philips Hue Bridge found
|
||||
Info(_log, "Philips Hue Bridge discovered at [%s]", QSTRING_CSTR( address ) );
|
||||
isDeviceFound = true;
|
||||
QStringList addressparts = address.split(":", QString::SkipEmptyParts);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList addressparts = address.split(":", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList addressparts = address.split(":", QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
_hostname = addressparts[0];
|
||||
_api_port = addressparts[1];
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "LedDeviceUdpH801.h"
|
||||
|
||||
const ushort H801_DEFAULT_PORT = 30977;
|
||||
static const char H801_DEFAULT_HOST[] = "255.255.255.255";
|
||||
|
||||
LedDeviceUdpH801::LedDeviceUdpH801(const QJsonObject &deviceConfig)
|
||||
: ProviderUdp()
|
||||
{
|
||||
@ -31,8 +34,8 @@ bool LedDeviceUdpH801::init(const QJsonObject &deviceConfig)
|
||||
}
|
||||
|
||||
_message = QByteArray(_prefix_size + _colors + _id_size * _ids.size() + _suffix_size, 0x00);
|
||||
_message[0] = 0xFB;
|
||||
_message[1] = 0xEB;
|
||||
_message[0] = static_cast<char>(0xFB);
|
||||
_message[1] = static_cast<char>(0xEB);
|
||||
|
||||
for (int i = 0; i < _ids.length(); i++) {
|
||||
_message[_prefix_size + _colors + i * _id_size + 0] = (_ids[i] >> 0x00) & 0xFF;
|
||||
|
@ -8,9 +8,6 @@
|
||||
///
|
||||
///
|
||||
|
||||
const ushort H801_DEFAULT_PORT = 30977;
|
||||
static const char H801_DEFAULT_HOST[] = "255.255.255.255";
|
||||
|
||||
class LedDeviceUdpH801: public ProviderUdp
|
||||
{
|
||||
protected:
|
||||
|
@ -14,6 +14,8 @@
|
||||
// Local Hyperion includes
|
||||
#include "ProviderUdp.h"
|
||||
|
||||
const ushort MAX_PORT = 65535;
|
||||
|
||||
ProviderUdp::ProviderUdp()
|
||||
: LedDevice()
|
||||
, _udpSocket (nullptr)
|
||||
@ -26,7 +28,10 @@ ProviderUdp::ProviderUdp()
|
||||
|
||||
ProviderUdp::~ProviderUdp()
|
||||
{
|
||||
_udpSocket->deleteLater();
|
||||
if ( _udpSocket != nullptr )
|
||||
{
|
||||
_udpSocket->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
bool ProviderUdp::init(const QJsonObject &deviceConfig)
|
||||
@ -79,17 +84,18 @@ bool ProviderUdp::initNetwork()
|
||||
|
||||
_udpSocket = new QUdpSocket(this);
|
||||
|
||||
if ( _udpSocket != nullptr)
|
||||
// Try to bind the UDP-Socket
|
||||
if ( _udpSocket != nullptr )
|
||||
{
|
||||
QHostAddress localAddress = QHostAddress::Any;
|
||||
quint16 localPort = 0;
|
||||
if ( !_udpSocket->bind(localAddress, localPort) )
|
||||
{
|
||||
Warning ( _log, "Could not bind local address: %s", strerror(errno));
|
||||
QString warntext = QString ("Could not bind local address: %1, (%2) %3").arg(localAddress.toString()).arg(_udpSocket->error()).arg(_udpSocket->errorString());
|
||||
Warning ( _log, "%s", QSTRING_CSTR(warntext));
|
||||
}
|
||||
isInitOK = true;
|
||||
}
|
||||
|
||||
return isInitOK;
|
||||
}
|
||||
|
||||
@ -120,18 +126,24 @@ void ProviderUdp::close()
|
||||
{
|
||||
LedDevice::close();
|
||||
|
||||
// LedDevice specific closing activites
|
||||
if ( _udpSocket != nullptr)
|
||||
if ( _udpSocket != nullptr )
|
||||
{
|
||||
_udpSocket->close();
|
||||
// Test, if device requires closing
|
||||
if ( _udpSocket->isOpen() )
|
||||
{
|
||||
Debug(_log,"Close UDP-device: %s", QSTRING_CSTR( this->getActiveDeviceType() ) );
|
||||
_udpSocket->close();
|
||||
// Everything is OK -> device is closed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ProviderUdp::writeBytes(const unsigned size, const uint8_t * data)
|
||||
{
|
||||
|
||||
qint64 retVal = _udpSocket->writeDatagram((const char *)data,size,_address,_port);
|
||||
WarningIf((retVal<0), _log, "Error sending: %s", strerror(errno));
|
||||
|
||||
WarningIf((retVal<0), _log, "&s", QSTRING_CSTR(QString
|
||||
("(%1:%2) Write Error: (%3) %4").arg(_address.toString()).arg(_port).arg(_udpSocket->error()).arg(_udpSocket->errorString())));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
class QUdpSocket;
|
||||
|
||||
const ushort MAX_PORT = 65535;
|
||||
|
||||
///
|
||||
/// The ProviderUdp implements an abstract base-class for LedDevices using UDP packets.
|
||||
///
|
||||
|
@ -1,11 +1,12 @@
|
||||
#include "LedDeviceFile.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
// Qt includes
|
||||
#include <Qt>
|
||||
#include <QTextStream>
|
||||
|
||||
LedDeviceFile::LedDeviceFile(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
, _file (nullptr)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_deviceReady = false;
|
||||
@ -14,6 +15,10 @@ LedDeviceFile::LedDeviceFile(const QJsonObject &deviceConfig)
|
||||
|
||||
LedDeviceFile::~LedDeviceFile()
|
||||
{
|
||||
if ( _file != nullptr )
|
||||
{
|
||||
_file->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceFile::construct(const QJsonObject &deviceConfig)
|
||||
@ -28,9 +33,19 @@ bool LedDeviceFile::init(const QJsonObject &deviceConfig)
|
||||
_fileName = deviceConfig["output"].toString("/dev/null");
|
||||
_printTimeStamp = deviceConfig["printTimeStamp"].toBool(false);
|
||||
|
||||
initFile(_fileName);
|
||||
|
||||
return initOK;
|
||||
}
|
||||
|
||||
void LedDeviceFile::initFile(const QString &fileName)
|
||||
{
|
||||
if ( _file == nullptr )
|
||||
{
|
||||
_file = new QFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
int LedDeviceFile::open()
|
||||
{
|
||||
int retval = -1;
|
||||
@ -39,26 +54,24 @@ int LedDeviceFile::open()
|
||||
|
||||
if ( init(_devConfig) )
|
||||
{
|
||||
if ( _ofs.is_open() )
|
||||
if ( ! _file->isOpen() )
|
||||
{
|
||||
_ofs.close();
|
||||
}
|
||||
Debug(_log, "QIODevice::WriteOnly, %s", QSTRING_CSTR(_fileName));
|
||||
if ( !_file->open(QIODevice::WriteOnly | QIODevice::Text) )
|
||||
{
|
||||
errortext = QString ("(%1) %2, file: (%3)").arg(_file->error()).arg(_file->errorString()).arg(_fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_deviceReady = true;
|
||||
setEnable(true);
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
_ofs.open( QSTRING_CSTR(_fileName));
|
||||
if ( _ofs.fail() )
|
||||
{
|
||||
errortext = QString ("Failed to open file (%1). Error message: %2").arg(_fileName, strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
_deviceReady = true;
|
||||
setEnable(true);
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
if ( retval < 0 )
|
||||
{
|
||||
this->setInError( errortext );
|
||||
if ( retval < 0 )
|
||||
{
|
||||
this->setInError( errortext );
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
@ -68,43 +81,47 @@ void LedDeviceFile::close()
|
||||
{
|
||||
LedDevice::close();
|
||||
|
||||
// LedDevice specific closing activites
|
||||
if ( _ofs )
|
||||
if ( _file != nullptr)
|
||||
{
|
||||
_ofs.close();
|
||||
if ( _ofs.fail() )
|
||||
// Test, if device requires closing
|
||||
if ( _file->isOpen() )
|
||||
{
|
||||
Error( _log, "Failed to close device (%s). Error message: %s", QSTRING_CSTR(_fileName), strerror(errno) );
|
||||
// close device physically
|
||||
Debug(_log,"File: %s", QSTRING_CSTR(_fileName) );
|
||||
_file->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int LedDeviceFile::write(const std::vector<ColorRgb> & ledValues)
|
||||
{
|
||||
QTextStream out(_file);
|
||||
|
||||
//printLedValues (ledValues);
|
||||
|
||||
if ( _printTimeStamp )
|
||||
{
|
||||
// get a precise timestamp as a string
|
||||
const auto now = std::chrono::system_clock::now();
|
||||
const auto nowAsTimeT = std::chrono::system_clock::to_time_t(now);
|
||||
const auto nowMs = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
qint64 elapsedTimeMs = _lastWriteTime.msecsTo(now);
|
||||
|
||||
const auto elapsedTimeMs = std::chrono::duration_cast<std::chrono::milliseconds>(now - lastWriteTime);
|
||||
|
||||
_ofs
|
||||
<< std::put_time(std::localtime(&nowAsTimeT), "%Y-%m-%d %T")
|
||||
<< '.' << std::setfill('0') << std::setw(3) << nowMs.count()
|
||||
<< " | +" << std::setfill('0') << std::setw(4) << elapsedTimeMs.count();
|
||||
|
||||
lastWriteTime = now;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
out << now.toString(Qt::ISODateWithMs) << " | +" << QString("%1").arg( elapsedTimeMs,4);
|
||||
#else
|
||||
out << now.toString(Qt::ISODate) << now.toString(".zzz") << " | +" << QString("%1").arg( elapsedTimeMs,4);
|
||||
#endif
|
||||
}
|
||||
|
||||
_ofs << " [";
|
||||
out << " [";
|
||||
for (const ColorRgb& color : ledValues)
|
||||
{
|
||||
_ofs << color;
|
||||
out << color;
|
||||
}
|
||||
_ofs << "]" << std::endl;
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
out << "]" << Qt::endl;
|
||||
#else
|
||||
out << "]" << endl;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,74 +1,84 @@
|
||||
#pragma once
|
||||
#ifndef LEDEVICEFILE_H
|
||||
#define LEDEVICEFILE_H
|
||||
|
||||
// STL includes
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
|
||||
// Leddevice includes
|
||||
// LedDevice includes
|
||||
#include <leddevice/LedDevice.h>
|
||||
|
||||
// Qt includes
|
||||
#include <QFile>
|
||||
#include <QDateTime>
|
||||
|
||||
///
|
||||
/// Implementation of the LedDevice that write the led-colors to an
|
||||
/// ASCII-textfile('/home/pi/LedDevice.out')
|
||||
/// Implementation of the LedDevice that write the LED-colors to an
|
||||
/// ASCII-textfile primarily for testing purposes
|
||||
///
|
||||
class LedDeviceFile : public LedDevice
|
||||
{
|
||||
public:
|
||||
|
||||
///
|
||||
/// Constructs specific LedDevice
|
||||
/// @brief Constructs a file output LED-device
|
||||
///
|
||||
/// @param deviceConfig json device config
|
||||
/// @param deviceConfig Device's configuration as JSON-Object
|
||||
///
|
||||
explicit LedDeviceFile(const QJsonObject &deviceConfig);
|
||||
|
||||
///
|
||||
/// Destructor of this test-device
|
||||
/// @brief Destructor of the LedDevice
|
||||
///
|
||||
virtual ~LedDeviceFile() override;
|
||||
|
||||
/// constructs leddevice
|
||||
///
|
||||
/// @brief Constructs the LED-device
|
||||
///
|
||||
/// @param[in] deviceConfig Device's configuration as JSON-Object
|
||||
/// @return LedDevice constructed
|
||||
static LedDevice* construct(const QJsonObject &deviceConfig);
|
||||
|
||||
public slots:
|
||||
///
|
||||
/// Sets configuration
|
||||
/// @brief Closes the output device.
|
||||
///
|
||||
/// @param deviceConfig the json device config
|
||||
/// @return true if success
|
||||
virtual bool init(const QJsonObject &deviceConfig) override;
|
||||
|
||||
public slots:
|
||||
///
|
||||
/// Closes the output device.
|
||||
/// Includes switching-off the device and stopping refreshes
|
||||
/// @return Zero on success (i.e. device is closed), else negative
|
||||
///
|
||||
virtual void close() override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
///
|
||||
/// Opens and initiatialises the output device
|
||||
/// @brief Initialise the device's configuration
|
||||
///
|
||||
/// @return Zero on succes (i.e. device is ready and enabled) else negative
|
||||
/// @param[in] deviceConfig the JSON device configuration
|
||||
/// @return True, if success
|
||||
///
|
||||
virtual bool init(const QJsonObject &deviceConfig) override;
|
||||
|
||||
///
|
||||
/// @brief Opens the output device.
|
||||
///
|
||||
/// @return Zero on success (i.e. device is ready), else negative
|
||||
///
|
||||
virtual int open() override;
|
||||
|
||||
///
|
||||
/// Writes the given led-color values to the output stream
|
||||
/// @brief Writes the RGB-Color values to the LEDs.
|
||||
///
|
||||
/// @param ledValues The color-value per led
|
||||
///
|
||||
/// @return Zero on success else negative
|
||||
/// @param[in] ledValues The RGB-color per LED
|
||||
/// @return Zero on success, else negative
|
||||
///
|
||||
virtual int write(const std::vector<ColorRgb> & ledValues) override;
|
||||
|
||||
/// The outputstream
|
||||
std::ofstream _ofs;
|
||||
QFile* _file;
|
||||
|
||||
private:
|
||||
|
||||
void initFile(const QString &filename);
|
||||
|
||||
QString _fileName;
|
||||
/// Timestamp for the output record
|
||||
bool _printTimeStamp;
|
||||
/// Last write/output timestamp
|
||||
std::chrono::system_clock::time_point lastWriteTime = std::chrono::system_clock::now();
|
||||
|
||||
};
|
||||
|
||||
#endif // LEDEVICEFILE_H
|
||||
|
@ -27,7 +27,7 @@ bool LedDeviceWS281x::init(const QJsonObject &deviceConfig)
|
||||
QString whiteAlgorithm = deviceConfig["whiteAlgorithm"].toString("white_off");
|
||||
|
||||
_whiteAlgorithm = RGBW::stringToWhiteAlgorithm(whiteAlgorithm);
|
||||
if (_whiteAlgorithm == RGBW::INVALID)
|
||||
if (_whiteAlgorithm == RGBW::WhiteAlgorithm::INVALID)
|
||||
{
|
||||
errortext = QString ("unknown whiteAlgorithm: %1").arg(whiteAlgorithm);
|
||||
isInitOK = false;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
LedDeviceSk6812SPI::LedDeviceSk6812SPI(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
, _whiteAlgorithm(RGBW::INVALID)
|
||||
, _whiteAlgorithm(RGBW::WhiteAlgorithm::INVALID)
|
||||
, SPI_BYTES_PER_COLOUR(4)
|
||||
, bitpair_to_byte {
|
||||
0b10001000,
|
||||
@ -30,7 +30,7 @@ bool LedDeviceSk6812SPI::init(const QJsonObject &deviceConfig)
|
||||
QString whiteAlgorithm = deviceConfig["whiteAlgorithm"].toString("white_off");
|
||||
|
||||
_whiteAlgorithm = RGBW::stringToWhiteAlgorithm(whiteAlgorithm);
|
||||
if (_whiteAlgorithm == RGBW::INVALID)
|
||||
if (_whiteAlgorithm == RGBW::WhiteAlgorithm::INVALID)
|
||||
{
|
||||
QString errortext = QString ("unknown whiteAlgorithm: %1").arg(whiteAlgorithm);
|
||||
this->setInError(errortext);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <ssdp/SSDPDiscover.h>
|
||||
|
||||
// qt inc
|
||||
// Qt includes
|
||||
#include <QUdpSocket>
|
||||
#include <QUrl>
|
||||
|
||||
@ -40,7 +40,7 @@ const QString SSDPDiscover::getFirstService(const searchType& type, const QStrin
|
||||
_searchTarget = st;
|
||||
|
||||
// search
|
||||
sendSearch(st);
|
||||
sendSearch(_searchTarget);
|
||||
|
||||
if ( _udpSocket->waitForReadyRead(timeout_ms) )
|
||||
{
|
||||
@ -58,12 +58,18 @@ const QString SSDPDiscover::getFirstService(const searchType& type, const QStrin
|
||||
|
||||
QString data(datagram);
|
||||
|
||||
Debug(_log, "_data: [%s]", QSTRING_CSTR(data));
|
||||
//Debug(_log, "_data: [%s]", QSTRING_CSTR(data));
|
||||
|
||||
QMap<QString,QString> headers;
|
||||
QString address;
|
||||
// parse request
|
||||
QStringList entries = data.split("\n", QString::SkipEmptyParts);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList entries = data.split("\n", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList entries = data.split("\n", QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
for(auto entry : entries)
|
||||
{
|
||||
// http header parse skip
|
||||
@ -92,13 +98,13 @@ const QString SSDPDiscover::getFirstService(const searchType& type, const QStrin
|
||||
_usnList << headers.value("usn");
|
||||
QUrl url(headers.value("location"));
|
||||
//Debug(_log, "Received msearch response from '%s:%d'. Search target: %s",QSTRING_CSTR(sender.toString()), senderPort, QSTRING_CSTR(headers.value("st")));
|
||||
if(type == STY_WEBSERVER)
|
||||
if(type == searchType::STY_WEBSERVER)
|
||||
{
|
||||
Debug(_log, "Found service [%s] at: %s:%d", QSTRING_CSTR(st), QSTRING_CSTR(url.host()), url.port());
|
||||
|
||||
return url.host()+":"+QString::number(url.port());
|
||||
}
|
||||
else if(type == STY_FLATBUFSERVER)
|
||||
else if(type == searchType::STY_FLATBUFSERVER)
|
||||
{
|
||||
const QString fbsport = headers.value("hyperion-fbs-port");
|
||||
if(fbsport.isEmpty())
|
||||
@ -111,7 +117,7 @@ const QString SSDPDiscover::getFirstService(const searchType& type, const QStrin
|
||||
return url.host()+":"+fbsport;
|
||||
}
|
||||
}
|
||||
else if(type == STY_JSONSERVER)
|
||||
else if(type == searchType::STY_JSONSERVER)
|
||||
{
|
||||
const QString jssport = headers.value("hyperion-jss-port");
|
||||
if(jssport.isEmpty())
|
||||
@ -146,7 +152,11 @@ void SSDPDiscover::readPendingDatagrams()
|
||||
QString data(datagram);
|
||||
QMap<QString,QString> headers;
|
||||
// parse request
|
||||
QStringList entries = data.split("\n", QString::SkipEmptyParts);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList entries = data.split("\n", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList entries = data.split("\n", QString::SkipEmptyParts);
|
||||
#endif
|
||||
for(auto entry : entries)
|
||||
{
|
||||
// http header parse skip
|
||||
|
@ -137,7 +137,11 @@ void SSDPServer::readPendingDatagrams()
|
||||
QString data(datagram);
|
||||
QMap<QString,QString> headers;
|
||||
// parse request
|
||||
QStringList entries = data.split("\n", QString::SkipEmptyParts);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList entries = data.split("\n", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList entries = data.split("\n", QString::SkipEmptyParts);
|
||||
#endif
|
||||
for(auto entry : entries)
|
||||
{
|
||||
// http header parse skip
|
||||
|
@ -8,7 +8,7 @@ ImageResampler::ImageResampler()
|
||||
, _cropRight(0)
|
||||
, _cropTop(0)
|
||||
, _cropBottom(0)
|
||||
, _videoMode(VIDEO_2D)
|
||||
, _videoMode(VideoMode::VIDEO_2D)
|
||||
{
|
||||
}
|
||||
|
||||
@ -47,10 +47,10 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
||||
// handle 3D mode
|
||||
switch (_videoMode)
|
||||
{
|
||||
case VIDEO_3DSBS:
|
||||
case VideoMode::VIDEO_3DSBS:
|
||||
cropRight = width >> 1;
|
||||
break;
|
||||
case VIDEO_3DTAB:
|
||||
case VideoMode::VIDEO_3DTAB:
|
||||
cropBottom = width >> 1;
|
||||
break;
|
||||
default:
|
||||
@ -71,7 +71,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
||||
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case PIXELFORMAT_UYVY:
|
||||
case PixelFormat::UYVY:
|
||||
{
|
||||
int index = lineLength * ySource + (xSource << 1);
|
||||
uint8_t y = data[index+1];
|
||||
@ -80,7 +80,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
||||
yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue);
|
||||
}
|
||||
break;
|
||||
case PIXELFORMAT_YUYV:
|
||||
case PixelFormat::YUYV:
|
||||
{
|
||||
int index = lineLength * ySource + (xSource << 1);
|
||||
uint8_t y = data[index];
|
||||
@ -89,7 +89,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
||||
yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue);
|
||||
}
|
||||
break;
|
||||
case PIXELFORMAT_BGR16:
|
||||
case PixelFormat::BGR16:
|
||||
{
|
||||
int index = lineLength * ySource + (xSource << 1);
|
||||
rgb.blue = (data[index] & 0x1f) << 3;
|
||||
@ -97,7 +97,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
||||
rgb.red = (data[index+1] & 0xF8);
|
||||
}
|
||||
break;
|
||||
case PIXELFORMAT_BGR24:
|
||||
case PixelFormat::BGR24:
|
||||
{
|
||||
int index = lineLength * ySource + (xSource << 1) + xSource;
|
||||
rgb.blue = data[index ];
|
||||
@ -105,7 +105,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
||||
rgb.red = data[index+2];
|
||||
}
|
||||
break;
|
||||
case PIXELFORMAT_RGB32:
|
||||
case PixelFormat::RGB32:
|
||||
{
|
||||
int index = lineLength * ySource + (xSource << 2);
|
||||
rgb.red = data[index ];
|
||||
@ -113,7 +113,7 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
||||
rgb.blue = data[index+2];
|
||||
}
|
||||
break;
|
||||
case PIXELFORMAT_BGR32:
|
||||
case PixelFormat::BGR32:
|
||||
{
|
||||
int index = lineLength * ySource + (xSource << 2);
|
||||
rgb.blue = data[index ];
|
||||
@ -122,10 +122,10 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
case PIXELFORMAT_MJPEG:
|
||||
case PixelFormat::MJPEG:
|
||||
break;
|
||||
#endif
|
||||
case PIXELFORMAT_NO_CHANGE:
|
||||
case PixelFormat::NO_CHANGE:
|
||||
Error(Logger::getInstance("ImageResampler"), "Invalid pixel format given");
|
||||
break;
|
||||
}
|
||||
|
@ -7,18 +7,18 @@ namespace RGBW {
|
||||
|
||||
WhiteAlgorithm stringToWhiteAlgorithm(QString str)
|
||||
{
|
||||
if (str == "subtract_minimum") return SUBTRACT_MINIMUM;
|
||||
if (str == "sub_min_warm_adjust") return SUB_MIN_WARM_ADJUST;
|
||||
if (str == "sub_min_cool_adjust") return SUB_MIN_COOL_ADJUST;
|
||||
if (str.isEmpty() || str == "white_off") return WHITE_OFF;
|
||||
return INVALID;
|
||||
if (str == "subtract_minimum") return WhiteAlgorithm::SUBTRACT_MINIMUM;
|
||||
if (str == "sub_min_warm_adjust") return WhiteAlgorithm::SUB_MIN_WARM_ADJUST;
|
||||
if (str == "sub_min_cool_adjust") return WhiteAlgorithm::SUB_MIN_COOL_ADJUST;
|
||||
if (str.isEmpty() || str == "white_off") return WhiteAlgorithm::WHITE_OFF;
|
||||
return WhiteAlgorithm::INVALID;
|
||||
}
|
||||
|
||||
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm)
|
||||
{
|
||||
switch (algorithm)
|
||||
{
|
||||
case SUBTRACT_MINIMUM:
|
||||
case WhiteAlgorithm::SUBTRACT_MINIMUM:
|
||||
{
|
||||
output->white = qMin(qMin(input.red, input.green), input.blue);
|
||||
output->red = input.red - output->white;
|
||||
@ -27,13 +27,13 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
|
||||
break;
|
||||
}
|
||||
|
||||
case SUB_MIN_WARM_ADJUST:
|
||||
case WhiteAlgorithm::SUB_MIN_WARM_ADJUST:
|
||||
{
|
||||
// http://forum.garagecube.com/viewtopic.php?t=10178
|
||||
// warm white
|
||||
float F1 = 0.274;
|
||||
float F2 = 0.454;
|
||||
float F3 = 2.333;
|
||||
// warm white
|
||||
float F1 = static_cast<float>(0.274);
|
||||
float F2 = static_cast<float>(0.454);
|
||||
float F3 = static_cast<float>(2.333);
|
||||
|
||||
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
|
||||
output->red = input.red - output->white/F1;
|
||||
@ -42,13 +42,13 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
|
||||
break;
|
||||
}
|
||||
|
||||
case SUB_MIN_COOL_ADJUST:
|
||||
case WhiteAlgorithm::SUB_MIN_COOL_ADJUST:
|
||||
{
|
||||
// http://forum.garagecube.com/viewtopic.php?t=10178
|
||||
// cold white
|
||||
float F1 = 0.299;
|
||||
float F2 = 0.587;
|
||||
float F3 = 0.114;
|
||||
// cold white
|
||||
float F1 = static_cast<float>(0.299);
|
||||
float F2 = static_cast<float>(0.587);
|
||||
float F3 = static_cast<float>(0.114);
|
||||
|
||||
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
|
||||
output->red = input.red - output->white/F1;
|
||||
@ -57,7 +57,7 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
|
||||
break;
|
||||
}
|
||||
|
||||
case WHITE_OFF:
|
||||
case WhiteAlgorithm::WHITE_OFF:
|
||||
{
|
||||
output->red = input.red;
|
||||
output->green = input.green;
|
||||
|
@ -58,7 +58,11 @@ void QtHttpClientWrapper::onClientDataReceived (void)
|
||||
case AwaitingRequest: // "command url version" × 1
|
||||
{
|
||||
QString str = QString::fromUtf8 (line).trimmed ();
|
||||
QStringList parts = str.split (SPACE, QString::SkipEmptyParts);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList parts = str.split (SPACE, Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList parts = str.split (SPACE, QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
if (parts.size () == 3)
|
||||
{
|
||||
@ -192,7 +196,12 @@ void QtHttpClientWrapper::onClientDataReceived (void)
|
||||
|
||||
// catch /jsonrpc in url, we need async callback, StaticFileServing is sync
|
||||
QString path = m_currentRequest->getUrl ().path ();
|
||||
QStringList uri_parts = path.split('/', QString::SkipEmptyParts);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList uri_parts = path.split('/', Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList uri_parts = path.split('/', QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
if ( ! uri_parts.empty() && uri_parts.at(0) == "json-rpc" )
|
||||
{
|
||||
|
@ -81,7 +81,11 @@ void StaticFileServing::onRequestNeedsReply (QtHttpRequest * request, QtHttpRepl
|
||||
if (command == QStringLiteral ("GET"))
|
||||
{
|
||||
QString path = request->getUrl ().path ();
|
||||
QStringList uri_parts = path.split('/', QString::SkipEmptyParts);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QStringList uri_parts = path.split('/', Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList uri_parts = path.split('/', QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
// special uri handling for server commands
|
||||
if ( ! uri_parts.empty() )
|
||||
|
@ -239,7 +239,7 @@ void WebSocketClient::handleBinaryMessage(QByteArray &data)
|
||||
unsigned width = ((data.at(2) << 8) & 0xFF00) | (data.at(3) & 0xFF);
|
||||
unsigned height = imgSize / width;
|
||||
|
||||
if ( ! (imgSize) % width)
|
||||
if ( imgSize % width > 0 )
|
||||
{
|
||||
Error(_log, "data size is not multiple of width");
|
||||
return;
|
||||
|
@ -69,7 +69,7 @@ int main(int argc, char ** argv)
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_FLATBUFSERVER);
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
|
@ -57,15 +57,15 @@ int main(int argc, char ** argv)
|
||||
// parse all options
|
||||
parser.process(app);
|
||||
|
||||
VideoMode videoMode = VIDEO_2D;
|
||||
VideoMode videoMode = VideoMode::VIDEO_2D;
|
||||
|
||||
if (parser.isSet(arg3DSBS))
|
||||
{
|
||||
videoMode = VIDEO_3DSBS;
|
||||
videoMode = VideoMode::VIDEO_3DSBS;
|
||||
}
|
||||
else if (parser.isSet(arg3DTAB))
|
||||
{
|
||||
videoMode = VIDEO_3DTAB;
|
||||
videoMode = VideoMode::VIDEO_3DTAB;
|
||||
}
|
||||
|
||||
// check if we need to display the usage. exit if we do.
|
||||
@ -98,7 +98,7 @@ int main(int argc, char ** argv)
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_FLATBUFSERVER);
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
|
@ -62,7 +62,7 @@ int main(int argc, char ** argv)
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_FLATBUFSERVER);
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
|
@ -65,7 +65,7 @@ int main(int argc, char ** argv)
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_FLATBUFSERVER);
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char ** argv)
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_FLATBUFSERVER);
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
|
@ -182,7 +182,7 @@ int main(int argc, char * argv[])
|
||||
if(argAddress.value(parser) == "127.0.0.1:19444")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_JSONSERVER);
|
||||
address = discover.getFirstService(searchType::STY_JSONSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
|
@ -84,18 +84,18 @@ int main(int argc, char** argv)
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
|
||||
|
||||
argVideoStandard.addSwitch("pal", VIDEOSTANDARD_PAL);
|
||||
argVideoStandard.addSwitch("ntsc", VIDEOSTANDARD_NTSC);
|
||||
argVideoStandard.addSwitch("secam", VIDEOSTANDARD_SECAM);
|
||||
argVideoStandard.addSwitch("no-change", VIDEOSTANDARD_NO_CHANGE);
|
||||
argVideoStandard.addSwitch("pal", VideoStandard::PAL);
|
||||
argVideoStandard.addSwitch("ntsc", VideoStandard::NTSC);
|
||||
argVideoStandard.addSwitch("secam", VideoStandard::SECAM);
|
||||
argVideoStandard.addSwitch("no-change", VideoStandard::NO_CHANGE);
|
||||
|
||||
argPixelFormat.addSwitch("yuyv", PIXELFORMAT_YUYV);
|
||||
argPixelFormat.addSwitch("uyvy", PIXELFORMAT_UYVY);
|
||||
argPixelFormat.addSwitch("rgb32", PIXELFORMAT_RGB32);
|
||||
argPixelFormat.addSwitch("yuyv", PixelFormat::YUYV);
|
||||
argPixelFormat.addSwitch("uyvy", PixelFormat::UYVY);
|
||||
argPixelFormat.addSwitch("rgb32", PixelFormat::RGB32);
|
||||
#ifdef HAVE_JPEG
|
||||
argPixelFormat.addSwitch("mjpeg", PIXELFORMAT_MJPEG);
|
||||
argPixelFormat.addSwitch("mjpeg", PixelFormat::MJPEG);
|
||||
#endif
|
||||
argPixelFormat.addSwitch("no-change", PIXELFORMAT_NO_CHANGE);
|
||||
argPixelFormat.addSwitch("no-change", PixelFormat::NO_CHANGE);
|
||||
|
||||
// parse all options
|
||||
parser.process(app);
|
||||
@ -173,11 +173,11 @@ int main(int argc, char** argv)
|
||||
// set 3D mode if applicable
|
||||
if (parser.isSet(arg3DSBS))
|
||||
{
|
||||
grabber.setVideoMode(VIDEO_3DSBS);
|
||||
grabber.setVideoMode(VideoMode::VIDEO_3DSBS);
|
||||
}
|
||||
else if (parser.isSet(arg3DTAB))
|
||||
{
|
||||
grabber.setVideoMode(VIDEO_3DTAB);
|
||||
grabber.setVideoMode(VideoMode::VIDEO_3DTAB);
|
||||
}
|
||||
|
||||
// run the grabber
|
||||
@ -198,7 +198,7 @@ int main(int argc, char** argv)
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_FLATBUFSERVER);
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
|
@ -83,7 +83,7 @@ int main(int argc, char ** argv)
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_FLATBUFSERVER);
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
|
@ -77,7 +77,12 @@ unsigned int getProcessIdsByProcessName(const char *processName, QStringList &li
|
||||
if (bytes.isEmpty())
|
||||
return 0;
|
||||
|
||||
listOfPids = QString(bytes).split("\n", QString::SkipEmptyParts);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
listOfPids = QString(bytes).split("\n", Qt::SkipEmptyParts);
|
||||
#else
|
||||
listOfPids = QString(bytes).split("\n", QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
return listOfPids.count();
|
||||
|
||||
#endif
|
||||
|
@ -76,7 +76,7 @@ HyperionDaemon::HyperionDaemon(const QString rootPath, QObject *parent, const bo
|
||||
, _osxGrabber(nullptr)
|
||||
, _qtGrabber(nullptr)
|
||||
, _ssdp(nullptr)
|
||||
, _currVideoMode(VIDEO_2D)
|
||||
, _currVideoMode(VideoMode::VIDEO_2D)
|
||||
{
|
||||
HyperionDaemon::daemon = this;
|
||||
|
||||
@ -278,7 +278,7 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type &settingsType, co
|
||||
if (level == "silent")
|
||||
Logger::setLogLevel(Logger::OFF);
|
||||
else if (level == "warn")
|
||||
Logger::setLogLevel(Logger::WARNING);
|
||||
Logger::setLogLevel(Logger::LogLevel::WARNING);
|
||||
else if (level == "verbose")
|
||||
Logger::setLogLevel(Logger::INFO);
|
||||
else if (level == "debug")
|
||||
@ -325,15 +325,19 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type &settingsType, co
|
||||
Error(_log, "grabber device '%s' for type amlogic not found!", QSTRING_CSTR(_grabber_device));
|
||||
}
|
||||
}
|
||||
// x11 -> if DISPLAY is set
|
||||
else if (getenv("DISPLAY") != NULL)
|
||||
{
|
||||
type = "x11";
|
||||
}
|
||||
// qt -> if nothing other applies
|
||||
else
|
||||
{
|
||||
type = "qt";
|
||||
// x11 -> if DISPLAY is set
|
||||
QByteArray envDisplay = qgetenv("DISPLAY");
|
||||
if ( !envDisplay.isEmpty() )
|
||||
{
|
||||
type = "x11";
|
||||
}
|
||||
// qt -> if nothing other applies
|
||||
else
|
||||
{
|
||||
type = "qt";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ int main(int argc, char** argv)
|
||||
if (parser.isSet(versionOption))
|
||||
{
|
||||
std::cout
|
||||
<< "Hyperion Ambilight Deamon (" << getpid() << ")" << std::endl
|
||||
<< "Hyperion Ambilight Deamon" << std::endl
|
||||
<< "\tVersion : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << std::endl
|
||||
<< "\tBuild Time: " << __DATE__ << " " << __TIME__ << std::endl;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
|
||||
// X11 includes
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include <QElapsedTimer>
|
||||
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
|
||||
// X11 includes
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
void foo_1(int pixelDecimation)
|
||||
{
|
||||
int cropWidth = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user