电话UI更新
authorhcj <1224667075@qq.com>
Sat, 17 Aug 2024 09:16:10 +0000 (17:16 +0800)
committerhcj <1224667075@qq.com>
Sat, 17 Aug 2024 09:16:10 +0000 (17:16 +0800)
26 files changed:
code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h
code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp
code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp
code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallerDisplayView.h
code/sdk/application/wearable/fd230app/nativeui/makephone/include/CallingView.h
code/sdk/application/wearable/fd230app/nativeui/makephone/include/MainCallingView.h
code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingView.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/include/phoneaddressmodel.h
code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp
code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp
code/sdk/application/wearable/nativeapp/nativeui/makephone/include/CallerDisplayView.h
code/sdk/application/wearable/nativeapp/nativeui/makephone/include/WaitingHintsView.h
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.h
code/sdk/application/wearable/service/ble_service/bleservice/bleService.c
code/sdk/application/wearable/service/ble_service/bleservice/bleService.h
code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callanswer.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/callhangup.bin [new file with mode: 0644]
code/sdk/drivers/peripheral/config/include/ConfigModel.h

index 72aee9e..dbcaf05 100644 (file)
@@ -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";
index 586115c..c3a877c 100644 (file)
@@ -763,9 +763,9 @@ void BtGapPairStatusChangedCallback(const bd_addr_t *bdAddr, int status)
     // { \r
    \r
         \r
-    //}\r
-    //uapi_a2dp_snk_connect();\r
-    //a2dp_snk_connect(bdAddr);\r
+    // }\r
+    // uapi_a2dp_snk_connect();\r
+    // a2dp_snk_connect(bdAddr);\r
     if(cm_custom_ble_service_on_flag() && !get_ble_pair())\r
     {\r
         if(cm_get_A2DP_switch() || cm_get_HFP_switch())\r
@@ -773,7 +773,10 @@ void BtGapPairStatusChangedCallback(const bd_addr_t *bdAddr, int status)
         //uapi_reconnect();\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_a2dp_snk_connect");\r
     }\r
+   \r
+\r
     if (status == GAP_PAIR_PAIRED) {\r
+        set_br_pair();\r
         if (ConnectPhonePresenter::GetInstance() != nullptr) {\r
             NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING);\r
         }\r
index f7a5580..4f4d230 100644 (file)
@@ -59,6 +59,8 @@ static void SetPriorityNumber()
 {
     time_t seconds;
     time(&seconds);
+    
+    CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSourcePhone);
 
     // 接听和挂起状态需要持续显示通话计时
     if (g_firstPriority != NO_NUMBER_STATUS) { // 接听
index c291f43..45fd84a 100644 (file)
@@ -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<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0)
         {
             NativeAbility::GetInstance().Back();
+            br_adv_start(20);
         }
         return true;
     }
index de3703d..fd39f52 100644 (file)
@@ -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};
 };
 }
 
index a271c9e..c2f80ab 100644 (file)
@@ -24,6 +24,7 @@ public:
     CallingView();
     ~CallingView();
     UIViewGroup *CreateUIViewGroup();
+    UIViewGroup *CreateUIViewGroup(uint8_t);
     UIImageView *GetImageMicrophone();
     static CallingView *GetInstance();
     UILabel *GetCallingDisplayLabel();
index 4a49971..9845b3e 100644 (file)
@@ -42,7 +42,7 @@ private:
     UIViewGroup *waitingGroup{nullptr};
     CallerDisplayView *displayView{nullptr};
     CallingView *callView{nullptr};
-    DialingScreenView *screenView{nullptr};
+    CallingView *screenView{nullptr};
     WaitingHintsView *waitingView{nullptr};
 };
 }
index 7c14e31..a8ebfd9 100644 (file)
@@ -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;
 }
 
index 9fd3061..64884b1 100644 (file)
@@ -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
index 36031b7..5180df5 100644 (file)
@@ -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;
index 7186316..87db043 100644 (file)
@@ -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);
     }
index 7424829..d569692 100644 (file)
@@ -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();
 
index 3236778..caac42c 100644 (file)
@@ -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
index 430eeba..90254c3 100644 (file)
@@ -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<addressbook_t.num;i++)
         {
             if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[0].number)==0)
             {
                 strcpy(name,addressbook_t.Contact_t[i].name);
+                if(sex!=NULL)
+                *sex=addressbook_t.Contact_t[i].sex;
                 return true;
             }
             else if(phone,addressbook_t.Contact_t[i].phone_num==2)
@@ -144,6 +146,8 @@ namespace OHOS
                 if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[1].number)==0)
                 {
                     strcpy(name,addressbook_t.Contact_t[i].name);
+                    if(sex!=NULL)
+                    *sex=addressbook_t.Contact_t[i].sex;
                     return true;
                 }   
             }
index b258fd9..0224802 100644 (file)
@@ -16,8 +16,8 @@
 #include <custom_utils.h>
 #include "themestyle/include/ThemeStyleModel.h"
 #include "aivoice/include/AiVoiceModel.h"
-#include "ConfigModel.h"
 #include "graphic_service.h"
+#include "bleService.h"
 namespace OHOS
 {
     RebootAndShutdownModel::RebootAndShutdownModel() {}
index 65491b6..176ef97 100644 (file)
@@ -7,6 +7,7 @@
 #include <ohos_types.h>
 #include "UiConfig.h"
 #include <graphic_math.h>
+#include "bleService.h"
 
 namespace OHOS
 {
@@ -89,6 +90,7 @@ namespace OHOS
         if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0)
         {
             NativeAbility::GetInstance().Back();
+            br_adv_start(20);
         }
         return true;
     }
index 7a3ff38..5b9221b 100755 (executable)
@@ -31,6 +31,7 @@ private:
     UIView::OnClickListener* clickLeftListener{nullptr};\r
     UIImageView *imageAgreeing{nullptr};\r
     UIImageView *imageDissgree{nullptr};\r
+    \r
     UILabel *callerDisplay{nullptr};\r
     UILabel *currentTimes{nullptr};\r
 };\r
index 2fdade5..afbc150 100755 (executable)
@@ -29,6 +29,8 @@ private:
     UIViewGroup *group{nullptr};\r
     UIView::OnClickListener* clickLeftListener{nullptr};\r
     UIImageView *imageDissgree{nullptr};\r
+    \r
+    \r
     UILabel *callerDisplay{nullptr};\r
     UILabel *newcallHints{nullptr};\r
 };\r
index 53099b7..4169bff 100644 (file)
@@ -78,6 +78,7 @@ extern "C" {
 
 #include <dirent.h>
 #include <ppg_service.h>
+#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()
 {
index 16c4caf..76e5559 100644 (file)
@@ -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
 }
index 461471e..692ce84 100644 (file)
@@ -155,6 +155,23 @@ void svr_ble_adv_start(void)
 }\r
 \r
 \r
+void br_adv_start(uint8_t sec)\r
+{\r
+    //ble广播开启\r
+    svr_ble_adv_start_param();\r
+\r
+    if(!get_br_is_pair())\r
+    { \r
+        gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, sec);    \r
+    }\r
+}\r
+\r
+void br_adv_stop(void)\r
+{\r
+    gap_br_set_bt_scan_mode(GAP_SCAN_MODE_NONE, 0);\r
+}\r
+\r
+\r
 /* adapt ios adv data. *///设置广播和扫描数据\r
 static void svr_ble_adv_data_set(int adv_id)\r
 {\r
@@ -1456,7 +1473,7 @@ void custom_ble_service_start(void)
     AdverFlag = true;\r
     svr_ble_adv_start_param();\r
    \r
-    //gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE, 0);\r
+    gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE, 0);\r
    \r
 }\r
 \r
index 06adf91..a955a2f 100644 (file)
@@ -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
index 7fe4087..e4502fe 100755 (executable)
@@ -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 (file)
index 0000000..b19817f
--- /dev/null
@@ -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 (file)
index 0000000..2debdab
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:780f9fa26c2ee54ec5c22e1f31f71e4290cecedc623e655e8d82c32a9f98d561
+size 1896
index 260ea7a..63ebea3 100644 (file)
@@ -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;            // 禁止拷贝构造