From 26b77840713857fa5995ffdf4cf1f178e4349e61 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Mon, 19 Aug 2024 02:30:37 +0000 Subject: [PATCH] Merge #716 into sdk602patch0626 from refs/changes/716/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 胡传军 * refs/changes/716/head: (10 commits squashed) - 修改br连接接口 改用消息机制 增加回连判断 实际实现传统蓝牙开关关闭则br连接不上(有BUG) - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 - 增加连接中 UI 及部分蓝牙问题修正 - 重新打开br广播 - 合并 - 改为默认开hfp和A2DP - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 - 电话UI更新 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 - BUG修复 Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/716 --- .../nativelauncher/include/UiConfig.h | 3 + .../nativeui/bluetooth/src/BluetoothModel.cpp | 9 +- .../nativeui/callerlog/src/CallerLogModel.cpp | 2 + .../src/LanguageSwitchPresenter.cpp | 2 + .../makephone/include/CallerDisplayView.h | 5 + .../nativeui/makephone/include/CallingView.h | 1 + .../makephone/include/MainCallingView.h | 2 +- .../makephone/src/CallerDisplayView.cpp | 125 +++++++++++++++--- .../nativeui/makephone/src/CallingView.cpp | 72 +++++++++- .../makephone/src/MainCallingPresenter.cpp | 10 +- .../makephone/src/MainCallingView.cpp | 4 +- .../makephone/src/WaitingHintsView.cpp | 2 +- .../phone/include/phoneaddressmodel.h | 2 +- .../nativeui/phone/src/MainPhoneView.cpp | 2 +- .../nativeui/phone/src/phoneaddressmodel.cpp | 6 +- .../src/RebootAndShutdownModel.cpp | 2 +- .../watchQRcode/src/WatchQRCodePresenter.cpp | 2 + .../makephone/include/CallerDisplayView.h | 1 + .../makephone/include/WaitingHintsView.h | 2 + .../service/ble_service/blemoder/bletest.cpp | 28 ++++ .../service/ble_service/blemoder/bletest.h | 8 ++ .../ble_service/bleservice/bleService.c | 19 ++- .../ble_service/bleservice/bleService.h | 4 + .../src/notify/makephone_notification.cpp | 4 +- .../fd230/fs/user/res/Phone/callanswer.bin | 3 + .../fd230/fs/user/res/Phone/callhangup.bin | 3 + .../peripheral/config/include/ConfigModel.h | 2 + 27 files changed, 287 insertions(+), 38 deletions(-) create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callanswer.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callhangup.bin diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index 72aee9e48..dbcaf05f7 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -132,6 +132,9 @@ namespace OHOS static constexpr const char *PNG_230_DIAL_IMAGE_PATH = APP_RES_PATH "/makephone/dial.bin"; static constexpr const char *PNG_230_HEADSET_1_IIMAGE_PATH = APP_RES_PATH "/makephone/headset_1.bin"; static constexpr const char *PNG_230_HEADSET_2_IIMAGE_PATH = APP_RES_PATH "/makephone/headset_2.bin"; + + static constexpr const char *PNG_ANSWER_230_TMAGE_PATH = APP_RES_PATH "/Phone/callanswer.bin"; + static constexpr const char *PNG_HANDUP_230_IMAGE_PATH = APP_RES_PATH "/Phone/callhangup.bin"; /* ---------------------------------- 血氧中图片 --------------------------------- */ static constexpr const char *PNG_BLOODOXYGEN_IMAGE_PATH = APP_RES_PATH "/BLOODOXYGEN_VIEW.bin"; static constexpr const char *PNG_PULLBUTTON_FACE_IMAGE = APP_RES_PATH "/BLOOD_FLOW_IMAGE_01.bin"; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp index 1f77b5c30..b00f97d17 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp @@ -766,9 +766,9 @@ void BtGapPairStatusChangedCallback(const bd_addr_t *bdAddr, int status) // { - //} - //uapi_a2dp_snk_connect(); - //a2dp_snk_connect(bdAddr); + // } + // uapi_a2dp_snk_connect(); + // a2dp_snk_connect(bdAddr); if(cm_custom_ble_service_on_flag() && !get_ble_pair()) { if(cm_get_A2DP_switch() || cm_get_HFP_switch()) @@ -776,7 +776,10 @@ void BtGapPairStatusChangedCallback(const bd_addr_t *bdAddr, int status) //uapi_reconnect(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_a2dp_snk_connect"); } + + if (status == GAP_PAIR_PAIRED) { + set_br_pair(); if (ConnectPhonePresenter::GetInstance() != nullptr) { NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp index f7a558031..4f4d2301b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp @@ -59,6 +59,8 @@ static void SetPriorityNumber() { time_t seconds; time(&seconds); + + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSourcePhone); // 接听和挂起状态需要持续显示通话计时 if (g_firstPriority != NO_NUMBER_STATUS) { // 接听 diff --git a/code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp index c291f4354..45fd84a0b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp @@ -15,6 +15,7 @@ #include "languagecode/LanguageInit.h" #include "ConfigModel.h" #include "settings/include/SettingModel.h" +#include "bleService.h" namespace OHOS { extern Language languages[]; @@ -159,6 +160,7 @@ namespace OHOS if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); + br_adv_start(20); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallerDisplayView.h b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallerDisplayView.h index de3703df4..fd39f5201 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallerDisplayView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallerDisplayView.h @@ -32,8 +32,13 @@ private: UIView::OnClickListener* clickLeftListener{nullptr}; UIImageView *imageAgreeing{nullptr}; UIImageView *imageDissgree{nullptr}; + UIImageView *imageperson{nullptr}; + UILabel *callerDisplay{nullptr}; UILabel *currentTimes{nullptr}; + + UILabel *label_call_source{nullptr}; + UILabel *label_call_hint{nullptr}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallingView.h b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallingView.h index a271c9e3e..c2f80ab42 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallingView.h @@ -24,6 +24,7 @@ public: CallingView(); ~CallingView(); UIViewGroup *CreateUIViewGroup(); + UIViewGroup *CreateUIViewGroup(uint8_t); UIImageView *GetImageMicrophone(); static CallingView *GetInstance(); UILabel *GetCallingDisplayLabel(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h index 4a49971c4..9845b3e28 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h @@ -42,7 +42,7 @@ private: UIViewGroup *waitingGroup{nullptr}; CallerDisplayView *displayView{nullptr}; CallingView *callView{nullptr}; - DialingScreenView *screenView{nullptr}; + CallingView *screenView{nullptr}; WaitingHintsView *waitingView{nullptr}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp index 7c14e3128..a8ebfd9ac 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp @@ -7,6 +7,7 @@ #include "CallerDisplayView.h" #include "MainCallingPresenter.h" #include "UiConfig.h" +#include "phoneaddressmodel.h" namespace OHOS { static constexpr uint16 MATH_ZERO = 0; @@ -30,6 +31,10 @@ static constexpr uint16 IMAGE_ALL_POSITION_Y = 240; static constexpr uint16 FONT_CURRENT_SIZE = 25; static constexpr uint16 FONT_CALLER_SIZE = 40; static CallerDisplayView *g_pMainView = nullptr; + +#define PHONE_DIR_GIRL_1 "/user/res/Phone/girl.bin" +#define PHONE_DIR_BOY_1 "/user/res/Phone/boy.bin" + CallerDisplayView::CallerDisplayView() { g_pMainView = this; @@ -46,12 +51,22 @@ CallerDisplayView::~CallerDisplayView() delete imageDissgree; imageDissgree = nullptr; + + delete imageperson; + imageperson = nullptr; + delete callerDisplay; callerDisplay = nullptr; + delete label_call_source; + label_call_source = nullptr; + delete currentTimes; currentTimes = nullptr; + delete label_call_hint; + label_call_hint = nullptr; + delete group; group = nullptr; @@ -80,8 +95,8 @@ bool CallerDisplayView::InitImageViewDisplay() if (imageAgreeing == nullptr) { return false; } - imageAgreeing->SetPosition(IMAGE_AGREEING_POSITION_X, IMAGE_ALL_POSITION_Y); // 30 : offset - imageAgreeing->SetSrc(PNG_AGREEING_IMAGE_PATH); + imageAgreeing->SetPosition(369, 207); // 30 : offset + imageAgreeing->SetSrc(PNG_ANSWER_230_TMAGE_PATH); imageAgreeing->SetTouchable(true); imageAgreeing->SetViewId("answer"); group->Add(imageAgreeing); @@ -90,12 +105,35 @@ bool CallerDisplayView::InitImageViewDisplay() if (imageDissgree == nullptr) { return false; } - imageDissgree->SetPosition(IMAGE_DISSGREE_POSITION_X, IMAGE_ALL_POSITION_Y); // 30 : offset - imageDissgree->SetSrc(PNG_DISSGREE_IMAGE_PATH); + imageDissgree->SetPosition(46, 207); // 30 : offset + imageDissgree->SetSrc(PNG_HANDUP_230_IMAGE_PATH); imageDissgree->SetTouchable(true); imageDissgree->SetViewId("displayHandUp"); group->Add(imageDissgree); + imageperson = new UIImageView(); + if (imageperson == nullptr) { + return false; + } + imageperson->SetPosition(158, 158); // 30 : offset + imageperson->SetSrc(PNG_230_PERSON_IMAGE_PATH); + imageperson->SetTouchable(true); + imageperson->SetViewId("headset"); + + char name_buf[30]={0}; + uint8_t sex; + if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex)) + { + if(sex) + imageperson->SetSrc(PHONE_DIR_BOY_1); + else + imageperson->SetSrc(PHONE_DIR_GIRL_1); + } + + group->Add(imageperson); + + + return true; } @@ -108,24 +146,79 @@ bool CallerDisplayView::InitUILabelDisplay() callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y, VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT); callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + + char name_buf[30]={0}; + if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL)) + { + callerDisplay->SetText(name_buf); + } + else + { + callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + } + callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER); callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE); callerDisplay->SetTextColor(Color::White()); + callerDisplay->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); group->Add(callerDisplay); - currentTimes = new UILabel(); - if (currentTimes == nullptr) { - return false; + if (label_call_hint == nullptr) { + label_call_hint = new UILabel(); } - currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y, - VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT); - currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER); - currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); - currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE); - currentTimes->SetTextColor(Color::White()); - group->Add(currentTimes); + + label_call_hint->SetPosition(163, 353); // widget's left position and top position + label_call_hint->Resize(140, 35); // widget's width and height + label_call_hint->SetViewId("label3");// Set style + label_call_hint->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + label_call_hint->SetText("挂断/接听"); + label_call_hint->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); + label_call_hint->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff)); + label_call_hint->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label_call_hint->SetRollSpeed(0); + label_call_hint->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + group->Add(label_call_hint); + + + if (label_call_source == nullptr) { + label_call_source = new UILabel(); + } + label_call_source->SetPosition(133, 34); // widget's left position and top position + label_call_source->Resize(200, 60); // widget's width and height + label_call_source->SetViewId("label1");// Set style + label_call_source->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) + label_call_source->SetText("手表来电"); + else + label_call_source->SetText("手机来电"); + + label_call_source->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + label_call_source->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff)); + label_call_source->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label_call_source->SetRollSpeed(0); + label_call_source->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + group->Add(label_call_source); + + + + // currentTimes = new UILabel(); + // if (currentTimes == nullptr) { + // return false; + // } + // currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y, + // VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT); + // currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + // currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER); + // currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); + // currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE); + // currentTimes->SetTextColor(Color::White()); + // group->Add(currentTimes); + + return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp index 9fd3061e1..64884b14f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp @@ -43,11 +43,15 @@ static constexpr uint16 LABEL_TIME_FONT_SIZE = 25; static constexpr uint16 LABEL_DISPLAY_FONE_SIZE = 40; static CallingView *g_pMainView = nullptr; +#define PHONE_DIR_GIRL_1 "/user/res/Phone/girl.bin" +#define PHONE_DIR_BOY_1 "/user/res/Phone/boy.bin" + CallingView::CallingView() { g_pMainView = this; } + CallingView::~CallingView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallingView::~CallingView"); @@ -73,6 +77,14 @@ CallingView::~CallingView() delete group; group = nullptr; + delete imagedial; + imagedial = nullptr; + + + delete imageperson; + imageperson = nullptr; + + if(dial_group) { dial_group->RemoveAll(); @@ -190,6 +202,16 @@ bool CallingView::InitImageViewDisplay() imageperson->SetTouchable(true); imageperson->SetViewId("headset"); group->Add(imageperson); + + char name_buf[30]={0}; + uint8_t sex; + if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex)) + { + if(sex) + imageperson->SetSrc(PHONE_DIR_BOY_1); + else + imageperson->SetSrc(PHONE_DIR_GIRL_1); + } return true; } @@ -213,7 +235,17 @@ bool CallingView::InitUILabelDisplay() callerDisplay->SetPosition(88, 81, 289, 40); callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + + char name_buf[30]={0}; + if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL)) + { + callerDisplay->SetText(name_buf); + } + else + { + callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + } + callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER); callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_DISPLAY_FONE_SIZE); callerDisplay->SetTextColor(Color::White()); @@ -242,7 +274,12 @@ bool CallingView::InitUILabelDisplay() 79, 35); currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER); + currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); + + + + currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); currentTimes->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff)); @@ -402,10 +439,39 @@ UIViewGroup *CallingView::CreateUIViewGroup() WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitAddOnclickevent error"); return nullptr; } + return group; +} - - +UIViewGroup *CallingView::CreateUIViewGroup(uint8_t type) +{ + group = new UIViewGroup(); + if (group == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::UIViewGroup::new group error"); + return nullptr; + } + group->SetPosition(MATH_ZERO, MATH_ZERO); + group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value + if (!InitImageViewDisplay()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitImageViewDisplay error"); + return nullptr; + } + if (!InitUILabelDisplay()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitUILabelDisplay error"); + return nullptr; + } + currentTimes->SetText("拨号中..."); /* code */ + + if(!Initshowdial()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitUILabelDisplay error"); + return nullptr; + } + if (!InitAddOnclickevent()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitAddOnclickevent error"); + return nullptr; + } return group; } + } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp index e3280e157..c0490bbdc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp @@ -132,10 +132,10 @@ bool MainCallingPresenter::InitPointerValue() return false; } - if (DialingScreenView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] DialingScreenView error"); - return false; - } + // if (DialingScreenView::GetInstance() == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] DialingScreenView error"); + // return false; + // } if (CallingView::GetInstance() == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[InitPointerValue] CallingView error"); @@ -184,7 +184,7 @@ bool MainCallingPresenter::HintsHandupClick() bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) { UNUSED(event); - + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",view.GetViewId()); if (!InitPointerValue()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::InitPointerValue error"); return false; diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp index 36031b779..5180df580 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp @@ -89,13 +89,13 @@ bool MainCallingView::InitPointerValue() return false; } - screenView = new DialingScreenView(); + screenView = new CallingView(); if (screenView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::screenView"); return false; } - screenGroup = screenView->CreateUIViewGroup(); + screenGroup = screenView->CreateUIViewGroup(0); if (screenGroup == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingView::screenGroup"); return false; diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp index 718631666..87db04345 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp @@ -97,7 +97,7 @@ bool WaitingHintsView::InitUILabelDisplay() VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT); callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); char name_buf[30]={0}; - if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str())) + if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL)) { callerDisplay->SetText(name_buf); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h index 742482951..d569692d6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h @@ -46,7 +46,7 @@ void read_addressbook_bin_file(); void add_addressbook(struct Contact *data); -bool get_phone_addrss_name(char *name,const char *phone); +bool get_phone_addrss_name(char *name,const char *phone,uint8_t *sex); void free_address(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp index 3236778dd..caac42c1e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp @@ -294,7 +294,7 @@ namespace OHOS sprintf_s(buf,20,"%s",(const char*)(info + i - 1)->tel); char name[30]={0}; - if(get_phone_addrss_name(name,buf)) + if(get_phone_addrss_name(name,buf,NULL)) { buttonconfig.str=name; }else diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp index 430eeba9f..90254c38f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp @@ -130,13 +130,15 @@ namespace OHOS // } } - bool get_phone_addrss_name(char *name,const char *phone) + bool get_phone_addrss_name(char *name,const char *phone,uint8_t *sex) { for(int i=0;i #include "themestyle/include/ThemeStyleModel.h" #include "aivoice/include/AiVoiceModel.h" -#include "ConfigModel.h" #include "graphic_service.h" +#include "bleService.h" namespace OHOS { RebootAndShutdownModel::RebootAndShutdownModel() {} diff --git a/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp index 65491b63f..176ef97f4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp @@ -7,6 +7,7 @@ #include #include "UiConfig.h" #include +#include "bleService.h" namespace OHOS { @@ -89,6 +90,7 @@ namespace OHOS if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); + br_adv_start(20); } return true; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/CallerDisplayView.h b/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/CallerDisplayView.h index 7a3ff3801..5b9221b52 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/CallerDisplayView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/CallerDisplayView.h @@ -31,6 +31,7 @@ private: UIView::OnClickListener* clickLeftListener{nullptr}; UIImageView *imageAgreeing{nullptr}; UIImageView *imageDissgree{nullptr}; + UILabel *callerDisplay{nullptr}; UILabel *currentTimes{nullptr}; }; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/WaitingHintsView.h b/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/WaitingHintsView.h index 2fdade598..afbc15026 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/WaitingHintsView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/WaitingHintsView.h @@ -29,6 +29,8 @@ private: UIViewGroup *group{nullptr}; UIView::OnClickListener* clickLeftListener{nullptr}; UIImageView *imageDissgree{nullptr}; + + UILabel *callerDisplay{nullptr}; UILabel *newcallHints{nullptr}; }; diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 53099b79d..4169bff40 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -78,6 +78,7 @@ extern "C" { #include #include +#include "power_display_service.h" #define before_file_day 30 @@ -87,6 +88,11 @@ void get_music_path(char *buf,uint8_t max_len) memcpy_s(buf,max_len,path.c_str(),path.length()); } +bool is_first_pair(void) +{ + return OHOS::ConfigModel::GetInstance()->GetisFirstTimeStart(); +} + //在此处实现,给UI回复消息。 void ble_app_reply(bool data) @@ -142,7 +148,29 @@ uint8_t get_ble_pair(void) } +uint8_t get_br_is_pair(void) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + + return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_BR_PAIR); +} + +void set_br_pair(void) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + + p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_BR_PAIR,1); + return; +} +bool get_lcd_state(void) +{ + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + if (display_api->get_screen_state() != SCREEN_ON) + return false; + else + return true; +} uint8_t ble_get_heart_data() { diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h index 16c4cafa5..76e5559e6 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -345,6 +345,14 @@ void SendDtfmStrNumberToCat1(char ch); //ble发送单个字符到CAT1 DTMF功能 void delete_before_file(uint8_t type); +bool is_first_pair(void); + +uint8_t get_br_is_pair(void); + +void set_br_pair(void); + +bool get_lcd_state(void); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c index 26dd320c1..d9ab47984 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -155,6 +155,23 @@ void svr_ble_adv_start(void) } +void br_adv_start(uint8_t sec) +{ + //ble广播开启 + svr_ble_adv_start_param(); + + if(!get_br_is_pair()) + { + gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, sec); + } +} + +void br_adv_stop(void) +{ + gap_br_set_bt_scan_mode(GAP_SCAN_MODE_NONE, 0); +} + + /* adapt ios adv data. *///设置广播和扫描数据 static void svr_ble_adv_data_set(int adv_id) { @@ -1458,7 +1475,7 @@ void custom_ble_service_start(void) AdverFlag = true; svr_ble_adv_start_param(); - //gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE, 0); + gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE, 0); } diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h index 06adf911b..a955a2f7f 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h @@ -57,6 +57,10 @@ errcode_t uapi_blesrv_service_init(void); void custom_ble_service_start_(uint8_t data); void uapi_ble_disconnect_device(void); + +void br_adv_start(uint8_t sec); + +void br_adv_stop(void); #ifdef __cplusplus } #endif diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp index 7fe4087f0..e4502fea0 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp @@ -766,7 +766,7 @@ static bool DrawPhoneCallViewLabel(void) const char *number=CallerLogModel::GetInstance()->GetPhoneNumber().c_str(); char name[32]={0}; #ifdef FD230 - get_phone_addrss_name(name,number); + get_phone_addrss_name(name,number,NULL); #endif callername->SetText(name); callername->SetAlign(TEXT_ALIGNMENT_CENTER); @@ -914,7 +914,7 @@ UIViewGroup* CreateCalldialView(void) char name_buf[30]={0}; - if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str())) + if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL)) { diallabl2->SetText(name_buf); } diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callanswer.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callanswer.bin new file mode 100644 index 000000000..b19817feb --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callanswer.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd8a757900d7490b0d4260452e36470867af3604554269256f99ee0ce0b43612 +size 1144 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callhangup.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callhangup.bin new file mode 100644 index 000000000..2debdabc6 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callhangup.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:780f9fa26c2ee54ec5c22e1f31f71e4290cecedc623e655e8d82c32a9f98d561 +size 1896 diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModel.h b/code/sdk/drivers/peripheral/config/include/ConfigModel.h index 260ea7a5e..63ebea390 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModel.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModel.h @@ -132,6 +132,7 @@ namespace OHOS CONFIGMODEL_ITEM_OPEN_AI_API_KEYS,//API Keys CONFIGMODEL_ITEM_APPLIST_STYLE,//applist的显示样式 CONFIGMODEL_ITEM_BLE_IOS_OR_ANDROID,//绑定设备为安卓或者ios 0:安卓 1:苹果 + CONFIGMODEL_ITEM_BR_PAIR,//br第一次绑定 CONFIGMODEL_ITEM_MAX, @@ -387,6 +388,7 @@ namespace OHOS {ConfigDataType::DATATYPE_STRING, "open_ai_api_keys", "-1" }, //CONFIGMODEL_ITEM_OPEN_AI_API_KEYS {ConfigDataType::DATATYPE_STRING, "applist_style", "list" }, //CONFIGMODEL_ITEM_APPLIST_STYLE {ConfigDataType::DATATYPE_INT, "android_or_ios", "0" },//CONFIGMODEL_ITEM_BLE_IOS_OR_ANDROID + {ConfigDataType::DATATYPE_INT, "br_pari" , "0"}, }; ConfigModel(); // 私有构造函数,确保无法在外部实例化 ConfigModel(const ConfigModel &) = delete; // 禁止拷贝构造 -- 2.17.1