board_control.cc 878 B

12345678910111213141516171819202122232425262728293031
  1. #include <freertos/FreeRTOS.h>
  2. #include <freertos/timers.h>
  3. #include <freertos/task.h>
  4. #include <esp_log.h>
  5. #include "board.h"
  6. #include "boards/common/wifi_board.h"
  7. #include "iot/thing.h"
  8. #define TAG "BoardControl"
  9. namespace iot {
  10. class BoardControl : public Thing {
  11. public:
  12. BoardControl() : Thing("BoardControl", "当前 AI 机器人管理和控制") {
  13. // 修改重新配网
  14. methods_.AddMethod("ResetWifiConfiguration", "重新配网", ParameterList(),
  15. [this](const ParameterList& parameters) {
  16. ESP_LOGI(TAG, "ResetWifiConfiguration");
  17. auto board = static_cast<WifiBoard*>(&Board::GetInstance());
  18. if (board && board->GetBoardType() == "wifi") {
  19. board->ResetWifiConfiguration();
  20. }
  21. });
  22. }
  23. };
  24. } // namespace iot
  25. DECLARE_THING(BoardControl);