mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
8a785e70c8
* SPI Fix - Free allocated memory in case of invert * Remove development statement * UI updates * Minor corrections * Tpm2net Fix - Free allocated memory * LGTM Finding * Add config directory and user type to SysInfo * WS281x - Ensure that device runs with root priviliges * WS281x - Update DMA defauls as per rpi_ws281x recommendation * Support Sysinfo for Qt < 5.10 * Address LGTM finding
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#ifndef LEDEVICETPM2NET_H
|
|
#define LEDEVICETPM2NET_H
|
|
|
|
// hyperion includes
|
|
#include "ProviderUdp.h"
|
|
|
|
///
|
|
/// Implementation of the LedDevice interface for sending LED colors via udp tpm2.net packets
|
|
///
|
|
class LedDeviceTpm2net : public ProviderUdp
|
|
{
|
|
public:
|
|
|
|
///
|
|
/// @brief Constructs a TPM2 LED-device fed via UDP
|
|
///
|
|
/// @param deviceConfig Device's configuration as JSON-Object
|
|
///
|
|
explicit LedDeviceTpm2net(const QJsonObject &deviceConfig);
|
|
|
|
///
|
|
/// @brief Destructor of the TPM2 LED-device
|
|
///
|
|
~LedDeviceTpm2net() override;
|
|
|
|
///
|
|
/// @brief Constructs the LED-device
|
|
///
|
|
/// @param[in] deviceConfig Device's configuration as JSON-Object
|
|
/// @return LedDevice constructed
|
|
///
|
|
static LedDevice* construct(const QJsonObject &deviceConfig);
|
|
|
|
private:
|
|
|
|
///
|
|
/// @brief Initialise the device's configuration
|
|
///
|
|
/// @param[in] deviceConfig the JSON device configuration
|
|
/// @return True, if success
|
|
///
|
|
bool init(const QJsonObject &deviceConfig) override;
|
|
|
|
///
|
|
/// @brief Writes the RGB-Color values to the LEDs.
|
|
///
|
|
/// @param[in] ledValues The RGB-color per LED
|
|
/// @return Zero on success, else negative
|
|
///
|
|
int write(const std::vector<ColorRgb> & ledValues) override;
|
|
|
|
int _tpm2_max;
|
|
int _tpm2ByteCount;
|
|
int _tpm2TotalPackets;
|
|
int _tpm2ThisPacket;
|
|
|
|
uint8_t * _tpm2_buffer;
|
|
};
|
|
|
|
#endif // LEDEVICETPM2NET_H
|