From aefce6dc36a73a2c8364b0cbdf5d9ef628ee8b7d Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 31 Oct 2024 16:31:48 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E8=80=B3=E6=9C=BA=E9=85=8D?= =?utf8?q?=E5=AF=B9=E5=90=8E=E9=87=8D=E5=90=AF=E8=93=9D=E7=89=99=E8=80=B3?= =?utf8?q?=E6=9C=BA=E8=BF=9E=E6=8E=A5=E7=82=B9=E5=87=BB=E6=97=A0=E5=8F=8D?= =?utf8?q?=E5=BA=94bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/BluetoothDeviceCaseListAdapter.cpp | 15 +++++++++++---- .../nativeui/player/src/MusicPlayerSourceView.cpp | 9 ++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp index 5be4c75c0..c6346f7f3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp @@ -76,17 +76,24 @@ public: if(view.GetViewType() == UIViewType::UI_BUTTON) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UIViewType::UI_BUTTON,%s",reinterpret_cast(bluetoothInfo_.deviceName)); - // 判断是否正在连接 bd_addr_t *lastAddr = BluetoothModel::GetInstance()->GetLastConnedAddr(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "lastAddr:%02X %02X %02X * * *", + lastAddr->addr[0],lastAddr->addr[1],lastAddr->addr[2]); + bool ret = bt_is_acl_connected(lastAddr); - if (ret) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bt_is_acl_connected:%d lastAddr:%02X %02X %02X * * *", + ret, lastAddr->addr[0],lastAddr->addr[1],lastAddr->addr[2]); + + //地址不是全0并且ret为真 + if (!( lastAddr->addr[0] == 0 && lastAddr->addr[1] == 0 && lastAddr->addr[2] == 0 && + lastAddr->addr[3] == 0 && lastAddr->addr[4] == 0 && lastAddr->addr[5] == 0 ) && ret) { BluetoothModel::GetInstance()->SetTagConnectNew(false); errcode_t retVal = gap_disconnect_remote_device(lastAddr); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Disconnect LastDevice retVal = %d", retVal); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[gap_disconnect_remote_device] retVal = %d", retVal); } else { mainBluetoothView->ChangeView(BluetoothModel::GetInstance()->GetCurView(), BLUETOOTHRECONNECTVIEW); errcode_t retVal = BluetoothModel::GetInstance()->ConnectRemoteDevice(&addr); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectRemoteDevice ret = %d", retVal); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ConnectRemoteDevice] retVal = %d", retVal); } } else if(view.GetViewType() == UIViewType::UI_IMAGE_VIEW) /*点击的是图片*/ diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp index fe94d9900..ee89bf6a0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp @@ -516,16 +516,19 @@ namespace OHOS { bool state = SettingModel::GetInstance().GetEarPhoneConnectStatus(); List &bluetoothCaseList = BluetoothModel::GetInstance()->GetConnedDevicesCase(); - if (bluetoothCaseList.IsEmpty()) // 如果已连接设备列表为空,则显示未配对 + bool ConnedDevicesListIsEmpty = bluetoothCaseList.IsEmpty(); + if (ConnedDevicesListIsEmpty) // 如果已连接设备列表为空,则显示未配对 { bluetoothHeadsetConnectState->SetTextId(STR_NOT_PAIRED); + bluetoothHeadsetConnectState->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); + bluetoothHeadsetConnectState->Invalidate(); } else // 否则则显示连接状态 { bluetoothHeadsetConnectState->SetTextId(state ? STR_CONNECTED : STR_DISCONNECTED); + bluetoothHeadsetConnectState->SetTextColor(state ? Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff) : Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); + bluetoothHeadsetConnectState->Invalidate(); } - bluetoothHeadsetConnectState->SetTextColor(state ? Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff) : Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); - bluetoothHeadsetConnectState->Invalidate(); } } } -- 2.17.1