Browse Source

添加IXWEBSOCKET库的支持,更新aiui封装库版本

master
zhaohe 2 years ago
parent
commit
2383e865ea
  1. 2
      .vscode/c_cpp_properties.json
  2. 8
      .vscode/settings.json
  3. 2
      CMakeLists.txt
  4. 5
      CMakeListsAARCH64.cmake
  5. 2
      dep/iflytopcpp
  6. 2
      dep/websocketpp
  7. 2
      dep/zlinuxcomponents
  8. 0
      project.config
  9. 11
      sh/envsetup.sh
  10. 15
      sh/envsetuppc.sh
  11. 28
      src/service/main_control_service.cpp
  12. 2
      src/test/test_H8922S_gps_info_reader.cpp
  13. 1
      src/test/test_iflytop_voice.cpp
  14. 1
      src/test/test_soundbox4mic_voice_processer.cpp

2
.vscode/c_cpp_properties.json

@ -11,7 +11,7 @@
"cStandard": "gnu11", "cStandard": "gnu11",
"cppStandard": "gnu++14", "cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64", "intelliSenseMode": "linux-gcc-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
"compileCommands": "${workspaceFolder}/buildpc/compile_commands.json"
} }
], ],
"version": 4 "version": 4

8
.vscode/settings.json

@ -97,6 +97,12 @@
"scoped_allocator": "cpp", "scoped_allocator": "cpp",
"netdb.h": "c", "netdb.h": "c",
"aiui_cjson.h": "c", "aiui_cjson.h": "c",
"string.h": "c"
"string.h": "c",
"aiui_base64.h": "c",
"aiui_wsclient.h": "c",
"aiui_sha256.h": "c",
"socket.h": "c",
"unistd.h": "c",
"err.h": "c"
} }
} }

2
CMakeLists.txt

@ -5,9 +5,9 @@ set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/)
include(zcmake/zcmake.cmake) include(zcmake/zcmake.cmake)
project(app) project(app)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/)
# ccacheC++ # ccacheC++
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)

5
CMakeListsAARCH64.cmake

@ -23,8 +23,9 @@ zadd_executable_simple(TARGET alsaplayer_main.out SRC
dep/zlinuxcomponents/alsaplayer/test_alsaplayer_main.cpp) dep/zlinuxcomponents/alsaplayer/test_alsaplayer_main.cpp)
zadd_executable_simple(TARGET audio_recorder_main.out SRC zadd_executable_simple(TARGET audio_recorder_main.out SRC
dep/zlinuxcomponents/audio/audio_recorder_main.cpp) dep/zlinuxcomponents/audio/audio_recorder_main.cpp)
zadd_executable_simple(TARGET test_asr_main.out SRC
dep/zlinuxcomponents/aiui_ws/aiui_main.c)
zadd_executable_simple(TARGET test_aiui_service.out SRC
dep/zlinuxcomponents/aiui_ws/test_aiui_service.cpp)
# #
zadd_executable_simple( zadd_executable_simple(
TARGET test_smart_soundbox_player.out SRC TARGET test_smart_soundbox_player.out SRC

2
dep/iflytopcpp

@ -1 +1 @@
Subproject commit dda7872ae77dbead40a13c3b39497c021562ff1b
Subproject commit e416beae5d0b2bb83e6ea4850f927cd840be66ce

2
dep/websocketpp

@ -1 +1 @@
Subproject commit a61fab296db75a7a78d48347355c48182ab15929
Subproject commit 8005a5e9a785128ae984c8a12d201a1bbc557b22

2
dep/zlinuxcomponents

@ -1 +1 @@
Subproject commit a7eed06478b662b8c685aa290cdbd6617dc067ac
Subproject commit 8085579161497e78502e7b50ffe5639ea0bb9183

0
project.config

11
sh/envsetup.sh

@ -5,6 +5,7 @@
CONFIG_SUPPORT_ALSA=true CONFIG_SUPPORT_ALSA=true
CONFIG_SUPPORT_FFMPEG=true CONFIG_SUPPORT_FFMPEG=true
CONFIG_SUPPORT_IFLYTOP_VOICE_PROCESS=true CONFIG_SUPPORT_IFLYTOP_VOICE_PROCESS=true
CONFIG_SUPPORT_IXWEBSOCKET=true
# Code Begin # Code Begin
mkdir -p ${LIBSDIR} mkdir -p ${LIBSDIR}
@ -61,5 +62,15 @@ if [ "$CONFIG_SUPPORT_IFLYTOP_VOICE_PROCESS" = true ]; then
PUBLIC_LINK_LIBS="${PUBLIC_LINK_LIBS};iflytopvoice;NE10_static" PUBLIC_LINK_LIBS="${PUBLIC_LINK_LIBS};iflytopvoice;NE10_static"
fi fi
if [ "$CONFIG_SUPPORT_IXWEBSOCKET" = true ]; then
wget -c "http://iflytop.local:8021/zlibrelease/libixwebsocket/libixwebsocket_v11.4.3_aarch64_static_ubuntu18.04_0.tar.gz"
tar -xvf libixwebsocket_v11.4.3_aarch64_static_ubuntu18.04_0.tar.gz >/dev/null
rm -rf ${LIBSDIR}/libixwebsocket
mv libixwebsocket_v11.4.3_aarch64_static_ubuntu18.04_0 ${LIBSDIR}/libixwebsocket
PUBLIC_LINK_DIRECTORIES="${PUBLIC_LINK_DIRECTORIES};${LIBSDIR}/libixwebsocket/lib"
PUBLIC_INCLUDE_DIRECTORIES="${PUBLIC_INCLUDE_DIRECTORIES};${LIBSDIR}/libixwebsocket/include"
PUBLIC_LINK_LIBS="${PUBLIC_LINK_LIBS};ixwebsocket"
fi
CROSS_TOOLCHAIN_C_COMPILER=aarch64-linux-gnu-gcc CROSS_TOOLCHAIN_C_COMPILER=aarch64-linux-gnu-gcc
CROSS_TOOLCHAIN_CXX_COMPILER=aarch64-linux-gnu-g++ CROSS_TOOLCHAIN_CXX_COMPILER=aarch64-linux-gnu-g++

15
sh/envsetuppc.sh

@ -1,2 +1,17 @@
CONFIG_SUPPORT_IXWEBSOCKET=true
mkdir -p ${LIBSDIR}
cd ${LIBSDIR}
PUBLIC_LINK_LIBS="${PUBLIC_LINK_LIBS};asound" PUBLIC_LINK_LIBS="${PUBLIC_LINK_LIBS};asound"
PUBLIC_LINK_LIBS="${PUBLIC_LINK_LIBS};avcodec;avdevice;avfilter;avformat;avutil;swresample;swscale" PUBLIC_LINK_LIBS="${PUBLIC_LINK_LIBS};avcodec;avdevice;avfilter;avformat;avutil;swresample;swscale"
if [ "$CONFIG_SUPPORT_IXWEBSOCKET" = true ]; then
wget -c "http://iflytop.local:8021/zlibrelease/libixwebsocket/libixwebsocket_v11.4.3_amd64_static_ubuntu18.04_0.tar.gz"
tar -xvf libixwebsocket_v11.4.3_amd64_static_ubuntu18.04_0.tar.gz >/dev/null
rm -rf ${LIBSDIR}/libixwebsocket
mv libixwebsocket_v11.4.3_amd64_static_ubuntu18.04_0 ${LIBSDIR}/libixwebsocket
PUBLIC_LINK_DIRECTORIES="${PUBLIC_LINK_DIRECTORIES};${LIBSDIR}/libixwebsocket/lib"
PUBLIC_INCLUDE_DIRECTORIES="${PUBLIC_INCLUDE_DIRECTORIES};${LIBSDIR}/libixwebsocket/include"
PUBLIC_LINK_LIBS="${PUBLIC_LINK_LIBS};ixwebsocket"
fi

28
src/service/main_control_service.cpp

@ -6,6 +6,15 @@ using namespace iflytop;
using namespace core; using namespace core;
using namespace std; using namespace std;
class Trace {
logger_t m_logger;
string m_name;
public:
Trace(logger_t log, const string& name) : m_logger(log), m_name(name) { m_logger->info("TRACE::ENTER {}", m_name); }
~Trace() { m_logger->info("TRACE::EXIT {}", m_name); }
};
/*********************************************************************************************************************** /***********************************************************************************************************************
* ============================================================================================================= * * ============================================================================================================= *
***********************************************************************************************************************/ ***********************************************************************************************************************/
@ -78,10 +87,10 @@ void MainControlService::initializeVoiceProcess() {
} }
}); });
m_aiuiService->onMessage.connect([&](json& rxjson) {
m_aiuiService->onMessage.connect([&](const json& rxjson) {
lock_guard<recursive_mutex> lock(m_voiceprocessmutex); lock_guard<recursive_mutex> lock(m_voiceprocessmutex);
json msg = rxjson;
Trace trace(logger, "m_aiuiService->onMessage");
json msg = rxjson;
m_workQueue->enQueue([this, msg]() { m_workQueue->enQueue([this, msg]() {
try { try {
processasrResult(msg); processasrResult(msg);
@ -126,6 +135,7 @@ void MainControlService::processasrResult_tts(json& rxjson) {
} }
void MainControlService::processasrResult(json rxjson) { void MainControlService::processasrResult(json rxjson) {
Trace trace(logger, "processasrResult");
lock_guard<recursive_mutex> lock(m_voiceprocessmutex); lock_guard<recursive_mutex> lock(m_voiceprocessmutex);
string action = rxjson["action"]; string action = rxjson["action"];
@ -168,8 +178,8 @@ void MainControlService::constructSession() {
* 4. session * 4. session
* 5. ,10s内无人应答session * 5. ,10s内无人应答session
*/ */
lock_guard<recursive_mutex> lock(m_voiceprocessmutex); lock_guard<recursive_mutex> lock(m_voiceprocessmutex);
Trace trace(logger, "constructSession");
/** /**
* @brief * @brief
* TODO: * TODO:
@ -203,13 +213,19 @@ void MainControlService::constructSession() {
void MainControlService::endSession() { void MainControlService::endSession() {
lock_guard<recursive_mutex> lock(m_voiceprocessmutex); lock_guard<recursive_mutex> lock(m_voiceprocessmutex);
Trace trace(logger, "endSession");
logger->info("{}", __LINE__);
if (m_conversationSession) { if (m_conversationSession) {
m_conversationSession = nullptr; m_conversationSession = nullptr;
m_aiuiService->aiuiFinished();
logger->info("{}", __LINE__);
int ret = m_aiuiService->aiuiFinished();
logger->info("{} {}", __LINE__, ret);
m_aiuiService->aiuiDestroy(); m_aiuiService->aiuiDestroy();
logger->info("{}", __LINE__);
} }
logger->info("{}", __LINE__);
m_audioLoggingService->endwakeup(); m_audioLoggingService->endwakeup();
logger->info("{}", __LINE__);
} }
void MainControlService::initialize() { void MainControlService::initialize() {

2
src/test/test_H8922S_gps_info_reader.cpp

@ -12,7 +12,6 @@
#include "service/device_io_service_mock.hpp" #include "service/device_io_service_mock.hpp"
#include "service/light_control_service.hpp" #include "service/light_control_service.hpp"
#include "service/report_service.hpp" #include "service/report_service.hpp"
#include "zlinuxcomponents/aiui_ws/aiui_service.hpp"
// //
#include <curl/curl.h> #include <curl/curl.h>
@ -21,7 +20,6 @@
#include <string> #include <string>
#include "service/H8922S_gps_Info_reader.hpp" #include "service/H8922S_gps_Info_reader.hpp"
#include "zlinuxcomponents/aiui_ws/aiui.h"
// //
using namespace iflytop; using namespace iflytop;

1
src/test/test_iflytop_voice.cpp

@ -19,7 +19,6 @@
// //
#include "zlinuxcomponents/aiui_ws/aiui.h"
// //
#include "audio_process_api.h" #include "audio_process_api.h"
ZMAIN(); ZMAIN();

1
src/test/test_soundbox4mic_voice_processer.cpp

@ -22,7 +22,6 @@
#include "iflytopvoicecpp/soundbox4mic_voice_pre_process.hpp" #include "iflytopvoicecpp/soundbox4mic_voice_pre_process.hpp"
#include "service/H8922S_gps_Info_reader.hpp" #include "service/H8922S_gps_Info_reader.hpp"
#include "zlinuxcomponents/aiui_ws/aiui.h"
#include "zlinuxcomponents/audio/audio_recoder.hpp" #include "zlinuxcomponents/audio/audio_recoder.hpp"
// //

Loading…
Cancel
Save