ESPHome 2025.12.5
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 (const char *it : *this->effects) {
480 buffer.encode_string(11, it, strlen(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 char *it : *this->effects) {
504 size.add_length_force(1, strlen(it));
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 // Use raw data directly to avoid allocation
616 this->effect = value.data();
617 this->effect_len = value.size();
618 break;
619 }
620 default:
621 return false;
622 }
623 return true;
624}
625bool LightCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
626 switch (field_id) {
627 case 1:
628 this->key = value.as_fixed32();
629 break;
630 case 5:
631 this->brightness = value.as_float();
632 break;
633 case 21:
634 this->color_brightness = value.as_float();
635 break;
636 case 7:
637 this->red = value.as_float();
638 break;
639 case 8:
640 this->green = value.as_float();
641 break;
642 case 9:
643 this->blue = value.as_float();
644 break;
645 case 11:
646 this->white = value.as_float();
647 break;
648 case 13:
649 this->color_temperature = value.as_float();
650 break;
651 case 25:
652 this->cold_white = value.as_float();
653 break;
654 case 27:
655 this->warm_white = value.as_float();
656 break;
657 default:
658 return false;
659 }
660 return true;
661}
662#endif
663#ifdef USE_SENSOR
665 buffer.encode_string(1, this->object_id_ref_);
666 buffer.encode_fixed32(2, this->key);
667 buffer.encode_string(3, this->name_ref_);
668#ifdef USE_ENTITY_ICON
669 buffer.encode_string(5, this->icon_ref_);
670#endif
672 buffer.encode_int32(7, this->accuracy_decimals);
673 buffer.encode_bool(8, this->force_update);
674 buffer.encode_string(9, this->device_class_ref_);
675 buffer.encode_uint32(10, static_cast<uint32_t>(this->state_class));
676 buffer.encode_bool(12, this->disabled_by_default);
677 buffer.encode_uint32(13, static_cast<uint32_t>(this->entity_category));
678#ifdef USE_DEVICES
679 buffer.encode_uint32(14, this->device_id);
680#endif
681}
683 size.add_length(1, this->object_id_ref_.size());
684 size.add_fixed32(1, this->key);
685 size.add_length(1, this->name_ref_.size());
686#ifdef USE_ENTITY_ICON
687 size.add_length(1, this->icon_ref_.size());
688#endif
690 size.add_int32(1, this->accuracy_decimals);
691 size.add_bool(1, this->force_update);
692 size.add_length(1, this->device_class_ref_.size());
693 size.add_uint32(1, static_cast<uint32_t>(this->state_class));
694 size.add_bool(1, this->disabled_by_default);
695 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
696#ifdef USE_DEVICES
697 size.add_uint32(1, this->device_id);
698#endif
699}
701 buffer.encode_fixed32(1, this->key);
702 buffer.encode_float(2, this->state);
703 buffer.encode_bool(3, this->missing_state);
704#ifdef USE_DEVICES
705 buffer.encode_uint32(4, this->device_id);
706#endif
707}
709 size.add_fixed32(1, this->key);
710 size.add_float(1, this->state);
711 size.add_bool(1, this->missing_state);
712#ifdef USE_DEVICES
713 size.add_uint32(1, this->device_id);
714#endif
715}
716#endif
717#ifdef USE_SWITCH
719 buffer.encode_string(1, this->object_id_ref_);
720 buffer.encode_fixed32(2, this->key);
721 buffer.encode_string(3, this->name_ref_);
722#ifdef USE_ENTITY_ICON
723 buffer.encode_string(5, this->icon_ref_);
724#endif
725 buffer.encode_bool(6, this->assumed_state);
726 buffer.encode_bool(7, this->disabled_by_default);
727 buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
728 buffer.encode_string(9, this->device_class_ref_);
729#ifdef USE_DEVICES
730 buffer.encode_uint32(10, this->device_id);
731#endif
732}
734 size.add_length(1, this->object_id_ref_.size());
735 size.add_fixed32(1, this->key);
736 size.add_length(1, this->name_ref_.size());
737#ifdef USE_ENTITY_ICON
738 size.add_length(1, this->icon_ref_.size());
739#endif
740 size.add_bool(1, this->assumed_state);
741 size.add_bool(1, this->disabled_by_default);
742 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
743 size.add_length(1, this->device_class_ref_.size());
744#ifdef USE_DEVICES
745 size.add_uint32(1, this->device_id);
746#endif
747}
749 buffer.encode_fixed32(1, this->key);
750 buffer.encode_bool(2, this->state);
751#ifdef USE_DEVICES
752 buffer.encode_uint32(3, this->device_id);
753#endif
754}
756 size.add_fixed32(1, this->key);
757 size.add_bool(1, this->state);
758#ifdef USE_DEVICES
759 size.add_uint32(1, this->device_id);
760#endif
761}
762bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
763 switch (field_id) {
764 case 2:
765 this->state = value.as_bool();
766 break;
767#ifdef USE_DEVICES
768 case 3:
769 this->device_id = value.as_uint32();
770 break;
771#endif
772 default:
773 return false;
774 }
775 return true;
776}
777bool SwitchCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
778 switch (field_id) {
779 case 1:
780 this->key = value.as_fixed32();
781 break;
782 default:
783 return false;
784 }
785 return true;
786}
787#endif
788#ifdef USE_TEXT_SENSOR
790 buffer.encode_string(1, this->object_id_ref_);
791 buffer.encode_fixed32(2, this->key);
792 buffer.encode_string(3, this->name_ref_);
793#ifdef USE_ENTITY_ICON
794 buffer.encode_string(5, this->icon_ref_);
795#endif
796 buffer.encode_bool(6, this->disabled_by_default);
797 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
798 buffer.encode_string(8, this->device_class_ref_);
799#ifdef USE_DEVICES
800 buffer.encode_uint32(9, this->device_id);
801#endif
802}
804 size.add_length(1, this->object_id_ref_.size());
805 size.add_fixed32(1, this->key);
806 size.add_length(1, this->name_ref_.size());
807#ifdef USE_ENTITY_ICON
808 size.add_length(1, this->icon_ref_.size());
809#endif
810 size.add_bool(1, this->disabled_by_default);
811 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
812 size.add_length(1, this->device_class_ref_.size());
813#ifdef USE_DEVICES
814 size.add_uint32(1, this->device_id);
815#endif
816}
818 buffer.encode_fixed32(1, this->key);
819 buffer.encode_string(2, this->state_ref_);
820 buffer.encode_bool(3, this->missing_state);
821#ifdef USE_DEVICES
822 buffer.encode_uint32(4, this->device_id);
823#endif
824}
826 size.add_fixed32(1, this->key);
827 size.add_length(1, this->state_ref_.size());
828 size.add_bool(1, this->missing_state);
829#ifdef USE_DEVICES
830 size.add_uint32(1, this->device_id);
831#endif
832}
833#endif
834bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
835 switch (field_id) {
836 case 1:
837 this->level = static_cast<enums::LogLevel>(value.as_uint32());
838 break;
839 case 2:
840 this->dump_config = value.as_bool();
841 break;
842 default:
843 return false;
844 }
845 return true;
846}
848 buffer.encode_uint32(1, static_cast<uint32_t>(this->level));
849 buffer.encode_bytes(3, this->message_ptr_, this->message_len_);
850}
852 size.add_uint32(1, static_cast<uint32_t>(this->level));
853 size.add_length(1, this->message_len_);
854}
855#ifdef USE_API_NOISE
857 switch (field_id) {
858 case 1:
859 this->key = value.as_string();
860 break;
861 default:
862 return false;
863 }
864 return true;
865}
868#endif
869#ifdef USE_API_HOMEASSISTANT_SERVICES
871 buffer.encode_string(1, this->key_ref_);
872 buffer.encode_string(2, this->value);
873}
875 size.add_length(1, this->key_ref_.size());
876 size.add_length(1, this->value.size());
877}
879 buffer.encode_string(1, this->service_ref_);
880 for (auto &it : this->data) {
881 buffer.encode_message(2, it, true);
882 }
883 for (auto &it : this->data_template) {
884 buffer.encode_message(3, it, true);
885 }
886 for (auto &it : this->variables) {
887 buffer.encode_message(4, it, true);
888 }
889 buffer.encode_bool(5, this->is_event);
890#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
891 buffer.encode_uint32(6, this->call_id);
892#endif
893#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
894 buffer.encode_bool(7, this->wants_response);
895#endif
896#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
897 buffer.encode_string(8, this->response_template);
898#endif
899}
901 size.add_length(1, this->service_ref_.size());
902 size.add_repeated_message(1, this->data);
903 size.add_repeated_message(1, this->data_template);
904 size.add_repeated_message(1, this->variables);
905 size.add_bool(1, this->is_event);
906#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
907 size.add_uint32(1, this->call_id);
908#endif
909#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
910 size.add_bool(1, this->wants_response);
911#endif
912#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
913 size.add_length(1, this->response_template.size());
914#endif
915}
916#endif
917#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
919 switch (field_id) {
920 case 1:
921 this->call_id = value.as_uint32();
922 break;
923 case 2:
924 this->success = value.as_bool();
925 break;
926 default:
927 return false;
928 }
929 return true;
930}
932 switch (field_id) {
933 case 3:
934 this->error_message = value.as_string();
935 break;
936#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
937 case 4: {
938 // Use raw data directly to avoid allocation
939 this->response_data = value.data();
940 this->response_data_len = value.size();
941 break;
942 }
943#endif
944 default:
945 return false;
946 }
947 return true;
948}
949#endif
950#ifdef USE_API_HOMEASSISTANT_STATES
952 buffer.encode_string(1, this->entity_id_ref_);
953 buffer.encode_string(2, this->attribute_ref_);
954 buffer.encode_bool(3, this->once);
955}
957 size.add_length(1, this->entity_id_ref_.size());
958 size.add_length(1, this->attribute_ref_.size());
959 size.add_bool(1, this->once);
960}
962 switch (field_id) {
963 case 1:
964 this->entity_id = value.as_string();
965 break;
966 case 2:
967 this->state = value.as_string();
968 break;
969 case 3:
970 this->attribute = value.as_string();
971 break;
972 default:
973 return false;
974 }
975 return true;
976}
977#endif
979 switch (field_id) {
980 case 2: {
981 // Use raw data directly to avoid allocation
982 this->timezone = value.data();
983 this->timezone_len = value.size();
984 break;
985 }
986 default:
987 return false;
988 }
989 return true;
990}
991bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
992 switch (field_id) {
993 case 1:
994 this->epoch_seconds = value.as_fixed32();
995 break;
996 default:
997 return false;
998 }
999 return true;
1000}
1001#ifdef USE_API_USER_DEFINED_ACTIONS
1003 buffer.encode_string(1, this->name_ref_);
1004 buffer.encode_uint32(2, static_cast<uint32_t>(this->type));
1005}
1007 size.add_length(1, this->name_ref_.size());
1008 size.add_uint32(1, static_cast<uint32_t>(this->type));
1009}
1011 buffer.encode_string(1, this->name_ref_);
1012 buffer.encode_fixed32(2, this->key);
1013 for (auto &it : this->args) {
1014 buffer.encode_message(3, it, true);
1015 }
1016 buffer.encode_uint32(4, static_cast<uint32_t>(this->supports_response));
1017}
1019 size.add_length(1, this->name_ref_.size());
1020 size.add_fixed32(1, this->key);
1021 size.add_repeated_message(1, this->args);
1022 size.add_uint32(1, static_cast<uint32_t>(this->supports_response));
1023}
1025 switch (field_id) {
1026 case 1:
1027 this->bool_ = value.as_bool();
1028 break;
1029 case 2:
1030 this->legacy_int = value.as_int32();
1031 break;
1032 case 5:
1033 this->int_ = value.as_sint32();
1034 break;
1035 case 6:
1036 this->bool_array.push_back(value.as_bool());
1037 break;
1038 case 7:
1039 this->int_array.push_back(value.as_sint32());
1040 break;
1041 default:
1042 return false;
1043 }
1044 return true;
1045}
1047 switch (field_id) {
1048 case 4:
1049 this->string_ = value.as_string();
1050 break;
1051 case 9:
1052 this->string_array.push_back(value.as_string());
1053 break;
1054 default:
1055 return false;
1056 }
1057 return true;
1058}
1059bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) {
1060 switch (field_id) {
1061 case 3:
1062 this->float_ = value.as_float();
1063 break;
1064 case 8:
1065 this->float_array.push_back(value.as_float());
1066 break;
1067 default:
1068 return false;
1069 }
1070 return true;
1071}
1072void ExecuteServiceArgument::decode(const uint8_t *buffer, size_t length) {
1073 uint32_t count_bool_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 6);
1074 this->bool_array.init(count_bool_array);
1075 uint32_t count_int_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 7);
1076 this->int_array.init(count_int_array);
1077 uint32_t count_float_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 8);
1078 this->float_array.init(count_float_array);
1079 uint32_t count_string_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 9);
1080 this->string_array.init(count_string_array);
1082}
1084 switch (field_id) {
1085#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
1086 case 3:
1087 this->call_id = value.as_uint32();
1088 break;
1089#endif
1090#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
1091 case 4:
1092 this->return_response = value.as_bool();
1093 break;
1094#endif
1095 default:
1096 return false;
1097 }
1098 return true;
1099}
1101 switch (field_id) {
1102 case 2:
1103 this->args.emplace_back();
1104 value.decode_to_message(this->args.back());
1105 break;
1106 default:
1107 return false;
1108 }
1109 return true;
1110}
1111bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1112 switch (field_id) {
1113 case 1:
1114 this->key = value.as_fixed32();
1115 break;
1116 default:
1117 return false;
1118 }
1119 return true;
1120}
1121void ExecuteServiceRequest::decode(const uint8_t *buffer, size_t length) {
1122 uint32_t count_args = ProtoDecodableMessage::count_repeated_field(buffer, length, 2);
1123 this->args.init(count_args);
1125}
1126#endif
1127#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
1129 buffer.encode_uint32(1, this->call_id);
1130 buffer.encode_bool(2, this->success);
1131 buffer.encode_string(3, this->error_message_ref_);
1132#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES_JSON
1133 buffer.encode_bytes(4, this->response_data, this->response_data_len);
1134#endif
1135}
1137 size.add_uint32(1, this->call_id);
1138 size.add_bool(1, this->success);
1139 size.add_length(1, this->error_message_ref_.size());
1140#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES_JSON
1141 size.add_length(4, this->response_data_len);
1142#endif
1143}
1144#endif
1145#ifdef USE_CAMERA
1147 buffer.encode_string(1, this->object_id_ref_);
1148 buffer.encode_fixed32(2, this->key);
1149 buffer.encode_string(3, this->name_ref_);
1150 buffer.encode_bool(5, this->disabled_by_default);
1151#ifdef USE_ENTITY_ICON
1152 buffer.encode_string(6, this->icon_ref_);
1153#endif
1154 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1155#ifdef USE_DEVICES
1156 buffer.encode_uint32(8, this->device_id);
1157#endif
1158}
1160 size.add_length(1, this->object_id_ref_.size());
1161 size.add_fixed32(1, this->key);
1162 size.add_length(1, this->name_ref_.size());
1163 size.add_bool(1, this->disabled_by_default);
1164#ifdef USE_ENTITY_ICON
1165 size.add_length(1, this->icon_ref_.size());
1166#endif
1167 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1168#ifdef USE_DEVICES
1169 size.add_uint32(1, this->device_id);
1170#endif
1171}
1173 buffer.encode_fixed32(1, this->key);
1174 buffer.encode_bytes(2, this->data_ptr_, this->data_len_);
1175 buffer.encode_bool(3, this->done);
1176#ifdef USE_DEVICES
1177 buffer.encode_uint32(4, this->device_id);
1178#endif
1179}
1181 size.add_fixed32(1, this->key);
1182 size.add_length(1, this->data_len_);
1183 size.add_bool(1, this->done);
1184#ifdef USE_DEVICES
1185 size.add_uint32(1, this->device_id);
1186#endif
1187}
1188bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1189 switch (field_id) {
1190 case 1:
1191 this->single = value.as_bool();
1192 break;
1193 case 2:
1194 this->stream = value.as_bool();
1195 break;
1196 default:
1197 return false;
1198 }
1199 return true;
1200}
1201#endif
1202#ifdef USE_CLIMATE
1204 buffer.encode_string(1, this->object_id_ref_);
1205 buffer.encode_fixed32(2, this->key);
1206 buffer.encode_string(3, this->name_ref_);
1209 for (const auto &it : *this->supported_modes) {
1210 buffer.encode_uint32(7, static_cast<uint32_t>(it), true);
1211 }
1212 buffer.encode_float(8, this->visual_min_temperature);
1213 buffer.encode_float(9, this->visual_max_temperature);
1215 buffer.encode_bool(12, this->supports_action);
1216 for (const auto &it : *this->supported_fan_modes) {
1217 buffer.encode_uint32(13, static_cast<uint32_t>(it), true);
1218 }
1219 for (const auto &it : *this->supported_swing_modes) {
1220 buffer.encode_uint32(14, static_cast<uint32_t>(it), true);
1221 }
1222 for (const char *it : *this->supported_custom_fan_modes) {
1223 buffer.encode_string(15, it, strlen(it), true);
1224 }
1225 for (const auto &it : *this->supported_presets) {
1226 buffer.encode_uint32(16, static_cast<uint32_t>(it), true);
1227 }
1228 for (const char *it : *this->supported_custom_presets) {
1229 buffer.encode_string(17, it, strlen(it), true);
1230 }
1231 buffer.encode_bool(18, this->disabled_by_default);
1232#ifdef USE_ENTITY_ICON
1233 buffer.encode_string(19, this->icon_ref_);
1234#endif
1235 buffer.encode_uint32(20, static_cast<uint32_t>(this->entity_category));
1237 buffer.encode_bool(22, this->supports_current_humidity);
1238 buffer.encode_bool(23, this->supports_target_humidity);
1239 buffer.encode_float(24, this->visual_min_humidity);
1240 buffer.encode_float(25, this->visual_max_humidity);
1241#ifdef USE_DEVICES
1242 buffer.encode_uint32(26, this->device_id);
1243#endif
1244 buffer.encode_uint32(27, this->feature_flags);
1245}
1247 size.add_length(1, this->object_id_ref_.size());
1248 size.add_fixed32(1, this->key);
1249 size.add_length(1, this->name_ref_.size());
1252 if (!this->supported_modes->empty()) {
1253 for (const auto &it : *this->supported_modes) {
1254 size.add_uint32_force(1, static_cast<uint32_t>(it));
1255 }
1256 }
1257 size.add_float(1, this->visual_min_temperature);
1258 size.add_float(1, this->visual_max_temperature);
1260 size.add_bool(1, this->supports_action);
1261 if (!this->supported_fan_modes->empty()) {
1262 for (const auto &it : *this->supported_fan_modes) {
1263 size.add_uint32_force(1, static_cast<uint32_t>(it));
1264 }
1265 }
1266 if (!this->supported_swing_modes->empty()) {
1267 for (const auto &it : *this->supported_swing_modes) {
1268 size.add_uint32_force(1, static_cast<uint32_t>(it));
1269 }
1270 }
1271 if (!this->supported_custom_fan_modes->empty()) {
1272 for (const char *it : *this->supported_custom_fan_modes) {
1273 size.add_length_force(1, strlen(it));
1274 }
1275 }
1276 if (!this->supported_presets->empty()) {
1277 for (const auto &it : *this->supported_presets) {
1278 size.add_uint32_force(2, static_cast<uint32_t>(it));
1279 }
1280 }
1281 if (!this->supported_custom_presets->empty()) {
1282 for (const char *it : *this->supported_custom_presets) {
1283 size.add_length_force(2, strlen(it));
1284 }
1285 }
1286 size.add_bool(2, this->disabled_by_default);
1287#ifdef USE_ENTITY_ICON
1288 size.add_length(2, this->icon_ref_.size());
1289#endif
1290 size.add_uint32(2, static_cast<uint32_t>(this->entity_category));
1292 size.add_bool(2, this->supports_current_humidity);
1293 size.add_bool(2, this->supports_target_humidity);
1294 size.add_float(2, this->visual_min_humidity);
1295 size.add_float(2, this->visual_max_humidity);
1296#ifdef USE_DEVICES
1297 size.add_uint32(2, this->device_id);
1298#endif
1299 size.add_uint32(2, this->feature_flags);
1300}
1302 buffer.encode_fixed32(1, this->key);
1303 buffer.encode_uint32(2, static_cast<uint32_t>(this->mode));
1304 buffer.encode_float(3, this->current_temperature);
1305 buffer.encode_float(4, this->target_temperature);
1306 buffer.encode_float(5, this->target_temperature_low);
1307 buffer.encode_float(6, this->target_temperature_high);
1308 buffer.encode_uint32(8, static_cast<uint32_t>(this->action));
1309 buffer.encode_uint32(9, static_cast<uint32_t>(this->fan_mode));
1310 buffer.encode_uint32(10, static_cast<uint32_t>(this->swing_mode));
1311 buffer.encode_string(11, this->custom_fan_mode_ref_);
1312 buffer.encode_uint32(12, static_cast<uint32_t>(this->preset));
1313 buffer.encode_string(13, this->custom_preset_ref_);
1314 buffer.encode_float(14, this->current_humidity);
1315 buffer.encode_float(15, this->target_humidity);
1316#ifdef USE_DEVICES
1317 buffer.encode_uint32(16, this->device_id);
1318#endif
1319}
1321 size.add_fixed32(1, this->key);
1322 size.add_uint32(1, static_cast<uint32_t>(this->mode));
1323 size.add_float(1, this->current_temperature);
1324 size.add_float(1, this->target_temperature);
1325 size.add_float(1, this->target_temperature_low);
1326 size.add_float(1, this->target_temperature_high);
1327 size.add_uint32(1, static_cast<uint32_t>(this->action));
1328 size.add_uint32(1, static_cast<uint32_t>(this->fan_mode));
1329 size.add_uint32(1, static_cast<uint32_t>(this->swing_mode));
1330 size.add_length(1, this->custom_fan_mode_ref_.size());
1331 size.add_uint32(1, static_cast<uint32_t>(this->preset));
1332 size.add_length(1, this->custom_preset_ref_.size());
1333 size.add_float(1, this->current_humidity);
1334 size.add_float(1, this->target_humidity);
1335#ifdef USE_DEVICES
1336 size.add_uint32(2, this->device_id);
1337#endif
1338}
1340 switch (field_id) {
1341 case 2:
1342 this->has_mode = value.as_bool();
1343 break;
1344 case 3:
1345 this->mode = static_cast<enums::ClimateMode>(value.as_uint32());
1346 break;
1347 case 4:
1348 this->has_target_temperature = value.as_bool();
1349 break;
1350 case 6:
1351 this->has_target_temperature_low = value.as_bool();
1352 break;
1353 case 8:
1354 this->has_target_temperature_high = value.as_bool();
1355 break;
1356 case 12:
1357 this->has_fan_mode = value.as_bool();
1358 break;
1359 case 13:
1360 this->fan_mode = static_cast<enums::ClimateFanMode>(value.as_uint32());
1361 break;
1362 case 14:
1363 this->has_swing_mode = value.as_bool();
1364 break;
1365 case 15:
1366 this->swing_mode = static_cast<enums::ClimateSwingMode>(value.as_uint32());
1367 break;
1368 case 16:
1369 this->has_custom_fan_mode = value.as_bool();
1370 break;
1371 case 18:
1372 this->has_preset = value.as_bool();
1373 break;
1374 case 19:
1375 this->preset = static_cast<enums::ClimatePreset>(value.as_uint32());
1376 break;
1377 case 20:
1378 this->has_custom_preset = value.as_bool();
1379 break;
1380 case 22:
1381 this->has_target_humidity = value.as_bool();
1382 break;
1383#ifdef USE_DEVICES
1384 case 24:
1385 this->device_id = value.as_uint32();
1386 break;
1387#endif
1388 default:
1389 return false;
1390 }
1391 return true;
1392}
1394 switch (field_id) {
1395 case 17:
1396 this->custom_fan_mode = value.as_string();
1397 break;
1398 case 21:
1399 this->custom_preset = value.as_string();
1400 break;
1401 default:
1402 return false;
1403 }
1404 return true;
1405}
1406bool ClimateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1407 switch (field_id) {
1408 case 1:
1409 this->key = value.as_fixed32();
1410 break;
1411 case 5:
1412 this->target_temperature = value.as_float();
1413 break;
1414 case 7:
1415 this->target_temperature_low = value.as_float();
1416 break;
1417 case 9:
1418 this->target_temperature_high = value.as_float();
1419 break;
1420 case 23:
1421 this->target_humidity = value.as_float();
1422 break;
1423 default:
1424 return false;
1425 }
1426 return true;
1427}
1428#endif
1429#ifdef USE_NUMBER
1431 buffer.encode_string(1, this->object_id_ref_);
1432 buffer.encode_fixed32(2, this->key);
1433 buffer.encode_string(3, this->name_ref_);
1434#ifdef USE_ENTITY_ICON
1435 buffer.encode_string(5, this->icon_ref_);
1436#endif
1437 buffer.encode_float(6, this->min_value);
1438 buffer.encode_float(7, this->max_value);
1439 buffer.encode_float(8, this->step);
1440 buffer.encode_bool(9, this->disabled_by_default);
1441 buffer.encode_uint32(10, static_cast<uint32_t>(this->entity_category));
1442 buffer.encode_string(11, this->unit_of_measurement_ref_);
1443 buffer.encode_uint32(12, static_cast<uint32_t>(this->mode));
1444 buffer.encode_string(13, this->device_class_ref_);
1445#ifdef USE_DEVICES
1446 buffer.encode_uint32(14, this->device_id);
1447#endif
1448}
1450 size.add_length(1, this->object_id_ref_.size());
1451 size.add_fixed32(1, this->key);
1452 size.add_length(1, this->name_ref_.size());
1453#ifdef USE_ENTITY_ICON
1454 size.add_length(1, this->icon_ref_.size());
1455#endif
1456 size.add_float(1, this->min_value);
1457 size.add_float(1, this->max_value);
1458 size.add_float(1, this->step);
1459 size.add_bool(1, this->disabled_by_default);
1460 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1461 size.add_length(1, this->unit_of_measurement_ref_.size());
1462 size.add_uint32(1, static_cast<uint32_t>(this->mode));
1463 size.add_length(1, this->device_class_ref_.size());
1464#ifdef USE_DEVICES
1465 size.add_uint32(1, this->device_id);
1466#endif
1467}
1469 buffer.encode_fixed32(1, this->key);
1470 buffer.encode_float(2, this->state);
1471 buffer.encode_bool(3, this->missing_state);
1472#ifdef USE_DEVICES
1473 buffer.encode_uint32(4, this->device_id);
1474#endif
1475}
1477 size.add_fixed32(1, this->key);
1478 size.add_float(1, this->state);
1479 size.add_bool(1, this->missing_state);
1480#ifdef USE_DEVICES
1481 size.add_uint32(1, this->device_id);
1482#endif
1483}
1484bool NumberCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1485 switch (field_id) {
1486#ifdef USE_DEVICES
1487 case 3:
1488 this->device_id = value.as_uint32();
1489 break;
1490#endif
1491 default:
1492 return false;
1493 }
1494 return true;
1495}
1496bool NumberCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1497 switch (field_id) {
1498 case 1:
1499 this->key = value.as_fixed32();
1500 break;
1501 case 2:
1502 this->state = value.as_float();
1503 break;
1504 default:
1505 return false;
1506 }
1507 return true;
1508}
1509#endif
1510#ifdef USE_SELECT
1512 buffer.encode_string(1, this->object_id_ref_);
1513 buffer.encode_fixed32(2, this->key);
1514 buffer.encode_string(3, this->name_ref_);
1515#ifdef USE_ENTITY_ICON
1516 buffer.encode_string(5, this->icon_ref_);
1517#endif
1518 for (const char *it : *this->options) {
1519 buffer.encode_string(6, it, strlen(it), true);
1520 }
1521 buffer.encode_bool(7, this->disabled_by_default);
1522 buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
1523#ifdef USE_DEVICES
1524 buffer.encode_uint32(9, this->device_id);
1525#endif
1526}
1528 size.add_length(1, this->object_id_ref_.size());
1529 size.add_fixed32(1, this->key);
1530 size.add_length(1, this->name_ref_.size());
1531#ifdef USE_ENTITY_ICON
1532 size.add_length(1, this->icon_ref_.size());
1533#endif
1534 if (!this->options->empty()) {
1535 for (const char *it : *this->options) {
1536 size.add_length_force(1, strlen(it));
1537 }
1538 }
1539 size.add_bool(1, this->disabled_by_default);
1540 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1541#ifdef USE_DEVICES
1542 size.add_uint32(1, this->device_id);
1543#endif
1544}
1546 buffer.encode_fixed32(1, this->key);
1547 buffer.encode_string(2, this->state_ref_);
1548 buffer.encode_bool(3, this->missing_state);
1549#ifdef USE_DEVICES
1550 buffer.encode_uint32(4, this->device_id);
1551#endif
1552}
1554 size.add_fixed32(1, this->key);
1555 size.add_length(1, this->state_ref_.size());
1556 size.add_bool(1, this->missing_state);
1557#ifdef USE_DEVICES
1558 size.add_uint32(1, this->device_id);
1559#endif
1560}
1561bool SelectCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1562 switch (field_id) {
1563#ifdef USE_DEVICES
1564 case 3:
1565 this->device_id = value.as_uint32();
1566 break;
1567#endif
1568 default:
1569 return false;
1570 }
1571 return true;
1572}
1574 switch (field_id) {
1575 case 2: {
1576 // Use raw data directly to avoid allocation
1577 this->state = value.data();
1578 this->state_len = value.size();
1579 break;
1580 }
1581 default:
1582 return false;
1583 }
1584 return true;
1585}
1586bool SelectCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1587 switch (field_id) {
1588 case 1:
1589 this->key = value.as_fixed32();
1590 break;
1591 default:
1592 return false;
1593 }
1594 return true;
1595}
1596#endif
1597#ifdef USE_SIREN
1599 buffer.encode_string(1, this->object_id_ref_);
1600 buffer.encode_fixed32(2, this->key);
1601 buffer.encode_string(3, this->name_ref_);
1602#ifdef USE_ENTITY_ICON
1603 buffer.encode_string(5, this->icon_ref_);
1604#endif
1605 buffer.encode_bool(6, this->disabled_by_default);
1606 for (auto &it : this->tones) {
1607 buffer.encode_string(7, it, true);
1608 }
1609 buffer.encode_bool(8, this->supports_duration);
1610 buffer.encode_bool(9, this->supports_volume);
1611 buffer.encode_uint32(10, static_cast<uint32_t>(this->entity_category));
1612#ifdef USE_DEVICES
1613 buffer.encode_uint32(11, this->device_id);
1614#endif
1615}
1617 size.add_length(1, this->object_id_ref_.size());
1618 size.add_fixed32(1, this->key);
1619 size.add_length(1, this->name_ref_.size());
1620#ifdef USE_ENTITY_ICON
1621 size.add_length(1, this->icon_ref_.size());
1622#endif
1623 size.add_bool(1, this->disabled_by_default);
1624 if (!this->tones.empty()) {
1625 for (const auto &it : this->tones) {
1626 size.add_length_force(1, it.size());
1627 }
1628 }
1629 size.add_bool(1, this->supports_duration);
1630 size.add_bool(1, this->supports_volume);
1631 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1632#ifdef USE_DEVICES
1633 size.add_uint32(1, this->device_id);
1634#endif
1635}
1637 buffer.encode_fixed32(1, this->key);
1638 buffer.encode_bool(2, this->state);
1639#ifdef USE_DEVICES
1640 buffer.encode_uint32(3, this->device_id);
1641#endif
1642}
1644 size.add_fixed32(1, this->key);
1645 size.add_bool(1, this->state);
1646#ifdef USE_DEVICES
1647 size.add_uint32(1, this->device_id);
1648#endif
1649}
1650bool SirenCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1651 switch (field_id) {
1652 case 2:
1653 this->has_state = value.as_bool();
1654 break;
1655 case 3:
1656 this->state = value.as_bool();
1657 break;
1658 case 4:
1659 this->has_tone = value.as_bool();
1660 break;
1661 case 6:
1662 this->has_duration = value.as_bool();
1663 break;
1664 case 7:
1665 this->duration = value.as_uint32();
1666 break;
1667 case 8:
1668 this->has_volume = value.as_bool();
1669 break;
1670#ifdef USE_DEVICES
1671 case 10:
1672 this->device_id = value.as_uint32();
1673 break;
1674#endif
1675 default:
1676 return false;
1677 }
1678 return true;
1679}
1681 switch (field_id) {
1682 case 5:
1683 this->tone = value.as_string();
1684 break;
1685 default:
1686 return false;
1687 }
1688 return true;
1689}
1690bool SirenCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1691 switch (field_id) {
1692 case 1:
1693 this->key = value.as_fixed32();
1694 break;
1695 case 9:
1696 this->volume = value.as_float();
1697 break;
1698 default:
1699 return false;
1700 }
1701 return true;
1702}
1703#endif
1704#ifdef USE_LOCK
1706 buffer.encode_string(1, this->object_id_ref_);
1707 buffer.encode_fixed32(2, this->key);
1708 buffer.encode_string(3, this->name_ref_);
1709#ifdef USE_ENTITY_ICON
1710 buffer.encode_string(5, this->icon_ref_);
1711#endif
1712 buffer.encode_bool(6, this->disabled_by_default);
1713 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1714 buffer.encode_bool(8, this->assumed_state);
1715 buffer.encode_bool(9, this->supports_open);
1716 buffer.encode_bool(10, this->requires_code);
1717 buffer.encode_string(11, this->code_format_ref_);
1718#ifdef USE_DEVICES
1719 buffer.encode_uint32(12, this->device_id);
1720#endif
1721}
1723 size.add_length(1, this->object_id_ref_.size());
1724 size.add_fixed32(1, this->key);
1725 size.add_length(1, this->name_ref_.size());
1726#ifdef USE_ENTITY_ICON
1727 size.add_length(1, this->icon_ref_.size());
1728#endif
1729 size.add_bool(1, this->disabled_by_default);
1730 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1731 size.add_bool(1, this->assumed_state);
1732 size.add_bool(1, this->supports_open);
1733 size.add_bool(1, this->requires_code);
1734 size.add_length(1, this->code_format_ref_.size());
1735#ifdef USE_DEVICES
1736 size.add_uint32(1, this->device_id);
1737#endif
1738}
1740 buffer.encode_fixed32(1, this->key);
1741 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
1742#ifdef USE_DEVICES
1743 buffer.encode_uint32(3, this->device_id);
1744#endif
1745}
1747 size.add_fixed32(1, this->key);
1748 size.add_uint32(1, static_cast<uint32_t>(this->state));
1749#ifdef USE_DEVICES
1750 size.add_uint32(1, this->device_id);
1751#endif
1752}
1753bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1754 switch (field_id) {
1755 case 2:
1756 this->command = static_cast<enums::LockCommand>(value.as_uint32());
1757 break;
1758 case 3:
1759 this->has_code = value.as_bool();
1760 break;
1761#ifdef USE_DEVICES
1762 case 5:
1763 this->device_id = value.as_uint32();
1764 break;
1765#endif
1766 default:
1767 return false;
1768 }
1769 return true;
1770}
1772 switch (field_id) {
1773 case 4:
1774 this->code = value.as_string();
1775 break;
1776 default:
1777 return false;
1778 }
1779 return true;
1780}
1781bool LockCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1782 switch (field_id) {
1783 case 1:
1784 this->key = value.as_fixed32();
1785 break;
1786 default:
1787 return false;
1788 }
1789 return true;
1790}
1791#endif
1792#ifdef USE_BUTTON
1794 buffer.encode_string(1, this->object_id_ref_);
1795 buffer.encode_fixed32(2, this->key);
1796 buffer.encode_string(3, this->name_ref_);
1797#ifdef USE_ENTITY_ICON
1798 buffer.encode_string(5, this->icon_ref_);
1799#endif
1800 buffer.encode_bool(6, this->disabled_by_default);
1801 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1802 buffer.encode_string(8, this->device_class_ref_);
1803#ifdef USE_DEVICES
1804 buffer.encode_uint32(9, this->device_id);
1805#endif
1806}
1808 size.add_length(1, this->object_id_ref_.size());
1809 size.add_fixed32(1, this->key);
1810 size.add_length(1, this->name_ref_.size());
1811#ifdef USE_ENTITY_ICON
1812 size.add_length(1, this->icon_ref_.size());
1813#endif
1814 size.add_bool(1, this->disabled_by_default);
1815 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1816 size.add_length(1, this->device_class_ref_.size());
1817#ifdef USE_DEVICES
1818 size.add_uint32(1, this->device_id);
1819#endif
1820}
1821bool ButtonCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1822 switch (field_id) {
1823#ifdef USE_DEVICES
1824 case 2:
1825 this->device_id = value.as_uint32();
1826 break;
1827#endif
1828 default:
1829 return false;
1830 }
1831 return true;
1832}
1833bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1834 switch (field_id) {
1835 case 1:
1836 this->key = value.as_fixed32();
1837 break;
1838 default:
1839 return false;
1840 }
1841 return true;
1842}
1843#endif
1844#ifdef USE_MEDIA_PLAYER
1846 buffer.encode_string(1, this->format_ref_);
1847 buffer.encode_uint32(2, this->sample_rate);
1848 buffer.encode_uint32(3, this->num_channels);
1849 buffer.encode_uint32(4, static_cast<uint32_t>(this->purpose));
1850 buffer.encode_uint32(5, this->sample_bytes);
1851}
1853 size.add_length(1, this->format_ref_.size());
1854 size.add_uint32(1, this->sample_rate);
1855 size.add_uint32(1, this->num_channels);
1856 size.add_uint32(1, static_cast<uint32_t>(this->purpose));
1857 size.add_uint32(1, this->sample_bytes);
1858}
1860 buffer.encode_string(1, this->object_id_ref_);
1861 buffer.encode_fixed32(2, this->key);
1862 buffer.encode_string(3, this->name_ref_);
1863#ifdef USE_ENTITY_ICON
1864 buffer.encode_string(5, this->icon_ref_);
1865#endif
1866 buffer.encode_bool(6, this->disabled_by_default);
1867 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
1868 buffer.encode_bool(8, this->supports_pause);
1869 for (auto &it : this->supported_formats) {
1870 buffer.encode_message(9, it, true);
1871 }
1872#ifdef USE_DEVICES
1873 buffer.encode_uint32(10, this->device_id);
1874#endif
1875 buffer.encode_uint32(11, this->feature_flags);
1876}
1878 size.add_length(1, this->object_id_ref_.size());
1879 size.add_fixed32(1, this->key);
1880 size.add_length(1, this->name_ref_.size());
1881#ifdef USE_ENTITY_ICON
1882 size.add_length(1, this->icon_ref_.size());
1883#endif
1884 size.add_bool(1, this->disabled_by_default);
1885 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
1886 size.add_bool(1, this->supports_pause);
1888#ifdef USE_DEVICES
1889 size.add_uint32(1, this->device_id);
1890#endif
1891 size.add_uint32(1, this->feature_flags);
1892}
1894 buffer.encode_fixed32(1, this->key);
1895 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
1896 buffer.encode_float(3, this->volume);
1897 buffer.encode_bool(4, this->muted);
1898#ifdef USE_DEVICES
1899 buffer.encode_uint32(5, this->device_id);
1900#endif
1901}
1903 size.add_fixed32(1, this->key);
1904 size.add_uint32(1, static_cast<uint32_t>(this->state));
1905 size.add_float(1, this->volume);
1906 size.add_bool(1, this->muted);
1907#ifdef USE_DEVICES
1908 size.add_uint32(1, this->device_id);
1909#endif
1910}
1912 switch (field_id) {
1913 case 2:
1914 this->has_command = value.as_bool();
1915 break;
1916 case 3:
1917 this->command = static_cast<enums::MediaPlayerCommand>(value.as_uint32());
1918 break;
1919 case 4:
1920 this->has_volume = value.as_bool();
1921 break;
1922 case 6:
1923 this->has_media_url = value.as_bool();
1924 break;
1925 case 8:
1926 this->has_announcement = value.as_bool();
1927 break;
1928 case 9:
1929 this->announcement = value.as_bool();
1930 break;
1931#ifdef USE_DEVICES
1932 case 10:
1933 this->device_id = value.as_uint32();
1934 break;
1935#endif
1936 default:
1937 return false;
1938 }
1939 return true;
1940}
1942 switch (field_id) {
1943 case 7:
1944 this->media_url = value.as_string();
1945 break;
1946 default:
1947 return false;
1948 }
1949 return true;
1950}
1952 switch (field_id) {
1953 case 1:
1954 this->key = value.as_fixed32();
1955 break;
1956 case 5:
1957 this->volume = value.as_float();
1958 break;
1959 default:
1960 return false;
1961 }
1962 return true;
1963}
1964#endif
1965#ifdef USE_BLUETOOTH_PROXY
1967 switch (field_id) {
1968 case 1:
1969 this->flags = value.as_uint32();
1970 break;
1971 default:
1972 return false;
1973 }
1974 return true;
1975}
1977 buffer.encode_uint64(1, this->address);
1978 buffer.encode_sint32(2, this->rssi);
1979 buffer.encode_uint32(3, this->address_type);
1980 buffer.encode_bytes(4, this->data, this->data_len);
1981}
1983 size.add_uint64(1, this->address);
1984 size.add_sint32(1, this->rssi);
1985 size.add_uint32(1, this->address_type);
1986 size.add_length(1, this->data_len);
1987}
1989 for (uint16_t i = 0; i < this->advertisements_len; i++) {
1990 buffer.encode_message(1, this->advertisements[i], true);
1991 }
1992}
1994 for (uint16_t i = 0; i < this->advertisements_len; i++) {
1995 size.add_message_object_force(1, this->advertisements[i]);
1996 }
1997}
1999 switch (field_id) {
2000 case 1:
2001 this->address = value.as_uint64();
2002 break;
2003 case 2:
2004 this->request_type = static_cast<enums::BluetoothDeviceRequestType>(value.as_uint32());
2005 break;
2006 case 3:
2007 this->has_address_type = value.as_bool();
2008 break;
2009 case 4:
2010 this->address_type = value.as_uint32();
2011 break;
2012 default:
2013 return false;
2014 }
2015 return true;
2016}
2018 buffer.encode_uint64(1, this->address);
2019 buffer.encode_bool(2, this->connected);
2020 buffer.encode_uint32(3, this->mtu);
2021 buffer.encode_int32(4, this->error);
2022}
2024 size.add_uint64(1, this->address);
2025 size.add_bool(1, this->connected);
2026 size.add_uint32(1, this->mtu);
2027 size.add_int32(1, this->error);
2028}
2030 switch (field_id) {
2031 case 1:
2032 this->address = value.as_uint64();
2033 break;
2034 default:
2035 return false;
2036 }
2037 return true;
2038}
2040 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2041 buffer.encode_uint64(1, this->uuid[0], true);
2042 buffer.encode_uint64(1, this->uuid[1], true);
2043 }
2044 buffer.encode_uint32(2, this->handle);
2045 buffer.encode_uint32(3, this->short_uuid);
2046}
2048 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2049 size.add_uint64_force(1, this->uuid[0]);
2050 size.add_uint64_force(1, this->uuid[1]);
2051 }
2052 size.add_uint32(1, this->handle);
2053 size.add_uint32(1, this->short_uuid);
2054}
2056 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2057 buffer.encode_uint64(1, this->uuid[0], true);
2058 buffer.encode_uint64(1, this->uuid[1], true);
2059 }
2060 buffer.encode_uint32(2, this->handle);
2061 buffer.encode_uint32(3, this->properties);
2062 for (auto &it : this->descriptors) {
2063 buffer.encode_message(4, it, true);
2064 }
2065 buffer.encode_uint32(5, this->short_uuid);
2066}
2068 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2069 size.add_uint64_force(1, this->uuid[0]);
2070 size.add_uint64_force(1, this->uuid[1]);
2071 }
2072 size.add_uint32(1, this->handle);
2073 size.add_uint32(1, this->properties);
2074 size.add_repeated_message(1, this->descriptors);
2075 size.add_uint32(1, this->short_uuid);
2076}
2078 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2079 buffer.encode_uint64(1, this->uuid[0], true);
2080 buffer.encode_uint64(1, this->uuid[1], true);
2081 }
2082 buffer.encode_uint32(2, this->handle);
2083 for (auto &it : this->characteristics) {
2084 buffer.encode_message(3, it, true);
2085 }
2086 buffer.encode_uint32(4, this->short_uuid);
2087}
2089 if (this->uuid[0] != 0 || this->uuid[1] != 0) {
2090 size.add_uint64_force(1, this->uuid[0]);
2091 size.add_uint64_force(1, this->uuid[1]);
2092 }
2093 size.add_uint32(1, this->handle);
2095 size.add_uint32(1, this->short_uuid);
2096}
2098 buffer.encode_uint64(1, this->address);
2099 for (auto &it : this->services) {
2100 buffer.encode_message(2, it, true);
2101 }
2102}
2104 size.add_uint64(1, this->address);
2105 size.add_repeated_message(1, this->services);
2106}
2112 switch (field_id) {
2113 case 1:
2114 this->address = value.as_uint64();
2115 break;
2116 case 2:
2117 this->handle = value.as_uint32();
2118 break;
2119 default:
2120 return false;
2121 }
2122 return true;
2123}
2125 buffer.encode_uint64(1, this->address);
2126 buffer.encode_uint32(2, this->handle);
2127 buffer.encode_bytes(3, this->data_ptr_, this->data_len_);
2128}
2130 size.add_uint64(1, this->address);
2131 size.add_uint32(1, this->handle);
2132 size.add_length(1, this->data_len_);
2133}
2135 switch (field_id) {
2136 case 1:
2137 this->address = value.as_uint64();
2138 break;
2139 case 2:
2140 this->handle = value.as_uint32();
2141 break;
2142 case 3:
2143 this->response = value.as_bool();
2144 break;
2145 default:
2146 return false;
2147 }
2148 return true;
2149}
2151 switch (field_id) {
2152 case 4: {
2153 // Use raw data directly to avoid allocation
2154 this->data = value.data();
2155 this->data_len = value.size();
2156 break;
2157 }
2158 default:
2159 return false;
2160 }
2161 return true;
2162}
2164 switch (field_id) {
2165 case 1:
2166 this->address = value.as_uint64();
2167 break;
2168 case 2:
2169 this->handle = value.as_uint32();
2170 break;
2171 default:
2172 return false;
2173 }
2174 return true;
2175}
2177 switch (field_id) {
2178 case 1:
2179 this->address = value.as_uint64();
2180 break;
2181 case 2:
2182 this->handle = value.as_uint32();
2183 break;
2184 default:
2185 return false;
2186 }
2187 return true;
2188}
2190 switch (field_id) {
2191 case 3: {
2192 // Use raw data directly to avoid allocation
2193 this->data = value.data();
2194 this->data_len = value.size();
2195 break;
2196 }
2197 default:
2198 return false;
2199 }
2200 return true;
2201}
2203 switch (field_id) {
2204 case 1:
2205 this->address = value.as_uint64();
2206 break;
2207 case 2:
2208 this->handle = value.as_uint32();
2209 break;
2210 case 3:
2211 this->enable = value.as_bool();
2212 break;
2213 default:
2214 return false;
2215 }
2216 return true;
2217}
2219 buffer.encode_uint64(1, this->address);
2220 buffer.encode_uint32(2, this->handle);
2221 buffer.encode_bytes(3, this->data_ptr_, this->data_len_);
2222}
2224 size.add_uint64(1, this->address);
2225 size.add_uint32(1, this->handle);
2226 size.add_length(1, this->data_len_);
2227}
2229 buffer.encode_uint32(1, this->free);
2230 buffer.encode_uint32(2, this->limit);
2231 for (const auto &it : this->allocated) {
2232 if (it != 0) {
2233 buffer.encode_uint64(3, it, true);
2234 }
2235 }
2236}
2238 size.add_uint32(1, this->free);
2239 size.add_uint32(1, this->limit);
2240 for (const auto &it : this->allocated) {
2241 if (it != 0) {
2242 size.add_uint64_force(1, it);
2243 }
2244 }
2245}
2247 buffer.encode_uint64(1, this->address);
2248 buffer.encode_uint32(2, this->handle);
2249 buffer.encode_int32(3, this->error);
2250}
2252 size.add_uint64(1, this->address);
2253 size.add_uint32(1, this->handle);
2254 size.add_int32(1, this->error);
2255}
2257 buffer.encode_uint64(1, this->address);
2258 buffer.encode_uint32(2, this->handle);
2259}
2261 size.add_uint64(1, this->address);
2262 size.add_uint32(1, this->handle);
2263}
2265 buffer.encode_uint64(1, this->address);
2266 buffer.encode_uint32(2, this->handle);
2267}
2269 size.add_uint64(1, this->address);
2270 size.add_uint32(1, this->handle);
2271}
2273 buffer.encode_uint64(1, this->address);
2274 buffer.encode_bool(2, this->paired);
2275 buffer.encode_int32(3, this->error);
2276}
2278 size.add_uint64(1, this->address);
2279 size.add_bool(1, this->paired);
2280 size.add_int32(1, this->error);
2281}
2283 buffer.encode_uint64(1, this->address);
2284 buffer.encode_bool(2, this->success);
2285 buffer.encode_int32(3, this->error);
2286}
2288 size.add_uint64(1, this->address);
2289 size.add_bool(1, this->success);
2290 size.add_int32(1, this->error);
2291}
2293 buffer.encode_uint64(1, this->address);
2294 buffer.encode_bool(2, this->success);
2295 buffer.encode_int32(3, this->error);
2296}
2298 size.add_uint64(1, this->address);
2299 size.add_bool(1, this->success);
2300 size.add_int32(1, this->error);
2301}
2303 buffer.encode_uint32(1, static_cast<uint32_t>(this->state));
2304 buffer.encode_uint32(2, static_cast<uint32_t>(this->mode));
2305 buffer.encode_uint32(3, static_cast<uint32_t>(this->configured_mode));
2306}
2308 size.add_uint32(1, static_cast<uint32_t>(this->state));
2309 size.add_uint32(1, static_cast<uint32_t>(this->mode));
2310 size.add_uint32(1, static_cast<uint32_t>(this->configured_mode));
2311}
2313 switch (field_id) {
2314 case 1:
2315 this->mode = static_cast<enums::BluetoothScannerMode>(value.as_uint32());
2316 break;
2317 default:
2318 return false;
2319 }
2320 return true;
2321}
2322#endif
2323#ifdef USE_VOICE_ASSISTANT
2325 switch (field_id) {
2326 case 1:
2327 this->subscribe = value.as_bool();
2328 break;
2329 case 2:
2330 this->flags = value.as_uint32();
2331 break;
2332 default:
2333 return false;
2334 }
2335 return true;
2336}
2338 buffer.encode_uint32(1, this->noise_suppression_level);
2339 buffer.encode_uint32(2, this->auto_gain);
2340 buffer.encode_float(3, this->volume_multiplier);
2341}
2343 size.add_uint32(1, this->noise_suppression_level);
2344 size.add_uint32(1, this->auto_gain);
2345 size.add_float(1, this->volume_multiplier);
2346}
2348 buffer.encode_bool(1, this->start);
2349 buffer.encode_string(2, this->conversation_id_ref_);
2350 buffer.encode_uint32(3, this->flags);
2351 buffer.encode_message(4, this->audio_settings);
2352 buffer.encode_string(5, this->wake_word_phrase_ref_);
2353}
2355 size.add_bool(1, this->start);
2356 size.add_length(1, this->conversation_id_ref_.size());
2357 size.add_uint32(1, this->flags);
2358 size.add_message_object(1, this->audio_settings);
2359 size.add_length(1, this->wake_word_phrase_ref_.size());
2360}
2362 switch (field_id) {
2363 case 1:
2364 this->port = value.as_uint32();
2365 break;
2366 case 2:
2367 this->error = value.as_bool();
2368 break;
2369 default:
2370 return false;
2371 }
2372 return true;
2373}
2375 switch (field_id) {
2376 case 1:
2377 this->name = value.as_string();
2378 break;
2379 case 2:
2380 this->value = value.as_string();
2381 break;
2382 default:
2383 return false;
2384 }
2385 return true;
2386}
2388 switch (field_id) {
2389 case 1:
2390 this->event_type = static_cast<enums::VoiceAssistantEvent>(value.as_uint32());
2391 break;
2392 default:
2393 return false;
2394 }
2395 return true;
2396}
2398 switch (field_id) {
2399 case 2:
2400 this->data.emplace_back();
2401 value.decode_to_message(this->data.back());
2402 break;
2403 default:
2404 return false;
2405 }
2406 return true;
2407}
2408bool VoiceAssistantAudio::decode_varint(uint32_t field_id, ProtoVarInt value) {
2409 switch (field_id) {
2410 case 2:
2411 this->end = value.as_bool();
2412 break;
2413 default:
2414 return false;
2415 }
2416 return true;
2417}
2419 switch (field_id) {
2420 case 1:
2421 this->data = value.as_string();
2422 break;
2423 default:
2424 return false;
2425 }
2426 return true;
2427}
2429 buffer.encode_bytes(1, this->data_ptr_, this->data_len_);
2430 buffer.encode_bool(2, this->end);
2431}
2433 size.add_length(1, this->data_len_);
2434 size.add_bool(1, this->end);
2435}
2437 switch (field_id) {
2438 case 1:
2439 this->event_type = static_cast<enums::VoiceAssistantTimerEvent>(value.as_uint32());
2440 break;
2441 case 4:
2442 this->total_seconds = value.as_uint32();
2443 break;
2444 case 5:
2445 this->seconds_left = value.as_uint32();
2446 break;
2447 case 6:
2448 this->is_active = value.as_bool();
2449 break;
2450 default:
2451 return false;
2452 }
2453 return true;
2454}
2456 switch (field_id) {
2457 case 2:
2458 this->timer_id = value.as_string();
2459 break;
2460 case 3:
2461 this->name = value.as_string();
2462 break;
2463 default:
2464 return false;
2465 }
2466 return true;
2467}
2469 switch (field_id) {
2470 case 4:
2471 this->start_conversation = value.as_bool();
2472 break;
2473 default:
2474 return false;
2475 }
2476 return true;
2477}
2479 switch (field_id) {
2480 case 1:
2481 this->media_id = value.as_string();
2482 break;
2483 case 2:
2484 this->text = value.as_string();
2485 break;
2486 case 3:
2487 this->preannounce_media_id = value.as_string();
2488 break;
2489 default:
2490 return false;
2491 }
2492 return true;
2493}
2497 buffer.encode_string(1, this->id_ref_);
2498 buffer.encode_string(2, this->wake_word_ref_);
2499 for (auto &it : this->trained_languages) {
2500 buffer.encode_string(3, it, true);
2501 }
2502}
2504 size.add_length(1, this->id_ref_.size());
2505 size.add_length(1, this->wake_word_ref_.size());
2506 if (!this->trained_languages.empty()) {
2507 for (const auto &it : this->trained_languages) {
2508 size.add_length_force(1, it.size());
2509 }
2510 }
2511}
2513 switch (field_id) {
2514 case 5:
2515 this->model_size = value.as_uint32();
2516 break;
2517 default:
2518 return false;
2519 }
2520 return true;
2521}
2523 switch (field_id) {
2524 case 1:
2525 this->id = value.as_string();
2526 break;
2527 case 2:
2528 this->wake_word = value.as_string();
2529 break;
2530 case 3:
2531 this->trained_languages.push_back(value.as_string());
2532 break;
2533 case 4:
2534 this->model_type = value.as_string();
2535 break;
2536 case 6:
2537 this->model_hash = value.as_string();
2538 break;
2539 case 7:
2540 this->url = value.as_string();
2541 break;
2542 default:
2543 return false;
2544 }
2545 return true;
2546}
2548 switch (field_id) {
2549 case 1:
2550 this->external_wake_words.emplace_back();
2551 value.decode_to_message(this->external_wake_words.back());
2552 break;
2553 default:
2554 return false;
2555 }
2556 return true;
2557}
2559 for (auto &it : this->available_wake_words) {
2560 buffer.encode_message(1, it, true);
2561 }
2562 for (const auto &it : *this->active_wake_words) {
2563 buffer.encode_string(2, it, true);
2564 }
2565 buffer.encode_uint32(3, this->max_active_wake_words);
2566}
2569 if (!this->active_wake_words->empty()) {
2570 for (const auto &it : *this->active_wake_words) {
2571 size.add_length_force(1, it.size());
2572 }
2573 }
2574 size.add_uint32(1, this->max_active_wake_words);
2575}
2577 switch (field_id) {
2578 case 1:
2579 this->active_wake_words.push_back(value.as_string());
2580 break;
2581 default:
2582 return false;
2583 }
2584 return true;
2585}
2586#endif
2587#ifdef USE_ALARM_CONTROL_PANEL
2589 buffer.encode_string(1, this->object_id_ref_);
2590 buffer.encode_fixed32(2, this->key);
2591 buffer.encode_string(3, this->name_ref_);
2592#ifdef USE_ENTITY_ICON
2593 buffer.encode_string(5, this->icon_ref_);
2594#endif
2595 buffer.encode_bool(6, this->disabled_by_default);
2596 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2597 buffer.encode_uint32(8, this->supported_features);
2598 buffer.encode_bool(9, this->requires_code);
2599 buffer.encode_bool(10, this->requires_code_to_arm);
2600#ifdef USE_DEVICES
2601 buffer.encode_uint32(11, this->device_id);
2602#endif
2603}
2605 size.add_length(1, this->object_id_ref_.size());
2606 size.add_fixed32(1, this->key);
2607 size.add_length(1, this->name_ref_.size());
2608#ifdef USE_ENTITY_ICON
2609 size.add_length(1, this->icon_ref_.size());
2610#endif
2611 size.add_bool(1, this->disabled_by_default);
2612 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2613 size.add_uint32(1, this->supported_features);
2614 size.add_bool(1, this->requires_code);
2615 size.add_bool(1, this->requires_code_to_arm);
2616#ifdef USE_DEVICES
2617 size.add_uint32(1, this->device_id);
2618#endif
2619}
2621 buffer.encode_fixed32(1, this->key);
2622 buffer.encode_uint32(2, static_cast<uint32_t>(this->state));
2623#ifdef USE_DEVICES
2624 buffer.encode_uint32(3, this->device_id);
2625#endif
2626}
2628 size.add_fixed32(1, this->key);
2629 size.add_uint32(1, static_cast<uint32_t>(this->state));
2630#ifdef USE_DEVICES
2631 size.add_uint32(1, this->device_id);
2632#endif
2633}
2635 switch (field_id) {
2636 case 2:
2637 this->command = static_cast<enums::AlarmControlPanelStateCommand>(value.as_uint32());
2638 break;
2639#ifdef USE_DEVICES
2640 case 4:
2641 this->device_id = value.as_uint32();
2642 break;
2643#endif
2644 default:
2645 return false;
2646 }
2647 return true;
2648}
2650 switch (field_id) {
2651 case 3:
2652 this->code = value.as_string();
2653 break;
2654 default:
2655 return false;
2656 }
2657 return true;
2658}
2660 switch (field_id) {
2661 case 1:
2662 this->key = value.as_fixed32();
2663 break;
2664 default:
2665 return false;
2666 }
2667 return true;
2668}
2669#endif
2670#ifdef USE_TEXT
2672 buffer.encode_string(1, this->object_id_ref_);
2673 buffer.encode_fixed32(2, this->key);
2674 buffer.encode_string(3, this->name_ref_);
2675#ifdef USE_ENTITY_ICON
2676 buffer.encode_string(5, this->icon_ref_);
2677#endif
2678 buffer.encode_bool(6, this->disabled_by_default);
2679 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2680 buffer.encode_uint32(8, this->min_length);
2681 buffer.encode_uint32(9, this->max_length);
2682 buffer.encode_string(10, this->pattern_ref_);
2683 buffer.encode_uint32(11, static_cast<uint32_t>(this->mode));
2684#ifdef USE_DEVICES
2685 buffer.encode_uint32(12, this->device_id);
2686#endif
2687}
2689 size.add_length(1, this->object_id_ref_.size());
2690 size.add_fixed32(1, this->key);
2691 size.add_length(1, this->name_ref_.size());
2692#ifdef USE_ENTITY_ICON
2693 size.add_length(1, this->icon_ref_.size());
2694#endif
2695 size.add_bool(1, this->disabled_by_default);
2696 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2697 size.add_uint32(1, this->min_length);
2698 size.add_uint32(1, this->max_length);
2699 size.add_length(1, this->pattern_ref_.size());
2700 size.add_uint32(1, static_cast<uint32_t>(this->mode));
2701#ifdef USE_DEVICES
2702 size.add_uint32(1, this->device_id);
2703#endif
2704}
2706 buffer.encode_fixed32(1, this->key);
2707 buffer.encode_string(2, this->state_ref_);
2708 buffer.encode_bool(3, this->missing_state);
2709#ifdef USE_DEVICES
2710 buffer.encode_uint32(4, this->device_id);
2711#endif
2712}
2714 size.add_fixed32(1, this->key);
2715 size.add_length(1, this->state_ref_.size());
2716 size.add_bool(1, this->missing_state);
2717#ifdef USE_DEVICES
2718 size.add_uint32(1, this->device_id);
2719#endif
2720}
2721bool TextCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2722 switch (field_id) {
2723#ifdef USE_DEVICES
2724 case 3:
2725 this->device_id = value.as_uint32();
2726 break;
2727#endif
2728 default:
2729 return false;
2730 }
2731 return true;
2732}
2734 switch (field_id) {
2735 case 2:
2736 this->state = value.as_string();
2737 break;
2738 default:
2739 return false;
2740 }
2741 return true;
2742}
2743bool TextCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2744 switch (field_id) {
2745 case 1:
2746 this->key = value.as_fixed32();
2747 break;
2748 default:
2749 return false;
2750 }
2751 return true;
2752}
2753#endif
2754#ifdef USE_DATETIME_DATE
2756 buffer.encode_string(1, this->object_id_ref_);
2757 buffer.encode_fixed32(2, this->key);
2758 buffer.encode_string(3, this->name_ref_);
2759#ifdef USE_ENTITY_ICON
2760 buffer.encode_string(5, this->icon_ref_);
2761#endif
2762 buffer.encode_bool(6, this->disabled_by_default);
2763 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2764#ifdef USE_DEVICES
2765 buffer.encode_uint32(8, this->device_id);
2766#endif
2767}
2769 size.add_length(1, this->object_id_ref_.size());
2770 size.add_fixed32(1, this->key);
2771 size.add_length(1, this->name_ref_.size());
2772#ifdef USE_ENTITY_ICON
2773 size.add_length(1, this->icon_ref_.size());
2774#endif
2775 size.add_bool(1, this->disabled_by_default);
2776 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2777#ifdef USE_DEVICES
2778 size.add_uint32(1, this->device_id);
2779#endif
2780}
2782 buffer.encode_fixed32(1, this->key);
2783 buffer.encode_bool(2, this->missing_state);
2784 buffer.encode_uint32(3, this->year);
2785 buffer.encode_uint32(4, this->month);
2786 buffer.encode_uint32(5, this->day);
2787#ifdef USE_DEVICES
2788 buffer.encode_uint32(6, this->device_id);
2789#endif
2790}
2792 size.add_fixed32(1, this->key);
2793 size.add_bool(1, this->missing_state);
2794 size.add_uint32(1, this->year);
2795 size.add_uint32(1, this->month);
2796 size.add_uint32(1, this->day);
2797#ifdef USE_DEVICES
2798 size.add_uint32(1, this->device_id);
2799#endif
2800}
2801bool DateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2802 switch (field_id) {
2803 case 2:
2804 this->year = value.as_uint32();
2805 break;
2806 case 3:
2807 this->month = value.as_uint32();
2808 break;
2809 case 4:
2810 this->day = value.as_uint32();
2811 break;
2812#ifdef USE_DEVICES
2813 case 5:
2814 this->device_id = value.as_uint32();
2815 break;
2816#endif
2817 default:
2818 return false;
2819 }
2820 return true;
2821}
2822bool DateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2823 switch (field_id) {
2824 case 1:
2825 this->key = value.as_fixed32();
2826 break;
2827 default:
2828 return false;
2829 }
2830 return true;
2831}
2832#endif
2833#ifdef USE_DATETIME_TIME
2835 buffer.encode_string(1, this->object_id_ref_);
2836 buffer.encode_fixed32(2, this->key);
2837 buffer.encode_string(3, this->name_ref_);
2838#ifdef USE_ENTITY_ICON
2839 buffer.encode_string(5, this->icon_ref_);
2840#endif
2841 buffer.encode_bool(6, this->disabled_by_default);
2842 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2843#ifdef USE_DEVICES
2844 buffer.encode_uint32(8, this->device_id);
2845#endif
2846}
2848 size.add_length(1, this->object_id_ref_.size());
2849 size.add_fixed32(1, this->key);
2850 size.add_length(1, this->name_ref_.size());
2851#ifdef USE_ENTITY_ICON
2852 size.add_length(1, this->icon_ref_.size());
2853#endif
2854 size.add_bool(1, this->disabled_by_default);
2855 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2856#ifdef USE_DEVICES
2857 size.add_uint32(1, this->device_id);
2858#endif
2859}
2861 buffer.encode_fixed32(1, this->key);
2862 buffer.encode_bool(2, this->missing_state);
2863 buffer.encode_uint32(3, this->hour);
2864 buffer.encode_uint32(4, this->minute);
2865 buffer.encode_uint32(5, this->second);
2866#ifdef USE_DEVICES
2867 buffer.encode_uint32(6, this->device_id);
2868#endif
2869}
2871 size.add_fixed32(1, this->key);
2872 size.add_bool(1, this->missing_state);
2873 size.add_uint32(1, this->hour);
2874 size.add_uint32(1, this->minute);
2875 size.add_uint32(1, this->second);
2876#ifdef USE_DEVICES
2877 size.add_uint32(1, this->device_id);
2878#endif
2879}
2880bool TimeCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2881 switch (field_id) {
2882 case 2:
2883 this->hour = value.as_uint32();
2884 break;
2885 case 3:
2886 this->minute = value.as_uint32();
2887 break;
2888 case 4:
2889 this->second = value.as_uint32();
2890 break;
2891#ifdef USE_DEVICES
2892 case 5:
2893 this->device_id = value.as_uint32();
2894 break;
2895#endif
2896 default:
2897 return false;
2898 }
2899 return true;
2900}
2901bool TimeCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2902 switch (field_id) {
2903 case 1:
2904 this->key = value.as_fixed32();
2905 break;
2906 default:
2907 return false;
2908 }
2909 return true;
2910}
2911#endif
2912#ifdef USE_EVENT
2914 buffer.encode_string(1, this->object_id_ref_);
2915 buffer.encode_fixed32(2, this->key);
2916 buffer.encode_string(3, this->name_ref_);
2917#ifdef USE_ENTITY_ICON
2918 buffer.encode_string(5, this->icon_ref_);
2919#endif
2920 buffer.encode_bool(6, this->disabled_by_default);
2921 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2922 buffer.encode_string(8, this->device_class_ref_);
2923 for (const char *it : *this->event_types) {
2924 buffer.encode_string(9, it, strlen(it), true);
2925 }
2926#ifdef USE_DEVICES
2927 buffer.encode_uint32(10, this->device_id);
2928#endif
2929}
2931 size.add_length(1, this->object_id_ref_.size());
2932 size.add_fixed32(1, this->key);
2933 size.add_length(1, this->name_ref_.size());
2934#ifdef USE_ENTITY_ICON
2935 size.add_length(1, this->icon_ref_.size());
2936#endif
2937 size.add_bool(1, this->disabled_by_default);
2938 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2939 size.add_length(1, this->device_class_ref_.size());
2940 if (!this->event_types->empty()) {
2941 for (const char *it : *this->event_types) {
2942 size.add_length_force(1, strlen(it));
2943 }
2944 }
2945#ifdef USE_DEVICES
2946 size.add_uint32(1, this->device_id);
2947#endif
2948}
2950 buffer.encode_fixed32(1, this->key);
2951 buffer.encode_string(2, this->event_type_ref_);
2952#ifdef USE_DEVICES
2953 buffer.encode_uint32(3, this->device_id);
2954#endif
2955}
2957 size.add_fixed32(1, this->key);
2958 size.add_length(1, this->event_type_ref_.size());
2959#ifdef USE_DEVICES
2960 size.add_uint32(1, this->device_id);
2961#endif
2962}
2963#endif
2964#ifdef USE_VALVE
2966 buffer.encode_string(1, this->object_id_ref_);
2967 buffer.encode_fixed32(2, this->key);
2968 buffer.encode_string(3, this->name_ref_);
2969#ifdef USE_ENTITY_ICON
2970 buffer.encode_string(5, this->icon_ref_);
2971#endif
2972 buffer.encode_bool(6, this->disabled_by_default);
2973 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
2974 buffer.encode_string(8, this->device_class_ref_);
2975 buffer.encode_bool(9, this->assumed_state);
2976 buffer.encode_bool(10, this->supports_position);
2977 buffer.encode_bool(11, this->supports_stop);
2978#ifdef USE_DEVICES
2979 buffer.encode_uint32(12, this->device_id);
2980#endif
2981}
2983 size.add_length(1, this->object_id_ref_.size());
2984 size.add_fixed32(1, this->key);
2985 size.add_length(1, this->name_ref_.size());
2986#ifdef USE_ENTITY_ICON
2987 size.add_length(1, this->icon_ref_.size());
2988#endif
2989 size.add_bool(1, this->disabled_by_default);
2990 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
2991 size.add_length(1, this->device_class_ref_.size());
2992 size.add_bool(1, this->assumed_state);
2993 size.add_bool(1, this->supports_position);
2994 size.add_bool(1, this->supports_stop);
2995#ifdef USE_DEVICES
2996 size.add_uint32(1, this->device_id);
2997#endif
2998}
3000 buffer.encode_fixed32(1, this->key);
3001 buffer.encode_float(2, this->position);
3002 buffer.encode_uint32(3, static_cast<uint32_t>(this->current_operation));
3003#ifdef USE_DEVICES
3004 buffer.encode_uint32(4, this->device_id);
3005#endif
3006}
3008 size.add_fixed32(1, this->key);
3009 size.add_float(1, this->position);
3010 size.add_uint32(1, static_cast<uint32_t>(this->current_operation));
3011#ifdef USE_DEVICES
3012 size.add_uint32(1, this->device_id);
3013#endif
3014}
3015bool ValveCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3016 switch (field_id) {
3017 case 2:
3018 this->has_position = value.as_bool();
3019 break;
3020 case 4:
3021 this->stop = value.as_bool();
3022 break;
3023#ifdef USE_DEVICES
3024 case 5:
3025 this->device_id = value.as_uint32();
3026 break;
3027#endif
3028 default:
3029 return false;
3030 }
3031 return true;
3032}
3033bool ValveCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3034 switch (field_id) {
3035 case 1:
3036 this->key = value.as_fixed32();
3037 break;
3038 case 3:
3039 this->position = value.as_float();
3040 break;
3041 default:
3042 return false;
3043 }
3044 return true;
3045}
3046#endif
3047#ifdef USE_DATETIME_DATETIME
3049 buffer.encode_string(1, this->object_id_ref_);
3050 buffer.encode_fixed32(2, this->key);
3051 buffer.encode_string(3, this->name_ref_);
3052#ifdef USE_ENTITY_ICON
3053 buffer.encode_string(5, this->icon_ref_);
3054#endif
3055 buffer.encode_bool(6, this->disabled_by_default);
3056 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
3057#ifdef USE_DEVICES
3058 buffer.encode_uint32(8, this->device_id);
3059#endif
3060}
3062 size.add_length(1, this->object_id_ref_.size());
3063 size.add_fixed32(1, this->key);
3064 size.add_length(1, this->name_ref_.size());
3065#ifdef USE_ENTITY_ICON
3066 size.add_length(1, this->icon_ref_.size());
3067#endif
3068 size.add_bool(1, this->disabled_by_default);
3069 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
3070#ifdef USE_DEVICES
3071 size.add_uint32(1, this->device_id);
3072#endif
3073}
3075 buffer.encode_fixed32(1, this->key);
3076 buffer.encode_bool(2, this->missing_state);
3077 buffer.encode_fixed32(3, this->epoch_seconds);
3078#ifdef USE_DEVICES
3079 buffer.encode_uint32(4, this->device_id);
3080#endif
3081}
3083 size.add_fixed32(1, this->key);
3084 size.add_bool(1, this->missing_state);
3085 size.add_fixed32(1, this->epoch_seconds);
3086#ifdef USE_DEVICES
3087 size.add_uint32(1, this->device_id);
3088#endif
3089}
3091 switch (field_id) {
3092#ifdef USE_DEVICES
3093 case 3:
3094 this->device_id = value.as_uint32();
3095 break;
3096#endif
3097 default:
3098 return false;
3099 }
3100 return true;
3101}
3102bool DateTimeCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3103 switch (field_id) {
3104 case 1:
3105 this->key = value.as_fixed32();
3106 break;
3107 case 2:
3108 this->epoch_seconds = value.as_fixed32();
3109 break;
3110 default:
3111 return false;
3112 }
3113 return true;
3114}
3115#endif
3116#ifdef USE_UPDATE
3118 buffer.encode_string(1, this->object_id_ref_);
3119 buffer.encode_fixed32(2, this->key);
3120 buffer.encode_string(3, this->name_ref_);
3121#ifdef USE_ENTITY_ICON
3122 buffer.encode_string(5, this->icon_ref_);
3123#endif
3124 buffer.encode_bool(6, this->disabled_by_default);
3125 buffer.encode_uint32(7, static_cast<uint32_t>(this->entity_category));
3126 buffer.encode_string(8, this->device_class_ref_);
3127#ifdef USE_DEVICES
3128 buffer.encode_uint32(9, this->device_id);
3129#endif
3130}
3132 size.add_length(1, this->object_id_ref_.size());
3133 size.add_fixed32(1, this->key);
3134 size.add_length(1, this->name_ref_.size());
3135#ifdef USE_ENTITY_ICON
3136 size.add_length(1, this->icon_ref_.size());
3137#endif
3138 size.add_bool(1, this->disabled_by_default);
3139 size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
3140 size.add_length(1, this->device_class_ref_.size());
3141#ifdef USE_DEVICES
3142 size.add_uint32(1, this->device_id);
3143#endif
3144}
3146 buffer.encode_fixed32(1, this->key);
3147 buffer.encode_bool(2, this->missing_state);
3148 buffer.encode_bool(3, this->in_progress);
3149 buffer.encode_bool(4, this->has_progress);
3150 buffer.encode_float(5, this->progress);
3151 buffer.encode_string(6, this->current_version_ref_);
3152 buffer.encode_string(7, this->latest_version_ref_);
3153 buffer.encode_string(8, this->title_ref_);
3154 buffer.encode_string(9, this->release_summary_ref_);
3155 buffer.encode_string(10, this->release_url_ref_);
3156#ifdef USE_DEVICES
3157 buffer.encode_uint32(11, this->device_id);
3158#endif
3159}
3161 size.add_fixed32(1, this->key);
3162 size.add_bool(1, this->missing_state);
3163 size.add_bool(1, this->in_progress);
3164 size.add_bool(1, this->has_progress);
3165 size.add_float(1, this->progress);
3166 size.add_length(1, this->current_version_ref_.size());
3167 size.add_length(1, this->latest_version_ref_.size());
3168 size.add_length(1, this->title_ref_.size());
3169 size.add_length(1, this->release_summary_ref_.size());
3170 size.add_length(1, this->release_url_ref_.size());
3171#ifdef USE_DEVICES
3172 size.add_uint32(1, this->device_id);
3173#endif
3174}
3175bool UpdateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3176 switch (field_id) {
3177 case 2:
3178 this->command = static_cast<enums::UpdateCommand>(value.as_uint32());
3179 break;
3180#ifdef USE_DEVICES
3181 case 3:
3182 this->device_id = value.as_uint32();
3183 break;
3184#endif
3185 default:
3186 return false;
3187 }
3188 return true;
3189}
3190bool UpdateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3191 switch (field_id) {
3192 case 1:
3193 this->key = value.as_fixed32();
3194 break;
3195 default:
3196 return false;
3197 }
3198 return true;
3199}
3200#endif
3201#ifdef USE_ZWAVE_PROXY
3203 switch (field_id) {
3204 case 1: {
3205 // Use raw data directly to avoid allocation
3206 this->data = value.data();
3207 this->data_len = value.size();
3208 break;
3209 }
3210 default:
3211 return false;
3212 }
3213 return true;
3214}
3215void ZWaveProxyFrame::encode(ProtoWriteBuffer buffer) const { buffer.encode_bytes(1, this->data, this->data_len); }
3217bool ZWaveProxyRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3218 switch (field_id) {
3219 case 1:
3220 this->type = static_cast<enums::ZWaveProxyRequestType>(value.as_uint32());
3221 break;
3222 default:
3223 return false;
3224 }
3225 return true;
3226}
3228 switch (field_id) {
3229 case 2: {
3230 // Use raw data directly to avoid allocation
3231 this->data = value.data();
3232 this->data_len = value.size();
3233 break;
3234 }
3235 default:
3236 return false;
3237 }
3238 return true;
3239}
3241 buffer.encode_uint32(1, static_cast<uint32_t>(this->type));
3242 buffer.encode_bytes(2, this->data, this->data_len);
3243}
3245 size.add_uint32(1, static_cast<uint32_t>(this->type));
3246 size.add_length(2, this->data_len);
3247}
3248#endif
3249
3250} // namespace esphome::api
constexpr bool empty() const
Check if the set is empty.
bool empty() const
Definition helpers.h:342
void push_back(const T &value)
Add element without bounds checking Caller must ensure sufficient capacity was allocated via init() S...
Definition helpers.h:301
void init(size_t n)
Definition helpers.h:274
constexpr size_type size() const
Definition string_ref.h:70
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2659
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2634
enums::AlarmControlPanelStateCommand command
Definition api_pb2.h:2646
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2649
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2627
enums::AlarmControlPanelState state
Definition api_pb2.h:2630
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2620
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:2184
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2228
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2237
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2297
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2292
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2017
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2023
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2277
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2272
enums::BluetoothDeviceRequestType request_type
Definition api_pb2.h:1909
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1998
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2282
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2287
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2055
FixedVector< BluetoothGATTDescriptor > descriptors
Definition api_pb2.h:1971
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2067
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:1968
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2047
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:1955
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2039
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2246
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2251
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2107
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2110
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2029
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2103
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2097
std::vector< BluetoothGATTService > services
Definition api_pb2.h:2003
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2218
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2223
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2202
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2268
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2264
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2163
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2111
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2124
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2129
FixedVector< BluetoothGATTCharacteristic > characteristics
Definition api_pb2.h:1985
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2088
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2077
std::array< uint64_t, 2 > uuid
Definition api_pb2.h:1983
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2189
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2176
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2150
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2134
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2260
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2256
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1982
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1976
std::array< BluetoothLERawAdvertisement, BLUETOOTH_PROXY_ADVERTISEMENT_BATCH_SIZE > advertisements
Definition api_pb2.h:1891
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1988
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1993
enums::BluetoothScannerMode mode
Definition api_pb2.h:2337
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2312
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2302
enums::BluetoothScannerMode mode
Definition api_pb2.h:2320
enums::BluetoothScannerState state
Definition api_pb2.h:2319
enums::BluetoothScannerMode configured_mode
Definition api_pb2.h:2321
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2307
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1821
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1833
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1188
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1180
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1172
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1406
enums::ClimateSwingMode swing_mode
Definition api_pb2.h:1493
enums::ClimateFanMode fan_mode
Definition api_pb2.h:1491
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1339
enums::ClimatePreset preset
Definition api_pb2.h:1497
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1393
enums::ClimateFanMode fan_mode
Definition api_pb2.h:1458
enums::ClimateSwingMode swing_mode
Definition api_pb2.h:1459
enums::ClimateAction action
Definition api_pb2.h:1457
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1301
enums::ClimatePreset preset
Definition api_pb2.h:1462
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1320
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:693
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:2822
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2801
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2781
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2791
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3102
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3090
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3082
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3074
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:567
std::array< DeviceInfo, ESPHOME_DEVICE_COUNT > devices
Definition api_pb2.h:564
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2956
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2949
void decode(const uint8_t *buffer, size_t length) override
Definition api_pb2.cpp:1072
FixedVector< float > float_array
Definition api_pb2.h:1293
FixedVector< std::string > string_array
Definition api_pb2.h:1294
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1046
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1024
FixedVector< int32_t > int_array
Definition api_pb2.h:1292
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1059
FixedVector< ExecuteServiceArgument > args
Definition api_pb2.h:1313
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1083
void decode(const uint8_t *buffer, size_t length) override
Definition api_pb2.cpp:1121
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1111
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1100
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1136
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1128
enums::FanDirection direction
Definition api_pb2.h:777
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:753
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:991
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:978
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:10
const uint8_t * client_info
Definition api_pb2.h:345
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:961
FixedVector< HomeassistantServiceMap > variables
Definition api_pb2.h:1123
FixedVector< HomeassistantServiceMap > data
Definition api_pb2.h:1121
FixedVector< HomeassistantServiceMap > data_template
Definition api_pb2.h:1122
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:900
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:878
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:918
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:931
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:870
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:874
enums::EntityCategory entity_category
Definition api_pb2.h:309
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:625
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:821
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:534
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2604
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2588
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:1807
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1793
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1159
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1146
const std::vector< const char * > * supported_custom_presets
Definition api_pb2.h:1430
const climate::ClimateSwingModeMask * supported_swing_modes
Definition api_pb2.h:1427
const std::vector< const char * > * supported_custom_fan_modes
Definition api_pb2.h:1428
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1246
const climate::ClimatePresetMask * supported_presets
Definition api_pb2.h:1429
const climate::ClimateFanModeMask * supported_fan_modes
Definition api_pb2.h:1426
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1203
const climate::ClimateModeMask * supported_modes
Definition api_pb2.h:1421
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:2755
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2768
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3061
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3048
const FixedVector< const char * > * event_types
Definition api_pb2.h:2833
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2930
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2913
const std::vector< const char * > * supported_preset_modes
Definition api_pb2.h:735
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 FixedVector< const char * > * effects
Definition api_pb2.h:803
const light::ColorModeMask * supported_color_modes
Definition api_pb2.h:800
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:470
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1705
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1722
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1859
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1877
std::vector< MediaPlayerSupportedFormat > supported_formats
Definition api_pb2.h:1800
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1449
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1430
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1527
const FixedVector< const char * > * options
Definition api_pb2.h:1578
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1511
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:664
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:682
enums::SensorStateClass state_class
Definition api_pb2.h:898
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1006
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1002
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1018
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1010
enums::SupportsResponseType supports_response
Definition api_pb2.h:1275
FixedVector< ListEntitiesServicesArgument > args
Definition api_pb2.h:1274
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1598
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1616
std::vector< std::string > tones
Definition api_pb2.h:1632
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:718
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:733
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2688
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2671
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:803
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:789
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2834
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2847
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3131
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3117
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2982
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2965
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1753
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1781
enums::LockCommand command
Definition api_pb2.h:1728
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1771
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1746
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1739
enums::MediaPlayerCommand command
Definition api_pb2.h:1836
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1951
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1911
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1941
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1902
enums::MediaPlayerState state
Definition api_pb2.h:1817
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1893
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1852
enums::MediaPlayerFormatPurpose purpose
Definition api_pb2.h:1782
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1845
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:856
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:866
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:867
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1496
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1484
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1468
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1476
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:1573
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1561
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1586
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1545
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1553
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:708
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:700
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:1680
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1650
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:1690
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:1643
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:1636
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:1966
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:956
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:951
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:834
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:851
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:847
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2324
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:777
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:762
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:748
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:755
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2733
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2743
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2721
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:825
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:817
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2713
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2705
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:2901
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2880
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2870
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2860
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3190
enums::UpdateCommand command
Definition api_pb2.h:3021
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3175
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3160
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3145
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3015
bool decode_32bit(uint32_t field_id, Proto32Bit value) override
Definition api_pb2.cpp:3033
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2999
enums::ValveOperation current_operation
Definition api_pb2.h:2889
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3007
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2495
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2494
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2478
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2468
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2428
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2432
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2418
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2408
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2337
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2342
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2547
std::vector< VoiceAssistantExternalWakeWord > external_wake_words
Definition api_pb2.h:2562
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2567
std::vector< VoiceAssistantWakeWord > available_wake_words
Definition api_pb2.h:2577
const std::vector< std::string > * active_wake_words
Definition api_pb2.h:2578
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2558
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2374
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2397
enums::VoiceAssistantEvent event_type
Definition api_pb2.h:2432
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2387
std::vector< VoiceAssistantEventData > data
Definition api_pb2.h:2433
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2522
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2512
std::vector< std::string > trained_languages
Definition api_pb2.h:2542
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2354
VoiceAssistantAudioSettings audio_settings
Definition api_pb2.h:2387
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2347
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2361
std::vector< std::string > active_wake_words
Definition api_pb2.h:2595
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2576
enums::VoiceAssistantTimerEvent event_type
Definition api_pb2.h:2474
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:2455
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:2436
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:2496
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:2503
std::vector< std::string > trained_languages
Definition api_pb2.h:2529
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:3202
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3215
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3216
void calculate_size(ProtoSize &size) const override
Definition api_pb2.cpp:3244
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override
Definition api_pb2.cpp:3227
bool decode_varint(uint32_t field_id, ProtoVarInt value) override
Definition api_pb2.cpp:3217
enums::ZWaveProxyRequestType type
Definition api_pb2.h:3057
void encode(ProtoWriteBuffer buffer) const override
Definition api_pb2.cpp:3240
uint16_t length
Definition tt21100.cpp:0