解决下拉界面连接状态异常问题 2175/1 2175/head 2176/target/1
authorluozheng <1732036298@qq.com>
Fri, 29 Aug 2025 07:46:52 +0000 (15:46 +0800)
committerluozheng <1732036298@qq.com>
Fri, 29 Aug 2025 07:46:52 +0000 (15:46 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/PullUpDownView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingModel.cpp

index ab99d3c..c64d882 100644 (file)
@@ -16,8 +16,6 @@
 #include "iostream"
 #include <string>        // For std::string
 #include <unordered_map> // For std::unordered_map
-#include <string>        // For std::string
-#include <unordered_map> // For std::unordered_map
 
 #ifdef SUPPORT_BLE_SERVICE
 #include <bleEvent.h>
@@ -671,8 +669,7 @@ namespace OHOS
         {
             if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID))
             {
-                /*AI对话界面右滑退出当前Slice*/
-                // NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+                //开始对话界面,右滑切换界面
                 DragLeftToRightChangeAIModel();
             }
             else if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_ALERT_APPBLUETOOTH_AND_4GNETWORK_VIEWID))
@@ -727,7 +724,7 @@ namespace OHOS
         }
         else if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT && event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP) /*上滑*/
         {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DIRECTION_BOTTOM_TO_TOP");
+            //如果选择的模型是在chatgpt
             if (model->IsExistOpenAIAPIKeys() == true)
             {
                 ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_SETAPIKEYS); /*开始对话界面->API Keys set界面*/
index 6df5a4b..52018d7 100644 (file)
@@ -129,11 +129,7 @@ namespace OHOS
         // else
         // return false;
 
-#ifdef FD230
         return SettingModel::GetInstance().GetPhoneConnectStatus();
-#else
-        return false;
-#endif
     }
     // 获取蓝牙耳机连接状态
     bool PullUpDownView::GetEarPhoneConnectedStatus(void)
@@ -145,11 +141,8 @@ namespace OHOS
         //     return true;
         // else
         // return false;
-#ifdef FD230
+
         return SettingModel::GetInstance().GetEarPhoneConnectStatus();
-#else
-        return false;
-#endif
     }
     // 获取蓝牙连接状态
     bool PullUpDownView::GetBlueToothConnectedStatus(void)
@@ -162,11 +155,7 @@ namespace OHOS
         // else
         // return false;
 
-#ifdef FD230
         return SettingModel::GetInstance().GetBlueToothConnectStatus();
-#else
-        return false;
-#endif
     }
 
     // 设置蓝牙连接状态是否显示
@@ -537,9 +526,7 @@ namespace OHOS
         /* -------------------------------------------------------------------------- */
         UpdateSignalStrengthStatusAndBatteryPosition();
 /* -------------------------------------------------------------------------- */
-#ifdef FD230
         MainPresenterSample::GetInstance()->UpdataBaseData();
-#endif
         /* -------------------------------------------------------------------------- */
         UpdateBatteryProcess();
     }
@@ -889,13 +876,11 @@ namespace OHOS
         updateSignalDisplay(); // 函数用于更新信号显示的UI
         UpdateXPosition();
 
-#ifdef FD230
         /*更新蓝牙连接状态*/
         int a2dp = uapi_a2dp_snk_get_device_connect_state();
         int hfp = uapi_hfp_connect_state();
-        bool bluetoothstatus = (a2dp == 0 && hfp == 0) ? false : true;
+        int bluetoothstatus = (a2dp == 0 && hfp == 0) ? 0 : 1;
         UpdateBlueToothStatus(bluetoothstatus);
-#endif
     }
 
     // 更新是否是充电状态
index 136b2aa..2e54d98 100644 (file)
@@ -105,6 +105,10 @@ namespace OHOS
         // {
         //     btConnectStatus = true;
         // }
+        int a2dp = uapi_a2dp_snk_get_device_connect_state();
+        int hfp = uapi_hfp_connect_state();
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "a2dp:%d,hfp:%d",a2dp,hfp);
+        btConnectStatus = (a2dp == 0 && hfp == 0) ? 0 : 1;
         #else
         btConnectStatus = false;
         #endif