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