2020-07-12 20:27:56 +02:00
|
|
|
#ifndef LEDEVICETEMPLATE_H
|
|
|
|
#define LEDEVICETEMPLATE_H
|
2020-02-10 15:21:58 +01:00
|
|
|
|
|
|
|
// LedDevice includes
|
|
|
|
#include <leddevice/LedDevice.h>
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Implementation of a LedDevice ...
|
|
|
|
/// ...
|
|
|
|
///
|
|
|
|
class LedDeviceTemplate : public LedDevice
|
|
|
|
{
|
|
|
|
public:
|
2020-07-12 20:27:56 +02:00
|
|
|
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @brief Constructs a specific LED-device
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @param deviceConfig Device's configuration as JSON-Object
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
|
|
|
explicit LedDeviceTemplate(const QJsonObject &deviceConfig);
|
|
|
|
|
2020-07-12 20:27:56 +02:00
|
|
|
///
|
|
|
|
/// @brief Constructs the LED-device
|
|
|
|
///
|
|
|
|
/// @param[in] deviceConfig Device's configuration as JSON-Object
|
|
|
|
/// @return LedDevice constructed
|
|
|
|
///
|
2020-02-10 15:21:58 +01:00
|
|
|
static LedDevice* construct(const QJsonObject &deviceConfig);
|
|
|
|
|
2020-07-12 20:27:56 +02:00
|
|
|
protected:
|
|
|
|
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @brief Initialise the device's configuration
|
|
|
|
///
|
|
|
|
/// @param[in] deviceConfig the JSON device configuration
|
|
|
|
/// @return True, if success
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-08-08 23:12:43 +02:00
|
|
|
bool init(const QJsonObject &deviceConfig) override;
|
2020-02-10 15:21:58 +01:00
|
|
|
|
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @brief Opens the output device.
|
|
|
|
///
|
|
|
|
/// @return Zero on success (i.e. device is ready), else negative
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-08-08 23:12:43 +02:00
|
|
|
int open() override;
|
2020-07-12 09:19:59 +02:00
|
|
|
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @brief Closes the output device.
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @return Zero on success (i.e. device is closed), else negative
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
2020-08-08 23:12:43 +02:00
|
|
|
int close() override;
|
2020-02-10 15:21:58 +01:00
|
|
|
|
|
|
|
///
|
2020-07-12 20:27:56 +02:00
|
|
|
/// @brief Writes the RGB-Color values to the LEDs.
|
|
|
|
///
|
|
|
|
/// @param[in] ledValues The RGB-color per LED
|
|
|
|
/// @return Zero on success, else negative
|
|
|
|
///
|
2020-08-08 23:12:43 +02:00
|
|
|
int write(const std::vector<ColorRgb> & ledValues) override;
|
2020-02-10 15:21:58 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
};
|
2020-07-12 20:27:56 +02:00
|
|
|
|
|
|
|
#endif // LEDEVICETEMPLATE_H
|