ESPHome  2024.2.1
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  case 12: {
1379  this->supported_preset_modes.push_back(value.as_string());
1380  return true;
1381  }
1382  default:
1383  return false;
1384  }
1385 }
1386 bool ListEntitiesFanResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1387  switch (field_id) {
1388  case 2: {
1389  this->key = value.as_fixed32();
1390  return true;
1391  }
1392  default:
1393  return false;
1394  }
1395 }
1397  buffer.encode_string(1, this->object_id);
1398  buffer.encode_fixed32(2, this->key);
1399  buffer.encode_string(3, this->name);
1400  buffer.encode_string(4, this->unique_id);
1401  buffer.encode_bool(5, this->supports_oscillation);
1402  buffer.encode_bool(6, this->supports_speed);
1403  buffer.encode_bool(7, this->supports_direction);
1404  buffer.encode_int32(8, this->supported_speed_count);
1405  buffer.encode_bool(9, this->disabled_by_default);
1406  buffer.encode_string(10, this->icon);
1407  buffer.encode_enum<enums::EntityCategory>(11, this->entity_category);
1408  for (auto &it : this->supported_preset_modes) {
1409  buffer.encode_string(12, it, true);
1410  }
1411 }
1412 #ifdef HAS_PROTO_MESSAGE_DUMP
1413 void ListEntitiesFanResponse::dump_to(std::string &out) const {
1414  __attribute__((unused)) char buffer[64];
1415  out.append("ListEntitiesFanResponse {\n");
1416  out.append(" object_id: ");
1417  out.append("'").append(this->object_id).append("'");
1418  out.append("\n");
1419 
1420  out.append(" key: ");
1421  sprintf(buffer, "%" PRIu32, this->key);
1422  out.append(buffer);
1423  out.append("\n");
1424 
1425  out.append(" name: ");
1426  out.append("'").append(this->name).append("'");
1427  out.append("\n");
1428 
1429  out.append(" unique_id: ");
1430  out.append("'").append(this->unique_id).append("'");
1431  out.append("\n");
1432 
1433  out.append(" supports_oscillation: ");
1434  out.append(YESNO(this->supports_oscillation));
1435  out.append("\n");
1436 
1437  out.append(" supports_speed: ");
1438  out.append(YESNO(this->supports_speed));
1439  out.append("\n");
1440 
1441  out.append(" supports_direction: ");
1442  out.append(YESNO(this->supports_direction));
1443  out.append("\n");
1444 
1445  out.append(" supported_speed_count: ");
1446  sprintf(buffer, "%" PRId32, this->supported_speed_count);
1447  out.append(buffer);
1448  out.append("\n");
1449 
1450  out.append(" disabled_by_default: ");
1451  out.append(YESNO(this->disabled_by_default));
1452  out.append("\n");
1453 
1454  out.append(" icon: ");
1455  out.append("'").append(this->icon).append("'");
1456  out.append("\n");
1457 
1458  out.append(" entity_category: ");
1459  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1460  out.append("\n");
1461 
1462  for (const auto &it : this->supported_preset_modes) {
1463  out.append(" supported_preset_modes: ");
1464  out.append("'").append(it).append("'");
1465  out.append("\n");
1466  }
1467  out.append("}");
1468 }
1469 #endif
1470 bool FanStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1471  switch (field_id) {
1472  case 2: {
1473  this->state = value.as_bool();
1474  return true;
1475  }
1476  case 3: {
1477  this->oscillating = value.as_bool();
1478  return true;
1479  }
1480  case 4: {
1481  this->speed = value.as_enum<enums::FanSpeed>();
1482  return true;
1483  }
1484  case 5: {
1485  this->direction = value.as_enum<enums::FanDirection>();
1486  return true;
1487  }
1488  case 6: {
1489  this->speed_level = value.as_int32();
1490  return true;
1491  }
1492  default:
1493  return false;
1494  }
1495 }
1497  switch (field_id) {
1498  case 7: {
1499  this->preset_mode = value.as_string();
1500  return true;
1501  }
1502  default:
1503  return false;
1504  }
1505 }
1506 bool FanStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1507  switch (field_id) {
1508  case 1: {
1509  this->key = value.as_fixed32();
1510  return true;
1511  }
1512  default:
1513  return false;
1514  }
1515 }
1517  buffer.encode_fixed32(1, this->key);
1518  buffer.encode_bool(2, this->state);
1519  buffer.encode_bool(3, this->oscillating);
1520  buffer.encode_enum<enums::FanSpeed>(4, this->speed);
1521  buffer.encode_enum<enums::FanDirection>(5, this->direction);
1522  buffer.encode_int32(6, this->speed_level);
1523  buffer.encode_string(7, this->preset_mode);
1524 }
1525 #ifdef HAS_PROTO_MESSAGE_DUMP
1526 void FanStateResponse::dump_to(std::string &out) const {
1527  __attribute__((unused)) char buffer[64];
1528  out.append("FanStateResponse {\n");
1529  out.append(" key: ");
1530  sprintf(buffer, "%" PRIu32, this->key);
1531  out.append(buffer);
1532  out.append("\n");
1533 
1534  out.append(" state: ");
1535  out.append(YESNO(this->state));
1536  out.append("\n");
1537 
1538  out.append(" oscillating: ");
1539  out.append(YESNO(this->oscillating));
1540  out.append("\n");
1541 
1542  out.append(" speed: ");
1543  out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
1544  out.append("\n");
1545 
1546  out.append(" direction: ");
1547  out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
1548  out.append("\n");
1549 
1550  out.append(" speed_level: ");
1551  sprintf(buffer, "%" PRId32, this->speed_level);
1552  out.append(buffer);
1553  out.append("\n");
1554 
1555  out.append(" preset_mode: ");
1556  out.append("'").append(this->preset_mode).append("'");
1557  out.append("\n");
1558  out.append("}");
1559 }
1560 #endif
1561 bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
1562  switch (field_id) {
1563  case 2: {
1564  this->has_state = value.as_bool();
1565  return true;
1566  }
1567  case 3: {
1568  this->state = value.as_bool();
1569  return true;
1570  }
1571  case 4: {
1572  this->has_speed = value.as_bool();
1573  return true;
1574  }
1575  case 5: {
1576  this->speed = value.as_enum<enums::FanSpeed>();
1577  return true;
1578  }
1579  case 6: {
1580  this->has_oscillating = value.as_bool();
1581  return true;
1582  }
1583  case 7: {
1584  this->oscillating = value.as_bool();
1585  return true;
1586  }
1587  case 8: {
1588  this->has_direction = value.as_bool();
1589  return true;
1590  }
1591  case 9: {
1592  this->direction = value.as_enum<enums::FanDirection>();
1593  return true;
1594  }
1595  case 10: {
1596  this->has_speed_level = value.as_bool();
1597  return true;
1598  }
1599  case 11: {
1600  this->speed_level = value.as_int32();
1601  return true;
1602  }
1603  case 12: {
1604  this->has_preset_mode = value.as_bool();
1605  return true;
1606  }
1607  default:
1608  return false;
1609  }
1610 }
1612  switch (field_id) {
1613  case 13: {
1614  this->preset_mode = value.as_string();
1615  return true;
1616  }
1617  default:
1618  return false;
1619  }
1620 }
1621 bool FanCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
1622  switch (field_id) {
1623  case 1: {
1624  this->key = value.as_fixed32();
1625  return true;
1626  }
1627  default:
1628  return false;
1629  }
1630 }
1632  buffer.encode_fixed32(1, this->key);
1633  buffer.encode_bool(2, this->has_state);
1634  buffer.encode_bool(3, this->state);
1635  buffer.encode_bool(4, this->has_speed);
1636  buffer.encode_enum<enums::FanSpeed>(5, this->speed);
1637  buffer.encode_bool(6, this->has_oscillating);
1638  buffer.encode_bool(7, this->oscillating);
1639  buffer.encode_bool(8, this->has_direction);
1640  buffer.encode_enum<enums::FanDirection>(9, this->direction);
1641  buffer.encode_bool(10, this->has_speed_level);
1642  buffer.encode_int32(11, this->speed_level);
1643  buffer.encode_bool(12, this->has_preset_mode);
1644  buffer.encode_string(13, this->preset_mode);
1645 }
1646 #ifdef HAS_PROTO_MESSAGE_DUMP
1647 void FanCommandRequest::dump_to(std::string &out) const {
1648  __attribute__((unused)) char buffer[64];
1649  out.append("FanCommandRequest {\n");
1650  out.append(" key: ");
1651  sprintf(buffer, "%" PRIu32, this->key);
1652  out.append(buffer);
1653  out.append("\n");
1654 
1655  out.append(" has_state: ");
1656  out.append(YESNO(this->has_state));
1657  out.append("\n");
1658 
1659  out.append(" state: ");
1660  out.append(YESNO(this->state));
1661  out.append("\n");
1662 
1663  out.append(" has_speed: ");
1664  out.append(YESNO(this->has_speed));
1665  out.append("\n");
1666 
1667  out.append(" speed: ");
1668  out.append(proto_enum_to_string<enums::FanSpeed>(this->speed));
1669  out.append("\n");
1670 
1671  out.append(" has_oscillating: ");
1672  out.append(YESNO(this->has_oscillating));
1673  out.append("\n");
1674 
1675  out.append(" oscillating: ");
1676  out.append(YESNO(this->oscillating));
1677  out.append("\n");
1678 
1679  out.append(" has_direction: ");
1680  out.append(YESNO(this->has_direction));
1681  out.append("\n");
1682 
1683  out.append(" direction: ");
1684  out.append(proto_enum_to_string<enums::FanDirection>(this->direction));
1685  out.append("\n");
1686 
1687  out.append(" has_speed_level: ");
1688  out.append(YESNO(this->has_speed_level));
1689  out.append("\n");
1690 
1691  out.append(" speed_level: ");
1692  sprintf(buffer, "%" PRId32, this->speed_level);
1693  out.append(buffer);
1694  out.append("\n");
1695 
1696  out.append(" has_preset_mode: ");
1697  out.append(YESNO(this->has_preset_mode));
1698  out.append("\n");
1699 
1700  out.append(" preset_mode: ");
1701  out.append("'").append(this->preset_mode).append("'");
1702  out.append("\n");
1703  out.append("}");
1704 }
1705 #endif
1707  switch (field_id) {
1708  case 12: {
1709  this->supported_color_modes.push_back(value.as_enum<enums::ColorMode>());
1710  return true;
1711  }
1712  case 5: {
1713  this->legacy_supports_brightness = value.as_bool();
1714  return true;
1715  }
1716  case 6: {
1717  this->legacy_supports_rgb = value.as_bool();
1718  return true;
1719  }
1720  case 7: {
1721  this->legacy_supports_white_value = value.as_bool();
1722  return true;
1723  }
1724  case 8: {
1725  this->legacy_supports_color_temperature = value.as_bool();
1726  return true;
1727  }
1728  case 13: {
1729  this->disabled_by_default = value.as_bool();
1730  return true;
1731  }
1732  case 15: {
1733  this->entity_category = value.as_enum<enums::EntityCategory>();
1734  return true;
1735  }
1736  default:
1737  return false;
1738  }
1739 }
1741  switch (field_id) {
1742  case 1: {
1743  this->object_id = value.as_string();
1744  return true;
1745  }
1746  case 3: {
1747  this->name = value.as_string();
1748  return true;
1749  }
1750  case 4: {
1751  this->unique_id = value.as_string();
1752  return true;
1753  }
1754  case 11: {
1755  this->effects.push_back(value.as_string());
1756  return true;
1757  }
1758  case 14: {
1759  this->icon = value.as_string();
1760  return true;
1761  }
1762  default:
1763  return false;
1764  }
1765 }
1766 bool ListEntitiesLightResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1767  switch (field_id) {
1768  case 2: {
1769  this->key = value.as_fixed32();
1770  return true;
1771  }
1772  case 9: {
1773  this->min_mireds = value.as_float();
1774  return true;
1775  }
1776  case 10: {
1777  this->max_mireds = value.as_float();
1778  return true;
1779  }
1780  default:
1781  return false;
1782  }
1783 }
1785  buffer.encode_string(1, this->object_id);
1786  buffer.encode_fixed32(2, this->key);
1787  buffer.encode_string(3, this->name);
1788  buffer.encode_string(4, this->unique_id);
1789  for (auto &it : this->supported_color_modes) {
1790  buffer.encode_enum<enums::ColorMode>(12, it, true);
1791  }
1792  buffer.encode_bool(5, this->legacy_supports_brightness);
1793  buffer.encode_bool(6, this->legacy_supports_rgb);
1794  buffer.encode_bool(7, this->legacy_supports_white_value);
1795  buffer.encode_bool(8, this->legacy_supports_color_temperature);
1796  buffer.encode_float(9, this->min_mireds);
1797  buffer.encode_float(10, this->max_mireds);
1798  for (auto &it : this->effects) {
1799  buffer.encode_string(11, it, true);
1800  }
1801  buffer.encode_bool(13, this->disabled_by_default);
1802  buffer.encode_string(14, this->icon);
1803  buffer.encode_enum<enums::EntityCategory>(15, this->entity_category);
1804 }
1805 #ifdef HAS_PROTO_MESSAGE_DUMP
1806 void ListEntitiesLightResponse::dump_to(std::string &out) const {
1807  __attribute__((unused)) char buffer[64];
1808  out.append("ListEntitiesLightResponse {\n");
1809  out.append(" object_id: ");
1810  out.append("'").append(this->object_id).append("'");
1811  out.append("\n");
1812 
1813  out.append(" key: ");
1814  sprintf(buffer, "%" PRIu32, this->key);
1815  out.append(buffer);
1816  out.append("\n");
1817 
1818  out.append(" name: ");
1819  out.append("'").append(this->name).append("'");
1820  out.append("\n");
1821 
1822  out.append(" unique_id: ");
1823  out.append("'").append(this->unique_id).append("'");
1824  out.append("\n");
1825 
1826  for (const auto &it : this->supported_color_modes) {
1827  out.append(" supported_color_modes: ");
1828  out.append(proto_enum_to_string<enums::ColorMode>(it));
1829  out.append("\n");
1830  }
1831 
1832  out.append(" legacy_supports_brightness: ");
1833  out.append(YESNO(this->legacy_supports_brightness));
1834  out.append("\n");
1835 
1836  out.append(" legacy_supports_rgb: ");
1837  out.append(YESNO(this->legacy_supports_rgb));
1838  out.append("\n");
1839 
1840  out.append(" legacy_supports_white_value: ");
1841  out.append(YESNO(this->legacy_supports_white_value));
1842  out.append("\n");
1843 
1844  out.append(" legacy_supports_color_temperature: ");
1845  out.append(YESNO(this->legacy_supports_color_temperature));
1846  out.append("\n");
1847 
1848  out.append(" min_mireds: ");
1849  sprintf(buffer, "%g", this->min_mireds);
1850  out.append(buffer);
1851  out.append("\n");
1852 
1853  out.append(" max_mireds: ");
1854  sprintf(buffer, "%g", this->max_mireds);
1855  out.append(buffer);
1856  out.append("\n");
1857 
1858  for (const auto &it : this->effects) {
1859  out.append(" effects: ");
1860  out.append("'").append(it).append("'");
1861  out.append("\n");
1862  }
1863 
1864  out.append(" disabled_by_default: ");
1865  out.append(YESNO(this->disabled_by_default));
1866  out.append("\n");
1867 
1868  out.append(" icon: ");
1869  out.append("'").append(this->icon).append("'");
1870  out.append("\n");
1871 
1872  out.append(" entity_category: ");
1873  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
1874  out.append("\n");
1875  out.append("}");
1876 }
1877 #endif
1878 bool LightStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
1879  switch (field_id) {
1880  case 2: {
1881  this->state = value.as_bool();
1882  return true;
1883  }
1884  case 11: {
1885  this->color_mode = value.as_enum<enums::ColorMode>();
1886  return true;
1887  }
1888  default:
1889  return false;
1890  }
1891 }
1893  switch (field_id) {
1894  case 9: {
1895  this->effect = value.as_string();
1896  return true;
1897  }
1898  default:
1899  return false;
1900  }
1901 }
1902 bool LightStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
1903  switch (field_id) {
1904  case 1: {
1905  this->key = value.as_fixed32();
1906  return true;
1907  }
1908  case 3: {
1909  this->brightness = value.as_float();
1910  return true;
1911  }
1912  case 10: {
1913  this->color_brightness = value.as_float();
1914  return true;
1915  }
1916  case 4: {
1917  this->red = value.as_float();
1918  return true;
1919  }
1920  case 5: {
1921  this->green = value.as_float();
1922  return true;
1923  }
1924  case 6: {
1925  this->blue = value.as_float();
1926  return true;
1927  }
1928  case 7: {
1929  this->white = value.as_float();
1930  return true;
1931  }
1932  case 8: {
1933  this->color_temperature = value.as_float();
1934  return true;
1935  }
1936  case 12: {
1937  this->cold_white = value.as_float();
1938  return true;
1939  }
1940  case 13: {
1941  this->warm_white = value.as_float();
1942  return true;
1943  }
1944  default:
1945  return false;
1946  }
1947 }
1949  buffer.encode_fixed32(1, this->key);
1950  buffer.encode_bool(2, this->state);
1951  buffer.encode_float(3, this->brightness);
1952  buffer.encode_enum<enums::ColorMode>(11, this->color_mode);
1953  buffer.encode_float(10, this->color_brightness);
1954  buffer.encode_float(4, this->red);
1955  buffer.encode_float(5, this->green);
1956  buffer.encode_float(6, this->blue);
1957  buffer.encode_float(7, this->white);
1958  buffer.encode_float(8, this->color_temperature);
1959  buffer.encode_float(12, this->cold_white);
1960  buffer.encode_float(13, this->warm_white);
1961  buffer.encode_string(9, this->effect);
1962 }
1963 #ifdef HAS_PROTO_MESSAGE_DUMP
1964 void LightStateResponse::dump_to(std::string &out) const {
1965  __attribute__((unused)) char buffer[64];
1966  out.append("LightStateResponse {\n");
1967  out.append(" key: ");
1968  sprintf(buffer, "%" PRIu32, this->key);
1969  out.append(buffer);
1970  out.append("\n");
1971 
1972  out.append(" state: ");
1973  out.append(YESNO(this->state));
1974  out.append("\n");
1975 
1976  out.append(" brightness: ");
1977  sprintf(buffer, "%g", this->brightness);
1978  out.append(buffer);
1979  out.append("\n");
1980 
1981  out.append(" color_mode: ");
1982  out.append(proto_enum_to_string<enums::ColorMode>(this->color_mode));
1983  out.append("\n");
1984 
1985  out.append(" color_brightness: ");
1986  sprintf(buffer, "%g", this->color_brightness);
1987  out.append(buffer);
1988  out.append("\n");
1989 
1990  out.append(" red: ");
1991  sprintf(buffer, "%g", this->red);
1992  out.append(buffer);
1993  out.append("\n");
1994 
1995  out.append(" green: ");
1996  sprintf(buffer, "%g", this->green);
1997  out.append(buffer);
1998  out.append("\n");
1999 
2000  out.append(" blue: ");
2001  sprintf(buffer, "%g", this->blue);
2002  out.append(buffer);
2003  out.append("\n");
2004 
2005  out.append(" white: ");
2006  sprintf(buffer, "%g", this->white);
2007  out.append(buffer);
2008  out.append("\n");
2009 
2010  out.append(" color_temperature: ");
2011  sprintf(buffer, "%g", this->color_temperature);
2012  out.append(buffer);
2013  out.append("\n");
2014 
2015  out.append(" cold_white: ");
2016  sprintf(buffer, "%g", this->cold_white);
2017  out.append(buffer);
2018  out.append("\n");
2019 
2020  out.append(" warm_white: ");
2021  sprintf(buffer, "%g", this->warm_white);
2022  out.append(buffer);
2023  out.append("\n");
2024 
2025  out.append(" effect: ");
2026  out.append("'").append(this->effect).append("'");
2027  out.append("\n");
2028  out.append("}");
2029 }
2030 #endif
2031 bool LightCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2032  switch (field_id) {
2033  case 2: {
2034  this->has_state = value.as_bool();
2035  return true;
2036  }
2037  case 3: {
2038  this->state = value.as_bool();
2039  return true;
2040  }
2041  case 4: {
2042  this->has_brightness = value.as_bool();
2043  return true;
2044  }
2045  case 22: {
2046  this->has_color_mode = value.as_bool();
2047  return true;
2048  }
2049  case 23: {
2050  this->color_mode = value.as_enum<enums::ColorMode>();
2051  return true;
2052  }
2053  case 20: {
2054  this->has_color_brightness = value.as_bool();
2055  return true;
2056  }
2057  case 6: {
2058  this->has_rgb = value.as_bool();
2059  return true;
2060  }
2061  case 10: {
2062  this->has_white = value.as_bool();
2063  return true;
2064  }
2065  case 12: {
2066  this->has_color_temperature = value.as_bool();
2067  return true;
2068  }
2069  case 24: {
2070  this->has_cold_white = value.as_bool();
2071  return true;
2072  }
2073  case 26: {
2074  this->has_warm_white = value.as_bool();
2075  return true;
2076  }
2077  case 14: {
2078  this->has_transition_length = value.as_bool();
2079  return true;
2080  }
2081  case 15: {
2082  this->transition_length = value.as_uint32();
2083  return true;
2084  }
2085  case 16: {
2086  this->has_flash_length = value.as_bool();
2087  return true;
2088  }
2089  case 17: {
2090  this->flash_length = value.as_uint32();
2091  return true;
2092  }
2093  case 18: {
2094  this->has_effect = value.as_bool();
2095  return true;
2096  }
2097  default:
2098  return false;
2099  }
2100 }
2102  switch (field_id) {
2103  case 19: {
2104  this->effect = value.as_string();
2105  return true;
2106  }
2107  default:
2108  return false;
2109  }
2110 }
2111 bool LightCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2112  switch (field_id) {
2113  case 1: {
2114  this->key = value.as_fixed32();
2115  return true;
2116  }
2117  case 5: {
2118  this->brightness = value.as_float();
2119  return true;
2120  }
2121  case 21: {
2122  this->color_brightness = value.as_float();
2123  return true;
2124  }
2125  case 7: {
2126  this->red = value.as_float();
2127  return true;
2128  }
2129  case 8: {
2130  this->green = value.as_float();
2131  return true;
2132  }
2133  case 9: {
2134  this->blue = value.as_float();
2135  return true;
2136  }
2137  case 11: {
2138  this->white = value.as_float();
2139  return true;
2140  }
2141  case 13: {
2142  this->color_temperature = value.as_float();
2143  return true;
2144  }
2145  case 25: {
2146  this->cold_white = value.as_float();
2147  return true;
2148  }
2149  case 27: {
2150  this->warm_white = value.as_float();
2151  return true;
2152  }
2153  default:
2154  return false;
2155  }
2156 }
2158  buffer.encode_fixed32(1, this->key);
2159  buffer.encode_bool(2, this->has_state);
2160  buffer.encode_bool(3, this->state);
2161  buffer.encode_bool(4, this->has_brightness);
2162  buffer.encode_float(5, this->brightness);
2163  buffer.encode_bool(22, this->has_color_mode);
2164  buffer.encode_enum<enums::ColorMode>(23, this->color_mode);
2165  buffer.encode_bool(20, this->has_color_brightness);
2166  buffer.encode_float(21, this->color_brightness);
2167  buffer.encode_bool(6, this->has_rgb);
2168  buffer.encode_float(7, this->red);
2169  buffer.encode_float(8, this->green);
2170  buffer.encode_float(9, this->blue);
2171  buffer.encode_bool(10, this->has_white);
2172  buffer.encode_float(11, this->white);
2173  buffer.encode_bool(12, this->has_color_temperature);
2174  buffer.encode_float(13, this->color_temperature);
2175  buffer.encode_bool(24, this->has_cold_white);
2176  buffer.encode_float(25, this->cold_white);
2177  buffer.encode_bool(26, this->has_warm_white);
2178  buffer.encode_float(27, this->warm_white);
2179  buffer.encode_bool(14, this->has_transition_length);
2180  buffer.encode_uint32(15, this->transition_length);
2181  buffer.encode_bool(16, this->has_flash_length);
2182  buffer.encode_uint32(17, this->flash_length);
2183  buffer.encode_bool(18, this->has_effect);
2184  buffer.encode_string(19, this->effect);
2185 }
2186 #ifdef HAS_PROTO_MESSAGE_DUMP
2187 void LightCommandRequest::dump_to(std::string &out) const {
2188  __attribute__((unused)) char buffer[64];
2189  out.append("LightCommandRequest {\n");
2190  out.append(" key: ");
2191  sprintf(buffer, "%" PRIu32, this->key);
2192  out.append(buffer);
2193  out.append("\n");
2194 
2195  out.append(" has_state: ");
2196  out.append(YESNO(this->has_state));
2197  out.append("\n");
2198 
2199  out.append(" state: ");
2200  out.append(YESNO(this->state));
2201  out.append("\n");
2202 
2203  out.append(" has_brightness: ");
2204  out.append(YESNO(this->has_brightness));
2205  out.append("\n");
2206 
2207  out.append(" brightness: ");
2208  sprintf(buffer, "%g", this->brightness);
2209  out.append(buffer);
2210  out.append("\n");
2211 
2212  out.append(" has_color_mode: ");
2213  out.append(YESNO(this->has_color_mode));
2214  out.append("\n");
2215 
2216  out.append(" color_mode: ");
2217  out.append(proto_enum_to_string<enums::ColorMode>(this->color_mode));
2218  out.append("\n");
2219 
2220  out.append(" has_color_brightness: ");
2221  out.append(YESNO(this->has_color_brightness));
2222  out.append("\n");
2223 
2224  out.append(" color_brightness: ");
2225  sprintf(buffer, "%g", this->color_brightness);
2226  out.append(buffer);
2227  out.append("\n");
2228 
2229  out.append(" has_rgb: ");
2230  out.append(YESNO(this->has_rgb));
2231  out.append("\n");
2232 
2233  out.append(" red: ");
2234  sprintf(buffer, "%g", this->red);
2235  out.append(buffer);
2236  out.append("\n");
2237 
2238  out.append(" green: ");
2239  sprintf(buffer, "%g", this->green);
2240  out.append(buffer);
2241  out.append("\n");
2242 
2243  out.append(" blue: ");
2244  sprintf(buffer, "%g", this->blue);
2245  out.append(buffer);
2246  out.append("\n");
2247 
2248  out.append(" has_white: ");
2249  out.append(YESNO(this->has_white));
2250  out.append("\n");
2251 
2252  out.append(" white: ");
2253  sprintf(buffer, "%g", this->white);
2254  out.append(buffer);
2255  out.append("\n");
2256 
2257  out.append(" has_color_temperature: ");
2258  out.append(YESNO(this->has_color_temperature));
2259  out.append("\n");
2260 
2261  out.append(" color_temperature: ");
2262  sprintf(buffer, "%g", this->color_temperature);
2263  out.append(buffer);
2264  out.append("\n");
2265 
2266  out.append(" has_cold_white: ");
2267  out.append(YESNO(this->has_cold_white));
2268  out.append("\n");
2269 
2270  out.append(" cold_white: ");
2271  sprintf(buffer, "%g", this->cold_white);
2272  out.append(buffer);
2273  out.append("\n");
2274 
2275  out.append(" has_warm_white: ");
2276  out.append(YESNO(this->has_warm_white));
2277  out.append("\n");
2278 
2279  out.append(" warm_white: ");
2280  sprintf(buffer, "%g", this->warm_white);
2281  out.append(buffer);
2282  out.append("\n");
2283 
2284  out.append(" has_transition_length: ");
2285  out.append(YESNO(this->has_transition_length));
2286  out.append("\n");
2287 
2288  out.append(" transition_length: ");
2289  sprintf(buffer, "%" PRIu32, this->transition_length);
2290  out.append(buffer);
2291  out.append("\n");
2292 
2293  out.append(" has_flash_length: ");
2294  out.append(YESNO(this->has_flash_length));
2295  out.append("\n");
2296 
2297  out.append(" flash_length: ");
2298  sprintf(buffer, "%" PRIu32, this->flash_length);
2299  out.append(buffer);
2300  out.append("\n");
2301 
2302  out.append(" has_effect: ");
2303  out.append(YESNO(this->has_effect));
2304  out.append("\n");
2305 
2306  out.append(" effect: ");
2307  out.append("'").append(this->effect).append("'");
2308  out.append("\n");
2309  out.append("}");
2310 }
2311 #endif
2313  switch (field_id) {
2314  case 7: {
2315  this->accuracy_decimals = value.as_int32();
2316  return true;
2317  }
2318  case 8: {
2319  this->force_update = value.as_bool();
2320  return true;
2321  }
2322  case 10: {
2323  this->state_class = value.as_enum<enums::SensorStateClass>();
2324  return true;
2325  }
2326  case 11: {
2327  this->legacy_last_reset_type = value.as_enum<enums::SensorLastResetType>();
2328  return true;
2329  }
2330  case 12: {
2331  this->disabled_by_default = value.as_bool();
2332  return true;
2333  }
2334  case 13: {
2335  this->entity_category = value.as_enum<enums::EntityCategory>();
2336  return true;
2337  }
2338  default:
2339  return false;
2340  }
2341 }
2343  switch (field_id) {
2344  case 1: {
2345  this->object_id = value.as_string();
2346  return true;
2347  }
2348  case 3: {
2349  this->name = value.as_string();
2350  return true;
2351  }
2352  case 4: {
2353  this->unique_id = value.as_string();
2354  return true;
2355  }
2356  case 5: {
2357  this->icon = value.as_string();
2358  return true;
2359  }
2360  case 6: {
2361  this->unit_of_measurement = value.as_string();
2362  return true;
2363  }
2364  case 9: {
2365  this->device_class = value.as_string();
2366  return true;
2367  }
2368  default:
2369  return false;
2370  }
2371 }
2373  switch (field_id) {
2374  case 2: {
2375  this->key = value.as_fixed32();
2376  return true;
2377  }
2378  default:
2379  return false;
2380  }
2381 }
2383  buffer.encode_string(1, this->object_id);
2384  buffer.encode_fixed32(2, this->key);
2385  buffer.encode_string(3, this->name);
2386  buffer.encode_string(4, this->unique_id);
2387  buffer.encode_string(5, this->icon);
2388  buffer.encode_string(6, this->unit_of_measurement);
2389  buffer.encode_int32(7, this->accuracy_decimals);
2390  buffer.encode_bool(8, this->force_update);
2391  buffer.encode_string(9, this->device_class);
2392  buffer.encode_enum<enums::SensorStateClass>(10, this->state_class);
2393  buffer.encode_enum<enums::SensorLastResetType>(11, this->legacy_last_reset_type);
2394  buffer.encode_bool(12, this->disabled_by_default);
2395  buffer.encode_enum<enums::EntityCategory>(13, this->entity_category);
2396 }
2397 #ifdef HAS_PROTO_MESSAGE_DUMP
2398 void ListEntitiesSensorResponse::dump_to(std::string &out) const {
2399  __attribute__((unused)) char buffer[64];
2400  out.append("ListEntitiesSensorResponse {\n");
2401  out.append(" object_id: ");
2402  out.append("'").append(this->object_id).append("'");
2403  out.append("\n");
2404 
2405  out.append(" key: ");
2406  sprintf(buffer, "%" PRIu32, this->key);
2407  out.append(buffer);
2408  out.append("\n");
2409 
2410  out.append(" name: ");
2411  out.append("'").append(this->name).append("'");
2412  out.append("\n");
2413 
2414  out.append(" unique_id: ");
2415  out.append("'").append(this->unique_id).append("'");
2416  out.append("\n");
2417 
2418  out.append(" icon: ");
2419  out.append("'").append(this->icon).append("'");
2420  out.append("\n");
2421 
2422  out.append(" unit_of_measurement: ");
2423  out.append("'").append(this->unit_of_measurement).append("'");
2424  out.append("\n");
2425 
2426  out.append(" accuracy_decimals: ");
2427  sprintf(buffer, "%" PRId32, this->accuracy_decimals);
2428  out.append(buffer);
2429  out.append("\n");
2430 
2431  out.append(" force_update: ");
2432  out.append(YESNO(this->force_update));
2433  out.append("\n");
2434 
2435  out.append(" device_class: ");
2436  out.append("'").append(this->device_class).append("'");
2437  out.append("\n");
2438 
2439  out.append(" state_class: ");
2440  out.append(proto_enum_to_string<enums::SensorStateClass>(this->state_class));
2441  out.append("\n");
2442 
2443  out.append(" legacy_last_reset_type: ");
2444  out.append(proto_enum_to_string<enums::SensorLastResetType>(this->legacy_last_reset_type));
2445  out.append("\n");
2446 
2447  out.append(" disabled_by_default: ");
2448  out.append(YESNO(this->disabled_by_default));
2449  out.append("\n");
2450 
2451  out.append(" entity_category: ");
2452  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2453  out.append("\n");
2454  out.append("}");
2455 }
2456 #endif
2457 bool SensorStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2458  switch (field_id) {
2459  case 3: {
2460  this->missing_state = value.as_bool();
2461  return true;
2462  }
2463  default:
2464  return false;
2465  }
2466 }
2467 bool SensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2468  switch (field_id) {
2469  case 1: {
2470  this->key = value.as_fixed32();
2471  return true;
2472  }
2473  case 2: {
2474  this->state = value.as_float();
2475  return true;
2476  }
2477  default:
2478  return false;
2479  }
2480 }
2482  buffer.encode_fixed32(1, this->key);
2483  buffer.encode_float(2, this->state);
2484  buffer.encode_bool(3, this->missing_state);
2485 }
2486 #ifdef HAS_PROTO_MESSAGE_DUMP
2487 void SensorStateResponse::dump_to(std::string &out) const {
2488  __attribute__((unused)) char buffer[64];
2489  out.append("SensorStateResponse {\n");
2490  out.append(" key: ");
2491  sprintf(buffer, "%" PRIu32, this->key);
2492  out.append(buffer);
2493  out.append("\n");
2494 
2495  out.append(" state: ");
2496  sprintf(buffer, "%g", this->state);
2497  out.append(buffer);
2498  out.append("\n");
2499 
2500  out.append(" missing_state: ");
2501  out.append(YESNO(this->missing_state));
2502  out.append("\n");
2503  out.append("}");
2504 }
2505 #endif
2507  switch (field_id) {
2508  case 6: {
2509  this->assumed_state = value.as_bool();
2510  return true;
2511  }
2512  case 7: {
2513  this->disabled_by_default = value.as_bool();
2514  return true;
2515  }
2516  case 8: {
2517  this->entity_category = value.as_enum<enums::EntityCategory>();
2518  return true;
2519  }
2520  default:
2521  return false;
2522  }
2523 }
2525  switch (field_id) {
2526  case 1: {
2527  this->object_id = value.as_string();
2528  return true;
2529  }
2530  case 3: {
2531  this->name = value.as_string();
2532  return true;
2533  }
2534  case 4: {
2535  this->unique_id = value.as_string();
2536  return true;
2537  }
2538  case 5: {
2539  this->icon = value.as_string();
2540  return true;
2541  }
2542  case 9: {
2543  this->device_class = value.as_string();
2544  return true;
2545  }
2546  default:
2547  return false;
2548  }
2549 }
2551  switch (field_id) {
2552  case 2: {
2553  this->key = value.as_fixed32();
2554  return true;
2555  }
2556  default:
2557  return false;
2558  }
2559 }
2561  buffer.encode_string(1, this->object_id);
2562  buffer.encode_fixed32(2, this->key);
2563  buffer.encode_string(3, this->name);
2564  buffer.encode_string(4, this->unique_id);
2565  buffer.encode_string(5, this->icon);
2566  buffer.encode_bool(6, this->assumed_state);
2567  buffer.encode_bool(7, this->disabled_by_default);
2568  buffer.encode_enum<enums::EntityCategory>(8, this->entity_category);
2569  buffer.encode_string(9, this->device_class);
2570 }
2571 #ifdef HAS_PROTO_MESSAGE_DUMP
2572 void ListEntitiesSwitchResponse::dump_to(std::string &out) const {
2573  __attribute__((unused)) char buffer[64];
2574  out.append("ListEntitiesSwitchResponse {\n");
2575  out.append(" object_id: ");
2576  out.append("'").append(this->object_id).append("'");
2577  out.append("\n");
2578 
2579  out.append(" key: ");
2580  sprintf(buffer, "%" PRIu32, this->key);
2581  out.append(buffer);
2582  out.append("\n");
2583 
2584  out.append(" name: ");
2585  out.append("'").append(this->name).append("'");
2586  out.append("\n");
2587 
2588  out.append(" unique_id: ");
2589  out.append("'").append(this->unique_id).append("'");
2590  out.append("\n");
2591 
2592  out.append(" icon: ");
2593  out.append("'").append(this->icon).append("'");
2594  out.append("\n");
2595 
2596  out.append(" assumed_state: ");
2597  out.append(YESNO(this->assumed_state));
2598  out.append("\n");
2599 
2600  out.append(" disabled_by_default: ");
2601  out.append(YESNO(this->disabled_by_default));
2602  out.append("\n");
2603 
2604  out.append(" entity_category: ");
2605  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2606  out.append("\n");
2607 
2608  out.append(" device_class: ");
2609  out.append("'").append(this->device_class).append("'");
2610  out.append("\n");
2611  out.append("}");
2612 }
2613 #endif
2614 bool SwitchStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2615  switch (field_id) {
2616  case 2: {
2617  this->state = value.as_bool();
2618  return true;
2619  }
2620  default:
2621  return false;
2622  }
2623 }
2624 bool SwitchStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2625  switch (field_id) {
2626  case 1: {
2627  this->key = value.as_fixed32();
2628  return true;
2629  }
2630  default:
2631  return false;
2632  }
2633 }
2635  buffer.encode_fixed32(1, this->key);
2636  buffer.encode_bool(2, this->state);
2637 }
2638 #ifdef HAS_PROTO_MESSAGE_DUMP
2639 void SwitchStateResponse::dump_to(std::string &out) const {
2640  __attribute__((unused)) char buffer[64];
2641  out.append("SwitchStateResponse {\n");
2642  out.append(" key: ");
2643  sprintf(buffer, "%" PRIu32, this->key);
2644  out.append(buffer);
2645  out.append("\n");
2646 
2647  out.append(" state: ");
2648  out.append(YESNO(this->state));
2649  out.append("\n");
2650  out.append("}");
2651 }
2652 #endif
2653 bool SwitchCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2654  switch (field_id) {
2655  case 2: {
2656  this->state = value.as_bool();
2657  return true;
2658  }
2659  default:
2660  return false;
2661  }
2662 }
2663 bool SwitchCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
2664  switch (field_id) {
2665  case 1: {
2666  this->key = value.as_fixed32();
2667  return true;
2668  }
2669  default:
2670  return false;
2671  }
2672 }
2674  buffer.encode_fixed32(1, this->key);
2675  buffer.encode_bool(2, this->state);
2676 }
2677 #ifdef HAS_PROTO_MESSAGE_DUMP
2678 void SwitchCommandRequest::dump_to(std::string &out) const {
2679  __attribute__((unused)) char buffer[64];
2680  out.append("SwitchCommandRequest {\n");
2681  out.append(" key: ");
2682  sprintf(buffer, "%" PRIu32, this->key);
2683  out.append(buffer);
2684  out.append("\n");
2685 
2686  out.append(" state: ");
2687  out.append(YESNO(this->state));
2688  out.append("\n");
2689  out.append("}");
2690 }
2691 #endif
2693  switch (field_id) {
2694  case 6: {
2695  this->disabled_by_default = value.as_bool();
2696  return true;
2697  }
2698  case 7: {
2699  this->entity_category = value.as_enum<enums::EntityCategory>();
2700  return true;
2701  }
2702  default:
2703  return false;
2704  }
2705 }
2707  switch (field_id) {
2708  case 1: {
2709  this->object_id = value.as_string();
2710  return true;
2711  }
2712  case 3: {
2713  this->name = value.as_string();
2714  return true;
2715  }
2716  case 4: {
2717  this->unique_id = value.as_string();
2718  return true;
2719  }
2720  case 5: {
2721  this->icon = value.as_string();
2722  return true;
2723  }
2724  default:
2725  return false;
2726  }
2727 }
2729  switch (field_id) {
2730  case 2: {
2731  this->key = value.as_fixed32();
2732  return true;
2733  }
2734  default:
2735  return false;
2736  }
2737 }
2739  buffer.encode_string(1, this->object_id);
2740  buffer.encode_fixed32(2, this->key);
2741  buffer.encode_string(3, this->name);
2742  buffer.encode_string(4, this->unique_id);
2743  buffer.encode_string(5, this->icon);
2744  buffer.encode_bool(6, this->disabled_by_default);
2745  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
2746 }
2747 #ifdef HAS_PROTO_MESSAGE_DUMP
2748 void ListEntitiesTextSensorResponse::dump_to(std::string &out) const {
2749  __attribute__((unused)) char buffer[64];
2750  out.append("ListEntitiesTextSensorResponse {\n");
2751  out.append(" object_id: ");
2752  out.append("'").append(this->object_id).append("'");
2753  out.append("\n");
2754 
2755  out.append(" key: ");
2756  sprintf(buffer, "%" PRIu32, this->key);
2757  out.append(buffer);
2758  out.append("\n");
2759 
2760  out.append(" name: ");
2761  out.append("'").append(this->name).append("'");
2762  out.append("\n");
2763 
2764  out.append(" unique_id: ");
2765  out.append("'").append(this->unique_id).append("'");
2766  out.append("\n");
2767 
2768  out.append(" icon: ");
2769  out.append("'").append(this->icon).append("'");
2770  out.append("\n");
2771 
2772  out.append(" disabled_by_default: ");
2773  out.append(YESNO(this->disabled_by_default));
2774  out.append("\n");
2775 
2776  out.append(" entity_category: ");
2777  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
2778  out.append("\n");
2779  out.append("}");
2780 }
2781 #endif
2782 bool TextSensorStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2783  switch (field_id) {
2784  case 3: {
2785  this->missing_state = value.as_bool();
2786  return true;
2787  }
2788  default:
2789  return false;
2790  }
2791 }
2793  switch (field_id) {
2794  case 2: {
2795  this->state = value.as_string();
2796  return true;
2797  }
2798  default:
2799  return false;
2800  }
2801 }
2802 bool TextSensorStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
2803  switch (field_id) {
2804  case 1: {
2805  this->key = value.as_fixed32();
2806  return true;
2807  }
2808  default:
2809  return false;
2810  }
2811 }
2813  buffer.encode_fixed32(1, this->key);
2814  buffer.encode_string(2, this->state);
2815  buffer.encode_bool(3, this->missing_state);
2816 }
2817 #ifdef HAS_PROTO_MESSAGE_DUMP
2818 void TextSensorStateResponse::dump_to(std::string &out) const {
2819  __attribute__((unused)) char buffer[64];
2820  out.append("TextSensorStateResponse {\n");
2821  out.append(" key: ");
2822  sprintf(buffer, "%" PRIu32, this->key);
2823  out.append(buffer);
2824  out.append("\n");
2825 
2826  out.append(" state: ");
2827  out.append("'").append(this->state).append("'");
2828  out.append("\n");
2829 
2830  out.append(" missing_state: ");
2831  out.append(YESNO(this->missing_state));
2832  out.append("\n");
2833  out.append("}");
2834 }
2835 #endif
2836 bool SubscribeLogsRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
2837  switch (field_id) {
2838  case 1: {
2839  this->level = value.as_enum<enums::LogLevel>();
2840  return true;
2841  }
2842  case 2: {
2843  this->dump_config = value.as_bool();
2844  return true;
2845  }
2846  default:
2847  return false;
2848  }
2849 }
2851  buffer.encode_enum<enums::LogLevel>(1, this->level);
2852  buffer.encode_bool(2, this->dump_config);
2853 }
2854 #ifdef HAS_PROTO_MESSAGE_DUMP
2855 void SubscribeLogsRequest::dump_to(std::string &out) const {
2856  __attribute__((unused)) char buffer[64];
2857  out.append("SubscribeLogsRequest {\n");
2858  out.append(" level: ");
2859  out.append(proto_enum_to_string<enums::LogLevel>(this->level));
2860  out.append("\n");
2861 
2862  out.append(" dump_config: ");
2863  out.append(YESNO(this->dump_config));
2864  out.append("\n");
2865  out.append("}");
2866 }
2867 #endif
2868 bool SubscribeLogsResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
2869  switch (field_id) {
2870  case 1: {
2871  this->level = value.as_enum<enums::LogLevel>();
2872  return true;
2873  }
2874  case 4: {
2875  this->send_failed = value.as_bool();
2876  return true;
2877  }
2878  default:
2879  return false;
2880  }
2881 }
2883  switch (field_id) {
2884  case 3: {
2885  this->message = value.as_string();
2886  return true;
2887  }
2888  default:
2889  return false;
2890  }
2891 }
2893  buffer.encode_enum<enums::LogLevel>(1, this->level);
2894  buffer.encode_string(3, this->message);
2895  buffer.encode_bool(4, this->send_failed);
2896 }
2897 #ifdef HAS_PROTO_MESSAGE_DUMP
2898 void SubscribeLogsResponse::dump_to(std::string &out) const {
2899  __attribute__((unused)) char buffer[64];
2900  out.append("SubscribeLogsResponse {\n");
2901  out.append(" level: ");
2902  out.append(proto_enum_to_string<enums::LogLevel>(this->level));
2903  out.append("\n");
2904 
2905  out.append(" message: ");
2906  out.append("'").append(this->message).append("'");
2907  out.append("\n");
2908 
2909  out.append(" send_failed: ");
2910  out.append(YESNO(this->send_failed));
2911  out.append("\n");
2912  out.append("}");
2913 }
2914 #endif
2916 #ifdef HAS_PROTO_MESSAGE_DUMP
2918  out.append("SubscribeHomeassistantServicesRequest {}");
2919 }
2920 #endif
2922  switch (field_id) {
2923  case 1: {
2924  this->key = value.as_string();
2925  return true;
2926  }
2927  case 2: {
2928  this->value = value.as_string();
2929  return true;
2930  }
2931  default:
2932  return false;
2933  }
2934 }
2936  buffer.encode_string(1, this->key);
2937  buffer.encode_string(2, this->value);
2938 }
2939 #ifdef HAS_PROTO_MESSAGE_DUMP
2940 void HomeassistantServiceMap::dump_to(std::string &out) const {
2941  __attribute__((unused)) char buffer[64];
2942  out.append("HomeassistantServiceMap {\n");
2943  out.append(" key: ");
2944  out.append("'").append(this->key).append("'");
2945  out.append("\n");
2946 
2947  out.append(" value: ");
2948  out.append("'").append(this->value).append("'");
2949  out.append("\n");
2950  out.append("}");
2951 }
2952 #endif
2954  switch (field_id) {
2955  case 5: {
2956  this->is_event = value.as_bool();
2957  return true;
2958  }
2959  default:
2960  return false;
2961  }
2962 }
2964  switch (field_id) {
2965  case 1: {
2966  this->service = value.as_string();
2967  return true;
2968  }
2969  case 2: {
2970  this->data.push_back(value.as_message<HomeassistantServiceMap>());
2971  return true;
2972  }
2973  case 3: {
2974  this->data_template.push_back(value.as_message<HomeassistantServiceMap>());
2975  return true;
2976  }
2977  case 4: {
2978  this->variables.push_back(value.as_message<HomeassistantServiceMap>());
2979  return true;
2980  }
2981  default:
2982  return false;
2983  }
2984 }
2986  buffer.encode_string(1, this->service);
2987  for (auto &it : this->data) {
2988  buffer.encode_message<HomeassistantServiceMap>(2, it, true);
2989  }
2990  for (auto &it : this->data_template) {
2991  buffer.encode_message<HomeassistantServiceMap>(3, it, true);
2992  }
2993  for (auto &it : this->variables) {
2994  buffer.encode_message<HomeassistantServiceMap>(4, it, true);
2995  }
2996  buffer.encode_bool(5, this->is_event);
2997 }
2998 #ifdef HAS_PROTO_MESSAGE_DUMP
2999 void HomeassistantServiceResponse::dump_to(std::string &out) const {
3000  __attribute__((unused)) char buffer[64];
3001  out.append("HomeassistantServiceResponse {\n");
3002  out.append(" service: ");
3003  out.append("'").append(this->service).append("'");
3004  out.append("\n");
3005 
3006  for (const auto &it : this->data) {
3007  out.append(" data: ");
3008  it.dump_to(out);
3009  out.append("\n");
3010  }
3011 
3012  for (const auto &it : this->data_template) {
3013  out.append(" data_template: ");
3014  it.dump_to(out);
3015  out.append("\n");
3016  }
3017 
3018  for (const auto &it : this->variables) {
3019  out.append(" variables: ");
3020  it.dump_to(out);
3021  out.append("\n");
3022  }
3023 
3024  out.append(" is_event: ");
3025  out.append(YESNO(this->is_event));
3026  out.append("\n");
3027  out.append("}");
3028 }
3029 #endif
3031 #ifdef HAS_PROTO_MESSAGE_DUMP
3032 void SubscribeHomeAssistantStatesRequest::dump_to(std::string &out) const {
3033  out.append("SubscribeHomeAssistantStatesRequest {}");
3034 }
3035 #endif
3037  switch (field_id) {
3038  case 1: {
3039  this->entity_id = value.as_string();
3040  return true;
3041  }
3042  case 2: {
3043  this->attribute = value.as_string();
3044  return true;
3045  }
3046  default:
3047  return false;
3048  }
3049 }
3051  buffer.encode_string(1, this->entity_id);
3052  buffer.encode_string(2, this->attribute);
3053 }
3054 #ifdef HAS_PROTO_MESSAGE_DUMP
3055 void SubscribeHomeAssistantStateResponse::dump_to(std::string &out) const {
3056  __attribute__((unused)) char buffer[64];
3057  out.append("SubscribeHomeAssistantStateResponse {\n");
3058  out.append(" entity_id: ");
3059  out.append("'").append(this->entity_id).append("'");
3060  out.append("\n");
3061 
3062  out.append(" attribute: ");
3063  out.append("'").append(this->attribute).append("'");
3064  out.append("\n");
3065  out.append("}");
3066 }
3067 #endif
3069  switch (field_id) {
3070  case 1: {
3071  this->entity_id = value.as_string();
3072  return true;
3073  }
3074  case 2: {
3075  this->state = value.as_string();
3076  return true;
3077  }
3078  case 3: {
3079  this->attribute = value.as_string();
3080  return true;
3081  }
3082  default:
3083  return false;
3084  }
3085 }
3087  buffer.encode_string(1, this->entity_id);
3088  buffer.encode_string(2, this->state);
3089  buffer.encode_string(3, this->attribute);
3090 }
3091 #ifdef HAS_PROTO_MESSAGE_DUMP
3092 void HomeAssistantStateResponse::dump_to(std::string &out) const {
3093  __attribute__((unused)) char buffer[64];
3094  out.append("HomeAssistantStateResponse {\n");
3095  out.append(" entity_id: ");
3096  out.append("'").append(this->entity_id).append("'");
3097  out.append("\n");
3098 
3099  out.append(" state: ");
3100  out.append("'").append(this->state).append("'");
3101  out.append("\n");
3102 
3103  out.append(" attribute: ");
3104  out.append("'").append(this->attribute).append("'");
3105  out.append("\n");
3106  out.append("}");
3107 }
3108 #endif
3110 #ifdef HAS_PROTO_MESSAGE_DUMP
3111 void GetTimeRequest::dump_to(std::string &out) const { out.append("GetTimeRequest {}"); }
3112 #endif
3113 bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3114  switch (field_id) {
3115  case 1: {
3116  this->epoch_seconds = value.as_fixed32();
3117  return true;
3118  }
3119  default:
3120  return false;
3121  }
3122 }
3123 void GetTimeResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->epoch_seconds); }
3124 #ifdef HAS_PROTO_MESSAGE_DUMP
3125 void GetTimeResponse::dump_to(std::string &out) const {
3126  __attribute__((unused)) char buffer[64];
3127  out.append("GetTimeResponse {\n");
3128  out.append(" epoch_seconds: ");
3129  sprintf(buffer, "%" PRIu32, this->epoch_seconds);
3130  out.append(buffer);
3131  out.append("\n");
3132  out.append("}");
3133 }
3134 #endif
3136  switch (field_id) {
3137  case 2: {
3138  this->type = value.as_enum<enums::ServiceArgType>();
3139  return true;
3140  }
3141  default:
3142  return false;
3143  }
3144 }
3146  switch (field_id) {
3147  case 1: {
3148  this->name = value.as_string();
3149  return true;
3150  }
3151  default:
3152  return false;
3153  }
3154 }
3156  buffer.encode_string(1, this->name);
3157  buffer.encode_enum<enums::ServiceArgType>(2, this->type);
3158 }
3159 #ifdef HAS_PROTO_MESSAGE_DUMP
3160 void ListEntitiesServicesArgument::dump_to(std::string &out) const {
3161  __attribute__((unused)) char buffer[64];
3162  out.append("ListEntitiesServicesArgument {\n");
3163  out.append(" name: ");
3164  out.append("'").append(this->name).append("'");
3165  out.append("\n");
3166 
3167  out.append(" type: ");
3168  out.append(proto_enum_to_string<enums::ServiceArgType>(this->type));
3169  out.append("\n");
3170  out.append("}");
3171 }
3172 #endif
3174  switch (field_id) {
3175  case 1: {
3176  this->name = value.as_string();
3177  return true;
3178  }
3179  case 3: {
3180  this->args.push_back(value.as_message<ListEntitiesServicesArgument>());
3181  return true;
3182  }
3183  default:
3184  return false;
3185  }
3186 }
3188  switch (field_id) {
3189  case 2: {
3190  this->key = value.as_fixed32();
3191  return true;
3192  }
3193  default:
3194  return false;
3195  }
3196 }
3198  buffer.encode_string(1, this->name);
3199  buffer.encode_fixed32(2, this->key);
3200  for (auto &it : this->args) {
3201  buffer.encode_message<ListEntitiesServicesArgument>(3, it, true);
3202  }
3203 }
3204 #ifdef HAS_PROTO_MESSAGE_DUMP
3205 void ListEntitiesServicesResponse::dump_to(std::string &out) const {
3206  __attribute__((unused)) char buffer[64];
3207  out.append("ListEntitiesServicesResponse {\n");
3208  out.append(" name: ");
3209  out.append("'").append(this->name).append("'");
3210  out.append("\n");
3211 
3212  out.append(" key: ");
3213  sprintf(buffer, "%" PRIu32, this->key);
3214  out.append(buffer);
3215  out.append("\n");
3216 
3217  for (const auto &it : this->args) {
3218  out.append(" args: ");
3219  it.dump_to(out);
3220  out.append("\n");
3221  }
3222  out.append("}");
3223 }
3224 #endif
3225 bool ExecuteServiceArgument::decode_varint(uint32_t field_id, ProtoVarInt value) {
3226  switch (field_id) {
3227  case 1: {
3228  this->bool_ = value.as_bool();
3229  return true;
3230  }
3231  case 2: {
3232  this->legacy_int = value.as_int32();
3233  return true;
3234  }
3235  case 5: {
3236  this->int_ = value.as_sint32();
3237  return true;
3238  }
3239  case 6: {
3240  this->bool_array.push_back(value.as_bool());
3241  return true;
3242  }
3243  case 7: {
3244  this->int_array.push_back(value.as_sint32());
3245  return true;
3246  }
3247  default:
3248  return false;
3249  }
3250 }
3252  switch (field_id) {
3253  case 4: {
3254  this->string_ = value.as_string();
3255  return true;
3256  }
3257  case 9: {
3258  this->string_array.push_back(value.as_string());
3259  return true;
3260  }
3261  default:
3262  return false;
3263  }
3264 }
3265 bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) {
3266  switch (field_id) {
3267  case 3: {
3268  this->float_ = value.as_float();
3269  return true;
3270  }
3271  case 8: {
3272  this->float_array.push_back(value.as_float());
3273  return true;
3274  }
3275  default:
3276  return false;
3277  }
3278 }
3280  buffer.encode_bool(1, this->bool_);
3281  buffer.encode_int32(2, this->legacy_int);
3282  buffer.encode_float(3, this->float_);
3283  buffer.encode_string(4, this->string_);
3284  buffer.encode_sint32(5, this->int_);
3285  for (auto it : this->bool_array) {
3286  buffer.encode_bool(6, it, true);
3287  }
3288  for (auto &it : this->int_array) {
3289  buffer.encode_sint32(7, it, true);
3290  }
3291  for (auto &it : this->float_array) {
3292  buffer.encode_float(8, it, true);
3293  }
3294  for (auto &it : this->string_array) {
3295  buffer.encode_string(9, it, true);
3296  }
3297 }
3298 #ifdef HAS_PROTO_MESSAGE_DUMP
3299 void ExecuteServiceArgument::dump_to(std::string &out) const {
3300  __attribute__((unused)) char buffer[64];
3301  out.append("ExecuteServiceArgument {\n");
3302  out.append(" bool_: ");
3303  out.append(YESNO(this->bool_));
3304  out.append("\n");
3305 
3306  out.append(" legacy_int: ");
3307  sprintf(buffer, "%" PRId32, this->legacy_int);
3308  out.append(buffer);
3309  out.append("\n");
3310 
3311  out.append(" float_: ");
3312  sprintf(buffer, "%g", this->float_);
3313  out.append(buffer);
3314  out.append("\n");
3315 
3316  out.append(" string_: ");
3317  out.append("'").append(this->string_).append("'");
3318  out.append("\n");
3319 
3320  out.append(" int_: ");
3321  sprintf(buffer, "%" PRId32, this->int_);
3322  out.append(buffer);
3323  out.append("\n");
3324 
3325  for (const auto it : this->bool_array) {
3326  out.append(" bool_array: ");
3327  out.append(YESNO(it));
3328  out.append("\n");
3329  }
3330 
3331  for (const auto &it : this->int_array) {
3332  out.append(" int_array: ");
3333  sprintf(buffer, "%" PRId32, it);
3334  out.append(buffer);
3335  out.append("\n");
3336  }
3337 
3338  for (const auto &it : this->float_array) {
3339  out.append(" float_array: ");
3340  sprintf(buffer, "%g", it);
3341  out.append(buffer);
3342  out.append("\n");
3343  }
3344 
3345  for (const auto &it : this->string_array) {
3346  out.append(" string_array: ");
3347  out.append("'").append(it).append("'");
3348  out.append("\n");
3349  }
3350  out.append("}");
3351 }
3352 #endif
3354  switch (field_id) {
3355  case 2: {
3356  this->args.push_back(value.as_message<ExecuteServiceArgument>());
3357  return true;
3358  }
3359  default:
3360  return false;
3361  }
3362 }
3363 bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
3364  switch (field_id) {
3365  case 1: {
3366  this->key = value.as_fixed32();
3367  return true;
3368  }
3369  default:
3370  return false;
3371  }
3372 }
3374  buffer.encode_fixed32(1, this->key);
3375  for (auto &it : this->args) {
3376  buffer.encode_message<ExecuteServiceArgument>(2, it, true);
3377  }
3378 }
3379 #ifdef HAS_PROTO_MESSAGE_DUMP
3380 void ExecuteServiceRequest::dump_to(std::string &out) const {
3381  __attribute__((unused)) char buffer[64];
3382  out.append("ExecuteServiceRequest {\n");
3383  out.append(" key: ");
3384  sprintf(buffer, "%" PRIu32, this->key);
3385  out.append(buffer);
3386  out.append("\n");
3387 
3388  for (const auto &it : this->args) {
3389  out.append(" args: ");
3390  it.dump_to(out);
3391  out.append("\n");
3392  }
3393  out.append("}");
3394 }
3395 #endif
3397  switch (field_id) {
3398  case 5: {
3399  this->disabled_by_default = value.as_bool();
3400  return true;
3401  }
3402  case 7: {
3403  this->entity_category = value.as_enum<enums::EntityCategory>();
3404  return true;
3405  }
3406  default:
3407  return false;
3408  }
3409 }
3411  switch (field_id) {
3412  case 1: {
3413  this->object_id = value.as_string();
3414  return true;
3415  }
3416  case 3: {
3417  this->name = value.as_string();
3418  return true;
3419  }
3420  case 4: {
3421  this->unique_id = value.as_string();
3422  return true;
3423  }
3424  case 6: {
3425  this->icon = value.as_string();
3426  return true;
3427  }
3428  default:
3429  return false;
3430  }
3431 }
3433  switch (field_id) {
3434  case 2: {
3435  this->key = value.as_fixed32();
3436  return true;
3437  }
3438  default:
3439  return false;
3440  }
3441 }
3443  buffer.encode_string(1, this->object_id);
3444  buffer.encode_fixed32(2, this->key);
3445  buffer.encode_string(3, this->name);
3446  buffer.encode_string(4, this->unique_id);
3447  buffer.encode_bool(5, this->disabled_by_default);
3448  buffer.encode_string(6, this->icon);
3449  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
3450 }
3451 #ifdef HAS_PROTO_MESSAGE_DUMP
3452 void ListEntitiesCameraResponse::dump_to(std::string &out) const {
3453  __attribute__((unused)) char buffer[64];
3454  out.append("ListEntitiesCameraResponse {\n");
3455  out.append(" object_id: ");
3456  out.append("'").append(this->object_id).append("'");
3457  out.append("\n");
3458 
3459  out.append(" key: ");
3460  sprintf(buffer, "%" PRIu32, this->key);
3461  out.append(buffer);
3462  out.append("\n");
3463 
3464  out.append(" name: ");
3465  out.append("'").append(this->name).append("'");
3466  out.append("\n");
3467 
3468  out.append(" unique_id: ");
3469  out.append("'").append(this->unique_id).append("'");
3470  out.append("\n");
3471 
3472  out.append(" disabled_by_default: ");
3473  out.append(YESNO(this->disabled_by_default));
3474  out.append("\n");
3475 
3476  out.append(" icon: ");
3477  out.append("'").append(this->icon).append("'");
3478  out.append("\n");
3479 
3480  out.append(" entity_category: ");
3481  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3482  out.append("\n");
3483  out.append("}");
3484 }
3485 #endif
3486 bool CameraImageResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3487  switch (field_id) {
3488  case 3: {
3489  this->done = value.as_bool();
3490  return true;
3491  }
3492  default:
3493  return false;
3494  }
3495 }
3497  switch (field_id) {
3498  case 2: {
3499  this->data = value.as_string();
3500  return true;
3501  }
3502  default:
3503  return false;
3504  }
3505 }
3506 bool CameraImageResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3507  switch (field_id) {
3508  case 1: {
3509  this->key = value.as_fixed32();
3510  return true;
3511  }
3512  default:
3513  return false;
3514  }
3515 }
3517  buffer.encode_fixed32(1, this->key);
3518  buffer.encode_string(2, this->data);
3519  buffer.encode_bool(3, this->done);
3520 }
3521 #ifdef HAS_PROTO_MESSAGE_DUMP
3522 void CameraImageResponse::dump_to(std::string &out) const {
3523  __attribute__((unused)) char buffer[64];
3524  out.append("CameraImageResponse {\n");
3525  out.append(" key: ");
3526  sprintf(buffer, "%" PRIu32, this->key);
3527  out.append(buffer);
3528  out.append("\n");
3529 
3530  out.append(" data: ");
3531  out.append("'").append(this->data).append("'");
3532  out.append("\n");
3533 
3534  out.append(" done: ");
3535  out.append(YESNO(this->done));
3536  out.append("\n");
3537  out.append("}");
3538 }
3539 #endif
3540 bool CameraImageRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
3541  switch (field_id) {
3542  case 1: {
3543  this->single = value.as_bool();
3544  return true;
3545  }
3546  case 2: {
3547  this->stream = value.as_bool();
3548  return true;
3549  }
3550  default:
3551  return false;
3552  }
3553 }
3555  buffer.encode_bool(1, this->single);
3556  buffer.encode_bool(2, this->stream);
3557 }
3558 #ifdef HAS_PROTO_MESSAGE_DUMP
3559 void CameraImageRequest::dump_to(std::string &out) const {
3560  __attribute__((unused)) char buffer[64];
3561  out.append("CameraImageRequest {\n");
3562  out.append(" single: ");
3563  out.append(YESNO(this->single));
3564  out.append("\n");
3565 
3566  out.append(" stream: ");
3567  out.append(YESNO(this->stream));
3568  out.append("\n");
3569  out.append("}");
3570 }
3571 #endif
3573  switch (field_id) {
3574  case 5: {
3575  this->supports_current_temperature = value.as_bool();
3576  return true;
3577  }
3578  case 6: {
3579  this->supports_two_point_target_temperature = value.as_bool();
3580  return true;
3581  }
3582  case 7: {
3583  this->supported_modes.push_back(value.as_enum<enums::ClimateMode>());
3584  return true;
3585  }
3586  case 11: {
3587  this->legacy_supports_away = value.as_bool();
3588  return true;
3589  }
3590  case 12: {
3591  this->supports_action = value.as_bool();
3592  return true;
3593  }
3594  case 13: {
3595  this->supported_fan_modes.push_back(value.as_enum<enums::ClimateFanMode>());
3596  return true;
3597  }
3598  case 14: {
3599  this->supported_swing_modes.push_back(value.as_enum<enums::ClimateSwingMode>());
3600  return true;
3601  }
3602  case 16: {
3603  this->supported_presets.push_back(value.as_enum<enums::ClimatePreset>());
3604  return true;
3605  }
3606  case 18: {
3607  this->disabled_by_default = value.as_bool();
3608  return true;
3609  }
3610  case 20: {
3611  this->entity_category = value.as_enum<enums::EntityCategory>();
3612  return true;
3613  }
3614  case 22: {
3615  this->supports_current_humidity = value.as_bool();
3616  return true;
3617  }
3618  case 23: {
3619  this->supports_target_humidity = value.as_bool();
3620  return true;
3621  }
3622  default:
3623  return false;
3624  }
3625 }
3627  switch (field_id) {
3628  case 1: {
3629  this->object_id = value.as_string();
3630  return true;
3631  }
3632  case 3: {
3633  this->name = value.as_string();
3634  return true;
3635  }
3636  case 4: {
3637  this->unique_id = value.as_string();
3638  return true;
3639  }
3640  case 15: {
3641  this->supported_custom_fan_modes.push_back(value.as_string());
3642  return true;
3643  }
3644  case 17: {
3645  this->supported_custom_presets.push_back(value.as_string());
3646  return true;
3647  }
3648  case 19: {
3649  this->icon = value.as_string();
3650  return true;
3651  }
3652  default:
3653  return false;
3654  }
3655 }
3657  switch (field_id) {
3658  case 2: {
3659  this->key = value.as_fixed32();
3660  return true;
3661  }
3662  case 8: {
3663  this->visual_min_temperature = value.as_float();
3664  return true;
3665  }
3666  case 9: {
3667  this->visual_max_temperature = value.as_float();
3668  return true;
3669  }
3670  case 10: {
3671  this->visual_target_temperature_step = value.as_float();
3672  return true;
3673  }
3674  case 21: {
3675  this->visual_current_temperature_step = value.as_float();
3676  return true;
3677  }
3678  case 24: {
3679  this->visual_min_humidity = value.as_float();
3680  return true;
3681  }
3682  case 25: {
3683  this->visual_max_humidity = value.as_float();
3684  return true;
3685  }
3686  default:
3687  return false;
3688  }
3689 }
3691  buffer.encode_string(1, this->object_id);
3692  buffer.encode_fixed32(2, this->key);
3693  buffer.encode_string(3, this->name);
3694  buffer.encode_string(4, this->unique_id);
3695  buffer.encode_bool(5, this->supports_current_temperature);
3696  buffer.encode_bool(6, this->supports_two_point_target_temperature);
3697  for (auto &it : this->supported_modes) {
3698  buffer.encode_enum<enums::ClimateMode>(7, it, true);
3699  }
3700  buffer.encode_float(8, this->visual_min_temperature);
3701  buffer.encode_float(9, this->visual_max_temperature);
3702  buffer.encode_float(10, this->visual_target_temperature_step);
3703  buffer.encode_bool(11, this->legacy_supports_away);
3704  buffer.encode_bool(12, this->supports_action);
3705  for (auto &it : this->supported_fan_modes) {
3706  buffer.encode_enum<enums::ClimateFanMode>(13, it, true);
3707  }
3708  for (auto &it : this->supported_swing_modes) {
3709  buffer.encode_enum<enums::ClimateSwingMode>(14, it, true);
3710  }
3711  for (auto &it : this->supported_custom_fan_modes) {
3712  buffer.encode_string(15, it, true);
3713  }
3714  for (auto &it : this->supported_presets) {
3715  buffer.encode_enum<enums::ClimatePreset>(16, it, true);
3716  }
3717  for (auto &it : this->supported_custom_presets) {
3718  buffer.encode_string(17, it, true);
3719  }
3720  buffer.encode_bool(18, this->disabled_by_default);
3721  buffer.encode_string(19, this->icon);
3722  buffer.encode_enum<enums::EntityCategory>(20, this->entity_category);
3723  buffer.encode_float(21, this->visual_current_temperature_step);
3724  buffer.encode_bool(22, this->supports_current_humidity);
3725  buffer.encode_bool(23, this->supports_target_humidity);
3726  buffer.encode_float(24, this->visual_min_humidity);
3727  buffer.encode_float(25, this->visual_max_humidity);
3728 }
3729 #ifdef HAS_PROTO_MESSAGE_DUMP
3730 void ListEntitiesClimateResponse::dump_to(std::string &out) const {
3731  __attribute__((unused)) char buffer[64];
3732  out.append("ListEntitiesClimateResponse {\n");
3733  out.append(" object_id: ");
3734  out.append("'").append(this->object_id).append("'");
3735  out.append("\n");
3736 
3737  out.append(" key: ");
3738  sprintf(buffer, "%" PRIu32, this->key);
3739  out.append(buffer);
3740  out.append("\n");
3741 
3742  out.append(" name: ");
3743  out.append("'").append(this->name).append("'");
3744  out.append("\n");
3745 
3746  out.append(" unique_id: ");
3747  out.append("'").append(this->unique_id).append("'");
3748  out.append("\n");
3749 
3750  out.append(" supports_current_temperature: ");
3751  out.append(YESNO(this->supports_current_temperature));
3752  out.append("\n");
3753 
3754  out.append(" supports_two_point_target_temperature: ");
3755  out.append(YESNO(this->supports_two_point_target_temperature));
3756  out.append("\n");
3757 
3758  for (const auto &it : this->supported_modes) {
3759  out.append(" supported_modes: ");
3760  out.append(proto_enum_to_string<enums::ClimateMode>(it));
3761  out.append("\n");
3762  }
3763 
3764  out.append(" visual_min_temperature: ");
3765  sprintf(buffer, "%g", this->visual_min_temperature);
3766  out.append(buffer);
3767  out.append("\n");
3768 
3769  out.append(" visual_max_temperature: ");
3770  sprintf(buffer, "%g", this->visual_max_temperature);
3771  out.append(buffer);
3772  out.append("\n");
3773 
3774  out.append(" visual_target_temperature_step: ");
3775  sprintf(buffer, "%g", this->visual_target_temperature_step);
3776  out.append(buffer);
3777  out.append("\n");
3778 
3779  out.append(" legacy_supports_away: ");
3780  out.append(YESNO(this->legacy_supports_away));
3781  out.append("\n");
3782 
3783  out.append(" supports_action: ");
3784  out.append(YESNO(this->supports_action));
3785  out.append("\n");
3786 
3787  for (const auto &it : this->supported_fan_modes) {
3788  out.append(" supported_fan_modes: ");
3789  out.append(proto_enum_to_string<enums::ClimateFanMode>(it));
3790  out.append("\n");
3791  }
3792 
3793  for (const auto &it : this->supported_swing_modes) {
3794  out.append(" supported_swing_modes: ");
3795  out.append(proto_enum_to_string<enums::ClimateSwingMode>(it));
3796  out.append("\n");
3797  }
3798 
3799  for (const auto &it : this->supported_custom_fan_modes) {
3800  out.append(" supported_custom_fan_modes: ");
3801  out.append("'").append(it).append("'");
3802  out.append("\n");
3803  }
3804 
3805  for (const auto &it : this->supported_presets) {
3806  out.append(" supported_presets: ");
3807  out.append(proto_enum_to_string<enums::ClimatePreset>(it));
3808  out.append("\n");
3809  }
3810 
3811  for (const auto &it : this->supported_custom_presets) {
3812  out.append(" supported_custom_presets: ");
3813  out.append("'").append(it).append("'");
3814  out.append("\n");
3815  }
3816 
3817  out.append(" disabled_by_default: ");
3818  out.append(YESNO(this->disabled_by_default));
3819  out.append("\n");
3820 
3821  out.append(" icon: ");
3822  out.append("'").append(this->icon).append("'");
3823  out.append("\n");
3824 
3825  out.append(" entity_category: ");
3826  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
3827  out.append("\n");
3828 
3829  out.append(" visual_current_temperature_step: ");
3830  sprintf(buffer, "%g", this->visual_current_temperature_step);
3831  out.append(buffer);
3832  out.append("\n");
3833 
3834  out.append(" supports_current_humidity: ");
3835  out.append(YESNO(this->supports_current_humidity));
3836  out.append("\n");
3837 
3838  out.append(" supports_target_humidity: ");
3839  out.append(YESNO(this->supports_target_humidity));
3840  out.append("\n");
3841 
3842  out.append(" visual_min_humidity: ");
3843  sprintf(buffer, "%g", this->visual_min_humidity);
3844  out.append(buffer);
3845  out.append("\n");
3846 
3847  out.append(" visual_max_humidity: ");
3848  sprintf(buffer, "%g", this->visual_max_humidity);
3849  out.append(buffer);
3850  out.append("\n");
3851  out.append("}");
3852 }
3853 #endif
3854 bool ClimateStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
3855  switch (field_id) {
3856  case 2: {
3857  this->mode = value.as_enum<enums::ClimateMode>();
3858  return true;
3859  }
3860  case 7: {
3861  this->unused_legacy_away = value.as_bool();
3862  return true;
3863  }
3864  case 8: {
3865  this->action = value.as_enum<enums::ClimateAction>();
3866  return true;
3867  }
3868  case 9: {
3869  this->fan_mode = value.as_enum<enums::ClimateFanMode>();
3870  return true;
3871  }
3872  case 10: {
3873  this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
3874  return true;
3875  }
3876  case 12: {
3877  this->preset = value.as_enum<enums::ClimatePreset>();
3878  return true;
3879  }
3880  default:
3881  return false;
3882  }
3883 }
3885  switch (field_id) {
3886  case 11: {
3887  this->custom_fan_mode = value.as_string();
3888  return true;
3889  }
3890  case 13: {
3891  this->custom_preset = value.as_string();
3892  return true;
3893  }
3894  default:
3895  return false;
3896  }
3897 }
3898 bool ClimateStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
3899  switch (field_id) {
3900  case 1: {
3901  this->key = value.as_fixed32();
3902  return true;
3903  }
3904  case 3: {
3905  this->current_temperature = value.as_float();
3906  return true;
3907  }
3908  case 4: {
3909  this->target_temperature = value.as_float();
3910  return true;
3911  }
3912  case 5: {
3913  this->target_temperature_low = value.as_float();
3914  return true;
3915  }
3916  case 6: {
3917  this->target_temperature_high = value.as_float();
3918  return true;
3919  }
3920  case 14: {
3921  this->current_humidity = value.as_float();
3922  return true;
3923  }
3924  case 15: {
3925  this->target_humidity = value.as_float();
3926  return true;
3927  }
3928  default:
3929  return false;
3930  }
3931 }
3933  buffer.encode_fixed32(1, this->key);
3934  buffer.encode_enum<enums::ClimateMode>(2, this->mode);
3935  buffer.encode_float(3, this->current_temperature);
3936  buffer.encode_float(4, this->target_temperature);
3937  buffer.encode_float(5, this->target_temperature_low);
3938  buffer.encode_float(6, this->target_temperature_high);
3939  buffer.encode_bool(7, this->unused_legacy_away);
3940  buffer.encode_enum<enums::ClimateAction>(8, this->action);
3941  buffer.encode_enum<enums::ClimateFanMode>(9, this->fan_mode);
3942  buffer.encode_enum<enums::ClimateSwingMode>(10, this->swing_mode);
3943  buffer.encode_string(11, this->custom_fan_mode);
3944  buffer.encode_enum<enums::ClimatePreset>(12, this->preset);
3945  buffer.encode_string(13, this->custom_preset);
3946  buffer.encode_float(14, this->current_humidity);
3947  buffer.encode_float(15, this->target_humidity);
3948 }
3949 #ifdef HAS_PROTO_MESSAGE_DUMP
3950 void ClimateStateResponse::dump_to(std::string &out) const {
3951  __attribute__((unused)) char buffer[64];
3952  out.append("ClimateStateResponse {\n");
3953  out.append(" key: ");
3954  sprintf(buffer, "%" PRIu32, this->key);
3955  out.append(buffer);
3956  out.append("\n");
3957 
3958  out.append(" mode: ");
3959  out.append(proto_enum_to_string<enums::ClimateMode>(this->mode));
3960  out.append("\n");
3961 
3962  out.append(" current_temperature: ");
3963  sprintf(buffer, "%g", this->current_temperature);
3964  out.append(buffer);
3965  out.append("\n");
3966 
3967  out.append(" target_temperature: ");
3968  sprintf(buffer, "%g", this->target_temperature);
3969  out.append(buffer);
3970  out.append("\n");
3971 
3972  out.append(" target_temperature_low: ");
3973  sprintf(buffer, "%g", this->target_temperature_low);
3974  out.append(buffer);
3975  out.append("\n");
3976 
3977  out.append(" target_temperature_high: ");
3978  sprintf(buffer, "%g", this->target_temperature_high);
3979  out.append(buffer);
3980  out.append("\n");
3981 
3982  out.append(" unused_legacy_away: ");
3983  out.append(YESNO(this->unused_legacy_away));
3984  out.append("\n");
3985 
3986  out.append(" action: ");
3987  out.append(proto_enum_to_string<enums::ClimateAction>(this->action));
3988  out.append("\n");
3989 
3990  out.append(" fan_mode: ");
3991  out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
3992  out.append("\n");
3993 
3994  out.append(" swing_mode: ");
3995  out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
3996  out.append("\n");
3997 
3998  out.append(" custom_fan_mode: ");
3999  out.append("'").append(this->custom_fan_mode).append("'");
4000  out.append("\n");
4001 
4002  out.append(" preset: ");
4003  out.append(proto_enum_to_string<enums::ClimatePreset>(this->preset));
4004  out.append("\n");
4005 
4006  out.append(" custom_preset: ");
4007  out.append("'").append(this->custom_preset).append("'");
4008  out.append("\n");
4009 
4010  out.append(" current_humidity: ");
4011  sprintf(buffer, "%g", this->current_humidity);
4012  out.append(buffer);
4013  out.append("\n");
4014 
4015  out.append(" target_humidity: ");
4016  sprintf(buffer, "%g", this->target_humidity);
4017  out.append(buffer);
4018  out.append("\n");
4019  out.append("}");
4020 }
4021 #endif
4022 bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
4023  switch (field_id) {
4024  case 2: {
4025  this->has_mode = value.as_bool();
4026  return true;
4027  }
4028  case 3: {
4029  this->mode = value.as_enum<enums::ClimateMode>();
4030  return true;
4031  }
4032  case 4: {
4033  this->has_target_temperature = value.as_bool();
4034  return true;
4035  }
4036  case 6: {
4037  this->has_target_temperature_low = value.as_bool();
4038  return true;
4039  }
4040  case 8: {
4041  this->has_target_temperature_high = value.as_bool();
4042  return true;
4043  }
4044  case 10: {
4045  this->unused_has_legacy_away = value.as_bool();
4046  return true;
4047  }
4048  case 11: {
4049  this->unused_legacy_away = value.as_bool();
4050  return true;
4051  }
4052  case 12: {
4053  this->has_fan_mode = value.as_bool();
4054  return true;
4055  }
4056  case 13: {
4057  this->fan_mode = value.as_enum<enums::ClimateFanMode>();
4058  return true;
4059  }
4060  case 14: {
4061  this->has_swing_mode = value.as_bool();
4062  return true;
4063  }
4064  case 15: {
4065  this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
4066  return true;
4067  }
4068  case 16: {
4069  this->has_custom_fan_mode = value.as_bool();
4070  return true;
4071  }
4072  case 18: {
4073  this->has_preset = value.as_bool();
4074  return true;
4075  }
4076  case 19: {
4077  this->preset = value.as_enum<enums::ClimatePreset>();
4078  return true;
4079  }
4080  case 20: {
4081  this->has_custom_preset = value.as_bool();
4082  return true;
4083  }
4084  case 22: {
4085  this->has_target_humidity = value.as_bool();
4086  return true;
4087  }
4088  default:
4089  return false;
4090  }
4091 }
4093  switch (field_id) {
4094  case 17: {
4095  this->custom_fan_mode = value.as_string();
4096  return true;
4097  }
4098  case 21: {
4099  this->custom_preset = value.as_string();
4100  return true;
4101  }
4102  default:
4103  return false;
4104  }
4105 }
4106 bool ClimateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4107  switch (field_id) {
4108  case 1: {
4109  this->key = value.as_fixed32();
4110  return true;
4111  }
4112  case 5: {
4113  this->target_temperature = value.as_float();
4114  return true;
4115  }
4116  case 7: {
4117  this->target_temperature_low = value.as_float();
4118  return true;
4119  }
4120  case 9: {
4121  this->target_temperature_high = value.as_float();
4122  return true;
4123  }
4124  case 23: {
4125  this->target_humidity = value.as_float();
4126  return true;
4127  }
4128  default:
4129  return false;
4130  }
4131 }
4133  buffer.encode_fixed32(1, this->key);
4134  buffer.encode_bool(2, this->has_mode);
4135  buffer.encode_enum<enums::ClimateMode>(3, this->mode);
4136  buffer.encode_bool(4, this->has_target_temperature);
4137  buffer.encode_float(5, this->target_temperature);
4138  buffer.encode_bool(6, this->has_target_temperature_low);
4139  buffer.encode_float(7, this->target_temperature_low);
4140  buffer.encode_bool(8, this->has_target_temperature_high);
4141  buffer.encode_float(9, this->target_temperature_high);
4142  buffer.encode_bool(10, this->unused_has_legacy_away);
4143  buffer.encode_bool(11, this->unused_legacy_away);
4144  buffer.encode_bool(12, this->has_fan_mode);
4145  buffer.encode_enum<enums::ClimateFanMode>(13, this->fan_mode);
4146  buffer.encode_bool(14, this->has_swing_mode);
4147  buffer.encode_enum<enums::ClimateSwingMode>(15, this->swing_mode);
4148  buffer.encode_bool(16, this->has_custom_fan_mode);
4149  buffer.encode_string(17, this->custom_fan_mode);
4150  buffer.encode_bool(18, this->has_preset);
4151  buffer.encode_enum<enums::ClimatePreset>(19, this->preset);
4152  buffer.encode_bool(20, this->has_custom_preset);
4153  buffer.encode_string(21, this->custom_preset);
4154  buffer.encode_bool(22, this->has_target_humidity);
4155  buffer.encode_float(23, this->target_humidity);
4156 }
4157 #ifdef HAS_PROTO_MESSAGE_DUMP
4158 void ClimateCommandRequest::dump_to(std::string &out) const {
4159  __attribute__((unused)) char buffer[64];
4160  out.append("ClimateCommandRequest {\n");
4161  out.append(" key: ");
4162  sprintf(buffer, "%" PRIu32, this->key);
4163  out.append(buffer);
4164  out.append("\n");
4165 
4166  out.append(" has_mode: ");
4167  out.append(YESNO(this->has_mode));
4168  out.append("\n");
4169 
4170  out.append(" mode: ");
4171  out.append(proto_enum_to_string<enums::ClimateMode>(this->mode));
4172  out.append("\n");
4173 
4174  out.append(" has_target_temperature: ");
4175  out.append(YESNO(this->has_target_temperature));
4176  out.append("\n");
4177 
4178  out.append(" target_temperature: ");
4179  sprintf(buffer, "%g", this->target_temperature);
4180  out.append(buffer);
4181  out.append("\n");
4182 
4183  out.append(" has_target_temperature_low: ");
4184  out.append(YESNO(this->has_target_temperature_low));
4185  out.append("\n");
4186 
4187  out.append(" target_temperature_low: ");
4188  sprintf(buffer, "%g", this->target_temperature_low);
4189  out.append(buffer);
4190  out.append("\n");
4191 
4192  out.append(" has_target_temperature_high: ");
4193  out.append(YESNO(this->has_target_temperature_high));
4194  out.append("\n");
4195 
4196  out.append(" target_temperature_high: ");
4197  sprintf(buffer, "%g", this->target_temperature_high);
4198  out.append(buffer);
4199  out.append("\n");
4200 
4201  out.append(" unused_has_legacy_away: ");
4202  out.append(YESNO(this->unused_has_legacy_away));
4203  out.append("\n");
4204 
4205  out.append(" unused_legacy_away: ");
4206  out.append(YESNO(this->unused_legacy_away));
4207  out.append("\n");
4208 
4209  out.append(" has_fan_mode: ");
4210  out.append(YESNO(this->has_fan_mode));
4211  out.append("\n");
4212 
4213  out.append(" fan_mode: ");
4214  out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
4215  out.append("\n");
4216 
4217  out.append(" has_swing_mode: ");
4218  out.append(YESNO(this->has_swing_mode));
4219  out.append("\n");
4220 
4221  out.append(" swing_mode: ");
4222  out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
4223  out.append("\n");
4224 
4225  out.append(" has_custom_fan_mode: ");
4226  out.append(YESNO(this->has_custom_fan_mode));
4227  out.append("\n");
4228 
4229  out.append(" custom_fan_mode: ");
4230  out.append("'").append(this->custom_fan_mode).append("'");
4231  out.append("\n");
4232 
4233  out.append(" has_preset: ");
4234  out.append(YESNO(this->has_preset));
4235  out.append("\n");
4236 
4237  out.append(" preset: ");
4238  out.append(proto_enum_to_string<enums::ClimatePreset>(this->preset));
4239  out.append("\n");
4240 
4241  out.append(" has_custom_preset: ");
4242  out.append(YESNO(this->has_custom_preset));
4243  out.append("\n");
4244 
4245  out.append(" custom_preset: ");
4246  out.append("'").append(this->custom_preset).append("'");
4247  out.append("\n");
4248 
4249  out.append(" has_target_humidity: ");
4250  out.append(YESNO(this->has_target_humidity));
4251  out.append("\n");
4252 
4253  out.append(" target_humidity: ");
4254  sprintf(buffer, "%g", this->target_humidity);
4255  out.append(buffer);
4256  out.append("\n");
4257  out.append("}");
4258 }
4259 #endif
4261  switch (field_id) {
4262  case 9: {
4263  this->disabled_by_default = value.as_bool();
4264  return true;
4265  }
4266  case 10: {
4267  this->entity_category = value.as_enum<enums::EntityCategory>();
4268  return true;
4269  }
4270  case 12: {
4271  this->mode = value.as_enum<enums::NumberMode>();
4272  return true;
4273  }
4274  default:
4275  return false;
4276  }
4277 }
4279  switch (field_id) {
4280  case 1: {
4281  this->object_id = value.as_string();
4282  return true;
4283  }
4284  case 3: {
4285  this->name = value.as_string();
4286  return true;
4287  }
4288  case 4: {
4289  this->unique_id = value.as_string();
4290  return true;
4291  }
4292  case 5: {
4293  this->icon = value.as_string();
4294  return true;
4295  }
4296  case 11: {
4297  this->unit_of_measurement = value.as_string();
4298  return true;
4299  }
4300  case 13: {
4301  this->device_class = value.as_string();
4302  return true;
4303  }
4304  default:
4305  return false;
4306  }
4307 }
4309  switch (field_id) {
4310  case 2: {
4311  this->key = value.as_fixed32();
4312  return true;
4313  }
4314  case 6: {
4315  this->min_value = value.as_float();
4316  return true;
4317  }
4318  case 7: {
4319  this->max_value = value.as_float();
4320  return true;
4321  }
4322  case 8: {
4323  this->step = value.as_float();
4324  return true;
4325  }
4326  default:
4327  return false;
4328  }
4329 }
4331  buffer.encode_string(1, this->object_id);
4332  buffer.encode_fixed32(2, this->key);
4333  buffer.encode_string(3, this->name);
4334  buffer.encode_string(4, this->unique_id);
4335  buffer.encode_string(5, this->icon);
4336  buffer.encode_float(6, this->min_value);
4337  buffer.encode_float(7, this->max_value);
4338  buffer.encode_float(8, this->step);
4339  buffer.encode_bool(9, this->disabled_by_default);
4340  buffer.encode_enum<enums::EntityCategory>(10, this->entity_category);
4341  buffer.encode_string(11, this->unit_of_measurement);
4342  buffer.encode_enum<enums::NumberMode>(12, this->mode);
4343  buffer.encode_string(13, this->device_class);
4344 }
4345 #ifdef HAS_PROTO_MESSAGE_DUMP
4346 void ListEntitiesNumberResponse::dump_to(std::string &out) const {
4347  __attribute__((unused)) char buffer[64];
4348  out.append("ListEntitiesNumberResponse {\n");
4349  out.append(" object_id: ");
4350  out.append("'").append(this->object_id).append("'");
4351  out.append("\n");
4352 
4353  out.append(" key: ");
4354  sprintf(buffer, "%" PRIu32, this->key);
4355  out.append(buffer);
4356  out.append("\n");
4357 
4358  out.append(" name: ");
4359  out.append("'").append(this->name).append("'");
4360  out.append("\n");
4361 
4362  out.append(" unique_id: ");
4363  out.append("'").append(this->unique_id).append("'");
4364  out.append("\n");
4365 
4366  out.append(" icon: ");
4367  out.append("'").append(this->icon).append("'");
4368  out.append("\n");
4369 
4370  out.append(" min_value: ");
4371  sprintf(buffer, "%g", this->min_value);
4372  out.append(buffer);
4373  out.append("\n");
4374 
4375  out.append(" max_value: ");
4376  sprintf(buffer, "%g", this->max_value);
4377  out.append(buffer);
4378  out.append("\n");
4379 
4380  out.append(" step: ");
4381  sprintf(buffer, "%g", this->step);
4382  out.append(buffer);
4383  out.append("\n");
4384 
4385  out.append(" disabled_by_default: ");
4386  out.append(YESNO(this->disabled_by_default));
4387  out.append("\n");
4388 
4389  out.append(" entity_category: ");
4390  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4391  out.append("\n");
4392 
4393  out.append(" unit_of_measurement: ");
4394  out.append("'").append(this->unit_of_measurement).append("'");
4395  out.append("\n");
4396 
4397  out.append(" mode: ");
4398  out.append(proto_enum_to_string<enums::NumberMode>(this->mode));
4399  out.append("\n");
4400 
4401  out.append(" device_class: ");
4402  out.append("'").append(this->device_class).append("'");
4403  out.append("\n");
4404  out.append("}");
4405 }
4406 #endif
4407 bool NumberStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4408  switch (field_id) {
4409  case 3: {
4410  this->missing_state = value.as_bool();
4411  return true;
4412  }
4413  default:
4414  return false;
4415  }
4416 }
4417 bool NumberStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4418  switch (field_id) {
4419  case 1: {
4420  this->key = value.as_fixed32();
4421  return true;
4422  }
4423  case 2: {
4424  this->state = value.as_float();
4425  return true;
4426  }
4427  default:
4428  return false;
4429  }
4430 }
4432  buffer.encode_fixed32(1, this->key);
4433  buffer.encode_float(2, this->state);
4434  buffer.encode_bool(3, this->missing_state);
4435 }
4436 #ifdef HAS_PROTO_MESSAGE_DUMP
4437 void NumberStateResponse::dump_to(std::string &out) const {
4438  __attribute__((unused)) char buffer[64];
4439  out.append("NumberStateResponse {\n");
4440  out.append(" key: ");
4441  sprintf(buffer, "%" PRIu32, this->key);
4442  out.append(buffer);
4443  out.append("\n");
4444 
4445  out.append(" state: ");
4446  sprintf(buffer, "%g", this->state);
4447  out.append(buffer);
4448  out.append("\n");
4449 
4450  out.append(" missing_state: ");
4451  out.append(YESNO(this->missing_state));
4452  out.append("\n");
4453  out.append("}");
4454 }
4455 #endif
4456 bool NumberCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4457  switch (field_id) {
4458  case 1: {
4459  this->key = value.as_fixed32();
4460  return true;
4461  }
4462  case 2: {
4463  this->state = value.as_float();
4464  return true;
4465  }
4466  default:
4467  return false;
4468  }
4469 }
4471  buffer.encode_fixed32(1, this->key);
4472  buffer.encode_float(2, this->state);
4473 }
4474 #ifdef HAS_PROTO_MESSAGE_DUMP
4475 void NumberCommandRequest::dump_to(std::string &out) const {
4476  __attribute__((unused)) char buffer[64];
4477  out.append("NumberCommandRequest {\n");
4478  out.append(" key: ");
4479  sprintf(buffer, "%" PRIu32, this->key);
4480  out.append(buffer);
4481  out.append("\n");
4482 
4483  out.append(" state: ");
4484  sprintf(buffer, "%g", this->state);
4485  out.append(buffer);
4486  out.append("\n");
4487  out.append("}");
4488 }
4489 #endif
4491  switch (field_id) {
4492  case 7: {
4493  this->disabled_by_default = value.as_bool();
4494  return true;
4495  }
4496  case 8: {
4497  this->entity_category = value.as_enum<enums::EntityCategory>();
4498  return true;
4499  }
4500  default:
4501  return false;
4502  }
4503 }
4505  switch (field_id) {
4506  case 1: {
4507  this->object_id = value.as_string();
4508  return true;
4509  }
4510  case 3: {
4511  this->name = value.as_string();
4512  return true;
4513  }
4514  case 4: {
4515  this->unique_id = value.as_string();
4516  return true;
4517  }
4518  case 5: {
4519  this->icon = value.as_string();
4520  return true;
4521  }
4522  case 6: {
4523  this->options.push_back(value.as_string());
4524  return true;
4525  }
4526  default:
4527  return false;
4528  }
4529 }
4531  switch (field_id) {
4532  case 2: {
4533  this->key = value.as_fixed32();
4534  return true;
4535  }
4536  default:
4537  return false;
4538  }
4539 }
4541  buffer.encode_string(1, this->object_id);
4542  buffer.encode_fixed32(2, this->key);
4543  buffer.encode_string(3, this->name);
4544  buffer.encode_string(4, this->unique_id);
4545  buffer.encode_string(5, this->icon);
4546  for (auto &it : this->options) {
4547  buffer.encode_string(6, it, true);
4548  }
4549  buffer.encode_bool(7, this->disabled_by_default);
4550  buffer.encode_enum<enums::EntityCategory>(8, this->entity_category);
4551 }
4552 #ifdef HAS_PROTO_MESSAGE_DUMP
4553 void ListEntitiesSelectResponse::dump_to(std::string &out) const {
4554  __attribute__((unused)) char buffer[64];
4555  out.append("ListEntitiesSelectResponse {\n");
4556  out.append(" object_id: ");
4557  out.append("'").append(this->object_id).append("'");
4558  out.append("\n");
4559 
4560  out.append(" key: ");
4561  sprintf(buffer, "%" PRIu32, this->key);
4562  out.append(buffer);
4563  out.append("\n");
4564 
4565  out.append(" name: ");
4566  out.append("'").append(this->name).append("'");
4567  out.append("\n");
4568 
4569  out.append(" unique_id: ");
4570  out.append("'").append(this->unique_id).append("'");
4571  out.append("\n");
4572 
4573  out.append(" icon: ");
4574  out.append("'").append(this->icon).append("'");
4575  out.append("\n");
4576 
4577  for (const auto &it : this->options) {
4578  out.append(" options: ");
4579  out.append("'").append(it).append("'");
4580  out.append("\n");
4581  }
4582 
4583  out.append(" disabled_by_default: ");
4584  out.append(YESNO(this->disabled_by_default));
4585  out.append("\n");
4586 
4587  out.append(" entity_category: ");
4588  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4589  out.append("\n");
4590  out.append("}");
4591 }
4592 #endif
4593 bool SelectStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4594  switch (field_id) {
4595  case 3: {
4596  this->missing_state = value.as_bool();
4597  return true;
4598  }
4599  default:
4600  return false;
4601  }
4602 }
4604  switch (field_id) {
4605  case 2: {
4606  this->state = value.as_string();
4607  return true;
4608  }
4609  default:
4610  return false;
4611  }
4612 }
4613 bool SelectStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4614  switch (field_id) {
4615  case 1: {
4616  this->key = value.as_fixed32();
4617  return true;
4618  }
4619  default:
4620  return false;
4621  }
4622 }
4624  buffer.encode_fixed32(1, this->key);
4625  buffer.encode_string(2, this->state);
4626  buffer.encode_bool(3, this->missing_state);
4627 }
4628 #ifdef HAS_PROTO_MESSAGE_DUMP
4629 void SelectStateResponse::dump_to(std::string &out) const {
4630  __attribute__((unused)) char buffer[64];
4631  out.append("SelectStateResponse {\n");
4632  out.append(" key: ");
4633  sprintf(buffer, "%" PRIu32, this->key);
4634  out.append(buffer);
4635  out.append("\n");
4636 
4637  out.append(" state: ");
4638  out.append("'").append(this->state).append("'");
4639  out.append("\n");
4640 
4641  out.append(" missing_state: ");
4642  out.append(YESNO(this->missing_state));
4643  out.append("\n");
4644  out.append("}");
4645 }
4646 #endif
4648  switch (field_id) {
4649  case 2: {
4650  this->state = value.as_string();
4651  return true;
4652  }
4653  default:
4654  return false;
4655  }
4656 }
4657 bool SelectCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4658  switch (field_id) {
4659  case 1: {
4660  this->key = value.as_fixed32();
4661  return true;
4662  }
4663  default:
4664  return false;
4665  }
4666 }
4668  buffer.encode_fixed32(1, this->key);
4669  buffer.encode_string(2, this->state);
4670 }
4671 #ifdef HAS_PROTO_MESSAGE_DUMP
4672 void SelectCommandRequest::dump_to(std::string &out) const {
4673  __attribute__((unused)) char buffer[64];
4674  out.append("SelectCommandRequest {\n");
4675  out.append(" key: ");
4676  sprintf(buffer, "%" PRIu32, this->key);
4677  out.append(buffer);
4678  out.append("\n");
4679 
4680  out.append(" state: ");
4681  out.append("'").append(this->state).append("'");
4682  out.append("\n");
4683  out.append("}");
4684 }
4685 #endif
4687  switch (field_id) {
4688  case 6: {
4689  this->disabled_by_default = value.as_bool();
4690  return true;
4691  }
4692  case 7: {
4693  this->entity_category = value.as_enum<enums::EntityCategory>();
4694  return true;
4695  }
4696  case 8: {
4697  this->assumed_state = value.as_bool();
4698  return true;
4699  }
4700  case 9: {
4701  this->supports_open = value.as_bool();
4702  return true;
4703  }
4704  case 10: {
4705  this->requires_code = value.as_bool();
4706  return true;
4707  }
4708  default:
4709  return false;
4710  }
4711 }
4713  switch (field_id) {
4714  case 1: {
4715  this->object_id = value.as_string();
4716  return true;
4717  }
4718  case 3: {
4719  this->name = value.as_string();
4720  return true;
4721  }
4722  case 4: {
4723  this->unique_id = value.as_string();
4724  return true;
4725  }
4726  case 5: {
4727  this->icon = value.as_string();
4728  return true;
4729  }
4730  case 11: {
4731  this->code_format = value.as_string();
4732  return true;
4733  }
4734  default:
4735  return false;
4736  }
4737 }
4738 bool ListEntitiesLockResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4739  switch (field_id) {
4740  case 2: {
4741  this->key = value.as_fixed32();
4742  return true;
4743  }
4744  default:
4745  return false;
4746  }
4747 }
4749  buffer.encode_string(1, this->object_id);
4750  buffer.encode_fixed32(2, this->key);
4751  buffer.encode_string(3, this->name);
4752  buffer.encode_string(4, this->unique_id);
4753  buffer.encode_string(5, this->icon);
4754  buffer.encode_bool(6, this->disabled_by_default);
4755  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4756  buffer.encode_bool(8, this->assumed_state);
4757  buffer.encode_bool(9, this->supports_open);
4758  buffer.encode_bool(10, this->requires_code);
4759  buffer.encode_string(11, this->code_format);
4760 }
4761 #ifdef HAS_PROTO_MESSAGE_DUMP
4762 void ListEntitiesLockResponse::dump_to(std::string &out) const {
4763  __attribute__((unused)) char buffer[64];
4764  out.append("ListEntitiesLockResponse {\n");
4765  out.append(" object_id: ");
4766  out.append("'").append(this->object_id).append("'");
4767  out.append("\n");
4768 
4769  out.append(" key: ");
4770  sprintf(buffer, "%" PRIu32, this->key);
4771  out.append(buffer);
4772  out.append("\n");
4773 
4774  out.append(" name: ");
4775  out.append("'").append(this->name).append("'");
4776  out.append("\n");
4777 
4778  out.append(" unique_id: ");
4779  out.append("'").append(this->unique_id).append("'");
4780  out.append("\n");
4781 
4782  out.append(" icon: ");
4783  out.append("'").append(this->icon).append("'");
4784  out.append("\n");
4785 
4786  out.append(" disabled_by_default: ");
4787  out.append(YESNO(this->disabled_by_default));
4788  out.append("\n");
4789 
4790  out.append(" entity_category: ");
4791  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
4792  out.append("\n");
4793 
4794  out.append(" assumed_state: ");
4795  out.append(YESNO(this->assumed_state));
4796  out.append("\n");
4797 
4798  out.append(" supports_open: ");
4799  out.append(YESNO(this->supports_open));
4800  out.append("\n");
4801 
4802  out.append(" requires_code: ");
4803  out.append(YESNO(this->requires_code));
4804  out.append("\n");
4805 
4806  out.append(" code_format: ");
4807  out.append("'").append(this->code_format).append("'");
4808  out.append("\n");
4809  out.append("}");
4810 }
4811 #endif
4812 bool LockStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
4813  switch (field_id) {
4814  case 2: {
4815  this->state = value.as_enum<enums::LockState>();
4816  return true;
4817  }
4818  default:
4819  return false;
4820  }
4821 }
4822 bool LockStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
4823  switch (field_id) {
4824  case 1: {
4825  this->key = value.as_fixed32();
4826  return true;
4827  }
4828  default:
4829  return false;
4830  }
4831 }
4833  buffer.encode_fixed32(1, this->key);
4834  buffer.encode_enum<enums::LockState>(2, this->state);
4835 }
4836 #ifdef HAS_PROTO_MESSAGE_DUMP
4837 void LockStateResponse::dump_to(std::string &out) const {
4838  __attribute__((unused)) char buffer[64];
4839  out.append("LockStateResponse {\n");
4840  out.append(" key: ");
4841  sprintf(buffer, "%" PRIu32, this->key);
4842  out.append(buffer);
4843  out.append("\n");
4844 
4845  out.append(" state: ");
4846  out.append(proto_enum_to_string<enums::LockState>(this->state));
4847  out.append("\n");
4848  out.append("}");
4849 }
4850 #endif
4851 bool LockCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
4852  switch (field_id) {
4853  case 2: {
4854  this->command = value.as_enum<enums::LockCommand>();
4855  return true;
4856  }
4857  case 3: {
4858  this->has_code = value.as_bool();
4859  return true;
4860  }
4861  default:
4862  return false;
4863  }
4864 }
4866  switch (field_id) {
4867  case 4: {
4868  this->code = value.as_string();
4869  return true;
4870  }
4871  default:
4872  return false;
4873  }
4874 }
4875 bool LockCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
4876  switch (field_id) {
4877  case 1: {
4878  this->key = value.as_fixed32();
4879  return true;
4880  }
4881  default:
4882  return false;
4883  }
4884 }
4886  buffer.encode_fixed32(1, this->key);
4887  buffer.encode_enum<enums::LockCommand>(2, this->command);
4888  buffer.encode_bool(3, this->has_code);
4889  buffer.encode_string(4, this->code);
4890 }
4891 #ifdef HAS_PROTO_MESSAGE_DUMP
4892 void LockCommandRequest::dump_to(std::string &out) const {
4893  __attribute__((unused)) char buffer[64];
4894  out.append("LockCommandRequest {\n");
4895  out.append(" key: ");
4896  sprintf(buffer, "%" PRIu32, this->key);
4897  out.append(buffer);
4898  out.append("\n");
4899 
4900  out.append(" command: ");
4901  out.append(proto_enum_to_string<enums::LockCommand>(this->command));
4902  out.append("\n");
4903 
4904  out.append(" has_code: ");
4905  out.append(YESNO(this->has_code));
4906  out.append("\n");
4907 
4908  out.append(" code: ");
4909  out.append("'").append(this->code).append("'");
4910  out.append("\n");
4911  out.append("}");
4912 }
4913 #endif
4915  switch (field_id) {
4916  case 6: {
4917  this->disabled_by_default = value.as_bool();
4918  return true;
4919  }
4920  case 7: {
4921  this->entity_category = value.as_enum<enums::EntityCategory>();
4922  return true;
4923  }
4924  default:
4925  return false;
4926  }
4927 }
4929  switch (field_id) {
4930  case 1: {
4931  this->object_id = value.as_string();
4932  return true;
4933  }
4934  case 3: {
4935  this->name = value.as_string();
4936  return true;
4937  }
4938  case 4: {
4939  this->unique_id = value.as_string();
4940  return true;
4941  }
4942  case 5: {
4943  this->icon = value.as_string();
4944  return true;
4945  }
4946  case 8: {
4947  this->device_class = value.as_string();
4948  return true;
4949  }
4950  default:
4951  return false;
4952  }
4953 }
4955  switch (field_id) {
4956  case 2: {
4957  this->key = value.as_fixed32();
4958  return true;
4959  }
4960  default:
4961  return false;
4962  }
4963 }
4965  buffer.encode_string(1, this->object_id);
4966  buffer.encode_fixed32(2, this->key);
4967  buffer.encode_string(3, this->name);
4968  buffer.encode_string(4, this->unique_id);
4969  buffer.encode_string(5, this->icon);
4970  buffer.encode_bool(6, this->disabled_by_default);
4971  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
4972  buffer.encode_string(8, this->device_class);
4973 }
4974 #ifdef HAS_PROTO_MESSAGE_DUMP
4975 void ListEntitiesButtonResponse::dump_to(std::string &out) const {
4976  __attribute__((unused)) char buffer[64];
4977  out.append("ListEntitiesButtonResponse {\n");
4978  out.append(" object_id: ");
4979  out.append("'").append(this->object_id).append("'");
4980  out.append("\n");
4981 
4982  out.append(" key: ");
4983  sprintf(buffer, "%" PRIu32, this->key);
4984  out.append(buffer);
4985  out.append("\n");
4986 
4987  out.append(" name: ");
4988  out.append("'").append(this->name).append("'");
4989  out.append("\n");
4990 
4991  out.append(" unique_id: ");
4992  out.append("'").append(this->unique_id).append("'");
4993  out.append("\n");
4994 
4995  out.append(" icon: ");
4996  out.append("'").append(this->icon).append("'");
4997  out.append("\n");
4998 
4999  out.append(" disabled_by_default: ");
5000  out.append(YESNO(this->disabled_by_default));
5001  out.append("\n");
5002 
5003  out.append(" entity_category: ");
5004  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
5005  out.append("\n");
5006 
5007  out.append(" device_class: ");
5008  out.append("'").append(this->device_class).append("'");
5009  out.append("\n");
5010  out.append("}");
5011 }
5012 #endif
5013 bool ButtonCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
5014  switch (field_id) {
5015  case 1: {
5016  this->key = value.as_fixed32();
5017  return true;
5018  }
5019  default:
5020  return false;
5021  }
5022 }
5023 void ButtonCommandRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_fixed32(1, this->key); }
5024 #ifdef HAS_PROTO_MESSAGE_DUMP
5025 void ButtonCommandRequest::dump_to(std::string &out) const {
5026  __attribute__((unused)) char buffer[64];
5027  out.append("ButtonCommandRequest {\n");
5028  out.append(" key: ");
5029  sprintf(buffer, "%" PRIu32, this->key);
5030  out.append(buffer);
5031  out.append("\n");
5032  out.append("}");
5033 }
5034 #endif
5036  switch (field_id) {
5037  case 6: {
5038  this->disabled_by_default = value.as_bool();
5039  return true;
5040  }
5041  case 7: {
5042  this->entity_category = value.as_enum<enums::EntityCategory>();
5043  return true;
5044  }
5045  case 8: {
5046  this->supports_pause = value.as_bool();
5047  return true;
5048  }
5049  default:
5050  return false;
5051  }
5052 }
5054  switch (field_id) {
5055  case 1: {
5056  this->object_id = value.as_string();
5057  return true;
5058  }
5059  case 3: {
5060  this->name = value.as_string();
5061  return true;
5062  }
5063  case 4: {
5064  this->unique_id = value.as_string();
5065  return true;
5066  }
5067  case 5: {
5068  this->icon = value.as_string();
5069  return true;
5070  }
5071  default:
5072  return false;
5073  }
5074 }
5076  switch (field_id) {
5077  case 2: {
5078  this->key = value.as_fixed32();
5079  return true;
5080  }
5081  default:
5082  return false;
5083  }
5084 }
5086  buffer.encode_string(1, this->object_id);
5087  buffer.encode_fixed32(2, this->key);
5088  buffer.encode_string(3, this->name);
5089  buffer.encode_string(4, this->unique_id);
5090  buffer.encode_string(5, this->icon);
5091  buffer.encode_bool(6, this->disabled_by_default);
5092  buffer.encode_enum<enums::EntityCategory>(7, this->entity_category);
5093  buffer.encode_bool(8, this->supports_pause);
5094 }
5095 #ifdef HAS_PROTO_MESSAGE_DUMP
5096 void ListEntitiesMediaPlayerResponse::dump_to(std::string &out) const {
5097  __attribute__((unused)) char buffer[64];
5098  out.append("ListEntitiesMediaPlayerResponse {\n");
5099  out.append(" object_id: ");
5100  out.append("'").append(this->object_id).append("'");
5101  out.append("\n");
5102 
5103  out.append(" key: ");
5104  sprintf(buffer, "%" PRIu32, this->key);
5105  out.append(buffer);
5106  out.append("\n");
5107 
5108  out.append(" name: ");
5109  out.append("'").append(this->name).append("'");
5110  out.append("\n");
5111 
5112  out.append(" unique_id: ");
5113  out.append("'").append(this->unique_id).append("'");
5114  out.append("\n");
5115 
5116  out.append(" icon: ");
5117  out.append("'").append(this->icon).append("'");
5118  out.append("\n");
5119 
5120  out.append(" disabled_by_default: ");
5121  out.append(YESNO(this->disabled_by_default));
5122  out.append("\n");
5123 
5124  out.append(" entity_category: ");
5125  out.append(proto_enum_to_string<enums::EntityCategory>(this->entity_category));
5126  out.append("\n");
5127 
5128  out.append(" supports_pause: ");
5129  out.append(YESNO(this->supports_pause));
5130  out.append("\n");
5131  out.append("}");
5132 }
5133 #endif
5135  switch (field_id) {
5136  case 2: {
5137  this->state = value.as_enum<enums::MediaPlayerState>();
5138  return true;
5139  }
5140  case 4: {
5141  this->muted = value.as_bool();
5142  return true;
5143  }
5144  default:
5145  return false;
5146  }
5147 }
5148 bool MediaPlayerStateResponse::decode_32bit(uint32_t field_id, Proto32Bit value) {
5149  switch (field_id) {
5150  case 1: {
5151  this->key = value.as_fixed32();
5152  return true;
5153  }
5154  case 3: {
5155  this->volume = value.as_float();
5156  return true;
5157  }
5158  default:
5159  return false;
5160  }
5161 }
5163  buffer.encode_fixed32(1, this->key);
5164  buffer.encode_enum<enums::MediaPlayerState>(2, this->state);
5165  buffer.encode_float(3, this->volume);
5166  buffer.encode_bool(4, this->muted);
5167 }
5168 #ifdef HAS_PROTO_MESSAGE_DUMP
5169 void MediaPlayerStateResponse::dump_to(std::string &out) const {
5170  __attribute__((unused)) char buffer[64];
5171  out.append("MediaPlayerStateResponse {\n");
5172  out.append(" key: ");
5173  sprintf(buffer, "%" PRIu32, this->key);
5174  out.append(buffer);
5175  out.append("\n");
5176 
5177  out.append(" state: ");
5178  out.append(proto_enum_to_string<enums::MediaPlayerState>(this->state));
5179  out.append("\n");
5180 
5181  out.append(" volume: ");
5182  sprintf(buffer, "%g", this->volume);
5183  out.append(buffer);
5184  out.append("\n");
5185 
5186  out.append(" muted: ");
5187  out.append(YESNO(this->muted));
5188  out.append("\n");
5189  out.append("}");
5190 }
5191 #endif
5193  switch (field_id) {
5194  case 2: {
5195  this->has_command = value.as_bool();
5196  return true;
5197  }
5198  case 3: {
5199  this->command = value.as_enum<enums::MediaPlayerCommand>();
5200  return true;
5201  }
5202  case 4: {
5203  this->has_volume = value.as_bool();
5204  return true;
5205  }
5206  case 6: {
5207  this->has_media_url = value.as_bool();
5208  return true;
5209  }
5210  default:
5211  return false;
5212  }
5213 }
5215  switch (field_id) {
5216  case 7: {
5217  this->media_url = value.as_string();
5218  return true;
5219  }
5220  default:
5221  return false;
5222  }
5223 }
5224 bool MediaPlayerCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
5225  switch (field_id) {
5226  case 1: {
5227  this->key = value.as_fixed32();
5228  return true;
5229  }
5230  case 5: {
5231  this->volume = value.as_float();
5232  return true;
5233  }
5234  default:
5235  return false;
5236  }
5237 }
5239  buffer.encode_fixed32(1, this->key);
5240  buffer.encode_bool(2, this->has_command);
5241  buffer.encode_enum<enums::MediaPlayerCommand>(3, this->command);
5242  buffer.encode_bool(4, this->has_volume);
5243  buffer.encode_float(5, this->volume);
5244  buffer.encode_bool(6, this->has_media_url);
5245  buffer.encode_string(7, this->media_url);
5246 }
5247 #ifdef HAS_PROTO_MESSAGE_DUMP
5248 void MediaPlayerCommandRequest::dump_to(std::string &out) const {
5249  __attribute__((unused)) char buffer[64];
5250  out.append("MediaPlayerCommandRequest {\n");
5251  out.append(" key: ");
5252  sprintf(buffer, "%" PRIu32, this->key);
5253  out.append(buffer);
5254  out.append("\n");
5255 
5256  out.append(" has_command: ");
5257  out.append(YESNO(this->has_command));
5258  out.append("\n");
5259 
5260  out.append(" command: ");
5261  out.append(proto_enum_to_string<enums::MediaPlayerCommand>(this->command));
5262  out.append("\n");
5263 
5264  out.append(" has_volume: ");
5265  out.append(YESNO(this->has_volume));
5266  out.append("\n");
5267 
5268  out.append(" volume: ");
5269  sprintf(buffer, "%g", this->volume);
5270  out.append(buffer);
5271  out.append("\n");
5272 
5273  out.append(" has_media_url: ");
5274  out.append(YESNO(this->has_media_url));
5275  out.append("\n");
5276 
5277  out.append(" media_url: ");
5278  out.append("'").append(this->media_url).append("'");
5279  out.append("\n");
5280  out.append("}");
5281 }
5282 #endif
5284  switch (field_id) {
5285  case 1: {
5286  this->flags = value.as_uint32();
5287  return true;
5288  }
5289  default:
5290  return false;
5291  }
5292 }
5294  buffer.encode_uint32(1, this->flags);
5295 }
5296 #ifdef HAS_PROTO_MESSAGE_DUMP
5298  __attribute__((unused)) char buffer[64];
5299  out.append("SubscribeBluetoothLEAdvertisementsRequest {\n");
5300  out.append(" flags: ");
5301  sprintf(buffer, "%" PRIu32, this->flags);
5302  out.append(buffer);
5303  out.append("\n");
5304  out.append("}");
5305 }
5306 #endif
5307 bool BluetoothServiceData::decode_varint(uint32_t field_id, ProtoVarInt value) {
5308  switch (field_id) {
5309  case 2: {
5310  this->legacy_data.push_back(value.as_uint32());
5311  return true;
5312  }
5313  default:
5314  return false;
5315  }
5316 }
5318  switch (field_id) {
5319  case 1: {
5320  this->uuid = value.as_string();
5321  return true;
5322  }
5323  case 3: {
5324  this->data = value.as_string();
5325  return true;
5326  }
5327  default:
5328  return false;
5329  }
5330 }
5332  buffer.encode_string(1, this->uuid);
5333  for (auto &it : this->legacy_data) {
5334  buffer.encode_uint32(2, it, true);
5335  }
5336  buffer.encode_string(3, this->data);
5337 }
5338 #ifdef HAS_PROTO_MESSAGE_DUMP
5339 void BluetoothServiceData::dump_to(std::string &out) const {
5340  __attribute__((unused)) char buffer[64];
5341  out.append("BluetoothServiceData {\n");
5342  out.append(" uuid: ");
5343  out.append("'").append(this->uuid).append("'");
5344  out.append("\n");
5345 
5346  for (const auto &it : this->legacy_data) {
5347  out.append(" legacy_data: ");
5348  sprintf(buffer, "%" PRIu32, it);
5349  out.append(buffer);
5350  out.append("\n");
5351  }
5352 
5353  out.append(" data: ");
5354  out.append("'").append(this->data).append("'");
5355  out.append("\n");
5356  out.append("}");
5357 }
5358 #endif
5360  switch (field_id) {
5361  case 1: {
5362  this->address = value.as_uint64();
5363  return true;
5364  }
5365  case 3: {
5366  this->rssi = value.as_sint32();
5367  return true;
5368  }
5369  case 7: {
5370  this->address_type = value.as_uint32();
5371  return true;
5372  }
5373  default:
5374  return false;
5375  }
5376 }
5378  switch (field_id) {
5379  case 2: {
5380  this->name = value.as_string();
5381  return true;
5382  }
5383  case 4: {
5384  this->service_uuids.push_back(value.as_string());
5385  return true;
5386  }
5387  case 5: {
5388  this->service_data.push_back(value.as_message<BluetoothServiceData>());
5389  return true;
5390  }
5391  case 6: {
5392  this->manufacturer_data.push_back(value.as_message<BluetoothServiceData>());
5393  return true;
5394  }
5395  default:
5396  return false;
5397  }
5398 }
5400  buffer.encode_uint64(1, this->address);
5401  buffer.encode_string(2, this->name);
5402  buffer.encode_sint32(3, this->rssi);
5403  for (auto &it : this->service_uuids) {
5404  buffer.encode_string(4, it, true);
5405  }
5406  for (auto &it : this->service_data) {
5407  buffer.encode_message<BluetoothServiceData>(5, it, true);
5408  }
5409  for (auto &it : this->manufacturer_data) {
5410  buffer.encode_message<BluetoothServiceData>(6, it, true);
5411  }
5412  buffer.encode_uint32(7, this->address_type);
5413 }
5414 #ifdef HAS_PROTO_MESSAGE_DUMP
5415 void BluetoothLEAdvertisementResponse::dump_to(std::string &out) const {
5416  __attribute__((unused)) char buffer[64];
5417  out.append("BluetoothLEAdvertisementResponse {\n");
5418  out.append(" address: ");
5419  sprintf(buffer, "%llu", this->address);
5420  out.append(buffer);
5421  out.append("\n");
5422 
5423  out.append(" name: ");
5424  out.append("'").append(this->name).append("'");
5425  out.append("\n");
5426 
5427  out.append(" rssi: ");
5428  sprintf(buffer, "%" PRId32, this->rssi);
5429  out.append(buffer);
5430  out.append("\n");
5431 
5432  for (const auto &it : this->service_uuids) {
5433  out.append(" service_uuids: ");
5434  out.append("'").append(it).append("'");
5435  out.append("\n");
5436  }
5437 
5438  for (const auto &it : this->service_data) {
5439  out.append(" service_data: ");
5440  it.dump_to(out);
5441  out.append("\n");
5442  }
5443 
5444  for (const auto &it : this->manufacturer_data) {
5445  out.append(" manufacturer_data: ");
5446  it.dump_to(out);
5447  out.append("\n");
5448  }
5449 
5450  out.append(" address_type: ");
5451  sprintf(buffer, "%" PRIu32, this->address_type);
5452  out.append(buffer);
5453  out.append("\n");
5454  out.append("}");
5455 }
5456 #endif
5458  switch (field_id) {
5459  case 1: {
5460  this->address = value.as_uint64();
5461  return true;
5462  }
5463  case 2: {
5464  this->rssi = value.as_sint32();
5465  return true;
5466  }
5467  case 3: {
5468  this->address_type = value.as_uint32();
5469  return true;
5470  }
5471  default:
5472  return false;
5473  }
5474 }
5476  switch (field_id) {
5477  case 4: {
5478  this->data = value.as_string();
5479  return true;
5480  }
5481  default:
5482  return false;
5483  }
5484 }
5486  buffer.encode_uint64(1, this->address);
5487  buffer.encode_sint32(2, this->rssi);
5488  buffer.encode_uint32(3, this->address_type);
5489  buffer.encode_string(4, this->data);
5490 }
5491 #ifdef HAS_PROTO_MESSAGE_DUMP
5492 void BluetoothLERawAdvertisement::dump_to(std::string &out) const {
5493  __attribute__((unused)) char buffer[64];
5494  out.append("BluetoothLERawAdvertisement {\n");
5495  out.append(" address: ");
5496  sprintf(buffer, "%llu", this->address);
5497  out.append(buffer);
5498  out.append("\n");
5499 
5500  out.append(" rssi: ");
5501  sprintf(buffer, "%" PRId32, this->rssi);
5502  out.append(buffer);
5503  out.append("\n");
5504 
5505  out.append(" address_type: ");
5506  sprintf(buffer, "%" PRIu32, this->address_type);
5507  out.append(buffer);
5508  out.append("\n");
5509 
5510  out.append(" data: ");
5511  out.append("'").append(this->data).append("'");
5512  out.append("\n");
5513  out.append("}");
5514 }
5515 #endif
5517  switch (field_id) {
5518  case 1: {
5519  this->advertisements.push_back(value.as_message<BluetoothLERawAdvertisement>());
5520  return true;
5521  }
5522  default:
5523  return false;
5524  }
5525 }
5527  for (auto &it : this->advertisements) {
5528  buffer.encode_message<BluetoothLERawAdvertisement>(1, it, true);
5529  }
5530 }
5531 #ifdef HAS_PROTO_MESSAGE_DUMP
5533  __attribute__((unused)) char buffer[64];
5534  out.append("BluetoothLERawAdvertisementsResponse {\n");
5535  for (const auto &it : this->advertisements) {
5536  out.append(" advertisements: ");
5537  it.dump_to(out);
5538  out.append("\n");
5539  }
5540  out.append("}");
5541 }
5542 #endif
5543 bool BluetoothDeviceRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
5544  switch (field_id) {
5545  case 1: {
5546  this->address = value.as_uint64();
5547  return true;
5548  }
5549  case 2: {
5550  this->request_type = value.as_enum<enums::BluetoothDeviceRequestType>();
5551  return true;
5552  }
5553  case 3: {
5554  this->has_address_type = value.as_bool();
5555  return true;
5556  }
5557  case 4: {
5558  this->address_type = value.as_uint32();
5559  return true;
5560  }
5561  default:
5562  return false;
5563  }
5564 }
5566  buffer.encode_uint64(1, this->address);
5567  buffer.encode_enum<enums::BluetoothDeviceRequestType>(2, this->request_type);
5568  buffer.encode_bool(3, this->has_address_type);
5569  buffer.encode_uint32(4, this->address_type);
5570 }
5571 #ifdef HAS_PROTO_MESSAGE_DUMP
5572 void BluetoothDeviceRequest::dump_to(std::string &out) const {
5573  __attribute__((unused)) char buffer[64];
5574  out.append("BluetoothDeviceRequest {\n");
5575  out.append(" address: ");
5576  sprintf(buffer, "%llu", this->address);
5577  out.append(buffer);
5578  out.append("\n");
5579 
5580  out.append(" request_type: ");
5581  out.append(proto_enum_to_string<enums::BluetoothDeviceRequestType>(this->request_type));
5582  out.append("\n");
5583 
5584  out.append(" has_address_type: ");
5585  out.append(YESNO(this->has_address_type));
5586  out.append("\n");
5587 
5588  out.append(" address_type: ");
5589  sprintf(buffer, "%" PRIu32, this->address_type);
5590  out.append(buffer);
5591  out.append("\n");
5592  out.append("}");
5593 }
5594 #endif
5596  switch (field_id) {
5597  case 1: {
5598  this->address = value.as_uint64();
5599  return true;
5600  }
5601  case 2: {
5602  this->connected = value.as_bool();
5603  return true;
5604  }
5605  case 3: {
5606  this->mtu = value.as_uint32();
5607  return true;
5608  }
5609  case 4: {
5610  this->error = value.as_int32();
5611  return true;
5612  }
5613  default:
5614  return false;
5615  }
5616 }
5618  buffer.encode_uint64(1, this->address);
5619  buffer.encode_bool(2, this->connected);
5620  buffer.encode_uint32(3, this->mtu);
5621  buffer.encode_int32(4, this->error);
5622 }
5623 #ifdef HAS_PROTO_MESSAGE_DUMP
5624 void BluetoothDeviceConnectionResponse::dump_to(std::string &out) const {
5625  __attribute__((unused)) char buffer[64];
5626  out.append("BluetoothDeviceConnectionResponse {\n");
5627  out.append(" address: ");
5628  sprintf(buffer, "%llu", this->address);
5629  out.append(buffer);
5630  out.append("\n");
5631 
5632  out.append(" connected: ");
5633  out.append(YESNO(this->connected));
5634  out.append("\n");
5635 
5636  out.append(" mtu: ");
5637  sprintf(buffer, "%" PRIu32, this->mtu);
5638  out.append(buffer);
5639  out.append("\n");
5640 
5641  out.append(" error: ");
5642  sprintf(buffer, "%" PRId32, this->error);
5643  out.append(buffer);
5644  out.append("\n");
5645  out.append("}");
5646 }
5647 #endif
5649  switch (field_id) {
5650  case 1: {
5651  this->address = value.as_uint64();
5652  return true;
5653  }
5654  default:
5655  return false;
5656  }
5657 }
5658 void BluetoothGATTGetServicesRequest::encode(ProtoWriteBuffer buffer) const { buffer.encode_uint64(1, this->address); }
5659 #ifdef HAS_PROTO_MESSAGE_DUMP
5660 void BluetoothGATTGetServicesRequest::dump_to(std::string &out) const {
5661  __attribute__((unused)) char buffer[64];
5662  out.append("BluetoothGATTGetServicesRequest {\n");
5663  out.append(" address: ");
5664  sprintf(buffer, "%llu", this->address);
5665  out.append(buffer);
5666  out.append("\n");
5667  out.append("}");
5668 }
5669 #endif
5670 bool BluetoothGATTDescriptor::decode_varint(uint32_t field_id, ProtoVarInt value) {
5671  switch (field_id) {
5672  case 1: {
5673  this->uuid.push_back(value.as_uint64());
5674  return true;
5675  }
5676  case 2: {
5677  this->handle = value.as_uint32();
5678  return true;
5679  }
5680  default:
5681  return false;
5682  }
5683 }
5685  for (auto &it : this->uuid) {
5686  buffer.encode_uint64(1, it, true);
5687  }
5688  buffer.encode_uint32(2, this->handle);
5689 }
5690 #ifdef HAS_PROTO_MESSAGE_DUMP
5691 void BluetoothGATTDescriptor::dump_to(std::string &out) const {
5692  __attribute__((unused)) char buffer[64];
5693  out.append("BluetoothGATTDescriptor {\n");
5694  for (const auto &it : this->uuid) {
5695  out.append(" uuid: ");
5696  sprintf(buffer, "%llu", it);
5697  out.append(buffer);
5698  out.append("\n");
5699  }
5700 
5701  out.append(" handle: ");
5702  sprintf(buffer, "%" PRIu32, this->handle);
5703  out.append(buffer);
5704  out.append("\n");
5705  out.append("}");
5706 }
5707 #endif
5709  switch (field_id) {
5710  case 1: {
5711  this->uuid.push_back(value.as_uint64());
5712  return true;
5713  }
5714  case 2: {
5715  this->handle = value.as_uint32();
5716  return true;
5717  }
5718  case 3: {
5719  this->properties = value.as_uint32();
5720  return true;
5721  }
5722  default:
5723  return false;
5724  }
5725 }
5727  switch (field_id) {
5728  case 4: {
5729  this->descriptors.push_back(value.as_message<BluetoothGATTDescriptor>());
5730  return true;
5731  }
5732  default:
5733  return false;
5734  }
5735 }
5737  for (auto &it : this->uuid) {
5738  buffer.encode_uint64(1, it, true);
5739  }
5740  buffer.encode_uint32(2, this->handle);
5741  buffer.encode_uint32(3, this->properties);
5742  for (auto &it : this->descriptors) {
5743  buffer.encode_message<BluetoothGATTDescriptor>(4, it, true);
5744  }
5745 }
5746 #ifdef HAS_PROTO_MESSAGE_DUMP
5747 void BluetoothGATTCharacteristic::dump_to(std::string &out) const {
5748  __attribute__((unused)) char buffer[64];
5749  out.append("BluetoothGATTCharacteristic {\n");
5750  for (const auto &it : this->uuid) {
5751  out.append(" uuid: ");
5752  sprintf(buffer, "%llu", it);
5753  out.append(buffer);
5754  out.append("\n");
5755  }
5756 
5757  out.append(" handle: ");
5758  sprintf(buffer, "%" PRIu32, this->handle);
5759  out.append(buffer);
5760  out.append("\n");
5761 
5762  out.append(" properties: ");
5763  sprintf(buffer, "%" PRIu32, this->properties);
5764  out.append(buffer);
5765  out.append("\n");
5766 
5767  for (const auto &it : this->descriptors) {
5768  out.append(" descriptors: ");
5769  it.dump_to(out);
5770  out.append("\n");
5771  }
5772  out.append("}");
5773 }
5774 #endif
5775 bool BluetoothGATTService::decode_varint(uint32_t field_id, ProtoVarInt value) {
5776  switch (field_id) {
5777  case 1: {
5778  this->uuid.push_back(value.as_uint64());
5779  return true;
5780  }
5781  case 2: {
5782  this->handle = value.as_uint32();
5783  return true;
5784  }
5785  default:
5786  return false;
5787  }
5788 }
5790  switch (field_id) {
5791  case 3: {
5792  this->characteristics.push_back(value.as_message<BluetoothGATTCharacteristic>());
5793  return true;
5794  }
5795  default:
5796  return false;
5797  }
5798 }