64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
#ifndef LEDEVICEUDPRAW_H
|
|
#define LEDEVICEUDPRAW_H
|
|
|
|
// hyperion includes
|
|
#include "ProviderUdp.h"
|
|
|
|
///
|
|
/// Implementation of the LedDevice interface for sending LED colors via UDP
|
|
///
|
|
class LedDeviceUdpRaw : public virtual ProviderUdp
|
|
{
|
|
public:
|
|
|
|
///
|
|
/// @brief Constructs a LED-device fed via UDP
|
|
///
|
|
/// @param deviceConfig Device's configuration as JSON-Object
|
|
///
|
|
explicit LedDeviceUdpRaw(const QJsonObject &deviceConfig);
|
|
|
|
///
|
|
/// @brief Constructs the LED-device
|
|
///
|
|
/// @param[in] deviceConfig Device's configuration as JSON-Object
|
|
/// @return LedDevice constructed
|
|
///
|
|
static LedDevice* construct(const QJsonObject &deviceConfig);
|
|
|
|
///
|
|
/// @brief Get a UDP-Raw device's resource properties
|
|
///
|
|
/// @param[in] params Parameters to query device
|
|
/// @return A JSON structure holding the device's properties
|
|
///
|
|
QJsonObject getProperties(const QJsonObject& params) override;
|
|
|
|
protected:
|
|
|
|
///
|
|
/// @brief Initialise the device's configuration
|
|
///
|
|
/// @param[in] deviceConfig the JSON device configuration
|
|
/// @return True, if success
|
|
///
|
|
bool init(const QJsonObject &deviceConfig) override;
|
|
|
|
///
|
|
/// @brief Opens the output device.
|
|
///
|
|
/// @return Zero on success (i.e. device is ready), else negative
|
|
///
|
|
int open() 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;
|
|
};
|
|
|
|
#endif // LEDEVICEUDPRAW_H
|