|
12 | 12 | #include "lvgl_theme.h" |
13 | 13 |
|
14 | 14 | #include <esp_log.h> |
15 | | -#include "esp_check.h" |
| 15 | +#include <esp_check.h> |
16 | 16 | #include <esp_lcd_panel_io.h> |
17 | 17 | #include <esp_lcd_panel_ops.h> |
18 | 18 | #include <esp_lcd_spd2010.h> |
|
28 | 28 | #include <esp_console.h> |
29 | 29 | #include <esp_mac.h> |
30 | 30 | #include <nvs_flash.h> |
| 31 | +#include <esp_app_desc.h> |
31 | 32 |
|
32 | 33 | #include "assets/lang_config.h" |
33 | 34 |
|
@@ -492,6 +493,47 @@ class SensecapWatcher : public WifiBoard { |
492 | 493 | }; |
493 | 494 | ESP_ERROR_CHECK(esp_console_cmd_register(&cmd5)); |
494 | 495 |
|
| 496 | + const esp_console_cmd_t cmd6 = { |
| 497 | + .command = "version", |
| 498 | + .help = "Read version info", |
| 499 | + .hint = NULL, |
| 500 | + .func = NULL, |
| 501 | + .argtable = NULL, |
| 502 | + .func_w_context = [](void *context,int argc, char** argv) -> int { |
| 503 | + auto self = static_cast<SensecapWatcher*>(context); |
| 504 | + auto app_desc = esp_app_get_description(); |
| 505 | + const char* region = "UNKNOWN"; |
| 506 | + #if defined(CONFIG_LANGUAGE_ZH_CN) |
| 507 | + region = "CN"; |
| 508 | + #elif defined(CONFIG_LANGUAGE_EN_US) |
| 509 | + region = "US"; |
| 510 | + #elif defined(CONFIG_LANGUAGE_JA_JP) |
| 511 | + region = "JP"; |
| 512 | + #elif defined(CONFIG_LANGUAGE_ES_ES) |
| 513 | + region = "ES"; |
| 514 | + #elif defined(CONFIG_LANGUAGE_DE_DE) |
| 515 | + region = "DE"; |
| 516 | + #elif defined(CONFIG_LANGUAGE_FR_FR) |
| 517 | + region = "FR"; |
| 518 | + #elif defined(CONFIG_LANGUAGE_IT_IT) |
| 519 | + region = "IT"; |
| 520 | + #elif defined(CONFIG_LANGUAGE_PT_PT) |
| 521 | + region = "PT"; |
| 522 | + #elif defined(CONFIG_LANGUAGE_RU_RU) |
| 523 | + region = "RU"; |
| 524 | + #elif defined(CONFIG_LANGUAGE_KO_KR) |
| 525 | + region = "KR"; |
| 526 | + #endif |
| 527 | + printf("{\"type\":0,\"name\":\"VER?\",\"code\":0,\"data\":{\"software\":\"%s\",\"hardware\":\"watcher xiaozhi agent\",\"camera\":%d,\"region\":\"%s\"}}\n", |
| 528 | + app_desc->version, |
| 529 | + self->GetCamera() == nullptr ? 0 : 1, |
| 530 | + region); |
| 531 | + return 0; |
| 532 | + }, |
| 533 | + .context =this |
| 534 | + }; |
| 535 | + ESP_ERROR_CHECK(esp_console_cmd_register(&cmd6)); |
| 536 | + |
495 | 537 | esp_console_dev_uart_config_t hw_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT(); |
496 | 538 | ESP_ERROR_CHECK(esp_console_new_repl_uart(&hw_config, &repl_config, &repl)); |
497 | 539 | ESP_ERROR_CHECK(esp_console_start_repl(repl)); |
|
0 commit comments