first Commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
//LightController.h
|
||||
#pragma once
|
||||
#include <QObject>
|
||||
#include <QtSerialPort/QSerialPort>
|
||||
#include <QString>
|
||||
|
||||
class LightController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Channel { CH1 = 0, CH2 = 1, ALL = 2 };
|
||||
Q_ENUM(Channel)
|
||||
|
||||
explicit LightController(QObject* parent = nullptr);
|
||||
~LightController();
|
||||
|
||||
public slots:
|
||||
bool open(const QString& portName);
|
||||
void close();
|
||||
|
||||
bool setBrightness(Channel ch, int value);
|
||||
bool setBrightnessValue(int channel, int value);
|
||||
bool setAlwaysOn();
|
||||
bool setAlwaysOff();
|
||||
bool softTrigger(Channel ch);
|
||||
|
||||
public:
|
||||
bool isOpen() const;
|
||||
|
||||
signals:
|
||||
void connected();
|
||||
void disconnected();
|
||||
void errorOccurred(const QString& msg);
|
||||
void commandSent(const QString& cmd, const QString& response);
|
||||
|
||||
private:
|
||||
bool sendCommand(const QString& cmd, QString& response);
|
||||
QString buildBrightnessCmd(Channel ch, int value);
|
||||
|
||||
QSerialPort* m_serial;
|
||||
};
|
||||
Reference in New Issue
Block a user