Add support for DT4, DT5, and DT6 devices

- Updated CMakeLists.txt to include new source files for DT4, DT5, and DT6.
- Modified dali.hpp to include headers for DT4, DT5, and DT6.
- Added command definitions for DT4, DT5, and DT6 in dali_define.hpp.
- Enhanced DaliDeviceCapabilities to support DT4, DT5, and DT6 detection.
- Implemented DT4 and DT5 classes with methods for device control and status querying.
- Created DT6 class with methods for device control and status querying.
- Updated decode.cpp to include new device types in the deviceTypeName mapping.
- Enhanced device.cpp to handle new device capabilities.
This commit is contained in:
Tony
2026-04-24 13:36:08 +08:00
parent 21afc6b942
commit bbcfcd11f6
12 changed files with 798 additions and 1 deletions
+130
View File
@@ -0,0 +1,130 @@
#pragma once
#include "base.hpp"
#include <optional>
class DaliDT6GearType {
public:
explicit DaliDT6GearType(int raw) : raw_(raw & 0xFF) {}
int raw() const { return raw_; }
bool ledPowerSupplyIntegrated() const { return bit(0x01); }
bool ledModuleIntegrated() const { return bit(0x02); }
bool acSupplyPossible() const { return bit(0x04); }
bool dcSupplyPossible() const { return bit(0x08); }
private:
int raw_ = 0;
bool bit(int mask) const { return (raw_ & mask) != 0; }
};
class DaliDT6OperatingModes {
public:
explicit DaliDT6OperatingModes(int raw) : raw_(raw & 0xFF) {}
int raw() const { return raw_; }
bool pwmModePossible() const { return bit(0x01); }
bool amModePossible() const { return bit(0x02); }
bool currentControlledOutput() const { return bit(0x04); }
bool highCurrentPulseMode() const { return bit(0x08); }
private:
int raw_ = 0;
bool bit(int mask) const { return (raw_ & mask) != 0; }
};
class DaliDT6Features {
public:
explicit DaliDT6Features(int raw) : raw_(raw & 0xFF) {}
int raw() const { return raw_; }
bool canQueryShortCircuit() const { return bit(0x01); }
bool canQueryOpenCircuit() const { return bit(0x02); }
bool canQueryLoadDecrease() const { return bit(0x04); }
bool canQueryLoadIncrease() const { return bit(0x08); }
bool canQueryCurrentProtector() const { return bit(0x10); }
bool canQueryThermalShutdown() const { return bit(0x20); }
bool canQueryThermalOverloadReduction() const { return bit(0x40); }
bool physicalSelectionSupported() const { return bit(0x80); }
private:
int raw_ = 0;
bool bit(int mask) const { return (raw_ & mask) != 0; }
};
class DaliDT6FailureStatus {
public:
explicit DaliDT6FailureStatus(int raw) : raw_(raw & 0xFF) {}
int raw() const { return raw_; }
bool shortCircuit() const { return bit(0x01); }
bool openCircuit() const { return bit(0x02); }
bool loadDecrease() const { return bit(0x04); }
bool loadIncrease() const { return bit(0x08); }
bool currentProtectorActive() const { return bit(0x10); }
bool thermalShutdown() const { return bit(0x20); }
bool thermalOverloadReduction() const { return bit(0x40); }
bool referenceMeasurementFailed() const { return bit(0x80); }
private:
int raw_ = 0;
bool bit(int mask) const { return (raw_ & mask) != 0; }
};
class DaliDT6OperatingMode {
public:
explicit DaliDT6OperatingMode(int raw) : raw_(raw & 0xFF) {}
int raw() const { return raw_; }
bool pwmModeActive() const { return bit(0x01); }
bool amModeActive() const { return bit(0x02); }
bool currentControlledOutput() const { return bit(0x04); }
bool highCurrentPulseModeActive() const { return bit(0x08); }
bool nonLogarithmicDimmingCurveActive() const { return bit(0x10); }
private:
int raw_ = 0;
bool bit(int mask) const { return (raw_ & mask) != 0; }
};
class DaliDT6 {
public:
explicit DaliDT6(DaliBase& base);
bool enableDT6();
bool referenceSystemPower(int a);
bool enableCurrentProtector(int a);
bool disableCurrentProtector(int a);
bool selectDimmingCurve(int a, int curve);
bool storeFastFadeTime(int a, int value);
std::optional<DaliDT6GearType> getGearType(int a);
std::optional<int> getDimmingCurve(int a);
std::optional<DaliDT6OperatingModes> getPossibleOperatingModes(int a);
std::optional<DaliDT6Features> getFeatures(int a);
std::optional<DaliDT6FailureStatus> getFailureStatus(int a);
std::optional<bool> hasShortCircuit(int a);
std::optional<bool> hasOpenCircuit(int a);
std::optional<bool> hasLoadDecrease(int a);
std::optional<bool> hasLoadIncrease(int a);
std::optional<bool> isCurrentProtectorActive(int a);
std::optional<bool> hasThermalShutDown(int a);
std::optional<bool> hasThermalOverload(int a);
std::optional<bool> isReferenceRunning(int a);
std::optional<bool> isReferenceMeasurementFailed(int a);
std::optional<bool> isCurrentProtectorEnabled(int a);
std::optional<DaliDT6OperatingMode> getOperatingMode(int a);
std::optional<int> getFastFadeTime(int a);
std::optional<int> getMinFastFadeTime(int a);
std::optional<int> getExtendedVersion(int a);
private:
DaliBase& base_;
bool enable();
static int addrOf(int a);
bool send(int a, int code, bool twice = false);
std::optional<int> query(int a, int code);
std::optional<bool> queryYesNo(int a, int code);
};