ESPHome  2022.11.3
api_pb2_service.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_service.h"
4 #include "esphome/core/log.h"
5 
6 namespace esphome {
7 namespace api {
8 
9 static const char *const TAG = "api.service";
10 
12 #ifdef HAS_PROTO_MESSAGE_DUMP
13  ESP_LOGVV(TAG, "send_hello_response: %s", msg.dump().c_str());
14 #endif
15  return this->send_message_<HelloResponse>(msg, 2);
16 }
18 #ifdef HAS_PROTO_MESSAGE_DUMP
19  ESP_LOGVV(TAG, "send_connect_response: %s", msg.dump().c_str());
20 #endif
21  return this->send_message_<ConnectResponse>(msg, 4);
22 }
24 #ifdef HAS_PROTO_MESSAGE_DUMP
25  ESP_LOGVV(TAG, "send_disconnect_request: %s", msg.dump().c_str());
26 #endif
27  return this->send_message_<DisconnectRequest>(msg, 5);
28 }
30 #ifdef HAS_PROTO_MESSAGE_DUMP
31  ESP_LOGVV(TAG, "send_disconnect_response: %s", msg.dump().c_str());
32 #endif
33  return this->send_message_<DisconnectResponse>(msg, 6);
34 }
36 #ifdef HAS_PROTO_MESSAGE_DUMP
37  ESP_LOGVV(TAG, "send_ping_request: %s", msg.dump().c_str());
38 #endif
39  return this->send_message_<PingRequest>(msg, 7);
40 }
42 #ifdef HAS_PROTO_MESSAGE_DUMP
43  ESP_LOGVV(TAG, "send_ping_response: %s", msg.dump().c_str());
44 #endif
45  return this->send_message_<PingResponse>(msg, 8);
46 }
48 #ifdef HAS_PROTO_MESSAGE_DUMP
49  ESP_LOGVV(TAG, "send_device_info_response: %s", msg.dump().c_str());
50 #endif
51  return this->send_message_<DeviceInfoResponse>(msg, 10);
52 }
54 #ifdef HAS_PROTO_MESSAGE_DUMP
55  ESP_LOGVV(TAG, "send_list_entities_done_response: %s", msg.dump().c_str());
56 #endif
57  return this->send_message_<ListEntitiesDoneResponse>(msg, 19);
58 }
59 #ifdef USE_BINARY_SENSOR
61 #ifdef HAS_PROTO_MESSAGE_DUMP
62  ESP_LOGVV(TAG, "send_list_entities_binary_sensor_response: %s", msg.dump().c_str());
63 #endif
64  return this->send_message_<ListEntitiesBinarySensorResponse>(msg, 12);
65 }
66 #endif
67 #ifdef USE_BINARY_SENSOR
69 #ifdef HAS_PROTO_MESSAGE_DUMP
70  ESP_LOGVV(TAG, "send_binary_sensor_state_response: %s", msg.dump().c_str());
71 #endif
72  return this->send_message_<BinarySensorStateResponse>(msg, 21);
73 }
74 #endif
75 #ifdef USE_COVER
77 #ifdef HAS_PROTO_MESSAGE_DUMP
78  ESP_LOGVV(TAG, "send_list_entities_cover_response: %s", msg.dump().c_str());
79 #endif
80  return this->send_message_<ListEntitiesCoverResponse>(msg, 13);
81 }
82 #endif
83 #ifdef USE_COVER
85 #ifdef HAS_PROTO_MESSAGE_DUMP
86  ESP_LOGVV(TAG, "send_cover_state_response: %s", msg.dump().c_str());
87 #endif
88  return this->send_message_<CoverStateResponse>(msg, 22);
89 }
90 #endif
91 #ifdef USE_COVER
92 #endif
93 #ifdef USE_FAN
95 #ifdef HAS_PROTO_MESSAGE_DUMP
96  ESP_LOGVV(TAG, "send_list_entities_fan_response: %s", msg.dump().c_str());
97 #endif
98  return this->send_message_<ListEntitiesFanResponse>(msg, 14);
99 }
100 #endif
101 #ifdef USE_FAN
103 #ifdef HAS_PROTO_MESSAGE_DUMP
104  ESP_LOGVV(TAG, "send_fan_state_response: %s", msg.dump().c_str());
105 #endif
106  return this->send_message_<FanStateResponse>(msg, 23);
107 }
108 #endif
109 #ifdef USE_FAN
110 #endif
111 #ifdef USE_LIGHT
113 #ifdef HAS_PROTO_MESSAGE_DUMP
114  ESP_LOGVV(TAG, "send_list_entities_light_response: %s", msg.dump().c_str());
115 #endif
116  return this->send_message_<ListEntitiesLightResponse>(msg, 15);
117 }
118 #endif
119 #ifdef USE_LIGHT
121 #ifdef HAS_PROTO_MESSAGE_DUMP
122  ESP_LOGVV(TAG, "send_light_state_response: %s", msg.dump().c_str());
123 #endif
124  return this->send_message_<LightStateResponse>(msg, 24);
125 }
126 #endif
127 #ifdef USE_LIGHT
128 #endif
129 #ifdef USE_SENSOR
131 #ifdef HAS_PROTO_MESSAGE_DUMP
132  ESP_LOGVV(TAG, "send_list_entities_sensor_response: %s", msg.dump().c_str());
133 #endif
134  return this->send_message_<ListEntitiesSensorResponse>(msg, 16);
135 }
136 #endif
137 #ifdef USE_SENSOR
139 #ifdef HAS_PROTO_MESSAGE_DUMP
140  ESP_LOGVV(TAG, "send_sensor_state_response: %s", msg.dump().c_str());
141 #endif
142  return this->send_message_<SensorStateResponse>(msg, 25);
143 }
144 #endif
145 #ifdef USE_SWITCH
147 #ifdef HAS_PROTO_MESSAGE_DUMP
148  ESP_LOGVV(TAG, "send_list_entities_switch_response: %s", msg.dump().c_str());
149 #endif
150  return this->send_message_<ListEntitiesSwitchResponse>(msg, 17);
151 }
152 #endif
153 #ifdef USE_SWITCH
155 #ifdef HAS_PROTO_MESSAGE_DUMP
156  ESP_LOGVV(TAG, "send_switch_state_response: %s", msg.dump().c_str());
157 #endif
158  return this->send_message_<SwitchStateResponse>(msg, 26);
159 }
160 #endif
161 #ifdef USE_SWITCH
162 #endif
163 #ifdef USE_TEXT_SENSOR
165 #ifdef HAS_PROTO_MESSAGE_DUMP
166  ESP_LOGVV(TAG, "send_list_entities_text_sensor_response: %s", msg.dump().c_str());
167 #endif
168  return this->send_message_<ListEntitiesTextSensorResponse>(msg, 18);
169 }
170 #endif
171 #ifdef USE_TEXT_SENSOR
173 #ifdef HAS_PROTO_MESSAGE_DUMP
174  ESP_LOGVV(TAG, "send_text_sensor_state_response: %s", msg.dump().c_str());
175 #endif
176  return this->send_message_<TextSensorStateResponse>(msg, 27);
177 }
178 #endif
180  return this->send_message_<SubscribeLogsResponse>(msg, 29);
181 }
183 #ifdef HAS_PROTO_MESSAGE_DUMP
184  ESP_LOGVV(TAG, "send_homeassistant_service_response: %s", msg.dump().c_str());
185 #endif
186  return this->send_message_<HomeassistantServiceResponse>(msg, 35);
187 }
190 #ifdef HAS_PROTO_MESSAGE_DUMP
191  ESP_LOGVV(TAG, "send_subscribe_home_assistant_state_response: %s", msg.dump().c_str());
192 #endif
193  return this->send_message_<SubscribeHomeAssistantStateResponse>(msg, 39);
194 }
196 #ifdef HAS_PROTO_MESSAGE_DUMP
197  ESP_LOGVV(TAG, "send_get_time_request: %s", msg.dump().c_str());
198 #endif
199  return this->send_message_<GetTimeRequest>(msg, 36);
200 }
202 #ifdef HAS_PROTO_MESSAGE_DUMP
203  ESP_LOGVV(TAG, "send_get_time_response: %s", msg.dump().c_str());
204 #endif
205  return this->send_message_<GetTimeResponse>(msg, 37);
206 }
208 #ifdef HAS_PROTO_MESSAGE_DUMP
209  ESP_LOGVV(TAG, "send_list_entities_services_response: %s", msg.dump().c_str());
210 #endif
211  return this->send_message_<ListEntitiesServicesResponse>(msg, 41);
212 }
213 #ifdef USE_ESP32_CAMERA
215 #ifdef HAS_PROTO_MESSAGE_DUMP
216  ESP_LOGVV(TAG, "send_list_entities_camera_response: %s", msg.dump().c_str());
217 #endif
218  return this->send_message_<ListEntitiesCameraResponse>(msg, 43);
219 }
220 #endif
221 #ifdef USE_ESP32_CAMERA
223 #ifdef HAS_PROTO_MESSAGE_DUMP
224  ESP_LOGVV(TAG, "send_camera_image_response: %s", msg.dump().c_str());
225 #endif
226  return this->send_message_<CameraImageResponse>(msg, 44);
227 }
228 #endif
229 #ifdef USE_ESP32_CAMERA
230 #endif
231 #ifdef USE_CLIMATE
233 #ifdef HAS_PROTO_MESSAGE_DUMP
234  ESP_LOGVV(TAG, "send_list_entities_climate_response: %s", msg.dump().c_str());
235 #endif
236  return this->send_message_<ListEntitiesClimateResponse>(msg, 46);
237 }
238 #endif
239 #ifdef USE_CLIMATE
241 #ifdef HAS_PROTO_MESSAGE_DUMP
242  ESP_LOGVV(TAG, "send_climate_state_response: %s", msg.dump().c_str());
243 #endif
244  return this->send_message_<ClimateStateResponse>(msg, 47);
245 }
246 #endif
247 #ifdef USE_CLIMATE
248 #endif
249 #ifdef USE_NUMBER
251 #ifdef HAS_PROTO_MESSAGE_DUMP
252  ESP_LOGVV(TAG, "send_list_entities_number_response: %s", msg.dump().c_str());
253 #endif
254  return this->send_message_<ListEntitiesNumberResponse>(msg, 49);
255 }
256 #endif
257 #ifdef USE_NUMBER
259 #ifdef HAS_PROTO_MESSAGE_DUMP
260  ESP_LOGVV(TAG, "send_number_state_response: %s", msg.dump().c_str());
261 #endif
262  return this->send_message_<NumberStateResponse>(msg, 50);
263 }
264 #endif
265 #ifdef USE_NUMBER
266 #endif
267 #ifdef USE_SELECT
269 #ifdef HAS_PROTO_MESSAGE_DUMP
270  ESP_LOGVV(TAG, "send_list_entities_select_response: %s", msg.dump().c_str());
271 #endif
272  return this->send_message_<ListEntitiesSelectResponse>(msg, 52);
273 }
274 #endif
275 #ifdef USE_SELECT
277 #ifdef HAS_PROTO_MESSAGE_DUMP
278  ESP_LOGVV(TAG, "send_select_state_response: %s", msg.dump().c_str());
279 #endif
280  return this->send_message_<SelectStateResponse>(msg, 53);
281 }
282 #endif
283 #ifdef USE_SELECT
284 #endif
285 #ifdef USE_LOCK
287 #ifdef HAS_PROTO_MESSAGE_DUMP
288  ESP_LOGVV(TAG, "send_list_entities_lock_response: %s", msg.dump().c_str());
289 #endif
290  return this->send_message_<ListEntitiesLockResponse>(msg, 58);
291 }
292 #endif
293 #ifdef USE_LOCK
295 #ifdef HAS_PROTO_MESSAGE_DUMP
296  ESP_LOGVV(TAG, "send_lock_state_response: %s", msg.dump().c_str());
297 #endif
298  return this->send_message_<LockStateResponse>(msg, 59);
299 }
300 #endif
301 #ifdef USE_LOCK
302 #endif
303 #ifdef USE_BUTTON
305 #ifdef HAS_PROTO_MESSAGE_DUMP
306  ESP_LOGVV(TAG, "send_list_entities_button_response: %s", msg.dump().c_str());
307 #endif
308  return this->send_message_<ListEntitiesButtonResponse>(msg, 61);
309 }
310 #endif
311 #ifdef USE_BUTTON
312 #endif
313 #ifdef USE_MEDIA_PLAYER
315 #ifdef HAS_PROTO_MESSAGE_DUMP
316  ESP_LOGVV(TAG, "send_list_entities_media_player_response: %s", msg.dump().c_str());
317 #endif
318  return this->send_message_<ListEntitiesMediaPlayerResponse>(msg, 63);
319 }
320 #endif
321 #ifdef USE_MEDIA_PLAYER
323 #ifdef HAS_PROTO_MESSAGE_DUMP
324  ESP_LOGVV(TAG, "send_media_player_state_response: %s", msg.dump().c_str());
325 #endif
326  return this->send_message_<MediaPlayerStateResponse>(msg, 64);
327 }
328 #endif
329 #ifdef USE_MEDIA_PLAYER
330 #endif
331 #ifdef USE_BLUETOOTH_PROXY
333 #ifdef HAS_PROTO_MESSAGE_DUMP
334  ESP_LOGVV(TAG, "send_bluetooth_le_advertisement_response: %s", msg.dump().c_str());
335 #endif
336  return this->send_message_<BluetoothLEAdvertisementResponse>(msg, 67);
337 }
338 #endif
339 #ifdef USE_BLUETOOTH_PROXY
340 #endif
341 #ifdef USE_BLUETOOTH_PROXY
343 #ifdef HAS_PROTO_MESSAGE_DUMP
344  ESP_LOGVV(TAG, "send_bluetooth_device_connection_response: %s", msg.dump().c_str());
345 #endif
346  return this->send_message_<BluetoothDeviceConnectionResponse>(msg, 69);
347 }
348 #endif
349 #ifdef USE_BLUETOOTH_PROXY
350 #endif
351 #ifdef USE_BLUETOOTH_PROXY
353 #ifdef HAS_PROTO_MESSAGE_DUMP
354  ESP_LOGVV(TAG, "send_bluetooth_gatt_get_services_response: %s", msg.dump().c_str());
355 #endif
356  return this->send_message_<BluetoothGATTGetServicesResponse>(msg, 71);
357 }
358 #endif
359 #ifdef USE_BLUETOOTH_PROXY
362 #ifdef HAS_PROTO_MESSAGE_DUMP
363  ESP_LOGVV(TAG, "send_bluetooth_gatt_get_services_done_response: %s", msg.dump().c_str());
364 #endif
365  return this->send_message_<BluetoothGATTGetServicesDoneResponse>(msg, 72);
366 }
367 #endif
368 #ifdef USE_BLUETOOTH_PROXY
369 #endif
370 #ifdef USE_BLUETOOTH_PROXY
372 #ifdef HAS_PROTO_MESSAGE_DUMP
373  ESP_LOGVV(TAG, "send_bluetooth_gatt_read_response: %s", msg.dump().c_str());
374 #endif
375  return this->send_message_<BluetoothGATTReadResponse>(msg, 74);
376 }
377 #endif
378 #ifdef USE_BLUETOOTH_PROXY
379 #endif
380 #ifdef USE_BLUETOOTH_PROXY
381 #endif
382 #ifdef USE_BLUETOOTH_PROXY
383 #endif
384 #ifdef USE_BLUETOOTH_PROXY
385 #endif
386 #ifdef USE_BLUETOOTH_PROXY
388 #ifdef HAS_PROTO_MESSAGE_DUMP
389  ESP_LOGVV(TAG, "send_bluetooth_gatt_notify_data_response: %s", msg.dump().c_str());
390 #endif
391  return this->send_message_<BluetoothGATTNotifyDataResponse>(msg, 79);
392 }
393 #endif
394 #ifdef USE_BLUETOOTH_PROXY
395 #endif
396 #ifdef USE_BLUETOOTH_PROXY
398 #ifdef HAS_PROTO_MESSAGE_DUMP
399  ESP_LOGVV(TAG, "send_bluetooth_connections_free_response: %s", msg.dump().c_str());
400 #endif
401  return this->send_message_<BluetoothConnectionsFreeResponse>(msg, 81);
402 }
403 #endif
404 #ifdef USE_BLUETOOTH_PROXY
406 #ifdef HAS_PROTO_MESSAGE_DUMP
407  ESP_LOGVV(TAG, "send_bluetooth_gatt_error_response: %s", msg.dump().c_str());
408 #endif
409  return this->send_message_<BluetoothGATTErrorResponse>(msg, 82);
410 }
411 #endif
412 #ifdef USE_BLUETOOTH_PROXY
414 #ifdef HAS_PROTO_MESSAGE_DUMP
415  ESP_LOGVV(TAG, "send_bluetooth_gatt_write_response: %s", msg.dump().c_str());
416 #endif
417  return this->send_message_<BluetoothGATTWriteResponse>(msg, 83);
418 }
419 #endif
420 #ifdef USE_BLUETOOTH_PROXY
422 #ifdef HAS_PROTO_MESSAGE_DUMP
423  ESP_LOGVV(TAG, "send_bluetooth_gatt_notify_response: %s", msg.dump().c_str());
424 #endif
425  return this->send_message_<BluetoothGATTNotifyResponse>(msg, 84);
426 }
427 #endif
428 bool APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type, uint8_t *msg_data) {
429  switch (msg_type) {
430  case 1: {
431  HelloRequest msg;
432  msg.decode(msg_data, msg_size);
433 #ifdef HAS_PROTO_MESSAGE_DUMP
434  ESP_LOGVV(TAG, "on_hello_request: %s", msg.dump().c_str());
435 #endif
436  this->on_hello_request(msg);
437  break;
438  }
439  case 3: {
440  ConnectRequest msg;
441  msg.decode(msg_data, msg_size);
442 #ifdef HAS_PROTO_MESSAGE_DUMP
443  ESP_LOGVV(TAG, "on_connect_request: %s", msg.dump().c_str());
444 #endif
445  this->on_connect_request(msg);
446  break;
447  }
448  case 5: {
449  DisconnectRequest msg;
450  msg.decode(msg_data, msg_size);
451 #ifdef HAS_PROTO_MESSAGE_DUMP
452  ESP_LOGVV(TAG, "on_disconnect_request: %s", msg.dump().c_str());
453 #endif
454  this->on_disconnect_request(msg);
455  break;
456  }
457  case 6: {
458  DisconnectResponse msg;
459  msg.decode(msg_data, msg_size);
460 #ifdef HAS_PROTO_MESSAGE_DUMP
461  ESP_LOGVV(TAG, "on_disconnect_response: %s", msg.dump().c_str());
462 #endif
463  this->on_disconnect_response(msg);
464  break;
465  }
466  case 7: {
467  PingRequest msg;
468  msg.decode(msg_data, msg_size);
469 #ifdef HAS_PROTO_MESSAGE_DUMP
470  ESP_LOGVV(TAG, "on_ping_request: %s", msg.dump().c_str());
471 #endif
472  this->on_ping_request(msg);
473  break;
474  }
475  case 8: {
476  PingResponse msg;
477  msg.decode(msg_data, msg_size);
478 #ifdef HAS_PROTO_MESSAGE_DUMP
479  ESP_LOGVV(TAG, "on_ping_response: %s", msg.dump().c_str());
480 #endif
481  this->on_ping_response(msg);
482  break;
483  }
484  case 9: {
485  DeviceInfoRequest msg;
486  msg.decode(msg_data, msg_size);
487 #ifdef HAS_PROTO_MESSAGE_DUMP
488  ESP_LOGVV(TAG, "on_device_info_request: %s", msg.dump().c_str());
489 #endif
490  this->on_device_info_request(msg);
491  break;
492  }
493  case 11: {
495  msg.decode(msg_data, msg_size);
496 #ifdef HAS_PROTO_MESSAGE_DUMP
497  ESP_LOGVV(TAG, "on_list_entities_request: %s", msg.dump().c_str());
498 #endif
499  this->on_list_entities_request(msg);
500  break;
501  }
502  case 20: {
504  msg.decode(msg_data, msg_size);
505 #ifdef HAS_PROTO_MESSAGE_DUMP
506  ESP_LOGVV(TAG, "on_subscribe_states_request: %s", msg.dump().c_str());
507 #endif
508  this->on_subscribe_states_request(msg);
509  break;
510  }
511  case 28: {
513  msg.decode(msg_data, msg_size);
514 #ifdef HAS_PROTO_MESSAGE_DUMP
515  ESP_LOGVV(TAG, "on_subscribe_logs_request: %s", msg.dump().c_str());
516 #endif
517  this->on_subscribe_logs_request(msg);
518  break;
519  }
520  case 30: {
521 #ifdef USE_COVER
523  msg.decode(msg_data, msg_size);
524 #ifdef HAS_PROTO_MESSAGE_DUMP
525  ESP_LOGVV(TAG, "on_cover_command_request: %s", msg.dump().c_str());
526 #endif
527  this->on_cover_command_request(msg);
528 #endif
529  break;
530  }
531  case 31: {
532 #ifdef USE_FAN
533  FanCommandRequest msg;
534  msg.decode(msg_data, msg_size);
535 #ifdef HAS_PROTO_MESSAGE_DUMP
536  ESP_LOGVV(TAG, "on_fan_command_request: %s", msg.dump().c_str());
537 #endif
538  this->on_fan_command_request(msg);
539 #endif
540  break;
541  }
542  case 32: {
543 #ifdef USE_LIGHT
545  msg.decode(msg_data, msg_size);
546 #ifdef HAS_PROTO_MESSAGE_DUMP
547  ESP_LOGVV(TAG, "on_light_command_request: %s", msg.dump().c_str());
548 #endif
549  this->on_light_command_request(msg);
550 #endif
551  break;
552  }
553  case 33: {
554 #ifdef USE_SWITCH
556  msg.decode(msg_data, msg_size);
557 #ifdef HAS_PROTO_MESSAGE_DUMP
558  ESP_LOGVV(TAG, "on_switch_command_request: %s", msg.dump().c_str());
559 #endif
560  this->on_switch_command_request(msg);
561 #endif
562  break;
563  }
564  case 34: {
566  msg.decode(msg_data, msg_size);
567 #ifdef HAS_PROTO_MESSAGE_DUMP
568  ESP_LOGVV(TAG, "on_subscribe_homeassistant_services_request: %s", msg.dump().c_str());
569 #endif
571  break;
572  }
573  case 36: {
574  GetTimeRequest msg;
575  msg.decode(msg_data, msg_size);
576 #ifdef HAS_PROTO_MESSAGE_DUMP
577  ESP_LOGVV(TAG, "on_get_time_request: %s", msg.dump().c_str());
578 #endif
579  this->on_get_time_request(msg);
580  break;
581  }
582  case 37: {
583  GetTimeResponse msg;
584  msg.decode(msg_data, msg_size);
585 #ifdef HAS_PROTO_MESSAGE_DUMP
586  ESP_LOGVV(TAG, "on_get_time_response: %s", msg.dump().c_str());
587 #endif
588  this->on_get_time_response(msg);
589  break;
590  }
591  case 38: {
593  msg.decode(msg_data, msg_size);
594 #ifdef HAS_PROTO_MESSAGE_DUMP
595  ESP_LOGVV(TAG, "on_subscribe_home_assistant_states_request: %s", msg.dump().c_str());
596 #endif
598  break;
599  }
600  case 40: {
602  msg.decode(msg_data, msg_size);
603 #ifdef HAS_PROTO_MESSAGE_DUMP
604  ESP_LOGVV(TAG, "on_home_assistant_state_response: %s", msg.dump().c_str());
605 #endif
607  break;
608  }
609  case 42: {
611  msg.decode(msg_data, msg_size);
612 #ifdef HAS_PROTO_MESSAGE_DUMP
613  ESP_LOGVV(TAG, "on_execute_service_request: %s", msg.dump().c_str());
614 #endif
615  this->on_execute_service_request(msg);
616  break;
617  }
618  case 45: {
619 #ifdef USE_ESP32_CAMERA
620  CameraImageRequest msg;
621  msg.decode(msg_data, msg_size);
622 #ifdef HAS_PROTO_MESSAGE_DUMP
623  ESP_LOGVV(TAG, "on_camera_image_request: %s", msg.dump().c_str());
624 #endif
625  this->on_camera_image_request(msg);
626 #endif
627  break;
628  }
629  case 48: {
630 #ifdef USE_CLIMATE
632  msg.decode(msg_data, msg_size);
633 #ifdef HAS_PROTO_MESSAGE_DUMP
634  ESP_LOGVV(TAG, "on_climate_command_request: %s", msg.dump().c_str());
635 #endif
636  this->on_climate_command_request(msg);
637 #endif
638  break;
639  }
640  case 51: {
641 #ifdef USE_NUMBER
643  msg.decode(msg_data, msg_size);
644 #ifdef HAS_PROTO_MESSAGE_DUMP
645  ESP_LOGVV(TAG, "on_number_command_request: %s", msg.dump().c_str());
646 #endif
647  this->on_number_command_request(msg);
648 #endif
649  break;
650  }
651  case 54: {
652 #ifdef USE_SELECT
654  msg.decode(msg_data, msg_size);
655 #ifdef HAS_PROTO_MESSAGE_DUMP
656  ESP_LOGVV(TAG, "on_select_command_request: %s", msg.dump().c_str());
657 #endif
658  this->on_select_command_request(msg);
659 #endif
660  break;
661  }
662  case 60: {
663 #ifdef USE_LOCK
664  LockCommandRequest msg;
665  msg.decode(msg_data, msg_size);
666 #ifdef HAS_PROTO_MESSAGE_DUMP
667  ESP_LOGVV(TAG, "on_lock_command_request: %s", msg.dump().c_str());
668 #endif
669  this->on_lock_command_request(msg);
670 #endif
671  break;
672  }
673  case 62: {
674 #ifdef USE_BUTTON
676  msg.decode(msg_data, msg_size);
677 #ifdef HAS_PROTO_MESSAGE_DUMP
678  ESP_LOGVV(TAG, "on_button_command_request: %s", msg.dump().c_str());
679 #endif
680  this->on_button_command_request(msg);
681 #endif
682  break;
683  }
684  case 65: {
685 #ifdef USE_MEDIA_PLAYER
687  msg.decode(msg_data, msg_size);
688 #ifdef HAS_PROTO_MESSAGE_DUMP
689  ESP_LOGVV(TAG, "on_media_player_command_request: %s", msg.dump().c_str());
690 #endif
692 #endif
693  break;
694  }
695  case 66: {
697  msg.decode(msg_data, msg_size);
698 #ifdef HAS_PROTO_MESSAGE_DUMP
699  ESP_LOGVV(TAG, "on_subscribe_bluetooth_le_advertisements_request: %s", msg.dump().c_str());
700 #endif
702  break;
703  }
704  case 68: {
705 #ifdef USE_BLUETOOTH_PROXY
707  msg.decode(msg_data, msg_size);
708 #ifdef HAS_PROTO_MESSAGE_DUMP
709  ESP_LOGVV(TAG, "on_bluetooth_device_request: %s", msg.dump().c_str());
710 #endif
711  this->on_bluetooth_device_request(msg);
712 #endif
713  break;
714  }
715  case 70: {
716 #ifdef USE_BLUETOOTH_PROXY
718  msg.decode(msg_data, msg_size);
719 #ifdef HAS_PROTO_MESSAGE_DUMP
720  ESP_LOGVV(TAG, "on_bluetooth_gatt_get_services_request: %s", msg.dump().c_str());
721 #endif
723 #endif
724  break;
725  }
726  case 73: {
727 #ifdef USE_BLUETOOTH_PROXY
729  msg.decode(msg_data, msg_size);
730 #ifdef HAS_PROTO_MESSAGE_DUMP
731  ESP_LOGVV(TAG, "on_bluetooth_gatt_read_request: %s", msg.dump().c_str());
732 #endif
734 #endif
735  break;
736  }
737  case 75: {
738 #ifdef USE_BLUETOOTH_PROXY
740  msg.decode(msg_data, msg_size);
741 #ifdef HAS_PROTO_MESSAGE_DUMP
742  ESP_LOGVV(TAG, "on_bluetooth_gatt_write_request: %s", msg.dump().c_str());
743 #endif
745 #endif
746  break;
747  }
748  case 76: {
749 #ifdef USE_BLUETOOTH_PROXY
751  msg.decode(msg_data, msg_size);
752 #ifdef HAS_PROTO_MESSAGE_DUMP
753  ESP_LOGVV(TAG, "on_bluetooth_gatt_read_descriptor_request: %s", msg.dump().c_str());
754 #endif
756 #endif
757  break;
758  }
759  case 77: {
760 #ifdef USE_BLUETOOTH_PROXY
762  msg.decode(msg_data, msg_size);
763 #ifdef HAS_PROTO_MESSAGE_DUMP
764  ESP_LOGVV(TAG, "on_bluetooth_gatt_write_descriptor_request: %s", msg.dump().c_str());
765 #endif
767 #endif
768  break;
769  }
770  case 78: {
771 #ifdef USE_BLUETOOTH_PROXY
773  msg.decode(msg_data, msg_size);
774 #ifdef HAS_PROTO_MESSAGE_DUMP
775  ESP_LOGVV(TAG, "on_bluetooth_gatt_notify_request: %s", msg.dump().c_str());
776 #endif
778 #endif
779  break;
780  }
781  case 80: {
782 #ifdef USE_BLUETOOTH_PROXY
784  msg.decode(msg_data, msg_size);
785 #ifdef HAS_PROTO_MESSAGE_DUMP
786  ESP_LOGVV(TAG, "on_subscribe_bluetooth_connections_free_request: %s", msg.dump().c_str());
787 #endif
789 #endif
790  break;
791  }
792  default:
793  return false;
794  }
795  return true;
796 }
797 
799  HelloResponse ret = this->hello(msg);
800  if (!this->send_hello_response(ret)) {
801  this->on_fatal_error();
802  }
803 }
805  ConnectResponse ret = this->connect(msg);
806  if (!this->send_connect_response(ret)) {
807  this->on_fatal_error();
808  }
809 }
811  DisconnectResponse ret = this->disconnect(msg);
812  if (!this->send_disconnect_response(ret)) {
813  this->on_fatal_error();
814  }
815 }
817  PingResponse ret = this->ping(msg);
818  if (!this->send_ping_response(ret)) {
819  this->on_fatal_error();
820  }
821 }
823  if (!this->is_connection_setup()) {
824  this->on_no_setup_connection();
825  return;
826  }
827  DeviceInfoResponse ret = this->device_info(msg);
828  if (!this->send_device_info_response(ret)) {
829  this->on_fatal_error();
830  }
831 }
833  if (!this->is_connection_setup()) {
834  this->on_no_setup_connection();
835  return;
836  }
837  if (!this->is_authenticated()) {
839  return;
840  }
841  this->list_entities(msg);
842 }
844  if (!this->is_connection_setup()) {
845  this->on_no_setup_connection();
846  return;
847  }
848  if (!this->is_authenticated()) {
850  return;
851  }
852  this->subscribe_states(msg);
853 }
855  if (!this->is_connection_setup()) {
856  this->on_no_setup_connection();
857  return;
858  }
859  if (!this->is_authenticated()) {
861  return;
862  }
863  this->subscribe_logs(msg);
864 }
867  if (!this->is_connection_setup()) {
868  this->on_no_setup_connection();
869  return;
870  }
871  if (!this->is_authenticated()) {
873  return;
874  }
875  this->subscribe_homeassistant_services(msg);
876 }
878  if (!this->is_connection_setup()) {
879  this->on_no_setup_connection();
880  return;
881  }
882  if (!this->is_authenticated()) {
884  return;
885  }
886  this->subscribe_home_assistant_states(msg);
887 }
889  if (!this->is_connection_setup()) {
890  this->on_no_setup_connection();
891  return;
892  }
893  GetTimeResponse ret = this->get_time(msg);
894  if (!this->send_get_time_response(ret)) {
895  this->on_fatal_error();
896  }
897 }
899  if (!this->is_connection_setup()) {
900  this->on_no_setup_connection();
901  return;
902  }
903  if (!this->is_authenticated()) {
905  return;
906  }
907  this->execute_service(msg);
908 }
909 #ifdef USE_COVER
911  if (!this->is_connection_setup()) {
912  this->on_no_setup_connection();
913  return;
914  }
915  if (!this->is_authenticated()) {
917  return;
918  }
919  this->cover_command(msg);
920 }
921 #endif
922 #ifdef USE_FAN
924  if (!this->is_connection_setup()) {
925  this->on_no_setup_connection();
926  return;
927  }
928  if (!this->is_authenticated()) {
930  return;
931  }
932  this->fan_command(msg);
933 }
934 #endif
935 #ifdef USE_LIGHT
937  if (!this->is_connection_setup()) {
938  this->on_no_setup_connection();
939  return;
940  }
941  if (!this->is_authenticated()) {
943  return;
944  }
945  this->light_command(msg);
946 }
947 #endif
948 #ifdef USE_SWITCH
950  if (!this->is_connection_setup()) {
951  this->on_no_setup_connection();
952  return;
953  }
954  if (!this->is_authenticated()) {
956  return;
957  }
958  this->switch_command(msg);
959 }
960 #endif
961 #ifdef USE_ESP32_CAMERA
963  if (!this->is_connection_setup()) {
964  this->on_no_setup_connection();
965  return;
966  }
967  if (!this->is_authenticated()) {
969  return;
970  }
971  this->camera_image(msg);
972 }
973 #endif
974 #ifdef USE_CLIMATE
976  if (!this->is_connection_setup()) {
977  this->on_no_setup_connection();
978  return;
979  }
980  if (!this->is_authenticated()) {
982  return;
983  }
984  this->climate_command(msg);
985 }
986 #endif
987 #ifdef USE_NUMBER
989  if (!this->is_connection_setup()) {
990  this->on_no_setup_connection();
991  return;
992  }
993  if (!this->is_authenticated()) {
995  return;
996  }
997  this->number_command(msg);
998 }
999 #endif
1000 #ifdef USE_SELECT
1002  if (!this->is_connection_setup()) {
1003  this->on_no_setup_connection();
1004  return;
1005  }
1006  if (!this->is_authenticated()) {
1007  this->on_unauthenticated_access();
1008  return;
1009  }
1010  this->select_command(msg);
1011 }
1012 #endif
1013 #ifdef USE_BUTTON
1015  if (!this->is_connection_setup()) {
1016  this->on_no_setup_connection();
1017  return;
1018  }
1019  if (!this->is_authenticated()) {
1020  this->on_unauthenticated_access();
1021  return;
1022  }
1023  this->button_command(msg);
1024 }
1025 #endif
1026 #ifdef USE_LOCK
1028  if (!this->is_connection_setup()) {
1029  this->on_no_setup_connection();
1030  return;
1031  }
1032  if (!this->is_authenticated()) {
1033  this->on_unauthenticated_access();
1034  return;
1035  }
1036  this->lock_command(msg);
1037 }
1038 #endif
1039 #ifdef USE_MEDIA_PLAYER
1041  if (!this->is_connection_setup()) {
1042  this->on_no_setup_connection();
1043  return;
1044  }
1045  if (!this->is_authenticated()) {
1046  this->on_unauthenticated_access();
1047  return;
1048  }
1049  this->media_player_command(msg);
1050 }
1051 #endif
1054  if (!this->is_connection_setup()) {
1055  this->on_no_setup_connection();
1056  return;
1057  }
1058  if (!this->is_authenticated()) {
1059  this->on_unauthenticated_access();
1060  return;
1061  }
1062  this->subscribe_bluetooth_le_advertisements(msg);
1063 }
1064 #ifdef USE_BLUETOOTH_PROXY
1066  if (!this->is_connection_setup()) {
1067  this->on_no_setup_connection();
1068  return;
1069  }
1070  if (!this->is_authenticated()) {
1071  this->on_unauthenticated_access();
1072  return;
1073  }
1074  this->bluetooth_device_request(msg);
1075 }
1076 #endif
1077 #ifdef USE_BLUETOOTH_PROXY
1079  if (!this->is_connection_setup()) {
1080  this->on_no_setup_connection();
1081  return;
1082  }
1083  if (!this->is_authenticated()) {
1084  this->on_unauthenticated_access();
1085  return;
1086  }
1087  this->bluetooth_gatt_get_services(msg);
1088 }
1089 #endif
1090 #ifdef USE_BLUETOOTH_PROXY
1092  if (!this->is_connection_setup()) {
1093  this->on_no_setup_connection();
1094  return;
1095  }
1096  if (!this->is_authenticated()) {
1097  this->on_unauthenticated_access();
1098  return;
1099  }
1100  this->bluetooth_gatt_read(msg);
1101 }
1102 #endif
1103 #ifdef USE_BLUETOOTH_PROXY
1105  if (!this->is_connection_setup()) {
1106  this->on_no_setup_connection();
1107  return;
1108  }
1109  if (!this->is_authenticated()) {
1110  this->on_unauthenticated_access();
1111  return;
1112  }
1113  this->bluetooth_gatt_write(msg);
1114 }
1115 #endif
1116 #ifdef USE_BLUETOOTH_PROXY
1118  if (!this->is_connection_setup()) {
1119  this->on_no_setup_connection();
1120  return;
1121  }
1122  if (!this->is_authenticated()) {
1123  this->on_unauthenticated_access();
1124  return;
1125  }
1126  this->bluetooth_gatt_read_descriptor(msg);
1127 }
1128 #endif
1129 #ifdef USE_BLUETOOTH_PROXY
1131  if (!this->is_connection_setup()) {
1132  this->on_no_setup_connection();
1133  return;
1134  }
1135  if (!this->is_authenticated()) {
1136  this->on_unauthenticated_access();
1137  return;
1138  }
1139  this->bluetooth_gatt_write_descriptor(msg);
1140 }
1141 #endif
1142 #ifdef USE_BLUETOOTH_PROXY
1144  if (!this->is_connection_setup()) {
1145  this->on_no_setup_connection();
1146  return;
1147  }
1148  if (!this->is_authenticated()) {
1149  this->on_unauthenticated_access();
1150  return;
1151  }
1152  this->bluetooth_gatt_notify(msg);
1153 }
1154 #endif
1155 #ifdef USE_BLUETOOTH_PROXY
1158  if (!this->is_connection_setup()) {
1159  this->on_no_setup_connection();
1160  return;
1161  }
1162  if (!this->is_authenticated()) {
1163  this->on_unauthenticated_access();
1164  return;
1165  }
1166  BluetoothConnectionsFreeResponse ret = this->subscribe_bluetooth_connections_free(msg);
1167  if (!this->send_bluetooth_connections_free_response(ret)) {
1168  this->on_fatal_error();
1169  }
1170 }
1171 #endif
1172 
1173 } // namespace api
1174 } // namespace esphome
bool send_list_entities_binary_sensor_response(const ListEntitiesBinarySensorResponse &msg)
virtual void on_climate_command_request(const ClimateCommandRequest &value)
virtual void on_subscribe_home_assistant_states_request(const SubscribeHomeAssistantStatesRequest &value)
bool send_fan_state_response(const FanStateResponse &msg)
bool send_ping_response(const PingResponse &msg)
virtual void on_subscribe_homeassistant_services_request(const SubscribeHomeassistantServicesRequest &value)
bool send_bluetooth_gatt_read_response(const BluetoothGATTReadResponse &msg)
virtual void on_hello_request(const HelloRequest &value)
void on_device_info_request(const DeviceInfoRequest &msg) override
bool send_get_time_response(const GetTimeResponse &msg)
bool send_ping_request(const PingRequest &msg)
void on_bluetooth_gatt_get_services_request(const BluetoothGATTGetServicesRequest &msg) override
virtual void on_bluetooth_device_request(const BluetoothDeviceRequest &value)
bool send_bluetooth_gatt_notify_data_response(const BluetoothGATTNotifyDataResponse &msg)
virtual void on_no_setup_connection()=0
void on_subscribe_home_assistant_states_request(const SubscribeHomeAssistantStatesRequest &msg) override
virtual void on_ping_response(const PingResponse &value)
void on_bluetooth_gatt_write_request(const BluetoothGATTWriteRequest &msg) override
virtual void on_light_command_request(const LightCommandRequest &value)
bool send_subscribe_logs_response(const SubscribeLogsResponse &msg)
std::string dump() const
Definition: proto.cpp:83
bool send_climate_state_response(const ClimateStateResponse &msg)
bool send_binary_sensor_state_response(const BinarySensorStateResponse &msg)
void on_cover_command_request(const CoverCommandRequest &msg) override
virtual void on_fatal_error()=0
bool send_bluetooth_gatt_error_response(const BluetoothGATTErrorResponse &msg)
void on_fan_command_request(const FanCommandRequest &msg) override
void on_subscribe_homeassistant_services_request(const SubscribeHomeassistantServicesRequest &msg) override
void decode(const uint8_t *buffer, size_t length)
Definition: proto.cpp:9
bool send_list_entities_fan_response(const ListEntitiesFanResponse &msg)
bool send_number_state_response(const NumberStateResponse &msg)
virtual void on_home_assistant_state_response(const HomeAssistantStateResponse &value)
bool send_list_entities_select_response(const ListEntitiesSelectResponse &msg)
bool send_homeassistant_service_response(const HomeassistantServiceResponse &msg)
bool send_bluetooth_gatt_write_response(const BluetoothGATTWriteResponse &msg)
virtual void on_bluetooth_gatt_write_request(const BluetoothGATTWriteRequest &value)
bool send_bluetooth_device_connection_response(const BluetoothDeviceConnectionResponse &msg)
virtual void on_connect_request(const ConnectRequest &value)
bool send_list_entities_done_response(const ListEntitiesDoneResponse &msg)
bool send_device_info_response(const DeviceInfoResponse &msg)
void on_switch_command_request(const SwitchCommandRequest &msg) override
void on_bluetooth_gatt_read_descriptor_request(const BluetoothGATTReadDescriptorRequest &msg) override
void on_button_command_request(const ButtonCommandRequest &msg) override
void on_get_time_request(const GetTimeRequest &msg) override
bool send_connect_response(const ConnectResponse &msg)
virtual void on_subscribe_bluetooth_le_advertisements_request(const SubscribeBluetoothLEAdvertisementsRequest &value)
void on_disconnect_request(const DisconnectRequest &msg) override
virtual void on_list_entities_request(const ListEntitiesRequest &value)
virtual void on_disconnect_request(const DisconnectRequest &value)
virtual void on_select_command_request(const SelectCommandRequest &value)
virtual void on_disconnect_response(const DisconnectResponse &value)
virtual void on_bluetooth_gatt_get_services_request(const BluetoothGATTGetServicesRequest &value)
void on_ping_request(const PingRequest &msg) override
bool send_bluetooth_le_advertisement_response(const BluetoothLEAdvertisementResponse &msg)
virtual void on_camera_image_request(const CameraImageRequest &value)
bool send_list_entities_services_response(const ListEntitiesServicesResponse &msg)
virtual void on_lock_command_request(const LockCommandRequest &value)
bool send_bluetooth_gatt_get_services_response(const BluetoothGATTGetServicesResponse &msg)
void on_media_player_command_request(const MediaPlayerCommandRequest &msg) override
virtual void on_media_player_command_request(const MediaPlayerCommandRequest &value)
bool send_list_entities_text_sensor_response(const ListEntitiesTextSensorResponse &msg)
void on_subscribe_bluetooth_le_advertisements_request(const SubscribeBluetoothLEAdvertisementsRequest &msg) override
virtual void on_subscribe_bluetooth_connections_free_request(const SubscribeBluetoothConnectionsFreeRequest &value)
void on_execute_service_request(const ExecuteServiceRequest &msg) override
void on_connect_request(const ConnectRequest &msg) override
bool send_list_entities_light_response(const ListEntitiesLightResponse &msg)
virtual void on_cover_command_request(const CoverCommandRequest &value)
bool send_text_sensor_state_response(const TextSensorStateResponse &msg)
bool send_bluetooth_gatt_notify_response(const BluetoothGATTNotifyResponse &msg)
bool send_list_entities_cover_response(const ListEntitiesCoverResponse &msg)
bool send_disconnect_request(const DisconnectRequest &msg)
bool send_list_entities_camera_response(const ListEntitiesCameraResponse &msg)
bool send_list_entities_button_response(const ListEntitiesButtonResponse &msg)
bool send_list_entities_media_player_response(const ListEntitiesMediaPlayerResponse &msg)
void on_bluetooth_gatt_read_request(const BluetoothGATTReadRequest &msg) override
void on_subscribe_bluetooth_connections_free_request(const SubscribeBluetoothConnectionsFreeRequest &msg) override
virtual void on_execute_service_request(const ExecuteServiceRequest &value)
void on_light_command_request(const LightCommandRequest &msg) override
void on_list_entities_request(const ListEntitiesRequest &msg) override
bool send_list_entities_number_response(const ListEntitiesNumberResponse &msg)
bool send_switch_state_response(const SwitchStateResponse &msg)
bool read_message(uint32_t msg_size, uint32_t msg_type, uint8_t *msg_data) override
void on_select_command_request(const SelectCommandRequest &msg) override
void on_subscribe_logs_request(const SubscribeLogsRequest &msg) override
bool send_camera_image_response(const CameraImageResponse &msg)
bool send_list_entities_lock_response(const ListEntitiesLockResponse &msg)
void on_bluetooth_gatt_write_descriptor_request(const BluetoothGATTWriteDescriptorRequest &msg) override
bool send_list_entities_sensor_response(const ListEntitiesSensorResponse &msg)
virtual void on_subscribe_states_request(const SubscribeStatesRequest &value)
void on_bluetooth_gatt_notify_request(const BluetoothGATTNotifyRequest &msg) override
bool send_select_state_response(const SelectStateResponse &msg)
bool send_bluetooth_connections_free_response(const BluetoothConnectionsFreeResponse &msg)
virtual void on_bluetooth_gatt_read_descriptor_request(const BluetoothGATTReadDescriptorRequest &value)
void on_subscribe_states_request(const SubscribeStatesRequest &msg) override
void on_camera_image_request(const CameraImageRequest &msg) override
virtual void on_bluetooth_gatt_write_descriptor_request(const BluetoothGATTWriteDescriptorRequest &value)
bool send_light_state_response(const LightStateResponse &msg)
virtual void on_bluetooth_gatt_notify_request(const BluetoothGATTNotifyRequest &value)
virtual void on_number_command_request(const NumberCommandRequest &value)
bool send_media_player_state_response(const MediaPlayerStateResponse &msg)
bool send_subscribe_home_assistant_state_response(const SubscribeHomeAssistantStateResponse &msg)
bool send_get_time_request(const GetTimeRequest &msg)
virtual bool is_authenticated()=0
bool send_list_entities_switch_response(const ListEntitiesSwitchResponse &msg)
virtual void on_get_time_request(const GetTimeRequest &value)
virtual void on_unauthenticated_access()=0
virtual void on_fan_command_request(const FanCommandRequest &value)
Definition: a4988.cpp:4
bool send_sensor_state_response(const SensorStateResponse &msg)
bool send_cover_state_response(const CoverStateResponse &msg)
bool send_hello_response(const HelloResponse &msg)
bool send_list_entities_climate_response(const ListEntitiesClimateResponse &msg)
bool send_disconnect_response(const DisconnectResponse &msg)
void on_climate_command_request(const ClimateCommandRequest &msg) override
bool send_bluetooth_gatt_get_services_done_response(const BluetoothGATTGetServicesDoneResponse &msg)
virtual void on_button_command_request(const ButtonCommandRequest &value)
void on_lock_command_request(const LockCommandRequest &msg) override
bool send_lock_state_response(const LockStateResponse &msg)
void on_bluetooth_device_request(const BluetoothDeviceRequest &msg) override
virtual void on_device_info_request(const DeviceInfoRequest &value)
virtual void on_switch_command_request(const SwitchCommandRequest &value)
virtual void on_get_time_response(const GetTimeResponse &value)
virtual void on_bluetooth_gatt_read_request(const BluetoothGATTReadRequest &value)
virtual bool is_connection_setup()=0
void on_number_command_request(const NumberCommandRequest &msg) override
virtual void on_ping_request(const PingRequest &value)
void on_hello_request(const HelloRequest &msg) override
virtual void on_subscribe_logs_request(const SubscribeLogsRequest &value)