From 90a62f8fcda66b0ca3a64b36b1c4dbf77edc48ea Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 2 Dec 2025 17:41:27 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E8=BF=9E=E6=8E=A5=E8=93=9D?= =?utf8?q?=E7=89=99=E5=87=BA=E7=8E=B0=E5=9C=B0=E5=9D=80=E4=B8=BA0=E6=83=85?= =?utf8?q?=E5=86=B5=E5=AF=BC=E8=87=B4=E8=BF=9E=E4=B8=8D=E4=B8=8Abug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../thunderbird/include/ThunderBirdBlueView.h | 3 +++ .../thunderbird/src/ThunderBirdBlueView.cpp | 19 ++++++++++++++++--- .../thunderbird/src/ThunderBirdModel.cpp | 2 ++ .../src/ThunderBirdReminderView.cpp | 5 ++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdBlueView.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdBlueView.h index 40c18ce38..532712cd7 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdBlueView.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdBlueView.h @@ -9,6 +9,7 @@ #include "components/ui_image_animator.h" #include "components/ui_list.h" #include "UiConfig.h" +#include "bluetooth/BluetoothModel.h" namespace OHOS { @@ -118,6 +119,8 @@ namespace OHOS // 当前视图状态 int16_t currentShowView_{-1}; + + bd_addr_t targetAddr{0}; }; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdBlueView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdBlueView.cpp index 9350f483b..e780264ad 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdBlueView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdBlueView.cpp @@ -6,7 +6,6 @@ #include "custom_utils.h" #include "vibrator_service.h" #include "bluetooth/Ln_Bluetooth_apiC.h" -#include "bluetooth/BluetoothModel.h" namespace OHOS @@ -834,7 +833,14 @@ namespace OHOS RefreshDeviceList(); // 发起连接 - BluetoothModel::GetInstance()->ConnectRemoteDevice((const bd_addr_t*)&selectedDevice->addr); + // 注意:BluetoothCaseInfo::addr 只是一个 6 字节数组,这里需要组装成 bd_addr_t 结构再传给 ConnectRemoteDevice + memset(&targetAddr, 0, sizeof(bd_addr_t)); + (void)memcpy_s(targetAddr.addr, BD_ADDR_LEN, BluetoothModel::GetInstance()->GetTempMacValue()->addr, BD_ADDR_LEN); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + "OnKeyConfirm: ConnectRemoteDevice targetAddr=%02x%02x%02x%02x%02x%02x", + targetAddr.addr[5], targetAddr.addr[4], targetAddr.addr[3], + targetAddr.addr[2], targetAddr.addr[1], targetAddr.addr[0]); + BluetoothModel::GetInstance()->ConnectRemoteDevice(&targetAddr); return; } @@ -882,7 +888,14 @@ namespace OHOS RefreshDeviceList(); // 发起连接 - BluetoothModel::GetInstance()->ConnectRemoteDevice((const bd_addr_t*)&caseInfo->addr); + // 注意:BluetoothCaseInfo::addr 只是一个 6 字节数组,这里需要组装成 bd_addr_t 结构再传给 ConnectRemoteDevice + memset(&targetAddr, 0, sizeof(bd_addr_t)); + (void)memcpy_s(targetAddr.addr, BD_ADDR_LEN, caseInfo->addr, BD_ADDR_LEN); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + "OnConnectFailed: ConnectRemoteDevice targetAddr=%02x%02x%02x%02x%02x%02x", + targetAddr.addr[5], targetAddr.addr[4], targetAddr.addr[3], + targetAddr.addr[2], targetAddr.addr[1], targetAddr.addr[0]); + BluetoothModel::GetInstance()->ConnectRemoteDevice(&targetAddr); return; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index bdce4603a..86af911ae 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -2916,6 +2916,8 @@ extern "C" { int currentView = ThunderBirdMainView::GetInstance()->GetCurrentView(); //获取当前视图 ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_ADJUSTVIEW, ThunderBirdAdjustView::THUNDERBIRD_ADJUSTVIEW_BIND_SUCCESS); } + int volume = AudioManager::GetInstance().SetVolume(AUDIO_STREAM_VOICE_ASSISTANT, 50); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleBindAndUnbind: 绑定成功,当前音量=%d", volume); bind_status = true; return; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp index c5e0947f9..e70e9f530 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp @@ -101,6 +101,9 @@ namespace OHOS { VolumeProgress->SetPosition(118, 132, 124, 4); VolumeProgress->SetRange(100, 0); + int volumeDelta = AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_ASSISTANT); + printf("volumeDelta = %d\n", volumeDelta); + VolumeProgress->SetValue(volumeDelta); VolumeProgress->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0xff); VolumeProgress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xffb4a9a0); VolumeProgress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); @@ -476,7 +479,7 @@ namespace OHOS { return; } - int16_t newVal = remindProgressValue_ + delta; + int16_t newVal = AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_ASSISTANT) + delta; SetRemindProgress(newVal); // 若当前处于音量界面,确保控件可见 if (RemindButton) { RemindButton->SetVisible(true); } -- 2.17.1