ESPHome  2023.11.6
api_pb2.cpp
Go to the documentation of this file.
1 // This file was automatically generated with a tool.
2 // See scripts/api_protobuf/api_protobuf.py
3 #include "api_pb2.h"
4 #include "esphome/core/log.h"
5 
6 #include <cinttypes>
7 
8 namespace esphome {
9 namespace api {
10 
11 #ifdef HAS_PROTO_MESSAGE_DUMP
12 template<> const char *proto_enum_to_string<enums::EntityCategory>(enums::EntityCategory value) {
13  switch (value) {
15  return "ENTITY_CATEGORY_NONE";
17  return "ENTITY_CATEGORY_CONFIG";
19  return "ENTITY_CATEGORY_DIAGNOSTIC";
20  default:
21  return "UNKNOWN";
22  }
23 }
24 #endif
25 #ifdef HAS_PROTO_MESSAGE_DUMP
26 template<> const char *proto_enum_to_string<enums::LegacyCoverState>(enums::LegacyCoverState value) {
27  switch (value) {
29  return "LEGACY_COVER_STATE_OPEN";
31  return "LEGACY_COVER_STATE_CLOSED";
32  default:
33  return "UNKNOWN";
34  }
35 }
36 #endif
37 #ifdef HAS_PROTO_MESSAGE_DUMP
38 template<> const char *proto_enum_to_string<enums::CoverOperation>(enums::CoverOperation value) {
39  switch (value) {
41  return "COVER_OPERATION_IDLE";
43  return "COVER_OPERATION_IS_OPENING";
45  return "COVER_OPERATION_IS_CLOSING";
46  default:
47  return "UNKNOWN";
48  }
49 }
50 #endif
51 #ifdef HAS_PROTO_MESSAGE_DUMP
52 template<> const char *proto_enum_to_string<enums::LegacyCoverCommand>(enums::LegacyCoverCommand value) {
53  switch (value) {
55  return "LEGACY_COVER_COMMAND_OPEN";
57  return "LEGACY_COVER_COMMAND_CLOSE";
59  return "LEGACY_COVER_COMMAND_STOP";
60  default:
61  return "UNKNOWN";
62  }
63 }
64 #endif
65 #ifdef HAS_PROTO_MESSAGE_DUMP
66 template<> const char *proto_enum_to_string<enums::FanSpeed>(enums::FanSpeed value) {
67  switch (value) {
69  return "FAN_SPEED_LOW";
71  return "FAN_SPEED_MEDIUM";
73  return "FAN_SPEED_HIGH";
74  default:
75  return "UNKNOWN";
76  }
77 }
78 #endif
79 #ifdef HAS_PROTO_MESSAGE_DUMP
80 template<> const char *proto_enum_to_string<enums::FanDirection>(enums::FanDirection value) {
81  switch (value) {
83  return "FAN_DIRECTION_FORWARD";
85  return "FAN_DIRECTION_REVERSE";
86  default:
87  return "UNKNOWN";
88  }
89 }
90 #endif
91 #ifdef HAS_PROTO_MESSAGE_DUMP
92 template<> const char *proto_enum_to_string<enums::ColorMode>(enums::ColorMode value) {
93  switch (value) {
95  return "COLOR_MODE_UNKNOWN";
97  return "COLOR_MODE_ON_OFF";
99  return "COLOR_MODE_BRIGHTNESS";
101  return "COLOR_MODE_WHITE";
103  return "COLOR_MODE_COLOR_TEMPERATURE";
105  return "COLOR_MODE_COLD_WARM_WHITE";
107  return "COLOR_MODE_RGB";
109  return "COLOR_MODE_RGB_WHITE";
111  return "COLOR_MODE_RGB_COLOR_TEMPERATURE";
113  return "COLOR_MODE_RGB_COLD_WARM_WHITE";
114  default:
115  return "UNKNOWN";
116  }
117 }
118 #endif
119 #ifdef HAS_PROTO_MESSAGE_DUMP
120 template<> const char *proto_enum_to_string<enums::SensorStateClass>(enums::SensorStateClass value) {
121  switch (value) {
123  return "STATE_CLASS_NONE";
125  return "STATE_CLASS_MEASUREMENT";
127  return "STATE_CLASS_TOTAL_INCREASING";
129  return "STATE_CLASS_TOTAL";
130  default:
131  return "UNKNOWN";
132  }
133 }
134 #endif
135 #ifdef HAS_PROTO_MESSAGE_DUMP
136 template<> const char *proto_enum_to_string<enums::SensorLastResetType>(enums::SensorLastResetType value) {
137  switch (value) {
139  return "LAST_RESET_NONE";
141  return "LAST_RESET_NEVER";
143  return "LAST_RESET_AUTO";
144  default:
145  return "UNKNOWN";
146  }
147 }
148 #endif
149 #ifdef HAS_PROTO_MESSAGE_DUMP
150 template<> const char *proto_enum_to_string<enums::LogLevel>(enums::LogLevel value) {
151  switch (value) {
153  return "LOG_LEVEL_NONE";
155  return "LOG_LEVEL_ERROR";
157  return "LOG_LEVEL_WARN";
159  return "LOG_LEVEL_INFO";
161  return "LOG_LEVEL_CONFIG";
163  return "LOG_LEVEL_DEBUG";
165  return "LOG_LEVEL_VERBOSE";
167  return "LOG_LEVEL_VERY_VERBOSE";
168  default:
169  return "UNKNOWN";
170  }
171 }
172 #endif
173 #ifdef HAS_PROTO_MESSAGE_DUMP
174 template<> const char *proto_enum_to_string<enums::ServiceArgType>(enums::ServiceArgType value) {
175  switch (value) {
177  return "SERVICE_ARG_TYPE_BOOL";
179  return "SERVICE_ARG_TYPE_INT";
181  return "SERVICE_ARG_TYPE_FLOAT";
183  return "SERVICE_ARG_TYPE_STRING";
185  return "SERVICE_ARG_TYPE_BOOL_ARRAY";
187  return "SERVICE_ARG_TYPE_INT_ARRAY";
189  return "SERVICE_ARG_TYPE_FLOAT_ARRAY";
191  return "SERVICE_ARG_TYPE_STRING_ARRAY";
192  default:
193  return "UNKNOWN";
194  }
195 }
196 #endif
197 #ifdef HAS_PROTO_MESSAGE_DUMP
198 template<> const char *proto_enum_to_string<enums::ClimateMode>(enums::ClimateMode value) {
199  switch (value) {
201  return "CLIMATE_MODE_OFF";
203  return "CLIMATE_MODE_HEAT_COOL";
205  return "CLIMATE_MODE_COOL";
207  return "CLIMATE_MODE_HEAT";
209  return "CLIMATE_MODE_FAN_ONLY";
211  return "CLIMATE_MODE_DRY";
213  return "CLIMATE_MODE_AUTO";
214  default:
215  return "UNKNOWN";
216  }
217 }
218 #endif
219 #ifdef HAS_PROTO_MESSAGE_DUMP
220 template<> const char *proto_enum_to_string<enums::ClimateFanMode>(enums::ClimateFanMode value) {
221  switch (value) {
223  return "CLIMATE_FAN_ON";
225  return "CLIMATE_FAN_OFF";
227  return "CLIMATE_FAN_AUTO";
229  return "CLIMATE_FAN_LOW";
231  return "CLIMATE_FAN_MEDIUM";
233  return "CLIMATE_FAN_HIGH";
235  return "CLIMATE_FAN_MIDDLE";
237  return "CLIMATE_FAN_FOCUS";
239  return "CLIMATE_FAN_DIFFUSE";
241  return "CLIMATE_FAN_QUIET";
242  default:
243  return "UNKNOWN";
244  }
245 }
246 #endif
247 #ifdef HAS_PROTO_MESSAGE_DUMP
248 template<> const char *proto_enum_to_string<enums::ClimateSwingMode>(enums::ClimateSwingMode value) {
249  switch (value) {
251  return "CLIMATE_SWING_OFF";
253  return "CLIMATE_SWING_BOTH";
255  return "CLIMATE_SWING_VERTICAL";
257  return "CLIMATE_SWING_HORIZONTAL";
258  default:
259  return "UNKNOWN";
260  }
261 }
262 #endif
263 #ifdef HAS_PROTO_MESSAGE_DUMP
264 template<> const char *proto_enum_to_string<enums::ClimateAction>(enums::ClimateAction value) {
265  switch (value) {
267  return "CLIMATE_ACTION_OFF";
269  return "CLIMATE_ACTION_COOLING";
271  return "CLIMATE_ACTION_HEATING";
273  return "CLIMATE_ACTION_IDLE";
275  return "CLIMATE_ACTION_DRYING";
277  return "CLIMATE_ACTION_FAN";
278  default:
279  return "UNKNOWN";
280  }
281 }
282 #endif
283 #ifdef HAS_PROTO_MESSAGE_DUMP
284 template<> const char *proto_enum_to_string<enums::ClimatePreset>(enums::ClimatePreset value) {
285  switch (value) {
287  return "CLIMATE_PRESET_NONE";
289  return "CLIMATE_PRESET_HOME";
291  return "CLIMATE_PRESET_AWAY";
293  return "CLIMATE_PRESET_BOOST";
295  return "CLIMATE_PRESET_COMFORT";
297  return "CLIMATE_PRESET_ECO";
299  return "CLIMATE_PRESET_SLEEP";
301  return "CLIMATE_PRESET_ACTIVITY";
302  default:
303  return "UNKNOWN";
304  }
305 }
306 #endif
307 #ifdef HAS_PROTO_MESSAGE_DUMP
308 template<> const char *proto_enum_to_string<enums::NumberMode>(enums::NumberMode value) {
309  switch (value) {
311  return "NUMBER_MODE_AUTO";
313  return "NUMBER_MODE_BOX";
315  return "NUMBER_MODE_SLIDER";
316  default:
317  return "UNKNOWN";
318  }
319 }
320 #endif
321 #ifdef HAS_PROTO_MESSAGE_DUMP
322 template<> const char *proto_enum_to_string<enums::LockState>(enums::LockState value) {
323  switch (value) {
325  return "LOCK_STATE_NONE";
327  return "LOCK_STATE_LOCKED";
329  return "LOCK_STATE_UNLOCKED";
331  return "LOCK_STATE_JAMMED";
333  return "LOCK_STATE_LOCKING";
335  return "LOCK_STATE_UNLOCKING";
336  default:
337  return "UNKNOWN";
338  }
339 }
340 #endif
341 #ifdef HAS_PROTO_MESSAGE_DUMP
342 template<> const char *proto_enum_to_string<enums::LockCommand>(enums::LockCommand value) {
343  switch (value) {
344  case enums::LOCK_UNLOCK:
345  return "LOCK_UNLOCK";
346  case enums::LOCK_LOCK:
347  return "LOCK_LOCK";
348  case enums::LOCK_OPEN:
349  return "LOCK_OPEN";
350  default:
351  return "UNKNOWN";
352  }
353 }
354 #endif
355 #ifdef HAS_PROTO_MESSAGE_DUMP
356 template<> const char *proto_enum_to_string<enums::MediaPlayerState>(enums::MediaPlayerState value) {
357  switch (value) {
359  return "MEDIA_PLAYER_STATE_NONE";
361  return "MEDIA_PLAYER_STATE_IDLE";
363  return "MEDIA_PLAYER_STATE_PLAYING";
365  return "MEDIA_PLAYER_STATE_PAUSED";
366  default:
367  return "UNKNOWN";
368  }
369 }
370 #endif
371 #ifdef HAS_PROTO_MESSAGE_DUMP
372 template<> const char *proto_enum_to_string<enums::MediaPlayerCommand>(enums::MediaPlayerCommand value) {
373  switch (value) {
375  return "MEDIA_PLAYER_COMMAND_PLAY";
377  return "MEDIA_PLAYER_COMMAND_PAUSE";
379  return "MEDIA_PLAYER_COMMAND_STOP";
381  return "MEDIA_PLAYER_COMMAND_MUTE";
383  return "MEDIA_PLAYER_COMMAND_UNMUTE";
384  default:
385  return "UNKNOWN";
386  }
387 }
388 #endif
389 #ifdef HAS_PROTO_MESSAGE_DUMP
390 template<>
391 const char *proto_enum_to_string<enums::BluetoothDeviceRequestType>(enums::BluetoothDeviceRequestType value) {
392  switch (value) {
394  return "BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT";
396  return "BLUETOOTH_DEVICE_REQUEST_TYPE_DISCONNECT";
398  return "BLUETOOTH_DEVICE_REQUEST_TYPE_PAIR";
400  return "BLUETOOTH_DEVICE_REQUEST_TYPE_UNPAIR";
402  return "BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITH_CACHE";
404  return "BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT_V3_WITHOUT_CACHE";
406  return "BLUETOOTH_DEVICE_REQUEST_TYPE_CLEAR_CACHE";
407  default:
408  return "UNKNOWN";
409  }
410 }
411 #endif
412 #ifdef HAS_PROTO_MESSAGE_DUMP
413 template<> const char *proto_enum_to_string<enums::VoiceAssistantRequestFlag>(enums::VoiceAssistantRequestFlag value) {
414  switch (value) {
416  return "VOICE_ASSISTANT_REQUEST_NONE";
418  return "VOICE_ASSISTANT_REQUEST_USE_VAD";
420  return "VOICE_ASSISTANT_REQUEST_USE_WAKE_WORD";
421  default:
422  return "UNKNOWN";
423  }
424 }
425 #endif
426 #ifdef HAS_PROTO_MESSAGE_DUMP
427 template<> const char *proto_enum_to_string<enums::VoiceAssistantEvent>(enums::VoiceAssistantEvent value) {
428  switch (value) {
430  return "VOICE_ASSISTANT_ERROR";
432  return "VOICE_ASSISTANT_RUN_START";
434  return "VOICE_ASSISTANT_RUN_END";
436  return "VOICE_ASSISTANT_STT_START";
438  return "VOICE_ASSISTANT_STT_END";
440  return "VOICE_ASSISTANT_INTENT_START";
442  return "VOICE_ASSISTANT_INTENT_END";
444  return "VOICE_ASSISTANT_TTS_START";
446  return "VOICE_ASSISTANT_TTS_END";
448  return "VOICE_ASSISTANT_WAKE_WORD_START";
450  return "VOICE_ASSISTANT_WAKE_WORD_END";
452  return "VOICE_ASSISTANT_STT_VAD_START";
454  return "VOICE_ASSISTANT_STT_VAD_END";
456  return "VOICE_ASSISTANT_TTS_STREAM_START";
458  return "VOICE_ASSISTANT_TTS_STREAM_END";
459  default:
460  return "UNKNOWN";
461  }
462 }
463 #endif
464 #ifdef HAS_PROTO_MESSAGE_DUMP
465 template<> const char *proto_enum_to_string<enums::AlarmControlPanelState>(enums::AlarmControlPanelState value) {
466  switch (value) {
468  return "ALARM_STATE_DISARMED";
470  return "ALARM_STATE_ARMED_HOME";
472  return "ALARM_STATE_ARMED_AWAY";
474  return "ALARM_STATE_ARMED_NIGHT";
476  return "ALARM_STATE_ARMED_VACATION";
478  return "ALARM_STATE_ARMED_CUSTOM_BYPASS";
480  return "ALARM_STATE_PENDING";
482  return "ALARM_STATE_ARMING";
484  return "ALARM_STATE_DISARMING";
486  return "ALARM_STATE_TRIGGERED";
487  default:
488  return "UNKNOWN";
489  }
490 }
491 #endif
492 #ifdef HAS_PROTO_MESSAGE_DUMP
493 template<>
494 const char *proto_enum_to_string<enums::AlarmControlPanelStateCommand>(enums::AlarmControlPanelStateCommand value) {
495  switch (value) {
497  return "ALARM_CONTROL_PANEL_DISARM";
499  return "ALARM_CONTROL_PANEL_ARM_AWAY";
501  return "ALARM_CONTROL_PANEL_ARM_HOME";
503  return "ALARM_CONTROL_PANEL_ARM_NIGHT";
505  return "ALARM_CONTROL_PANEL_ARM_VACATION";
507  return "ALARM_CONTROL_PANEL_ARM_CUSTOM_BYPASS";
509  return "ALARM_CONTROL_PANEL_TRIGGER";
510  default:
511  return "UNKNOWN";
512  }
513 }
514 #endif
515 #ifdef HAS_PROTO_MESSAGE_DUMP
516 template<> const char *proto_enum_to_string<enums::TextMode>(enums::TextMode value) {
517  switch (value) {
519  return "TEXT_MODE_TEXT";
521  return "TEXT_MODE_PASSWORD";
522  default:
523  return "UNKNOWN";
524  }
525 }
526 #endif
527 bool HelloRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
528  switch (field_id) {
529  case 2: {
530  this->api_version_major = value.as_uint32();
531  return true;
532  }
533  case 3: {
534  this->api_version_minor = value.as_uint32();
535  return true;
536  }
537  default:
538  return false;
539  }
540 }
541 bool HelloRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
542  switch (field_id) {
543  case 1: {
544  this->client_info = value.as_string();
545  return true;
546  }
547  default:
548  return false;
549  }
550 }
552  buffer.encode_string(1, this->client_info);
553  buffer.encode_uint32(2, this->api_version_major);
554  buffer.encode_uint32(3, this->api_version_minor);
555 }
556 #ifdef HAS_PROTO_MESSAGE_DUMP
557 void HelloRequest::dump_to(std::string &out) const {
558  __attribute__((unused)) char buffer[64];
559  out.append("HelloRequest {\n");
560  out.append(" client_info: ");
561  out.append("'").append(this->client_info).append("'");
562  out.append("\n");
563 
564  out.append(" api_version_major: ");
565  sprintf(buffer, "%" PRIu32, this->api_version_major);
566  out.append(buffer);
567  out.append("\n");
568 
569  out.append(" api_version_minor: ");
570  sprintf(buffer, "%" PRIu32, this->api_version_minor);
571  out.append(buffer);
572  out.append("\n");
573  out.append("}");
574 }
575 #endif
576 bool HelloResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
577  switch (field_id) {
578  case 1: {
579  this->api_version_major = value.as_uint32();
580  return true;
581  }
582  case 2: {
583  this->api_version_minor = value.as_uint32();
584  return true;
585  }
586  default:
587  return false;
588  }
589 }
590 bool HelloResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
591  switch (field_id) {
592  case 3: {
593  this->server_info = value.as_string();
594  return true;
595  }
596  case 4: {
597  this->name = value.as_string();
598  return true;
599  }
600  default:
601  return false;
602  }
603 }
605  buffer.encode_uint32(1, this->api_version_major);
606  buffer.encode_uint32(2, this->api_version_minor);
607  buffer.encode_string(3, this->server_info);
608  buffer.encode_string(4, this->name);
609 }
610 #ifdef HAS_PROTO_MESSAGE_DUMP
611 void HelloResponse::dump_to(std::string &out) const {
612  __attribute__((unused)) char buffer[64];
613  out.append("HelloResponse {\n");
614  out.append(" api_version_major: ");
615  sprintf(buffer, "%" PRIu32, this->api_version_major);
616  out.append(buffer);
617  out.append("\n");
618 
619  out.append(" api_version_minor: ");
620  sprintf(buffer, "%" PRIu32, this->api_version_minor);
621  out.append(buffer);
622  out.append("\n");
623 
624  out.append(" server_info: ");
625  out.append("'").append(this->server_info).append("'");
626  out.append("\n");
627 
628  out.append(" name: ");
629  out.append("'").append(this->name).append("'");
630  out.append("\n");
631  out.append("}");
632 }
633 #endif
634 bool ConnectRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
635  switch (field_id) {
636  case 1: {
637  this->password = value.as_string();
638  return true;
639  }
640  default:
641  return false;
642  }
643 }
644 void ConnectRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_string(1, this->password); }
645 #ifdef HAS_PROTO_MESSAGE_DUMP
646 void ConnectRequest::dump_to(std::string &out) const {
647  __attribute__((unused)) char buffer[64];
648  out.append("ConnectRequest {\n");
649  out.append(" password: ");
650  out.append("'").append(this->password).append("'");
651  out.append("\n");
652  out.append("}");
653 }
654 #endif
655 bool ConnectResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
656  switch (field_id) {
657  case 1: {
658  this->invalid_password = value.as_bool();
659  return true;
660  }
661  default:
662  return false;
663  }
664 }
665 void ConnectResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_bool(1, this->invalid_password); }
666 #ifdef HAS_PROTO_MESSAGE_DUMP
667 void ConnectResponse::dump_to(std::string &out) const {
668  __attribute__((unused)) char buffer[64];
669  out.append("ConnectResponse {\n");
670  out.append(" invalid_password: ");
671  out.append(YESNO(this->invalid_password));
672  out.append("\n");
673  out.append("}");
674 }
675 #endif
677 #ifdef HAS_PROTO_MESSAGE_DUMP
678 void DisconnectRequest::dump_to(std::string &out) const { out.append("DisconnectRequest {}"); }
679 #endif
681 #ifdef HAS_PROTO_MESSAGE_DUMP
682 void DisconnectResponse::dump_to(std::string &out) const { out.append("DisconnectResponse {}"); }
683 #endif
685 #ifdef HAS_PROTO_MESSAGE_DUMP
686 void PingRequest::dump_to(std::string &out) const { out.append("PingRequest {}"); }
687 #endif
689 #ifdef HAS_PROTO_MESSAGE_DUMP
690 void PingResponse::dump_to(std::string &out) const { out.append("PingResponse {}"); }
691 #endif
693 #ifdef HAS_PROTO_MESSAGE_DUMP
694 void DeviceInfoRequest::dump_to(std::string &out) const { out.append("DeviceInfoRequest {}"); }
695 #endif
696 bool DeviceInfoResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
697  switch (field_id) {
698  case 1: {
699  this->uses_password = value.as_bool();
700  return true;
701  }
702  case 7: {
703  this->has_deep_sleep = value.as_bool();
704  return true;
705  }
706  case 10: {
707  this->webserver_port = value.as_uint32();
708  return true;
709  }
710  case 11: {
711  this->legacy_bluetooth_proxy_version = value.as_uint32();
712  return true;
713  }
714  case 15: {
715  this->bluetooth_proxy_feature_flags = value.as_uint32();
716  return true;
717  }
718  case 14: {
719  this->voice_assistant_version = value.as_uint32();
720  return true;
721  }
722  default:
723  return false;
724  }
725 }
727  switch (field_id) {
728  case 2: {
729  this->name = value.as_string();
730  return true;
731  }
732  case 3: {
733  this->mac_address = value.as_string();
734  return true;
735  }
736  case 4: {
737  this->esphome_version = value.as_string();
738  return true;
739  }
740  case 5: {
741  this->compilation_time = value.as_string();
742  return true;
743  }
744  case 6: {
745  this->model = value.as_string();
746  return true;
747  }
748  case 8: {
749  this->project_name = value.as_string();
750  return true;
751  }
752  case 9: {
753  this->project_version = value.as_string();
754  return true;
755  }
756  case 12: {
757  this->manufacturer = value.as_string();
758  return true;
759  }
760  case 13: {
761  this->friendly_name = value.as_string();
762  return true;
763  }
764  case 16: {
765  this->suggested_area = value.as_string();
766  return true;
767  }
768  default:
769  return false;
770  }
771 }
773  buffer.encode_bool(1, this->uses_password);
774  buffer.encode_string(2, this->name);
775  buffer.encode_string(3, this->mac_address);
776  buffer.encode_string(4, this->esphome_version);
777  buffer.encode_string(5, this->compilation_time);
778  buffer.encode_string(6, this->model);
779  buffer.encode_bool(7, this->has_deep_sleep);
780  buffer.encode_string(8, this->project_name);
781  buffer.encode_string(9, this->project_version);
782  buffer.encode_uint32(10, this->webserver_port);
783  buffer.encode_uint32(11, this->legacy_bluetooth_proxy_version);
784  buffer.encode_uint32(15, this->bluetooth_proxy_feature_flags);
785  buffer.encode_string(12, this->manufacturer);
786  buffer.encode_string(13, this->friendly_name);
787  buffer.encode_uint32(14, this->voice_assistant_version);
788  buffer.encode_string(16, this->suggested_area);
789 }
790 #ifdef HAS_PROTO_MESSAGE_DUMP
791 void DeviceInfoResponse::dump_to(std::string &out) const {
792  __attribute__((unused)) char buffer[64];
793  out.append("DeviceInfoResponse {\n");
794  out.append(" uses_password: ");
795  out.append(YESNO(this->uses_password));
796  out.append("\n");
797 
798  out.append(" name: ");
799  out.append("'").append(this->name).append("'");
800  out.append("\n");
801 
802  out.append(" mac_address: ");
803  out.append("'").append(this->mac_address).append("'");
804  out.append("\n");
805 
806  out.append(" esphome_version: ");
807  out.append("'").append(this->esphome_version).append("'");
808  out.append("\n");
809 
810  out.append(" compilation_time: ");
811  out.append("'").append(this->compilation_time).append("'");
812  out.append("\n");
813 
814  out.append(" model: ");
815  out.append("'").append(this->model).append("'");
816  out.append("\n");
817 
818  out.append(" has_deep_sleep: ");
819  out.append(YESNO(this->has_deep_sleep));
820  out.append("\n");
821 
822  out.append(" project_name: ");
823  out.append("'").append(this->project_name).append("'");
824  out.append("\n");
825 
826  out.append(" project_version: ");
827  out.append("'").append(this->project_version).append("'");
828  out.append("\n");
829 
830  out.append(" webserver_port: ");
831  sprintf(buffer, "%" PRIu32, this->webserver_port);
832  out.append(buffer);
833  out.append("\n");
834 
835  out.append(" legacy_bluetooth_proxy_version: ");
836  sprintf(buffer, "%" PRIu32, this->legacy_bluetooth_proxy_version);
837  out.append(buffer);
838  out.append("\n");
839 
840  out.append(" bluetooth_proxy_feature_flags: ");
841  sprintf(buffer, "%" PRIu32, this->bluetooth_proxy_feature_flags);
842  out.append(buffer);
843  out.append("\n");
844 
845  out.append(" manufacturer: ");
846  out.append("'").append(this->manufacturer).append("'");
847  out.append("\n");
848 
849  out.append(" friendly_name: ");
850  out.append("'").append(this->friendly_name).append("'");
851  out.append("\n");
852 
853  out.append(" voice_assistant_version: ");
854  sprintf(buffer, "%" PRIu32, this->voice_assistant_version);
855  out.append(buffer);
856  out.append("\n");
857 
858  out.append(" suggested_area: ");
859  out.append("'").append(this->suggested_area).append("'");
860  out.append("\n");
861  out.append("}");
862 }
863 #endif
865 #ifdef HAS_PROTO_MESSAGE_DUMP
866 void ListEntitiesRequest::dump_to(std::string &out) const { out.append("ListEntitiesRequest {}"); }
867 #endif
869 #ifdef HAS_PROTO_MESSAGE_DUMP
870 void ListEntitiesDoneResponse::dump_to(std::string &out) const { out.append("ListEntitiesDoneResponse {}"); }
871 #endif
873 #ifdef HAS_PROTO_MESSAGE_DUMP
874 void SubscribeStatesRequest::dump_to(std::string &out) const { out.append("SubscribeStatesRequest {}"); }
875 #endif
877  switch (field_id) {
878  case 6: {
879  this->is_status_binary_sensor = value.as_bool();
880  return true;
881  }
882  case 7: {
883  this->disabled_by_default = value.as_bool();
884  return true;
885  }
886  case 9: {
887  this->entity_category = value.as_enum<enums::EntityCategory>();
888  return true;
889  }
890  default:
891  return false;
892  }
893 }
895  switch (field_id) {
896  case 1: {
897  this->object_id = value.as_string();
898  return true;
899  }
900  case 3: {
901  this->name = value.as_string();
902  return true;
903  }
904  case 4: {
905  this->unique_id = value.as_string();
906  return true;
907  }
908  case 5: {
909  this->device_class = value.as_string();
910  return true;
911  }
912  case 8: {
913  this->icon = value.as_string();
914  return true;
915  }
916  default:
917  return false;
918  }
919 }
921  switch (field_id) {
922  case 2: {
923  this->key = value.as_fixed32();
924  return true;
925  }
926  default:
927  return false;
928  }
929 }
931  buffer.encode_string(1, this->object_id);
932  buffer.encode_fixed32(2, this->key);
933  buffer.encode_string(3, this->name);
934  buffer.encode_string(4, this->unique_id);
935  buffer.encode_string(5, this->device_class);
936  buffer.encode_bool(6, this->is_status_binary_sensor);
937  buffer.encode_bool(7, this->disabled_by_default);
938  buffer.encode_string(8, this->icon);
939  buffer.encode_enum<enums::EntityCategory>(9, this->entity_category);
940 }
941 #ifdef HAS_PROTO_MESSAGE_DUMP
942 void ListEntitiesBinarySensorResponse::dump_to(std::string &out) const {
943  __attribute__((unused)) char buffer[64];
944  out.append("ListEntitiesBinarySensorResponse {\n");
945  out.append(" object_id: ");
946  out.append("'").append(this->object_id).append("'");
947  out.append("\n");
948 
949  out.append(" key: ");
950  sprintf(buffer, "%" PRIu32, this->key);
951  out.append(buffer);
952  out.append("\n");
953 
954  out.append(" name: ");
955  out.append("'").append(this->name).append("'");
956  out.append("\n");
957 
958  out.append(" unique_id: ");
959  out.append("'").append(this->unique_id).append("'");
960  out.append("\n");
961 
962  out.append(" device_class: ");
963  out.append("'").append(this->device_class).append("'");
964  out.append("\n");
965 
966  out.append(" is_status_binary_sensor: ");
967  out.append(YESNO(this->is_status_binary_sensor));
968  out.append("\n");
969 
970  out.append(" disabled_by_default: ");
971  out.append(YESNO(this->disabled_by_default));
972  out.append("\n");
973 
974  out.append(" icon: ");
975  out.append("'").append(this->icon).append("'");
976  out.append("\n");
977 
978  out.append(" entity_category: ");
979  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
980  out.append("\n");
981  out.append("}");
982 }
983 #endif
985  switch (field_id) {
986  case 2: {
987  this->state = value.as_bool();
988  return true;
989  }
990  case 3: {
991  this->missing_state = value.as_bool();
992  return true;
993  }
994  default:
995  return false;
996  }
997 }
998 bool BinarySensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
999  switch (field_id) {
1000  case 1: {
1001  this->key = value.as_fixed32();
1002  return true;
1003  }
1004  default:
1005  return false;
1006  }
1007 }
1009  buffer.encode_fixed32(1, this->key);
1010  buffer.encode_bool(2, this->state);
1011  buffer.encode_bool(3, this->missing_state);
1012 }
1013 #ifdef HAS_PROTO_MESSAGE_DUMP
1014 void BinarySensorStateResponse::dump_to(std::string &out) const {
1015  __attribute__((unused)) char buffer[64];
1016  out.append("BinarySensorStateResponse {\n");
1017  out.append(" key: ");
1018  sprintf(buffer, "%" PRIu32, this->key);
1019  out.append(buffer);
1020  out.append("\n");
1021 
1022  out.append(" state: ");
1023  out.append(YESNO(this->state));
1024  out.append("\n");
1025 
1026  out.append(" missing_state: ");
1027  out.append(YESNO(this->missing_state));
1028  out.append("\n");
1029  out.append("}");
1030 }
1031 #endif
1033  switch (field_id) {
1034  case 5: {
1035  this->assumed_state = value.as_bool();
1036  return true;
1037  }
1038  case 6: {
1039  this->supports_position = value.as_bool();
1040  return true;
1041  }
1042  case 7: {
1043  this->supports_tilt = value.as_bool();
1044  return true;
1045  }
1046  case 9: {
1047  this->disabled_by_default = value.as_bool();
1048  return true;
1049  }
1050  case 11: {
1051  this->entity_category = value.as_enum<enums::EntityCategory>();
1052  return true;
1053  }
1054  case 12: {
1055  this->supports_stop = value.as_bool();
1056  return true;
1057  }
1058  default:
1059  return false;
1060  }
1061 }
1063  switch (field_id) {
1064  case 1: {
1065  this->object_id = value.as_string();
1066  return true;
1067  }
1068  case 3: {
1069  this->name = value.as_string();
1070  return true;
1071  }
1072  case 4: {
1073  this->unique_id = value.as_string();
1074  return true;
1075  }
1076  case 8: {
1077  this->device_class = value.as_string();
1078  return true;
1079  }
1080  case 10: {
1081  this->icon = value.as_string();
1082  return true;
1083  }
1084  default:
1085  return false;
1086  }
1087 }
1088 bool ListEntitiesCoverResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1089  switch (field_id) {
1090  case 2: {
1091  this->key = value.as_fixed32();
1092  return true;
1093  }
1094  default:
1095  return false;
1096  }
1097 }
1099  buffer.encode_string(1, this->object_id);
1100  buffer.encode_fixed32(2, this->key);
1101  buffer.encode_string(3, this->name);
1102  buffer.encode_string(4, this->unique_id);
1103  buffer.encode_bool(5, this->assumed_state);
1104  buffer.encode_bool(6, this->supports_position);
1105  buffer.encode_bool(7, this->supports_tilt);
1106  buffer.encode_string(8, this->device_class);
1107  buffer.encode_bool(9, this->disabled_by_default);
1108  buffer.encode_string(10, this->icon);
1109  buffer.encode_enum<enums::EntityCategory>(11, this->entity_category);
1110  buffer.encode_bool(12, this->supports_stop);
1111 }
1112 #ifdef HAS_PROTO_MESSAGE_DUMP
1113 void ListEntitiesCoverResponse::dump_to(std::string &out) const {
1114  __attribute__((unused)) char buffer[64];
1115  out.append("ListEntitiesCoverResponse {\n");
1116  out.append(" object_id: ");
1117  out.append("'").append(this->object_id).append("'");
1118  out.append("\n");
1119 
1120  out.append(" key: ");
1121  sprintf(buffer, "%" PRIu32, this->key);
1122  out.append(buffer);
1123  out.append("\n");
1124 
1125  out.append(" name: ");
1126  out.append("'").append(this->name).append("'");
1127  out.append("\n");
1128 
1129  out.append(" unique_id: ");
1130  out.append("'").append(this->unique_id).append("'");
1131  out.append("\n");
1132 
1133  out.append(" assumed_state: ");
1134  out.append(YESNO(this->assumed_state));
1135  out.append("\n");
1136 
1137  out.append(" supports_position: ");
1138  out.append(YESNO(this->supports_position));
1139  out.append("\n");
1140 
1141  out.append(" supports_tilt: ");
1142  out.append(YESNO(this->supports_tilt));
1143  out.append("\n");
1144 
1145  out.append(" device_class: ");
1146  out.append("'").append(this->device_class).append("'");
1147  out.append("\n");
1148 
1149  out.append(" disabled_by_default: ");
1150  out.append(YESNO(this->disabled_by_default));
1151  out.append("\n");
1152 
1153  out.append(" icon: ");
1154  out.append("'").append(this->icon).append("'");
1155  out.append("\n");
1156 
1157  out.append(" entity_category: ");
1158  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1159  out.append("\n");
1160 
1161  out.append(" supports_stop: ");
1162  out.append(YESNO(this->supports_stop));
1163  out.append("\n");
1164  out.append("}");
1165 }
1166 #endif
1167 bool CoverStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1168  switch (field_id) {
1169  case 2: {
1170  this->legacy_state = value.as_enum<enums::LegacyCoverState>();
1171  return true;
1172  }
1173  case 5: {
1174  this->current_operation = value.as_enum<enums::CoverOperation>();
1175  return true;
1176  }
1177  default:
1178  return false;
1179  }
1180 }
1181 bool CoverStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1182  switch (field_id) {
1183  case 1: {
1184  this->key = value.as_fixed32();
1185  return true;
1186  }
1187  case 3: {
1188  this->position = value.as_float();
1189  return true;
1190  }
1191  case 4: {
1192  this->tilt = value.as_float();
1193  return true;
1194  }
1195  default:
1196  return false;
1197  }
1198 }
1200  buffer.encode_fixed32(1, this->key);
1201  buffer.encode_enum<enums::LegacyCoverState>(2, this->legacy_state);
1202  buffer.encode_float(3, this->position);
1203  buffer.encode_float(4, this->tilt);
1204  buffer.encode_enum<enums::CoverOperation>(5, this->current_operation);
1205 }
1206 #ifdef HAS_PROTO_MESSAGE_DUMP
1207 void CoverStateResponse::dump_to(std::string &out) const {
1208  __attribute__((unused)) char buffer[64];
1209  out.append("CoverStateResponse {\n");
1210  out.append(" key: ");
1211  sprintf(buffer, "%" PRIu32, this->key);
1212  out.append(buffer);
1213  out.append("\n");
1214 
1215  out.append(" legacy_state: ");
1216  out.append(proto_enum_to_string<enums::LegacyCoverState>(this->legacy_state));
1217  out.append("\n");
1218 
1219  out.append(" position: ");
1220  sprintf(buffer, "%g", this->position);
1221  out.append(buffer);
1222  out.append("\n");
1223 
1224  out.append(" tilt: ");
1225  sprintf(buffer, "%g", this->tilt);
1226  out.append(buffer);
1227  out.append("\n");
1228 
1229  out.append(" current_operation: ");
1230  out.append(proto_enum_to_string<enums::CoverOperation>(this->current_operation));
1231  out.append("\n");
1232  out.append("}");
1233 }
1234 #endif
1235 bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1236  switch (field_id) {
1237  case 2: {
1238  this->has_legacy_command = value.as_bool();
1239  return true;
1240  }
1241  case 3: {
1242  this->legacy_command = value.as_enum<enums::LegacyCoverCommand>();
1243  return true;
1244  }
1245  case 4: {
1246  this->has_position = value.as_bool();
1247  return true;
1248  }
1249  case 6: {
1250  this->has_tilt = value.as_bool();
1251  return true;
1252  }
1253  case 8: {
1254  this->stop = value.as_bool();
1255  return true;
1256  }
1257  default:
1258  return false;
1259  }
1260 }
1261 bool CoverCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1262  switch (field_id) {
1263  case 1: {
1264  this->key = value.as_fixed32();
1265  return true;
1266  }
1267  case 5: {
1268  this->position = value.as_float();
1269  return true;
1270  }
1271  case 7: {
1272  this->tilt = value.as_float();
1273  return true;
1274  }
1275  default:
1276  return false;
1277  }
1278 }
1280  buffer.encode_fixed32(1, this->key);
1281  buffer.encode_bool(2, this->has_legacy_command);
1282  buffer.encode_enum<enums::LegacyCoverCommand>(3, this->legacy_command);
1283  buffer.encode_bool(4, this->has_position);
1284  buffer.encode_float(5, this->position);
1285  buffer.encode_bool(6, this->has_tilt);
1286  buffer.encode_float(7, this->tilt);
1287  buffer.encode_bool(8, this->stop);
1288 }
1289 #ifdef HAS_PROTO_MESSAGE_DUMP
1290 void CoverCommandRequest::dump_to(std::string &out) const {
1291  __attribute__((unused)) char buffer[64];
1292  out.append("CoverCommandRequest {\n");
1293  out.append(" key: ");
1294  sprintf(buffer, "%" PRIu32, this->key);
1295  out.append(buffer);
1296  out.append("\n");
1297 
1298  out.append(" has_legacy_command: ");
1299  out.append(YESNO(this->has_legacy_command));
1300  out.append("\n");
1301 
1302  out.append(" legacy_command: ");
1303  out.append(proto_enum_to_string<enums::LegacyCoverCommand>(this->legacy_command));
1304  out.append("\n");
1305 
1306  out.append(" has_position: ");
1307  out.append(YESNO(this->has_position));
1308  out.append("\n");
1309 
1310  out.append(" position: ");
1311  sprintf(buffer, "%g", this->position);
1312  out.append(buffer);
1313  out.append("\n");
1314 
1315  out.append(" has_tilt: ");
1316  out.append(YESNO(this->has_tilt));
1317  out.append("\n");
1318 
1319  out.append(" tilt: ");
1320  sprintf(buffer, "%g", this->tilt);
1321  out.append(buffer);
1322  out.append("\n");
1323 
1324  out.append(" stop: ");
1325  out.append(YESNO(this->stop));
1326  out.append("\n");
1327  out.append("}");
1328 }
1329 #endif
1330 bool ListEntitiesFanResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1331  switch (field_id) {
1332  case 5: {
1333  this->supports_oscillation = value.as_bool();
1334  return true;
1335  }
1336  case 6: {
1337  this->supports_speed = value.as_bool();
1338  return true;
1339  }
1340  case 7: {
1341  this->supports_direction = value.as_bool();
1342  return true;
1343  }
1344  case 8: {
1345  this->supported_speed_count = value.as_int32();
1346  return true;
1347  }
1348  case 9: {
1349  this->disabled_by_default = value.as_bool();
1350  return true;
1351  }
1352  case 11: {
1353  this->entity_category = value.as_enum<enums::EntityCategory>();
1354  return true;
1355  }
1356  default:
1357  return false;
1358  }
1359 }
1361  switch (field_id) {
1362  case 1: {
1363  this->object_id = value.as_string();
1364  return true;
1365  }
1366  case 3: {
1367  this->name = value.as_string();
1368  return true;
1369  }
1370  case 4: {
1371  this->unique_id = value.as_string();
1372  return true;
1373  }
1374  case 10: {
1375  this->icon = value.as_string();
1376  return true;
1377  }
1378  default:
1379  return false;
1380  }
1381 }
1382 bool ListEntitiesFanResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1383  switch (field_id) {
1384  case 2: {
1385  this->key = value.as_fixed32();
1386  return true;
1387  }
1388  default:
1389  return false;
1390  }
1391 }
1393  buffer.encode_string(1, this->object_id);
1394  buffer.encode_fixed32(2, this->key);
1395  buffer.encode_string(3, this->name);
1396  buffer.encode_string(4, this->unique_id);
1397  buffer.encode_bool(5, this->supports_oscillation);
1398  buffer.encode_bool(6, this->supports_speed);
1399  buffer.encode_bool(7, this->supports_direction);
1400  buffer.encode_int32(8, this->supported_speed_count);
1401  buffer.encode_bool(9, this->disabled_by_default);
1402  buffer.encode_string(10, this->icon);
1403  buffer.encode_enum<enums::EntityCategory>(11, this->entity_category);
1404 }
1405 #ifdef HAS_PROTO_MESSAGE_DUMP
1406 void ListEntitiesFanResponse::dump_to(std::string &out) const {
1407  __attribute__((unused)) char buffer[64];
1408  out.append("ListEntitiesFanResponse {\n");
1409  out.append(" object_id: ");
1410  out.append("'").append(this->object_id).append("'");
1411  out.append("\n");
1412 
1413  out.append(" key: ");
1414  sprintf(buffer, "%" PRIu32, this->key);
1415  out.append(buffer);
1416  out.append("\n");
1417 
1418  out.append(" name: ");
1419  out.append("'").append(this->name).append("'");
1420  out.append("\n");
1421 
1422  out.append(" unique_id: ");
1423  out.append("'").append(this->unique_id).append("'");
1424  out.append("\n");
1425 
1426  out.append(" supports_oscillation: ");
1427  out.append(YESNO(this->supports_oscillation));
1428  out.append("\n");
1429 
1430  out.append(" supports_speed: ");
1431  out.append(YESNO(this->supports_speed));
1432  out.append("\n");
1433 
1434  out.append(" supports_direction: ");
1435  out.append(YESNO(this->supports_direction));
1436  out.append("\n");
1437 
1438  out.append(" supported_speed_count: ");
1439  sprintf(buffer, "%" PRId32, this->supported_speed_count);
1440  out.append(buffer);
1441  out.append("\n");
1442 
1443  out.append(" disabled_by_default: ");
1444  out.append(YESNO(this->disabled_by_default));
1445  out.append("\n");
1446 
1447  out.append(" icon: ");
1448  out.append("'").append(this->icon).append("'");
1449  out.append("\n");
1450 
1451  out.append(" entity_category: ");
1452  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1453  out.append("\n");
1454  out.append("}");
1455 }
1456 #endif
1457 bool FanStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1458  switch (field_id) {
1459  case 2: {
1460  this->state = value.as_bool();
1461  return true;
1462  }
1463  case 3: {
1464  this->oscillating = value.as_bool();
1465  return true;
1466  }
1467  case 4: {
1468  this->speed = value.as_enum<enums::FanSpeed>();
1469  return true;
1470  }
1471  case 5: {
1472  this->direction = value.as_enum<enums::FanDirection>();
1473  return true;
1474  }
1475  case 6: {
1476  this->speed_level = value.as_int32();
1477  return true;
1478  }
1479  default:
1480  return false;
1481  }
1482 }
1483 bool FanStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1484  switch (field_id) {
1485  case 1: {
1486  this->key = value.as_fixed32();
1487  return true;
1488  }
1489  default:
1490  return false;
1491  }
1492 }
1494  buffer.encode_fixed32(1, this->key);
1495  buffer.encode_bool(2, this->state);
1496  buffer.encode_bool(3, this->oscillating);
1497  buffer.encode_enum<enums::FanSpeed>(4, this->speed);
1498  buffer.encode_enum<enums::FanDirection>(5, this->direction);
1499  buffer.encode_int32(6, this->speed_level);
1500 }
1501 #ifdef HAS_PROTO_MESSAGE_DUMP
1502 void FanStateResponse::dump_to(std::string &out) const {
1503  __attribute__((unused)) char buffer[64];
1504  out.append("FanStateResponse {\n");
1505  out.append(" key: ");
1506  sprintf(buffer, "%" PRIu32, this->key);
1507  out.append(buffer);
1508  out.append("\n");
1509 
1510  out.append(" state: ");
1511  out.append(YESNO(this->state));
1512  out.append("\n");
1513 
1514  out.append(" oscillating: ");
1515  out.append(YESNO(this->oscillating));
1516  out.append("\n");
1517 
1518  out.append(" speed: ");
1519  out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
1520  out.append("\n");
1521 
1522  out.append(" direction: ");
1523  out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
1524  out.append("\n");
1525 
1526  out.append(" speed_level: ");
1527  sprintf(buffer, "%" PRId32, this->speed_level);
1528  out.append(buffer);
1529  out.append("\n");
1530  out.append("}");
1531 }
1532 #endif
1533 bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1534  switch (field_id) {
1535  case 2: {
1536  this->has_state = value.as_bool();
1537  return true;
1538  }
1539  case 3: {
1540  this->state = value.as_bool();
1541  return true;
1542  }
1543  case 4: {
1544  this->has_speed = value.as_bool();
1545  return true;
1546  }
1547  case 5: {
1548  this->speed = value.as_enum<enums::FanSpeed>();
1549  return true;
1550  }
1551  case 6: {
1552  this->has_oscillating = value.as_bool();
1553  return true;
1554  }
1555  case 7: {
1556  this->oscillating = value.as_bool();
1557  return true;
1558  }
1559  case 8: {
1560  this->has_direction = value.as_bool();
1561  return true;
1562  }
1563  case 9: {
1564  this->direction = value.as_enum<enums::FanDirection>();
1565  return true;
1566  }
1567  case 10: {
1568  this->has_speed_level = value.as_bool();
1569  return true;
1570  }
1571  case 11: {
1572  this->speed_level = value.as_int32();
1573  return true;
1574  }
1575  default:
1576  return false;
1577  }
1578 }
1579 bool FanCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1580  switch (field_id) {
1581  case 1: {
1582  this->key = value.as_fixed32();
1583  return true;
1584  }
1585  default:
1586  return false;
1587  }
1588 }
1590  buffer.encode_fixed32(1, this->key);
1591  buffer.encode_bool(2, this->has_state);
1592  buffer.encode_bool(3, this->state);
1593  buffer.encode_bool(4, this->has_speed);
1594  buffer.encode_enum<enums::FanSpeed>(5, this->speed);
1595  buffer.encode_bool(6, this->has_oscillating);
1596  buffer.encode_bool(7, this->oscillating);
1597  buffer.encode_bool(8, this->has_direction);
1598  buffer.encode_enum<enums::FanDirection>(9, this->direction);
1599  buffer.encode_bool(10, this->has_speed_level);
1600  buffer.encode_int32(11, this->speed_level);
1601 }
1602 #ifdef HAS_PROTO_MESSAGE_DUMP
1603 void FanCommandRequest::dump_to(std::string &out) const {
1604  __attribute__((unused)) char buffer[64];
1605  out.append("FanCommandRequest {\n");
1606  out.append(" key: ");
1607  sprintf(buffer, "%" PRIu32, this->key);
1608  out.append(buffer);
1609  out.append("\n");
1610 
1611  out.append(" has_state: ");
1612  out.append(YESNO(this->has_state));
1613  out.append("\n");
1614 
1615  out.append(" state: ");
1616  out.append(YESNO(this->state));
1617  out.append("\n");
1618 
1619  out.append(" has_speed: ");
1620  out.append(YESNO(this->has_speed));
1621  out.append("\n");
1622 
1623  out.append(" speed: ");
1624  out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
1625  out.append("\n");
1626 
1627  out.append(" has_oscillating: ");
1628  out.append(YESNO(this->has_oscillating));
1629  out.append("\n");
1630 
1631  out.append(" oscillating: ");
1632  out.append(YESNO(this->oscillating));
1633  out.append("\n");
1634 
1635  out.append(" has_direction: ");
1636  out.append(YESNO(this->has_direction));
1637  out.append("\n");
1638 
1639  out.append(" direction: ");
1640  out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
1641  out.append("\n");
1642 
1643  out.append(" has_speed_level: ");
1644  out.append(YESNO(this->has_speed_level));
1645  out.append("\n");
1646 
1647  out.append(" speed_level: ");
1648  sprintf(buffer, "%" PRId32, this->speed_level);
1649  out.append(buffer);
1650  out.append("\n");
1651  out.append("}");
1652 }
1653 #endif
1655  switch (field_id) {
1656  case 12: {
1657  this->supported_color_modes.push_back(value.as_enum<enums::ColorMode>());
1658  return true;
1659  }
1660  case 5: {
1661  this->legacy_supports_brightness = value.as_bool();
1662  return true;
1663  }
1664  case 6: {
1665  this->legacy_supports_rgb = value.as_bool();
1666  return true;
1667  }
1668  case 7: {
1669  this->legacy_supports_white_value = value.as_bool();
1670  return true;
1671  }
1672  case 8: {
1673  this->legacy_supports_color_temperature = value.as_bool();
1674  return true;
1675  }
1676  case 13: {
1677  this->disabled_by_default = value.as_bool();
1678  return true;
1679  }
1680  case 15: {
1681  this->entity_category = value.as_enum<enums::EntityCategory>();
1682  return true;
1683  }
1684  default:
1685  return false;
1686  }
1687 }
1689  switch (field_id) {
1690  case 1: {
1691  this->object_id = value.as_string();
1692  return true;
1693  }
1694  case 3: {
1695  this->name = value.as_string();
1696  return true;
1697  }
1698  case 4: {
1699  this->unique_id = value.as_string();
1700  return true;
1701  }
1702  case 11: {
1703  this->effects.push_back(value.as_string());
1704  return true;
1705  }
1706  case 14: {
1707  this->icon = value.as_string();
1708  return true;
1709  }
1710  default:
1711  return false;
1712  }
1713 }
1714 bool ListEntitiesLightResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1715  switch (field_id) {
1716  case 2: {
1717  this->key = value.as_fixed32();
1718  return true;
1719  }
1720  case 9: {
1721  this->min_mireds = value.as_float();
1722  return true;
1723  }
1724  case 10: {
1725  this->max_mireds = value.as_float();
1726  return true;
1727  }
1728  default:
1729  return false;
1730  }
1731 }
1733  buffer.encode_string(1, this->object_id);
1734  buffer.encode_fixed32(2, this->key);
1735  buffer.encode_string(3, this->name);
1736  buffer.encode_string(4, this->unique_id);
1737  for (auto &it : this->supported_color_modes) {
1738  buffer.encode_enum<enums::ColorMode>(12, it, true);
1739  }
1740  buffer.encode_bool(5, this->legacy_supports_brightness);
1741  buffer.encode_bool(6, this->legacy_supports_rgb);
1742  buffer.encode_bool(7, this->legacy_supports_white_value);
1743  buffer.encode_bool(8, this->legacy_supports_color_temperature);
1744  buffer.encode_float(9, this->min_mireds);
1745  buffer.encode_float(10, this->max_mireds);
1746  for (auto &it : this->effects) {
1747  buffer.encode_string(11, it, true);
1748  }
1749  buffer.encode_bool(13, this->disabled_by_default);
1750  buffer.encode_string(14, this->icon);
1751  buffer.encode_enum<enums::EntityCategory>(15, this->entity_category);
1752 }
1753 #ifdef HAS_PROTO_MESSAGE_DUMP
1754 void ListEntitiesLightResponse::dump_to(std::string &out) const {
1755  __attribute__((unused)) char buffer[64];
1756  out.append("ListEntitiesLightResponse {\n");
1757  out.append(" object_id: ");
1758  out.append("'").append(this->object_id).append("'");
1759  out.append("\n");
1760 
1761  out.append(" key: ");
1762  sprintf(buffer, "%" PRIu32, this->key);
1763  out.append(buffer);
1764  out.append("\n");
1765 
1766  out.append(" name: ");
1767  out.append("'").append(this->name).append("'");
1768  out.append("\n");
1769 
1770  out.append(" unique_id: ");
1771  out.append("'").append(this->unique_id).append("'");
1772  out.append("\n");
1773 
1774  for (const auto &it : this->supported_color_modes) {
1775  out.append(" supported_color_modes: ");
1776  out.append(proto_enum_to_string<enums::ColorMode>(it));
1777  out.append("\n");
1778  }
1779 
1780  out.append(" legacy_supports_brightness: ");
1781  out.append(YESNO(this->legacy_supports_brightness));
1782  out.append("\n");
1783 
1784  out.append(" legacy_supports_rgb: ");
1785  out.append(YESNO(this->legacy_supports_rgb));
1786  out.append("\n");
1787 
1788  out.append(" legacy_supports_white_value: ");
1789  out.append(YESNO(this->legacy_supports_white_value));
1790  out.append("\n");
1791 
1792  out.append(" legacy_supports_color_temperature: ");
1793  out.append(YESNO(this->legacy_supports_color_temperature));
1794  out.append("\n");
1795 
1796  out.append(" min_mireds: ");
1797  sprintf(buffer, "%g", this->min_mireds);
1798  out.append(buffer);
1799  out.append("\n");
1800 
1801  out.append(" max_mireds: ");
1802  sprintf(buffer, "%g", this->max_mireds);
1803  out.append(buffer);
1804  out.append("\n");
1805 
1806  for (const auto &it : this->effects) {
1807  out.append(" effects: ");
1808  out.append("'").append(it).append("'");
1809  out.append("\n");
1810  }
1811 
1812  out.append(" disabled_by_default: ");
1813  out.append(YESNO(this->disabled_by_default));
1814  out.append("\n");
1815 
1816  out.append(" icon: ");
1817  out.append("'").append(this->icon).append("'");
1818  out.append("\n");
1819 
1820  out.append(" entity_category: ");
1821  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1822  out.append("\n");
1823  out.append("}");
1824 }
1825 #endif
1826 bool LightStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1827  switch (field_id) {
1828  case 2: {
1829  this->state = value.as_bool();
1830  return true;
1831  }
1832  case 11: {
1833  this->color_mode = value.as_enum<enums::ColorMode>();
1834  return true;
1835  }
1836  default:
1837  return false;
1838  }
1839 }
1841  switch (field_id) {
1842  case 9: {
1843  this->effect = value.as_string();
1844  return true;
1845  }
1846  default:
1847  return false;
1848  }
1849 }
1850 bool LightStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1851  switch (field_id) {
1852  case 1: {
1853  this->key = value.as_fixed32();
1854  return true;
1855  }
1856  case 3: {
1857  this->brightness = value.as_float();
1858  return true;
1859  }
1860  case 10: {
1861  this->color_brightness = value.as_float();
1862  return true;
1863  }
1864  case 4: {
1865  this->red = value.as_float();
1866  return true;
1867  }
1868  case 5: {
1869  this->green = value.as_float();
1870  return true;
1871  }
1872  case 6: {
1873  this->blue = value.as_float();
1874  return true;
1875  }
1876  case 7: {
1877  this->white = value.as_float();
1878  return true;
1879  }
1880  case 8: {
1881  this->color_temperature = value.as_float();
1882  return true;
1883  }
1884  case 12: {
1885  this->cold_white = value.as_float();
1886  return true;
1887  }
1888  case 13: {
1889  this->warm_white = value.as_float();
1890  return true;
1891  }
1892  default:
1893  return false;
1894  }
1895 }
1897  buffer.encode_fixed32(1, this->key);
1898  buffer.encode_bool(2, this->state);
1899  buffer.encode_float(3, this->brightness);
1900  buffer.encode_enum<enums::ColorMode>(11, this->color_mode);
1901  buffer.encode_float(10, this->color_brightness);
1902  buffer.encode_float(4, this->red);
1903  buffer.encode_float(5, this->green);
1904  buffer.encode_float(6, this->blue);
1905  buffer.encode_float(7, this->white);
1906  buffer.encode_float(8, this->color_temperature);
1907  buffer.encode_float(12, this->cold_white);
1908  buffer.encode_float(13, this->warm_white);
1909  buffer.encode_string(9, this->effect);
1910 }
1911 #ifdef HAS_PROTO_MESSAGE_DUMP
1912 void LightStateResponse::dump_to(std::string &out) const {
1913  __attribute__((unused)) char buffer[64];
1914  out.append("LightStateResponse {\n");
1915  out.append(" key: ");
1916  sprintf(buffer, "%" PRIu32, this->key);
1917  out.append(buffer);
1918  out.append("\n");
1919 
1920  out.append(" state: ");
1921  out.append(YESNO(this->state));
1922  out.append("\n");
1923 
1924  out.append(" brightness: ");
1925  sprintf(buffer, "%g", this->brightness);
1926  out.append(buffer);
1927  out.append("\n");
1928 
1929  out.append(" color_mode: ");
1930  out.append(proto_enum_to_string<enums::ColorMode>(this->color_mode));
1931  out.append("\n");
1932 
1933  out.append(" color_brightness: ");
1934  sprintf(buffer, "%g", this->color_brightness);
1935  out.append(buffer);
1936  out.append("\n");
1937 
1938  out.append(" red: ");
1939  sprintf(buffer, "%g", this->red);
1940  out.append(buffer);
1941  out.append("\n");
1942 
1943  out.append(" green: ");
1944  sprintf(buffer, "%g", this->green);
1945  out.append(buffer);
1946  out.append("\n");
1947 
1948  out.append(" blue: ");
1949  sprintf(buffer, "%g", this->blue);
1950  out.append(buffer);
1951  out.append("\n");
1952 
1953  out.append(" white: ");
1954  sprintf(buffer, "%g", this->white);
1955  out.append(buffer);
1956  out.append("\n");
1957 
1958  out.append(" color_temperature: ");
1959  sprintf(buffer, "%g", this->color_temperature);
1960  out.append(buffer);
1961  out.append("\n");
1962 
1963  out.append(" cold_white: ");
1964  sprintf(buffer, "%g", this->cold_white);
1965  out.append(buffer);
1966  out.append("\n");
1967 
1968  out.append(" warm_white: ");
1969  sprintf(buffer, "%g", this->warm_white);
1970  out.append(buffer);
1971  out.append("\n");
1972 
1973  out.append(" effect: ");
1974  out.append("'").append(this->effect).append("'");
1975  out.append("\n");
1976  out.append("}");
1977 }
1978 #endif
1979 bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1980  switch (field_id) {
1981  case 2: {
1982  this->has_state = value.as_bool();
1983  return true;
1984  }
1985  case 3: {
1986  this->state = value.as_bool();
1987  return true;
1988  }
1989  case 4: {
1990  this->has_brightness = value.as_bool();
1991  return true;
1992  }
1993  case 22: {
1994  this->has_color_mode = value.as_bool();
1995  return true;
1996  }
1997  case 23: {
1998  this->color_mode = value.as_enum<enums::ColorMode>();
1999  return true;
2000  }
2001  case 20: {
2002  this->has_color_brightness = value.as_bool();
2003  return true;
2004  }
2005  case 6: {
2006  this->has_rgb = value.as_bool();
2007  return true;
2008  }
2009  case 10: {
2010  this->has_white = value.as_bool();
2011  return true;
2012  }
2013  case 12: {
2014  this->has_color_temperature = value.as_bool();
2015  return true;
2016  }
2017  case 24: {
2018  this->has_cold_white = value.as_bool();
2019  return true;
2020  }
2021  case 26: {
2022  this->has_warm_white = value.as_bool();
2023  return true;
2024  }
2025  case 14: {
2026  this->has_transition_length = value.as_bool();
2027  return true;
2028  }
2029  case 15: {
2030  this->transition_length = value.as_uint32();
2031  return true;
2032  }
2033  case 16: {
2034  this->has_flash_length = value.as_bool();
2035  return true;
2036  }
2037  case 17: {
2038  this->flash_length = value.as_uint32();
2039  return true;
2040  }
2041  case 18: {
2042  this->has_effect = value.as_bool();
2043  return true;
2044  }
2045  default:
2046  return false;
2047  }
2048 }
2050  switch (field_id) {
2051  case 19: {
2052  this->effect = value.as_string();
2053  return true;
2054  }
2055  default:
2056  return false;
2057  }
2058 }
2059 bool LightCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2060  switch (field_id) {
2061  case 1: {
2062  this->key = value.as_fixed32();
2063  return true;
2064  }
2065  case 5: {
2066  this->brightness = value.as_float();
2067  return true;
2068  }
2069  case 21: {
2070  this->color_brightness = value.as_float();
2071  return true;
2072  }
2073  case 7: {
2074  this->red = value.as_float();
2075  return true;
2076  }
2077  case 8: {
2078  this->green = value.as_float();
2079  return true;
2080  }
2081  case 9: {
2082  this->blue = value.as_float();
2083  return true;
2084  }
2085  case 11: {
2086  this->white = value.as_float();
2087  return true;
2088  }
2089  case 13: {
2090  this->color_temperature = value.as_float();
2091  return true;
2092  }
2093  case 25: {
2094  this->cold_white = value.as_float();
2095  return true;
2096  }
2097  case 27: {
2098  this->warm_white = value.as_float();
2099  return true;
2100  }
2101  default:
2102  return false;
2103  }
2104 }
2106  buffer.encode_fixed32(1, this->key);
2107  buffer.encode_bool(2, this->has_state);
2108  buffer.encode_bool(3, this->state);
2109  buffer.encode_bool(4, this->has_brightness);
2110  buffer.encode_float(5, this->brightness);
2111  buffer.encode_bool(22, this->has_color_mode);
2112  buffer.encode_enum<enums::ColorMode>(23, this->color_mode);
2113  buffer.encode_bool(20, this->has_color_brightness);
2114  buffer.encode_float(21, this->color_brightness);
2115  buffer.encode_bool(6, this->has_rgb);
2116  buffer.encode_float(7, this->red);
2117  buffer.encode_float(8, this->green);
2118  buffer.encode_float(9, this->blue);
2119  buffer.encode_bool(10, this->has_white);
2120  buffer.encode_float(11, this->white);
2121  buffer.encode_bool(12, this->has_color_temperature);
2122  buffer.encode_float(13, this->color_temperature);
2123  buffer.encode_bool(24, this->has_cold_white);
2124  buffer.encode_float(25, this->cold_white);
2125  buffer.encode_bool(26, this->has_warm_white);
2126  buffer.encode_float(27, this->warm_white);
2127  buffer.encode_bool(14, this->has_transition_length);
2128  buffer.encode_uint32(15, this->transition_length);
2129  buffer.encode_bool(16, this->has_flash_length);
2130  buffer.encode_uint32(17, this->flash_length);
2131  buffer.encode_bool(18, this->has_effect);
2132  buffer.encode_string(19, this->effect);
2133 }
2134 #ifdef HAS_PROTO_MESSAGE_DUMP
2135 void LightCommandRequest::dump_to(std::string &out) const {
2136  __attribute__((unused)) char buffer[64];
2137  out.append("LightCommandRequest {\n");
2138  out.append(" key: ");
2139  sprintf(buffer, "%" PRIu32, this->key);
2140  out.append(buffer);
2141  out.append("\n");
2142 
2143  out.append(" has_state: ");
2144  out.append(YESNO(this->has_state));
2145  out.append("\n");
2146 
2147  out.append(" state: ");
2148  out.append(YESNO(this->state));
2149  out.append("\n");
2150 
2151  out.append(" has_brightness: ");
2152  out.append(YESNO(this->has_brightness));
2153  out.append("\n");
2154 
2155  out.append(" brightness: ");
2156  sprintf(buffer, "%g", this->brightness);
2157  out.append(buffer);
2158  out.append("\n");
2159 
2160  out.append(" has_color_mode: ");
2161  out.append(YESNO(this->has_color_mode));
2162  out.append("\n");
2163 
2164  out.append(" color_mode: ");
2165  out.append(proto_enum_to_string<enums::ColorMode>(this->color_mode));
2166  out.append("\n");
2167 
2168  out.append(" has_color_brightness: ");
2169  out.append(YESNO(this->has_color_brightness));
2170  out.append("\n");
2171 
2172  out.append(" color_brightness: ");
2173  sprintf(buffer, "%g", this->color_brightness);
2174  out.append(buffer);
2175  out.append("\n");
2176 
2177  out.append(" has_rgb: ");
2178  out.append(YESNO(this->has_rgb));
2179  out.append("\n");
2180 
2181  out.append(" red: ");
2182  sprintf(buffer, "%g", this->red);
2183  out.append(buffer);
2184  out.append("\n");
2185 
2186  out.append(" green: ");
2187  sprintf(buffer, "%g", this->green);
2188  out.append(buffer);
2189  out.append("\n");
2190 
2191  out.append(" blue: ");
2192  sprintf(buffer, "%g", this->blue);
2193  out.append(buffer);
2194  out.append("\n");
2195 
2196  out.append(" has_white: ");
2197  out.append(YESNO(this->has_white));
2198  out.append("\n");
2199 
2200  out.append(" white: ");
2201  sprintf(buffer, "%g", this->white);
2202  out.append(buffer);
2203  out.append("\n");
2204 
2205  out.append(" has_color_temperature: ");
2206  out.append(YESNO(this->has_color_temperature));
2207  out.append("\n");
2208 
2209  out.append(" color_temperature: ");
2210  sprintf(buffer, "%g", this->color_temperature);
2211  out.append(buffer);
2212  out.append("\n");
2213 
2214  out.append(" has_cold_white: ");
2215  out.append(YESNO(this->has_cold_white));
2216  out.append("\n");
2217 
2218  out.append(" cold_white: ");
2219  sprintf(buffer, "%g", this->cold_white);
2220  out.append(buffer);
2221  out.append("\n");
2222 
2223  out.append(" has_warm_white: ");
2224  out.append(YESNO(this->has_warm_white));
2225  out.append("\n");
2226 
2227  out.append(" warm_white: ");
2228  sprintf(buffer, "%g", this->warm_white);
2229  out.append(buffer);
2230  out.append("\n");
2231 
2232  out.append(" has_transition_length: ");
2233  out.append(YESNO(this->has_transition_length));
2234  out.append("\n");
2235 
2236  out.append(" transition_length: ");
2237  sprintf(buffer, "%" PRIu32, this->transition_length);
2238  out.append(buffer);
2239  out.append("\n");
2240 
2241  out.append(" has_flash_length: ");
2242  out.append(YESNO(this->has_flash_length));
2243  out.append("\n");
2244 
2245  out.append(" flash_length: ");
2246  sprintf(buffer, "%" PRIu32, this->flash_length);
2247  out.append(buffer);
2248  out.append("\n");
2249 
2250  out.append(" has_effect: ");
2251  out.append(YESNO(this->has_effect));
2252  out.append("\n");
2253 
2254  out.append(" effect: ");
2255  out.append("'").append(this->effect).append("'");
2256  out.append("\n");
2257  out.append("}");
2258 }
2259 #endif
2261  switch (field_id) {
2262  case 7: {
2263  this->accuracy_decimals = value.as_int32();
2264  return true;
2265  }
2266  case 8: {
2267  this->force_update = value.as_bool();
2268  return true;
2269  }
2270  case 10: {
2271  this->state_class = value.as_enum<enums::SensorStateClass>();
2272  return true;
2273  }
2274  case 11: {
2275  this->legacy_last_reset_type = value.as_enum<enums::SensorLastResetType>();
2276  return true;
2277  }
2278  case 12: {
2279  this->disabled_by_default = value.as_bool();
2280  return true;
2281  }
2282  case 13: {
2283  this->entity_category = value.as_enum<enums::EntityCategory>();
2284  return true;
2285  }
2286  default:
2287  return false;
2288  }
2289 }
2291  switch (field_id) {
2292  case 1: {
2293  this->object_id = value.as_string();
2294  return true;
2295  }
2296  case 3: {
2297  this->name = value.as_string();
2298  return true;
2299  }
2300  case 4: {
2301  this->unique_id = value.as_string();
2302  return true;
2303  }
2304  case 5: {
2305  this->icon = value.as_string();
2306  return true;
2307  }
2308  case 6: {
2309  this->unit_of_measurement = value.as_string();
2310  return true;
2311  }
2312  case 9: {
2313  this->device_class = value.as_string();
2314  return true;
2315  }
2316  default:
2317  return false;
2318  }
2319 }
2321  switch (field_id) {
2322  case 2: {
2323  this->key = value.as_fixed32();
2324  return true;
2325  }
2326  default:
2327  return false;
2328  }
2329 }
2331  buffer.encode_string(1, this->object_id);
2332  buffer.encode_fixed32(2, this->key);
2333  buffer.encode_string(3, this->name);
2334  buffer.encode_string(4, this->unique_id);
2335  buffer.encode_string(5, this->icon);
2336  buffer.encode_string(6, this->unit_of_measurement);
2337  buffer.encode_int32(7, this->accuracy_decimals);
2338  buffer.encode_bool(8, this->force_update);
2339  buffer.encode_string(9, this->device_class);
2340  buffer.encode_enum<enums::SensorStateClass>(10, this->state_class);
2341  buffer.encode_enum<enums::SensorLastResetType>(11, this->legacy_last_reset_type);
2342  buffer.encode_bool(12, this->disabled_by_default);
2343  buffer.encode_enum<enums::EntityCategory>(13, this->entity_category);
2344 }
2345 #ifdef HAS_PROTO_MESSAGE_DUMP
2346 void ListEntitiesSensorResponse::dump_to(std::string &out) const {
2347  __attribute__((unused)) char buffer[64];
2348  out.append("ListEntitiesSensorResponse {\n");
2349  out.append(" object_id: ");
2350  out.append("'").append(this->object_id).append("'");
2351  out.append("\n");
2352 
2353  out.append(" key: ");
2354  sprintf(buffer, "%" PRIu32, this->key);
2355  out.append(buffer);
2356  out.append("\n");
2357 
2358  out.append(" name: ");
2359  out.append("'").append(this->name).append("'");
2360  out.append("\n");
2361 
2362  out.append(" unique_id: ");
2363  out.append("'").append(this->unique_id).append("'");
2364  out.append("\n");
2365 
2366  out.append(" icon: ");
2367  out.append("'").append(this->icon).append("'");
2368  out.append("\n");
2369 
2370  out.append(" unit_of_measurement: ");
2371  out.append("'").append(this->unit_of_measurement).append("'");
2372  out.append("\n");
2373 
2374  out.append(" accuracy_decimals: ");
2375  sprintf(buffer, "%" PRId32, this->accuracy_decimals);
2376  out.append(buffer);
2377  out.append("\n");
2378 
2379  out.append(" force_update: ");
2380  out.append(YESNO(this->force_update));
2381  out.append("\n");
2382 
2383  out.append(" device_class: ");
2384  out.append("'").append(this->device_class).append("'");
2385  out.append("\n");
2386 
2387  out.append(" state_class: ");
2388  out.append(proto_enum_to_string<enums::SensorStateClass>(this->state_class));
2389  out.append("\n");
2390 
2391  out.append(" legacy_last_reset_type: ");
2392  out.append(proto_enum_to_string<enums::SensorLastResetType>(this->legacy_last_reset_type));
2393  out.append("\n");
2394 
2395  out.append(" disabled_by_default: ");
2396  out.append(YESNO(this->disabled_by_default));
2397  out.append("\n");
2398 
2399  out.append(" entity_category: ");
2400  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2401  out.append("\n");
2402  out.append("}");
2403 }
2404 #endif
2405 bool SensorStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2406  switch (field_id) {
2407  case 3: {
2408  this->missing_state = value.as_bool();
2409  return true;
2410  }
2411  default:
2412  return false;
2413  }
2414 }
2415 bool SensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2416  switch (field_id) {
2417  case 1: {
2418  this->key = value.as_fixed32();
2419  return true;
2420  }
2421  case 2: {
2422  this->state = value.as_float();
2423  return true;
2424  }
2425  default:
2426  return false;
2427  }
2428 }
2430  buffer.encode_fixed32(1, this->key);
2431  buffer.encode_float(2, this->state);
2432  buffer.encode_bool(3, this->missing_state);
2433 }
2434 #ifdef HAS_PROTO_MESSAGE_DUMP
2435 void SensorStateResponse::dump_to(std::string &out) const {
2436  __attribute__((unused)) char buffer[64];
2437  out.append("SensorStateResponse {\n");
2438  out.append(" key: ");
2439  sprintf(buffer, "%" PRIu32, this->key);
2440  out.append(buffer);
2441  out.append("\n");
2442 
2443  out.append(" state: ");
2444  sprintf(buffer, "%g", this->state);
2445  out.append(buffer);
2446  out.append("\n");
2447 
2448  out.append(" missing_state: ");
2449  out.append(YESNO(this->missing_state));
2450  out.append("\n");
2451  out.append("}");
2452 }
2453 #endif
2455  switch (field_id) {
2456  case 6: {
2457  this->assumed_state = value.as_bool();
2458  return true;
2459  }
2460  case 7: {
2461  this->disabled_by_default = value.as_bool();
2462  return true;
2463  }
2464  case 8: {
2465  this->entity_category = value.as_enum<enums::EntityCategory>();
2466  return true;
2467  }
2468  default:
2469  return false;
2470  }
2471 }
2473  switch (field_id) {
2474  case 1: {
2475  this->object_id = value.as_string();
2476  return true;
2477  }
2478  case 3: {
2479  this->name = value.as_string();
2480  return true;
2481  }
2482  case 4: {
2483  this->unique_id = value.as_string();
2484  return true;
2485  }
2486  case 5: {
2487  this->icon = value.as_string();
2488  return true;
2489  }
2490  case 9: {
2491  this->device_class = value.as_string();
2492  return true;
2493  }
2494  default:
2495  return false;
2496  }
2497 }
2499  switch (field_id) {
2500  case 2: {
2501  this->key = value.as_fixed32();
2502  return true;
2503  }
2504  default:
2505  return false;
2506  }
2507 }
2509  buffer.encode_string(1, this->object_id);
2510  buffer.encode_fixed32(2, this->key);
2511  buffer.encode_string(3, this->name);
2512  buffer.encode_string(4, this->unique_id);
2513  buffer.encode_string(5, this->icon);
2514  buffer.encode_bool(6, this->assumed_state);
2515  buffer.encode_bool(7, this->disabled_by_default);
2516  buffer.encode_enum<enums::EntityCategory>(8, this->entity_category);
2517  buffer.encode_string(9, this->device_class);
2518 }
2519 #ifdef HAS_PROTO_MESSAGE_DUMP
2520 void ListEntitiesSwitchResponse::dump_to(std::string &out) const {
2521  __attribute__((unused)) char buffer[64];
2522  out.append("ListEntitiesSwitchResponse {\n");
2523  out.append(" object_id: ");
2524  out.append("'").append(this->object_id).append("'");
2525  out.append("\n");
2526 
2527  out.append(" key: ");
2528  sprintf(buffer, "%" PRIu32, this->key);
2529  out.append(buffer);
2530  out.append("\n");
2531 
2532  out.append(" name: ");
2533  out.append("'").append(this->name).append("'");
2534  out.append("\n");
2535 
2536  out.append(" unique_id: ");
2537  out.append("'").append(this->unique_id).append("'");
2538  out.append("\n");
2539 
2540  out.append(" icon: ");
2541  out.append("'").append(this->icon).append("'");
2542  out.append("\n");
2543 
2544  out.append(" assumed_state: ");
2545  out.append(YESNO(this->assumed_state));
2546  out.append("\n");
2547 
2548  out.append(" disabled_by_default: ");
2549  out.append(YESNO(this->disabled_by_default));
2550  out.append("\n");
2551 
2552  out.append(" entity_category: ");
2553  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2554  out.append("\n");
2555 
2556  out.append(" device_class: ");
2557  out.append("'").append(this->device_class).append("'");
2558  out.append("\n");
2559  out.append("}");
2560 }
2561 #endif
2562 bool SwitchStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2563  switch (field_id) {
2564  case 2: {
2565  this->state = value.as_bool();
2566  return true;
2567  }
2568  default:
2569  return false;
2570  }
2571 }
2572 bool SwitchStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2573  switch (field_id) {
2574  case 1: {
2575  this->key = value.as_fixed32();
2576  return true;
2577  }
2578  default:
2579  return false;
2580  }
2581 }
2583  buffer.encode_fixed32(1, this->key);
2584  buffer.encode_bool(2, this->state);
2585 }
2586 #ifdef HAS_PROTO_MESSAGE_DUMP
2587 void SwitchStateResponse::dump_to(std::string &out) const {
2588  __attribute__((unused)) char buffer[64];
2589  out.append("SwitchStateResponse {\n");
2590  out.append(" key: ");
2591  sprintf(buffer, "%" PRIu32, this->key);
2592  out.append(buffer);
2593  out.append("\n");
2594 
2595  out.append(" state: ");
2596  out.append(YESNO(this->state));
2597  out.append("\n");
2598  out.append("}");
2599 }
2600 #endif
2601 bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2602  switch (field_id) {
2603  case 2: {
2604  this->state = value.as_bool();
2605  return true;
2606  }
2607  default:
2608  return false;
2609  }
2610 }
2611 bool SwitchCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2612  switch (field_id) {
2613  case 1: {
2614  this->key = value.as_fixed32();
2615  return true;
2616  }
2617  default:
2618  return false;
2619  }
2620 }
2622  buffer.encode_fixed32(1, this->key);
2623  buffer.encode_bool(2, this->state);
2624 }
2625 #ifdef HAS_PROTO_MESSAGE_DUMP
2626 void SwitchCommandRequest::dump_to(std::string &out) const {
2627  __attribute__((unused)) char buffer[64];
2628  out.append("SwitchCommandRequest {\n");
2629  out.append(" key: ");
2630  sprintf(buffer, "%" PRIu32, this->key);
2631  out.append(buffer);
2632  out.append("\n");
2633 
2634  out.append(" state: ");
2635  out.append(YESNO(this->state));
2636  out.append("\n");
2637  out.append("}");
2638 }
2639 #endif
2641  switch (field_id) {
2642  case 6: {
2643  this->disabled_by_default = value.as_bool();
2644  return true;
2645  }
2646  case 7: {
2647  this->entity_category = value.as_enum<enums::EntityCategory>();
2648  return true;
2649  }
2650  default:
2651  return false;
2652  }
2653 }
2655  switch (field_id) {
2656  case 1: {
2657  this->object_id = value.as_string();
2658  return true;
2659  }
2660  case 3: {
2661  this->name = value.as_string();
2662  return true;
2663  }
2664  case 4: {
2665  this->unique_id = value.as_string();
2666  return true;
2667  }
2668  case 5: {
2669  this->icon = value.as_string();
2670  return true;
2671  }
2672  default:
2673  return false;
2674  }
2675 }
2677  switch (field_id) {
2678  case 2: {
2679  this->key = value.as_fixed32();
2680  return true;
2681  }
2682  default:
2683  return false;
2684  }
2685 }
2687  buffer.encode_string(1, this->object_id);
2688  buffer.encode_fixed32(2, this->key);
2689  buffer.encode_string(3, this->name);
2690  buffer.encode_string(4, this->unique_id);
2691  buffer.encode_string(5, this->icon);
2692  buffer.encode_bool(6, this->disabled_by_default);
2693  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
2694 }
2695 #ifdef HAS_PROTO_MESSAGE_DUMP
2696 void ListEntitiesTextSensorResponse::dump_to(std::string &out) const {
2697  __attribute__((unused)) char buffer[64];
2698  out.append("ListEntitiesTextSensorResponse {\n");
2699  out.append(" object_id: ");
2700  out.append("'").append(this->object_id).append("'");
2701  out.append("\n");
2702 
2703  out.append(" key: ");
2704  sprintf(buffer, "%" PRIu32, this->key);
2705  out.append(buffer);
2706  out.append("\n");
2707 
2708  out.append(" name: ");
2709  out.append("'").append(this->name).append("'");
2710  out.append("\n");
2711 
2712  out.append(" unique_id: ");
2713  out.append("'").append(this->unique_id).append("'");
2714  out.append("\n");
2715 
2716  out.append(" icon: ");
2717  out.append("'").append(this->icon).append("'");
2718  out.append("\n");
2719 
2720  out.append(" disabled_by_default: ");
2721  out.append(YESNO(this->disabled_by_default));
2722  out.append("\n");
2723 
2724  out.append(" entity_category: ");
2725  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2726  out.append("\n");
2727  out.append("}");
2728 }
2729 #endif
2730 bool TextSensorStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2731  switch (field_id) {
2732  case 3: {
2733  this->missing_state = value.as_bool();
2734  return true;
2735  }
2736  default:
2737  return false;
2738  }
2739 }
2741  switch (field_id) {
2742  case 2: {
2743  this->state = value.as_string();
2744  return true;
2745  }
2746  default:
2747  return false;
2748  }
2749 }
2750 bool TextSensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2751  switch (field_id) {
2752  case 1: {
2753  this->key = value.as_fixed32();
2754  return true;
2755  }
2756  default:
2757  return false;
2758  }
2759 }
2761  buffer.encode_fixed32(1, this->key);
2762  buffer.encode_string(2, this->state);
2763  buffer.encode_bool(3, this->missing_state);
2764 }
2765 #ifdef HAS_PROTO_MESSAGE_DUMP
2766 void TextSensorStateResponse::dump_to(std::string &out) const {
2767  __attribute__((unused)) char buffer[64];
2768  out.append("TextSensorStateResponse {\n");
2769  out.append(" key: ");
2770  sprintf(buffer, "%" PRIu32, this->key);
2771  out.append(buffer);
2772  out.append("\n");
2773 
2774  out.append(" state: ");
2775  out.append("'").append(this->state).append("'");
2776  out.append("\n");
2777 
2778  out.append(" missing_state: ");
2779  out.append(YESNO(this->missing_state));
2780  out.append("\n");
2781  out.append("}");
2782 }
2783 #endif
2784 bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2785  switch (field_id) {
2786  case 1: {
2787  this->level = value.as_enum<enums::LogLevel>();
2788  return true;
2789  }
2790  case 2: {
2791  this->dump_config = value.as_bool();
2792  return true;
2793  }
2794  default:
2795  return false;
2796  }
2797 }
2799  buffer.encode_enum<enums::LogLevel>(1, this->level);
2800  buffer.encode_bool(2, this->dump_config);
2801 }
2802 #ifdef HAS_PROTO_MESSAGE_DUMP
2803 void SubscribeLogsRequest::dump_to(std::string &out) const {
2804  __attribute__((unused)) char buffer[64];
2805  out.append("SubscribeLogsRequest {\n");
2806  out.append(" level: ");
2807  out.append(proto_enum_to_string<enums::LogLevel>(this->level));
2808  out.append("\n");
2809 
2810  out.append(" dump_config: ");
2811  out.append(YESNO(this->dump_config));
2812  out.append("\n");
2813  out.append("}");
2814 }
2815 #endif
2816 bool SubscribeLogsResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2817  switch (field_id) {
2818  case 1: {
2819  this->level = value.as_enum<enums::LogLevel>();
2820  return true;
2821  }
2822  case 4: {
2823  this->send_failed = value.as_bool();
2824  return true;
2825  }
2826  default:
2827  return false;
2828  }
2829 }
2831  switch (field_id) {
2832  case 3: {
2833  this->message = value.as_string();
2834  return true;
2835  }
2836  default:
2837  return false;
2838  }
2839 }
2841  buffer.encode_enum<enums::LogLevel>(1, this->level);
2842  buffer.encode_string(3, this->message);
2843  buffer.encode_bool(4, this->send_failed);
2844 }
2845 #ifdef HAS_PROTO_MESSAGE_DUMP
2846 void SubscribeLogsResponse::dump_to(std::string &out) const {
2847  __attribute__((unused)) char buffer[64];
2848  out.append("SubscribeLogsResponse {\n");
2849  out.append(" level: ");
2850  out.append(proto_enum_to_string<enums::LogLevel>(this->level));
2851  out.append("\n");
2852 
2853  out.append(" message: ");
2854  out.append("'").append(this->message).append("'");
2855  out.append("\n");
2856 
2857  out.append(" send_failed: ");
2858  out.append(YESNO(this->send_failed));
2859  out.append("\n");
2860  out.append("}");
2861 }
2862 #endif
2864 #ifdef HAS_PROTO_MESSAGE_DUMP
2866  out.append("SubscribeHomeassistantServicesRequest {}");
2867 }
2868 #endif
2870  switch (field_id) {
2871  case 1: {
2872  this->key = value.as_string();
2873  return true;
2874  }
2875  case 2: {
2876  this->value = value.as_string();
2877  return true;
2878  }
2879  default:
2880  return false;
2881  }
2882 }
2884  buffer.encode_string(1, this->key);
2885  buffer.encode_string(2, this->value);
2886 }
2887 #ifdef HAS_PROTO_MESSAGE_DUMP
2888 void HomeassistantServiceMap::dump_to(std::string &out) const {
2889  __attribute__((unused)) char buffer[64];
2890  out.append("HomeassistantServiceMap {\n");
2891  out.append(" key: ");
2892  out.append("'").append(this->key).append("'");
2893  out.append("\n");
2894 
2895  out.append(" value: ");
2896  out.append("'").append(this->value).append("'");
2897  out.append("\n");
2898  out.append("}");
2899 }
2900 #endif
2902  switch (field_id) {
2903  case 5: {
2904  this->is_event = value.as_bool();
2905  return true;
2906  }
2907  default:
2908  return false;
2909  }
2910 }
2912  switch (field_id) {
2913  case 1: {
2914  this->service = value.as_string();
2915  return true;
2916  }
2917  case 2: {
2918  this->data.push_back(value.as_message<HomeassistantServiceMap>());
2919  return true;
2920  }
2921  case 3: {
2922  this->data_template.push_back(value.as_message<HomeassistantServiceMap>());
2923  return true;
2924  }
2925  case 4: {
2926  this->variables.push_back(value.as_message<HomeassistantServiceMap>());
2927  return true;
2928  }
2929  default:
2930  return false;
2931  }
2932 }
2934  buffer.encode_string(1, this->service);
2935  for (auto &it : this->data) {
2936  buffer.encode_message<HomeassistantServiceMap>(2, it, true);
2937  }
2938  for (auto &it : this->data_template) {
2939  buffer.encode_message<HomeassistantServiceMap>(3, it, true);
2940  }
2941  for (auto &it : this->variables) {
2942  buffer.encode_message<HomeassistantServiceMap>(4, it, true);
2943  }
2944  buffer.encode_bool(5, this->is_event);
2945 }
2946 #ifdef HAS_PROTO_MESSAGE_DUMP
2947 void HomeassistantServiceResponse::dump_to(std::string &out) const {
2948  __attribute__((unused)) char buffer[64];
2949  out.append("HomeassistantServiceResponse {\n");
2950  out.append(" service: ");
2951  out.append("'").append(this->service).append("'");
2952  out.append("\n");
2953 
2954  for (const auto &it : this->data) {
2955  out.append(" data: ");
2956  it.dump_to(out);
2957  out.append("\n");
2958  }
2959 
2960  for (const auto &it : this->data_template) {
2961  out.append(" data_template: ");
2962  it.dump_to(out);
2963  out.append("\n");
2964  }
2965 
2966  for (const auto &it : this->variables) {
2967  out.append(" variables: ");
2968  it.dump_to(out);
2969  out.append("\n");
2970  }
2971 
2972  out.append(" is_event: ");
2973  out.append(YESNO(this->is_event));
2974  out.append("\n");
2975  out.append("}");
2976 }
2977 #endif
2979 #ifdef HAS_PROTO_MESSAGE_DUMP
2980 void SubscribeHomeAssistantStatesRequest::dump_to(std::string &out) const {
2981  out.append("SubscribeHomeAssistantStatesRequest {}");
2982 }
2983 #endif
2985  switch (field_id) {
2986  case 1: {
2987  this->entity_id = value.as_string();
2988  return true;
2989  }
2990  case 2: {
2991  this->attribute = value.as_string();
2992  return true;
2993  }
2994  default:
2995  return false;
2996  }
2997 }
2999  buffer.encode_string(1, this->entity_id);
3000  buffer.encode_string(2, this->attribute);
3001 }
3002 #ifdef HAS_PROTO_MESSAGE_DUMP
3003 void SubscribeHomeAssistantStateResponse::dump_to(std::string &out) const {
3004  __attribute__((unused)) char buffer[64];
3005  out.append("SubscribeHomeAssistantStateResponse {\n");
3006  out.append(" entity_id: ");
3007  out.append("'").append(this->entity_id).append("'");
3008  out.append("\n");
3009 
3010  out.append(" attribute: ");
3011  out.append("'").append(this->attribute).append("'");
3012  out.append("\n");
3013  out.append("}");
3014 }
3015 #endif
3017  switch (field_id) {
3018  case 1: {
3019  this->entity_id = value.as_string();
3020  return true;
3021  }
3022  case 2: {
3023  this->state = value.as_string();
3024  return true;
3025  }
3026  case 3: {
3027  this->attribute = value.as_string();
3028  return true;
3029  }
3030  default:
3031  return false;
3032  }
3033 }
3035  buffer.encode_string(1, this->entity_id);
3036  buffer.encode_string(2, this->state);
3037  buffer.encode_string(3, this->attribute);
3038 }
3039 #ifdef HAS_PROTO_MESSAGE_DUMP
3040 void HomeAssistantStateResponse::dump_to(std::string &out) const {
3041  __attribute__((unused)) char buffer[64];
3042  out.append("HomeAssistantStateResponse {\n");
3043  out.append(" entity_id: ");
3044  out.append("'").append(this->entity_id).append("'");
3045  out.append("\n");
3046 
3047  out.append(" state: ");
3048  out.append("'").append(this->state).append("'");
3049  out.append("\n");
3050 
3051  out.append(" attribute: ");
3052  out.append("'").append(this->attribute).append("'");
3053  out.append("\n");
3054  out.append("}");
3055 }
3056 #endif
3058 #ifdef HAS_PROTO_MESSAGE_DUMP
3059 void GetTimeRequest::dump_to(std::string &out) const { out.append("GetTimeRequest {}"); }
3060 #endif
3061 bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3062  switch (field_id) {
3063  case 1: {
3064  this->epoch_seconds = value.as_fixed32();
3065  return true;
3066  }
3067  default:
3068  return false;
3069  }
3070 }
3071 void GetTimeResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->epoch_seconds); }
3072 #ifdef HAS_PROTO_MESSAGE_DUMP
3073 void GetTimeResponse::dump_to(std::string &out) const {
3074  __attribute__((unused)) char buffer[64];
3075  out.append("GetTimeResponse {\n");
3076  out.append(" epoch_seconds: ");
3077  sprintf(buffer, "%" PRIu32, this->epoch_seconds);
3078  out.append(buffer);
3079  out.append("\n");
3080  out.append("}");
3081 }
3082 #endif
3084  switch (field_id) {
3085  case 2: {
3086  this->type = value.as_enum<enums::ServiceArgType>();
3087  return true;
3088  }
3089  default:
3090  return false;
3091  }
3092 }
3094  switch (field_id) {
3095  case 1: {
3096  this->name = value.as_string();
3097  return true;
3098  }
3099  default:
3100  return false;
3101  }
3102 }
3104  buffer.encode_string(1, this->name);
3105  buffer.encode_enum<enums::ServiceArgType>(2, this->type);
3106 }
3107 #ifdef HAS_PROTO_MESSAGE_DUMP
3108 void ListEntitiesServicesArgument::dump_to(std::string &out) const {
3109  __attribute__((unused)) char buffer[64];
3110  out.append("ListEntitiesServicesArgument {\n");
3111  out.append(" name: ");
3112  out.append("'").append(this->name).append("'");
3113  out.append("\n");
3114 
3115  out.append(" type: ");
3116  out.append(proto_enum_to_string<enums::ServiceArgType>(this->type));
3117  out.append("\n");
3118  out.append("}");
3119 }
3120 #endif
3122  switch (field_id) {
3123  case 1: {
3124  this->name = value.as_string();
3125  return true;
3126  }
3127  case 3: {
3128  this->args.push_back(value.as_message<ListEntitiesServicesArgument>());
3129  return true;
3130  }
3131  default:
3132  return false;
3133  }
3134 }
3136  switch (field_id) {
3137  case 2: {
3138  this->key = value.as_fixed32();
3139  return true;
3140  }
3141  default:
3142  return false;
3143  }
3144 }
3146  buffer.encode_string(1, this->name);
3147  buffer.encode_fixed32(2, this->key);
3148  for (auto &it : this->args) {
3149  buffer.encode_message<ListEntitiesServicesArgument>(3, it, true);
3150  }
3151 }
3152 #ifdef HAS_PROTO_MESSAGE_DUMP
3153 void ListEntitiesServicesResponse::dump_to(std::string &out) const {
3154  __attribute__((unused)) char buffer[64];
3155  out.append("ListEntitiesServicesResponse {\n");
3156  out.append(" name: ");
3157  out.append("'").append(this->name).append("'");
3158  out.append("\n");
3159 
3160  out.append(" key: ");
3161  sprintf(buffer, "%" PRIu32, this->key);
3162  out.append(buffer);
3163  out.append("\n");
3164 
3165  for (const auto &it : this->args) {
3166  out.append(" args: ");
3167  it.dump_to(out);
3168  out.append("\n");
3169  }
3170  out.append("}");
3171 }
3172 #endif
3173 bool ExecuteServiceArgument::decode_varint(uint32_t field_id, ProtoVarInt value) {
3174  switch (field_id) {
3175  case 1: {
3176  this->bool_ = value.as_bool();
3177  return true;
3178  }
3179  case 2: {
3180  this->legacy_int = value.as_int32();
3181  return true;
3182  }
3183  case 5: {
3184  this->int_ = value.as_sint32();
3185  return true;
3186  }
3187  case 6: {
3188  this->bool_array.push_back(value.as_bool());
3189  return true;
3190  }
3191  case 7: {
3192  this->int_array.push_back(value.as_sint32());
3193  return true;
3194  }
3195  default:
3196  return false;
3197  }
3198 }
3200  switch (field_id) {
3201  case 4: {
3202  this->string_ = value.as_string();
3203  return true;
3204  }
3205  case 9: {
3206  this->string_array.push_back(value.as_string());
3207  return true;
3208  }
3209  default:
3210  return false;
3211  }
3212 }
3213 bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) {
3214  switch (field_id) {
3215  case 3: {
3216  this->float_ = value.as_float();
3217  return true;
3218  }
3219  case 8: {
3220  this->float_array.push_back(value.as_float());
3221  return true;
3222  }
3223  default:
3224  return false;
3225  }
3226 }
3228  buffer.encode_bool(1, this->bool_);
3229  buffer.encode_int32(2, this->legacy_int);
3230  buffer.encode_float(3, this->float_);
3231  buffer.encode_string(4, this->string_);
3232  buffer.encode_sint32(5, this->int_);
3233  for (auto it : this->bool_array) {
3234  buffer.encode_bool(6, it, true);
3235  }
3236  for (auto &it : this->int_array) {
3237  buffer.encode_sint32(7, it, true);
3238  }
3239  for (auto &it : this->float_array) {
3240  buffer.encode_float(8, it, true);
3241  }
3242  for (auto &it : this->string_array) {
3243  buffer.encode_string(9, it, true);
3244  }
3245 }
3246 #ifdef HAS_PROTO_MESSAGE_DUMP
3247 void ExecuteServiceArgument::dump_to(std::string &out) const {
3248  __attribute__((unused)) char buffer[64];
3249  out.append("ExecuteServiceArgument {\n");
3250  out.append(" bool_: ");
3251  out.append(YESNO(this->bool_));
3252  out.append("\n");
3253 
3254  out.append(" legacy_int: ");
3255  sprintf(buffer, "%" PRId32, this->legacy_int);
3256  out.append(buffer);
3257  out.append("\n");
3258 
3259  out.append(" float_: ");
3260  sprintf(buffer, "%g", this->float_);
3261  out.append(buffer);
3262  out.append("\n");
3263 
3264  out.append(" string_: ");
3265  out.append("'").append(this->string_).append("'");
3266  out.append("\n");
3267 
3268  out.append(" int_: ");
3269  sprintf(buffer, "%" PRId32, this->int_);
3270  out.append(buffer);
3271  out.append("\n");
3272 
3273  for (const auto it : this->bool_array) {
3274  out.append(" bool_array: ");
3275  out.append(YESNO(it));
3276  out.append("\n");
3277  }
3278 
3279  for (const auto &it : this->int_array) {
3280  out.append(" int_array: ");
3281  sprintf(buffer, "%" PRId32, it);
3282  out.append(buffer);
3283  out.append("\n");
3284  }
3285 
3286  for (const auto &it : this->float_array) {
3287  out.append(" float_array: ");
3288  sprintf(buffer, "%g", it);
3289  out.append(buffer);
3290  out.append("\n");
3291  }
3292 
3293  for (const auto &it : this->string_array) {
3294  out.append(" string_array: ");
3295  out.append("'").append(it).append("'");
3296  out.append("\n");
3297  }
3298  out.append("}");
3299 }
3300 #endif
3302  switch (field_id) {
3303  case 2: {
3304  this->args.push_back(value.as_message<ExecuteServiceArgument>());
3305  return true;
3306  }
3307  default:
3308  return false;
3309  }
3310 }
3311 bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3312  switch (field_id) {
3313  case 1: {
3314  this->key = value.as_fixed32();
3315  return true;
3316  }
3317  default:
3318  return false;
3319  }
3320 }
3322  buffer.encode_fixed32(1, this->key);
3323  for (auto &it : this->args) {
3324  buffer.encode_message<ExecuteServiceArgument>(2, it, true);
3325  }
3326 }
3327 #ifdef HAS_PROTO_MESSAGE_DUMP
3328 void ExecuteServiceRequest::dump_to(std::string &out) const {
3329  __attribute__((unused)) char buffer[64];
3330  out.append("ExecuteServiceRequest {\n");
3331  out.append(" key: ");
3332  sprintf(buffer, "%" PRIu32, this->key);
3333  out.append(buffer);
3334  out.append("\n");
3335 
3336  for (const auto &it : this->args) {
3337  out.append(" args: ");
3338  it.dump_to(out);
3339  out.append("\n");
3340  }
3341  out.append("}");
3342 }
3343 #endif
3345  switch (field_id) {
3346  case 5: {
3347  this->disabled_by_default = value.as_bool();
3348  return true;
3349  }
3350  case 7: {
3351  this->entity_category = value.as_enum<enums::EntityCategory>();
3352  return true;
3353  }
3354  default:
3355  return false;
3356  }
3357 }
3359  switch (field_id) {
3360  case 1: {
3361  this->object_id = value.as_string();
3362  return true;
3363  }
3364  case 3: {
3365  this->name = value.as_string();
3366  return true;
3367  }
3368  case 4: {
3369  this->unique_id = value.as_string();
3370  return true;
3371  }
3372  case 6: {
3373  this->icon = value.as_string();
3374  return true;
3375  }
3376  default:
3377  return false;
3378  }
3379 }
3381  switch (field_id) {
3382  case 2: {
3383  this->key = value.as_fixed32();
3384  return true;
3385  }
3386  default:
3387  return false;
3388  }
3389 }
3391  buffer.encode_string(1, this->object_id);
3392  buffer.encode_fixed32(2, this->key);
3393  buffer.encode_string(3, this->name);
3394  buffer.encode_string(4, this->unique_id);
3395  buffer.encode_bool(5, this->disabled_by_default);
3396  buffer.encode_string(6, this->icon);
3397  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
3398 }
3399 #ifdef HAS_PROTO_MESSAGE_DUMP
3400 void ListEntitiesCameraResponse::dump_to(std::string &out) const {
3401  __attribute__((unused)) char buffer[64];
3402  out.append("ListEntitiesCameraResponse {\n");
3403  out.append(" object_id: ");
3404  out.append("'").append(this->object_id).append("'");
3405  out.append("\n");
3406 
3407  out.append(" key: ");
3408  sprintf(buffer, "%" PRIu32, this->key);
3409  out.append(buffer);
3410  out.append("\n");
3411 
3412  out.append(" name: ");
3413  out.append("'").append(this->name).append("'");
3414  out.append("\n");
3415 
3416  out.append(" unique_id: ");
3417  out.append("'").append(this->unique_id).append("'");
3418  out.append("\n");
3419 
3420  out.append(" disabled_by_default: ");
3421  out.append(YESNO(this->disabled_by_default));
3422  out.append("\n");
3423 
3424  out.append(" icon: ");
3425  out.append("'").append(this->icon).append("'");
3426  out.append("\n");
3427 
3428  out.append(" entity_category: ");
3429  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3430  out.append("\n");
3431  out.append("}");
3432 }
3433 #endif
3434 bool CameraImageResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3435  switch (field_id) {
3436  case 3: {
3437  this->done = value.as_bool();
3438  return true;
3439  }
3440  default:
3441  return false;
3442  }
3443 }
3445  switch (field_id) {
3446  case 2: {
3447  this->data = value.as_string();
3448  return true;
3449  }
3450  default:
3451  return false;
3452  }
3453 }
3454 bool CameraImageResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3455  switch (field_id) {
3456  case 1: {
3457  this->key = value.as_fixed32();
3458  return true;
3459  }
3460  default:
3461  return false;
3462  }
3463 }
3465  buffer.encode_fixed32(1, this->key);
3466  buffer.encode_string(2, this->data);
3467  buffer.encode_bool(3, this->done);
3468 }
3469 #ifdef HAS_PROTO_MESSAGE_DUMP
3470 void CameraImageResponse::dump_to(std::string &out) const {
3471  __attribute__((unused)) char buffer[64];
3472  out.append("CameraImageResponse {\n");
3473  out.append(" key: ");
3474  sprintf(buffer, "%" PRIu32, this->key);
3475  out.append(buffer);
3476  out.append("\n");
3477 
3478  out.append(" data: ");
3479  out.append("'").append(this->data).append("'");
3480  out.append("\n");
3481 
3482  out.append(" done: ");
3483  out.append(YESNO(this->done));
3484  out.append("\n");
3485  out.append("}");
3486 }
3487 #endif
3488 bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3489  switch (field_id) {
3490  case 1: {
3491  this->single = value.as_bool();
3492  return true;
3493  }
3494  case 2: {
3495  this->stream = value.as_bool();
3496  return true;
3497  }
3498  default:
3499  return false;
3500  }
3501 }
3503  buffer.encode_bool(1, this->single);
3504  buffer.encode_bool(2, this->stream);
3505 }
3506 #ifdef HAS_PROTO_MESSAGE_DUMP
3507 void CameraImageRequest::dump_to(std::string &out) const {
3508  __attribute__((unused)) char buffer[64];
3509  out.append("CameraImageRequest {\n");
3510  out.append(" single: ");
3511  out.append(YESNO(this->single));
3512  out.append("\n");
3513 
3514  out.append(" stream: ");
3515  out.append(YESNO(this->stream));
3516  out.append("\n");
3517  out.append("}");
3518 }
3519 #endif
3521  switch (field_id) {
3522  case 5: {
3523  this->supports_current_temperature = value.as_bool();
3524  return true;
3525  }
3526  case 6: {
3527  this->supports_two_point_target_temperature = value.as_bool();
3528  return true;
3529  }
3530  case 7: {
3531  this->supported_modes.push_back(value.as_enum<enums::ClimateMode>());
3532  return true;
3533  }
3534  case 11: {
3535  this->legacy_supports_away = value.as_bool();
3536  return true;
3537  }
3538  case 12: {
3539  this->supports_action = value.as_bool();
3540  return true;
3541  }
3542  case 13: {
3543  this->supported_fan_modes.push_back(value.as_enum<enums::ClimateFanMode>());
3544  return true;
3545  }
3546  case 14: {
3547  this->supported_swing_modes.push_back(value.as_enum<enums::ClimateSwingMode>());
3548  return true;
3549  }
3550  case 16: {
3551  this->supported_presets.push_back(value.as_enum<enums::ClimatePreset>());
3552  return true;
3553  }
3554  case 18: {
3555  this->disabled_by_default = value.as_bool();
3556  return true;
3557  }
3558  case 20: {
3559  this->entity_category = value.as_enum<enums::EntityCategory>();
3560  return true;
3561  }
3562  default:
3563  return false;
3564  }
3565 }
3567  switch (field_id) {
3568  case 1: {
3569  this->object_id = value.as_string();
3570  return true;
3571  }
3572  case 3: {
3573  this->name = value.as_string();
3574  return true;
3575  }
3576  case 4: {
3577  this->unique_id = value.as_string();
3578  return true;
3579  }
3580  case 15: {
3581  this->supported_custom_fan_modes.push_back(value.as_string());
3582  return true;
3583  }
3584  case 17: {
3585  this->supported_custom_presets.push_back(value.as_string());
3586  return true;
3587  }
3588  case 19: {
3589  this->icon = value.as_string();
3590  return true;
3591  }
3592  default:
3593  return false;
3594  }
3595 }
3597  switch (field_id) {
3598  case 2: {
3599  this->key = value.as_fixed32();
3600  return true;
3601  }
3602  case 8: {
3603  this->visual_min_temperature = value.as_float();
3604  return true;
3605  }
3606  case 9: {
3607  this->visual_max_temperature = value.as_float();
3608  return true;
3609  }
3610  case 10: {
3611  this->visual_target_temperature_step = value.as_float();
3612  return true;
3613  }
3614  case 21: {
3615  this->visual_current_temperature_step = value.as_float();
3616  return true;
3617  }
3618  default:
3619  return false;
3620  }
3621 }
3623  buffer.encode_string(1, this->object_id);
3624  buffer.encode_fixed32(2, this->key);
3625  buffer.encode_string(3, this->name);
3626  buffer.encode_string(4, this->unique_id);
3627  buffer.encode_bool(5, this->supports_current_temperature);
3628  buffer.encode_bool(6, this->supports_two_point_target_temperature);
3629  for (auto &it : this->supported_modes) {
3630  buffer.encode_enum<enums::ClimateMode>(7, it, true);
3631  }
3632  buffer.encode_float(8, this->visual_min_temperature);
3633  buffer.encode_float(9, this->visual_max_temperature);
3634  buffer.encode_float(10, this->visual_target_temperature_step);
3635  buffer.encode_bool(11, this->legacy_supports_away);
3636  buffer.encode_bool(12, this->supports_action);
3637  for (auto &it : this->supported_fan_modes) {
3638  buffer.encode_enum<enums::ClimateFanMode>(13, it, true);
3639  }
3640  for (auto &it : this->supported_swing_modes) {
3641  buffer.encode_enum<enums::ClimateSwingMode>(14, it, true);
3642  }
3643  for (auto &it : this->supported_custom_fan_modes) {
3644  buffer.encode_string(15, it, true);
3645  }
3646  for (auto &it : this->supported_presets) {
3647  buffer.encode_enum<enums::ClimatePreset>(16, it, true);
3648  }
3649  for (auto &it : this->supported_custom_presets) {
3650  buffer.encode_string(17, it, true);
3651  }
3652  buffer.encode_bool(18, this->disabled_by_default);
3653  buffer.encode_string(19, this->icon);
3654  buffer.encode_enum<enums::EntityCategory>(20, this->entity_category);
3655  buffer.encode_float(21, this->visual_current_temperature_step);
3656 }
3657 #ifdef HAS_PROTO_MESSAGE_DUMP
3658 void ListEntitiesClimateResponse::dump_to(std::string &out) const {
3659  __attribute__((unused)) char buffer[64];
3660  out.append("ListEntitiesClimateResponse {\n");
3661  out.append(" object_id: ");
3662  out.append("'").append(this->object_id).append("'");
3663  out.append("\n");
3664 
3665  out.append(" key: ");
3666  sprintf(buffer, "%" PRIu32, this->key);
3667  out.append(buffer);
3668  out.append("\n");
3669 
3670  out.append(" name: ");
3671  out.append("'").append(this->name).append("'");
3672  out.append("\n");
3673 
3674  out.append(" unique_id: ");
3675  out.append("'").append(this->unique_id).append("'");
3676  out.append("\n");
3677 
3678  out.append(" supports_current_temperature: ");
3679  out.append(YESNO(this->supports_current_temperature));
3680  out.append("\n");
3681 
3682  out.append(" supports_two_point_target_temperature: ");
3683  out.append(YESNO(this->supports_two_point_target_temperature));
3684  out.append("\n");
3685 
3686  for (const auto &it : this->supported_modes) {
3687  out.append(" supported_modes: ");
3688  out.append(proto_enum_to_string<enums::ClimateMode>(it));
3689  out.append("\n");
3690  }
3691 
3692  out.append(" visual_min_temperature: ");
3693  sprintf(buffer, "%g", this->visual_min_temperature);
3694  out.append(buffer);
3695  out.append("\n");
3696 
3697  out.append(" visual_max_temperature: ");
3698  sprintf(buffer, "%g", this->visual_max_temperature);
3699  out.append(buffer);
3700  out.append("\n");
3701 
3702  out.append(" visual_target_temperature_step: ");
3703  sprintf(buffer, "%g", this->visual_target_temperature_step);
3704  out.append(buffer);
3705  out.append("\n");
3706 
3707  out.append(" legacy_supports_away: ");
3708  out.append(YESNO(this->legacy_supports_away));
3709  out.append("\n");
3710 
3711  out.append(" supports_action: ");
3712  out.append(YESNO(this->supports_action));
3713  out.append("\n");
3714 
3715  for (const auto &it : this->supported_fan_modes) {
3716  out.append(" supported_fan_modes: ");
3717  out.append(proto_enum_to_string<enums::ClimateFanMode>(it));
3718  out.append("\n");
3719  }
3720 
3721  for (const auto &it : this->supported_swing_modes) {
3722  out.append(" supported_swing_modes: ");
3723  out.append(proto_enum_to_string<enums::ClimateSwingMode>(it));
3724  out.append("\n");
3725  }
3726 
3727  for (const auto &it : this->supported_custom_fan_modes) {
3728  out.append(" supported_custom_fan_modes: ");
3729  out.append("'").append(it).append("'");
3730  out.append("\n");
3731  }
3732 
3733  for (const auto &it : this->supported_presets) {
3734  out.append(" supported_presets: ");
3735  out.append(proto_enum_to_string<enums::ClimatePreset>(it));
3736  out.append("\n");
3737  }
3738 
3739  for (const auto &it : this->supported_custom_presets) {
3740  out.append(" supported_custom_presets: ");
3741  out.append("'").append(it).append("'");
3742  out.append("\n");
3743  }
3744 
3745  out.append(" disabled_by_default: ");
3746  out.append(YESNO(this->disabled_by_default));
3747  out.append("\n");
3748 
3749  out.append(" icon: ");
3750  out.append("'").append(this->icon).append("'");
3751  out.append("\n");
3752 
3753  out.append(" entity_category: ");
3754  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3755  out.append("\n");
3756 
3757  out.append(" visual_current_temperature_step: ");
3758  sprintf(buffer, "%g", this->visual_current_temperature_step);
3759  out.append(buffer);
3760  out.append("\n");
3761  out.append("}");
3762 }
3763 #endif
3764 bool ClimateStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3765  switch (field_id) {
3766  case 2: {
3767  this->mode = value.as_enum<enums::ClimateMode>();
3768  return true;
3769  }
3770  case 7: {
3771  this->unused_legacy_away = value.as_bool();
3772  return true;
3773  }
3774  case 8: {
3775  this->action = value.as_enum<enums::ClimateAction>();
3776  return true;
3777  }
3778  case 9: {
3779  this->fan_mode = value.as_enum<enums::ClimateFanMode>();
3780  return true;
3781  }
3782  case 10: {
3783  this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
3784  return true;
3785  }
3786  case 12: {
3787  this->preset = value.as_enum<enums::ClimatePreset>();
3788  return true;
3789  }
3790  default:
3791  return false;
3792  }
3793 }
3795  switch (field_id) {
3796  case 11: {
3797  this->custom_fan_mode = value.as_string();
3798  return true;
3799  }
3800  case 13: {
3801  this->custom_preset = value.as_string();
3802  return true;
3803  }
3804  default:
3805  return false;
3806  }
3807 }
3808 bool ClimateStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3809  switch (field_id) {
3810  case 1: {
3811  this->key = value.as_fixed32();
3812  return true;
3813  }
3814  case 3: {
3815  this->current_temperature = value.as_float();
3816  return true;
3817  }
3818  case 4: {
3819  this->target_temperature = value.as_float();
3820  return true;
3821  }
3822  case 5: {
3823  this->target_temperature_low = value.as_float();
3824  return true;
3825  }
3826  case 6: {
3827  this->target_temperature_high = value.as_float();
3828  return true;
3829  }
3830  default:
3831  return false;
3832  }
3833 }
3835  buffer.encode_fixed32(1, this->key);
3836  buffer.encode_enum<enums::ClimateMode>(2, this->mode);
3837  buffer.encode_float(3, this->current_temperature);
3838  buffer.encode_float(4, this->target_temperature);
3839  buffer.encode_float(5, this->target_temperature_low);
3840  buffer.encode_float(6, this->target_temperature_high);
3841  buffer.encode_bool(7, this->unused_legacy_away);
3842  buffer.encode_enum<enums::ClimateAction>(8, this->action);
3843  buffer.encode_enum<enums::ClimateFanMode>(9, this->fan_mode);
3844  buffer.encode_enum<enums::ClimateSwingMode>(10, this->swing_mode);
3845  buffer.encode_string(11, this->custom_fan_mode);
3846  buffer.encode_enum<enums::ClimatePreset>(12, this->preset);
3847  buffer.encode_string(13, this->custom_preset);
3848 }
3849 #ifdef HAS_PROTO_MESSAGE_DUMP
3850 void ClimateStateResponse::dump_to(std::string &out) const {
3851  __attribute__((unused)) char buffer[64];
3852  out.append("ClimateStateResponse {\n");
3853  out.append(" key: ");
3854  sprintf(buffer, "%" PRIu32, this->key);
3855  out.append(buffer);
3856  out.append("\n");
3857 
3858  out.append(" mode: ");
3859  out.append(proto_enum_to_string<enums::ClimateMode>(this->mode));
3860  out.append("\n");
3861 
3862  out.append(" current_temperature: ");
3863  sprintf(buffer, "%g", this->current_temperature);
3864  out.append(buffer);
3865  out.append("\n");
3866 
3867  out.append(" target_temperature: ");
3868  sprintf(buffer, "%g", this->target_temperature);
3869  out.append(buffer);
3870  out.append("\n");
3871 
3872  out.append(" target_temperature_low: ");
3873  sprintf(buffer, "%g", this->target_temperature_low);
3874  out.append(buffer);
3875  out.append("\n");
3876 
3877  out.append(" target_temperature_high: ");
3878  sprintf(buffer, "%g", this->target_temperature_high);
3879  out.append(buffer);
3880  out.append("\n");
3881 
3882  out.append(" unused_legacy_away: ");
3883  out.append(YESNO(this->unused_legacy_away));
3884  out.append("\n");
3885 
3886  out.append(" action: ");
3887  out.append(proto_enum_to_string<enums::ClimateAction>(this->action));
3888  out.append("\n");
3889 
3890  out.append(" fan_mode: ");
3891  out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
3892  out.append("\n");
3893 
3894  out.append(" swing_mode: ");
3895  out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
3896  out.append("\n");
3897 
3898  out.append(" custom_fan_mode: ");
3899  out.append("'").append(this->custom_fan_mode).append("'");
3900  out.append("\n");
3901 
3902  out.append(" preset: ");
3903  out.append(proto_enum_to_string<enums::ClimatePreset>(this->preset));
3904  out.append("\n");
3905 
3906  out.append(" custom_preset: ");
3907  out.append("'").append(this->custom_preset).append("'");
3908  out.append("\n");
3909  out.append("}");
3910 }
3911 #endif
3912 bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3913  switch (field_id) {
3914  case 2: {
3915  this->has_mode = value.as_bool();
3916  return true;
3917  }
3918  case 3: {
3919  this->mode = value.as_enum<enums::ClimateMode>();
3920  return true;
3921  }
3922  case 4: {
3923  this->has_target_temperature = value.as_bool();
3924  return true;
3925  }
3926  case 6: {
3927  this->has_target_temperature_low = value.as_bool();
3928  return true;
3929  }
3930  case 8: {
3931  this->has_target_temperature_high = value.as_bool();
3932  return true;
3933  }
3934  case 10: {
3935  this->unused_has_legacy_away = value.as_bool();
3936  return true;
3937  }
3938  case 11: {
3939  this->unused_legacy_away = value.as_bool();
3940  return true;
3941  }
3942  case 12: {
3943  this->has_fan_mode = value.as_bool();
3944  return true;
3945  }
3946  case 13: {
3947  this->fan_mode = value.as_enum<enums::ClimateFanMode>();
3948  return true;
3949  }
3950  case 14: {
3951  this->has_swing_mode = value.as_bool();
3952  return true;
3953  }
3954  case 15: {
3955  this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
3956  return true;
3957  }
3958  case 16: {
3959  this->has_custom_fan_mode = value.as_bool();
3960  return true;
3961  }
3962  case 18: {
3963  this->has_preset = value.as_bool();
3964  return true;
3965  }
3966  case 19: {
3967  this->preset = value.as_enum<enums::ClimatePreset>();
3968  return true;
3969  }
3970  case 20: {
3971  this->has_custom_preset = value.as_bool();
3972  return true;
3973  }
3974  default:
3975  return false;
3976  }
3977 }
3979  switch (field_id) {
3980  case 17: {
3981  this->custom_fan_mode = value.as_string();
3982  return true;
3983  }
3984  case 21: {
3985  this->custom_preset = value.as_string();
3986  return true;
3987  }
3988  default:
3989  return false;
3990  }
3991 }
3992 bool ClimateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3993  switch (field_id) {
3994  case 1: {
3995  this->key = value.as_fixed32();
3996  return true;
3997  }
3998  case 5: {
3999  this->target_temperature = value.as_float();
4000  return true;
4001  }
4002  case 7: {
4003  this->target_temperature_low = value.as_float();
4004  return true;
4005  }
4006  case 9: {
4007  this->target_temperature_high = value.as_float();
4008  return true;
4009  }
4010  default:
4011  return false;
4012  }
4013 }
4015  buffer.encode_fixed32(1, this->key);
4016  buffer.encode_bool(2, this->has_mode);
4017  buffer.encode_enum<enums::ClimateMode>(3, this->mode);
4018  buffer.encode_bool(4, this->has_target_temperature);
4019  buffer.encode_float(5, this->target_temperature);
4020  buffer.encode_bool(6, this->has_target_temperature_low);
4021  buffer.encode_float(7, this->target_temperature_low);
4022  buffer.encode_bool(8, this->has_target_temperature_high);
4023  buffer.encode_float(9, this->target_temperature_high);
4024  buffer.encode_bool(10, this->unused_has_legacy_away);
4025  buffer.encode_bool(11, this->unused_legacy_away);
4026  buffer.encode_bool(12, this->has_fan_mode);
4027  buffer.encode_enum<enums::ClimateFanMode>(13, this->fan_mode);
4028  buffer.encode_bool(14, this->has_swing_mode);
4029  buffer.encode_enum<enums::ClimateSwingMode>(15, this->swing_mode);
4030  buffer.encode_bool(16, this->has_custom_fan_mode);
4031  buffer.encode_string(17, this->custom_fan_mode);
4032  buffer.encode_bool(18, this->has_preset);
4033  buffer.encode_enum<enums::ClimatePreset>(19, this->preset);
4034  buffer.encode_bool(20, this->has_custom_preset);
4035  buffer.encode_string(21, this->custom_preset);
4036 }
4037 #ifdef HAS_PROTO_MESSAGE_DUMP
4038 void ClimateCommandRequest::dump_to(std::string &out) const {
4039  __attribute__((unused)) char buffer[64];
4040  out.append("ClimateCommandRequest {\n");
4041  out.append(" key: ");
4042  sprintf(buffer, "%" PRIu32, this->key);
4043  out.append(buffer);
4044  out.append("\n");
4045 
4046  out.append(" has_mode: ");
4047  out.append(YESNO(this->has_mode));
4048  out.append("\n");
4049 
4050  out.append(" mode: ");
4051  out.append(proto_enum_to_string<enums::ClimateMode>(this->mode));
4052  out.append("\n");
4053 
4054  out.append(" has_target_temperature: ");
4055  out.append(YESNO(this->has_target_temperature));
4056  out.append("\n");
4057 
4058  out.append(" target_temperature: ");
4059  sprintf(buffer, "%g", this->target_temperature);
4060  out.append(buffer);
4061  out.append("\n");
4062 
4063  out.append(" has_target_temperature_low: ");
4064  out.append(YESNO(this->has_target_temperature_low));
4065  out.append("\n");
4066 
4067  out.append(" target_temperature_low: ");
4068  sprintf(buffer, "%g", this->target_temperature_low);
4069  out.append(buffer);
4070  out.append("\n");
4071 
4072  out.append(" has_target_temperature_high: ");
4073  out.append(YESNO(this->has_target_temperature_high));
4074  out.append("\n");
4075 
4076  out.append(" target_temperature_high: ");
4077  sprintf(buffer, "%g", this->target_temperature_high);
4078  out.append(buffer);
4079  out.append("\n");
4080 
4081  out.append(" unused_has_legacy_away: ");
4082  out.append(YESNO(this->unused_has_legacy_away));
4083  out.append("\n");
4084 
4085  out.append(" unused_legacy_away: ");
4086  out.append(YESNO(this->unused_legacy_away));
4087  out.append("\n");
4088 
4089  out.append(" has_fan_mode: ");
4090  out.append(YESNO(this->has_fan_mode));
4091  out.append("\n");
4092 
4093  out.append(" fan_mode: ");
4094  out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
4095  out.append("\n");
4096 
4097  out.append(" has_swing_mode: ");
4098  out.append(YESNO(this->has_swing_mode));
4099  out.append("\n");
4100 
4101  out.append(" swing_mode: ");
4102  out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
4103  out.append("\n");
4104 
4105  out.append(" has_custom_fan_mode: ");
4106  out.append(YESNO(this->has_custom_fan_mode));
4107  out.append("\n");
4108 
4109  out.append(" custom_fan_mode: ");
4110  out.append("'").append(this->custom_fan_mode).append("'");
4111  out.append("\n");
4112 
4113  out.append(" has_preset: ");
4114  out.append(YESNO(this->has_preset));
4115  out.append("\n");
4116 
4117  out.append(" preset: ");
4118  out.append(proto_enum_to_string<enums::ClimatePreset>(this->preset));
4119  out.append("\n");
4120 
4121  out.append(" has_custom_preset: ");
4122  out.append(YESNO(this->has_custom_preset));
4123  out.append("\n");
4124 
4125  out.append(" custom_preset: ");
4126  out.append("'").append(this->custom_preset).append("'");
4127  out.append("\n");
4128  out.append("}");
4129 }
4130 #endif
4132  switch (field_id) {
4133  case 9: {
4134  this->disabled_by_default = value.as_bool();
4135  return true;
4136  }
4137  case 10: {
4138  this->entity_category = value.as_enum<enums::EntityCategory>();
4139  return true;
4140  }
4141  case 12: {
4142  this->mode = value.as_enum<enums::NumberMode>();
4143  return true;
4144  }
4145  default:
4146  return false;
4147  }
4148 }
4150  switch (field_id) {
4151  case 1: {
4152  this->object_id = value.as_string();
4153  return true;
4154  }
4155  case 3: {
4156  this->name = value.as_string();
4157  return true;
4158  }
4159  case 4: {
4160  this->unique_id = value.as_string();
4161  return true;
4162  }
4163  case 5: {
4164  this->icon = value.as_string();
4165  return true;
4166  }
4167  case 11: {
4168  this->unit_of_measurement = value.as_string();
4169  return true;
4170  }
4171  case 13: {
4172  this->device_class = value.as_string();
4173  return true;
4174  }
4175  default:
4176  return false;
4177  }
4178 }
4180  switch (field_id) {
4181  case 2: {
4182  this->key = value.as_fixed32();
4183  return true;
4184  }
4185  case 6: {
4186  this->min_value = value.as_float();
4187  return true;
4188  }
4189  case 7: {
4190  this->max_value = value.as_float();
4191  return true;
4192  }
4193  case 8: {
4194  this->step = value.as_float();
4195  return true;
4196  }
4197  default:
4198  return false;
4199  }
4200 }
4202  buffer.encode_string(1, this->object_id);
4203  buffer.encode_fixed32(2, this->key);
4204  buffer.encode_string(3, this->name);
4205  buffer.encode_string(4, this->unique_id);
4206  buffer.encode_string(5, this->icon);
4207  buffer.encode_float(6, this->min_value);
4208  buffer.encode_float(7, this->max_value);
4209  buffer.encode_float(8, this->step);
4210  buffer.encode_bool(9, this->disabled_by_default);
4211  buffer.encode_enum<enums::EntityCategory>(10, this->entity_category);
4212  buffer.encode_string(11, this->unit_of_measurement);
4213  buffer.encode_enum<enums::NumberMode>(12, this->mode);
4214  buffer.encode_string(13, this->device_class);
4215 }
4216 #ifdef HAS_PROTO_MESSAGE_DUMP
4217 void ListEntitiesNumberResponse::dump_to(std::string &out) const {
4218  __attribute__((unused)) char buffer[64];
4219  out.append("ListEntitiesNumberResponse {\n");
4220  out.append(" object_id: ");
4221  out.append("'").append(this->object_id).append("'");
4222  out.append("\n");
4223 
4224  out.append(" key: ");
4225  sprintf(buffer, "%" PRIu32, this->key);
4226  out.append(buffer);
4227  out.append("\n");
4228 
4229  out.append(" name: ");
4230  out.append("'").append(this->name).append("'");
4231  out.append("\n");
4232 
4233  out.append(" unique_id: ");
4234  out.append("'").append(this->unique_id).append("'");
4235  out.append("\n");
4236 
4237  out.append(" icon: ");
4238  out.append("'").append(this->icon).append("'");
4239  out.append("\n");
4240 
4241  out.append(" min_value: ");
4242  sprintf(buffer, "%g", this->min_value);
4243  out.append(buffer);
4244  out.append("\n");
4245 
4246  out.append(" max_value: ");
4247  sprintf(buffer, "%g", this->max_value);
4248  out.append(buffer);
4249  out.append("\n");
4250 
4251  out.append(" step: ");
4252  sprintf(buffer, "%g", this->step);
4253  out.append(buffer);
4254  out.append("\n");
4255 
4256  out.append(" disabled_by_default: ");
4257  out.append(YESNO(this->disabled_by_default));
4258  out.append("\n");
4259 
4260  out.append(" entity_category: ");
4261  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4262  out.append("\n");
4263 
4264  out.append(" unit_of_measurement: ");
4265  out.append("'").append(this->unit_of_measurement).append("'");
4266  out.append("\n");
4267 
4268  out.append(" mode: ");
4269  out.append(proto_enum_to_string<enums::NumberMode>(this->mode));
4270  out.append("\n");
4271 
4272  out.append(" device_class: ");
4273  out.append("'").append(this->device_class).append("'");
4274  out.append("\n");
4275  out.append("}");
4276 }
4277 #endif
4278 bool NumberStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4279  switch (field_id) {
4280  case 3: {
4281  this->missing_state = value.as_bool();
4282  return true;
4283  }
4284  default:
4285  return false;
4286  }
4287 }
4288 bool NumberStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4289  switch (field_id) {
4290  case 1: {
4291  this->key = value.as_fixed32();
4292  return true;
4293  }
4294  case 2: {
4295  this->state = value.as_float();
4296  return true;
4297  }
4298  default:
4299  return false;
4300  }
4301 }
4303  buffer.encode_fixed32(1, this->key);
4304  buffer.encode_float(2, this->state);
4305  buffer.encode_bool(3, this->missing_state);
4306 }
4307 #ifdef HAS_PROTO_MESSAGE_DUMP
4308 void NumberStateResponse::dump_to(std::string &out) const {
4309  __attribute__((unused)) char buffer[64];
4310  out.append("NumberStateResponse {\n");
4311  out.append(" key: ");
4312  sprintf(buffer, "%" PRIu32, this->key);
4313  out.append(buffer);
4314  out.append("\n");
4315 
4316  out.append(" state: ");
4317  sprintf(buffer, "%g", this->state);
4318  out.append(buffer);
4319  out.append("\n");
4320 
4321  out.append(" missing_state: ");
4322  out.append(YESNO(this->missing_state));
4323  out.append("\n");
4324  out.append("}");
4325 }
4326 #endif
4327 bool NumberCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4328  switch (field_id) {
4329  case 1: {
4330  this->key = value.as_fixed32();
4331  return true;
4332  }
4333  case 2: {
4334  this->state = value.as_float();
4335  return true;
4336  }
4337  default:
4338  return false;
4339  }
4340 }
4342  buffer.encode_fixed32(1, this->key);
4343  buffer.encode_float(2, this->state);
4344 }
4345 #ifdef HAS_PROTO_MESSAGE_DUMP
4346 void NumberCommandRequest::dump_to(std::string &out) const {
4347  __attribute__((unused)) char buffer[64];
4348  out.append("NumberCommandRequest {\n");
4349  out.append(" key: ");
4350  sprintf(buffer, "%" PRIu32, this->key);
4351  out.append(buffer);
4352  out.append("\n");
4353 
4354  out.append(" state: ");
4355  sprintf(buffer, "%g", this->state);
4356  out.append(buffer);
4357  out.append("\n");
4358  out.append("}");
4359 }
4360 #endif
4362  switch (field_id) {
4363  case 7: {
4364  this->disabled_by_default = value.as_bool();
4365  return true;
4366  }
4367  case 8: {
4368  this->entity_category = value.as_enum<enums::EntityCategory>();
4369  return true;
4370  }
4371  default:
4372  return false;
4373  }
4374 }
4376  switch (field_id) {
4377  case 1: {
4378  this->object_id = value.as_string();
4379  return true;
4380  }
4381  case 3: {
4382  this->name = value.as_string();
4383  return true;
4384  }
4385  case 4: {
4386  this->unique_id = value.as_string();
4387  return true;
4388  }
4389  case 5: {
4390  this->icon = value.as_string();
4391  return true;
4392  }
4393  case 6: {
4394  this->options.push_back(value.as_string());
4395  return true;
4396  }
4397  default:
4398  return false;
4399  }
4400 }
4402  switch (field_id) {
4403  case 2: {
4404  this->key = value.as_fixed32();
4405  return true;
4406  }
4407  default:
4408  return false;
4409  }
4410 }
4412  buffer.encode_string(1, this->object_id);
4413  buffer.encode_fixed32(2, this->key);
4414  buffer.encode_string(3, this->name);
4415  buffer.encode_string(4, this->unique_id);
4416  buffer.encode_string(5, this->icon);
4417  for (auto &it : this->options) {
4418  buffer.encode_string(6, it, true);
4419  }
4420  buffer.encode_bool(7, this->disabled_by_default);
4421  buffer.encode_enum<enums::EntityCategory>(8, this->entity_category);
4422 }
4423 #ifdef HAS_PROTO_MESSAGE_DUMP
4424 void ListEntitiesSelectResponse::dump_to(std::string &out) const {
4425  __attribute__((unused)) char buffer[64];
4426  out.append("ListEntitiesSelectResponse {\n");
4427  out.append(" object_id: ");
4428  out.append("'").append(this->object_id).append("'");
4429  out.append("\n");
4430 
4431  out.append(" key: ");
4432  sprintf(buffer, "%" PRIu32, this->key);
4433  out.append(buffer);
4434  out.append("\n");
4435 
4436  out.append(" name: ");
4437  out.append("'").append(this->name).append("'");
4438  out.append("\n");
4439 
4440  out.append(" unique_id: ");
4441  out.append("'").append(this->unique_id).append("'");
4442  out.append("\n");
4443 
4444  out.append(" icon: ");
4445  out.append("'").append(this->icon).append("'");
4446  out.append("\n");
4447 
4448  for (const auto &it : this->options) {
4449  out.append(" options: ");
4450  out.append("'").append(it).append("'");
4451  out.append("\n");
4452  }
4453 
4454  out.append(" disabled_by_default: ");
4455  out.append(YESNO(this->disabled_by_default));
4456  out.append("\n");
4457 
4458  out.append(" entity_category: ");
4459  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4460  out.append("\n");
4461  out.append("}");
4462 }
4463 #endif
4464 bool SelectStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4465  switch (field_id) {
4466  case 3: {
4467  this->missing_state = value.as_bool();
4468  return true;
4469  }
4470  default:
4471  return false;
4472  }
4473 }
4475  switch (field_id) {
4476  case 2: {
4477  this->state = value.as_string();
4478  return true;
4479  }
4480  default:
4481  return false;
4482  }
4483 }
4484 bool SelectStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4485  switch (field_id) {
4486  case 1: {
4487  this->key = value.as_fixed32();
4488  return true;
4489  }
4490  default:
4491  return false;
4492  }
4493 }
4495  buffer.encode_fixed32(1, this->key);
4496  buffer.encode_string(2, this->state);
4497  buffer.encode_bool(3, this->missing_state);
4498 }
4499 #ifdef HAS_PROTO_MESSAGE_DUMP
4500 void SelectStateResponse::dump_to(std::string &out) const {
4501  __attribute__((unused)) char buffer[64];
4502  out.append("SelectStateResponse {\n");
4503  out.append(" key: ");
4504  sprintf(buffer, "%" PRIu32, this->key);
4505  out.append(buffer);
4506  out.append("\n");
4507 
4508  out.append(" state: ");
4509  out.append("'").append(this->state).append("'");
4510  out.append("\n");
4511 
4512  out.append(" missing_state: ");
4513  out.append(YESNO(this->missing_state));
4514  out.append("\n");
4515  out.append("}");
4516 }
4517 #endif
4519  switch (field_id) {
4520  case 2: {
4521  this->state = value.as_string();
4522  return true;
4523  }
4524  default:
4525  return false;
4526  }
4527 }
4528 bool SelectCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4529  switch (field_id) {
4530  case 1: {
4531  this->key = value.as_fixed32();
4532  return true;
4533  }
4534  default:
4535  return false;
4536  }
4537 }
4539  buffer.encode_fixed32(1, this->key);
4540  buffer.encode_string(2, this->state);
4541 }
4542 #ifdef HAS_PROTO_MESSAGE_DUMP
4543 void SelectCommandRequest::dump_to(std::string &out) const {
4544  __attribute__((unused)) char buffer[64];
4545  out.append("SelectCommandRequest {\n");
4546  out.append(" key: ");
4547  sprintf(buffer, "%" PRIu32, this->key);
4548  out.append(buffer);
4549  out.append("\n");
4550 
4551  out.append(" state: ");
4552  out.append("'").append(this->state).append("'");
4553  out.append("\n");
4554  out.append("}");
4555 }
4556 #endif
4558  switch (field_id) {
4559  case 6: {
4560  this->disabled_by_default = value.as_bool();
4561  return true;
4562  }
4563  case 7: {
4564  this->entity_category = value.as_enum<enums::EntityCategory>();
4565  return true;
4566  }
4567  case 8: {
4568  this->assumed_state = value.as_bool();
4569  return true;
4570  }
4571  case 9: {
4572  this->supports_open = value.as_bool();
4573  return true;
4574  }
4575  case 10: {
4576  this->requires_code = value.as_bool();
4577  return true;
4578  }
4579  default:
4580  return false;
4581  }
4582 }
4584  switch (field_id) {
4585  case 1: {
4586  this->object_id = value.as_string();
4587  return true;
4588  }
4589  case 3: {
4590  this->name = value.as_string();
4591  return true;
4592  }
4593  case 4: {
4594  this->unique_id = value.as_string();
4595  return true;
4596  }
4597  case 5: {
4598  this->icon = value.as_string();
4599  return true;
4600  }
4601  case 11: {
4602  this->code_format = value.as_string();
4603  return true;
4604  }
4605  default:
4606  return false;
4607  }
4608 }
4609 bool ListEntitiesLockResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4610  switch (field_id) {
4611  case 2: {
4612  this->key = value.as_fixed32();
4613  return true;
4614  }
4615  default:
4616  return false;
4617  }
4618 }
4620  buffer.encode_string(1, this->object_id);
4621  buffer.encode_fixed32(2, this->key);
4622  buffer.encode_string(3, this->name);
4623  buffer.encode_string(4, this->unique_id);
4624  buffer.encode_string(5, this->icon);
4625  buffer.encode_bool(6, this->disabled_by_default);
4626  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4627  buffer.encode_bool(8, this->assumed_state);
4628  buffer.encode_bool(9, this->supports_open);
4629  buffer.encode_bool(10, this->requires_code);
4630  buffer.encode_string(11, this->code_format);
4631 }
4632 #ifdef HAS_PROTO_MESSAGE_DUMP
4633 void ListEntitiesLockResponse::dump_to(std::string &out) const {
4634  __attribute__((unused)) char buffer[64];
4635  out.append("ListEntitiesLockResponse {\n");
4636  out.append(" object_id: ");
4637  out.append("'").append(this->object_id).append("'");
4638  out.append("\n");
4639 
4640  out.append(" key: ");
4641  sprintf(buffer, "%" PRIu32, this->key);
4642  out.append(buffer);
4643  out.append("\n");
4644 
4645  out.append(" name: ");
4646  out.append("'").append(this->name).append("'");
4647  out.append("\n");
4648 
4649  out.append(" unique_id: ");
4650  out.append("'").append(this->unique_id).append("'");
4651  out.append("\n");
4652 
4653  out.append(" icon: ");
4654  out.append("'").append(this->icon).append("'");
4655  out.append("\n");
4656 
4657  out.append(" disabled_by_default: ");
4658  out.append(YESNO(this->disabled_by_default));
4659  out.append("\n");
4660 
4661  out.append(" entity_category: ");
4662  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4663  out.append("\n");
4664 
4665  out.append(" assumed_state: ");
4666  out.append(YESNO(this->assumed_state));
4667  out.append("\n");
4668 
4669  out.append(" supports_open: ");
4670  out.append(YESNO(this->supports_open));
4671  out.append("\n");
4672 
4673  out.append(" requires_code: ");
4674  out.append(YESNO(this->requires_code));
4675  out.append("\n");
4676 
4677  out.append(" code_format: ");
4678  out.append("'").append(this->code_format).append("'");
4679  out.append("\n");
4680  out.append("}");
4681 }
4682 #endif
4683 bool LockStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4684  switch (field_id) {
4685  case 2: {
4686  this->state = value.as_enum<enums::LockState>();
4687  return true;
4688  }
4689  default:
4690  return false;
4691  }
4692 }
4693 bool LockStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4694  switch (field_id) {
4695  case 1: {
4696  this->key = value.as_fixed32();
4697  return true;
4698  }
4699  default:
4700  return false;
4701  }
4702 }
4704  buffer.encode_fixed32(1, this->key);
4705  buffer.encode_enum<enums::LockState>(2, this->state);
4706 }
4707 #ifdef HAS_PROTO_MESSAGE_DUMP
4708 void LockStateResponse::dump_to(std::string &out) const {
4709  __attribute__((unused)) char buffer[64];
4710  out.append("LockStateResponse {\n");
4711  out.append(" key: ");
4712  sprintf(buffer, "%" PRIu32, this->key);
4713  out.append(buffer);
4714  out.append("\n");
4715 
4716  out.append(" state: ");
4717  out.append(proto_enum_to_string<enums::LockState>(this->state));
4718  out.append("\n");
4719  out.append("}");
4720 }
4721 #endif
4722 bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
4723  switch (field_id) {
4724  case 2: {
4725  this->command = value.as_enum<enums::LockCommand>();
4726  return true;
4727  }
4728  case 3: {
4729  this->has_code = value.as_bool();
4730  return true;
4731  }
4732  default:
4733  return false;
4734  }
4735 }
4737  switch (field_id) {
4738  case 4: {
4739  this->code = value.as_string();
4740  return true;
4741  }
4742  default:
4743  return false;
4744  }
4745 }
4746 bool LockCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4747  switch (field_id) {
4748  case 1: {
4749  this->key = value.as_fixed32();
4750  return true;
4751  }
4752  default:
4753  return false;
4754  }
4755 }
4757  buffer.encode_fixed32(1, this->key);
4758  buffer.encode_enum<enums::LockCommand>(2, this->command);
4759  buffer.encode_bool(3, this->has_code);
4760  buffer.encode_string(4, this->code);
4761 }
4762 #ifdef HAS_PROTO_MESSAGE_DUMP
4763 void LockCommandRequest::dump_to(std::string &out) const {
4764  __attribute__((unused)) char buffer[64];
4765  out.append("LockCommandRequest {\n");
4766  out.append(" key: ");
4767  sprintf(buffer, "%" PRIu32, this->key);
4768  out.append(buffer);
4769  out.append("\n");
4770 
4771  out.append(" command: ");
4772  out.append(proto_enum_to_string<enums::LockCommand>(this->command));
4773  out.append("\n");
4774 
4775  out.append(" has_code: ");
4776  out.append(YESNO(this->has_code));
4777  out.append("\n");
4778 
4779  out.append(" code: ");
4780  out.append("'").append(this->code).append("'");
4781  out.append("\n");
4782  out.append("}");
4783 }
4784 #endif
4786  switch (field_id) {
4787  case 6: {
4788  this->disabled_by_default = value.as_bool();
4789  return true;
4790  }
4791  case 7: {
4792  this->entity_category = value.as_enum<enums::EntityCategory>();
4793  return true;
4794  }
4795  default:
4796  return false;
4797  }
4798 }
4800  switch (field_id) {
4801  case 1: {
4802  this->object_id = value.as_string();
4803  return true;
4804  }
4805  case 3: {
4806  this->name = value.as_string();
4807  return true;
4808  }
4809  case 4: {
4810  this->unique_id = value.as_string();
4811  return true;
4812  }
4813  case 5: {
4814  this->icon = value.as_string();
4815  return true;
4816  }
4817  case 8: {
4818  this->device_class = value.as_string();
4819  return true;
4820  }
4821  default:
4822  return false;
4823  }
4824 }
4826  switch (field_id) {
4827  case 2: {
4828  this->key = value.as_fixed32();
4829  return true;
4830  }
4831  default:
4832  return false;
4833  }
4834 }
4836  buffer.encode_string(1, this->object_id);
4837  buffer.encode_fixed32(2, this->key);
4838  buffer.encode_string(3, this->name);
4839  buffer.encode_string(4, this->unique_id);
4840  buffer.encode_string(5, this->icon);
4841  buffer.encode_bool(6, this->disabled_by_default);
4842  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4843  buffer.encode_string(8, this->device_class);
4844 }
4845 #ifdef HAS_PROTO_MESSAGE_DUMP
4846 void ListEntitiesButtonResponse::dump_to(std::string &out) const {
4847  __attribute__((unused)) char buffer[64];
4848  out.append("ListEntitiesButtonResponse {\n");
4849  out.append(" object_id: ");
4850  out.append("'").append(this->object_id).append("'");
4851  out.append("\n");
4852 
4853  out.append(" key: ");
4854  sprintf(buffer, "%" PRIu32, this->key);
4855  out.append(buffer);
4856  out.append("\n");
4857 
4858  out.append(" name: ");
4859  out.append("'").append(this->name).append("'");
4860  out.append("\n");
4861 
4862  out.append(" unique_id: ");
4863  out.append("'").append(this->unique_id).append("'");
4864  out.append("\n");
4865 
4866  out.append(" icon: ");
4867  out.append("'").append(this->icon).append("'");
4868  out.append("\n");
4869 
4870  out.append(" disabled_by_default: ");
4871  out.append(YESNO(this->disabled_by_default));
4872  out.append("\n");
4873 
4874  out.append(" entity_category: ");
4875  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4876  out.append("\n");
4877 
4878  out.append(" device_class: ");
4879  out.append("'").append(this->device_class).append("'");
4880  out.append("\n");
4881  out.append("}");
4882 }
4883 #endif
4884 bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4885  switch (field_id) {
4886  case 1: {
4887  this->key = value.as_fixed32();
4888  return true;
4889  }
4890  default:
4891  return false;
4892  }
4893 }
4894 void ButtonCommandRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->key); }
4895 #ifdef HAS_PROTO_MESSAGE_DUMP
4896 void ButtonCommandRequest::dump_to(std::string &out) const {
4897  __attribute__((unused)) char buffer[64];
4898  out.append("ButtonCommandRequest {\n");
4899  out.append(" key: ");
4900  sprintf(buffer, "%" PRIu32, this->key);
4901  out.append(buffer);
4902  out.append("\n");
4903  out.append("}");
4904 }
4905 #endif
4907  switch (field_id) {
4908  case 6: {
4909  this->disabled_by_default = value.as_bool();
4910  return true;
4911  }
4912  case 7: {
4913  this->entity_category = value.as_enum<enums::EntityCategory>();
4914  return true;
4915  }
4916  case 8: {
4917  this->supports_pause = value.as_bool();
4918  return true;
4919  }
4920  default:
4921  return false;
4922  }
4923 }
4925  switch (field_id) {
4926  case 1: {
4927  this->object_id = value.as_string();
4928  return true;
4929  }
4930  case 3: {
4931  this->name = value.as_string();
4932  return true;
4933  }
4934  case 4: {
4935  this->unique_id = value.as_string();
4936  return true;
4937  }
4938  case 5: {
4939  this->icon = value.as_string();
4940  return true;
4941  }
4942  default:
4943  return false;
4944  }
4945 }
4947  switch (field_id) {
4948  case 2: {
4949  this->key = value.as_fixed32();
4950  return true;
4951  }
4952  default:
4953  return false;
4954  }
4955 }
4957  buffer.encode_string(1, this->object_id);
4958  buffer.encode_fixed32(2, this->key);
4959  buffer.encode_string(3, this->name);
4960  buffer.encode_string(4, this->unique_id);
4961  buffer.encode_string(5, this->icon);
4962  buffer.encode_bool(6, this->disabled_by_default);
4963  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4964  buffer.encode_bool(8, this->supports_pause);
4965 }
4966 #ifdef HAS_PROTO_MESSAGE_DUMP
4967 void ListEntitiesMediaPlayerResponse::dump_to(std::string &out) const {
4968  __attribute__((unused)) char buffer[64];
4969  out.append("ListEntitiesMediaPlayerResponse {\n");
4970  out.append(" object_id: ");
4971  out.append("'").append(this->object_id).append("'");
4972  out.append("\n");
4973 
4974  out.append(" key: ");
4975  sprintf(buffer, "%" PRIu32, this->key);
4976  out.append(buffer);
4977  out.append("\n");
4978 
4979  out.append(" name: ");
4980  out.append("'").append(this->name).append("'");
4981  out.append("\n");
4982 
4983  out.append(" unique_id: ");
4984  out.append("'").append(this->unique_id).append("'");
4985  out.append("\n");
4986 
4987  out.append(" icon: ");
4988  out.append("'").append(this->icon).append("'");
4989  out.append("\n");
4990 
4991  out.append(" disabled_by_default: ");
4992  out.append(YESNO(this->disabled_by_default));
4993  out.append("\n");
4994 
4995  out.append(" entity_category: ");
4996  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4997  out.append("\n");
4998 
4999  out.append(" supports_pause: ");
5000  out.append(YESNO(this->supports_pause));
5001  out.append("\n");
5002  out.append("}");
5003 }
5004 #endif
5006  switch (field_id) {
5007  case 2: {
5008  this->state = value.as_enum<enums::MediaPlayerState>();
5009  return true;
5010  }
5011  case 4: {
5012  this->muted = value.as_bool();
5013  return true;
5014  }
5015  default:
5016  return false;
5017  }
5018 }
5019 bool MediaPlayerStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
5020  switch (field_id) {
5021  case 1: {
5022  this->key = value.as_fixed32();
5023  return true;
5024  }
5025  case 3: {
5026  this->volume = value.as_float();
5027  return true;
5028  }
5029  default:
5030  return false;
5031  }
5032 }
5034  buffer.encode_fixed32(1, this->key);
5035  buffer.encode_enum<enums::MediaPlayerState>(2, this->state);
5036  buffer.encode_float(3, this->volume);
5037  buffer.encode_bool(4, this->muted);
5038 }
5039 #ifdef HAS_PROTO_MESSAGE_DUMP
5040 void MediaPlayerStateResponse::dump_to(std::string &out) const {
5041  __attribute__((unused)) char buffer[64];
5042  out.append("MediaPlayerStateResponse {\n");
5043  out.append(" key: ");
5044  sprintf(buffer, "%" PRIu32, this->key);
5045  out.append(buffer);
5046  out.append("\n");
5047 
5048  out.append(" state: ");
5049  out.append(proto_enum_to_string<enums::MediaPlayerState>(this->state));
5050  out.append("\n");
5051 
5052  out.append(" volume: ");
5053  sprintf(buffer, "%g", this->volume);
5054  out.append(buffer);
5055  out.append("\n");
5056 
5057  out.append(" muted: ");
5058  out.append(YESNO(this->muted));
5059  out.append("\n");
5060  out.append("}");
5061 }
5062 #endif
5064  switch (field_id) {
5065  case 2: {
5066  this->has_command = value.as_bool();
5067  return true;
5068  }
5069  case 3: {
5070  this->command = value.as_enum<enums::MediaPlayerCommand>();
5071  return true;
5072  }
5073  case 4: {
5074  this->has_volume = value.as_bool();
5075  return true;
5076  }
5077  case 6: {
5078  this->has_media_url = value.as_bool();
5079  return true;
5080  }
5081  default:
5082  return false;
5083  }
5084 }
5086  switch (field_id) {
5087  case 7: {
5088  this->media_url = value.as_string();
5089  return true;
5090  }
5091  default:
5092  return false;
5093  }
5094 }
5095 bool MediaPlayerCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
5096  switch (field_id) {
5097  case 1: {
5098  this->key = value.as_fixed32();
5099  return true;
5100  }
5101  case 5: {
5102  this->volume = value.as_float();
5103  return true;
5104  }
5105  default:
5106  return false;
5107  }
5108 }
5110  buffer.encode_fixed32(1, this->key);
5111  buffer.encode_bool(2, this->has_command);
5112  buffer.encode_enum<enums::MediaPlayerCommand>(3, this->command);
5113  buffer.encode_bool(4, this->has_volume);
5114  buffer.encode_float(5, this->volume);
5115  buffer.encode_bool(6, this->has_media_url);
5116  buffer.encode_string(7, this->media_url);
5117 }
5118 #ifdef HAS_PROTO_MESSAGE_DUMP
5119 void MediaPlayerCommandRequest::dump_to(std::string &out) const {
5120  __attribute__((unused)) char buffer[64];
5121  out.append("MediaPlayerCommandRequest {\n");
5122  out.append(" key: ");
5123  sprintf(buffer, "%" PRIu32, this->key);
5124  out.append(buffer);
5125  out.append("\n");
5126 
5127  out.append(" has_command: ");
5128  out.append(YESNO(this->has_command));
5129  out.append("\n");
5130 
5131  out.append(" command: ");
5132  out.append(proto_enum_to_string<enums::MediaPlayerCommand>(this->command));
5133  out.append("\n");
5134 
5135  out.append(" has_volume: ");
5136  out.append(YESNO(this->has_volume));
5137  out.append("\n");
5138 
5139  out.append(" volume: ");
5140  sprintf(buffer, "%g", this->volume);
5141  out.append(buffer);
5142  out.append("\n");
5143 
5144  out.append(" has_media_url: ");
5145  out.append(YESNO(this->has_media_url));
5146  out.append("\n");
5147 
5148  out.append(" media_url: ");
5149  out.append("'").append(this->media_url).append("'");
5150  out.append("\n");
5151  out.append("}");
5152 }
5153 #endif
5155  switch (field_id) {
5156  case 1: {
5157  this->flags = value.as_uint32();
5158  return true;
5159  }
5160  default:
5161  return false;
5162  }
5163 }
5165  buffer.encode_uint32(1, this->flags);
5166 }
5167 #ifdef HAS_PROTO_MESSAGE_DUMP
5169  __attribute__((unused)) char buffer[64];
5170  out.append("SubscribeBluetoothLEAdvertisementsRequest {\n");
5171  out.append(" flags: ");
5172  sprintf(buffer, "%" PRIu32, this->flags);
5173  out.append(buffer);
5174  out.append("\n");
5175  out.append("}");
5176 }
5177 #endif
5178 bool BluetoothServiceData::decode_varint(uint32_t field_id, ProtoVarInt value) {
5179  switch (field_id) {
5180  case 2: {
5181  this->legacy_data.push_back(value.as_uint32());
5182  return true;
5183  }
5184  default:
5185  return false;
5186  }
5187 }
5189  switch (field_id) {
5190  case 1: {
5191  this->uuid = value.as_string();
5192  return true;
5193  }
5194  case 3: {
5195  this->data = value.as_string();
5196  return true;
5197  }
5198  default:
5199  return false;
5200  }
5201 }
5203  buffer.encode_string(1, this->uuid);
5204  for (auto &it : this->legacy_data) {
5205  buffer.encode_uint32(2, it, true);
5206  }
5207  buffer.encode_string(3, this->data);
5208 }
5209 #ifdef HAS_PROTO_MESSAGE_DUMP
5210 void BluetoothServiceData::dump_to(std::string &out) const {
5211  __attribute__((unused)) char buffer[64];
5212  out.append("BluetoothServiceData {\n");
5213  out.append(" uuid: ");
5214  out.append("'").append(this->uuid).append("'");
5215  out.append("\n");
5216 
5217  for (const auto &it : this->legacy_data) {
5218  out.append(" legacy_data: ");
5219  sprintf(buffer, "%" PRIu32, it);
5220  out.append(buffer);
5221  out.append("\n");
5222  }
5223 
5224  out.append(" data: ");
5225  out.append("'").append(this->data).append("'");
5226  out.append("\n");
5227  out.append("}");
5228 }
5229 #endif
5231  switch (field_id) {
5232  case 1: {
5233  this->address = value.as_uint64();
5234  return true;
5235  }
5236  case 3: {
5237  this->rssi = value.as_sint32();
5238  return true;
5239  }
5240  case 7: {
5241  this->address_type = value.as_uint32();
5242  return true;
5243  }
5244  default:
5245  return false;
5246  }
5247 }
5249  switch (field_id) {
5250  case 2: {
5251  this->name = value.as_string();
5252  return true;
5253  }
5254  case 4: {
5255  this->service_uuids.push_back(value.as_string());
5256  return true;
5257  }
5258  case 5: {
5259  this->service_data.push_back(value.as_message<BluetoothServiceData>());
5260  return true;
5261  }
5262  case 6: {
5263  this->manufacturer_data.push_back(value.as_message<BluetoothServiceData>());
5264  return true;
5265  }
5266  default:
5267  return false;
5268  }
5269 }
5271  buffer.encode_uint64(1, this->address);
5272  buffer.encode_string(2, this->name);
5273  buffer.encode_sint32(3, this->rssi);
5274  for (auto &it : this->service_uuids) {
5275  buffer.encode_string(4, it, true);
5276  }
5277  for (auto &it : this->service_data) {
5278  buffer.encode_message<BluetoothServiceData>(5, it, true);
5279  }
5280  for (auto &it : this->manufacturer_data) {
5281  buffer.encode_message<BluetoothServiceData>(6, it, true);
5282  }
5283  buffer.encode_uint32(7, this->address_type);
5284 }
5285 #ifdef HAS_PROTO_MESSAGE_DUMP
5286 void BluetoothLEAdvertisementResponse::dump_to(std::string &out) const {
5287  __attribute__((unused)) char buffer[64];
5288  out.append("BluetoothLEAdvertisementResponse {\n");
5289  out.append(" address: ");
5290  sprintf(buffer, "%llu", this->address);
5291  out.append(buffer);
5292  out.append("\n");
5293 
5294  out.append(" name: ");
5295  out.append("'").append(this->name).append("'");
5296  out.append("\n");
5297 
5298  out.append(" rssi: ");
5299  sprintf(buffer, "%" PRId32, this->rssi);
5300  out.append(buffer);
5301  out.append("\n");
5302 
5303  for (const auto &it : this->service_uuids) {
5304  out.append(" service_uuids: ");
5305  out.append("'").append(it).append("'");
5306  out.append("\n");
5307  }
5308 
5309  for (const auto &it : this->service_data) {
5310  out.append(" service_data: ");
5311  it.dump_to(out);
5312  out.append("\n");
5313  }
5314 
5315  for (const auto &it : this->manufacturer_data) {
5316  out.append(" manufacturer_data: ");
5317  it.dump_to(out);
5318  out.append("\n");
5319  }
5320 
5321  out.append(" address_type: ");
5322  sprintf(buffer, "%" PRIu32, this->address_type);
5323  out.append(buffer);
5324  out.append("\n");
5325  out.append("}");
5326 }
5327 #endif
5329  switch (field_id) {
5330  case 1: {
5331  this->address = value.as_uint64();
5332  return true;
5333  }
5334  case 2: {
5335  this->rssi = value.as_sint32();
5336  return true;
5337  }
5338  case 3: {
5339  this->address_type = value.as_uint32();
5340  return true;
5341  }
5342  default:
5343  return false;
5344  }
5345 }
5347  switch (field_id) {
5348  case 4: {
5349  this->data = value.as_string();
5350  return true;
5351  }
5352  default:
5353  return false;
5354  }
5355 }
5357  buffer.encode_uint64(1, this->address);
5358  buffer.encode_sint32(2, this->rssi);
5359  buffer.encode_uint32(3, this->address_type);
5360  buffer.encode_string(4, this->data);
5361 }
5362 #ifdef HAS_PROTO_MESSAGE_DUMP
5363 void BluetoothLERawAdvertisement::dump_to(std::string &out) const {
5364  __attribute__((unused)) char buffer[64];
5365  out.append("BluetoothLERawAdvertisement {\n");
5366  out.append(" address: ");
5367  sprintf(buffer, "%llu", this->address);
5368  out.append(buffer);
5369  out.append("\n");
5370 
5371  out.append(" rssi: ");
5372  sprintf(buffer, "%" PRId32, this->rssi);
5373  out.append(buffer);
5374  out.append("\n");
5375 
5376  out.append(" address_type: ");
5377  sprintf(buffer, "%" PRIu32, this->address_type);
5378  out.append(buffer);
5379  out.append("\n");
5380 
5381  out.append(" data: ");
5382  out.append("'").append(this->data).append("'");
5383  out.append("\n");
5384  out.append("}");
5385 }
5386 #endif
5388  switch (field_id) {
5389  case 1: {
5390  this->advertisements.push_back(value.as_message<BluetoothLERawAdvertisement>());
5391  return true;
5392  }
5393  default:
5394  return false;
5395  }
5396 }
5398  for (auto &it : this->advertisements) {
5399  buffer.encode_message<BluetoothLERawAdvertisement>(1, it, true);
5400  }
5401 }
5402 #ifdef HAS_PROTO_MESSAGE_DUMP
5404  __attribute__((unused)) char buffer[64];
5405  out.append("BluetoothLERawAdvertisementsResponse {\n");
5406  for (const auto &it : this->advertisements) {
5407  out.append(" advertisements: ");
5408  it.dump_to(out);
5409  out.append("\n");
5410  }
5411  out.append("}");
5412 }
5413 #endif
5414 bool BluetoothDeviceRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
5415  switch (field_id) {
5416  case 1: {
5417  this->address = value.as_uint64();
5418  return true;
5419  }
5420  case 2: {
5421  this->request_type = value.as_enum<enums::BluetoothDeviceRequestType>();
5422  return true;
5423  }
5424  case 3: {
5425  this->has_address_type = value.as_bool();
5426  return true;
5427  }
5428  case 4: {
5429  this->address_type = value.as_uint32();
5430  return true;
5431  }
5432  default:
5433  return false;
5434  }
5435 }
5437  buffer.encode_uint64(1, this->address);
5438  buffer.encode_enum<enums::BluetoothDeviceRequestType>(2, this->request_type);
5439  buffer.encode_bool(3, this->has_address_type);
5440  buffer.encode_uint32(4, this->address_type);
5441 }
5442 #ifdef HAS_PROTO_MESSAGE_DUMP
5443 void BluetoothDeviceRequest::dump_to(std::string &out) const {
5444  __attribute__((unused)) char buffer[64];
5445  out.append("BluetoothDeviceRequest {\n");
5446  out.append(" address: ");
5447  sprintf(buffer, "%llu", this->address);
5448  out.append(buffer);
5449  out.append("\n");
5450 
5451  out.append(" request_type: ");
5452  out.append(proto_enum_to_string<enums::BluetoothDeviceRequestType>(this->request_type));
5453  out.append("\n");
5454 
5455  out.append(" has_address_type: ");
5456  out.append(YESNO(this->has_address_type));
5457  out.append("\n");
5458 
5459  out.append(" address_type: ");
5460  sprintf(buffer, "%" PRIu32, this->address_type);
5461  out.append(buffer);
5462  out.append("\n");
5463  out.append("}");
5464 }
5465 #endif
5467  switch (field_id) {
5468  case 1: {
5469  this->address = value.as_uint64();
5470  return true;
5471  }
5472  case 2: {
5473  this->connected = value.as_bool();
5474  return true;
5475  }
5476  case 3: {
5477  this->mtu = value.as_uint32();
5478  return true;
5479  }
5480  case 4: {
5481  this->error = value.as_int32();
5482  return true;
5483  }
5484  default:
5485  return false;
5486  }
5487 }
5489  buffer.encode_uint64(1, this->address);
5490  buffer.encode_bool(2, this->connected);
5491  buffer.encode_uint32(3, this->mtu);
5492  buffer.encode_int32(4, this->error);
5493 }
5494 #ifdef HAS_PROTO_MESSAGE_DUMP
5495 void BluetoothDeviceConnectionResponse::dump_to(std::string &out) const {
5496  __attribute__((unused)) char buffer[64];
5497  out.append("BluetoothDeviceConnectionResponse {\n");
5498  out.append(" address: ");
5499  sprintf(buffer, "%llu", this->address);
5500  out.append(buffer);
5501  out.append("\n");
5502 
5503  out.append(" connected: ");
5504  out.append(YESNO(this->connected));
5505  out.append("\n");
5506 
5507  out.append(" mtu: ");
5508  sprintf(buffer, "%" PRIu32, this->mtu);
5509  out.append(buffer);
5510  out.append("\n");
5511 
5512  out.append(" error: ");
5513  sprintf(buffer, "%" PRId32, this->error);
5514  out.append(buffer);
5515  out.append("\n");
5516  out.append("}");
5517 }
5518 #endif
5520  switch (field_id) {
5521  case 1: {
5522  this->address = value.as_uint64();
5523  return true;
5524  }
5525  default:
5526  return false;
5527  }
5528 }
5529 void BluetoothGATTGetServicesRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_uint64(1, this->address); }
5530 #ifdef HAS_PROTO_MESSAGE_DUMP
5531 void BluetoothGATTGetServicesRequest::dump_to(std::string &out) const {
5532  __attribute__((unused)) char buffer[64];
5533  out.append("BluetoothGATTGetServicesRequest {\n");
5534  out.append(" address: ");
5535  sprintf(buffer, "%llu", this->address);
5536  out.append(buffer);
5537  out.append("\n");
5538  out.append("}");
5539 }
5540 #endif
5541 bool BluetoothGATTDescriptor::decode_varint(uint32_t field_id, ProtoVarInt value) {
5542  switch (field_id) {
5543  case 1: {
5544  this->uuid.push_back(value.as_uint64());
5545  return true;
5546  }
5547  case 2: {
5548  this->handle = value.as_uint32();
5549  return true;
5550  }
5551  default:
5552  return false;
5553  }
5554 }
5556  for (auto &it : this->uuid) {
5557  buffer.encode_uint64(1, it, true);
5558  }
5559  buffer.encode_uint32(2, this->handle);
5560 }
5561 #ifdef HAS_PROTO_MESSAGE_DUMP
5562 void BluetoothGATTDescriptor::dump_to(std::string &out) const {
5563  __attribute__((unused)) char buffer[64];
5564  out.append("BluetoothGATTDescriptor {\n");
5565  for (const auto &it : this->uuid) {
5566  out.append(" uuid: ");
5567  sprintf(buffer, "%llu", it);
5568  out.append(buffer);
5569  out.append("\n");
5570  }
5571 
5572  out.append(" handle: ");
5573  sprintf(buffer, "%" PRIu32, this->handle);
5574  out.append(buffer);
5575  out.append("\n");
5576  out.append("}");
5577 }
5578 #endif
5580  switch (field_id) {
5581  case 1: {
5582  this->uuid.push_back(value.as_uint64());
5583  return true;
5584  }
5585  case 2: {
5586  this->handle = value.as_uint32();
5587  return true;
5588  }
5589  case 3: {
5590  this->properties = value.as_uint32();
5591  return true;
5592  }
5593  default:
5594  return false;
5595  }
5596 }
5598  switch (field_id) {
5599  case 4: {
5600  this->descriptors.push_back(value.as_message<BluetoothGATTDescriptor>());
5601  return true;
5602  }
5603  default:
5604  return false;
5605  }
5606 }
5608  for (auto &it : this->uuid) {
5609  buffer.encode_uint64(1, it, true);
5610  }
5611  buffer.encode_uint32(2, this->handle);
5612  buffer.encode_uint32(3, this->properties);
5613  for (auto &it : this->descriptors) {
5614  buffer.encode_message<BluetoothGATTDescriptor>(4, it, true);
5615  }
5616 }
5617 #ifdef HAS_PROTO_MESSAGE_DUMP
5618 void BluetoothGATTCharacteristic::dump_to(std::string &out) const {
5619  __attribute__((unused)) char buffer[64];
5620  out.append("BluetoothGATTCharacteristic {\n");
5621  for (const auto &it : this->uuid) {
5622  out.append(" uuid: ");
5623  sprintf(buffer, "%llu", it);
5624  out.append(buffer);
5625  out.append("\n");
5626  }
5627 
5628  out.append(" handle: ");
5629  sprintf(buffer, "%" PRIu32, this->handle);
5630  out.append(buffer);
5631  out.append("\n");
5632 
5633  out.append(" properties: ");
5634  sprintf(buffer, "%" PRIu32, this->properties);
5635  out.append(buffer);
5636  out.append("\n");
5637 
5638  for (const auto &it : this->descriptors) {
5639  out.append(" descriptors: ");
5640  it.dump_to(out);
5641  out.append("\n");
5642  }
5643  out.append("}");
5644 }
5645 #endif
5646 bool BluetoothGATTService::decode_varint(uint32_t field_id, ProtoVarInt value) {
5647  switch (field_id) {
5648  case 1: {
5649  this->uuid.push_back(value.as_uint64());
5650  return true;
5651  }
5652  case 2: {
5653  this->handle = value.as_uint32();
5654  return true;
5655  }
5656  default:
5657  return false;
5658  }
5659 }
5661  switch (field_id) {
5662  case 3: {
5663  this->characteristics.push_back(value.as_message<BluetoothGATTCharacteristic>());
5664  return true;
5665  }
5666  default:
5667  return false;
5668  }
5669 }
5671  for (auto &it : this->uuid) {
5672  buffer.encode_uint64(1, it, true);
5673  }
5674  buffer.encode_uint32(2, this->handle);
5675  for (auto &it : this->characteristics) {
5676  buffer.encode_message<BluetoothGATTCharacteristic>(3, it, true);
5677  }
5678 }
5679 #ifdef HAS_PROTO_MESSAGE_DUMP
5680 void BluetoothGATTService::dump_to(std::string &out) const {
5681  __attribute__((unused)) char buffer[64];
5682  out.append("BluetoothGATTService {\n");
5683  for (const auto &it : this->uuid) {
5684  out.append(" uuid: ");
5685  sprintf(buffer, "%llu", it);
5686  out.append(buffer);
5687  out.append("\n");
5688  }
5689 
5690  out.append(" handle: ");
5691  sprintf(buffer, "%" PRIu32, this->handle);
5692  out.append(buffer);
5693  out.append("\n");
5694 
5695  for (const auto &it : this->characteristics) {
5696  out.append(" characteristics: ");
5697  it.dump_to(out);
5698  out.append("\n");
5699  }
5700  out.append("}");
5701 }
5702 #endif
5704  switch (field_id) {
5705  case 1: {
5706  this->address = value.as_uint64();
5707  return true;
5708  }
5709  default:
5710  return false;
5711  }
5712 }
5714  switch (field_id) {
5715  case 2: {
5716  this->services.push_back(value.as_message<BluetoothGATTService>());
5717  return true;
5718  }
5719  default:
5720  return false;
5721  }
5722 }
5724  buffer.encode_uint64(1, this->address);
5725  for (auto &it : this->services) {
5726  buffer.encode_message<BluetoothGATTService>(2, it, true);
5727  }
5728 }
5729 #ifdef HAS_PROTO_MESSAGE_DUMP
5730 void BluetoothGATTGetServicesResponse::dump_to(std::string &out) const {
5731  __attribute__((unused)) char buffer[64];
5732  out.append("BluetoothGATTGetServicesResponse {\n");
5733  out.append(" address: ");
5734  sprintf(buffer, "%llu", this->address);
5735  out.append(buffer);
5736  out.append("\n");
5737 
5738  for (const auto &it : this->services) {
5739  out.append(" services: ");
5740  it.dump_to(out);
5741  out.append("\n");
5742  }
5743  out.append("}");
5744 }
5745 #endif
5747  switch (field_id) {
5748  case 1: {
5749  this->address = value.as_uint64();
5750  return true;
5751  }
5752  default:
5753  return false;
5754  }
5755 }
5757  buffer.encode_uint64(1, this->address);
5758 }
5759 #ifdef HAS_PROTO_MESSAGE_DUMP
5761  __attribute__((unused)) char buffer[64];
5762  out.append("BluetoothGATTGetServicesDoneResponse {\n");
5763  out.append(" address: ");
5764  sprintf(buffer, "%llu", this->address);
5765  out.append(buffer);
5766  out.append("\n");
5767  out.append("}");
5768 }
5769 #endif
5771  switch (field_id) {
5772  case 1: {
5773  this->address = value.as_uint64();
5774  return true;
5775  }
5776  case 2: {
5777  this->handle = value.as_uint32();
5778  return true;
5779  }
5780  default:
5781  return false;
5782  }
5783 }
5785  buffer.encode_uint64(1, this->address);
5786  buffer.encode_uint32(2, this->handle);
5787 }