mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
* Handle Exceptions in main & Pythoninit * Have SSDPDiscover generic again * Have SSDPDiscover generic again * Change Info- to Debug logs as technical service messages * Nanoleaf - When switched on, ensure UDP mode * Include SQL Database in Cross-Compile instructions * Fix Clazy (QT code checker) and clang Warnings * Stop LedDevice:write for disabled device * Nanoleaf: Fix uint printfs * NanoLeaf: Fix indents to tabs * NanoLeaf - Add debug verbosity switches * Device switchability support, FileDevice with timestamp support * Nanoleaf Light Panels now support External Control V2 * Enhance LedDeviceFile by Timestamp + fix readyness * Stop color stream, if LedDevice disabled * Nanoleaf - remove switchability
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
#pragma once
|
|
|
|
// STL includes
|
|
#include <fstream>
|
|
|
|
// Leddevice includes
|
|
#include <leddevice/LedDevice.h>
|
|
|
|
///
|
|
/// Implementation of the LedDevice that write the led-colors to an
|
|
/// ASCII-textfile('/home/pi/LedDevice.out')
|
|
///
|
|
class LedDeviceFile : public LedDevice
|
|
{
|
|
public:
|
|
///
|
|
/// Constructs specific LedDevice
|
|
///
|
|
/// @param deviceConfig json device config
|
|
///
|
|
LedDeviceFile(const QJsonObject &deviceConfig);
|
|
|
|
///
|
|
/// Destructor of this test-device
|
|
///
|
|
virtual ~LedDeviceFile();
|
|
|
|
/// constructs leddevice
|
|
static LedDevice* construct(const QJsonObject &deviceConfig);
|
|
|
|
///
|
|
/// Sets configuration
|
|
///
|
|
/// @param deviceConfig the json device config
|
|
/// @return true if success
|
|
virtual bool init(const QJsonObject &deviceConfig);
|
|
|
|
protected:
|
|
///
|
|
/// Opens and configures the output file
|
|
///
|
|
/// @return Zero on succes else negative
|
|
///
|
|
///
|
|
virtual int open();
|
|
///
|
|
/// Writes the given led-color values to the output stream
|
|
///
|
|
/// @param ledValues The color-value per led
|
|
///
|
|
/// @return Zero on success else negative
|
|
///
|
|
virtual int write(const std::vector<ColorRgb> & ledValues);
|
|
|
|
/// The outputstream
|
|
std::ofstream _ofs;
|
|
|
|
private:
|
|
|
|
QString _fileName;
|
|
/// Timestamp for the output record
|
|
bool _printTimeStamp;
|
|
};
|