From ae2b15b8309d1dfc3ba21ff4e53b5901a1b00438 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 3 Sep 2024 20:38:52 +0800 Subject: [PATCH] =?utf8?q?=E9=9F=B3=E4=B9=90=E8=93=9D=E7=89=99=E8=BF=9E?= =?utf8?q?=E6=8E=A5=E5=A4=B1=E8=B4=A5=E8=A7=86=E5=9B=BE=E4=BC=98=E5=8C=96?= =?utf8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E8=A7=86=E5=9B=BE=E4=B8=AD=E6=B7=BB?= =?utf8?q?=E5=8A=A0=E8=93=9D=E7=89=99=E8=80=B3=E6=9C=BA=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/MusicPlayerBTConnectFailedView.h | 6 ++++-- .../src/MusicPlayerBTConnectFailedView.cpp | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/MusicPlayerBTConnectFailedView.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/MusicPlayerBTConnectFailedView.h index 9615c6d42..ad3e92a78 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/MusicPlayerBTConnectFailedView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/MusicPlayerBTConnectFailedView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-12 11:31:35 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-12 17:08:31 + * @LastEditTime: 2024-09-03 20:13:24 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/MusicPlayerBTConnectFailedView.cpp */ #ifndef MUSIC_PLAYER_BTCONNECTFAILED_VIEW_H @@ -25,17 +25,19 @@ namespace OHOS bool CreateMusicPlayerBTConnectFailedViewLabel(); bool CreateMusicPlayerBTConnectFailedViewButton(); void ClearAll(); + void get_bt_name(void); UIViewGroup *group{nullptr}; UIScrollView *scrollView{nullptr}; UILabelExt *titleLabel{nullptr}; // 标题 UILabelExt *IPoneLabel{nullptr}; - UILabelExt *AndroidLabel{nullptr}; + UILabelExt *AndroidLabel{nullptr}; UILabelExt *BTNoteLabel1{nullptr}; UILabelExt *BTNoteLabel2{nullptr}; UILabelExt *BTNoteLabel3{nullptr}; UILabelExt *CloseLabel{nullptr}; UIButton *CloseButton{nullptr}; UIView::OnDragListener *dragListener{nullptr}; + uint8_t ble_name[30]{0}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp index e889d663c..625281acf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-12 11:31:43 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-12 17:19:23 + * @LastEditTime: 2024-09-03 20:31:31 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp */ #include "player/include/MusicPlayerBTConnectFailedView.h" @@ -10,7 +10,8 @@ #include "player/include/PlayersView.h" #include "wearable_log.h" #include "ui_resource_string.h" - +#include +#include "uicomponents/UIComponents.h" namespace OHOS { static constexpr const char *CLOSEBUTTON_VIEWID = "CLOSEButton"; @@ -164,6 +165,7 @@ namespace OHOS BTNoteLabel2->SetStyle(STYLE_TEXT_FONT, 30); BTNoteLabel2->SetStyle(STYLE_LINE_HEIGHT, 35); BTNoteLabel2->SetTextId(STR_ENABLE_BLUETOOTH_CALL_NOTE_IPHONE); + UpdateLabel(BTNoteLabel2, (char *)ble_name, STR_ENABLE_BLUETOOTH_CALL_NOTE_IPHONE); BTNoteLabel2->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); BTNoteLabel2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* ------------------------------- AndroidLabel ------------------------------- */ @@ -179,7 +181,7 @@ namespace OHOS AndroidLabel->SetPosition(53, BTNoteLabel2->GetY() + BTNoteLabel2->GetTextHeight() + 40, 360, 35); AndroidLabel->SetStyle(STYLE_TEXT_FONT, 30); AndroidLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - AndroidLabel->SetTextId(STR_IPHONE); + AndroidLabel->SetTextId(STR_ANDROID); AndroidLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); AndroidLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* ------------------------------ BTNoteLabel3 ------------------------------ */ @@ -196,6 +198,7 @@ namespace OHOS BTNoteLabel3->SetStyle(STYLE_TEXT_FONT, 30); BTNoteLabel3->SetStyle(STYLE_LINE_HEIGHT, 35); BTNoteLabel3->SetTextId(STR_ENABLE_BLUETOOTH_CALL_NOTE_ANDROID); + UpdateLabel(BTNoteLabel3, (char *)ble_name, STR_ENABLE_BLUETOOTH_CALL_NOTE_ANDROID); BTNoteLabel3->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); BTNoteLabel3->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* ------------------------------- CloseLabel ------------------------------- */ @@ -285,6 +288,9 @@ namespace OHOS scrollView->SetMaxScrollDistance(1000); scrollView->SetDirection(UIScrollView::VERTICAL); + /* --------------------------------- 获取蓝牙名称 --------------------------------- */ + get_bt_name(); + /* -------------------------------------------------------------------------- */ if (!CreateMusicPlayerBTConnectFailedViewLabel() || !CreateMusicPlayerBTConnectFailedViewButton()) { return nullptr; @@ -302,4 +308,9 @@ namespace OHOS return group; } + void MusicPlayerBTConnectFailedView::get_bt_name(void) + { + uint32_t ble_name_len = sizeof(ble_name); + uapi_get_nv_btname(ble_name, &ble_name_len); + } } \ No newline at end of file -- 2.17.1