mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
General tidy up
This commit is contained in:
@@ -33,7 +33,7 @@ LedDevice::LedDevice(const QJsonObject& deviceConfig, QObject* parent)
|
||||
, _lastWriteTime(QDateTime::currentDateTime())
|
||||
, _isRefreshEnabled (false)
|
||||
{
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice::~LedDevice()
|
||||
|
@@ -13,14 +13,10 @@ QString _usbProductDescription = "Hyperion led controller";
|
||||
}
|
||||
|
||||
LedDeviceHyperionUsbasp::LedDeviceHyperionUsbasp(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
, _libusbContext(nullptr)
|
||||
, _deviceHandle(nullptr)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceHyperionUsbasp::~LedDeviceHyperionUsbasp()
|
||||
|
@@ -33,7 +33,7 @@ enum DATA_VERSION_INDEXES{
|
||||
};
|
||||
|
||||
LedDeviceLightpack::LedDeviceLightpack(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
, _libusbContext(nullptr)
|
||||
, _deviceHandle(nullptr)
|
||||
, _busNumber(-1)
|
||||
@@ -41,12 +41,8 @@ LedDeviceLightpack::LedDeviceLightpack(const QJsonObject &deviceConfig)
|
||||
, _firmwareVersion({-1,-1})
|
||||
, _bitsPerChannel(-1)
|
||||
, _hwLedCount(-1)
|
||||
,_isOpen(false)
|
||||
, _isOpen(false)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceLightpack::~LedDeviceLightpack()
|
||||
|
@@ -18,23 +18,16 @@ bool compareLightpacks(LedDeviceLightpack * lhs, LedDeviceLightpack * rhs)
|
||||
}
|
||||
|
||||
LedDeviceMultiLightpack::LedDeviceMultiLightpack(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
, _lightpacks()
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceMultiLightpack::~LedDeviceMultiLightpack()
|
||||
{
|
||||
for (LedDeviceLightpack * device : _lightpacks)
|
||||
{
|
||||
if ( device != nullptr)
|
||||
{
|
||||
delete device;
|
||||
}
|
||||
delete device;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,14 +2,9 @@
|
||||
|
||||
// Use out report HID device
|
||||
LedDevicePaintpack::LedDevicePaintpack(const QJsonObject &deviceConfig)
|
||||
: ProviderHID()
|
||||
: ProviderHID(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_useFeature = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDevicePaintpack::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -2,13 +2,8 @@
|
||||
|
||||
// Use feature report HID device
|
||||
LedDeviceRawHID::LedDeviceRawHID(const QJsonObject &deviceConfig)
|
||||
: ProviderHID()
|
||||
: ProviderHID(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
|
||||
_useFeature = true;
|
||||
}
|
||||
|
||||
|
@@ -9,8 +9,9 @@
|
||||
// Local Hyperion includes
|
||||
#include "ProviderHID.h"
|
||||
|
||||
ProviderHID::ProviderHID()
|
||||
: _VendorId(0)
|
||||
ProviderHID::ProviderHID(const QJsonObject &deviceConfig)
|
||||
: LedDevice(deviceConfig)
|
||||
, _VendorId(0)
|
||||
, _ProductId(0)
|
||||
, _useFeature(false)
|
||||
, _deviceHandle(nullptr)
|
||||
|
@@ -21,7 +21,7 @@ public:
|
||||
///
|
||||
/// @param deviceConfig Device's configuration as JSON-Object
|
||||
///
|
||||
ProviderHID();
|
||||
ProviderHID(const QJsonObject &deviceConfig);
|
||||
|
||||
///
|
||||
/// @brief Destructor of the LedDevice
|
||||
|
@@ -9,7 +9,7 @@ const quint16 MULTICAST_GROUPL_DEFAULT_PORT = 49692;
|
||||
const int LEDS_DEFAULT_NUMBER = 24;
|
||||
|
||||
LedDeviceAtmoOrb::LedDeviceAtmoOrb(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
, _udpSocket (nullptr)
|
||||
, _multiCastGroupPort (MULTICAST_GROUPL_DEFAULT_PORT)
|
||||
, _joinedMulticastgroup (false)
|
||||
@@ -19,10 +19,6 @@ LedDeviceAtmoOrb::LedDeviceAtmoOrb(const QJsonObject &deviceConfig)
|
||||
, _numLeds (LEDS_DEFAULT_NUMBER)
|
||||
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceAtmoOrb::construct(const QJsonObject &deviceConfig)
|
||||
@@ -32,10 +28,7 @@ LedDevice* LedDeviceAtmoOrb::construct(const QJsonObject &deviceConfig)
|
||||
|
||||
LedDeviceAtmoOrb::~LedDeviceAtmoOrb()
|
||||
{
|
||||
if ( _udpSocket != nullptr )
|
||||
{
|
||||
delete _udpSocket;
|
||||
}
|
||||
delete _udpSocket;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
QByteArray datagram = bytes;
|
||||
_udpSocket->writeDatagram(datagram.data(), datagram.size(), _groupAddress, _multiCastGroupPort);
|
||||
_udpSocket->writeDatagram(bytes.data(), bytes.size(), _groupAddress, _multiCastGroupPort);
|
||||
}
|
||||
|
@@ -127,7 +127,6 @@ private:
|
||||
QMap<int, int> lastColorRedMap;
|
||||
QMap<int, int> lastColorGreenMap;
|
||||
QMap<int, int> lastColorBlueMap;
|
||||
|
||||
};
|
||||
|
||||
#endif // LEDEVICEATMOORB_H
|
||||
|
@@ -20,23 +20,16 @@ const unsigned OPC_HEADER_SIZE = 4; // OPC header size
|
||||
const quint16 STREAM_DEFAULT_PORT = 7890;
|
||||
|
||||
LedDeviceFadeCandy::LedDeviceFadeCandy(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
, _client(nullptr)
|
||||
,_host()
|
||||
,_port(STREAM_DEFAULT_PORT)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceFadeCandy::~LedDeviceFadeCandy()
|
||||
{
|
||||
if ( _client != nullptr )
|
||||
{
|
||||
delete _client;
|
||||
}
|
||||
delete _client;
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceFadeCandy::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -35,7 +35,7 @@ public:
|
||||
/// "interpolation" : false,
|
||||
/// "manualLed" : false,
|
||||
/// "ledOn" : false
|
||||
/// },
|
||||
/// },
|
||||
///@endcode
|
||||
///
|
||||
/// @param deviceConfig Device's configuration as JSON-Object
|
||||
@@ -114,7 +114,7 @@ private:
|
||||
/// @return amount of transferred bytes. -1 error while transferring, -2 error while connecting
|
||||
///
|
||||
int transferData();
|
||||
|
||||
|
||||
///
|
||||
/// @brief Send system exclusive commands
|
||||
///
|
||||
|
@@ -90,7 +90,7 @@ enum EXTCONTROLVERSIONS {
|
||||
};
|
||||
|
||||
LedDeviceNanoleaf::LedDeviceNanoleaf(const QJsonObject &deviceConfig)
|
||||
: ProviderUdp()
|
||||
: ProviderUdp(deviceConfig)
|
||||
,_restApi(nullptr)
|
||||
,_apiPort(API_DEFAULT_PORT)
|
||||
,_topDown(true)
|
||||
@@ -100,10 +100,6 @@ LedDeviceNanoleaf::LedDeviceNanoleaf(const QJsonObject &deviceConfig)
|
||||
,_extControlVersion (EXTCTRLVER_V2),
|
||||
_panelLedCount(0)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceNanoleaf::construct(const QJsonObject &deviceConfig)
|
||||
@@ -113,11 +109,8 @@ LedDevice* LedDeviceNanoleaf::construct(const QJsonObject &deviceConfig)
|
||||
|
||||
LedDeviceNanoleaf::~LedDeviceNanoleaf()
|
||||
{
|
||||
if ( _restApi != nullptr )
|
||||
{
|
||||
delete _restApi;
|
||||
_restApi = nullptr;
|
||||
}
|
||||
delete _restApi;
|
||||
_restApi = nullptr;
|
||||
}
|
||||
|
||||
bool LedDeviceNanoleaf::init(const QJsonObject &deviceConfig)
|
||||
|
@@ -264,7 +264,7 @@ double CiColor::getDistanceBetweenTwoPoints(CiColor p1, XYColor p2)
|
||||
}
|
||||
|
||||
LedDevicePhilipsHueBridge::LedDevicePhilipsHueBridge(const QJsonObject &deviceConfig)
|
||||
: ProviderUdpSSL()
|
||||
: ProviderUdpSSL(deviceConfig)
|
||||
, _restApi(nullptr)
|
||||
, _apiPort(API_DEFAULT_PORT)
|
||||
, _useHueEntertainmentAPI(false)
|
||||
@@ -273,17 +273,12 @@ LedDevicePhilipsHueBridge::LedDevicePhilipsHueBridge(const QJsonObject &deviceCo
|
||||
, _api_patch(0)
|
||||
, _isHueEntertainmentReady(false)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
}
|
||||
|
||||
LedDevicePhilipsHueBridge::~LedDevicePhilipsHueBridge()
|
||||
{
|
||||
if ( _restApi != nullptr )
|
||||
{
|
||||
delete _restApi;
|
||||
_restApi = nullptr;
|
||||
}
|
||||
delete _restApi;
|
||||
_restApi = nullptr;
|
||||
}
|
||||
|
||||
bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig)
|
||||
@@ -828,10 +823,6 @@ LedDevicePhilipsHue::LedDevicePhilipsHue(const QJsonObject& deviceConfig)
|
||||
, start_retry_left(3)
|
||||
, stop_retry_left(3)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDevicePhilipsHue::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -3,12 +3,8 @@
|
||||
const ushort TPM2_DEFAULT_PORT = 65506;
|
||||
|
||||
LedDeviceTpm2net::LedDeviceTpm2net(const QJsonObject &deviceConfig)
|
||||
: ProviderUdp()
|
||||
: ProviderUdp(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceTpm2net::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -12,15 +12,10 @@
|
||||
const ushort ARTNET_DEFAULT_PORT = 6454;
|
||||
|
||||
LedDeviceUdpArtNet::LedDeviceUdpArtNet(const QJsonObject &deviceConfig)
|
||||
: ProviderUdp()
|
||||
: ProviderUdp(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
|
||||
LedDevice* LedDeviceUdpArtNet::construct(const QJsonObject &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
|
||||
|
||||
LedDeviceUdpE131::LedDeviceUdpE131(const QJsonObject &deviceConfig)
|
||||
: ProviderUdp()
|
||||
: ProviderUdp(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceUdpE131::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -9,12 +9,8 @@ const char H801_DEFAULT_HOST[] = "255.255.255.255";
|
||||
} //End of constants
|
||||
|
||||
LedDeviceUdpH801::LedDeviceUdpH801(const QJsonObject &deviceConfig)
|
||||
: ProviderUdp()
|
||||
: ProviderUdp(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceUdpH801::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -3,12 +3,8 @@
|
||||
const ushort RAW_DEFAULT_PORT=5568;
|
||||
|
||||
LedDeviceUdpRaw::LedDeviceUdpRaw(const QJsonObject &deviceConfig)
|
||||
: ProviderUdp()
|
||||
: ProviderUdp(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceUdpRaw::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -34,23 +34,16 @@ const char SSDP_FILTER_HEADER[] = "ST";
|
||||
} //End of constants
|
||||
|
||||
LedDeviceWled::LedDeviceWled(const QJsonObject &deviceConfig)
|
||||
: ProviderUdp()
|
||||
: ProviderUdp(deviceConfig)
|
||||
,_restApi(nullptr)
|
||||
,_apiPort(API_DEFAULT_PORT)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceWled::~LedDeviceWled()
|
||||
{
|
||||
if ( _restApi != nullptr )
|
||||
{
|
||||
delete _restApi;
|
||||
_restApi = nullptr;
|
||||
}
|
||||
delete _restApi;
|
||||
_restApi = nullptr;
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceWled::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -117,10 +117,7 @@ YeelightLight::YeelightLight( Logger *log, const QString &hostname, quint16 port
|
||||
YeelightLight::~YeelightLight()
|
||||
{
|
||||
log (3,"~YeelightLight()","" );
|
||||
if ( _tcpSocket != nullptr)
|
||||
{
|
||||
delete _tcpSocket;
|
||||
}
|
||||
delete _tcpSocket;
|
||||
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)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
,_lightsCount (0)
|
||||
,_outputColorModel(0)
|
||||
,_transitionEffect(YeelightLight::API_EFFECT_SMOOTH)
|
||||
@@ -982,10 +979,6 @@ LedDeviceYeelight::LedDeviceYeelight(const QJsonObject &deviceConfig)
|
||||
,_debuglevel(0)
|
||||
,_musicModeServerPort(-1)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceYeelight::~LedDeviceYeelight()
|
||||
|
@@ -16,10 +16,9 @@
|
||||
class httpResponse
|
||||
{
|
||||
public:
|
||||
httpResponse() = default;
|
||||
|
||||
explicit httpResponse() {}
|
||||
|
||||
bool error() { return _hasError;}
|
||||
bool error() const { return _hasError;}
|
||||
void setError(const bool hasError) { _hasError = hasError; }
|
||||
|
||||
QJsonDocument getBody() const { return _responseBody; }
|
||||
@@ -70,7 +69,7 @@ public:
|
||||
///
|
||||
/// @brief Constructor of the REST-API wrapper
|
||||
///
|
||||
explicit ProviderRestApi();
|
||||
ProviderRestApi();
|
||||
|
||||
///
|
||||
/// @brief Constructor of the REST-API wrapper
|
||||
|
@@ -16,22 +16,18 @@
|
||||
|
||||
const ushort MAX_PORT = 65535;
|
||||
|
||||
ProviderUdp::ProviderUdp()
|
||||
: LedDevice()
|
||||
ProviderUdp::ProviderUdp(const QJsonObject &deviceConfig)
|
||||
: LedDevice(deviceConfig)
|
||||
, _udpSocket (nullptr)
|
||||
, _port(1)
|
||||
, _defaultHost("127.0.0.1")
|
||||
{
|
||||
_isDeviceReady = false;
|
||||
_latchTime_ms = 1;
|
||||
}
|
||||
|
||||
ProviderUdp::~ProviderUdp()
|
||||
{
|
||||
if ( _udpSocket != nullptr )
|
||||
{
|
||||
delete _udpSocket;
|
||||
}
|
||||
delete _udpSocket;
|
||||
}
|
||||
|
||||
bool ProviderUdp::init(const QJsonObject &deviceConfig)
|
||||
|
@@ -21,7 +21,7 @@ public:
|
||||
///
|
||||
/// @brief Constructs an UDP LED-device
|
||||
///
|
||||
ProviderUdp();
|
||||
ProviderUdp(const QJsonObject &deviceConfig);
|
||||
|
||||
///
|
||||
/// @brief Destructor of the UDP LED-device
|
||||
|
@@ -15,8 +15,8 @@
|
||||
const int MAX_RETRY = 5;
|
||||
const ushort MAX_PORT_SSL = 65535;
|
||||
|
||||
ProviderUdpSSL::ProviderUdpSSL()
|
||||
: LedDevice()
|
||||
ProviderUdpSSL::ProviderUdpSSL(const QJsonObject &deviceConfig)
|
||||
: LedDevice(deviceConfig)
|
||||
, client_fd()
|
||||
, entropy()
|
||||
, ssl()
|
||||
@@ -41,7 +41,6 @@ ProviderUdpSSL::ProviderUdpSSL()
|
||||
, _debugStreamer(false)
|
||||
, _debugLevel(0)
|
||||
{
|
||||
_isDeviceReady = false;
|
||||
_latchTime_ms = 1;
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
///
|
||||
/// @brief Constructs an UDP SSL LED-device
|
||||
///
|
||||
ProviderUdpSSL();
|
||||
ProviderUdpSSL(const QJsonObject &deviceConfig);
|
||||
|
||||
///
|
||||
/// @brief Destructor of the LED-device
|
||||
|
@@ -5,19 +5,15 @@
|
||||
#include <QTextStream>
|
||||
|
||||
LedDeviceFile::LedDeviceFile(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
, _file (nullptr)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
_printTimeStamp = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceFile::~LedDeviceFile()
|
||||
{
|
||||
delete _file;
|
||||
delete _file;
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceFile::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -10,13 +10,9 @@
|
||||
#include "LedDevicePiBlaster.h"
|
||||
|
||||
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
|
||||
// -1 is invalid
|
||||
// z is also meaningless
|
||||
|
@@ -1,12 +1,8 @@
|
||||
#include "LedDeviceWS281x.h"
|
||||
|
||||
LedDeviceWS281x::LedDeviceWS281x(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceWS281x::~LedDeviceWS281x()
|
||||
|
@@ -3,14 +3,10 @@
|
||||
#include <cassert>
|
||||
|
||||
LedDeviceAdalight::LedDeviceAdalight(const QJsonObject &deviceConfig)
|
||||
: ProviderRs232()
|
||||
: ProviderRs232(deviceConfig)
|
||||
, _headerSize(6)
|
||||
, _ligthBerryAPA102Mode(false)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceAdalight::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -2,15 +2,10 @@
|
||||
#include "LedDeviceAtmo.h"
|
||||
|
||||
LedDeviceAtmo::LedDeviceAtmo(const QJsonObject &deviceConfig)
|
||||
: ProviderRs232()
|
||||
: ProviderRs232(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
|
||||
LedDevice* LedDeviceAtmo::construct(const QJsonObject &deviceConfig)
|
||||
{
|
||||
return new LedDeviceAtmo(deviceConfig);
|
||||
|
@@ -6,20 +6,15 @@
|
||||
#endif
|
||||
|
||||
LedDeviceDMX::LedDeviceDMX(const QJsonObject &deviceConfig)
|
||||
: ProviderRs232()
|
||||
: ProviderRs232(deviceConfig)
|
||||
, _dmxDeviceType(0)
|
||||
, _dmxStart(1)
|
||||
, _dmxSlotsPerLed(3)
|
||||
, _dmxLedCount(0)
|
||||
, _dmxChannelCount(0)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
|
||||
LedDevice* LedDeviceDMX::construct(const QJsonObject &deviceConfig)
|
||||
{
|
||||
return new LedDeviceDMX(deviceConfig);
|
||||
|
@@ -2,12 +2,8 @@
|
||||
#include "LedDeviceKarate.h"
|
||||
|
||||
LedDeviceKarate::LedDeviceKarate(const QJsonObject &deviceConfig)
|
||||
: ProviderRs232()
|
||||
: ProviderRs232(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceKarate::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -7,12 +7,8 @@ struct FrameSpec
|
||||
};
|
||||
|
||||
LedDeviceSedu::LedDeviceSedu(const QJsonObject &deviceConfig)
|
||||
: ProviderRs232()
|
||||
: ProviderRs232(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceSedu::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -2,15 +2,10 @@
|
||||
|
||||
|
||||
LedDeviceTpm2::LedDeviceTpm2(const QJsonObject &deviceConfig)
|
||||
: ProviderRs232()
|
||||
: ProviderRs232(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
|
||||
LedDevice* LedDeviceTpm2::construct(const QJsonObject &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 NUM_POWEROFF_WRITE_BLACK = 2; // Number of write "BLACK" during powering off
|
||||
|
||||
ProviderRs232::ProviderRs232()
|
||||
: _rs232Port(this)
|
||||
ProviderRs232::ProviderRs232(const QJsonObject &deviceConfig)
|
||||
: LedDevice(deviceConfig)
|
||||
, _rs232Port(this)
|
||||
,_baudRate_Hz(1000000)
|
||||
,_isAutoDeviceName(false)
|
||||
,_delayAfterConnect_ms(0)
|
||||
|
@@ -19,7 +19,7 @@ public:
|
||||
///
|
||||
/// @brief Constructs a RS232 LED-device
|
||||
///
|
||||
ProviderRs232();
|
||||
ProviderRs232(const QJsonObject &deviceConfig);
|
||||
|
||||
///
|
||||
/// @brief Destructor of the UDP LED-device
|
||||
|
@@ -1,12 +1,8 @@
|
||||
#include "LedDeviceAPA102.h"
|
||||
|
||||
LedDeviceAPA102::LedDeviceAPA102(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
: ProviderSpi(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceAPA102::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -35,7 +35,7 @@ Reset time is 24uS = 59 bits = 8 bytes
|
||||
*/
|
||||
|
||||
LedDeviceAPA104::LedDeviceAPA104(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
: ProviderSpi(deviceConfig)
|
||||
, SPI_BYTES_PER_COLOUR(4)
|
||||
, SPI_FRAME_END_LATCH_BYTES(8)
|
||||
, bitpair_to_byte {
|
||||
@@ -45,10 +45,6 @@ LedDeviceAPA104::LedDeviceAPA104(const QJsonObject &deviceConfig)
|
||||
0b11101110,
|
||||
}
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,12 +1,8 @@
|
||||
#include "LedDeviceLpd6803.h"
|
||||
|
||||
LedDeviceLpd6803::LedDeviceLpd6803(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
: ProviderSpi(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceLpd6803::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -1,12 +1,8 @@
|
||||
#include "LedDeviceLpd8806.h"
|
||||
|
||||
LedDeviceLpd8806::LedDeviceLpd8806(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
: ProviderSpi(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceLpd8806::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -1,12 +1,8 @@
|
||||
#include "LedDeviceP9813.h"
|
||||
|
||||
LedDeviceP9813::LedDeviceP9813(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
: ProviderSpi(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceP9813::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "LedDeviceSk6812SPI.h"
|
||||
|
||||
LedDeviceSk6812SPI::LedDeviceSk6812SPI(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
LedDeviceSk6812SPI::LedDeviceSk6812SPI(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi(deviceConfig)
|
||||
, _whiteAlgorithm(RGBW::WhiteAlgorithm::INVALID)
|
||||
, SPI_BYTES_PER_COLOUR(4)
|
||||
, bitpair_to_byte {
|
||||
@@ -11,10 +11,6 @@
|
||||
0b11001100,
|
||||
}
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceSk6812SPI::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -37,7 +37,7 @@ Reset time is 50uS = 100 bits = 13 bytes
|
||||
*/
|
||||
|
||||
LedDeviceSk6822SPI::LedDeviceSk6822SPI(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
: ProviderSpi(deviceConfig)
|
||||
, SPI_BYTES_PER_COLOUR(4)
|
||||
, SPI_BYTES_WAIT_TIME(3)
|
||||
, SPI_FRAME_END_LATCH_BYTES(13)
|
||||
@@ -48,13 +48,8 @@ LedDeviceSk6822SPI::LedDeviceSk6822SPI(const QJsonObject &deviceConfig)
|
||||
0b11101110,
|
||||
}
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
|
||||
LedDevice* LedDeviceSk6822SPI::construct(const QJsonObject &deviceConfig)
|
||||
{
|
||||
return new LedDeviceSk6822SPI(deviceConfig);
|
||||
|
@@ -1,12 +1,8 @@
|
||||
#include "LedDeviceWs2801.h"
|
||||
|
||||
LedDeviceWs2801::LedDeviceWs2801(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
: ProviderSpi(deviceConfig)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceWs2801::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -34,8 +34,8 @@ Reset time is 300uS = 923 bits = 116 bytes
|
||||
|
||||
*/
|
||||
|
||||
LedDeviceWs2812SPI::LedDeviceWs2812SPI(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi()
|
||||
LedDeviceWs2812SPI::LedDeviceWs2812SPI(const QJsonObject &deviceConfig)
|
||||
: ProviderSpi(deviceConfig)
|
||||
, SPI_BYTES_PER_COLOUR(4)
|
||||
, SPI_FRAME_END_LATCH_BYTES(116)
|
||||
, bitpair_to_byte {
|
||||
@@ -45,10 +45,6 @@ Reset time is 300uS = 923 bits = 116 bytes
|
||||
0b11001100,
|
||||
}
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceWs2812SPI::construct(const QJsonObject &deviceConfig)
|
||||
|
@@ -14,9 +14,8 @@
|
||||
#include "ProviderSpi.h"
|
||||
#include <utils/Logger.h>
|
||||
|
||||
|
||||
ProviderSpi::ProviderSpi()
|
||||
: LedDevice()
|
||||
ProviderSpi::ProviderSpi(const QJsonObject &deviceConfig)
|
||||
: LedDevice(deviceConfig)
|
||||
, _deviceName("/dev/spidev0.0")
|
||||
, _baudRate_Hz(1000000)
|
||||
, _fid(-1)
|
||||
|
@@ -15,7 +15,7 @@ public:
|
||||
///
|
||||
/// Constructs specific LedDevice
|
||||
///
|
||||
ProviderSpi();
|
||||
ProviderSpi(const QJsonObject &deviceConfig);
|
||||
|
||||
///
|
||||
/// Sets configuration
|
||||
|
@@ -16,16 +16,12 @@ const uint16_t DEFAULT_PORT = 4223;
|
||||
} //End of constants
|
||||
|
||||
LedDeviceTinkerforge::LedDeviceTinkerforge(const QJsonObject &deviceConfig)
|
||||
: LedDevice()
|
||||
: LedDevice(deviceConfig)
|
||||
,_port(DEFAULT_PORT)
|
||||
,_ipConnection(nullptr)
|
||||
,_ledStrip(nullptr)
|
||||
,_colorChannelSize(0)
|
||||
{
|
||||
_devConfig = deviceConfig;
|
||||
_isDeviceReady = false;
|
||||
|
||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||
}
|
||||
|
||||
LedDeviceTinkerforge::~LedDeviceTinkerforge()
|
||||
|
Reference in New Issue
Block a user