Files
StackChan/firmware/main/apps/app_ai_agent/app_ai_agent.cpp
T
2026-04-20 16:27:36 +08:00

58 lines
1.4 KiB
C++

/*
* SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
#include "app_ai_agent.h"
#include <hal/hal.h>
#include <mooncake.h>
#include <mooncake_log.h>
#include <assets/assets.h>
#include <smooth_lvgl.hpp>
#include <stackchan/stackchan.h>
#include <apps/common/common.h>
using namespace mooncake;
using namespace smooth_ui_toolkit::lvgl_cpp;
AppAiAgent::AppAiAgent()
{
// Configure App name
setAppInfo().name = "AI.AGENT";
// Configure App icon
static auto icon = assets::get_image("icon_ai_agent.bin");
setAppInfo().icon = (void*)&icon;
// Configure App theme color
static uint32_t theme_color = 0x33CC99;
setAppInfo().userData = (void*)&theme_color;
}
// Called when the App is installed
void AppAiAgent::onCreate()
{
mclog::tagInfo(getAppInfo().name, "on create");
}
// Called when the App is opened
// You can construct UI, initialize operations, etc. here
void AppAiAgent::onOpen()
{
mclog::tagInfo(getAppInfo().name, "on open");
// Request to start Xiaozhi service
// All apps will be uninstall in next mooncake update
GetHAL().requestXiaozhiStart();
}
// Called repeatedly while the App is running
void AppAiAgent::onRunning()
{
}
// Called when the App is closed
// You can destroy UI, release resources, etc. here
void AppAiAgent::onClose()
{
mclog::tagInfo(getAppInfo().name, "on close");
}