语音助手:增加使用语音助手的情况下不进行弹窗 1636/2
authorCaisking <3449750381@qq.com>
Sat, 18 Jan 2025 03:44:20 +0000 (11:44 +0800)
committerCaisking <3449750381@qq.com>
Sat, 18 Jan 2025 03:44:20 +0000 (11:44 +0800)
code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantModel.cpp
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp
code/sdk/drivers/peripheral/utils/custom_runtime.c
code/sdk/drivers/peripheral/utils/custom_runtime.h

index 75ccc7e..a9bd880 100644 (file)
@@ -145,6 +145,8 @@ bool AssistantModel::GetHFPStatus(void) {
 bool AssistantModel::StartAssistant(void) {
   if (uapi_open_voice_recognition() == 0) {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is ok");
+    //成功开启语音助手
+    uapi_dev_runtime_set_voice_status(1);
     return true;
   }
   WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
@@ -153,7 +155,6 @@ bool AssistantModel::StartAssistant(void) {
 }
 //关闭语音助手
 void AssistantModel::StopAssistant(void) {
-
   if (uapi_close_voice_recognition() == 0) {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
                   "uapi_close_voice_recognition is ok");
@@ -175,6 +176,8 @@ bool AssistantModel::ChangeToMainView(void) {
               ->IsVisible() == true &&
       p_AssistantView->GetAssistantScrollView(ASSISTANT_MAIN_VIEW)
               ->IsVisible() == false) {
+    //设置退出状态
+    uapi_dev_runtime_set_voice_status(0);
     p_AssistantView->ChangeView(ASSISTANT_ANSWER_VIEW, ASSISTANT_MAIN_VIEW);
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "退出语音助手成功\r\n");
   }
index 83d0423..9566ae1 100644 (file)
@@ -207,9 +207,17 @@ static void Notify(void *args, const Topic topic, Request *request) {
 
     messageTimestamp = currentTimestamp;
 
+    /*
+      以下状态不进行消息弹窗
+      -训练中
+      -省电模式
+      -呼吸训练中
+      -使用语音助手
+    */
     if (uapi_dev_runtime_get_train_status() ||
         uapi_dev_runtime_get_saveele_status() ||
-        uapi_dev_runtime_get_respiratory_training_status()) {
+        uapi_dev_runtime_get_respiratory_training_status() ||
+        uapi_dev_runtime_get_voice_status()) {
 
       free(messageInfo_.title);
       free(messageInfo_.msg);
@@ -533,8 +541,6 @@ void MessageModel::AddMessageData(ancs_data_info_t *messageInfo) {
   WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageInfo add is ok");
 }
 
-
-
 // 获取目前的项
 MessageData *MessageModel::GetCurrentMessageData() {
   if (currentIndex_ < MessageVector.size()) {
index 04e1656..c316da0 100644 (file)
@@ -106,6 +106,7 @@ typedef struct
     uint8_t transmitting_status;//是否处于ble传输状态
 
     uint8_t atuoota_status;//是否处于自动ota状态
+    uint8_t voice_status;//是否处于使用语音助手
 } runtime_status_t;
 
 
@@ -609,6 +610,15 @@ uint8_t uapi_dev_runtime_get_heartrate_detect_status(void)
 {
     return g_runtime.heartrate_detect_status;
 }
+//设置是否在使用语音助手功能
+void uapi_dev_runtime_set_voice_status(uint8_t status)
+{
+    g_runtime.voice_status = status;
+}
+uint8_t uapi_dev_runtime_get_voice_status(void)
+{
+    return g_runtime.voice_status;
+}
 // 设置是否为指南针页面状态
 void uapi_dev_runtime_set_mmc_status(uint8_t status)
 {
index 147df7a..1f414c9 100644 (file)
@@ -285,6 +285,9 @@ void uapi_dev_runtime_set_safemode_flag(uint8_t status);
 // 安全模式
 uint8_t uapi_dev_runtime_get_safemode_flag(void);
 
+//是否使用语音助手状态
+void uapi_dev_runtime_set_voice_status(uint8_t status);
+uint8_t uapi_dev_runtime_get_voice_status(void);
 
 void uapi_dev_runtime_set_hrs_passivity(uint8_t status);
 // 获取被动心率检测状态