2013-11-17 15:51:42 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// stl includes
|
|
|
|
#include <vector>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
2013-11-20 20:54:04 +01:00
|
|
|
#include <list>
|
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
|
|
|
///
|
2016-08-23 20:07:12 +02:00
|
|
|
/// @param deviceConfig json device config
|
|
|
|
///
|
|
|
|
LedDeviceMultiLightpack(const Json::Value &);
|
2013-11-17 15:51:42 +01:00
|
|
|
|
|
|
|
///
|
|
|
|
/// Destructor of the LedDevice; closes the output device if it is open
|
|
|
|
///
|
|
|
|
virtual ~LedDeviceMultiLightpack();
|
|
|
|
|
2016-08-23 20:07:12 +02:00
|
|
|
/// constructs leddevice
|
|
|
|
static LedDevice* construct(const Json::Value &deviceConfig);
|
|
|
|
|
2013-11-17 15:51:42 +01:00
|
|
|
///
|
|
|
|
/// Opens and configures the output device7
|
|
|
|
///
|
|
|
|
/// @return Zero on succes else negative
|
|
|
|
///
|
|
|
|
int open();
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Writes the RGB-Color values to the leds.
|
|
|
|
///
|
|
|
|
/// @param[in] ledValues The RGB-color per led
|
|
|
|
///
|
|
|
|
/// @return Zero on success else negative
|
|
|
|
///
|
|
|
|
virtual int write(const std::vector<ColorRgb>& ledValues);
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Switch the leds off
|
|
|
|
///
|
|
|
|
/// @return Zero on success else negative
|
|
|
|
///
|
|
|
|
virtual int switchOff();
|
|
|
|
|
2013-11-20 20:54:04 +01:00
|
|
|
private:
|
|
|
|
static std::list<std::string> getLightpackSerials();
|
|
|
|
static std::string getString(libusb_device * device, int stringDescriptorIndex);
|
|
|
|
|
2013-11-17 15:51:42 +01:00
|
|
|
private:
|
|
|
|
/// buffer for led data
|
|
|
|
std::vector<LedDeviceLightpack *> _lightpacks;
|
|
|
|
};
|