修复通讯录错误添加BUG
authorhcj <1224667075@qq.com>
Sat, 3 Aug 2024 09:33:20 +0000 (17:33 +0800)
committerhcj <1224667075@qq.com>
Sat, 3 Aug 2024 09:33:20 +0000 (17:33 +0800)
code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp
code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp
code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h
code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp
code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp

index 79d9784..3236778 100644 (file)
@@ -232,20 +232,32 @@ namespace OHOS
             }
             RecentCallLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
             /* ------------------------- TelephoneLineImageView ------------------------- */
-            TelephonyInitInterface::ImageParams imageParam = {
-                .x = 83,
-                .y = 344,
-                .width = 300,
-                .height = 0,
-                .viewId = "TelephoneLineImageView",
-                .imgsrc = PNG_TELEPHONELINE_IMAGE,
-            };
-            TelephoneLineImageView = TelephonyInitInterface::ImageViewInit(imageParam);
-            if (TelephoneLineImageView == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::TelephoneLineImageView new fail!");
-                return;
+            // TelephonyInitInterface::ImageParams imageParam = {
+            //     .x = 83,
+            //     .y = 344,
+            //     .width = 300,
+            //     .height = 3,
+            //     .viewId = "TelephoneLineImageView",
+            //     .imgsrc = NULL,
+            // };
+            // TelephoneLineImageView = TelephonyInitInterface::ImageViewInit(imageParam);
+            // if (TelephoneLineImageView == nullptr)
+            // {
+            //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::TelephoneLineImageView new fail!");
+            //     return;
+            // }
+            // TelephoneLineImageView->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+             // Add ImageView to App
+            if (TelephoneLineImageView == nullptr) {
+                TelephoneLineImageView = new UIImageView();
             }
+            TelephoneLineImageView->SetPosition(83, 344);         // widget's left position and top position
+            TelephoneLineImageView->Resize(300, 2);          // widget's width and height
+            TelephoneLineImageView->SetViewId("image1");// Set style
+            TelephoneLineImageView->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+            TelephoneLineImageView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+
+            
             /* ------------------------------ NoCallsLabel ------------------------------ */
             info = new CallLogInfo[sizeof(CallLogInfo) * CALL_LOG_MAX_NUM];
             if (GetCallLog(&info, &num) == -1) {
@@ -277,7 +289,7 @@ namespace OHOS
               
                 for (int i  = num; i != 0; i--) {
                   
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",(info + i - 1)->tel);
+                    //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",(info + i - 1)->tel);
                     char buf[20]={0};
     
                     sprintf_s(buf,20,"%s",(const char*)(info + i - 1)->tel);
@@ -297,7 +309,7 @@ namespace OHOS
                     }
                     buttonconfig.y += 20+104;
                     MainPhoneViewScrollView->Add(button_calllog[i]);
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",(info + i - 1)->tel);
+                    //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",(info + i - 1)->tel);
                     
                     time_t currtime;
                     struct tm *timeinfo;
index fab972e..9f1619a 100644 (file)
@@ -96,6 +96,7 @@ namespace OHOS
         }
         image->SetPosition(params.x, params.y, params.width, params.height);
         image->SetViewId(params.viewId);
+        if(params.imgsrc)
         image->SetSrc(params.imgsrc);
 
         return image;
index bbd3f16..6ec2695 100644 (file)
@@ -62,6 +62,7 @@ typedef enum {
     CALL_MISSED, // 未接来电
 } CallFinishStatus;
 
+#pragma pack(1)
 typedef struct {
     char name[NAME_SIZE];
     unsigned char nameLen;
@@ -72,6 +73,7 @@ typedef struct {
     uint64 callDurTime; // 通话持续时间
 } CallLogInfo;
 
+#pragma pack(0)
 // 通话状态改变回调函数
 typedef void (*PhoneServiceCallChangedCb)(const PhoneCallInfo *phoneCall);
 // 电话服务失败回调函数
index 4b29bd8..83b146b 100644 (file)
@@ -736,7 +736,7 @@ void AddToCallLog(CallLogInfo *info)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLog] fopen %s failed!", CALL_LOG_PATH);
         return;
     }
-
+    printf("AddToCallLog %s \r\n",info->tel);
     ret = fwrite(info, sizeof(CallLogInfo), 1, fp);
     if (ret != 1) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLog] fwrite failed! ret:%d", ret);
@@ -860,6 +860,7 @@ void AddToCallLog_CAT1(CallLogInfo *callInfo)
             return;
         }
     }
+
     AddToCallLog(callInfo);
 
 }
index 95f53ee..957308e 100755 (executable)
@@ -135,7 +135,6 @@ void calllog_info_init()
     uapi_get_timestampe_ss(&tmptime);
     info.creationTime = tmptime;
     info.callDurTime=0;
-    
     info.telLen=len;
        
 
@@ -151,6 +150,7 @@ void addcalllog()
     info.status=CALL_MISSED;
     if(call_stat<=2)
     {
+        printf("写入:%s\r\b",info.tel);
         AddToCallLog_CAT1(&info);
         call_stat=3;
     }
@@ -741,6 +741,8 @@ void FreeCalldialView(void)
         DisableCallTimer(CallTimerType::NOTIFY_PHONE_CALLING_DISPLAY);
         DisableCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY);
 
+        RootView::GetInstance()->Remove(calldialView);
+
         calldialView->RemoveAll();
         if(diallabel1!=NULL)
         {
@@ -760,7 +762,7 @@ void FreeCalldialView(void)
             button1dial =nullptr;
         }
        
-        RootView::GetInstance()->Remove(calldialView);
+      
         delete calldialView;
         calldialView = nullptr;
     }
index 704eb0e..9ffebc4 100644 (file)
@@ -355,6 +355,8 @@ void udp_send_msg_toCat1(uint8_t cmd,char *content)
     if( sourceAddr.sin_port != 0 ) {
         
         udp_send_response(station_tx_buffer, cmd, content);
+        if(cmd==UDP_CMD_DIAL_NUMB)
+        uapi_cat1_start_volte_voice();
     }
      uapi_cat1_wakeup_cat1(0);
 }
@@ -731,6 +733,7 @@ void cat1_ota_update(char *url)
 void cat1_call_dial(char* phonenum)
 {
     udp_send_msg_toCat1(UDP_CMD_DIAL_NUMB,phonenum);
+    
 }
 
 void cat1_at_cmd(char * cmd)