wangzhibo
2026-08-31 17ac2ce0ed52874616c79c910667e41e34604826
xiaozhi-esp32-2.2.6/main/application.cc
@@ -393,6 +393,7 @@
    Schedule([this]() {
        // Play the success sound to indicate the device is ready
        audio_service_.PlaySound(Lang::Sounds::OGG_SUCCESS);
        Board::GetInstance().OnDeviceReady();
    });
}
@@ -841,6 +842,21 @@
void Application::StopListening() {
    xEventGroupSetBits(event_group_, MAIN_EVENT_STOP_LISTENING);
}
void Application::SendListenDetect(const std::string& text, bool open_if_idle) {
    Schedule([this, text, open_if_idle]() {
        if (!protocol_ || text.empty()) {
            return;
        }
        if (protocol_->IsAudioChannelOpened()) {
            protocol_->SendWakeWordDetected(text);
            return;
        }
        if (open_if_idle) {
            WakeWordInvoke(text);
        }
    });
}
void Application::HandleToggleChatEvent() {
@@ -1417,7 +1433,9 @@
            SetDeviceState(kDeviceStateIdle);
        }
        audio_service_.EnableWakeWordDetection(true);
        BoardMqtt_ResumePlaylistIfUnfinished();
        if (!Board::GetInstance().OnRestoredFromPowerOff(network_ready)) {
            BoardMqtt_ResumePlaylistIfUnfinished();
        }
    });
}