* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-20 15:14:50
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-10-23 14:19:17
+ * @LastEditTime: 2024-10-28 11:02:51
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
*/
#include "aivoice/include/AiVoiceModel.h"
// 停止聆听用户问题
void AiVoiceModel::StopListenAndRecordingUserQuestion(void)
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::StopListenAndRecordingUserQuestion");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::StopListenAndRecordingUserQuestion");
int32_t argc = 1;
uint8_t *argv = (uint8_t *)"stop";
AudioCaptureSample(argc, (const char **)&argv);
// 声明定时器变量
static osTimerId_t g_screen60s_timer = nullptr;
- static uint16_t SCREEN_60S_TIME = 60; // 60s
+ static int8_t SCREEN_60S_TIME = 60; // 60s
static void ai_start_screen60s_timer_callbackProc(int data)
{
}
static osTimerId_t g_listeningEndHandle = nullptr;
- static uint8_t LISTENING_TIMEOUT = 10; // 10s钟无操作关闭该视图
+ static int8_t LISTENING_TIMEOUT = 10; // 10s钟无操作关闭该视图
static void AIListeningCallbackProc(int data)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AIListeningCallbackProc %d", LISTENING_TIMEOUT);
}
static osTimerId_t g_ai_is_ready_Handle = nullptr; // 处理查询AI是否就绪定时器
- static uint8_t AI_IS_READY_TIMEOUT = 5; // 5s钟超时
+ static int8_t AI_IS_READY_TIMEOUT = 5; // 5s钟超时
static void AI_IS_READY_CallbackProc(int data)
{
if (AI_IS_READY_TIMEOUT <= 0) // 模型连接失败有5秒超时
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-05-07 11:25:58
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-10-17 10:39:36
+ * @LastEditTime: 2024-10-28 11:14:56
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp
*/
#include "aivoice/include/AiVoicePresenter.h"
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_AiVoiceBluetoothFailedStartView->CreateAiVoiceBluetoothFailedStartView();
+ // AiVoiceScrollView[thisView] = p_AiVoiceBluetoothFailedStartView->CreateAiVoiceBluetoothFailedStartView();
+ UIScrollView *scrollview = p_AiVoiceBluetoothFailedStartView->CreateAiVoiceBluetoothFailedStartView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
return true;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_AivoiceMobileDataFailedStartView->CreateAivoiceMobileDataFailedStartView();
+ // AiVoiceScrollView[thisView] = p_AivoiceMobileDataFailedStartView->CreateAivoiceMobileDataFailedStartView();
+ UIScrollView *scrollview = p_AivoiceMobileDataFailedStartView->CreateAivoiceMobileDataFailedStartView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
return true;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_AivoiceConnectTimeoutView->CreateAivoiceConnectTimeoutView();
+ // AiVoiceScrollView[thisView] = p_AivoiceConnectTimeoutView->CreateAivoiceConnectTimeoutView();
+ UIScrollView *scrollview = p_AivoiceConnectTimeoutView->CreateAivoiceConnectTimeoutView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_AivoiceListeningView->CreateAivoiceListeningView();
+ // AiVoiceScrollView[thisView] = p_AivoiceListeningView->CreateAivoiceListeningView();
+ UIScrollView *scrollview = p_AivoiceListeningView->CreateAivoiceListeningView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
- if(p_AivoiceListeningView)
+ if (p_AivoiceListeningView)
{
p_AivoiceListeningView->GetShowtimeoutLabel()->SetText("10");
p_AivoiceListeningView->GetShowtimeoutLabel()->Invalidate();
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_AivoiceThinkingView->CreateAivoiceThinkingView();
+ // AiVoiceScrollView[thisView] = p_AivoiceThinkingView->CreateAivoiceThinkingView();
+ UIScrollView *scrollview = p_AivoiceThinkingView->CreateAivoiceThinkingView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
return true;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_AivoiceReturnResultTextView->CreateAivoiceReturnResultTextView();
+ // AiVoiceScrollView[thisView] = p_AivoiceReturnResultTextView->CreateAivoiceReturnResultTextView();
+ UIScrollView *scrollview = p_AivoiceReturnResultTextView->CreateAivoiceReturnResultTextView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
return true;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_SetApiKeysView->CreateSetApiKeysView();
+ // AiVoiceScrollView[thisView] = p_SetApiKeysView->CreateSetApiKeysView();
+ UIScrollView *scrollview = p_SetApiKeysView->CreateSetApiKeysView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
return true;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_NotSetApiKeysView->CreateNotSetApiKeysView();
+ // AiVoiceScrollView[thisView] = p_NotSetApiKeysView->CreateNotSetApiKeysView();
+ UIScrollView *scrollview = p_NotSetApiKeysView->CreateNotSetApiKeysView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
return true;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_ApiKeysDeleteView->CreateApiKeysDeleteView();
+ // AiVoiceScrollView[thisView] = p_ApiKeysDeleteView->CreateApiKeysDeleteView();
+ UIScrollView *scrollview = p_ApiKeysDeleteView->CreateApiKeysDeleteView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
return true;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
return false;
}
- AiVoiceScrollView[thisView] = p_AiVoiceConnectingView->CreateAiVoiceConnectingView();
+ // AiVoiceScrollView[thisView] = p_AiVoiceConnectingView->CreateAiVoiceConnectingView();
+ UIScrollView *scrollview = p_AiVoiceConnectingView->CreateAiVoiceConnectingView();
+ if (scrollview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView);
+ return false;
+ }
+ AiVoiceScrollView[thisView] = scrollview;
container_->Add(AiVoiceScrollView[thisView]);
}
return true;
bool jug = (this->*(ViewMapper[i].func))(interface);
if (jug == false)
{
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::ClickFunc err.");
return false;
}
return true;
{
if (hideView == AiVoiceDestroyMapper[i])
{
- container_->Remove(AiVoiceScrollView[hideView]);
- AiVoiceScrollView[hideView] = nullptr;
+ if (AiVoiceScrollView[hideView] != nullptr)
+ {
+ container_->Remove(AiVoiceScrollView[hideView]);
+ AiVoiceScrollView[hideView] = nullptr;
+ }
break;
}
}
AiVoiceScrollView[hideView]->SetVisible(false);
ClickFunc(showView);
AiVoiceScrollView[showView]->SetVisible(true);
+ if (AiVoiceScrollView[showView] != nullptr)
+ {
+ AiVoiceScrollView[showView]->SetVisible(true);
+ }
+ else
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceScrollView[%d] is nullptr", showView);
+ }
Draw();
DestroyTempView(hideView);
AiVoiceModel::GetInstance().SetCurView(showView);