From 73cdd2c19f6ea204f92846842beeacea3cb41836 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 3 Aug 2024 17:33:20 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E9=80=9A=E8=AE=AF=E5=BD=95?= =?utf8?q?=E9=94=99=E8=AF=AF=E6=B7=BB=E5=8A=A0BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/phone/src/MainPhoneView.cpp | 42 ++++++++++++------- .../phone/src/TelephonyInitInterface.cpp | 1 + .../phoneservice/include/PhoneService.h | 2 + .../phoneservice/src/PhoneService.cpp | 3 +- .../src/notify/makephone_notification.cpp | 6 ++- .../slip/cat1Service/cat1_server.cpp | 3 ++ 6 files changed, 39 insertions(+), 18 deletions(-) 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 79d978411..3236778dd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp @@ -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; diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp index fab972e67..9f1619a36 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp @@ -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; diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h index bbd3f1614..6ec269518 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h @@ -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); // 电话服务失败回调函数 diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp index 4b29bd802..83b146b67 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -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); } 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 95f53ee91..957308e9e 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 @@ -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; } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 704eb0e58..9ffebc46a 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -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) -- 2.17.1