feat: add application controller handling and DALI control device commands

Signed-off-by: Tony <tonylu@tony-cloud.com>
This commit is contained in:
Tony
2026-06-11 18:46:32 +08:00
parent 1342ab6aaf
commit 6ffca719d9
6 changed files with 379 additions and 11 deletions
@@ -324,7 +324,7 @@ GatewayRuntime::CommandPriority GatewayRuntime::classifyCommandPriority(
if (opcode == 0x00 || opcode == 0x01 || opcode == 0x03 || opcode == 0x04 || opcode == 0x07 ||
opcode == 0x08 || opcode == 0x10 || opcode == 0x11 || opcode == 0x12 || opcode == 0x13 ||
opcode == 0x17 || opcode == 0x18 || opcode == 0x37 || opcode == 0x38 ||
(opcode == 0x30 && addr == 0)) {
opcode == 0x60 || opcode == 0x61 || opcode == 0x62 || (opcode == 0x30 && addr == 0)) {
return CommandPriority::kControl;
}
return CommandPriority::kNormal;
@@ -597,8 +597,8 @@ std::string GatewayRuntime::defaultBleGatewayName() const {
}
bool GatewayRuntime::isQueryCommand(const std::vector<uint8_t>& command) const {
return command.size() >= 6 && isGatewayCommandFrame(command) && command[3] >= 0x14 &&
command[3] <= 0x16;
return command.size() >= 6 && isGatewayCommandFrame(command) &&
((command[3] >= 0x14 && command[3] <= 0x16) || command[3] == 0x62);
}
size_t GatewayRuntime::pendingCommandCountLocked() const {
@@ -639,6 +639,15 @@ std::optional<std::string> GatewayRuntime::queryCommandKey(
const auto gw = command[2];
const auto cmd = command[3];
if (cmd == 0x62) {
if (command.size() < 8) {
return std::nullopt;
}
char key[40] = {0};
std::snprintf(key, sizeof(key), "%u:%u:%u:%u:%u", gw, cmd, command[4], command[5],
command[6]);
return std::string(key);
}
if (cmd == 0x16) {
char key[16] = {0};
std::snprintf(key, sizeof(key), "%u:%u", gw, cmd);
@@ -688,4 +697,4 @@ std::string GatewayRuntime::toHex(const std::vector<uint8_t>& bytes) {
return out;
}
} // namespace gateway
} // namespace gateway