fix a few more that are missing

This commit is contained in:
J. Nick Koston 2025-07-15 19:57:43 -10:00
parent c80481baab
commit f6c12229e5
No known key found for this signature in database
3 changed files with 14 additions and 2 deletions

View File

@ -1915,7 +1915,7 @@ message TextStateResponse {
// If the Text does not have a valid state yet. // If the Text does not have a valid state yet.
// Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller // Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller
bool missing_state = 3; bool missing_state = 3;
uint32 device_id = 4; uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"];
} }
message TextCommandRequest { message TextCommandRequest {
option (id) = 99; option (id) = 99;
@ -1926,7 +1926,7 @@ message TextCommandRequest {
fixed32 key = 1; fixed32 key = 1;
string state = 2; string state = 2;
uint32 device_id = 3; uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"];
} }

View File

@ -2894,19 +2894,25 @@ void TextStateResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_fixed32(1, this->key); buffer.encode_fixed32(1, this->key);
buffer.encode_string(2, this->state); buffer.encode_string(2, this->state);
buffer.encode_bool(3, this->missing_state); buffer.encode_bool(3, this->missing_state);
#ifdef USE_DEVICES
buffer.encode_uint32(4, this->device_id); buffer.encode_uint32(4, this->device_id);
#endif
} }
void TextStateResponse::calculate_size(uint32_t &total_size) const { void TextStateResponse::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->state); ProtoSize::add_string_field(total_size, 1, this->state);
ProtoSize::add_bool_field(total_size, 1, this->missing_state); ProtoSize::add_bool_field(total_size, 1, this->missing_state);
#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 TextCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { bool TextCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
switch (field_id) { switch (field_id) {
#ifdef USE_DEVICES
case 3: case 3:
this->device_id = value.as_uint32(); this->device_id = value.as_uint32();
break; break;
#endif
default: default:
return false; return false;
} }

View File

@ -3954,10 +3954,13 @@ void TextStateResponse::dump_to(std::string &out) const {
out.append(YESNO(this->missing_state)); out.append(YESNO(this->missing_state));
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 TextCommandRequest::dump_to(std::string &out) const { void TextCommandRequest::dump_to(std::string &out) const {
@ -3972,10 +3975,13 @@ void TextCommandRequest::dump_to(std::string &out) const {
out.append("'").append(this->state).append("'"); out.append("'").append(this->state).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