fix a few more that are missing

This commit is contained in:
J. Nick Koston 2025-07-15 19:58:13 -10:00
parent dfdec8ec0a
commit 5adfb71fe1
No known key found for this signature in database
3 changed files with 22 additions and 3 deletions

View File

@ -2052,7 +2052,7 @@ message EventResponse {
fixed32 key = 1; fixed32 key = 1;
string event_type = 2; string event_type = 2;
uint32 device_id = 3; uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"];
} }
// ==================== VALVE ==================== // ==================== VALVE ====================
@ -2093,7 +2093,7 @@ message ValveStateResponse {
fixed32 key = 1; fixed32 key = 1;
float position = 2; float position = 2;
ValveOperation current_operation = 3; ValveOperation current_operation = 3;
uint32 device_id = 4; uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"];
} }
message ValveCommandRequest { message ValveCommandRequest {
@ -2107,7 +2107,7 @@ message ValveCommandRequest {
bool has_position = 2; bool has_position = 2;
float position = 3; float position = 3;
bool stop = 4; bool stop = 4;
uint32 device_id = 5; uint32 device_id = 5 [(field_ifdef) = "USE_DEVICES"];
} }
// ==================== DATETIME DATETIME ==================== // ==================== DATETIME DATETIME ====================

View File

@ -3137,12 +3137,16 @@ void ListEntitiesEventResponse::calculate_size(uint32_t &total_size) const {
void EventResponse::encode(ProtoWriteBuffer buffer) const { void EventResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_fixed32(1, this->key); buffer.encode_fixed32(1, this->key);
buffer.encode_string(2, this->event_type); buffer.encode_string(2, this->event_type);
#ifdef USE_DEVICES
buffer.encode_uint32(3, this->device_id); buffer.encode_uint32(3, this->device_id);
#endif
} }
void EventResponse::calculate_size(uint32_t &total_size) const { void EventResponse::calculate_size(uint32_t &total_size) const {
ProtoSize::add_fixed32_field(total_size, 1, this->key); ProtoSize::add_fixed32_field(total_size, 1, this->key);
ProtoSize::add_string_field(total_size, 1, this->event_type); ProtoSize::add_string_field(total_size, 1, this->event_type);
#ifdef USE_DEVICES
ProtoSize::add_uint32_field(total_size, 1, this->device_id); ProtoSize::add_uint32_field(total_size, 1, this->device_id);
#endif
} }
#endif #endif
#ifdef USE_VALVE #ifdef USE_VALVE
@ -3184,13 +3188,17 @@ void ValveStateResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_fixed32(1, this->key); buffer.encode_fixed32(1, this->key);
buffer.encode_float(2, this->position); buffer.encode_float(2, this->position);
buffer.encode_uint32(3, static_cast<uint32_t>(this->current_operation)); buffer.encode_uint32(3, static_cast<uint32_t>(this->current_operation));
#ifdef USE_DEVICES
buffer.encode_uint32(4, this->device_id); buffer.encode_uint32(4, this->device_id);
#endif
} }
void ValveStateResponse::calculate_size(uint32_t &total_size) const { void ValveStateResponse::calculate_size(uint32_t &total_size) const {
ProtoSize::add_fixed32_field(total_size, 1, this->key); ProtoSize::add_fixed32_field(total_size, 1, this->key);
ProtoSize::add_float_field(total_size, 1, this->position); ProtoSize::add_float_field(total_size, 1, this->position);
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->current_operation)); ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->current_operation));
#ifdef USE_DEVICES
ProtoSize::add_uint32_field(total_size, 1, this->device_id); ProtoSize::add_uint32_field(total_size, 1, this->device_id);
#endif
} }
bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
switch (field_id) { switch (field_id) {
@ -3200,9 +3208,11 @@ bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
case 4: case 4:
this->stop = value.as_bool(); this->stop = value.as_bool();
break; break;
#ifdef USE_DEVICES
case 5: case 5:
this->device_id = value.as_uint32(); this->device_id = value.as_uint32();
break; break;
#endif
default: default:
return false; return false;
} }

View File

@ -4265,10 +4265,13 @@ void EventResponse::dump_to(std::string &out) const {
out.append("'").append(this->event_type).append("'"); out.append("'").append(this->event_type).append("'");
out.append("\n"); out.append("\n");
#ifdef USE_DEVICES
out.append(" device_id: "); out.append(" device_id: ");
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id);
out.append(buffer); out.append(buffer);
out.append("\n"); out.append("\n");
#endif
out.append("}"); out.append("}");
} }
#endif #endif
@ -4345,10 +4348,13 @@ void ValveStateResponse::dump_to(std::string &out) const {
out.append(proto_enum_to_string<enums::ValveOperation>(this->current_operation)); out.append(proto_enum_to_string<enums::ValveOperation>(this->current_operation));
out.append("\n"); out.append("\n");
#ifdef USE_DEVICES
out.append(" device_id: "); out.append(" device_id: ");
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id);
out.append(buffer); out.append(buffer);
out.append("\n"); out.append("\n");
#endif
out.append("}"); out.append("}");
} }
void ValveCommandRequest::dump_to(std::string &out) const { void ValveCommandRequest::dump_to(std::string &out) const {
@ -4372,10 +4378,13 @@ void ValveCommandRequest::dump_to(std::string &out) const {
out.append(YESNO(this->stop)); out.append(YESNO(this->stop));
out.append("\n"); out.append("\n");
#ifdef USE_DEVICES
out.append(" device_id: "); out.append(" device_id: ");
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id); snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id);
out.append(buffer); out.append(buffer);
out.append("\n"); out.append("\n");
#endif
out.append("}"); out.append("}");
} }
#endif #endif