2013-11-17 15:51:42 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// stl includes
|
|
|
|
#include <vector>
|
|
|
|
#include <cstdint>
|
2017-03-04 22:17:42 +01:00
|
|
|
#include <QStringList>
|
|
|
|
#include <QString>
|
2013-11-17 15:51:42 +01:00
|
|
|
|
|
|
|
// libusb include
|
|
|
|
#include <libusb.h>
|
|
|
|
|
|
|
|
// Hyperion includes
|
2013-12-17 19:50:15 +01:00
|
|
|
#include <leddevice/LedDevice.h>
|
2013-11-17 15:51:42 +01:00
|
|
|
#include "LedDeviceLightpack.h"
|
|
|
|
|
|
|
|
///
|
|
|
|
/// LedDevice implementation for multiple lightpack devices
|
|
|
|
///
|
|
|
|
class LedDeviceMultiLightpack : public LedDevice
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
2016-08-23 20:07:12 +02:00
|
|
|
/// Constructs specific LedDevice
|
2013-11-17 15:51:42 +01:00
|
|
|
///
|
2020-02-10 15:21:58 +01:00
|
|
|
explicit LedDeviceMultiLightpack(const QJsonObject &);
|
2013-11-17 15:51:42 +01:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Destructor of the LedDevice; closes the output device if it is open
|
|
|
|
///
|
2020-02-10 15:21:58 +01:00
|
|
|
virtual ~LedDeviceMultiLightpack() override;
|
2013-11-17 15:51:42 +01:00
|
|
|
|
2016-08-23 20:07:12 +02:00
|
|
|
/// constructs leddevice
|
2016-10-13 21:59:58 +02:00
|
|
|
static LedDevice* construct(const QJsonObject &deviceConfig);
|
2016-08-23 20:07:12 +02:00
|
|
|
|
2020-02-10 15:21:58 +01:00
|
|
|
///
|
|
|
|
virtual int switchOff() override;
|
|
|
|
|
|
|
|
protected:
|
2013-11-17 15:51:42 +01:00
|
|
|
///
|
|
|
|
/// Opens and configures the output device7
|
|
|
|
///
|
|
|
|
/// @return Zero on succes else negative
|
|
|
|
///
|
2020-02-10 15:21:58 +01:00
|
|
|
int open() override;
|
2013-11-17 15:51:42 +01:00
|
|
|
///
|
2016-09-23 08:49:22 +02:00
|
|
|
/// Switch the leds off
|
2013-11-17 15:51:42 +01:00
|
|
|
///
|
|
|
|
/// @return Zero on success else negative
|
|
|
|
|
2016-09-23 08:49:22 +02:00
|
|
|
private:
|
2013-11-17 15:51:42 +01:00
|
|
|
///
|
2016-09-23 08:49:22 +02:00
|
|
|
/// Writes the RGB-Color values to the leds.
|
|
|
|
///
|
|
|
|
/// @param[in] ledValues The RGB-color per led
|
2013-11-17 15:51:42 +01:00
|
|
|
///
|
|
|
|
/// @return Zero on success else negative
|
|
|
|
///
|
2020-02-10 15:21:58 +01:00
|
|
|
virtual int write(const std::vector<ColorRgb>& ledValues) override;
|
2013-11-17 15:51:42 +01:00
|
|
|
|
2017-03-04 22:17:42 +01:00
|
|
|
static QStringList getLightpackSerials();
|
|
|
|
static QString getString(libusb_device * device, int stringDescriptorIndex);
|
2013-11-20 20:54:04 +01:00
|
|
|
|
2013-11-17 15:51:42 +01:00
|
|
|
/// buffer for led data
|
|
|
|
std::vector<LedDeviceLightpack *> _lightpacks;
|
|
|
|
};
|