mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
General tidy up
This commit is contained in:
parent
13205a9d11
commit
dd2d5e4b40
@ -60,12 +60,12 @@ namespace hyperion
|
|||||||
/// @return The detected (or not detected) black border info
|
/// @return The detected (or not detected) black border info
|
||||||
///
|
///
|
||||||
|
|
||||||
uint8_t calculateThreshold(double blackborderThreshold);
|
uint8_t calculateThreshold(double blackborderThreshold) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// default detection mode (3lines 4side detection)
|
/// default detection mode (3lines 4side detection)
|
||||||
template <typename Pixel_T>
|
template <typename Pixel_T>
|
||||||
BlackBorder process(const Image<Pixel_T> & image)
|
BlackBorder process(const Image<Pixel_T> & image) const
|
||||||
{
|
{
|
||||||
// test center and 33%, 66% of width/heigth
|
// test center and 33%, 66% of width/heigth
|
||||||
// 33 and 66 will check left and top
|
// 33 and 66 will check left and top
|
||||||
@ -122,7 +122,7 @@ namespace hyperion
|
|||||||
///
|
///
|
||||||
/// classic detection mode (topleft single line mode)
|
/// classic detection mode (topleft single line mode)
|
||||||
template <typename Pixel_T>
|
template <typename Pixel_T>
|
||||||
BlackBorder process_classic(const Image<Pixel_T> & image)
|
BlackBorder process_classic(const Image<Pixel_T> & image) const
|
||||||
{
|
{
|
||||||
// only test the topleft third of the image
|
// only test the topleft third of the image
|
||||||
int width = image.width() /3;
|
int width = image.width() /3;
|
||||||
@ -179,7 +179,7 @@ namespace hyperion
|
|||||||
///
|
///
|
||||||
/// osd detection mode (find x then y at detected x to avoid changes by osd overlays)
|
/// osd detection mode (find x then y at detected x to avoid changes by osd overlays)
|
||||||
template <typename Pixel_T>
|
template <typename Pixel_T>
|
||||||
BlackBorder process_osd(const Image<Pixel_T> & image)
|
BlackBorder process_osd(const Image<Pixel_T> & image) const
|
||||||
{
|
{
|
||||||
// find X position at height33 and height66 we check from the left side, Ycenter will check from right side
|
// find X position at height33 and height66 we check from the left side, Ycenter will check from right side
|
||||||
// then we try to find a pixel at this X position from top and bottom and right side from top
|
// then we try to find a pixel at this X position from top and bottom and right side from top
|
||||||
@ -245,7 +245,7 @@ namespace hyperion
|
|||||||
/// @return True if the color is considered black else false
|
/// @return True if the color is considered black else false
|
||||||
///
|
///
|
||||||
template <typename Pixel_T>
|
template <typename Pixel_T>
|
||||||
inline bool isBlack(const Pixel_T & color)
|
inline bool isBlack(const Pixel_T & color) const
|
||||||
{
|
{
|
||||||
// Return the simple compare of the color against black
|
// Return the simple compare of the color against black
|
||||||
return color.red < _blackborderThreshold && color.green < _blackborderThreshold && color.blue < _blackborderThreshold;
|
return color.red < _blackborderThreshold && color.green < _blackborderThreshold && color.blue < _blackborderThreshold;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// QT includes
|
// QT includes
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
class ColorAdjustment
|
class ColorAdjustment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Unique identifier for this color transform
|
/// Unique identifier for this color transform
|
||||||
QString _id;
|
QString _id;
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ namespace hyperion
|
|||||||
///
|
///
|
||||||
unsigned height() const;
|
unsigned height() const;
|
||||||
|
|
||||||
unsigned horizontalBorder() { return _horizontalBorder; };
|
unsigned horizontalBorder() const { return _horizontalBorder; };
|
||||||
unsigned verticalBorder() { return _verticalBorder; };
|
unsigned verticalBorder() const { return _verticalBorder; };
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Determines the mean color for each led using the mapping the image given
|
/// Determines the mean color for each led using the mapping the image given
|
||||||
@ -176,9 +176,9 @@ namespace hyperion
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accumulate the sum of each seperate color channel
|
// Accumulate the sum of each seperate color channel
|
||||||
uint_fast16_t cummRed = 0;
|
uint_fast32_t cummRed = 0;
|
||||||
uint_fast16_t cummGreen = 0;
|
uint_fast32_t cummGreen = 0;
|
||||||
uint_fast16_t cummBlue = 0;
|
uint_fast32_t cummBlue = 0;
|
||||||
const auto& imgData = image.memptr();
|
const auto& imgData = image.memptr();
|
||||||
|
|
||||||
for (const unsigned colorOffset : colors)
|
for (const unsigned colorOffset : colors)
|
||||||
@ -210,9 +210,9 @@ namespace hyperion
|
|||||||
ColorRgb calcMeanColor(const Image<Pixel_T> & image) const
|
ColorRgb calcMeanColor(const Image<Pixel_T> & image) const
|
||||||
{
|
{
|
||||||
// Accumulate the sum of each seperate color channel
|
// Accumulate the sum of each seperate color channel
|
||||||
uint_fast16_t cummRed = 0;
|
uint_fast32_t cummRed = 0;
|
||||||
uint_fast16_t cummGreen = 0;
|
uint_fast32_t cummGreen = 0;
|
||||||
uint_fast16_t cummBlue = 0;
|
uint_fast32_t cummBlue = 0;
|
||||||
const unsigned imageSize = image.width() * image.height();
|
const unsigned imageSize = image.width() * image.height();
|
||||||
|
|
||||||
const auto& imgData = image.memptr();
|
const auto& imgData = image.memptr();
|
||||||
|
@ -25,13 +25,13 @@ public:
|
|||||||
/// @param local The local address of the socket (Differs based on NetworkAdapter IP or localhost)
|
/// @param local The local address of the socket (Differs based on NetworkAdapter IP or localhost)
|
||||||
/// @return True when allowed, else false
|
/// @return True when allowed, else false
|
||||||
///
|
///
|
||||||
bool accessAllowed(const QHostAddress& address, const QHostAddress& local);
|
bool accessAllowed(const QHostAddress& address, const QHostAddress& local) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Check if address is in subnet of local
|
/// @brief Check if address is in subnet of local
|
||||||
/// @return True or false
|
/// @return True or false
|
||||||
///
|
///
|
||||||
bool isLocalAddress(const QHostAddress& address, const QHostAddress& local);
|
bool isLocalAddress(const QHostAddress& address, const QHostAddress& local) const;
|
||||||
|
|
||||||
static NetOrigin* getInstance(){ return instance; };
|
static NetOrigin* getInstance(){ return instance; };
|
||||||
static NetOrigin* instance;
|
static NetOrigin* instance;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
namespace Process {
|
namespace Process {
|
||||||
|
|
||||||
void restartHyperion(bool asNewProcess=false);
|
void restartHyperion(bool asNewProcess=false);
|
||||||
QByteArray command_exec(QString cmd, QByteArray data="");
|
QByteArray command_exec(const QString& cmd, const QByteArray& data = {});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ BlackBorderDetector::BlackBorderDetector(double threshold)
|
|||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t BlackBorderDetector::calculateThreshold(double threshold)
|
uint8_t BlackBorderDetector::calculateThreshold(double threshold) const
|
||||||
{
|
{
|
||||||
int rgbThreshold = int(std::ceil(threshold * 255));
|
int rgbThreshold = int(std::ceil(threshold * 255));
|
||||||
if (rgbThreshold < 0)
|
if (rgbThreshold < 0)
|
||||||
|
@ -56,8 +56,7 @@ void BlackBorderProcessor::handleSettingsUpdate(const settings::type& type, cons
|
|||||||
{
|
{
|
||||||
_oldThreshold = newThreshold;
|
_oldThreshold = newThreshold;
|
||||||
|
|
||||||
if(_detector != nullptr)
|
delete _detector;
|
||||||
delete _detector;
|
|
||||||
|
|
||||||
_detector = new BlackBorderDetector(newThreshold);
|
_detector = new BlackBorderDetector(newThreshold);
|
||||||
}
|
}
|
||||||
|
@ -210,12 +210,14 @@ bool XcbGrabber::Setup()
|
|||||||
setupRender();
|
setupRender();
|
||||||
setupShm();
|
setupShm();
|
||||||
|
|
||||||
Info(_log, "XcbRandR : %s", _XcbRandRAvailable ? "available" : "unavailable");
|
Info(_log, QString("XcbRandR=[%1] XcbRender=[%2] XcbShm=[%3] XcbPixmap=[%4]")
|
||||||
Info(_log, "XcbRender : %s", _XcbRenderAvailable ? "available" : "unavailable");
|
.arg(_XcbRandRAvailable ? "available" : "unavailable")
|
||||||
Info(_log, "XcbShm : %s", _XcbShmAvailable ? "available" : "unavailable");
|
.arg(_XcbRenderAvailable ? "available" : "unavailable")
|
||||||
Info(_log, "XcbPixmap : %s", _XcbShmPixmapAvailable ? "available" : "unavailable");
|
.arg(_XcbShmAvailable ? "available" : "unavailable")
|
||||||
|
.arg(_XcbShmPixmapAvailable ? "available" : "unavailable")
|
||||||
|
.toStdString().c_str());
|
||||||
|
|
||||||
bool result = (updateScreenDimensions(true) >=0);
|
bool result = (updateScreenDimensions(true) >= 0);
|
||||||
ErrorIf(!result, _log, "XCB Grabber start failed");
|
ErrorIf(!result, _log, "XCB Grabber start failed");
|
||||||
setEnabled(result);
|
setEnabled(result);
|
||||||
return result;
|
return result;
|
||||||
|
@ -33,7 +33,7 @@ LedDevice::LedDevice(const QJsonObject& deviceConfig, QObject* parent)
|
|||||||
, _lastWriteTime(QDateTime::currentDateTime())
|
, _lastWriteTime(QDateTime::currentDateTime())
|
||||||
, _isRefreshEnabled (false)
|
, _isRefreshEnabled (false)
|
||||||
{
|
{
|
||||||
|
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice::~LedDevice()
|
LedDevice::~LedDevice()
|
||||||
|
@ -13,14 +13,10 @@ QString _usbProductDescription = "Hyperion led controller";
|
|||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceHyperionUsbasp::LedDeviceHyperionUsbasp(const QJsonObject &deviceConfig)
|
LedDeviceHyperionUsbasp::LedDeviceHyperionUsbasp(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
, _libusbContext(nullptr)
|
, _libusbContext(nullptr)
|
||||||
, _deviceHandle(nullptr)
|
, _deviceHandle(nullptr)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceHyperionUsbasp::~LedDeviceHyperionUsbasp()
|
LedDeviceHyperionUsbasp::~LedDeviceHyperionUsbasp()
|
||||||
|
@ -33,7 +33,7 @@ enum DATA_VERSION_INDEXES{
|
|||||||
};
|
};
|
||||||
|
|
||||||
LedDeviceLightpack::LedDeviceLightpack(const QJsonObject &deviceConfig)
|
LedDeviceLightpack::LedDeviceLightpack(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
, _libusbContext(nullptr)
|
, _libusbContext(nullptr)
|
||||||
, _deviceHandle(nullptr)
|
, _deviceHandle(nullptr)
|
||||||
, _busNumber(-1)
|
, _busNumber(-1)
|
||||||
@ -41,12 +41,8 @@ LedDeviceLightpack::LedDeviceLightpack(const QJsonObject &deviceConfig)
|
|||||||
, _firmwareVersion({-1,-1})
|
, _firmwareVersion({-1,-1})
|
||||||
, _bitsPerChannel(-1)
|
, _bitsPerChannel(-1)
|
||||||
, _hwLedCount(-1)
|
, _hwLedCount(-1)
|
||||||
,_isOpen(false)
|
, _isOpen(false)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceLightpack::~LedDeviceLightpack()
|
LedDeviceLightpack::~LedDeviceLightpack()
|
||||||
|
@ -18,23 +18,16 @@ bool compareLightpacks(LedDeviceLightpack * lhs, LedDeviceLightpack * rhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceMultiLightpack::LedDeviceMultiLightpack(const QJsonObject &deviceConfig)
|
LedDeviceMultiLightpack::LedDeviceMultiLightpack(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
, _lightpacks()
|
, _lightpacks()
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceMultiLightpack::~LedDeviceMultiLightpack()
|
LedDeviceMultiLightpack::~LedDeviceMultiLightpack()
|
||||||
{
|
{
|
||||||
for (LedDeviceLightpack * device : _lightpacks)
|
for (LedDeviceLightpack * device : _lightpacks)
|
||||||
{
|
{
|
||||||
if ( device != nullptr)
|
delete device;
|
||||||
{
|
|
||||||
delete device;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,14 +2,9 @@
|
|||||||
|
|
||||||
// Use out report HID device
|
// Use out report HID device
|
||||||
LedDevicePaintpack::LedDevicePaintpack(const QJsonObject &deviceConfig)
|
LedDevicePaintpack::LedDevicePaintpack(const QJsonObject &deviceConfig)
|
||||||
: ProviderHID()
|
: ProviderHID(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_useFeature = false;
|
_useFeature = false;
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDevicePaintpack::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDevicePaintpack::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -2,13 +2,8 @@
|
|||||||
|
|
||||||
// Use feature report HID device
|
// Use feature report HID device
|
||||||
LedDeviceRawHID::LedDeviceRawHID(const QJsonObject &deviceConfig)
|
LedDeviceRawHID::LedDeviceRawHID(const QJsonObject &deviceConfig)
|
||||||
: ProviderHID()
|
: ProviderHID(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
|
|
||||||
_useFeature = true;
|
_useFeature = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
// Local Hyperion includes
|
// Local Hyperion includes
|
||||||
#include "ProviderHID.h"
|
#include "ProviderHID.h"
|
||||||
|
|
||||||
ProviderHID::ProviderHID()
|
ProviderHID::ProviderHID(const QJsonObject &deviceConfig)
|
||||||
: _VendorId(0)
|
: LedDevice(deviceConfig)
|
||||||
|
, _VendorId(0)
|
||||||
, _ProductId(0)
|
, _ProductId(0)
|
||||||
, _useFeature(false)
|
, _useFeature(false)
|
||||||
, _deviceHandle(nullptr)
|
, _deviceHandle(nullptr)
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param deviceConfig Device's configuration as JSON-Object
|
/// @param deviceConfig Device's configuration as JSON-Object
|
||||||
///
|
///
|
||||||
ProviderHID();
|
ProviderHID(const QJsonObject &deviceConfig);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Destructor of the LedDevice
|
/// @brief Destructor of the LedDevice
|
||||||
|
@ -9,7 +9,7 @@ const quint16 MULTICAST_GROUPL_DEFAULT_PORT = 49692;
|
|||||||
const int LEDS_DEFAULT_NUMBER = 24;
|
const int LEDS_DEFAULT_NUMBER = 24;
|
||||||
|
|
||||||
LedDeviceAtmoOrb::LedDeviceAtmoOrb(const QJsonObject &deviceConfig)
|
LedDeviceAtmoOrb::LedDeviceAtmoOrb(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
, _udpSocket (nullptr)
|
, _udpSocket (nullptr)
|
||||||
, _multiCastGroupPort (MULTICAST_GROUPL_DEFAULT_PORT)
|
, _multiCastGroupPort (MULTICAST_GROUPL_DEFAULT_PORT)
|
||||||
, _joinedMulticastgroup (false)
|
, _joinedMulticastgroup (false)
|
||||||
@ -19,10 +19,6 @@ LedDeviceAtmoOrb::LedDeviceAtmoOrb(const QJsonObject &deviceConfig)
|
|||||||
, _numLeds (LEDS_DEFAULT_NUMBER)
|
, _numLeds (LEDS_DEFAULT_NUMBER)
|
||||||
|
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceAtmoOrb::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceAtmoOrb::construct(const QJsonObject &deviceConfig)
|
||||||
@ -32,10 +28,7 @@ LedDevice* LedDeviceAtmoOrb::construct(const QJsonObject &deviceConfig)
|
|||||||
|
|
||||||
LedDeviceAtmoOrb::~LedDeviceAtmoOrb()
|
LedDeviceAtmoOrb::~LedDeviceAtmoOrb()
|
||||||
{
|
{
|
||||||
if ( _udpSocket != nullptr )
|
delete _udpSocket;
|
||||||
{
|
|
||||||
delete _udpSocket;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedDeviceAtmoOrb::init(const QJsonObject &deviceConfig)
|
bool LedDeviceAtmoOrb::init(const QJsonObject &deviceConfig)
|
||||||
@ -241,6 +234,5 @@ void LedDeviceAtmoOrb::setColor(int orbId, const ColorRgb &color, int commandTyp
|
|||||||
|
|
||||||
void LedDeviceAtmoOrb::sendCommand(const QByteArray &bytes)
|
void LedDeviceAtmoOrb::sendCommand(const QByteArray &bytes)
|
||||||
{
|
{
|
||||||
QByteArray datagram = bytes;
|
_udpSocket->writeDatagram(bytes.data(), bytes.size(), _groupAddress, _multiCastGroupPort);
|
||||||
_udpSocket->writeDatagram(datagram.data(), datagram.size(), _groupAddress, _multiCastGroupPort);
|
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,6 @@ private:
|
|||||||
QMap<int, int> lastColorRedMap;
|
QMap<int, int> lastColorRedMap;
|
||||||
QMap<int, int> lastColorGreenMap;
|
QMap<int, int> lastColorGreenMap;
|
||||||
QMap<int, int> lastColorBlueMap;
|
QMap<int, int> lastColorBlueMap;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LEDEVICEATMOORB_H
|
#endif // LEDEVICEATMOORB_H
|
||||||
|
@ -20,23 +20,16 @@ const unsigned OPC_HEADER_SIZE = 4; // OPC header size
|
|||||||
const quint16 STREAM_DEFAULT_PORT = 7890;
|
const quint16 STREAM_DEFAULT_PORT = 7890;
|
||||||
|
|
||||||
LedDeviceFadeCandy::LedDeviceFadeCandy(const QJsonObject &deviceConfig)
|
LedDeviceFadeCandy::LedDeviceFadeCandy(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
, _client(nullptr)
|
, _client(nullptr)
|
||||||
,_host()
|
,_host()
|
||||||
,_port(STREAM_DEFAULT_PORT)
|
,_port(STREAM_DEFAULT_PORT)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceFadeCandy::~LedDeviceFadeCandy()
|
LedDeviceFadeCandy::~LedDeviceFadeCandy()
|
||||||
{
|
{
|
||||||
if ( _client != nullptr )
|
delete _client;
|
||||||
{
|
|
||||||
delete _client;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceFadeCandy::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceFadeCandy::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -90,7 +90,7 @@ enum EXTCONTROLVERSIONS {
|
|||||||
};
|
};
|
||||||
|
|
||||||
LedDeviceNanoleaf::LedDeviceNanoleaf(const QJsonObject &deviceConfig)
|
LedDeviceNanoleaf::LedDeviceNanoleaf(const QJsonObject &deviceConfig)
|
||||||
: ProviderUdp()
|
: ProviderUdp(deviceConfig)
|
||||||
,_restApi(nullptr)
|
,_restApi(nullptr)
|
||||||
,_apiPort(API_DEFAULT_PORT)
|
,_apiPort(API_DEFAULT_PORT)
|
||||||
,_topDown(true)
|
,_topDown(true)
|
||||||
@ -100,10 +100,6 @@ LedDeviceNanoleaf::LedDeviceNanoleaf(const QJsonObject &deviceConfig)
|
|||||||
,_extControlVersion (EXTCTRLVER_V2),
|
,_extControlVersion (EXTCTRLVER_V2),
|
||||||
_panelLedCount(0)
|
_panelLedCount(0)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceNanoleaf::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceNanoleaf::construct(const QJsonObject &deviceConfig)
|
||||||
@ -113,11 +109,8 @@ LedDevice* LedDeviceNanoleaf::construct(const QJsonObject &deviceConfig)
|
|||||||
|
|
||||||
LedDeviceNanoleaf::~LedDeviceNanoleaf()
|
LedDeviceNanoleaf::~LedDeviceNanoleaf()
|
||||||
{
|
{
|
||||||
if ( _restApi != nullptr )
|
delete _restApi;
|
||||||
{
|
_restApi = nullptr;
|
||||||
delete _restApi;
|
|
||||||
_restApi = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedDeviceNanoleaf::init(const QJsonObject &deviceConfig)
|
bool LedDeviceNanoleaf::init(const QJsonObject &deviceConfig)
|
||||||
|
@ -264,7 +264,7 @@ double CiColor::getDistanceBetweenTwoPoints(CiColor p1, XYColor p2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LedDevicePhilipsHueBridge::LedDevicePhilipsHueBridge(const QJsonObject &deviceConfig)
|
LedDevicePhilipsHueBridge::LedDevicePhilipsHueBridge(const QJsonObject &deviceConfig)
|
||||||
: ProviderUdpSSL()
|
: ProviderUdpSSL(deviceConfig)
|
||||||
, _restApi(nullptr)
|
, _restApi(nullptr)
|
||||||
, _apiPort(API_DEFAULT_PORT)
|
, _apiPort(API_DEFAULT_PORT)
|
||||||
, _useHueEntertainmentAPI(false)
|
, _useHueEntertainmentAPI(false)
|
||||||
@ -273,17 +273,12 @@ LedDevicePhilipsHueBridge::LedDevicePhilipsHueBridge(const QJsonObject &deviceCo
|
|||||||
, _api_patch(0)
|
, _api_patch(0)
|
||||||
, _isHueEntertainmentReady(false)
|
, _isHueEntertainmentReady(false)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevicePhilipsHueBridge::~LedDevicePhilipsHueBridge()
|
LedDevicePhilipsHueBridge::~LedDevicePhilipsHueBridge()
|
||||||
{
|
{
|
||||||
if ( _restApi != nullptr )
|
delete _restApi;
|
||||||
{
|
_restApi = nullptr;
|
||||||
delete _restApi;
|
|
||||||
_restApi = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig)
|
bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig)
|
||||||
@ -828,10 +823,6 @@ LedDevicePhilipsHue::LedDevicePhilipsHue(const QJsonObject& deviceConfig)
|
|||||||
, start_retry_left(3)
|
, start_retry_left(3)
|
||||||
, stop_retry_left(3)
|
, stop_retry_left(3)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDevicePhilipsHue::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDevicePhilipsHue::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -3,12 +3,8 @@
|
|||||||
const ushort TPM2_DEFAULT_PORT = 65506;
|
const ushort TPM2_DEFAULT_PORT = 65506;
|
||||||
|
|
||||||
LedDeviceTpm2net::LedDeviceTpm2net(const QJsonObject &deviceConfig)
|
LedDeviceTpm2net::LedDeviceTpm2net(const QJsonObject &deviceConfig)
|
||||||
: ProviderUdp()
|
: ProviderUdp(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceTpm2net::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceTpm2net::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -12,15 +12,10 @@
|
|||||||
const ushort ARTNET_DEFAULT_PORT = 6454;
|
const ushort ARTNET_DEFAULT_PORT = 6454;
|
||||||
|
|
||||||
LedDeviceUdpArtNet::LedDeviceUdpArtNet(const QJsonObject &deviceConfig)
|
LedDeviceUdpArtNet::LedDeviceUdpArtNet(const QJsonObject &deviceConfig)
|
||||||
: ProviderUdp()
|
: ProviderUdp(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LedDevice* LedDeviceUdpArtNet::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceUdpArtNet::construct(const QJsonObject &deviceConfig)
|
||||||
{
|
{
|
||||||
return new LedDeviceUdpArtNet(deviceConfig);
|
return new LedDeviceUdpArtNet(deviceConfig);
|
||||||
|
@ -25,12 +25,8 @@ const uint32_t VECTOR_E131_DATA_PACKET = 0x00000002;
|
|||||||
const int DMX_MAX = 512; // 512 usable slots
|
const int DMX_MAX = 512; // 512 usable slots
|
||||||
|
|
||||||
LedDeviceUdpE131::LedDeviceUdpE131(const QJsonObject &deviceConfig)
|
LedDeviceUdpE131::LedDeviceUdpE131(const QJsonObject &deviceConfig)
|
||||||
: ProviderUdp()
|
: ProviderUdp(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceUdpE131::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceUdpE131::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -9,12 +9,8 @@ const char H801_DEFAULT_HOST[] = "255.255.255.255";
|
|||||||
} //End of constants
|
} //End of constants
|
||||||
|
|
||||||
LedDeviceUdpH801::LedDeviceUdpH801(const QJsonObject &deviceConfig)
|
LedDeviceUdpH801::LedDeviceUdpH801(const QJsonObject &deviceConfig)
|
||||||
: ProviderUdp()
|
: ProviderUdp(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceUdpH801::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceUdpH801::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -3,12 +3,8 @@
|
|||||||
const ushort RAW_DEFAULT_PORT=5568;
|
const ushort RAW_DEFAULT_PORT=5568;
|
||||||
|
|
||||||
LedDeviceUdpRaw::LedDeviceUdpRaw(const QJsonObject &deviceConfig)
|
LedDeviceUdpRaw::LedDeviceUdpRaw(const QJsonObject &deviceConfig)
|
||||||
: ProviderUdp()
|
: ProviderUdp(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceUdpRaw::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceUdpRaw::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -34,23 +34,16 @@ const char SSDP_FILTER_HEADER[] = "ST";
|
|||||||
} //End of constants
|
} //End of constants
|
||||||
|
|
||||||
LedDeviceWled::LedDeviceWled(const QJsonObject &deviceConfig)
|
LedDeviceWled::LedDeviceWled(const QJsonObject &deviceConfig)
|
||||||
: ProviderUdp()
|
: ProviderUdp(deviceConfig)
|
||||||
,_restApi(nullptr)
|
,_restApi(nullptr)
|
||||||
,_apiPort(API_DEFAULT_PORT)
|
,_apiPort(API_DEFAULT_PORT)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceWled::~LedDeviceWled()
|
LedDeviceWled::~LedDeviceWled()
|
||||||
{
|
{
|
||||||
if ( _restApi != nullptr )
|
delete _restApi;
|
||||||
{
|
_restApi = nullptr;
|
||||||
delete _restApi;
|
|
||||||
_restApi = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceWled::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceWled::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -117,10 +117,7 @@ YeelightLight::YeelightLight( Logger *log, const QString &hostname, quint16 port
|
|||||||
YeelightLight::~YeelightLight()
|
YeelightLight::~YeelightLight()
|
||||||
{
|
{
|
||||||
log (3,"~YeelightLight()","" );
|
log (3,"~YeelightLight()","" );
|
||||||
if ( _tcpSocket != nullptr)
|
delete _tcpSocket;
|
||||||
{
|
|
||||||
delete _tcpSocket;
|
|
||||||
}
|
|
||||||
log (2,"~YeelightLight()","void" );
|
log (2,"~YeelightLight()","void" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,7 +965,7 @@ void YeelightLight::log(const int logLevel, const char* msg, const char* type, .
|
|||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
|
|
||||||
LedDeviceYeelight::LedDeviceYeelight(const QJsonObject &deviceConfig)
|
LedDeviceYeelight::LedDeviceYeelight(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
,_lightsCount (0)
|
,_lightsCount (0)
|
||||||
,_outputColorModel(0)
|
,_outputColorModel(0)
|
||||||
,_transitionEffect(YeelightLight::API_EFFECT_SMOOTH)
|
,_transitionEffect(YeelightLight::API_EFFECT_SMOOTH)
|
||||||
@ -982,10 +979,6 @@ LedDeviceYeelight::LedDeviceYeelight(const QJsonObject &deviceConfig)
|
|||||||
,_debuglevel(0)
|
,_debuglevel(0)
|
||||||
,_musicModeServerPort(-1)
|
,_musicModeServerPort(-1)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceYeelight::~LedDeviceYeelight()
|
LedDeviceYeelight::~LedDeviceYeelight()
|
||||||
|
@ -16,10 +16,9 @@
|
|||||||
class httpResponse
|
class httpResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
httpResponse() = default;
|
||||||
|
|
||||||
explicit httpResponse() {}
|
bool error() const { return _hasError;}
|
||||||
|
|
||||||
bool error() { return _hasError;}
|
|
||||||
void setError(const bool hasError) { _hasError = hasError; }
|
void setError(const bool hasError) { _hasError = hasError; }
|
||||||
|
|
||||||
QJsonDocument getBody() const { return _responseBody; }
|
QJsonDocument getBody() const { return _responseBody; }
|
||||||
@ -70,7 +69,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @brief Constructor of the REST-API wrapper
|
/// @brief Constructor of the REST-API wrapper
|
||||||
///
|
///
|
||||||
explicit ProviderRestApi();
|
ProviderRestApi();
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Constructor of the REST-API wrapper
|
/// @brief Constructor of the REST-API wrapper
|
||||||
|
@ -16,22 +16,18 @@
|
|||||||
|
|
||||||
const ushort MAX_PORT = 65535;
|
const ushort MAX_PORT = 65535;
|
||||||
|
|
||||||
ProviderUdp::ProviderUdp()
|
ProviderUdp::ProviderUdp(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
, _udpSocket (nullptr)
|
, _udpSocket (nullptr)
|
||||||
, _port(1)
|
, _port(1)
|
||||||
, _defaultHost("127.0.0.1")
|
, _defaultHost("127.0.0.1")
|
||||||
{
|
{
|
||||||
_isDeviceReady = false;
|
|
||||||
_latchTime_ms = 1;
|
_latchTime_ms = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProviderUdp::~ProviderUdp()
|
ProviderUdp::~ProviderUdp()
|
||||||
{
|
{
|
||||||
if ( _udpSocket != nullptr )
|
delete _udpSocket;
|
||||||
{
|
|
||||||
delete _udpSocket;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProviderUdp::init(const QJsonObject &deviceConfig)
|
bool ProviderUdp::init(const QJsonObject &deviceConfig)
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @brief Constructs an UDP LED-device
|
/// @brief Constructs an UDP LED-device
|
||||||
///
|
///
|
||||||
ProviderUdp();
|
ProviderUdp(const QJsonObject &deviceConfig);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Destructor of the UDP LED-device
|
/// @brief Destructor of the UDP LED-device
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
const int MAX_RETRY = 5;
|
const int MAX_RETRY = 5;
|
||||||
const ushort MAX_PORT_SSL = 65535;
|
const ushort MAX_PORT_SSL = 65535;
|
||||||
|
|
||||||
ProviderUdpSSL::ProviderUdpSSL()
|
ProviderUdpSSL::ProviderUdpSSL(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
, client_fd()
|
, client_fd()
|
||||||
, entropy()
|
, entropy()
|
||||||
, ssl()
|
, ssl()
|
||||||
@ -41,7 +41,6 @@ ProviderUdpSSL::ProviderUdpSSL()
|
|||||||
, _debugStreamer(false)
|
, _debugStreamer(false)
|
||||||
, _debugLevel(0)
|
, _debugLevel(0)
|
||||||
{
|
{
|
||||||
_isDeviceReady = false;
|
|
||||||
_latchTime_ms = 1;
|
_latchTime_ms = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @brief Constructs an UDP SSL LED-device
|
/// @brief Constructs an UDP SSL LED-device
|
||||||
///
|
///
|
||||||
ProviderUdpSSL();
|
ProviderUdpSSL(const QJsonObject &deviceConfig);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Destructor of the LED-device
|
/// @brief Destructor of the LED-device
|
||||||
|
@ -5,19 +5,15 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
LedDeviceFile::LedDeviceFile(const QJsonObject &deviceConfig)
|
LedDeviceFile::LedDeviceFile(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
, _file (nullptr)
|
, _file (nullptr)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
_printTimeStamp = false;
|
_printTimeStamp = false;
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceFile::~LedDeviceFile()
|
LedDeviceFile::~LedDeviceFile()
|
||||||
{
|
{
|
||||||
delete _file;
|
delete _file;
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceFile::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceFile::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -10,13 +10,9 @@
|
|||||||
#include "LedDevicePiBlaster.h"
|
#include "LedDevicePiBlaster.h"
|
||||||
|
|
||||||
LedDevicePiBlaster::LedDevicePiBlaster(const QJsonObject &deviceConfig)
|
LedDevicePiBlaster::LedDevicePiBlaster(const QJsonObject &deviceConfig)
|
||||||
: _fid(nullptr)
|
: LedDevice(deviceConfig)
|
||||||
|
, _fid(nullptr)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
|
|
||||||
// initialise the mapping tables
|
// initialise the mapping tables
|
||||||
// -1 is invalid
|
// -1 is invalid
|
||||||
// z is also meaningless
|
// z is also meaningless
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
#include "LedDeviceWS281x.h"
|
#include "LedDeviceWS281x.h"
|
||||||
|
|
||||||
LedDeviceWS281x::LedDeviceWS281x(const QJsonObject &deviceConfig)
|
LedDeviceWS281x::LedDeviceWS281x(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceWS281x::~LedDeviceWS281x()
|
LedDeviceWS281x::~LedDeviceWS281x()
|
||||||
|
@ -3,14 +3,10 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
LedDeviceAdalight::LedDeviceAdalight(const QJsonObject &deviceConfig)
|
LedDeviceAdalight::LedDeviceAdalight(const QJsonObject &deviceConfig)
|
||||||
: ProviderRs232()
|
: ProviderRs232(deviceConfig)
|
||||||
, _headerSize(6)
|
, _headerSize(6)
|
||||||
, _ligthBerryAPA102Mode(false)
|
, _ligthBerryAPA102Mode(false)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceAdalight::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceAdalight::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -2,15 +2,10 @@
|
|||||||
#include "LedDeviceAtmo.h"
|
#include "LedDeviceAtmo.h"
|
||||||
|
|
||||||
LedDeviceAtmo::LedDeviceAtmo(const QJsonObject &deviceConfig)
|
LedDeviceAtmo::LedDeviceAtmo(const QJsonObject &deviceConfig)
|
||||||
: ProviderRs232()
|
: ProviderRs232(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LedDevice* LedDeviceAtmo::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceAtmo::construct(const QJsonObject &deviceConfig)
|
||||||
{
|
{
|
||||||
return new LedDeviceAtmo(deviceConfig);
|
return new LedDeviceAtmo(deviceConfig);
|
||||||
|
@ -6,20 +6,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
LedDeviceDMX::LedDeviceDMX(const QJsonObject &deviceConfig)
|
LedDeviceDMX::LedDeviceDMX(const QJsonObject &deviceConfig)
|
||||||
: ProviderRs232()
|
: ProviderRs232(deviceConfig)
|
||||||
, _dmxDeviceType(0)
|
, _dmxDeviceType(0)
|
||||||
, _dmxStart(1)
|
, _dmxStart(1)
|
||||||
, _dmxSlotsPerLed(3)
|
, _dmxSlotsPerLed(3)
|
||||||
, _dmxLedCount(0)
|
, _dmxLedCount(0)
|
||||||
, _dmxChannelCount(0)
|
, _dmxChannelCount(0)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LedDevice* LedDeviceDMX::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceDMX::construct(const QJsonObject &deviceConfig)
|
||||||
{
|
{
|
||||||
return new LedDeviceDMX(deviceConfig);
|
return new LedDeviceDMX(deviceConfig);
|
||||||
|
@ -2,12 +2,8 @@
|
|||||||
#include "LedDeviceKarate.h"
|
#include "LedDeviceKarate.h"
|
||||||
|
|
||||||
LedDeviceKarate::LedDeviceKarate(const QJsonObject &deviceConfig)
|
LedDeviceKarate::LedDeviceKarate(const QJsonObject &deviceConfig)
|
||||||
: ProviderRs232()
|
: ProviderRs232(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceKarate::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceKarate::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -7,12 +7,8 @@ struct FrameSpec
|
|||||||
};
|
};
|
||||||
|
|
||||||
LedDeviceSedu::LedDeviceSedu(const QJsonObject &deviceConfig)
|
LedDeviceSedu::LedDeviceSedu(const QJsonObject &deviceConfig)
|
||||||
: ProviderRs232()
|
: ProviderRs232(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceSedu::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceSedu::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -2,15 +2,10 @@
|
|||||||
|
|
||||||
|
|
||||||
LedDeviceTpm2::LedDeviceTpm2(const QJsonObject &deviceConfig)
|
LedDeviceTpm2::LedDeviceTpm2(const QJsonObject &deviceConfig)
|
||||||
: ProviderRs232()
|
: ProviderRs232(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LedDevice* LedDeviceTpm2::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceTpm2::construct(const QJsonObject &deviceConfig)
|
||||||
{
|
{
|
||||||
return new LedDeviceTpm2(deviceConfig);
|
return new LedDeviceTpm2(deviceConfig);
|
||||||
|
@ -15,8 +15,9 @@ constexpr std::chrono::milliseconds OPEN_TIMEOUT{5000}; // device open timeout
|
|||||||
const int MAX_WRITE_TIMEOUTS = 5; // Maximum number of allowed timeouts
|
const int MAX_WRITE_TIMEOUTS = 5; // Maximum number of allowed timeouts
|
||||||
const int NUM_POWEROFF_WRITE_BLACK = 2; // Number of write "BLACK" during powering off
|
const int NUM_POWEROFF_WRITE_BLACK = 2; // Number of write "BLACK" during powering off
|
||||||
|
|
||||||
ProviderRs232::ProviderRs232()
|
ProviderRs232::ProviderRs232(const QJsonObject &deviceConfig)
|
||||||
: _rs232Port(this)
|
: LedDevice(deviceConfig)
|
||||||
|
, _rs232Port(this)
|
||||||
,_baudRate_Hz(1000000)
|
,_baudRate_Hz(1000000)
|
||||||
,_isAutoDeviceName(false)
|
,_isAutoDeviceName(false)
|
||||||
,_delayAfterConnect_ms(0)
|
,_delayAfterConnect_ms(0)
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// @brief Constructs a RS232 LED-device
|
/// @brief Constructs a RS232 LED-device
|
||||||
///
|
///
|
||||||
ProviderRs232();
|
ProviderRs232(const QJsonObject &deviceConfig);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Destructor of the UDP LED-device
|
/// @brief Destructor of the UDP LED-device
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
#include "LedDeviceAPA102.h"
|
#include "LedDeviceAPA102.h"
|
||||||
|
|
||||||
LedDeviceAPA102::LedDeviceAPA102(const QJsonObject &deviceConfig)
|
LedDeviceAPA102::LedDeviceAPA102(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceAPA102::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceAPA102::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -35,7 +35,7 @@ Reset time is 24uS = 59 bits = 8 bytes
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
LedDeviceAPA104::LedDeviceAPA104(const QJsonObject &deviceConfig)
|
LedDeviceAPA104::LedDeviceAPA104(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
, SPI_BYTES_PER_COLOUR(4)
|
, SPI_BYTES_PER_COLOUR(4)
|
||||||
, SPI_FRAME_END_LATCH_BYTES(8)
|
, SPI_FRAME_END_LATCH_BYTES(8)
|
||||||
, bitpair_to_byte {
|
, bitpair_to_byte {
|
||||||
@ -45,10 +45,6 @@ LedDeviceAPA104::LedDeviceAPA104(const QJsonObject &deviceConfig)
|
|||||||
0b11101110,
|
0b11101110,
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
#include "LedDeviceLpd6803.h"
|
#include "LedDeviceLpd6803.h"
|
||||||
|
|
||||||
LedDeviceLpd6803::LedDeviceLpd6803(const QJsonObject &deviceConfig)
|
LedDeviceLpd6803::LedDeviceLpd6803(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceLpd6803::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceLpd6803::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
#include "LedDeviceLpd8806.h"
|
#include "LedDeviceLpd8806.h"
|
||||||
|
|
||||||
LedDeviceLpd8806::LedDeviceLpd8806(const QJsonObject &deviceConfig)
|
LedDeviceLpd8806::LedDeviceLpd8806(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceLpd8806::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceLpd8806::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
#include "LedDeviceP9813.h"
|
#include "LedDeviceP9813.h"
|
||||||
|
|
||||||
LedDeviceP9813::LedDeviceP9813(const QJsonObject &deviceConfig)
|
LedDeviceP9813::LedDeviceP9813(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceP9813::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceP9813::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "LedDeviceSk6812SPI.h"
|
#include "LedDeviceSk6812SPI.h"
|
||||||
|
|
||||||
LedDeviceSk6812SPI::LedDeviceSk6812SPI(const QJsonObject &deviceConfig)
|
LedDeviceSk6812SPI::LedDeviceSk6812SPI(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
, _whiteAlgorithm(RGBW::WhiteAlgorithm::INVALID)
|
, _whiteAlgorithm(RGBW::WhiteAlgorithm::INVALID)
|
||||||
, SPI_BYTES_PER_COLOUR(4)
|
, SPI_BYTES_PER_COLOUR(4)
|
||||||
, bitpair_to_byte {
|
, bitpair_to_byte {
|
||||||
@ -11,10 +11,6 @@
|
|||||||
0b11001100,
|
0b11001100,
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceSk6812SPI::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceSk6812SPI::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -37,7 +37,7 @@ Reset time is 50uS = 100 bits = 13 bytes
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
LedDeviceSk6822SPI::LedDeviceSk6822SPI(const QJsonObject &deviceConfig)
|
LedDeviceSk6822SPI::LedDeviceSk6822SPI(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
, SPI_BYTES_PER_COLOUR(4)
|
, SPI_BYTES_PER_COLOUR(4)
|
||||||
, SPI_BYTES_WAIT_TIME(3)
|
, SPI_BYTES_WAIT_TIME(3)
|
||||||
, SPI_FRAME_END_LATCH_BYTES(13)
|
, SPI_FRAME_END_LATCH_BYTES(13)
|
||||||
@ -48,13 +48,8 @@ LedDeviceSk6822SPI::LedDeviceSk6822SPI(const QJsonObject &deviceConfig)
|
|||||||
0b11101110,
|
0b11101110,
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LedDevice* LedDeviceSk6822SPI::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceSk6822SPI::construct(const QJsonObject &deviceConfig)
|
||||||
{
|
{
|
||||||
return new LedDeviceSk6822SPI(deviceConfig);
|
return new LedDeviceSk6822SPI(deviceConfig);
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
#include "LedDeviceWs2801.h"
|
#include "LedDeviceWs2801.h"
|
||||||
|
|
||||||
LedDeviceWs2801::LedDeviceWs2801(const QJsonObject &deviceConfig)
|
LedDeviceWs2801::LedDeviceWs2801(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceWs2801::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceWs2801::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -34,8 +34,8 @@ Reset time is 300uS = 923 bits = 116 bytes
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LedDeviceWs2812SPI::LedDeviceWs2812SPI(const QJsonObject &deviceConfig)
|
LedDeviceWs2812SPI::LedDeviceWs2812SPI(const QJsonObject &deviceConfig)
|
||||||
: ProviderSpi()
|
: ProviderSpi(deviceConfig)
|
||||||
, SPI_BYTES_PER_COLOUR(4)
|
, SPI_BYTES_PER_COLOUR(4)
|
||||||
, SPI_FRAME_END_LATCH_BYTES(116)
|
, SPI_FRAME_END_LATCH_BYTES(116)
|
||||||
, bitpair_to_byte {
|
, bitpair_to_byte {
|
||||||
@ -45,10 +45,6 @@ Reset time is 300uS = 923 bits = 116 bytes
|
|||||||
0b11001100,
|
0b11001100,
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDevice* LedDeviceWs2812SPI::construct(const QJsonObject &deviceConfig)
|
LedDevice* LedDeviceWs2812SPI::construct(const QJsonObject &deviceConfig)
|
||||||
|
@ -14,9 +14,8 @@
|
|||||||
#include "ProviderSpi.h"
|
#include "ProviderSpi.h"
|
||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
|
|
||||||
|
ProviderSpi::ProviderSpi(const QJsonObject &deviceConfig)
|
||||||
ProviderSpi::ProviderSpi()
|
: LedDevice(deviceConfig)
|
||||||
: LedDevice()
|
|
||||||
, _deviceName("/dev/spidev0.0")
|
, _deviceName("/dev/spidev0.0")
|
||||||
, _baudRate_Hz(1000000)
|
, _baudRate_Hz(1000000)
|
||||||
, _fid(-1)
|
, _fid(-1)
|
||||||
|
@ -15,7 +15,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// Constructs specific LedDevice
|
/// Constructs specific LedDevice
|
||||||
///
|
///
|
||||||
ProviderSpi();
|
ProviderSpi(const QJsonObject &deviceConfig);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Sets configuration
|
/// Sets configuration
|
||||||
|
@ -16,16 +16,12 @@ const uint16_t DEFAULT_PORT = 4223;
|
|||||||
} //End of constants
|
} //End of constants
|
||||||
|
|
||||||
LedDeviceTinkerforge::LedDeviceTinkerforge(const QJsonObject &deviceConfig)
|
LedDeviceTinkerforge::LedDeviceTinkerforge(const QJsonObject &deviceConfig)
|
||||||
: LedDevice()
|
: LedDevice(deviceConfig)
|
||||||
,_port(DEFAULT_PORT)
|
,_port(DEFAULT_PORT)
|
||||||
,_ipConnection(nullptr)
|
,_ipConnection(nullptr)
|
||||||
,_ledStrip(nullptr)
|
,_ledStrip(nullptr)
|
||||||
,_colorChannelSize(0)
|
,_colorChannelSize(0)
|
||||||
{
|
{
|
||||||
_devConfig = deviceConfig;
|
|
||||||
_isDeviceReady = false;
|
|
||||||
|
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDeviceTinkerforge::~LedDeviceTinkerforge()
|
LedDeviceTinkerforge::~LedDeviceTinkerforge()
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#define STRINGIFY2(x) #x
|
#define STRINGIFY2(x) #x
|
||||||
#define STRINGIFY(x) STRINGIFY2(x)
|
#define STRINGIFY(x) STRINGIFY2(x)
|
||||||
|
|
||||||
|
|
||||||
PythonInit::PythonInit()
|
PythonInit::PythonInit()
|
||||||
{
|
{
|
||||||
// register modules
|
// register modules
|
||||||
|
@ -13,7 +13,7 @@ NetOrigin::NetOrigin(QObject* parent, Logger* log)
|
|||||||
NetOrigin::instance = this;
|
NetOrigin::instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& local)
|
bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& local) const
|
||||||
{
|
{
|
||||||
if(_internetAccessAllowed)
|
if(_internetAccessAllowed)
|
||||||
return true;
|
return true;
|
||||||
@ -29,7 +29,7 @@ bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& l
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetOrigin::isLocalAddress(const QHostAddress& address, const QHostAddress& local)
|
bool NetOrigin::isLocalAddress(const QHostAddress& address, const QHostAddress& local) const
|
||||||
{
|
{
|
||||||
if(address.protocol() == QAbstractSocket::IPv4Protocol)
|
if(address.protocol() == QAbstractSocket::IPv4Protocol)
|
||||||
{
|
{
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
namespace Process {
|
namespace Process {
|
||||||
|
|
||||||
void restartHyperion(bool asNewProcess){}
|
void restartHyperion(bool asNewProcess) {}
|
||||||
|
|
||||||
QByteArray command_exec(QString /*cmd*/, QByteArray /*data*/)
|
QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/)
|
||||||
{
|
{
|
||||||
return QSTRING_CSTR(QString());
|
return QSTRING_CSTR(QString());
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ void restartHyperion(bool asNewProcess)
|
|||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray command_exec(QString cmd, QByteArray data)
|
QByteArray command_exec(const QString& cmd, const QByteArray& data)
|
||||||
{
|
{
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
QString result;
|
QString result;
|
||||||
|
@ -31,9 +31,9 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
|
|||||||
{
|
{
|
||||||
// http://forum.garagecube.com/viewtopic.php?t=10178
|
// http://forum.garagecube.com/viewtopic.php?t=10178
|
||||||
// warm white
|
// warm white
|
||||||
float F1 = static_cast<float>(0.274);
|
const float F1(0.274);
|
||||||
float F2 = static_cast<float>(0.454);
|
const float F2(0.454);
|
||||||
float F3 = static_cast<float>(2.333);
|
const float F3(2.333);
|
||||||
|
|
||||||
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
|
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
|
||||||
output->red = input.red - output->white/F1;
|
output->red = input.red - output->white/F1;
|
||||||
@ -46,9 +46,9 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
|
|||||||
{
|
{
|
||||||
// http://forum.garagecube.com/viewtopic.php?t=10178
|
// http://forum.garagecube.com/viewtopic.php?t=10178
|
||||||
// cold white
|
// cold white
|
||||||
float F1 = static_cast<float>(0.299);
|
const float F1(0.299);
|
||||||
float F2 = static_cast<float>(0.587);
|
const float F2(0.587);
|
||||||
float F3 = static_cast<float>(0.114);
|
const float F3(0.114);
|
||||||
|
|
||||||
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
|
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
|
||||||
output->red = input.red - output->white/F1;
|
output->red = input.red - output->white/F1;
|
||||||
|
Loading…
Reference in New Issue
Block a user