#include "zlinuxcomponents/zmainhelper.hpp" // #include "configs/config.hpp" #include "iflytopcpp/core/spdlogfactory/logger.hpp" #include "iflytopcpp/core/thread/thread.hpp" #include "spdlog/spdlog.h" #include "version.hpp" #include "zlinuxcomponents/rootfs_auto_update/rootfs_auto_update.hpp" #include "zservice_container/zservice_container.hpp" #include "zwebservice/zwebservice.hpp" // #include "service/device_io_service.hpp" #include "service/device_io_service_mock.hpp" #include "service/light_control_service.hpp" #include "service/main_control_service.hpp" #include "service/report_service.hpp" // #include "zlinuxcomponents/alsaplayer/AudioPlayerAlsaImpl.hpp" // #include "zlinuxcomponents/audio/audio_recoder.hpp" #include #include #include #include "zlinuxcomponents/aiui_ws/aiui.h" // using namespace iflytop; using namespace core; using namespace std; using namespace clipp; ZMAIN(); /*********************************************************************************************************************** * =======================================================Main======================================================== * ***********************************************************************************************************************/ static void onmessage(const char *data, int len) {} static void onerror(int code, const char *str) { printf("aiui_init onerror %d => %s\n", code, str); } void Main::onSIGINT() { exit(0); } int Main::main(int argc, char *argv[]) { string g_host_server_ip; string g_device_id; spdlog::flush_on(spdlog::level::debug); const char *appid = "5938b7c7"; // 应用ID,在AIUI开放平台创建并设置 const char *key = "19c1f7becc78eedc7826b485aabe30de"; // 接口密钥,在AIUI开放平台查看 const char *param = "{\"result_level\":\"plain\",\"auth_id\":\"ac30105366ea460f9ff08ddac0c4f71e\",\"data_" "type\":\"text\"," "\"scene\":\"main_box\",\"sample_rate\":\"16000\", " "\"context\":\"{\\\"sdk_support\\\":[\\\"nlp\\\",\\\"tts\\\"]}\"}"; aiui_init(appid, key, param, onmessage, onerror); const char *text = "播放音乐"; aiui_write(text, strlen(text)); aiui_finished(); aiui_destroy(); while (true) sleep(1000); }