|
@ -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,9 +87,9 @@ 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); |
|
|
|
|
|
|
|
|
|
|
|
Trace trace(logger, "m_aiuiService->onMessage"); |
|
|
json msg = rxjson; |
|
|
json msg = rxjson; |
|
|
m_workQueue->enQueue([this, msg]() { |
|
|
m_workQueue->enQueue([this, msg]() { |
|
|
try { |
|
|
try { |
|
@ -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() { |
|
|