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