优化电话
authorhcj <1224667075@qq.com>
Wed, 7 Aug 2024 07:49:00 +0000 (15:49 +0800)
committerhcj <1224667075@qq.com>
Wed, 7 Aug 2024 07:49:00 +0000 (15:49 +0800)
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp
code/sdk/application/wearable/fd230app/nativeui/callerlog/include/CallerLogModel.h
code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp
code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp
code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c
code/sdk/application/wearable/service/msg_center/CMakeLists.txt
code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp

index 1dd336c..4946d55 100644 (file)
@@ -18,7 +18,7 @@
 #include "PlayersModel.h"
 #include "PhoneService.h"
 #include "ui_service.h"
-
+#include "notification_manager.h"
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -708,6 +708,11 @@ uint16 AlarmClockModel::GetSliceId()
 int AlarmClockModel::AlarmPlayerStat()
 {
     int32_t ret;
+    if(NotificationManager::GetInstance()->GetWatchCallStatus())
+    {
+
+        return 0;
+    }
 
     // 设置回调函数
     if (playerCtr.get() == nullptr) {
index 74509a7..b85d61d 100644 (file)
@@ -34,21 +34,26 @@ enum PhoneStatus {
 void g_callTimesclean();\r
 \r
 void g_callTimesadd();\r
-\r
+int get_g_callTimes();\r
 bool MulitplePhoneTextReplaces();\r
 bool FindCallListInfoAndSetPriorityNumber();\r
 void PhoneScoStatausCallback(hfp_sco_connect_state_t state);\r
 void PhoneChangeStatusCallback(const PhoneCallInfo *phoneCall);\r
 void PhoneErrorCallback(PhoneServiceErrorType type, int volume);\r
 void UsingPhoneScoStatausCallback(hfp_sco_connect_state_t state);\r
+void StatusReset();\r
 void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall);\r
 void UsingPhoneErrorCallback(PhoneServiceErrorType type);\r
-\r
+void CAT1_ChangeStatusScreendisplay(int lastStatus);\r
 namespace OHOS {\r
 \r
 \r
 class CallerLogModel {\r
 public:\r
+typedef enum {\r
+        CallSourcePhone,\r
+        CallSourceCat1,\r
+    } CallSource;\r
     void InitPhoneService();\r
     static CallerLogModel *GetInstance(void);\r
 \r
@@ -80,6 +85,14 @@ public:
     bool GetNotifyFlag(void);\r
     void SetNotifyFlag(bool flag);\r
     bool IsMulitplePhoneStatus(void);\r
+CallSource GetCallSource(void)\r
+    {\r
+        return callsrc;\r
+    }\r
+    void SetCallSource(CallSource source)\r
+    {\r
+        callsrc = source;\r
+    }\r
 private:\r
     CallerLogModel();\r
     CallerLogModel(const CallerLogModel &);\r
@@ -96,6 +109,8 @@ private:
     bool phoneStatus{false}; // 判断是拨打界面还是呼入界面\r
     bool callStatus{false}; // 判断是否正在接听电话\r
     bool notifyFlag{false}; // 判断是否来电呼入 由notify生成界面\r
+\r
+    CallSource callsrc{CallSourcePhone}; //电话来源 \r
 };\r
 }\r
 #ifdef __cplusplus\r
index 6e90c21..f7a5580 100644 (file)
@@ -94,14 +94,14 @@ static void DisableCallingTimer()
 }
 
 /* 状态复位 */
-static void StatusReset()
+void StatusReset()
 {
     CallerLogModel::GetInstance()->SetCallStatus(false);
     CallerLogModel::GetInstance()->SetWaitingStatus(false);
     DisableCallingTimer();
     // If the call is handling in the notification, the slice is not switched
     if (!CallerLogModel::GetInstance()->GetNotifyFlag()) {
-        NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);
+        NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_PHONE);
     } else {
         g_isWatchCallView = false;
     }
@@ -454,30 +454,39 @@ static void WatchFinishHandle(void)
     g_phoneStatus = PHONE_SINGLE_STATUS;
 }
 
+void CAT1_ChangeStatusScreendisplay(int lastStatus)
+{
+    // If the call is handling in the notification, the slice is not switched
+    if (lastStatus != OPERATE_PHONE_ACTIVE && (!CallerLogModel::GetInstance()->GetNotifyFlag())) {
+        NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
+            PRIORITY_ONE);
+    }
+}
+
 static void ChangeStatusScreendisplay(int lastStatus)
 {
     if (GetScoConnectState() != HFP_SCO_STATE_CONNECTED) {
         if (lastStatus == HFP_HF_CALL_STATE_ACTIVE) {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ACTIVE");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ACTIVE");
             StatusReset();
             return;
         } else if (lastStatus == HFP_HF_CALL_STATE_INCOMING) {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_INCOMING");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_INCOMING");
         } else if (GetCurrCallNum() == 1 && (lastStatus == HFP_HF_CALL_STATE_DIALING ||
             lastStatus == HFP_HF_CALL_STATE_ALERTING)) {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ALERTING");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ALERTING");
         } else if (GetCurrCallNum() > 1) {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] GetCurrCallNum MULITE");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] GetCurrCallNum MULITE");
             DisableCallingTimer();
             return;
         }
     }
     if (!IsCompleteCallFlow()) {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] is not complete call flow");
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] is not complete call flow");
         return;
     }
     if (MultiplePhonesViewDisplay()) {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] MultiplePhonesViewDisplay");
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] MultiplePhonesViewDisplay");
         return;
     }
     // If the call is handling in the notification, the slice is not switched
@@ -489,7 +498,7 @@ static void ChangeStatusScreendisplay(int lastStatus)
 
 void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall)
 {
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] operate:%d, callNUm:%d, call flow:%d",
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] operate:%d, callNUm:%d, call flow:%d",
         phoneCall->operate, GetCurrCallNum(), IsCompleteCallFlow());
 
     if (phoneCall->operate == OPERATE_WATCH_FINISH && GetCurrCallNum() == 0) {
@@ -640,6 +649,7 @@ void PhoneChangeStatusCallback(const PhoneCallInfo *phoneCall)
 {
     (void)memset_s(&callInfo, sizeof(PhoneCallInfo), 0, sizeof(PhoneCallInfo));
     (void)memcpy_s(&callInfo, sizeof(PhoneCallInfo), phoneCall, sizeof(PhoneCallInfo));
+    WEARABLE_LOGE(HILOG_MODULE_AAFWK, "PhoneChangeStatusCallback");
     GraphicService::GetInstance()->PostGraphicEvent(std::bind(UsingPhoneChangeStatusCallback, &callInfo));
 }
 
index ac557a5..9fd3061 100644 (file)
@@ -9,6 +9,11 @@
 #include "wearable_log.h"
 #include "UiConfig.h"
 #include "PhoneService.h"
+#include "cat1_server.h"
+#include "cat1_server_hal.h"
+#include "custom_utils.h"
+#include "phoneaddressmodel.h"
+#include "bletest.h"
 
 namespace OHOS {
 static constexpr uint16 MATH_ZERO = 0;
@@ -215,33 +220,33 @@ bool CallingView::InitUILabelDisplay()
     callerDisplay->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
     group->Add(callerDisplay);
 
-    callDuration = new UILabel();
-    if (callDuration == nullptr) {
-        return false;
-    }
-    callDuration->SetPosition(194, 38,
-        79, 35);
-    callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
-    callDuration->SetAlign(TEXT_ALIGNMENT_CENTER);
-    callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str());
-    callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
-    callDuration->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));
-    group->Add(callDuration);
-
-
-    // currentTimes = new UILabel();
-    // if (currentTimes == nullptr) {
+    // callDuration = new UILabel();
+    // if (callDuration == 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, LABEL_TIME_FONT_SIZE);
-    // currentTimes->SetTextColor(Color::White());
-
-    // group->Add(currentTimes);
+    // callDuration->SetPosition(194, 38,
+    //     79, 35);
+    // callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+    // callDuration->SetAlign(TEXT_ALIGNMENT_CENTER);
+    // callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str());
+    // callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+    // callDuration->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));
+    // group->Add(callDuration);
+
+
+    currentTimes = new UILabel();
+    if (currentTimes == nullptr) {
+        return false;
+    }
+    currentTimes->SetPosition(194, 38,
+         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));
+
+    group->Add(currentTimes);
     return true;
 }
 
@@ -262,7 +267,11 @@ void CallingView::showdial(bool flag)
 
 void CallingView::text_updata_buf(const char *buf)
 {
+    if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+    SendDtfmStrNumberToCat1(buf[0]);
+    else
     uapi_hfp_send_DTMF_CODE(buf[0]);
+    
     char new_buf[16]={0};
     const char*text_buf=label_number->GetText();
     sprintf_s(new_buf,16,"%s%s",text_buf,buf);
index ce7dcf1..e3280e1 100644 (file)
 #include "MainCallingView.h"
 #include "PhoneService.h"
 #include "WaitingHintsView.h"
-
+#include "cat1_server.h"
+#include "cat1_server_hal.h"
+#include "custom_utils.h"
+#include "phoneaddressmodel.h"
+#include "bletest.h"
+#include "NativeAbility.h"
 namespace OHOS {
 static MainCallingPresenter *g_pMainView = nullptr;
 static constexpr int32 NUM_10 = 10;
@@ -184,7 +189,7 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::InitPointerValue error");
         return false;
     }
-
+     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",view.GetViewId());
     if (strcmp(view.GetViewId(), "microphoneChange") == 0) {
         if (changeImage == 0) {
             changeImage = 1;
@@ -198,35 +203,99 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event)
         return true;
     } else if (strcmp(view.GetViewId(), "displayHandUp") == 0 || strcmp(view.GetViewId(), "callingHandUp") == 0||
         strcmp(view.GetViewId(), "dialingHandUp") == 0) {
-        if (strcmp(view.GetViewId(), "displayHandUp") == 0) {
-            // 手表拒接呼入来电
-            if (RejectIncomingCall() != 0) {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::RejectIncomingCall() fail");
+        if(strcmp(view.GetViewId(), "callingHandUp") == 0 ||  strcmp(view.GetViewId(), "dialingHandUp") == 0) 
+        {
+            if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+            {
+
+                cat1_call_hungup();
+                cat1_handle_call_disconnected();
+            }
+            else
+            {
+                if (FinishCall() != 0) {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail");
                 return false;
+                }
+            }
+            return true;
+        }
+        if (strcmp(view.GetViewId(), "displayHandUp") == 0) 
+        {
+            if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+            {
+                    cat1_call_hungup();
+                    return true;
+                //#endif
+
+            }
+            else
+            {
+                // 手表拒接呼入来电
+                if (RejectIncomingCall() != 0) {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::RejectIncomingCall() fail");
+                    return false;
+                }
             }
         }
         if (FinishCall() != 0) {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail");
-            return false;
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::FinishCall() fail");
+                return false;
         }
         return true;
+       
     } else if (strcmp(view.GetViewId(), "volumeSwitch") == 0) {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::honrs show");
         HonrsViewChange();
-    } else if (strcmp(view.GetViewId(), "hintsHandup") == 0) {
-        if (!HintsHandupClick()) {
-            return false;
-        }
+    } else if (strcmp(view.GetViewId(), "hintsHandup") == 0) 
+    {
+
+            if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+            {
+                    cat1_call_hungup();
+                    cat1_handle_call_disconnected();
+                    return true;
+                //#endif
+
+            }else
+            {
+                if (!HintsHandupClick())
+                {
+                    return false;
+                }
+            }
+       
+           
+        
+       
     } else if (strcmp(view.GetViewId(), "answer") == 0) {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::phone calling");
-        // 界面的显示和隐藏
-        SetMicMute(false);
-        // 手表接听呼入来电
-        if (AcceptIncomingCall() != 0) {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::AcceptIncomingCall() fail");
-            return false;
+        if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1)
+        {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 ");
+            //#ifdef SUPPORT_CAT1_SERVICE
+                
+                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] start");
+                //incomedcall_event_sendmsg_toUI("ok");
+                cat1_call_answer();
+                return true;
+
+            //#endif
         }
-        return true;
+        else
+        {
+              // 界面的显示和隐藏
+            SetMicMute(false);
+            // 手表接听呼入来电
+            if (AcceptIncomingCall() != 0) {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::AcceptIncomingCall() fail");
+                return false;
+            }
+            return true;
+
+        }
+      
+        
     }
     else if ((strcmp(view.GetViewId(), "dial") == 0))
     {
index 11b1e6e..985b613 100644 (file)
@@ -56,6 +56,7 @@ namespace OHOS
     void DialingMethodPresenter::OnStop(void)
     {
         Presenter<DialingMethodView>::OnStop();
+        set_address_number(NULL);
     }
 
     bool DialingMethodPresenter::OnClick(UIView &view, const ClickEvent &event)
index 483861e..3e185ee 100644 (file)
@@ -913,7 +913,8 @@ void cleanUnbindInfor(uint8_t flag)//和旧手机解绑清除配对信息
             printf("json remove fail\r\n");\r
         }\r
         set_ble_falg(0);\r
-        uapi_reboot_device();\r
+        do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);//恢复出厂\r
+        //uapi_reboot_device();\r
     }\r
 }\r
 static bool ctkd_flag_ble=false;\r
index 283224b..2f53eb5 100644 (file)
@@ -6,28 +6,6 @@ set(PUBLIC_HEADER
 )
 
 set(PRIVATE_HEADER
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclockmanage/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phone/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phoneservice/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/system/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/sleep/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/config/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/main/include/dial
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/bloodoxygen/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heartrate/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/saveele/include/
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/goal/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heart_blood/health_service/
     ${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps
     ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include
     ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits
@@ -48,7 +26,39 @@ set(PRIVATE_HEADER
     ${ROOT_DIR}/include/middleware/services/bts/br
     ${ROOT_DIR}/include/middleware/services/bts/common
 )
+if("FD230" IN_LIST DEFINES)
 
+set(PRIVATE_HEADER
+    ${PRIVATE_HEADER}
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/callerlog/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phone/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phoneservice/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/system/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/sleep/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/config/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/main/include/dial
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/bloodoxygen/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heartrate/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/saveele/include/
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/goal/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heart_blood/health_service/    
+)
+else()
+set(PRIVATE_HEADER
+    ${PRIVATE_HEADER}
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclockmanage/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include   
+)
+endif()
 if("JS_ENABLE" IN_LIST DEFINES)
 set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/msg_center.cpp
@@ -111,6 +121,7 @@ set(PUBLIC_HEADER
 )
 
 set(PRIVATE_HEADER
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/callerlog/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclockmanage/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include
index ade20be..29010aa 100755 (executable)
@@ -17,6 +17,7 @@ enum class CallTimerType {
 
 namespace OHOS {
 void addcalllog(void);
+void cat1_phone_state_change_cb(uint8_t state);
 
 class VolumeSettingView;
 UIViewGroup* CreatePhoneCallView(void);
index 1f8eca0..9b90c52 100644 (file)
@@ -43,6 +43,7 @@
 #include "custom_runtime.h"
 #include "custom_utils.h"
 #include "SleepModel.h"
+#include "PlayersModel.h"
 #ifdef FD230
 #include "DialModelCharge.h"
 #include "DialModelHeartRate.h"
@@ -502,13 +503,16 @@ void MsgCenterNotifyHfpIncomingProc(const Topic topic, Request* req)
     if (ret != EOK) {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
     } else {
-    // Prevent this from happening:
+   // Prevent this from happening:
     // When the incoming call view is displayed, the calling number is not set in CallerLogModel.
     CallerLogModel::GetInstance()->SetoperateNumber(callData.number, callData.number_len);
     }
     NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
-    CallerLogModel::GetInstance()->SetNotifyFlag(true);
-    if (GetCurrCallNum() == 1) {
+     CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
+
+    if (GetCurrCallNum() > 1) {
+        CallerLogModel::GetInstance()->SetNotifyFlag(true);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetCurrCallNum %d",GetCurrCallNum());
         NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, static_cast<uint16_t>(topic), true);
     } else {
         EnableWaitingView();
@@ -528,6 +532,8 @@ void MsgCenterNotifyHfpPhoneProc(const Topic topic, Request* req)
             NotificationManager::GetInstance()->SetWatchCallStatus(false);
         }
     }
+     CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
+
 }
 
 void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req)
@@ -537,14 +543,22 @@ void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req)
         NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
         // default not mute
         SetMicMute(false);
-        if (CallerLogModel::GetInstance()->IsMulitplePhoneStatus()) {
+        if (CallerLogModel::GetInstance()->IsMulitplePhoneStatus()) 
+        {
             NotificationManager::GetInstance()->ShowNotify(ShowMultiPhoneCallNotify,
                                                            static_cast<uint16_t>(topic), true);
         } else {
-            NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast<uint16_t>(topic), true);
+            //NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast<uint16_t>(topic), true);
+            //CallerLogModel::GetInstance()->SetCallStatus(true);
+
+           // NotificationManager::GetInstance()->StopNotify();
+           // NativeAbility::GetInstance().ChangeSlice(AppViewId::VIEW_INCOMING_CALL);
         }
         NotificationManager::GetInstance()->SetWatchCallStatus(true);
+
     }
+     CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone);
+
 }
 
 
@@ -724,6 +738,14 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
     } else {
     // Prevent this from happening:
     // When the incoming call view is displayed, the calling number is not set in CallerLogModel.
+        if( NotificationManager::GetInstance()->GetWatchCallStatus())
+        {
+            cat1_call_hungup();
+            return;
+        }
+
+        int ret = PlayersModel::GetInstance()->PlayerStop();
+
         const power_display_svr_api_t *display_api = power_display_svr_get_api();
         if (display_api->get_screen_state() != SCREEN_ON)
          {   
@@ -741,8 +763,11 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
     free(call_data);
 
     NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
-    CallerLogModel::GetInstance()->SetNotifyFlag(true);
-    NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, (uint16_t)topic, true);
+    //CallerLogModel::GetInstance()->SetNotifyFlag(true);
+    //NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, (uint16_t)topic, true);
+    cat1_phone_state_change_cb(OPERATE_INCOMING);
+
+    NotificationManager::GetInstance()->SetWatchCallStatus(true);
 }
 void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
 {
@@ -750,11 +775,18 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
     unused(req);
 
     if (req == NULL) return ;
+    if(!NotificationManager::GetInstance()->GetWatchCallStatus())
+    {
+        return;
+    }
     AlarmClockModel::GetInstance()->AlarmPlayerStop();
     NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
-    CallerLogModel::GetInstance()->SetNotifyFlag(true);
-    NotificationManager::GetInstance()->ShowNotify(CreateCallingView, (uint16_t)topic, true);
+    //CallerLogModel::GetInstance()->SetNotifyFlag(true);
+    cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
+    //NotificationManager::GetInstance()->ShowNotify(CreateCallingView, (uint16_t)topic, true);
     CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+    NotificationManager::GetInstance()->SetWatchCallStatus(false);
+    
 
 }
 void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
@@ -778,21 +810,25 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
         // display_api->set_screen_set_keepon_timeout(10);
         
         //AlarmClockModel::GetInstance()->AlarmPlayerStart();
+        int ret = PlayersModel::GetInstance()->PlayerStop();
+
+
         cat1_call_dial(call_data);
         CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
         CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+
+        cat1_phone_state_change_cb(OPERATE_DIALING);
+         NotificationManager::GetInstance()->SetWatchCallStatus(true);
         // hfp_hf_calls_info_t call;
         // CallChangeIncomePro(&call);
     }
     free(call_data);
-
     NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE);
-    CallerLogModel::GetInstance()->SetNotifyFlag(true);
+    //CallerLogModel::GetInstance()->SetNotifyFlag(true);
     #ifdef FD230
-    NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true);
+    //NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true);
     #endif
 
-
 }
 void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
 {
@@ -800,10 +836,13 @@ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
     unused(req);
     // just stop the notify
     AlarmClockModel::GetInstance()->AlarmPlayerStop();
-    if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) {
-        NotificationManager::GetInstance()->StopNotify();
-        addcalllog();
-    }
+    cat1_phone_state_change_cb(OPERATE_WATCH_FINISH);
+    
+    // if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) {
+    //     NotificationManager::GetInstance()->StopNotify();
+    //     addcalllog();
+    // }
+    NotificationManager::GetInstance()->SetWatchCallStatus(false);
 
 
 }
@@ -1260,6 +1299,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
     {TOPIC_EVENT_ON_TIME,            MsgCenterNotifyONtimeProc},//增加整点保存数据
     {TOPIC_EVENT_STEPDATA_UPDATE,    MsgCenterNotifystepProc},
     {TOPIC_EVENT_NEXTDAY_UPDATE,     MsgCenterNotifyNextDayProc},
+
     {TOPIC_EVENT_HFP_INCOMMING,      MsgCenterNotifyHfpIncomingProc},
     {TOPIC_EVENT_HFP_PHONE_ACTIVE,   MsgCenterNotifyHfpPhoneProc},
     {TOPIC_EVENT_HFP_FINISHED,       MsgCenterNotifyHfpPhoneProc},
@@ -1295,6 +1335,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
     {TOPIC_EVENT_CAT1_CALLCONNTED,      MsgCenterNotifyCat1CallConnectedProc},
     {TOPIC_EVENT_CAT1_CALLENDED,        MsgCenterNotifyCat1CallEndedProc},
     {TOPIC_EVENT_CAT1_CALLDIAL,         MsgCenterNotifyCat1dialProc},
+
     {TOPIC_EVENT_CAT1_SIGNAL_UPDATE,    MsgCenterNotifyCat1SignalUpdateProc},
     {TOPIC_EVENT_CAT1_POWER_ON,      MsgCenterNotifyCat1PowerOnProc},
     {TOPIC_EVENT_CAT1_POWER_OFF,      MsgCenterNotifyCat1PowerOffProc},
index 957308e..e68d10f 100755 (executable)
@@ -26,6 +26,7 @@
 #include "phoneaddressmodel.h"
 #include "components/ui_label_button.h"
 #include "bletest.h"
+#include "NativeAbility.h"
 // #define NOTIFY_THREE_SECONDS 3000
 // #define NOTIFY_ONE_SECOND 1000
 // #define NOTIFY_THIRTY_SECONDS 30000
@@ -136,8 +137,6 @@ void calllog_info_init()
     info.creationTime = tmptime;
     info.callDurTime=0;
     info.telLen=len;
-       
-
 }
 
 void addcalllog()
@@ -157,6 +156,106 @@ void addcalllog()
      
 }
 
+static int g_callOperate = OPERATE_NO_OPE;
+
+
+static void DialingHandle(void)
+{
+    CallerLogModel::GetInstance()->SetDialingStatus("正在拨号");
+    CallerLogModel::GetInstance()->SetMakePhoneStatus(true);
+
+}
+
+static void AlertingHandle(void)
+{
+    CallerLogModel::GetInstance()->SetDialingStatus("正在响铃");
+    CallerLogModel::GetInstance()->SetMakePhoneStatus(true);
+}
+
+static void IncomingHandle(void)
+{
+    CallerLogModel::GetInstance()->SetMakePhoneStatus(false);
+}
+
+static void WaitingOpreate()
+{
+    
+    CallerLogModel::GetInstance()->SetCallStatus(false);
+    CallerLogModel::GetInstance()->SetWaitingStatus(true);
+    // If the call is handling in the notification, the slice is not switched
+    NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID,
+            PRIORITY_ONE);
+   
+}
+
+static void WatchActiveHandle()
+{
+    CallerLogModel::GetInstance()->SetCallStatus(true);
+    CallerLogModel::GetInstance()->SetWaitingStatus(false);
+   
+}
+
+static void PhoneActiveHandle(void)
+{
+   
+}
+
+static void WatchFinishHandle(void)
+{
+    if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL ||
+    CallerLogModel::GetInstance()->GetNotifyFlag()) 
+    {
+        StatusReset();
+    }
+}
+
+void cat1_phone_state_change_cb(uint8_t state)
+{
+    g_callOperate = state;
+
+    switch (g_callOperate) {
+        case OPERATE_DIALING:
+            // 显示正在呼出界面
+            DialingHandle();
+            call_stat=0;
+            calllog_info_init();
+            break;
+        case OPERATE_ALERTING:
+            // 显示对方响铃
+            AlertingHandle();
+            break;
+        case OPERATE_INCOMING:
+            // 显示电话呼入
+            IncomingHandle();
+            calllog_info_init();
+            call_stat=2;
+            break;
+        case OPERATE_WAITING:
+            // 震动一下,提示有新电话呼入   还未对齐
+            WaitingOpreate();
+
+            return;
+        case OPERATE_WATCH_ACTIVE:
+            // 手表接听,显示界面
+            if(call_stat==2)
+            call_stat=1;
+            WatchActiveHandle();
+            break;
+        case OPERATE_PHONE_HOLD:
+            // 挂起状态,不做处理
+            return;
+        case OPERATE_WATCH_FINISH:
+            WatchFinishHandle();
+            addcalllog();
+            return;
+        case OPERATE_WATCH_REJECT:
+        default:
+            break;
+    }
+    CAT1_ChangeStatusScreendisplay(g_callOperate);
+}
+
+
 //     PhoneCallInfo tmp;
 
 //     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeFinishPro] start g_scoFlag = %d, g_currCallNum = %d",