2016-08-23 20:07:12 +02:00
|
|
|
#pragma once
|
|
|
|
|
2016-09-04 09:07:10 +02:00
|
|
|
// hyperion includes
|
|
|
|
#include "ProviderUdp.h"
|
|
|
|
|
2020-02-10 15:21:58 +01:00
|
|
|
const ushort TPM2_DEFAULT_PORT = 65506;
|
2016-09-04 09:07:10 +02:00
|
|
|
|
|
|
|
///
|
2016-10-08 13:52:22 +02:00
|
|
|
/// Implementation of the LedDevice interface for sending led colors via udp tpm2.net packets
|
2016-08-23 20:07:12 +02:00
|
|
|
///
|
2016-09-04 09:07:10 +02:00
|
|
|
class LedDeviceTpm2net : public ProviderUdp
|
2016-08-23 20:07:12 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
/// Constructs specific LedDevice
|
|
|
|
///
|
|
|
|
/// @param deviceConfig json device config
|
|
|
|
///
|
2020-02-10 15:21:58 +01:00
|
|
|
explicit LedDeviceTpm2net(const QJsonObject &deviceConfig);
|
|
|
|
|
|
|
|
/// constructs leddevice
|
|
|
|
static LedDevice* construct(const QJsonObject &deviceConfig);
|
2016-08-23 20:07:12 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Sets configuration
|
|
|
|
///
|
|
|
|
/// @param deviceConfig the json device config
|
|
|
|
/// @return true if success
|
2020-02-10 15:21:58 +01:00
|
|
|
virtual bool init(const QJsonObject &deviceConfig) override;
|
2016-08-23 20:07:12 +02:00
|
|
|
|
2016-09-23 08:49:22 +02:00
|
|
|
private:
|
2016-08-23 20:07:12 +02:00
|
|
|
///
|
2016-09-04 09:07:10 +02:00
|
|
|
/// Writes the led color values to the led-device
|
2016-08-23 20:07:12 +02:00
|
|
|
///
|
|
|
|
/// @param ledValues The color-value per led
|
2016-09-04 09:07:10 +02:00
|
|
|
/// @return Zero on succes else negative
|
2016-08-23 20:07:12 +02:00
|
|
|
///
|
2020-02-10 15:21:58 +01:00
|
|
|
virtual int write(const std::vector<ColorRgb> &ledValues) override;
|
2016-08-23 20:07:12 +02:00
|
|
|
|
2016-09-04 09:07:10 +02:00
|
|
|
int _tpm2_max;
|
2016-09-22 09:19:31 +02:00
|
|
|
int _tpm2ByteCount;
|
|
|
|
int _tpm2TotalPackets;
|
|
|
|
int _tpm2ThisPacket;
|
2016-08-23 20:07:12 +02:00
|
|
|
};
|