fix a few more that are missing

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

View File

@ -1320,7 +1320,7 @@ message MediaPlayerStateResponse {
MediaPlayerState state = 2;
float volume = 3;
bool muted = 4;
uint32 device_id = 5;
uint32 device_id = 5 [(field_ifdef) = "USE_DEVICES"];
}
message MediaPlayerCommandRequest {
option (id) = 65;
@ -1863,7 +1863,7 @@ message AlarmControlPanelStateResponse {
option (no_delay) = true;
fixed32 key = 1;
AlarmControlPanelState state = 2;
uint32 device_id = 3;
uint32 device_id = 3 [(field_ifdef) = "USE_DEVICES"];
}
message AlarmControlPanelCommandRequest {
@ -1875,7 +1875,7 @@ message AlarmControlPanelCommandRequest {
fixed32 key = 1;
AlarmControlPanelStateCommand command = 2;
string code = 3;
uint32 device_id = 4;
uint32 device_id = 4 [(field_ifdef) = "USE_DEVICES"];
}
// ===================== TEXT =====================

View File

@ -1939,14 +1939,18 @@ void MediaPlayerStateResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
buffer.encode_float(3, this->volume);
buffer.encode_bool(4, this->muted);
#ifdef USE_DEVICES
buffer.encode_uint32(5, this->device_id);
#endif
}
void MediaPlayerStateResponse::calculate_size(uint32_t &total_size) const {
ProtoSize::add_fixed32_field(total_size, 1, this->key);
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state));
ProtoSize::add_float_field(total_size, 1, this->volume);
ProtoSize::add_bool_field(total_size, 1, this->muted);
#ifdef USE_DEVICES
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
#endif
}
bool MediaPlayerCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
switch (field_id) {
@ -2804,21 +2808,27 @@ void ListEntitiesAlarmControlPanelResponse::calculate_size(uint32_t &total_size)
void AlarmControlPanelStateResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_fixed32(1, this->key);
buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
#ifdef USE_DEVICES
buffer.encode_uint32(3, this->device_id);
#endif
}
void AlarmControlPanelStateResponse::calculate_size(uint32_t &total_size) const {
ProtoSize::add_fixed32_field(total_size, 1, this->key);
ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state));
#ifdef USE_DEVICES
ProtoSize::add_uint32_field(total_size, 1, this->device_id);
#endif
}
bool AlarmControlPanelCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
switch (field_id) {
case 2:
this->command = static_cast<enums::AlarmControlPanelStateCommand>(value.as_uint32());
break;
#ifdef USE_DEVICES
case 4:
this->device_id = value.as_uint32();
break;
#endif
default:
return false;
}

View File

@ -2983,10 +2983,13 @@ void MediaPlayerStateResponse::dump_to(std::string &out) const {
out.append(YESNO(this->muted));
out.append("\n");
#ifdef USE_DEVICES
out.append(" device_id: ");
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id);
out.append(buffer);
out.append("\n");
#endif
out.append("}");
}
void MediaPlayerCommandRequest::dump_to(std::string &out) const {
@ -3842,10 +3845,13 @@ void AlarmControlPanelStateResponse::dump_to(std::string &out) const {
out.append(proto_enum_to_string<enums::AlarmControlPanelState>(this->state));
out.append("\n");
#ifdef USE_DEVICES
out.append(" device_id: ");
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id);
out.append(buffer);
out.append("\n");
#endif
out.append("}");
}
void AlarmControlPanelCommandRequest::dump_to(std::string &out) const {
@ -3864,10 +3870,13 @@ void AlarmControlPanelCommandRequest::dump_to(std::string &out) const {
out.append("'").append(this->code).append("'");
out.append("\n");
#ifdef USE_DEVICES
out.append(" device_id: ");
snprintf(buffer, sizeof(buffer), "%" PRIu32, this->device_id);
out.append(buffer);
out.append("\n");
#endif
out.append("}");
}
#endif