You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.3 KiB

  1. #include "zlinuxcomponents/zmainhelper.hpp"
  2. //
  3. #include "configs/config.hpp"
  4. #include "iflytopcpp/core/spdlogfactory/logger.hpp"
  5. #include "iflytopcpp/core/thread/thread.hpp"
  6. #include "spdlog/spdlog.h"
  7. #include "version.hpp"
  8. #include "zlinuxcomponents/rootfs_auto_update/rootfs_auto_update.hpp"
  9. #include "zservice_container/zservice_container.hpp"
  10. #include "zwebservice/zwebservice.hpp"
  11. //
  12. #include "service/device_io_service.hpp"
  13. #include "service/device_io_service_mock.hpp"
  14. #include "service/light_control_service.hpp"
  15. #include "service/main_control_service.hpp"
  16. #include "service/report_service.hpp"
  17. //
  18. #include "zlinuxcomponents/alsaplayer/AudioPlayerAlsaImpl.hpp"
  19. // #include "zlinuxcomponents/audio/audio_recoder.hpp"
  20. #include <curl/curl.h>
  21. #include <iostream>
  22. #include <string>
  23. #include "zlinuxcomponents/aiui_ws/aiui.h"
  24. //
  25. using namespace iflytop;
  26. using namespace core;
  27. using namespace std;
  28. using namespace clipp;
  29. ZMAIN();
  30. /***********************************************************************************************************************
  31. * =======================================================Main======================================================== *
  32. ***********************************************************************************************************************/
  33. static void onmessage(const char *data, int len) {}
  34. static void onerror(int code, const char *str) { printf("aiui_init onerror %d => %s\n", code, str); }
  35. void Main::onSIGINT() { exit(0); }
  36. int Main::main(int argc, char *argv[]) {
  37. string g_host_server_ip;
  38. string g_device_id;
  39. spdlog::flush_on(spdlog::level::debug);
  40. const char *appid = "5938b7c7"; // 应用ID,在AIUI开放平台创建并设置
  41. const char *key = "19c1f7becc78eedc7826b485aabe30de"; // 接口密钥,在AIUI开放平台查看
  42. const char *param =
  43. "{\"result_level\":\"plain\",\"auth_id\":\"ac30105366ea460f9ff08ddac0c4f71e\",\"data_"
  44. "type\":\"text\","
  45. "\"scene\":\"main_box\",\"sample_rate\":\"16000\", "
  46. "\"context\":\"{\\\"sdk_support\\\":[\\\"nlp\\\",\\\"tts\\\"]}\"}";
  47. aiui_init(appid, key, param, onmessage, onerror);
  48. const char *text = "播放音乐";
  49. aiui_write(text, strlen(text));
  50. aiui_finished();
  51. aiui_destroy();
  52. while (true) sleep(1000);
  53. }