first Commit

This commit is contained in:
lidg
2026-10-26 10:56:56 +08:00
commit c8cd533d9b
81 changed files with 128540 additions and 0 deletions
+42
View File
@@ -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;
};