Refactor DALI command handling: streamline send methods and enhance scene color reporting

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Tony
2026-04-28 17:32:32 +08:00
parent 32e7329b3e
commit 9e1244712d
10 changed files with 84 additions and 38 deletions
+26
View File
@@ -25,6 +25,20 @@ class ColorStatus {
int status_ = 0;
};
class ColorType {
public:
explicit ColorType(int type) : type_(type) {}
int raw() const { return type_; }
bool xy() const { return (type_ & 0x10) != 0; }
bool ct() const { return (type_ & 0x20) != 0; }
bool primaryN() const { return (type_ & 0x40) != 0; }
bool rgbWaf() const { return (type_ & 0x80) != 0; }
private:
int type_ = 0;
};
class ColorTypeFeature {
public:
explicit ColorTypeFeature(int features) : features_(features) {}
@@ -41,6 +55,17 @@ class ColorTypeFeature {
int features_ = 0;
};
struct SceneColorReport {
int brightness = 0;
int colorTypeValue = 0;
std::vector<double> xy;
std::optional<int> colorTemperature;
ColorType colorType() const { return ColorType(colorTypeValue); }
bool hasXy() const { return xy.size() == 2; }
bool hasColorTemperature() const { return colorTemperature.has_value(); }
};
class DaliDT8 {
public:
explicit DaliDT8(DaliBase& base);
@@ -135,6 +160,7 @@ class DaliDT8 {
std::optional<int> getPrimaryYRaw(int a, int n);
std::optional<int> getPrimaryTy(int a, int n);
std::optional<SceneColorReport> getSceneColorReport(int a, int sense);
std::vector<double> getSceneColor(int a, int sense);
// Store / config