Enhance DaliBase and BridgeModel: add readMemoryLocation method and support for readMemoryIdentity operation
Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
@@ -72,6 +72,7 @@ class DaliBase {
|
|||||||
std::optional<int> getDTR(int a);
|
std::optional<int> getDTR(int a);
|
||||||
std::optional<int> getDTR1(int a);
|
std::optional<int> getDTR1(int a);
|
||||||
std::optional<int> getDTR2(int a);
|
std::optional<int> getDTR2(int a);
|
||||||
|
std::optional<int> readMemoryLocation(int a, int bank, int location);
|
||||||
bool copyCurrentBrightToDTR(int a);
|
bool copyCurrentBrightToDTR(int a);
|
||||||
|
|
||||||
// Colour value helpers (DT8 plumbing)
|
// Colour value helpers (DT8 plumbing)
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ enum class BridgeOperation {
|
|||||||
setColourRGBCW = 81,
|
setColourRGBCW = 81,
|
||||||
setColourRGBWAF = 82,
|
setColourRGBWAF = 82,
|
||||||
setTemporaryRGBWAFDimLevels = 83,
|
setTemporaryRGBWAFDimLevels = 83,
|
||||||
|
readMemoryIdentity = 84,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class BridgeValueEncoding {
|
enum class BridgeValueEncoding {
|
||||||
|
|||||||
@@ -112,6 +112,16 @@ std::optional<int> DaliBase::getDTR1(int a) { return query(a, DALI_CMD_QUERY_CON
|
|||||||
|
|
||||||
std::optional<int> DaliBase::getDTR2(int a) { return query(a, DALI_CMD_QUERY_CONTENT_DTR2); }
|
std::optional<int> DaliBase::getDTR2(int a) { return query(a, DALI_CMD_QUERY_CONTENT_DTR2); }
|
||||||
|
|
||||||
|
std::optional<int> DaliBase::readMemoryLocation(int a, int bank, int location) {
|
||||||
|
if (!setDTR1(bank & 0xFF)) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
if (!setDTR(location & 0xFF)) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
return query(a, DALI_CMD_READ_MEMORY_LOCATION);
|
||||||
|
}
|
||||||
|
|
||||||
bool DaliBase::copyCurrentBrightToDTR(int a) {
|
bool DaliBase::copyCurrentBrightToDTR(int a) {
|
||||||
return sendExtCmd(encodeCmdAddr(a), DALI_CMD_STORE_ACTUAL_LEVEL_IN_THE_DTR);
|
return sendExtCmd(encodeCmdAddr(a), DALI_CMD_STORE_ACTUAL_LEVEL_IN_THE_DTR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ bool isReadOperation(BridgeOperation operation) {
|
|||||||
case BridgeOperation::dt1GetRatedDuration:
|
case BridgeOperation::dt1GetRatedDuration:
|
||||||
case BridgeOperation::dt1GetExtendedVersion:
|
case BridgeOperation::dt1GetExtendedVersion:
|
||||||
case BridgeOperation::dt1GetEmergencyDeviceType:
|
case BridgeOperation::dt1GetEmergencyDeviceType:
|
||||||
|
case BridgeOperation::readMemoryIdentity:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -478,6 +478,8 @@ const char* bridgeOperationToString(BridgeOperation operation) {
|
|||||||
return "dt1_get_extended_version";
|
return "dt1_get_extended_version";
|
||||||
case BridgeOperation::dt1GetEmergencyDeviceType:
|
case BridgeOperation::dt1GetEmergencyDeviceType:
|
||||||
return "dt1_get_emergency_device_type";
|
return "dt1_get_emergency_device_type";
|
||||||
|
case BridgeOperation::readMemoryIdentity:
|
||||||
|
return "read_memory_identity";
|
||||||
case BridgeOperation::unknown:
|
case BridgeOperation::unknown:
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
@@ -623,6 +625,9 @@ BridgeOperation bridgeOperationFromString(const std::string& value) {
|
|||||||
if (normalized == "dt1_get_emergency_device_type" || normalized == "dt1_get_type") {
|
if (normalized == "dt1_get_emergency_device_type" || normalized == "dt1_get_type") {
|
||||||
return BridgeOperation::dt1GetEmergencyDeviceType;
|
return BridgeOperation::dt1GetEmergencyDeviceType;
|
||||||
}
|
}
|
||||||
|
if (normalized == "read_memory_identity" || normalized == "get_memory_identity") {
|
||||||
|
return BridgeOperation::readMemoryIdentity;
|
||||||
|
}
|
||||||
if (normalized == "search_address_range") return BridgeOperation::searchAddressRange;
|
if (normalized == "search_address_range") return BridgeOperation::searchAddressRange;
|
||||||
if (normalized == "allocate_all_short_addresses" || normalized == "allocate_all_addr") {
|
if (normalized == "allocate_all_short_addresses" || normalized == "allocate_all_addr") {
|
||||||
return BridgeOperation::allocateAllShortAddresses;
|
return BridgeOperation::allocateAllShortAddresses;
|
||||||
|
|||||||
Reference in New Issue
Block a user