mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
46 lines
947 B
C
46 lines
947 B
C
|
#pragma once
|
||
|
#include "QObject"
|
||
|
#include "utils/Logger.h"
|
||
|
|
||
|
///
|
||
|
/// The ProviderSpi implements an abstract base-class for LedDevices using the SPI-device.
|
||
|
///
|
||
|
class BaseProvider
|
||
|
{
|
||
|
public:
|
||
|
///
|
||
|
/// Constructs specific LedDevice
|
||
|
///
|
||
|
BaseProvider(const QJsonObject& deviceConfig);
|
||
|
///
|
||
|
/// Destructor of the LedDevice; closes the output device if it is open
|
||
|
///
|
||
|
~BaseProvider();
|
||
|
|
||
|
///
|
||
|
/// Opens and configures the output device
|
||
|
///
|
||
|
/// @return Zero on success else negative
|
||
|
///
|
||
|
virtual int open();
|
||
|
|
||
|
virtual QJsonArray discover(const QJsonObject& params);
|
||
|
|
||
|
virtual int close();
|
||
|
|
||
|
virtual int writeBytes(unsigned size, const uint8_t *data);
|
||
|
protected:
|
||
|
|
||
|
/// The common Logger instance for all LED-devices
|
||
|
Logger* _log;
|
||
|
|
||
|
/// Current device's type
|
||
|
QString _activeDeviceType;
|
||
|
|
||
|
/// The name of the output device
|
||
|
QString _deviceName;
|
||
|
|
||
|
/// The used baudrate of the output device
|
||
|
int _baudRate_Hz;
|
||
|
};
|