ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
api_pb2.cpp
Go to the documentation of this file.
1// This file was automatically generated with a tool.
2// See script/api_protobuf/api_protobuf.py
3#include "api_pb2.h"
4#include "esphome/core/log.h"
6#include <cstring>
7
8namespace esphome::api {
9
10bool HelloRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
11 switch (field_id) {
12 case 2:
13 this->api_version_major = value.as_uint32();
14 break;
15 case 3:
16 this->api_version_minor = value.as_uint32();
17 break;
18 default:
19 return false;
20 }
21 return true;
22}
23bool HelloRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
24 switch (field_id) {
25 case 1: {
26 // Use raw data directly to avoid allocation
27 this->client_info = value.data();
28 this->client_info_len = value.size();
29 break;
30 }
31 default:
32 return false;
33 }
34 return true;
35}
37 buffer.encode_uint32(1, this->api_version_major);
38 buffer.encode_uint32(2, this->api_version_minor);
39 buffer.encode_string(3, this->server_info_ref_);
40 buffer.encode_string(4, this->name_ref_);
41}
43 size.add_uint32(1, this->api_version_major);
44 size.add_uint32(1, this->api_version_minor);
45 size.add_length(1, this->server_info_ref_.size());
46 size.add_length(1, this->name_ref_.size());
47}
48#ifdef USE_API_PASSWORD
50 switch (field_id) {
51 case 1: {
52 // Use raw data directly to avoid allocation
53 this->password = value.data();
54 this->password_len = value.size();
55 break;
56 }
57 default:
58 return false;
59 }
60 return true;
61}
64#endif
65#ifdef USE_AREAS
67 buffer.encode_uint32(1, this->area_id);
68 buffer.encode_string(2, this->name_ref_);
69}
71 size.add_uint32(1, this->area_id);
72 size.add_length(1, this->name_ref_.size());
73}
74#endif
75#ifdef USE_DEVICES
77 buffer.encode_uint32(1, this->device_id);
78 buffer.encode_string(2, this->name_ref_);
79 buffer.encode_uint32(3, this->area_id);
80}
82 size.add_uint32(1, this->device_id);
83 size.add_length(1, this->name_ref_.size());
84 size.add_uint32(1, this->area_id);
85}
86#endif
88#ifdef USE_API_PASSWORD
89 buffer.encode_bool(1, this->uses_password);
90#endif
91 buffer.encode_string(2, this->name_ref_);
92 buffer.encode_string(3, this->mac_address_ref_);
93 buffer.encode_string(4, this->esphome_version_ref_);
94 buffer.encode_string(5, this->compilation_time_ref_);
95 buffer.encode_string(6, this->model_ref_);
96#ifdef USE_DEEP_SLEEP
97 buffer.encode_bool(7, this->has_deep_sleep);
98#endif
99#ifdef ESPHOME_PROJECT_NAME
100 buffer.encode_string(8, this->project_name_ref_);
101#endif
102#ifdef ESPHOME_PROJECT_NAME
103 buffer.encode_string(9, this->project_version_ref_);
104#endif
105#ifdef USE_WEBSERVER
106 buffer.encode_uint32(10, this->webserver_port);
107#endif
108#ifdef USE_BLUETOOTH_PROXY
110#endif
111 buffer.encode_string(12, this->manufacturer_ref_);
112 buffer.encode_string(13, this->friendly_name_ref_);
113#ifdef USE_VOICE_ASSISTANT
115#endif
116#ifdef USE_AREAS
117 buffer.encode_string(16, this->suggested_area_ref_);
118#endif
119#ifdef USE_BLUETOOTH_PROXY
121#endif
122#ifdef USE_API_NOISE
123 buffer.encode_bool(19, this->api_encryption_supported);
124#endif
125#ifdef USE_DEVICES
126 for (const auto &it : this->devices) {
127 buffer.encode_message(20, it, true);
128 }
129#endif
130#ifdef USE_AREAS
131 for (const auto &it : this->areas) {
132 buffer.encode_message(21, it, true);
133 }
134#endif
135#ifdef USE_AREAS
136 buffer.encode_message(22, this->area);
137#endif
138#ifdef USE_ZWAVE_PROXY
140#endif
141#ifdef USE_ZWAVE_PROXY
142 buffer.encode_uint32(24, this->zwave_home_id);
143#endif
144}
146#ifdef USE_API_PASSWORD
147 size.add_bool(1, this->uses_password);
148#endif
149 size.add_length(1, this->name_ref_.size());
150 size.add_length(1, this->mac_address_ref_.size());
151 size.add_length(1, this->esphome_version_ref_.size());
152 size.add_length(1, this->compilation_time_ref_.size());
153 size.add_length(1, this->model_ref_.size());
154#ifdef USE_DEEP_SLEEP
155 size.add_bool(1, this->has_deep_sleep);
156#endif
157#ifdef ESPHOME_PROJECT_NAME
158 size.add_length(1, this->project_name_ref_.size());
159#endif
160#ifdef ESPHOME_PROJECT_NAME
161 size.add_length(1, this->project_version_ref_.size());
162#endif
163#ifdef USE_WEBSERVER
164 size.add_uint32(1, this->webserver_port);
165#endif
166#ifdef USE_BLUETOOTH_PROXY
168#endif
169 size.add_length(1, this->manufacturer_ref_.size());
170 size.add_length(1, this->friendly_name_ref_.size());
171#ifdef USE_VOICE_ASSISTANT
173#endif
174#ifdef USE_AREAS
175 size.add_length(2, this->suggested_area_ref_.size());
176#endif
177#ifdef USE_BLUETOOTH_PROXY
179#endif
180#ifdef USE_API_NOISE
181 size.add_bool(2, this->api_encryption_supported);
182#endif
183#ifdef USE_DEVICES
184 for (const auto &it : this->devices) {
185 size.add_message_object_force(2, it);
186 }
187#endif
188#ifdef USE_AREAS
189 for (const auto &it : this->areas) {
190 size.add_message_object_force(2, it);
191 }
192#endif
193#ifdef USE_AREAS
194 size.add_message_object(2, this->area);
195#endif
196#ifdef USE_ZWAVE_PROXY
198#endif
199#ifdef USE_ZWAVE_PROXY
200 size.add_uint32(2, this->zwave_home_id);
201#endif
202}
203#ifdef USE_BINARY_SENSOR
205 buffer.encode_string(1, this->object_id_ref_);
206 buffer.encode_fixed32(2, this->key);
207 buffer.encode_string(3, this->name_ref_);
208 buffer.encode_string(5, this->device_class_ref_);
209 buffer.encode_bool(6, this->is_status_binary_sensor);
210 buffer.encode_bool(7, this->disabled_by_default);
211#ifdef USE_ENTITY_ICON
212 buffer.encode_string(8, this->icon_ref_);
213#endif
214 buffer.encode_uint32(9, static_cast<uint32_t>(this->entity_category));
215#ifdef USE_DEVICES
216 buffer.encode_uint32(10, this->device_id);
217#endif
218}
220 size.add_length(1, this->object_id_ref_.size());
221 size.add_fixed32(1, this->key);
222 size.add_length(1, this->name_ref_.size());
223 size.add_length(1, this->device_class_ref_.size());
224 size.add_bool(1, this->is_status_binary_sensor);
225 size.add_bool(1, this->disabled_by_default);
226#ifdef USE_ENTITY_ICON
227 size.add_length(1, this->icon_ref_.size());
228#endif
229 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
230#ifdef USE_DEVICES
231 size.add_uint32(1, this->device_id);
232#endif
233}
235 buffer.encode_fixed32(1, this->key);
236 buffer.encode_bool(2, this->state);
237 buffer.encode_bool(3, this->missing_state);
238#ifdef USE_DEVICES
239 buffer.encode_uint32(4, this->device_id);
240#endif
241}
243 size.add_fixed32(1, this->key);
244 size.add_bool(1, this->state);
245 size.add_bool(1, this->missing_state);
246#ifdef USE_DEVICES
247 size.add_uint32(1, this->device_id);
248#endif
249}
250#endif
251#ifdef USE_COVER
253 buffer.encode_string(1, this->object_id_ref_);
254 buffer.encode_fixed32(2, this->key);
255 buffer.encode_string(3, this->name_ref_);
256 buffer.encode_bool(5, this->assumed_state);
257 buffer.encode_bool(6, this->supports_position);
258 buffer.encode_bool(7, this->supports_tilt);
259 buffer.encode_string(8, this->device_class_ref_);
260 buffer.encode_bool(9, this->disabled_by_default);
261#ifdef USE_ENTITY_ICON
262 buffer.encode_string(10, this->icon_ref_);
263#endif
264 buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
265 buffer.encode_bool(12, this->supports_stop);
266#ifdef USE_DEVICES
267 buffer.encode_uint32(13, this->device_id);
268#endif
269}
271 size.add_length(1, this->object_id_ref_.size());
272 size.add_fixed32(1, this->key);
273 size.add_length(1, this->name_ref_.size());
274 size.add_bool(1, this->assumed_state);
275 size.add_bool(1, this->supports_position);
276 size.add_bool(1, this->supports_tilt);
277 size.add_length(1, this->device_class_ref_.size());
278 size.add_bool(1, this->disabled_by_default);
279#ifdef USE_ENTITY_ICON
280 size.add_length(1, this->icon_ref_.size());
281#endif
282 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
283 size.add_bool(1, this->supports_stop);
284#ifdef USE_DEVICES
285 size.add_uint32(1, this->device_id);
286#endif
287}
289 buffer.encode_fixed32(1, this->key);
290 buffer.encode_float(3, this->position);
291 buffer.encode_float(4, this->tilt);
292 buffer.encode_uint32(5, static_cast<uint32_t>(this->current_operation));
293#ifdef USE_DEVICES
294 buffer.encode_uint32(6, this->device_id);
295#endif
296}
298 size.add_fixed32(1, this->key);
299 size.add_float(1, this->position);
300 size.add_float(1, this->tilt);
301 size.add_uint32(1, static_cast<uint32_t>(this->current_operation));
302#ifdef USE_DEVICES
303 size.add_uint32(1, this->device_id);
304#endif
305}
306bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
307 switch (field_id) {
308 case 4:
309 this->has_position = value.as_bool();
310 break;
311 case 6:
312 this->has_tilt = value.as_bool();
313 break;
314 case 8:
315 this->stop = value.as_bool();
316 break;
317#ifdef USE_DEVICES
318 case 9:
319 this->device_id = value.as_uint32();
320 break;
321#endif
322 default:
323 return false;
324 }
325 return true;
326}
327bool CoverCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
328 switch (field_id) {
329 case 1:
330 this->key = value.as_fixed32();
331 break;
332 case 5:
333 this->position = value.as_float();
334 break;
335 case 7:
336 this->tilt = value.as_float();
337 break;
338 default:
339 return false;
340 }
341 return true;
342}
343#endif
344#ifdef USE_FAN
346 buffer.encode_string(1, this->object_id_ref_);
347 buffer.encode_fixed32(2, this->key);
348 buffer.encode_string(3, this->name_ref_);
349 buffer.encode_bool(5, this->supports_oscillation);
350 buffer.encode_bool(6, this->supports_speed);
351 buffer.encode_bool(7, this->supports_direction);
352 buffer.encode_int32(8, this->supported_speed_count);
353 buffer.encode_bool(9, this->disabled_by_default);
354#ifdef USE_ENTITY_ICON
355 buffer.encode_string(10, this->icon_ref_);
356#endif
357 buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
358 for (const char *it : *this->supported_preset_modes) {
359 buffer.encode_string(12, it, strlen(it), true);
360 }
361#ifdef USE_DEVICES
362 buffer.encode_uint32(13, this->device_id);
363#endif
364}
366 size.add_length(1, this->object_id_ref_.size());
367 size.add_fixed32(1, this->key);
368 size.add_length(1, this->name_ref_.size());
369 size.add_bool(1, this->supports_oscillation);
370 size.add_bool(1, this->supports_speed);
371 size.add_bool(1, this->supports_direction);
372 size.add_int32(1, this->supported_speed_count);
373 size.add_bool(1, this->disabled_by_default);
374#ifdef USE_ENTITY_ICON
375 size.add_length(1, this->icon_ref_.size());
376#endif
377 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
378 if (!this->supported_preset_modes->empty()) {
379 for (const char *it : *this->supported_preset_modes) {
380 size.add_length_force(1, strlen(it));
381 }
382 }
383#ifdef USE_DEVICES
384 size.add_uint32(1, this->device_id);
385#endif
386}
388 buffer.encode_fixed32(1, this->key);
389 buffer.encode_bool(2, this->state);
390 buffer.encode_bool(3, this->oscillating);
391 buffer.encode_uint32(5, static_cast<uint32_t>(this->direction));
392 buffer.encode_int32(6, this->speed_level);
393 buffer.encode_string(7, this->preset_mode_ref_);
394#ifdef USE_DEVICES
395 buffer.encode_uint32(8, this->device_id);
396#endif
397}
399 size.add_fixed32(1, this->key);
400 size.add_bool(1, this->state);
401 size.add_bool(1, this->oscillating);
402 size.add_uint32(1, static_cast<uint32_t>(this->direction));
403 size.add_int32(1, this->speed_level);
404 size.add_length(1, this->preset_mode_ref_.size());
405#ifdef USE_DEVICES
406 size.add_uint32(1, this->device_id);
407#endif
408}
409bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
410 switch (field_id) {
411 case 2:
412 this->has_state = value.as_bool();
413 break;
414 case 3:
415 this->state = value.as_bool();
416 break;
417 case 6:
418 this->has_oscillating = value.as_bool();
419 break;
420 case 7:
421 this->oscillating = value.as_bool();
422 break;
423 case 8:
424 this->has_direction = value.as_bool();
425 break;
426 case 9:
427 this->direction = static_cast<enums::FanDirection>(value.as_uint32());
428 break;
429 case 10:
430 this->has_speed_level = value.as_bool();
431 break;
432 case 11:
433 this->speed_level = value.as_int32();
434 break;
435 case 12:
436 this->has_preset_mode = value.as_bool();
437 break;
438#ifdef USE_DEVICES
439 case 14:
440 this->device_id = value.as_uint32();
441 break;
442#endif
443 default:
444 return false;
445 }
446 return true;
447}
449 switch (field_id) {
450 case 13:
451 this->preset_mode = value.as_string();
452 break;
453 default:
454 return false;
455 }
456 return true;
457}
458bool FanCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
459 switch (field_id) {
460 case 1:
461 this->key = value.as_fixed32();
462 break;
463 default:
464 return false;
465 }
466 return true;
467}
468#endif
469#ifdef USE_LIGHT
471 buffer.encode_string(1, this->object_id_ref_);
472 buffer.encode_fixed32(2, this->key);
473 buffer.encode_string(3, this->name_ref_);
474 for (const auto &it : *this->supported_color_modes) {
475 buffer.encode_uint32(12, static_cast<uint32_t>(it), true);
476 }
477 buffer.encode_float(9, this->min_mireds);
478 buffer.encode_float(10, this->max_mireds);
479 for (auto &it : this->effects) {
480 buffer.encode_string(11, it, true);
481 }
482 buffer.encode_bool(13, this->disabled_by_default);
483#ifdef USE_ENTITY_ICON
484 buffer.encode_string(14, this->icon_ref_);
485#endif
486 buffer.encode_uint32(15, static_cast<uint32_t>(this->entity_category));
487#ifdef USE_DEVICES
488 buffer.encode_uint32(16, this->device_id);
489#endif
490}
492 size.add_length(1, this->object_id_ref_.size());
493 size.add_fixed32(1, this->key);
494 size.add_length(1, this->name_ref_.size());
495 if (!this->supported_color_modes->empty()) {
496 for (const auto &it : *this->supported_color_modes) {
497 size.add_uint32_force(1, static_cast<uint32_t>(it));
498 }
499 }
500 size.add_float(1, this->min_mireds);
501 size.add_float(1, this->max_mireds);
502 if (!this->effects.empty()) {
503 for (const auto &it : this->effects) {
504 size.add_length_force(1, it.size());
505 }
506 }
507 size.add_bool(1, this->disabled_by_default);
508#ifdef USE_ENTITY_ICON
509 size.add_length(1, this->icon_ref_.size());
510#endif
511 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
512#ifdef USE_DEVICES
513 size.add_uint32(2, this->device_id);
514#endif
515}
517 buffer.encode_fixed32(1, this->key);
518 buffer.encode_bool(2, this->state);
519 buffer.encode_float(3, this->brightness);
520 buffer.encode_uint32(11, static_cast<uint32_t>(this->color_mode));
521 buffer.encode_float(10, this->color_brightness);
522 buffer.encode_float(4, this->red);
523 buffer.encode_float(5, this->green);
524 buffer.encode_float(6, this->blue);
525 buffer.encode_float(7, this->white);
526 buffer.encode_float(8, this->color_temperature);
527 buffer.encode_float(12, this->cold_white);
528 buffer.encode_float(13, this->warm_white);
529 buffer.encode_string(9, this->effect_ref_);
530#ifdef USE_DEVICES
531 buffer.encode_uint32(14, this->device_id);
532#endif
533}
535 size.add_fixed32(1, this->key);
536 size.add_bool(1, this->state);
537 size.add_float(1, this->brightness);
538 size.add_uint32(1, static_cast<uint32_t>(this->color_mode));
539 size.add_float(1, this->color_brightness);
540 size.add_float(1, this->red);
541 size.add_float(1, this->green);
542 size.add_float(1, this->blue);
543 size.add_float(1, this->white);
544 size.add_float(1, this->color_temperature);
545 size.add_float(1, this->cold_white);
546 size.add_float(1, this->warm_white);
547 size.add_length(1, this->effect_ref_.size());
548#ifdef USE_DEVICES
549 size.add_uint32(1, this->device_id);
550#endif
551}
552bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
553 switch (field_id) {
554 case 2:
555 this->has_state = value.as_bool();
556 break;
557 case 3:
558 this->state = value.as_bool();
559 break;
560 case 4:
561 this->has_brightness = value.as_bool();
562 break;
563 case 22:
564 this->has_color_mode = value.as_bool();
565 break;
566 case 23:
567 this->color_mode = static_cast<enums::ColorMode>(value.as_uint32());
568 break;
569 case 20:
570 this->has_color_brightness = value.as_bool();
571 break;
572 case 6:
573 this->has_rgb = value.as_bool();
574 break;
575 case 10:
576 this->has_white = value.as_bool();
577 break;
578 case 12:
579 this->has_color_temperature = value.as_bool();
580 break;
581 case 24:
582 this->has_cold_white = value.as_bool();
583 break;
584 case 26:
585 this->has_warm_white = value.as_bool();
586 break;
587 case 14:
588 this->has_transition_length = value.as_bool();
589 break;
590 case 15:
591 this->transition_length = value.as_uint32();
592 break;
593 case 16:
594 this->has_flash_length = value.as_bool();
595 break;
596 case 17:
597 this->flash_length = value.as_uint32();
598 break;
599 case 18:
600 this->has_effect = value.as_bool();
601 break;
602#ifdef USE_DEVICES
603 case 28:
604 this->device_id = value.as_uint32();
605 break;
606#endif
607 default:
608 return false;
609 }
610 return true;
611}
613 switch (field_id) {
614 case 19:
615 this->effect = value.as_string();
616 break;
617 default:
618 return false;
619 }
620 return true;
621}
622bool LightCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
623 switch (field_id) {
624 case 1:
625 this->key = value.as_fixed32();
626 break;
627 case 5:
628 this->brightness = value.as_float();
629 break;
630 case 21:
631 this->color_brightness = value.as_float();
632 break;
633 case 7:
634 this->red = value.as_float();
635 break;
636 case 8:
637 this->green = value.as_float();
638 break;
639 case 9:
640 this->blue = value.as_float();
641 break;
642 case 11:
643 this->white = value.as_float();
644 break;
645 case 13:
646 this->color_temperature = value.as_float();
647 break;
648 case 25:
649 this->cold_white = value.as_float();
650 break;
651 case 27:
652 this->warm_white = value.as_float();
653 break;
654 default:
655 return false;
656 }
657 return true;
658}
659#endif
660#ifdef USE_SENSOR
662 buffer.encode_string(1, this->object_id_ref_);
663 buffer.encode_fixed32(2, this->key);
664 buffer.encode_string(3, this->name_ref_);
665#ifdef USE_ENTITY_ICON
666 buffer.encode_string(5, this->icon_ref_);
667#endif
669 buffer.encode_int32(7, this->accuracy_decimals);
670 buffer.encode_bool(8, this->force_update);
671 buffer.encode_string(9, this->device_class_ref_);
672 buffer.encode_uint32(10, static_cast<uint32_t>(this->state_class));
673 buffer.encode_bool(12, this->disabled_by_default);
674 buffer.encode_uint32(13, static_cast<uint32_t>(this->entity_category));
675#ifdef USE_DEVICES
676 buffer.encode_uint32(14, this->device_id);
677#endif
678}
680 size.add_length(1, this->object_id_ref_.size());
681 size.add_fixed32(1, this->key);
682 size.add_length(1, this->name_ref_.size());
683#ifdef USE_ENTITY_ICON
684 size.add_length(1, this->icon_ref_.size());
685#endif
687 size.add_int32(1, this->accuracy_decimals);
688 size.add_bool(1, this->force_update);
689 size.add_length(1, this->device_class_ref_.size());
690 size.add_uint32(1, static_cast<uint32_t>(this->state_class));
691 size.add_bool(1, this->disabled_by_default);
692 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
693#ifdef USE_DEVICES
694 size.add_uint32(1, this->device_id);
695#endif
696}
698 buffer.encode_fixed32(1, this->key);
699 buffer.encode_float(2, this->state);
700 buffer.encode_bool(3, this->missing_state);
701#ifdef USE_DEVICES
702 buffer.encode_uint32(4, this->device_id);
703#endif
704}
706 size.add_fixed32(1, this->key);
707 size.add_float(1, this->state);
708 size.add_bool(1, this->missing_state);
709#ifdef USE_DEVICES
710 size.add_uint32(1, this->device_id);
711#endif
712}
713#endif
714#ifdef USE_SWITCH
716 buffer.encode_string(1, this->object_id_ref_);
717 buffer.encode_fixed32(2, this->key);
718 buffer.encode_string(3, this->name_ref_);
719#ifdef USE_ENTITY_ICON
720 buffer.encode_string(5, this->icon_ref_);
721#endif
722 buffer.encode_bool(6, this->assumed_state);
723 buffer.encode_bool(7, this->disabled_by_default);
724 buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
725 buffer.encode_string(9, this->device_class_ref_);
726#ifdef USE_DEVICES
727 buffer.encode_uint32(10, this->device_id);
728#endif
729}
731 size.add_length(1, this->object_id_ref_.size());
732 size.add_fixed32(1, this->key);
733 size.add_length(1, this->name_ref_.size());
734#ifdef USE_ENTITY_ICON
735 size.add_length(1, this->icon_ref_.size());
736#endif
737 size.add_bool(1, this->assumed_state);
738 size.add_bool(1, this->disabled_by_default);
739 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
740 size.add_length(1, this->device_class_ref_.size());
741#ifdef USE_DEVICES
742 size.add_uint32(1, this->device_id);
743#endif
744}
746 buffer.encode_fixed32(1, this->key);
747 buffer.encode_bool(2, this->state);
748#ifdef USE_DEVICES
749 buffer.encode_uint32(3, this->device_id);
750#endif
751}
753 size.add_fixed32(1, this->key);
754 size.add_bool(1, this->state);
755#ifdef USE_DEVICES
756 size.add_uint32(1, this->device_id);
757#endif
758}
759bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
760 switch (field_id) {
761 case 2:
762 this->state = value.as_bool();
763 break;
764#ifdef USE_DEVICES
765 case 3:
766 this->device_id = value.as_uint32();
767 break;
768#endif
769 default:
770 return false;
771 }
772 return true;
773}
774bool SwitchCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
775 switch (field_id) {
776 case 1:
777 this->key = value.as_fixed32();
778 break;
779 default:
780 return false;
781 }
782 return true;
783}
784#endif
785#ifdef USE_TEXT_SENSOR
787 buffer.encode_string(1, this->object_id_ref_);
788 buffer.encode_fixed32(2, this->key);
789 buffer.encode_string(3, this->name_ref_);
790#ifdef USE_ENTITY_ICON
791 buffer.encode_string(5, this->icon_ref_);
792#endif
793 buffer.encode_bool(6, this->disabled_by_default);
794 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
795 buffer.encode_string(8, this->device_class_ref_);
796#ifdef USE_DEVICES
797 buffer.encode_uint32(9, this->device_id);
798#endif
799}
801 size.add_length(1, this->object_id_ref_.size());
802 size.add_fixed32(1, this->key);
803 size.add_length(1, this->name_ref_.size());
804#ifdef USE_ENTITY_ICON
805 size.add_length(1, this->icon_ref_.size());
806#endif
807 size.add_bool(1, this->disabled_by_default);
808 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
809 size.add_length(1, this->device_class_ref_.size());
810#ifdef USE_DEVICES
811 size.add_uint32(1, this->device_id);
812#endif
813}
815 buffer.encode_fixed32(1, this->key);
816 buffer.encode_string(2, this->state_ref_);
817 buffer.encode_bool(3, this->missing_state);
818#ifdef USE_DEVICES
819 buffer.encode_uint32(4, this->device_id);
820#endif
821}
823 size.add_fixed32(1, this->key);
824 size.add_length(1, this->state_ref_.size());
825 size.add_bool(1, this->missing_state);
826#ifdef USE_DEVICES
827 size.add_uint32(1, this->device_id);
828#endif
829}
830#endif
831bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
832 switch (field_id) {
833 case 1:
834 this->level = static_cast<enums::LogLevel>(value.as_uint32());
835 break;
836 case 2:
837 this->dump_config = value.as_bool();
838 break;
839 default:
840 return false;
841 }
842 return true;
843}
845 buffer.encode_uint32(1, static_cast<uint32_t>(this->level));
846 buffer.encode_bytes(3, this->message_ptr_, this->message_len_);
847}
849 size.add_uint32(1, static_cast<uint32_t>(this->level));
850 size.add_length(1, this->message_len_);
851}
852#ifdef USE_API_NOISE
854 switch (field_id) {
855 case 1:
856 this->key = value.as_string();
857 break;
858 default:
859 return false;
860 }
861 return true;
862}
865#endif
866#ifdef USE_API_HOMEASSISTANT_SERVICES
868 buffer.encode_string(1, this->key_ref_);
869 buffer.encode_string(2, this->value);
870}
872 size.add_length(1, this->key_ref_.size());
873 size.add_length(1, this->value.size());
874}
876 buffer.encode_string(1, this->service_ref_);
877 for (auto &it : this->data) {
878 buffer.encode_message(2, it, true);
879 }
880 for (auto &it : this->data_template) {
881 buffer.encode_message(3, it, true);
882 }
883 for (auto &it : this->variables) {
884 buffer.encode_message(4, it, true);
885 }
886 buffer.encode_bool(5, this->is_event);
887#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
888 buffer.encode_uint32(6, this->call_id);
889#endif
890#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
891 buffer.encode_bool(7, this->wants_response);
892#endif
893#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
894 buffer.encode_string(8, this->response_template);
895#endif
896}
898 size.add_length(1, this->service_ref_.size());
899 size.add_repeated_message(1, this->data);
900 size.add_repeated_message(1, this->data_template);
901 size.add_repeated_message(1, this->variables);
902 size.add_bool(1, this->is_event);
903#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
904 size.add_uint32(1, this->call_id);
905#endif
906#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
907 size.add_bool(1, this->wants_response);
908#endif
909#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
910 size.add_length(1, this->response_template.size());
911#endif
912}
913#endif
914#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
916 switch (field_id) {
917 case 1:
918 this->call_id = value.as_uint32();
919 break;
920 case 2:
921 this->success = value.as_bool();
922 break;
923 default:
924 return false;
925 }
926 return true;
927}
929 switch (field_id) {
930 case 3:
931 this->error_message = value.as_string();
932 break;
933#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
934 case 4: {
935 // Use raw data directly to avoid allocation
936 this->response_data = value.data();
937 this->response_data_len = value.size();
938 break;
939 }
940#endif
941 default:
942 return false;
943 }
944 return true;
945}
946#endif
947#ifdef USE_API_HOMEASSISTANT_STATES
949 buffer.encode_string(1, this->entity_id_ref_);
950 buffer.encode_string(2, this->attribute_ref_);
951 buffer.encode_bool(3, this->once);
952}
954 size.add_length(1, this->entity_id_ref_.size());
955 size.add_length(1, this->attribute_ref_.size());
956 size.add_bool(1, this->once);
957}
959 switch (field_id) {
960 case 1:
961 this->entity_id = value.as_string();
962 break;
963 case 2:
964 this->state = value.as_string();
965 break;
966 case 3:
967 this->attribute = value.as_string();
968 break;
969 default:
970 return false;
971 }
972 return true;
973}
974#endif
976 switch (field_id) {
977 case 2: {
978 // Use raw data directly to avoid allocation
979 this->timezone = value.data();
980 this->timezone_len = value.size();
981 break;
982 }
983 default:
984 return false;
985 }
986 return true;
987}
988bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
989 switch (field_id) {
990 case 1:
991 this->epoch_seconds = value.as_fixed32();
992 break;
993 default:
994 return false;
995 }
996 return true;
997}
998#ifdef USE_API_SERVICES
1000 buffer.encode_string(1, this->name_ref_);
1001 buffer.encode_uint32(2, static_cast<uint32_t>(this->type));
1002}
1004 size.add_length(1, this->name_ref_.size());
1005 size.add_uint32(1, static_cast<uint32_t>(this->type));
1006}
1008 buffer.encode_string(1, this->name_ref_);
1009 buffer.encode_fixed32(2, this->key);
1010 for (auto &it : this->args) {
1011 buffer.encode_message(3, it, true);
1012 }
1013}
1015 size.add_length(1, this->name_ref_.size());
1016 size.add_fixed32(1, this->key);
1017 size.add_repeated_message(1, this->args);
1018}
1020 switch (field_id) {
1021 case 1:
1022 this->bool_ = value.as_bool();
1023 break;
1024 case 2:
1025 this->legacy_int = value.as_int32();
1026 break;
1027 case 5:
1028 this->int_ = value.as_sint32();
1029 break;
1030 case 6:
1031 this->bool_array.push_back(value.as_bool());
1032 break;
1033 case 7:
1034 this->int_array.push_back(value.as_sint32());
1035 break;
1036 default:
1037 return false;
1038 }
1039 return true;
1040}
1042 switch (field_id) {
1043 case 4:
1044 this->string_ = value.as_string();
1045 break;
1046 case 9:
1047 this->string_array.push_back(value.as_string());
1048 break;
1049 default:
1050 return false;
1051 }
1052 return true;
1053}
1054bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) {
1055 switch (field_id) {
1056 case 3:
1057 this->float_ = value.as_float();
1058 break;
1059 case 8:
1060 this->float_array.push_back(value.as_float());
1061 break;
1062 default:
1063 return false;
1064 }
1065 return true;
1066}
1067void ExecuteServiceArgument::decode(const uint8_t *buffer, size_t length) {
1068 uint32_t count_bool_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 6);
1069 this->bool_array.init(count_bool_array);
1070 uint32_t count_int_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 7);
1071 this->int_array.init(count_int_array);
1072 uint32_t count_float_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 8);
1073 this->float_array.init(count_float_array);
1074 uint32_t count_string_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 9);
1075 this->string_array.init(count_string_array);
1077}
1079 switch (field_id) {
1080 case 2:
1081 this->args.emplace_back();
1082 value.decode_to_message(this->args.back());
1083 break;
1084 default:
1085 return false;
1086 }
1087 return true;
1088}
1089bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1090 switch (field_id) {
1091 case 1:
1092 this->key = value.as_fixed32();
1093 break;
1094 default:
1095 return false;
1096 }
1097 return true;
1098}
1099void ExecuteServiceRequest::decode(const uint8_t *buffer, size_t length) {
1100 uint32_t count_args = ProtoDecodableMessage::count_repeated_field(buffer, length, 2);
1101 this->args.init(count_args);
1103}
1104#endif
1105#ifdef USE_CAMERA
1107 buffer.encode_string(1, this->object_id_ref_);
1108 buffer.encode_fixed32(2, this->key);
1109 buffer.encode_string(3, this->name_ref_);
1110 buffer.encode_bool(5, this->disabled_by_default);
1111#ifdef USE_ENTITY_ICON
1112 buffer.encode_string(6, this->icon_ref_);
1113#endif
1114 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1115#ifdef USE_DEVICES
1116 buffer.encode_uint32(8, this->device_id);
1117#endif
1118}
1120 size.add_length(1, this->object_id_ref_.size());
1121 size.add_fixed32(1, this->key);
1122 size.add_length(1, this->name_ref_.size());
1123 size.add_bool(1, this->disabled_by_default);
1124#ifdef USE_ENTITY_ICON
1125 size.add_length(1, this->icon_ref_.size());
1126#endif
1127 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1128#ifdef USE_DEVICES
1129 size.add_uint32(1, this->device_id);
1130#endif
1131}
1133 buffer.encode_fixed32(1, this->key);
1134 buffer.encode_bytes(2, this->data_ptr_, this->data_len_);
1135 buffer.encode_bool(3, this->done);
1136#ifdef USE_DEVICES
1137 buffer.encode_uint32(4, this->device_id);
1138#endif
1139}
1141 size.add_fixed32(1, this->key);
1142 size.add_length(1, this->data_len_);
1143 size.add_bool(1, this->done);
1144#ifdef USE_DEVICES
1145 size.add_uint32(1, this->device_id);
1146#endif
1147}
1148bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1149 switch (field_id) {
1150 case 1:
1151 this->single = value.as_bool();
1152 break;
1153 case 2:
1154 this->stream = value.as_bool();
1155 break;
1156 default:
1157 return false;
1158 }
1159 return true;
1160}
1161#endif
1162#ifdef USE_CLIMATE
1164 buffer.encode_string(1, this->object_id_ref_);
1165 buffer.encode_fixed32(2, this->key);
1166 buffer.encode_string(3, this->name_ref_);
1169 for (const auto &it : *this->supported_modes) {
1170 buffer.encode_uint32(7, static_cast<uint32_t>(it), true);
1171 }
1172 buffer.encode_float(8, this->visual_min_temperature);
1173 buffer.encode_float(9, this->visual_max_temperature);
1175 buffer.encode_bool(12, this->supports_action);
1176 for (const auto &it : *this->supported_fan_modes) {
1177 buffer.encode_uint32(13, static_cast<uint32_t>(it), true);
1178 }
1179 for (const auto &it : *this->supported_swing_modes) {
1180 buffer.encode_uint32(14, static_cast<uint32_t>(it), true);
1181 }
1182 for (const char *it : *this->supported_custom_fan_modes) {
1183 buffer.encode_string(15, it, strlen(it), true);
1184 }
1185 for (const auto &it : *this->supported_presets) {
1186 buffer.encode_uint32(16, static_cast<uint32_t>(it), true);
1187 }
1188 for (const char *it : *this->supported_custom_presets) {
1189 buffer.encode_string(17, it, strlen(it), true);
1190 }
1191 buffer.encode_bool(18, this->disabled_by_default);
1192#ifdef USE_ENTITY_ICON
1193 buffer.encode_string(19, this->icon_ref_);
1194#endif
1195 buffer.encode_uint32(20, static_cast<uint32_t>(this->entity_category));
1197 buffer.encode_bool(22, this->supports_current_humidity);
1198 buffer.encode_bool(23, this->supports_target_humidity);
1199 buffer.encode_float(24, this->visual_min_humidity);
1200 buffer.encode_float(25, this->visual_max_humidity);
1201#ifdef USE_DEVICES
1202 buffer.encode_uint32(26, this->device_id);
1203#endif
1204 buffer.encode_uint32(27, this->feature_flags);
1205}
1207 size.add_length(1, this->object_id_ref_.size());
1208 size.add_fixed32(1, this->key);
1209 size.add_length(1, this->name_ref_.size());
1212 if (!this->supported_modes->empty()) {
1213 for (const auto &it : *this->supported_modes) {
1214 size.add_uint32_force(1, static_cast<uint32_t>(it));
1215 }
1216 }
1217 size.add_float(1, this->visual_min_temperature);
1218 size.add_float(1, this->visual_max_temperature);
1220 size.add_bool(1, this->supports_action);
1221 if (!this->supported_fan_modes->empty()) {
1222 for (const auto &it : *this->supported_fan_modes) {
1223 size.add_uint32_force(1, static_cast<uint32_t>(it));
1224 }
1225 }
1226 if (!this->supported_swing_modes->empty()) {
1227 for (const auto &it : *this->supported_swing_modes) {
1228 size.add_uint32_force(1, static_cast<uint32_t>(it));
1229 }
1230 }
1231 if (!this->supported_custom_fan_modes->empty()) {
1232 for (const char *it : *this->supported_custom_fan_modes) {
1233 size.add_length_force(1, strlen(it));
1234 }
1235 }
1236 if (!this->supported_presets->empty()) {
1237 for (const auto &it : *this->supported_presets) {
1238 size.add_uint32_force(2, static_cast<uint32_t>(it));
1239 }
1240 }
1241 if (!this->supported_custom_presets->empty()) {
1242 for (const char *it : *this->supported_custom_presets) {
1243 size.add_length_force(2, strlen(it));
1244 }
1245 }
1246 size.add_bool(2, this->disabled_by_default);
1247#ifdef USE_ENTITY_ICON
1248 size.add_length(2, this->icon_ref_.size());
1249#endif
1250 size.add_uint32(2, static_cast<uint32_t>(this->entity_category));
1252 size.add_bool(2, this->supports_current_humidity);
1253 size.add_bool(2, this->supports_target_humidity);
1254 size.add_float(2, this->visual_min_humidity);
1255 size.add_float(2, this->visual_max_humidity);
1256#ifdef USE_DEVICES
1257 size.add_uint32(2, this->device_id);
1258#endif
1259 size.add_uint32(2, this->feature_flags);
1260}
1262 buffer.encode_fixed32(1, this->key);
1263 buffer.encode_uint32(2, static_cast<uint32_t>(this->mode));
1264 buffer.encode_float(3, this->current_temperature);
1265 buffer.encode_float(4, this->target_temperature);
1266 buffer.encode_float(5, this->target_temperature_low);
1267 buffer.encode_float(6, this->target_temperature_high);
1268 buffer.encode_uint32(8, static_cast<uint32_t>(this->action));
1269 buffer.encode_uint32(9, static_cast<uint32_t>(this->fan_mode));
1270 buffer.encode_uint32(10, static_cast<uint32_t>(this->swing_mode));
1271 buffer.encode_string(11, this->custom_fan_mode_ref_);
1272 buffer.encode_uint32(12, static_cast<uint32_t>(this->preset));
1273 buffer.encode_string(13, this->custom_preset_ref_);
1274 buffer.encode_float(14, this->current_humidity);
1275 buffer.encode_float(15, this->target_humidity);
1276#ifdef USE_DEVICES
1277 buffer.encode_uint32(16, this->device_id);
1278#endif
1279}
1281 size.add_fixed32(1, this->key);
1282 size.add_uint32(1, static_cast<uint32_t>(this->mode));
1283 size.add_float(1, this->current_temperature);
1284 size.add_float(1, this->target_temperature);
1285 size.add_float(1, this->target_temperature_low);
1286 size.add_float(1, this->target_temperature_high);
1287 size.add_uint32(1, static_cast<uint32_t>(this->action));
1288 size.add_uint32(1, static_cast<uint32_t>(this->fan_mode));
1289 size.add_uint32(1, static_cast<uint32_t>(this->swing_mode));
1290 size.add_length(1, this->custom_fan_mode_ref_.size());
1291 size.add_uint32(1, static_cast<uint32_t>(this->preset));
1292 size.add_length(1, this->custom_preset_ref_.size());
1293 size.add_float(1, this->current_humidity);
1294 size.add_float(1, this->target_humidity);
1295#ifdef USE_DEVICES
1296 size.add_uint32(2, this->device_id);
1297#endif
1298}
1300 switch (field_id) {
1301 case 2:
1302 this->has_mode = value.as_bool();
1303 break;
1304 case 3:
1305 this->mode = static_cast<enums::ClimateMode>(value.as_uint32());
1306 break;
1307 case 4:
1308 this->has_target_temperature = value.as_bool();
1309 break;
1310 case 6:
1311 this->has_target_temperature_low = value.as_bool();
1312 break;
1313 case 8:
1314 this->has_target_temperature_high = value.as_bool();
1315 break;
1316 case 12:
1317 this->has_fan_mode = value.as_bool();
1318 break;
1319 case 13:
1320 this->fan_mode = static_cast<enums::ClimateFanMode>(value.as_uint32());
1321 break;
1322 case 14:
1323 this->has_swing_mode = value.as_bool();
1324 break;
1325 case 15:
1326 this->swing_mode = static_cast<enums::ClimateSwingMode>(value.as_uint32());
1327 break;
1328 case 16:
1329 this->has_custom_fan_mode = value.as_bool();
1330 break;
1331 case 18:
1332 this->has_preset = value.as_bool();
1333 break;
1334 case 19:
1335 this->preset = static_cast<enums::ClimatePreset>(value.as_uint32());
1336 break;
1337 case 20:
1338 this->has_custom_preset = value.as_bool();
1339 break;
1340 case 22:
1341 this->has_target_humidity = value.as_bool();
1342 break;
1343#ifdef USE_DEVICES
1344 case 24:
1345 this->device_id = value.as_uint32();
1346 break;
1347#endif
1348 default:
1349 return false;
1350 }
1351 return true;
1352}
1354 switch (field_id) {
1355 case 17:
1356 this->custom_fan_mode = value.as_string();
1357 break;
1358 case 21:
1359 this->custom_preset = value.as_string();
1360 break;
1361 default:
1362 return false;
1363 }
1364 return true;
1365}
1366bool ClimateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1367 switch (field_id) {
1368 case 1:
1369 this->key = value.as_fixed32();
1370 break;
1371 case 5:
1372 this->target_temperature = value.as_float();
1373 break;
1374 case 7:
1375 this->target_temperature_low = value.as_float();
1376 break;
1377 case 9:
1378 this->target_temperature_high = value.as_float();
1379 break;
1380 case 23:
1381 this->target_humidity = value.as_float();
1382 break;
1383 default:
1384 return false;
1385 }
1386 return true;
1387}
1388#endif
1389#ifdef USE_NUMBER
1391 buffer.encode_string(1, this->object_id_ref_);
1392 buffer.encode_fixed32(2, this->key);
1393 buffer.encode_string(3, this->name_ref_);
1394#ifdef USE_ENTITY_ICON
1395 buffer.encode_string(5, this->icon_ref_);
1396#endif
1397 buffer.encode_float(6, this->min_value);
1398 buffer.encode_float(7, this->max_value);
1399 buffer.encode_float(8, this->step);
1400 buffer.encode_bool(9, this->disabled_by_default);
1401 buffer.encode_uint32(10, static_cast<uint32_t>(this->entity_category));
1402 buffer.encode_string(11, this->unit_of_measurement_ref_);
1403 buffer.encode_uint32(12, static_cast<uint32_t>(this->mode));
1404 buffer.encode_string(13, this->device_class_ref_);
1405#ifdef USE_DEVICES
1406 buffer.encode_uint32(14, this->device_id);
1407#endif
1408}
1410 size.add_length(1, this->object_id_ref_.size());
1411 size.add_fixed32(1, this->key);
1412 size.add_length(1, this->name_ref_.size());
1413#ifdef USE_ENTITY_ICON
1414 size.add_length(1, this->icon_ref_.size());
1415#endif
1416 size.add_float(1, this->min_value);
1417 size.add_float(1, this->max_value);
1418 size.add_float(1, this->step);
1419 size.add_bool(1, this->disabled_by_default);
1420 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1421 size.add_length(1, this->unit_of_measurement_ref_.size());
1422 size.add_uint32(1, static_cast<uint32_t>(this->mode));
1423 size.add_length(1, this->device_class_ref_.size());
1424#ifdef USE_DEVICES
1425 size.add_uint32(1, this->device_id);
1426#endif
1427}
1429 buffer.encode_fixed32(1, this->key);
1430 buffer.encode_float(2, this->state);
1431 buffer.encode_bool(3, this->missing_state);
1432#ifdef USE_DEVICES
1433 buffer.encode_uint32(4, this->device_id);
1434#endif
1435}
1437 size.add_fixed32(1, this->key);
1438 size.add_float(1, this->state);
1439 size.add_bool(1, this->missing_state);
1440#ifdef USE_DEVICES
1441 size.add_uint32(1, this->device_id);
1442#endif
1443}
1444bool NumberCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1445 switch (field_id) {
1446#ifdef USE_DEVICES
1447 case 3:
1448 this->device_id = value.as_uint32();
1449 break;
1450#endif
1451 default:
1452 return false;
1453 }
1454 return true;
1455}
1456bool NumberCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1457 switch (field_id) {
1458 case 1:
1459 this->key = value.as_fixed32();
1460 break;
1461 case 2:
1462 this->state = value.as_float();
1463 break;
1464 default:
1465 return false;
1466 }
1467 return true;
1468}
1469#endif
1470#ifdef USE_SELECT
1472 buffer.encode_string(1, this->object_id_ref_);
1473 buffer.encode_fixed32(2, this->key);
1474 buffer.encode_string(3, this->name_ref_);
1475#ifdef USE_ENTITY_ICON
1476 buffer.encode_string(5, this->icon_ref_);
1477#endif
1478 for (const char *it : *this->options) {
1479 buffer.encode_string(6, it, strlen(it), true);
1480 }
1481 buffer.encode_bool(7, this->disabled_by_default);
1482 buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
1483#ifdef USE_DEVICES
1484 buffer.encode_uint32(9, this->device_id);
1485#endif
1486}
1488 size.add_length(1, this->object_id_ref_.size());
1489 size.add_fixed32(1, this->key);
1490 size.add_length(1, this->name_ref_.size());
1491#ifdef USE_ENTITY_ICON
1492 size.add_length(1, this->icon_ref_.size());
1493#endif
1494 if (!this->options->empty()) {
1495 for (const char *it : *this->options) {
1496 size.add_length_force(1, strlen(it));
1497 }
1498 }
1499 size.add_bool(1, this->disabled_by_default);
1500 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1501#ifdef USE_DEVICES
1502 size.add_uint32(1, this->device_id);
1503#endif
1504}
1506 buffer.encode_fixed32(1, this->key);
1507 buffer.encode_string(2, this->state_ref_);
1508 buffer.encode_bool(3, this->missing_state);
1509#ifdef USE_DEVICES
1510 buffer.encode_uint32(4, this->device_id);
1511#endif
1512}
1514 size.add_fixed32(1, this->key);
1515 size.add_length(1, this->state_ref_.size());
1516 size.add_bool(1, this->missing_state);
1517#ifdef USE_DEVICES
1518 size.add_uint32(1, this->device_id);
1519#endif
1520}
1521bool SelectCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1522 switch (field_id) {
1523#ifdef USE_DEVICES
1524 case 3:
1525 this->device_id = value.as_uint32();
1526 break;
1527#endif
1528 default:
1529 return false;
1530 }
1531 return true;
1532}
1534 switch (field_id) {
1535 case 2:
1536 this->state = value.as_string();
1537 break;
1538 default:
1539 return false;
1540 }
1541 return true;
1542}
1543bool SelectCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1544 switch (field_id) {
1545 case 1:
1546 this->key = value.as_fixed32();
1547 break;
1548 default:
1549 return false;
1550 }
1551 return true;
1552}
1553#endif
1554#ifdef USE_SIREN
1556 buffer.encode_string(1, this->object_id_ref_);
1557 buffer.encode_fixed32(2, this->key);
1558 buffer.encode_string(3, this->name_ref_);
1559#ifdef USE_ENTITY_ICON
1560 buffer.encode_string(5, this->icon_ref_);
1561#endif
1562 buffer.encode_bool(6, this->disabled_by_default);
1563 for (auto &it : this->tones) {
1564 buffer.encode_string(7, it, true);
1565 }
1566 buffer.encode_bool(8, this->supports_duration);
1567 buffer.encode_bool(9, this->supports_volume);
1568 buffer.encode_uint32(10, static_cast<uint32_t>(this->entity_category));
1569#ifdef USE_DEVICES
1570 buffer.encode_uint32(11, this->device_id);
1571#endif
1572}
1574 size.add_length(1, this->object_id_ref_.size());
1575 size.add_fixed32(1, this->key);
1576 size.add_length(1, this->name_ref_.size());
1577#ifdef USE_ENTITY_ICON
1578 size.add_length(1, this->icon_ref_.size());
1579#endif
1580 size.add_bool(1, this->disabled_by_default);
1581 if (!this->tones.empty()) {
1582 for (const auto &it : this->tones) {
1583 size.add_length_force(1, it.size());
1584 }
1585 }
1586 size.add_bool(1, this->supports_duration);
1587 size.add_bool(1, this->supports_volume);
1588 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1589#ifdef USE_DEVICES
1590 size.add_uint32(1, this->device_id);
1591#endif
1592}
1594 buffer.encode_fixed32(1, this->key);
1595 buffer.encode_bool(2, this->state);
1596#ifdef USE_DEVICES
1597 buffer.encode_uint32(3, this->device_id);
1598#endif
1599}
1601 size.add_fixed32(1, this->key);
1602 size.add_bool(1, this->state);
1603#ifdef USE_DEVICES
1604 size.add_uint32(1, this->device_id);
1605#endif
1606}
1607bool SirenCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1608 switch (field_id) {
1609 case 2:
1610 this->has_state = value.as_bool();
1611 break;
1612 case 3:
1613 this->state = value.as_bool();
1614 break;
1615 case 4:
1616 this->has_tone = value.as_bool();
1617 break;
1618 case 6:
1619 this->has_duration = value.as_bool();
1620 break;
1621 case 7:
1622 this->duration = value.as_uint32();
1623 break;
1624 case 8:
1625 this->has_volume = value.as_bool();
1626 break;
1627#ifdef USE_DEVICES
1628 case 10:
1629 this->device_id = value.as_uint32();
1630 break;
1631#endif
1632 default:
1633 return false;
1634 }
1635 return true;
1636}
1638 switch (field_id) {
1639 case 5:
1640 this->tone = value.as_string();
1641 break;
1642 default:
1643 return false;
1644 }
1645 return true;
1646}
1647bool SirenCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1648 switch (field_id) {
1649 case 1:
1650 this->key = value.as_fixed32();
1651 break;
1652 case 9:
1653 this->volume = value.as_float();
1654 break;
1655 default:
1656 return false;
1657 }
1658 return true;
1659}
1660#endif
1661#ifdef USE_LOCK
1663 buffer.encode_string(1, this->object_id_ref_);
1664 buffer.encode_fixed32(2, this->key);
1665 buffer.encode_string(3, this->name_ref_);
1666#ifdef USE_ENTITY_ICON
1667 buffer.encode_string(5, this->icon_ref_);
1668#endif
1669 buffer.encode_bool(6, this->disabled_by_default);
1670 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1671 buffer.encode_bool(8, this->assumed_state);
1672 buffer.encode_bool(9, this->supports_open);
1673 buffer.encode_bool(10, this->requires_code);
1674 buffer.encode_string(11, this->code_format_ref_);
1675#ifdef USE_DEVICES
1676 buffer.encode_uint32(12, this->device_id);
1677#endif
1678}
1680 size.add_length(1, this->object_id_ref_.size());
1681 size.add_fixed32(1, this->key);
1682 size.add_length(1, this->name_ref_.size());
1683#ifdef USE_ENTITY_ICON
1684 size.add_length(1, this->icon_ref_.size());
1685#endif
1686 size.add_bool(1, this->disabled_by_default);
1687 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1688 size.add_bool(1, this->assumed_state);
1689 size.add_bool(1, this->supports_open);
1690 size.add_bool(1, this->requires_code);
1691 size.add_length(1, this->code_format_ref_.size());
1692#ifdef USE_DEVICES
1693 size.add_uint32(1, this->device_id);
1694#endif
1695}
1697 buffer.encode_fixed32(1, this->key);
1698 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
1699#ifdef USE_DEVICES
1700 buffer.encode_uint32(3, this->device_id);
1701#endif
1702}
1704 size.add_fixed32(1, this->key);
1705 size.add_uint32(1, static_cast<uint32_t>(this->state));
1706#ifdef USE_DEVICES
1707 size.add_uint32(1, this->device_id);
1708#endif
1709}
1710bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1711 switch (field_id) {
1712 case 2:
1713 this->command = static_cast<enums::LockCommand>(value.as_uint32());
1714 break;
1715 case 3:
1716 this->has_code = value.as_bool();
1717 break;
1718#ifdef USE_DEVICES
1719 case 5:
1720 this->device_id = value.as_uint32();
1721 break;
1722#endif
1723 default:
1724 return false;
1725 }
1726 return true;
1727}
1729 switch (field_id) {
1730 case 4:
1731 this->code = value.as_string();
1732 break;
1733 default:
1734 return false;
1735 }
1736 return true;
1737}
1738bool LockCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1739 switch (field_id) {
1740 case 1:
1741 this->key = value.as_fixed32();
1742 break;
1743 default:
1744 return false;
1745 }
1746 return true;
1747}
1748#endif
1749#ifdef USE_BUTTON
1751 buffer.encode_string(1, this->object_id_ref_);
1752 buffer.encode_fixed32(2, this->key);
1753 buffer.encode_string(3, this->name_ref_);
1754#ifdef USE_ENTITY_ICON
1755 buffer.encode_string(5, this->icon_ref_);
1756#endif
1757 buffer.encode_bool(6, this->disabled_by_default);
1758 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1759 buffer.encode_string(8, this->device_class_ref_);
1760#ifdef USE_DEVICES
1761 buffer.encode_uint32(9, this->device_id);
1762#endif
1763}
1765 size.add_length(1, this->object_id_ref_.size());
1766 size.add_fixed32(1, this->key);
1767 size.add_length(1, this->name_ref_.size());
1768#ifdef USE_ENTITY_ICON
1769 size.add_length(1, this->icon_ref_.size());
1770#endif
1771 size.add_bool(1, this->disabled_by_default);
1772 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1773 size.add_length(1, this->device_class_ref_.size());
1774#ifdef USE_DEVICES
1775 size.add_uint32(1, this->device_id);
1776#endif
1777}
1778bool ButtonCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1779 switch (field_id) {
1780#ifdef USE_DEVICES
1781 case 2:
1782 this->device_id = value.as_uint32();
1783 break;
1784#endif
1785 default:
1786 return false;
1787 }
1788 return true;
1789}
1790bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1791 switch (field_id) {
1792 case 1:
1793 this->key = value.as_fixed32();
1794 break;
1795 default:
1796 return false;
1797 }
1798 return true;
1799}
1800#endif
1801#ifdef USE_MEDIA_PLAYER
1803 buffer.encode_string(1, this->format_ref_);
1804 buffer.encode_uint32(2, this->sample_rate);
1805 buffer.encode_uint32(3, this->num_channels);
1806 buffer.encode_uint32(4, static_cast<uint32_t>(this->purpose));
1807 buffer.encode_uint32(5, this->sample_bytes);
1808}
1810 size.add_length(1, this->format_ref_.size());
1811 size.add_uint32(1, this->sample_rate);
1812 size.add_uint32(1, this->num_channels);
1813 size.add_uint32(1, static_cast<uint32_t>(this->purpose));
1814 size.add_uint32(1, this->sample_bytes);
1815}
1817 buffer.encode_string(1, this->object_id_ref_);
1818 buffer.encode_fixed32(2, this->key);
1819 buffer.encode_string(3, this->name_ref_);
1820#ifdef USE_ENTITY_ICON
1821 buffer.encode_string(5, this->icon_ref_);
1822#endif
1823 buffer.encode_bool(6, this->disabled_by_default);
1824 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1825 buffer.encode_bool(8, this->supports_pause);
1826 for (auto &it : this->supported_formats) {
1827 buffer.encode_message(9, it, true);
1828 }
1829#ifdef USE_DEVICES
1830 buffer.encode_uint32(10, this->device_id);
1831#endif
1832 buffer.encode_uint32(11, this->feature_flags);
1833}
1835 size.add_length(1, this->object_id_ref_.size());
1836 size.add_fixed32(1, this->key);
1837 size.add_length(1, this->name_ref_.size());
1838#ifdef USE_ENTITY_ICON
1839 size.add_length(1, this->icon_ref_.size());
1840#endif
1841 size.add_bool(1, this->disabled_by_default);
1842 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1843 size.add_bool(1, this->supports_pause);
1845#ifdef USE_DEVICES
1846 size.add_uint32(1, this->device_id);
1847#endif
1848 size.add_uint32(1, this->feature_flags);
1849}
1851 buffer.encode_fixed32(1, this->key);
1852 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
1853 buffer.encode_float(3, this->volume);
1854 buffer.encode_bool(4, this->muted);
1855#ifdef USE_DEVICES
1856 buffer.encode_uint32(5, this->device_id);
1857#endif
1858}
1860 size.add_fixed32(1, this->key);
1861 size.add_uint32(1, static_cast<uint32_t>(this->state));
1862 size.add_float(1, this->volume);
1863 size.add_bool(1, this->muted);
1864#ifdef USE_DEVICES
1865 size.add_uint32(1, this->device_id);
1866#endif
1867}
1869 switch (field_id) {
1870 case 2:
1871 this->has_command = value.as_bool();
1872 break;
1873 case 3:
1874 this->command = static_cast<enums::MediaPlayerCommand>(value.as_uint32());
1875 break;
1876 case 4:
1877 this->has_volume = value.as_bool();
1878 break;
1879 case 6:
1880 this->has_media_url = value.as_bool();
1881 break;
1882 case 8:
1883 this->has_announcement = value.as_bool();
1884 break;
1885 case 9:
1886 this->announcement = value.as_bool();
1887 break;
1888#ifdef USE_DEVICES
1889 case 10:
1890 this->device_id = value.as_uint32();
1891 break;
1892#endif
1893 default:
1894 return false;
1895 }
1896 return true;
1897}
1899 switch (field_id) {
1900 case 7:
1901 this->media_url = value.as_string();
1902 break;
1903 default:
1904 return false;
1905 }
1906 return true;
1907}
1909 switch (field_id) {
1910 case 1:
1911 this->key = value.as_fixed32();
1912 break;
1913 case 5:
1914 this->volume = value.as_float();
1915 break;
1916 default:
1917 return false;
1918 }
1919 return true;
1920}
1921#endif
1922#ifdef USE_BLUETOOTH_PROXY
1924 switch (field_id) {
1925 case 1:
1926 this->flags = value.as_uint32();
1927 break;
1928 default:
1929 return false;
1930 }
1931 return true;
1932}
1934 buffer.encode_uint64(1, this->address);
1935 buffer.encode_sint32(2, this->rssi);
1936 buffer.encode_uint32(3, this->address_type);
1937 buffer.encode_bytes(4, this->data, this->data_len);
1938}
1940 size.add_uint64(1, this->address);
1941 size.add_sint32(1, this->rssi);
1942 size.add_uint32(1, this->address_type);
1943 size.add_length(1, this->data_len);
1944}
1946 for (uint16_t i = 0; i < this->advertisements_len; i++) {
1947 buffer.encode_message(1, this->advertisements[i], true);
1948 }
1949}
1951 for (uint16_t i = 0; i < this->advertisements_len; i++) {
1952 size.add_message_object_force(1, this->advertisements[i]);
1953 }
1954}
1956 switch (field_id) {
1957 case 1:
1958 this->address = value.as_uint64();
1959 break;
1960 case 2:
1961 this->request_type = static_cast<enums::BluetoothDeviceRequestType>(value.as_uint32());
1962 break;
1963 case 3:
1964 this->has_address_type = value.as_bool();
1965 break;
1966 case 4:
1967 this->address_type = value.as_uint32();
1968 break;
1969 default:
1970 return false;
1971 }
1972 return true;
1973}
1975 buffer.encode_uint64(1, this->address);
1976 buffer.encode_bool(2, this->connected);
1977 buffer.encode_uint32(3, this->mtu);
1978 buffer.encode_int32(4, this->error);
1979}
1981 size.add_uint64(1, this->address);
1982 size.add_bool(1, this->connected);
1983 size.add_uint32(1, this->mtu);
1984 size.add_int32(1, this->error);
1985}
1987 switch (field_id) {
1988 case 1:
1989 this->address = value.as_uint64();
1990 break;
1991 default:
1992 return false;
1993 }
1994 return true;
1995}
1997 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
1998 buffer.encode_uint64(1, this->uuid[0], true);
1999 buffer.encode_uint64(1, this->uuid[1], true);
2000 }
2001 buffer.encode_uint32(2, this->handle);
2002 buffer.encode_uint32(3, this->short_uuid);
2003}
2005 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2006 size.add_uint64_force(1, this->uuid[0]);
2007 size.add_uint64_force(1, this->uuid[1]);
2008 }
2009 size.add_uint32(1, this->handle);
2010 size.add_uint32(1, this->short_uuid);
2011}
2013 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2014 buffer.encode_uint64(1, this->uuid[0], true);
2015 buffer.encode_uint64(1, this->uuid[1], true);
2016 }
2017 buffer.encode_uint32(2, this->handle);
2018 buffer.encode_uint32(3, this->properties);
2019 for (auto &it : this->descriptors) {
2020 buffer.encode_message(4, it, true);
2021 }
2022 buffer.encode_uint32(5, this->short_uuid);
2023}
2025 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2026 size.add_uint64_force(1, this->uuid[0]);
2027 size.add_uint64_force(1, this->uuid[1]);
2028 }
2029 size.add_uint32(1, this->handle);
2030 size.add_uint32(1, this->properties);
2031 size.add_repeated_message(1, this->descriptors);
2032 size.add_uint32(1, this->short_uuid);
2033}
2035 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2036 buffer.encode_uint64(1, this->uuid[0], true);
2037 buffer.encode_uint64(1, this->uuid[1], true);
2038 }
2039 buffer.encode_uint32(2, this->handle);
2040 for (auto &it : this->characteristics) {
2041 buffer.encode_message(3, it, true);
2042 }
2043 buffer.encode_uint32(4, this->short_uuid);
2044}
2046 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2047 size.add_uint64_force(1, this->uuid[0]);
2048 size.add_uint64_force(1, this->uuid[1]);
2049 }
2050 size.add_uint32(1, this->handle);
2052 size.add_uint32(1, this->short_uuid);
2053}
2055 buffer.encode_uint64(1, this->address);
2056 for (auto &it : this->services) {
2057 buffer.encode_message(2, it, true);
2058 }
2059}
2061 size.add_uint64(1, this->address);
2062 size.add_repeated_message(1, this->services);
2063}
2069 switch (field_id) {
2070 case 1:
2071 this->address = value.as_uint64();
2072 break;
2073 case 2:
2074 this->handle = value.as_uint32();
2075 break;
2076 default:
2077 return false;
2078 }
2079 return true;
2080}
2082 buffer.encode_uint64(1, this->address);
2083 buffer.encode_uint32(2, this->handle);
2084 buffer.encode_bytes(3, this->data_ptr_, this->data_len_);
2085}
2087 size.add_uint64(1, this->address);
2088 size.add_uint32(1, this->handle);
2089 size.add_length(1, this->data_len_);
2090}
2092 switch (field_id) {
2093 case 1:
2094 this->address = value.as_uint64();
2095 break;
2096 case 2:
2097 this->handle = value.as_uint32();
2098 break;
2099 case 3:
2100 this->response = value.as_bool();
2101 break;
2102 default:
2103 return false;
2104 }
2105 return true;
2106}
2108 switch (field_id) {
2109 case 4: {
2110 // Use raw data directly to avoid allocation
2111 this->data = value.data();
2112 this->data_len = value.size();
2113 break;
2114 }
2115 default:
2116 return false;
2117 }
2118 return true;
2119}
2121 switch (field_id) {
2122 case 1:
2123 this->address = value.as_uint64();
2124 break;
2125 case 2:
2126 this->handle = value.as_uint32();
2127 break;
2128 default:
2129 return false;
2130 }
2131 return true;
2132}
2134 switch (field_id) {
2135 case 1:
2136 this->address = value.as_uint64();
2137 break;
2138 case 2:
2139 this->handle = value.as_uint32();
2140 break;
2141 default:
2142 return false;
2143 }
2144 return true;
2145}
2147 switch (field_id) {
2148 case 3: {
2149 // Use raw data directly to avoid allocation
2150 this->data = value.data();
2151 this->data_len = value.size();
2152 break;
2153 }
2154 default:
2155 return false;
2156 }
2157 return true;
2158}
2160 switch (field_id) {
2161 case 1:
2162 this->address = value.as_uint64();
2163 break;
2164 case 2:
2165 this->handle = value.as_uint32();
2166 break;
2167 case 3:
2168 this->enable = value.as_bool();
2169 break;
2170 default:
2171 return false;
2172 }
2173 return true;
2174}
2176 buffer.encode_uint64(1, this->address);
2177 buffer.encode_uint32(2, this->handle);
2178 buffer.encode_bytes(3, this->data_ptr_, this->data_len_);
2179}
2181 size.add_uint64(1, this->address);
2182 size.add_uint32(1, this->handle);
2183 size.add_length(1, this->data_len_);
2184}
2186 buffer.encode_uint32(1, this->free);
2187 buffer.encode_uint32(2, this->limit);
2188 for (const auto &it : this->allocated) {
2189 if (it != 0) {
2190 buffer.encode_uint64(3, it, true);
2191 }
2192 }
2193}
2195 size.add_uint32(1, this->free);
2196 size.add_uint32(1, this->limit);
2197 for (const auto &it : this->allocated) {
2198 if (it != 0) {
2199 size.add_uint64_force(1, it);
2200 }
2201 }
2202}
2204 buffer.encode_uint64(1, this->address);
2205 buffer.encode_uint32(2, this->handle);
2206 buffer.encode_int32(3, this->error);
2207}
2209 size.add_uint64(1, this->address);
2210 size.add_uint32(1, this->handle);
2211 size.add_int32(1, this->error);
2212}
2214 buffer.encode_uint64(1, this->address);
2215 buffer.encode_uint32(2, this->handle);
2216}
2218 size.add_uint64(1, this->address);
2219 size.add_uint32(1, this->handle);
2220}
2222 buffer.encode_uint64(1, this->address);
2223 buffer.encode_uint32(2, this->handle);
2224}
2226 size.add_uint64(1, this->address);
2227 size.add_uint32(1, this->handle);
2228}
2230 buffer.encode_uint64(1, this->address);
2231 buffer.encode_bool(2, this->paired);
2232 buffer.encode_int32(3, this->error);
2233}
2235 size.add_uint64(1, this->address);
2236 size.add_bool(1, this->paired);
2237 size.add_int32(1, this->error);
2238}
2240 buffer.encode_uint64(1, this->address);
2241 buffer.encode_bool(2, this->success);
2242 buffer.encode_int32(3, this->error);
2243}
2245 size.add_uint64(1, this->address);
2246 size.add_bool(1, this->success);
2247 size.add_int32(1, this->error);
2248}
2250 buffer.encode_uint64(1, this->address);
2251 buffer.encode_bool(2, this->success);
2252 buffer.encode_int32(3, this->error);
2253}
2255 size.add_uint64(1, this->address);
2256 size.add_bool(1, this->success);
2257 size.add_int32(1, this->error);
2258}
2260 buffer.encode_uint32(1, static_cast<uint32_t>(this->state));
2261 buffer.encode_uint32(2, static_cast<uint32_t>(this->mode));
2262 buffer.encode_uint32(3, static_cast<uint32_t>(this->configured_mode));
2263}
2265 size.add_uint32(1, static_cast<uint32_t>(this->state));
2266 size.add_uint32(1, static_cast<uint32_t>(this->mode));
2267 size.add_uint32(1, static_cast<uint32_t>(this->configured_mode));
2268}
2270 switch (field_id) {
2271 case 1:
2272 this->mode = static_cast<enums::BluetoothScannerMode>(value.as_uint32());
2273 break;
2274 default:
2275 return false;
2276 }
2277 return true;
2278}
2279#endif
2280#ifdef USE_VOICE_ASSISTANT
2282 switch (field_id) {
2283 case 1:
2284 this->subscribe = value.as_bool();
2285 break;
2286 case 2:
2287 this->flags = value.as_uint32();
2288 break;
2289 default:
2290 return false;
2291 }
2292 return true;
2293}
2295 buffer.encode_uint32(1, this->noise_suppression_level);
2296 buffer.encode_uint32(2, this->auto_gain);
2297 buffer.encode_float(3, this->volume_multiplier);
2298}
2300 size.add_uint32(1, this->noise_suppression_level);
2301 size.add_uint32(1, this->auto_gain);
2302 size.add_float(1, this->volume_multiplier);
2303}
2305 buffer.encode_bool(1, this->start);
2306 buffer.encode_string(2, this->conversation_id_ref_);
2307 buffer.encode_uint32(3, this->flags);
2308 buffer.encode_message(4, this->audio_settings);
2309 buffer.encode_string(5, this->wake_word_phrase_ref_);
2310}
2312 size.add_bool(1, this->start);
2313 size.add_length(1, this->conversation_id_ref_.size());
2314 size.add_uint32(1, this->flags);
2315 size.add_message_object(1, this->audio_settings);
2316 size.add_length(1, this->wake_word_phrase_ref_.size());
2317}
2319 switch (field_id) {
2320 case 1:
2321 this->port = value.as_uint32();
2322 break;
2323 case 2:
2324 this->error = value.as_bool();
2325 break;
2326 default:
2327 return false;
2328 }
2329 return true;
2330}
2332 switch (field_id) {
2333 case 1:
2334 this->name = value.as_string();
2335 break;
2336 case 2:
2337 this->value = value.as_string();
2338 break;
2339 default:
2340 return false;
2341 }
2342 return true;
2343}
2345 switch (field_id) {
2346 case 1:
2347 this->event_type = static_cast<enums::VoiceAssistantEvent>(value.as_uint32());
2348 break;
2349 default:
2350 return false;
2351 }
2352 return true;
2353}
2355 switch (field_id) {
2356 case 2:
2357 this->data.emplace_back();
2358 value.decode_to_message(this->data.back());
2359 break;
2360 default:
2361 return false;
2362 }
2363 return true;
2364}
2365bool VoiceAssistantAudio::decode_varint(uint32_t field_id, ProtoVarInt value) {
2366 switch (field_id) {
2367 case 2:
2368 this->end = value.as_bool();
2369 break;
2370 default:
2371 return false;
2372 }
2373 return true;
2374}
2376 switch (field_id) {
2377 case 1:
2378 this->data = value.as_string();
2379 break;
2380 default:
2381 return false;
2382 }
2383 return true;
2384}
2386 buffer.encode_bytes(1, this->data_ptr_, this->data_len_);
2387 buffer.encode_bool(2, this->end);
2388}
2390 size.add_length(1, this->data_len_);
2391 size.add_bool(1, this->end);
2392}
2394 switch (field_id) {
2395 case 1:
2396 this->event_type = static_cast<enums::VoiceAssistantTimerEvent>(value.as_uint32());
2397 break;
2398 case 4:
2399 this->total_seconds = value.as_uint32();
2400 break;
2401 case 5:
2402 this->seconds_left = value.as_uint32();
2403 break;
2404 case 6:
2405 this->is_active = value.as_bool();
2406 break;
2407 default:
2408 return false;
2409 }
2410 return true;
2411}
2413 switch (field_id) {
2414 case 2:
2415 this->timer_id = value.as_string();
2416 break;
2417 case 3:
2418 this->name = value.as_string();
2419 break;
2420 default:
2421 return false;
2422 }
2423 return true;
2424}
2426 switch (field_id) {
2427 case 4:
2428 this->start_conversation = value.as_bool();
2429 break;
2430 default:
2431 return false;
2432 }
2433 return true;
2434}
2436 switch (field_id) {
2437 case 1:
2438 this->media_id = value.as_string();
2439 break;
2440 case 2:
2441 this->text = value.as_string();
2442 break;
2443 case 3:
2444 this->preannounce_media_id = value.as_string();
2445 break;
2446 default:
2447 return false;
2448 }
2449 return true;
2450}
2454 buffer.encode_string(1, this->id_ref_);
2455 buffer.encode_string(2, this->wake_word_ref_);
2456 for (auto &it : this->trained_languages) {
2457 buffer.encode_string(3, it, true);
2458 }
2459}
2461 size.add_length(1, this->id_ref_.size());
2462 size.add_length(1, this->wake_word_ref_.size());
2463 if (!this->trained_languages.empty()) {
2464 for (const auto &it : this->trained_languages) {
2465 size.add_length_force(1, it.size());
2466 }
2467 }
2468}
2470 switch (field_id) {
2471 case 5:
2472 this->model_size = value.as_uint32();
2473 break;
2474 default:
2475 return false;
2476 }
2477 return true;
2478}
2480 switch (field_id) {
2481 case 1:
2482 this->id = value.as_string();
2483 break;
2484 case 2:
2485 this->wake_word = value.as_string();
2486 break;
2487 case 3:
2488 this->trained_languages.push_back(value.as_string());
2489 break;
2490 case 4:
2491 this->model_type = value.as_string();
2492 break;
2493 case 6:
2494 this->model_hash = value.as_string();
2495 break;
2496 case 7:
2497 this->url = value.as_string();
2498 break;
2499 default:
2500 return false;
2501 }
2502 return true;
2503}
2505 switch (field_id) {
2506 case 1:
2507 this->external_wake_words.emplace_back();
2508 value.decode_to_message(this->external_wake_words.back());
2509 break;
2510 default:
2511 return false;
2512 }
2513 return true;
2514}
2516 for (auto &it : this->available_wake_words) {
2517 buffer.encode_message(1, it, true);
2518 }
2519 for (const auto &it : *this->active_wake_words) {
2520 buffer.encode_string(2, it, true);
2521 }
2522 buffer.encode_uint32(3, this->max_active_wake_words);
2523}
2526 if (!this->active_wake_words->empty()) {
2527 for (const auto &it : *this->active_wake_words) {
2528 size.add_length_force(1, it.size());
2529 }
2530 }
2531 size.add_uint32(1, this->max_active_wake_words);
2532}
2534 switch (field_id) {
2535 case 1:
2536 this->active_wake_words.push_back(value.as_string());
2537 break;
2538 default:
2539 return false;
2540 }
2541 return true;
2542}
2543#endif
2544#ifdef USE_ALARM_CONTROL_PANEL
2546 buffer.encode_string(1, this->object_id_ref_);
2547 buffer.encode_fixed32(2, this->key);
2548 buffer.encode_string(3, this->name_ref_);
2549#ifdef USE_ENTITY_ICON
2550 buffer.encode_string(5, this->icon_ref_);
2551#endif
2552 buffer.encode_bool(6, this->disabled_by_default);
2553 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2554 buffer.encode_uint32(8, this->supported_features);
2555 buffer.encode_bool(9, this->requires_code);
2556 buffer.encode_bool(10, this->requires_code_to_arm);
2557#ifdef USE_DEVICES
2558 buffer.encode_uint32(11, this->device_id);
2559#endif
2560}
2562 size.add_length(1, this->object_id_ref_.size());
2563 size.add_fixed32(1, this->key);
2564 size.add_length(1, this->name_ref_.size());
2565#ifdef USE_ENTITY_ICON
2566 size.add_length(1, this->icon_ref_.size());
2567#endif
2568 size.add_bool(1, this->disabled_by_default);
2569 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2570 size.add_uint32(1, this->supported_features);
2571 size.add_bool(1, this->requires_code);
2572 size.add_bool(1, this->requires_code_to_arm);
2573#ifdef USE_DEVICES
2574 size.add_uint32(1, this->device_id);
2575#endif
2576}
2578 buffer.encode_fixed32(1, this->key);
2579 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
2580#ifdef USE_DEVICES
2581 buffer.encode_uint32(3, this->device_id);
2582#endif
2583}
2585 size.add_fixed32(1, this->key);
2586 size.add_uint32(1, static_cast<uint32_t>(this->state));
2587#ifdef USE_DEVICES
2588 size.add_uint32(1, this->device_id);
2589#endif
2590}
2592 switch (field_id) {
2593 case 2:
2594 this->command = static_cast<enums::AlarmControlPanelStateCommand>(value.as_uint32());
2595 break;
2596#ifdef USE_DEVICES
2597 case 4:
2598 this->device_id = value.as_uint32();
2599 break;
2600#endif
2601 default:
2602 return false;
2603 }
2604 return true;
2605}
2607 switch (field_id) {
2608 case 3:
2609 this->code = value.as_string();
2610 break;
2611 default:
2612 return false;
2613 }
2614 return true;
2615}
2617 switch (field_id) {
2618 case 1:
2619 this->key = value.as_fixed32();
2620 break;
2621 default:
2622 return false;
2623 }
2624 return true;
2625}
2626#endif
2627#ifdef USE_TEXT
2629 buffer.encode_string(1, this->object_id_ref_);
2630 buffer.encode_fixed32(2, this->key);
2631 buffer.encode_string(3, this->name_ref_);
2632#ifdef USE_ENTITY_ICON
2633 buffer.encode_string(5, this->icon_ref_);
2634#endif
2635 buffer.encode_bool(6, this->disabled_by_default);
2636 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2637 buffer.encode_uint32(8, this->min_length);
2638 buffer.encode_uint32(9, this->max_length);
2639 buffer.encode_string(10, this->pattern_ref_);
2640 buffer.encode_uint32(11, static_cast<uint32_t>(this->mode));
2641#ifdef USE_DEVICES
2642 buffer.encode_uint32(12, this->device_id);
2643#endif
2644}
2646 size.add_length(1, this->object_id_ref_.size());
2647 size.add_fixed32(1, this->key);
2648 size.add_length(1, this->name_ref_.size());
2649#ifdef USE_ENTITY_ICON
2650 size.add_length(1, this->icon_ref_.size());
2651#endif
2652 size.add_bool(1, this->disabled_by_default);
2653 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2654 size.add_uint32(1, this->min_length);
2655 size.add_uint32(1, this->max_length);
2656 size.add_length(1, this->pattern_ref_.size());
2657 size.add_uint32(1, static_cast<uint32_t>(this->mode));
2658#ifdef USE_DEVICES
2659 size.add_uint32(1, this->device_id);
2660#endif
2661}
2663 buffer.encode_fixed32(1, this->key);
2664 buffer.encode_string(2, this->state_ref_);
2665 buffer.encode_bool(3, this->missing_state);
2666#ifdef USE_DEVICES
2667 buffer.encode_uint32(4, this->device_id);
2668#endif
2669}
2671 size.add_fixed32(1, this->key);
2672 size.add_length(1, this->state_ref_.size());
2673 size.add_bool(1, this->missing_state);
2674#ifdef USE_DEVICES
2675 size.add_uint32(1, this->device_id);
2676#endif
2677}
2678bool TextCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2679 switch (field_id) {
2680#ifdef USE_DEVICES
2681 case 3:
2682 this->device_id = value.as_uint32();
2683 break;
2684#endif
2685 default:
2686 return false;
2687 }
2688 return true;
2689}
2691 switch (field_id) {
2692 case 2:
2693 this->state = value.as_string();
2694 break;
2695 default:
2696 return false;
2697 }
2698 return true;
2699}
2700bool TextCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2701 switch (field_id) {
2702 case 1:
2703 this->key = value.as_fixed32();
2704 break;
2705 default:
2706 return false;
2707 }
2708 return true;
2709}
2710#endif
2711#ifdef USE_DATETIME_DATE
2713 buffer.encode_string(1, this->object_id_ref_);
2714 buffer.encode_fixed32(2, this->key);
2715 buffer.encode_string(3, this->name_ref_);
2716#ifdef USE_ENTITY_ICON
2717 buffer.encode_string(5, this->icon_ref_);
2718#endif
2719 buffer.encode_bool(6, this->disabled_by_default);
2720 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2721#ifdef USE_DEVICES
2722 buffer.encode_uint32(8, this->device_id);
2723#endif
2724}
2726 size.add_length(1, this->object_id_ref_.size());
2727 size.add_fixed32(1, this->key);
2728 size.add_length(1, this->name_ref_.size());
2729#ifdef USE_ENTITY_ICON
2730 size.add_length(1, this->icon_ref_.size());
2731#endif
2732 size.add_bool(1, this->disabled_by_default);
2733 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2734#ifdef USE_DEVICES
2735 size.add_uint32(1, this->device_id);
2736#endif
2737}
2739 buffer.encode_fixed32(1, this->key);
2740 buffer.encode_bool(2, this->missing_state);
2741 buffer.encode_uint32(3, this->year);
2742 buffer.encode_uint32(4, this->month);
2743 buffer.encode_uint32(5, this->day);
2744#ifdef USE_DEVICES
2745 buffer.encode_uint32(6, this->device_id);
2746#endif
2747}
2749 size.add_fixed32(1, this->key);
2750 size.add_bool(1, this->missing_state);
2751 size.add_uint32(1, this->year);
2752 size.add_uint32(1, this->month);
2753 size.add_uint32(1, this->day);
2754#ifdef USE_DEVICES
2755 size.add_uint32(1, this->device_id);
2756#endif
2757}
2758bool DateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2759 switch (field_id) {
2760 case 2:
2761 this->year = value.as_uint32();
2762 break;
2763 case 3:
2764 this->month = value.as_uint32();
2765 break;
2766 case 4:
2767 this->day = value.as_uint32();
2768 break;
2769#ifdef USE_DEVICES
2770 case 5:
2771 this->device_id = value.as_uint32();
2772 break;
2773#endif
2774 default:
2775 return false;
2776 }
2777 return true;
2778}
2779bool DateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2780 switch (field_id) {
2781 case 1:
2782 this->key = value.as_fixed32();
2783 break;
2784 default:
2785 return false;
2786 }
2787 return true;
2788}
2789#endif
2790#ifdef USE_DATETIME_TIME
2792 buffer.encode_string(1, this->object_id_ref_);
2793 buffer.encode_fixed32(2, this->key);
2794 buffer.encode_string(3, this->name_ref_);
2795#ifdef USE_ENTITY_ICON
2796 buffer.encode_string(5, this->icon_ref_);
2797#endif
2798 buffer.encode_bool(6, this->disabled_by_default);
2799 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2800#ifdef USE_DEVICES
2801 buffer.encode_uint32(8, this->device_id);
2802#endif
2803}
2805 size.add_length(1, this->object_id_ref_.size());
2806 size.add_fixed32(1, this->key);
2807 size.add_length(1, this->name_ref_.size());
2808#ifdef USE_ENTITY_ICON
2809 size.add_length(1, this->icon_ref_.size());
2810#endif
2811 size.add_bool(1, this->disabled_by_default);
2812 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2813#ifdef USE_DEVICES
2814 size.add_uint32(1, this->device_id);
2815#endif
2816}
2818 buffer.encode_fixed32(1, this->key);
2819 buffer.encode_bool(2, this->missing_state);
2820 buffer.encode_uint32(3, this->hour);
2821 buffer.encode_uint32(4, this->minute);
2822 buffer.encode_uint32(5, this->second);
2823#ifdef USE_DEVICES
2824 buffer.encode_uint32(6, this->device_id);
2825#endif
2826}
2828 size.add_fixed32(1, this->key);
2829 size.add_bool(1, this->missing_state);
2830 size.add_uint32(1, this->hour);
2831 size.add_uint32(1, this->minute);
2832 size.add_uint32(1, this->second);
2833#ifdef USE_DEVICES
2834 size.add_uint32(1, this->device_id);
2835#endif
2836}
2837bool TimeCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2838 switch (field_id) {
2839 case 2:
2840 this->hour = value.as_uint32();
2841 break;
2842 case 3:
2843 this->minute = value.as_uint32();
2844 break;
2845 case 4:
2846 this->second = value.as_uint32();
2847 break;
2848#ifdef USE_DEVICES
2849 case 5:
2850 this->device_id = value.as_uint32();
2851 break;
2852#endif
2853 default:
2854 return false;
2855 }
2856 return true;
2857}
2858bool TimeCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2859 switch (field_id) {
2860 case 1:
2861 this->key = value.as_fixed32();
2862 break;
2863 default:
2864 return false;
2865 }
2866 return true;
2867}
2868#endif
2869#ifdef USE_EVENT
2871 buffer.encode_string(1, this->object_id_ref_);
2872 buffer.encode_fixed32(2, this->key);
2873 buffer.encode_string(3, this->name_ref_);
2874#ifdef USE_ENTITY_ICON
2875 buffer.encode_string(5, this->icon_ref_);
2876#endif
2877 buffer.encode_bool(6, this->disabled_by_default);
2878 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2879 buffer.encode_string(8, this->device_class_ref_);
2880 for (const char *it : *this->event_types) {
2881 buffer.encode_string(9, it, strlen(it), true);
2882 }
2883#ifdef USE_DEVICES
2884 buffer.encode_uint32(10, this->device_id);
2885#endif
2886}
2888 size.add_length(1, this->object_id_ref_.size());
2889 size.add_fixed32(1, this->key);
2890 size.add_length(1, this->name_ref_.size());
2891#ifdef USE_ENTITY_ICON
2892 size.add_length(1, this->icon_ref_.size());
2893#endif
2894 size.add_bool(1, this->disabled_by_default);
2895 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2896 size.add_length(1, this->device_class_ref_.size());
2897 if (!this->event_types->empty()) {
2898 for (const char *it : *this->event_types) {
2899 size.add_length_force(1, strlen(it));
2900 }
2901 }
2902#ifdef USE_DEVICES
2903 size.add_uint32(1, this->device_id);
2904#endif
2905}
2907 buffer.encode_fixed32(1, this->key);
2908 buffer.encode_string(2, this->event_type_ref_);
2909#ifdef USE_DEVICES
2910 buffer.encode_uint32(3, this->device_id);
2911#endif
2912}
2914 size.add_fixed32(1, this->key);
2915 size.add_length(1, this->event_type_ref_.size());
2916#ifdef USE_DEVICES
2917 size.add_uint32(1, this->device_id);
2918#endif
2919}
2920#endif
2921#ifdef USE_VALVE
2923 buffer.encode_string(1, this->object_id_ref_);
2924 buffer.encode_fixed32(2, this->key);
2925 buffer.encode_string(3, this->name_ref_);
2926#ifdef USE_ENTITY_ICON
2927 buffer.encode_string(5, this->icon_ref_);
2928#endif
2929 buffer.encode_bool(6, this->disabled_by_default);
2930 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2931 buffer.encode_string(8, this->device_class_ref_);
2932 buffer.encode_bool(9, this->assumed_state);
2933 buffer.encode_bool(10, this->supports_position);
2934 buffer.encode_bool(11, this->supports_stop);
2935#ifdef USE_DEVICES
2936 buffer.encode_uint32(12, this->device_id);
2937#endif
2938}
2940 size.add_length(1, this->object_id_ref_.size());
2941 size.add_fixed32(1, this->key);
2942 size.add_length(1, this->name_ref_.size());
2943#ifdef USE_ENTITY_ICON
2944 size.add_length(1, this->icon_ref_.size());
2945#endif
2946 size.add_bool(1, this->disabled_by_default);
2947 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2948 size.add_length(1, this->device_class_ref_.size());
2949 size.add_bool(1, this->assumed_state);
2950 size.add_bool(1, this->supports_position);
2951 size.add_bool(1, this->supports_stop);
2952#ifdef USE_DEVICES
2953 size.add_uint32(1, this->device_id);
2954#endif
2955}
2957 buffer.encode_fixed32(1, this->key);
2958 buffer.encode_float(2, this->position);
2959 buffer.encode_uint32(3, static_cast<uint32_t>(this->current_operation));
2960#ifdef USE_DEVICES
2961 buffer.encode_uint32(4, this->device_id);
2962#endif
2963}
2965 size.add_fixed32(1, this->key);
2966 size.add_float(1, this->position);
2967 size.add_uint32(1, static_cast<uint32_t>(this->current_operation));
2968#ifdef USE_DEVICES
2969 size.add_uint32(1, this->device_id);
2970#endif
2971}
2972bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2973 switch (field_id) {
2974 case 2:
2975 this->has_position = value.as_bool();
2976 break;
2977 case 4:
2978 this->stop = value.as_bool();
2979 break;
2980#ifdef USE_DEVICES
2981 case 5:
2982 this->device_id = value.as_uint32();
2983 break;
2984#endif
2985 default:
2986 return false;
2987 }
2988 return true;
2989}
2990bool ValveCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2991 switch (field_id) {
2992 case 1:
2993 this->key = value.as_fixed32();
2994 break;
2995 case 3:
2996 this->position = value.as_float();
2997 break;
2998 default:
2999 return false;
3000 }
3001 return true;
3002}
3003#endif
3004#ifdef USE_DATETIME_DATETIME
3006 buffer.encode_string(1, this->object_id_ref_);
3007 buffer.encode_fixed32(2, this->key);
3008 buffer.encode_string(3, this->name_ref_);
3009#ifdef USE_ENTITY_ICON
3010 buffer.encode_string(5, this->icon_ref_);
3011#endif
3012 buffer.encode_bool(6, this->disabled_by_default);
3013 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
3014#ifdef USE_DEVICES
3015 buffer.encode_uint32(8, this->device_id);
3016#endif
3017}
3019 size.add_length(1, this->object_id_ref_.size());
3020 size.add_fixed32(1, this->key);
3021 size.add_length(1, this->name_ref_.size());
3022#ifdef USE_ENTITY_ICON
3023 size.add_length(1, this->icon_ref_.size());
3024#endif
3025 size.add_bool(1, this->disabled_by_default);
3026 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
3027#ifdef USE_DEVICES
3028 size.add_uint32(1, this->device_id);
3029#endif
3030}
3032 buffer.encode_fixed32(1, this->key);
3033 buffer.encode_bool(2, this->missing_state);
3034 buffer.encode_fixed32(3, this->epoch_seconds);
3035#ifdef USE_DEVICES
3036 buffer.encode_uint32(4, this->device_id);
3037#endif
3038}
3040 size.add_fixed32(1, this->key);
3041 size.add_bool(1, this->missing_state);
3042 size.add_fixed32(1, this->epoch_seconds);
3043#ifdef USE_DEVICES
3044 size.add_uint32(1, this->device_id);
3045#endif
3046}
3048 switch (field_id) {
3049#ifdef USE_DEVICES
3050 case 3:
3051 this->device_id = value.as_uint32();
3052 break;
3053#endif
3054 default:
3055 return false;
3056 }
3057 return true;
3058}
3059bool DateTimeCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3060 switch (field_id) {
3061 case 1:
3062 this->key = value.as_fixed32();
3063 break;
3064 case 2:
3065 this->epoch_seconds = value.as_fixed32();
3066 break;
3067 default:
3068 return false;
3069 }
3070 return true;
3071}
3072#endif
3073#ifdef USE_UPDATE
3075 buffer.encode_string(1, this->object_id_ref_);
3076 buffer.encode_fixed32(2, this->key);
3077 buffer.encode_string(3, this->name_ref_);
3078#ifdef USE_ENTITY_ICON
3079 buffer.encode_string(5, this->icon_ref_);
3080#endif
3081 buffer.encode_bool(6, this->disabled_by_default);
3082 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
3083 buffer.encode_string(8, this->device_class_ref_);
3084#ifdef USE_DEVICES
3085 buffer.encode_uint32(9, this->device_id);
3086#endif
3087}
3089 size.add_length(1, this->object_id_ref_.size());
3090 size.add_fixed32(1, this->key);
3091 size.add_length(1, this->name_ref_.size());
3092#ifdef USE_ENTITY_ICON
3093 size.add_length(1, this->icon_ref_.size());
3094#endif
3095 size.add_bool(1, this->disabled_by_default);
3096 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
3097 size.add_length(1, this->device_class_ref_.size());
3098#ifdef USE_DEVICES
3099 size.add_uint32(1, this->device_id);
3100#endif
3101}
3103 buffer.encode_fixed32(1, this->key);
3104 buffer.encode_bool(2, this->missing_state);
3105 buffer.encode_bool(3, this->in_progress);
3106 buffer.encode_bool(4, this->has_progress);
3107 buffer.encode_float(5, this->progress);
3108 buffer.encode_string(6, this->current_version_ref_);
3109 buffer.encode_string(7, this->latest_version_ref_);
3110 buffer.encode_string(8, this->title_ref_);
3111 buffer.encode_string(9, this->release_summary_ref_);
3112 buffer.encode_string(10, this->release_url_ref_);
3113#ifdef USE_DEVICES
3114 buffer.encode_uint32(11, this->device_id);
3115#endif
3116}
3118 size.add_fixed32(1, this->key);
3119 size.add_bool(1, this->missing_state);
3120 size.add_bool(1, this->in_progress);
3121 size.add_bool(1, this->has_progress);
3122 size.add_float(1, this->progress);
3123 size.add_length(1, this->current_version_ref_.size());
3124 size.add_length(1, this->latest_version_ref_.size());
3125 size.add_length(1, this->title_ref_.size());
3126 size.add_length(1, this->release_summary_ref_.size());
3127 size.add_length(1, this->release_url_ref_.size());
3128#ifdef USE_DEVICES
3129 size.add_uint32(1, this->device_id);
3130#endif
3131}
3132bool UpdateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3133 switch (field_id) {
3134 case 2:
3135 this->command = static_cast<enums::UpdateCommand>(value.as_uint32());
3136 break;
3137#ifdef USE_DEVICES
3138 case 3:
3139 this->device_id = value.as_uint32();
3140 break;
3141#endif
3142 default:
3143 return false;
3144 }
3145 return true;
3146}
3147bool UpdateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3148 switch (field_id) {
3149 case 1:
3150 this->key = value.as_fixed32();
3151 break;
3152 default:
3153 return false;
3154 }
3155 return true;
3156}
3157#endif
3158#ifdef USE_ZWAVE_PROXY
3160 switch (field_id) {
3161 case 1: {
3162 // Use raw data directly to avoid allocation
3163 this->data = value.data();
3164 this->data_len = value.size();
3165 break;
3166 }
3167 default:
3168 return false;
3169 }
3170 return true;
3171}
3172void ZWaveProxyFrame::encode(ProtoWriteBuffer buffer) const { buffer.encode_bytes(1, this->data, this->data_len); }
3174bool ZWaveProxyRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3175 switch (field_id) {
3176 case 1:
3177 this->type = static_cast<enums::ZWaveProxyRequestType>(value.as_uint32());
3178 break;
3179 default:
3180 return false;
3181 }
3182 return true;
3183}
3185 switch (field_id) {
3186 case 2: {
3187 // Use raw data directly to avoid allocation
3188 this->data = value.data();
3189 this->data_len = value.size();
3190 break;
3191 }
3192 default:
3193 return false;
3194 }
3195 return true;
3196}
3198 buffer.encode_uint32(1, static_cast<uint32_t>(this->type));
3199 buffer.encode_bytes(2, this->data, this->data_len);
3200}
3202 size.add_uint32(1, static_cast<uint32_t>(this->type));
3203 size.add_length(2, this->data_len);
3204}
3205#endif
3206
3207} // namespace esphome::api
constexpr bool empty() const
Check if the set is empty.
bool empty() const
Definition helpers.h:339
void push_back(const T &value)
Add element without bounds checking Caller must ensure sufficient capacity was allocated via init() S...
Definition helpers.h:298
void init(size_t n)
Definition helpers.h:271
constexpr size_type size() const
Definition string_ref.h:70
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2616
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2591
enums::AlarmControlPanelStateCommand command
Definition api_pb2.h:2604
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2606
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2584
enums::AlarmControlPanelState state
Definition api_pb2.h:2588
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2577
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:66
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:70
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:49
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:62
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:63
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:234
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:242
std::array< uint64_t, BLUETOOTH_PROXY_MAX_CONNECTIONS > allocated
Definition api_pb2.h:2142
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2185
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2194
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2254
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2249
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1974
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1980
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2234
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2229
enums::BluetoothDeviceRequestType request_type
Definition api_pb2.h:1867
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1955
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2239
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2244
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2012
FixedVector< BluetoothGATTDescriptor > descriptors
Definition api_pb2.h:1929
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2024
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:1926
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2004
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:1913
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1996
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2203
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2208
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2064
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2067
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1986
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2060
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2054
std::vector< BluetoothGATTService > services
Definition api_pb2.h:1961
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2175
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2180
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2159
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2225
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2221
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2120
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2068
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2081
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2086
FixedVector< BluetoothGATTCharacteristic > characteristics
Definition api_pb2.h:1943
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2045
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2034
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:1941
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2146
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2133
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2107
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2091
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2217
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2213
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1939
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1933
std::array< BluetoothLERawAdvertisement, BLUETOOTH_PROXY_ADVERTISEMENT_BATCH_SIZE > advertisements
Definition api_pb2.h:1849
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1945
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1950
enums::BluetoothScannerMode mode
Definition api_pb2.h:2295
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2269
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2259
enums::BluetoothScannerMode mode
Definition api_pb2.h:2278
enums::BluetoothScannerState state
Definition api_pb2.h:2277
enums::BluetoothScannerMode configured_mode
Definition api_pb2.h:2279
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2264
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1778
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1790
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1148
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1140
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1132
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1366
enums::ClimateSwingMode swing_mode
Definition api_pb2.h:1452
enums::ClimateFanMode fan_mode
Definition api_pb2.h:1450
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1299
enums::ClimatePreset preset
Definition api_pb2.h:1456
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1353
enums::ClimateFanMode fan_mode
Definition api_pb2.h:1417
enums::ClimateSwingMode swing_mode
Definition api_pb2.h:1418
enums::ClimateAction action
Definition api_pb2.h:1416
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1261
enums::ClimatePreset preset
Definition api_pb2.h:1421
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1280
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:327
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:306
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:288
enums::CoverOperation current_operation
Definition api_pb2.h:686
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:297
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2779
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2758
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2738
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2748
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3059
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3047
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3039
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3031
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:81
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:76
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:87
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:145
std::array< AreaInfo, ESPHOME_AREA_COUNT > areas
Definition api_pb2.h:560
std::array< DeviceInfo, ESPHOME_DEVICE_COUNT > devices
Definition api_pb2.h:557
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2913
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2906
void decode(const uint8_t *buffer, size_t length) override
Definition api_pb2.cpp:1067
FixedVector< float > float_array
Definition api_pb2.h:1284
FixedVector< std::string > string_array
Definition api_pb2.h:1285
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1041
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1019
FixedVector< int32_t > int_array
Definition api_pb2.h:1283
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1054
FixedVector< ExecuteServiceArgument > args
Definition api_pb2.h:1304
void decode(const uint8_t *buffer, size_t length) override
Definition api_pb2.cpp:1099
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1089
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1078
enums::FanDirection direction
Definition api_pb2.h:770
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:409
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:448
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:458
enums::FanDirection direction
Definition api_pb2.h:746
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:387
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:398
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:988
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:975
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:10
const uint8_t * client_info
Definition api_pb2.h:338
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:23
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:42
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:36
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:958
FixedVector< HomeassistantServiceMap > variables
Definition api_pb2.h:1115
FixedVector< HomeassistantServiceMap > data
Definition api_pb2.h:1113
FixedVector< HomeassistantServiceMap > data_template
Definition api_pb2.h:1114
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:897
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:875
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:915
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:928
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:867
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:871
enums::EntityCategory entity_category
Definition api_pb2.h:302
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:612
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:622
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:552
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:516
enums::ColorMode color_mode
Definition api_pb2.h:814
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:534
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2561
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2545
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:204
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:219
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1764
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1750
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1119
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1106
const std::vector< const char * > * supported_custom_presets
Definition api_pb2.h:1389
const climate::ClimateSwingModeMask * supported_swing_modes
Definition api_pb2.h:1386
const std::vector< const char * > * supported_custom_fan_modes
Definition api_pb2.h:1387
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1206
const climate::ClimatePresetMask * supported_presets
Definition api_pb2.h:1388
const climate::ClimateFanModeMask * supported_fan_modes
Definition api_pb2.h:1385
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1163
const climate::ClimateModeMask * supported_modes
Definition api_pb2.h:1380
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:270
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:252
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2712
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2725
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3018
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3005
const FixedVector< const char * > * event_types
Definition api_pb2.h:2791
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2887
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2870
const std::vector< const char * > * supported_preset_modes
Definition api_pb2.h:728
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:345
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:365
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:491
const light::ColorModeMask * supported_color_modes
Definition api_pb2.h:793
std::vector< std::string > effects
Definition api_pb2.h:796
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:470
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1662
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1679
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1816
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1834
std::vector< MediaPlayerSupportedFormat > supported_formats
Definition api_pb2.h:1758
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1409
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1390
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1487
const FixedVector< const char * > * options
Definition api_pb2.h:1537
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1471
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:661
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:679
enums::SensorStateClass state_class
Definition api_pb2.h:890
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1003
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:999
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1014
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1007
FixedVector< ListEntitiesServicesArgument > args
Definition api_pb2.h:1266
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1555
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1573
std::vector< std::string > tones
Definition api_pb2.h:1590
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:715
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:730
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2645
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2628
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:800
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:786
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2791
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2804
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3088
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3074
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2939
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2922
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1710
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1738
enums::LockCommand command
Definition api_pb2.h:1686
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1728
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1703
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1696
enums::MediaPlayerCommand command
Definition api_pb2.h:1794
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1908
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1868
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1898
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1859
enums::MediaPlayerState state
Definition api_pb2.h:1775
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1850
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1809
enums::MediaPlayerFormatPurpose purpose
Definition api_pb2.h:1740
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1802
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:853
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:863
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:864
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1456
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1444
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1428
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1436
uint32_t as_fixed32() const
Definition proto.h:215
float as_float() const
Definition proto.h:217
virtual void decode(const uint8_t *buffer, size_t length)
Definition proto.cpp:73
static uint32_t count_repeated_field(const uint8_t *buffer, size_t length, uint32_t target_field_id)
Count occurrences of a repeated field in a protobuf buffer.
Definition proto.cpp:10
void decode_to_message(ProtoDecodableMessage &msg) const
Decode the length-delimited data into an existing ProtoDecodableMessage instance.
Definition proto.h:824
const uint8_t * data() const
Definition proto.h:193
std::string as_string() const
Definition proto.h:190
void add_message_object(uint32_t field_id_size, const ProtoMessage &message)
Calculates and adds the size of a nested message field to the total message size.
Definition proto.h:733
void add_message_object_force(uint32_t field_id_size, const ProtoMessage &message)
Calculates and adds the size of a nested message field to the total message size (force version)
Definition proto.h:748
void add_float(uint32_t field_id_size, float value)
Calculates and adds the size of a float field to the total message size.
Definition proto.h:578
void add_uint32_force(uint32_t field_id_size, uint32_t value)
Calculates and adds the size of a uint32 field to the total message size (force version)
Definition proto.h:551
void add_sint32(uint32_t field_id_size, int32_t value)
Calculates and adds the size of a sint32 field to the total message size.
Definition proto.h:616
void add_bool(uint32_t field_id_size, bool value)
Calculates and adds the size of a boolean field to the total message size.
Definition proto.h:559
void add_uint32(uint32_t field_id_size, uint32_t value)
Calculates and adds the size of a uint32 field to the total message size.
Definition proto.h:542
void add_repeated_message(uint32_t field_id_size, const std::vector< MessageType > &messages)
Calculates and adds the sizes of all messages in a repeated field to the total message size.
Definition proto.h:768
void add_uint64(uint32_t field_id_size, uint64_t value)
Calculates and adds the size of a uint64 field to the total message size.
Definition proto.h:653
void add_length_force(uint32_t field_id_size, size_t len)
Calculates and adds the size of a length-delimited field (string/bytes) to the total message size (re...
Definition proto.h:683
void add_int32(uint32_t field_id_size, int32_t value)
Common parameters for all add_*_field methods.
Definition proto.h:524
void add_uint64_force(uint32_t field_id_size, uint64_t value)
Calculates and adds the size of a uint64 field to the total message size (force version)
Definition proto.h:662
void add_fixed32(uint32_t field_id_size, uint32_t value)
Calculates and adds the size of a fixed32 field to the total message size.
Definition proto.h:590
void add_length(uint32_t field_id_size, size_t len)
Calculates and adds the size of a length-delimited field (string/bytes) to the total message size.
Definition proto.h:673
Representation of a VarInt - in ProtoBuf should be 64bit but we only use 32bit.
Definition proto.h:73
constexpr uint64_t as_uint64() const
Definition proto.h:116
constexpr int32_t as_int32() const
Definition proto.h:118
constexpr uint32_t as_uint32() const
Definition proto.h:115
constexpr bool as_bool() const
Definition proto.h:117
constexpr int32_t as_sint32() const
Definition proto.h:126
void encode_float(uint32_t field_id, float value, bool force=false)
Definition proto.h:309
void encode_int32(uint32_t field_id, int32_t value, bool force=false)
Definition proto.h:320
void encode_string(uint32_t field_id, const char *string, size_t len, bool force=false)
Definition proto.h:254
void encode_bool(uint32_t field_id, bool value, bool force=false)
Definition proto.h:289
void encode_uint64(uint32_t field_id, uint64_t value, bool force=false)
Definition proto.h:283
void encode_uint32(uint32_t field_id, uint32_t value, bool force=false)
Definition proto.h:277
void encode_sint32(uint32_t field_id, int32_t value, bool force=false)
Definition proto.h:331
void encode_message(uint32_t field_id, const ProtoMessage &value, bool force=false)
Definition proto.h:798
void encode_bytes(uint32_t field_id, const uint8_t *data, size_t len, bool force=false)
Definition proto.h:274
void encode_fixed32(uint32_t field_id, uint32_t value, bool force=false)
Definition proto.h:295
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1533
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1521
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1543
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1505
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1513
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:705
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:697
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1637
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1607
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1647
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1600
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1593
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1923
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:953
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:948
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:831
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:848
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:844
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2281
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:774
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:759
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:745
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:752
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2690
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2700
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2678
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:822
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:814
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2670
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2662
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2858
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2837
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2827
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2817
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3147
enums::UpdateCommand command
Definition api_pb2.h:2979
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3132
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3117
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3102
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2972
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2990
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2956
enums::ValveOperation current_operation
Definition api_pb2.h:2847
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2964
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2452
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2451
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2435
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2425
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2385
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2389
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2375
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2365
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2294
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2299
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2504
std::vector< VoiceAssistantExternalWakeWord > external_wake_words
Definition api_pb2.h:2520
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2524
std::vector< VoiceAssistantWakeWord > available_wake_words
Definition api_pb2.h:2535
const std::vector< std::string > * active_wake_words
Definition api_pb2.h:2536
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2515
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2331
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2354
enums::VoiceAssistantEvent event_type
Definition api_pb2.h:2390
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2344
std::vector< VoiceAssistantEventData > data
Definition api_pb2.h:2391
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2479
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2469
std::vector< std::string > trained_languages
Definition api_pb2.h:2500
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2311
VoiceAssistantAudioSettings audio_settings
Definition api_pb2.h:2345
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2304
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2318
std::vector< std::string > active_wake_words
Definition api_pb2.h:2553
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2533
enums::VoiceAssistantTimerEvent event_type
Definition api_pb2.h:2432
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2412
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2393
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2453
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2460
std::vector< std::string > trained_languages
Definition api_pb2.h:2487
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:3159
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3172
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3173
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3201
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:3184
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3174
enums::ZWaveProxyRequestType type
Definition api_pb2.h:3015
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3197
uint16_t length
Definition tt21100.cpp:0