From: root Date: Sun, 3 Mar 2024 05:22:32 +0000 (+0800) Subject: cat1 call_ui X-Git-Tag: release_V1.2.70_20241020_135402~1274^2~38^2~4 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=a493a8edff728fb517d74c28534d8184d07ff1b2;p=mirrors%2FFD230.git cat1 call_ui --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateModel.cpp index 60e0c3c9d..ba43c06d1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateModel.cpp @@ -66,7 +66,7 @@ void read_dial(void) dialInfo_1[dial_num++].title=str_2; fclose(fp); - delete(data); + UIFree(data); } } 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 2cfce573f..23f4c1447 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h @@ -115,6 +115,9 @@ int DialCall(unsigned char *number, unsigned char len); */ int AcceptIncomingCall(void); +void CallChangeIncomePro(const hfp_hf_calls_info_t *call); + +int AcceptIncomingCall_cat1(void); /** * @brief 手表拒接呼入来电 * 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 052695d76..4227c38c8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -24,6 +24,8 @@ #include "service_id_define.h" #include "samgr_lite.h" #include "ui_service.h" +#include "cat1_server_hal.h" + #if defined(SUPPORT_POWER_MANAGER) #include "power_display_service.h" #endif @@ -1167,8 +1169,9 @@ void HfpIncomingEventPublish(uint16 topic, hfp_hf_calls_info_t callsInfo) } // 通话状态变化--呼入处理 -static void CallChangeIncomePro(const hfp_hf_calls_info_t *call) +void CallChangeIncomePro(const hfp_hf_calls_info_t *call) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[hu] call"); PhoneCallInfo *phoneCall = NULL; int tmp, ret; @@ -1438,6 +1441,7 @@ static void CallStateChanged(const bd_addr_t *bdAddr, const hfp_hf_calls_info_t CallChangeAlertPro(call); break; case HFP_HF_CALL_STATE_INCOMING: // 呼入 + PhoneServiceScreenCtr(1); CallChangeIncomePro(call); break; @@ -1705,6 +1709,13 @@ int AcceptIncomingCall(void) return OHOS_SUCCESS; } +int AcceptIncomingCall_cat1(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] start"); + int ret, i; + incomedcall_event_sendmsg_toUI("10086"); + return OHOS_SUCCESS; +} // 手表拒接呼入来电,成功:0,失败:错误码 int RejectIncomingCall(void) { diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index eb38dcbfa..58acdec44 100755 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -28,6 +28,8 @@ #include "want.h" #include "msg_center.h" #include "common_def.h" +#include "PhoneService.h" +#include "power_display_service.h" namespace OHOS { @@ -181,6 +183,7 @@ void MsgCenterNotifyHfpIncomingProc(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. + CallerLogModel::GetInstance()->SetoperateNumber(call_data.number, call_data.number_len); CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); } @@ -303,10 +306,22 @@ 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. + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + if (display_api->get_screen_state() != SCREEN_ON) + { + display_api->turn_on_screen(); + } + display_api->set_screen_set_keepon_timeout(10); + + AlarmClockModel::GetInstance()->AlarmPlayerStart(); + CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len); CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1); + // hfp_hf_calls_info_t call; + // CallChangeIncomePro(&call); } free(call_data); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); CallerLogModel::GetInstance()->SetNotifyFlag(true); NotificationManager::GetInstance()->ShowNotify(showPhoneCallNotify, (uint16_t)topic, true); @@ -315,11 +330,28 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) { unused(topic); unused(req); + + if (req == NULL) return ; + AlarmClockModel::GetInstance()->AlarmPlayerStop(); + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); + CallerLogModel::GetInstance()->SetNotifyFlag(true); + NotificationManager::GetInstance()->ShowNotify(CreateCallingView, (uint16_t)topic, true); + } void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req) { unused(topic); unused(req); + + unused(topic); + unused(req); + // just stop the notify + AlarmClockModel::GetInstance()->AlarmPlayerStop(); + if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) { + NotificationManager::GetInstance()->StopNotify(); + } + + } void MsgCenterNotifyCat1SignalUpdateProc(const Topic topic, Request* req) { 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 80c4ee23d..738a4a7df 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 @@ -20,12 +20,14 @@ #ifdef SUPPORT_CAT1_SERVICE #include "cat1_server.h" #endif +#include "cat1_server.h" #define NOTIFY_THREE_SECONDS 3000 #define NOTIFY_ONE_SECOND 1000 #define NOTIFY_THIRTY_SECONDS 30000 #define NOTIFY_ONE_MINUTE 60000 #define NOTOFY_NO_OPERATE_TIME 35000 +#include "NativeAbility.h" namespace OHOS { int changeImage = 0; osTimerId_t g_callDuration = NULL; // timer of call duration @@ -507,7 +509,7 @@ CallViewEventListener *CallViewEventListener::GetInstance(void) static CallViewEventListener callViewEventListener; return &callViewEventListener; } - +//#define SUPPORT_CAT1_SERVICE bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event) { UNUSED(event); @@ -519,11 +521,18 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event) if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) { - #ifdef SUPPORT_CAT1_SERVICE + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 "); + //#ifdef SUPPORT_CAT1_SERVICE + + AcceptIncomingCall_cat1(); cat1_call_answer(); - #endif - }else{ + //#endif + } + else + { + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify222222222 "); if (AcceptIncomingCall() != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AcceptIncomingCall() fail"); return false; @@ -532,14 +541,21 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event) return true; } else if (strcmp(view.GetViewId(), "displayHandUp") == 0 || - strcmp(view.GetViewId(), "callingHandUp") == 0) { - if (strcmp(view.GetViewId(), "displayHandUp") == 0) { + strcmp(view.GetViewId(), "callingHandUp") == 0) + { + if (strcmp(view.GetViewId(), "displayHandUp") == 0) + { // The watch rejects the call if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) { - #ifdef SUPPORT_CAT1_SERVICE + //#ifdef SUPPORT_CAT1_SERVICE + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 "); cat1_call_hungup(); - #endif + // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + // NativeAbility::GetInstance().ChangeSlice(preSlice); + NotificationManager::GetInstance()->StopNotify(); + + //#endif }else{ if (RejectIncomingCall() != 0) { @@ -551,9 +567,26 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event) return false; } } - } - return true; - } else if (strcmp(view.GetViewId(), "microphoneChange") == 0) { + } + else if (strcmp(view.GetViewId(), "callingHandUp") == 0) + { + + // The watch rejects the call + if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) + { + //#ifdef SUPPORT_CAT1_SERVICE + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 "); + cat1_call_hungup(); + // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + // NativeAbility::GetInstance().ChangeSlice(preSlice); + NotificationManager::GetInstance()->StopNotify(); + //#endif + } + } + return true; + } + + else if (strcmp(view.GetViewId(), "microphoneChange") == 0) { if (changeImage == 0) { changeImage = 1; RefreshMicrophoneImageSrc(PNG_MICROPHONE_CLOSE_IMAGE_PATH); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp index 94b55e5db..cffab3922 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp @@ -205,6 +205,28 @@ static uint32_t cat1_ifconfig(uint8_t *para, uint32_t paraLen, char *strCommonCm return ERRCODE_SUCC; } + +static uint32_t AT_CALL_ifconfig(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(strCommonCmd); + uint8_t argv[PPG_MAX_ARGC][PPG_MAX_ARGV_LEN] = { 0 }; + uint32_t argc = 0; + + int ret = ConvertCmdToParam(para, paraLen, argv, &argc); + if (ret != PPG_SUCCESS) { + printf("CAT1TEST ATCMD Convert Command Failed\n"); + return ERRCODE_FAIL; + } + + // if (argc != 1) { + // printf("CAT1TEST ATCMD Set Parameter Failed\n"); + // return ERRCODE_FAIL; + // } + test_call_incomming(); + + return ERRCODE_SUCC; +} + static const at_cmd_table_t g_cat1_cmd[] = { { (char *)"AT^CAT1POWER", cat1_power, (char *)"1" }, { (char *)"AT^CAT1DIAL", at_cat1_dial, (char *)"1" }, @@ -216,6 +238,8 @@ static const at_cmd_table_t g_cat1_cmd[] = { { (char *)"AT^PING", cat1_ping, (char *)"1" }, { (char *)"AT^IFCONFIG", cat1_ifconfig, (char *)"1" }, { (char *)"AT^CAT1GETVER", at_cat1_getver, (char *)"1" }, + { (char *)"AT^CALL_1", AT_CALL_ifconfig, (char *)"1" }, + }; at_cmd_table_t *get_cat1_cmd_table(uint32_t *cmd_count) diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 0bea9ecf5..520d49c1b 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -216,15 +216,39 @@ void cat1_call_sms_send(char* phonenum,char* sms_txtdata) } } +static char* phonenum =NULL; + +//来电 int cat1_handle_call_incomming(struct tcp_msg_t *msg) { - char* phonenum = msg->buffer; + if(phonenum!=NULL) + { + free(phonenum); + phonenum=NULL; + } + phonenum = (char*)malloc(strlen(msg->buffer)); + if(phonenum==NULL) + return 0; + + strcpy(phonenum,msg->buffer); WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 incomming call %s\n",phonenum); + incomingcall_event_sendmsg_toUI(phonenum); - uapi_cat1_start_volte_voice(); + //声音 + //uapi_cat1_start_volte_voice(); + + + return 1; } +void test_call_incomming(void) +{ + struct tcp_msg_t msg; + strcpy(msg.buffer,"10086"); + cat1_handle_call_incomming(&msg); +} + int cat1_handle_networ_msg(struct tcp_msg_t *msg) { char* networkmsg=msg->buffer; @@ -289,13 +313,17 @@ int cat1_handle_call_connected(struct tcp_msg_t *msg) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 call connected\n"); + //声音处理 uapi_cat1_start_volte_voice(); + return 1; } +//来电挂断处理 int cat1_handle_call_disconnected(struct tcp_msg_t *msg) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 call disconnected\n"); //TODO: 关闭声音 + callend_event_sendmsg_toUI("0k"); uapi_cat1_stop_volte_voice(); return 1; } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h index 7c62d1ede..69bfd278d 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h @@ -21,6 +21,7 @@ void cat1_call_answer(void); void cat1_getsignal(void); void cat1_call_dial(char* phonenum); +void test_call_incomming(void); void cat1_call_sms_send(char* phonenum,char* sms_txt); void cat1_gettime(void); void cat1_getver(void); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp index 7b5d82161..0d5831a95 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp @@ -40,7 +40,7 @@ static void CustomEventPublish(uint16_t topic, uint8_t *data , uint32_t size) BroadcastApi *broadcastApi = NULL; IUnknown *api = NULL; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish topic=%u!!", topic); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish topic=%u %d %s!!", topic,size,data); /* alloc request */ request = SAMGR_AllocRequestMsg(0, PLATFORM_CORE, BROADCAST_SVR_ID, size); @@ -50,14 +50,17 @@ static void CustomEventPublish(uint16_t topic, uint8_t *data , uint32_t size) } request->msgId = topic; ret = memcpy_s(request->data, size, (const void *)data, size); + if (ret != EOK) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish memcpy_s rateDataTmp fail! ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish memcpy_s rateDataTmp fail! ret = %d ", ret); return; } request->len = size; request->msgValue = 0; + /* public request */ + api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); if (api == NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetFeatureApi failed"); @@ -72,8 +75,10 @@ static void CustomEventPublish(uint16_t topic, uint8_t *data , uint32_t size) } broadcastApi->PublishTopic((IUnknown *)broadcastApi, request); broadcastApi->Release((IUnknown *)broadcastApi); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish end!!"); + return; } @@ -84,6 +89,35 @@ static errcode_t incomingcall_event_notify(char* callno) CustomEventPublish(TOPIC_EVENT_CAT1_INCOMMING,(uint8_t*)callno,strlen(callno)); return 0; } + +static errcode_t incomed_call_event_notify(char* callno) +{ + CustomEventPublish(TOPIC_EVENT_CAT1_CALLCONNTED,(uint8_t*)callno,strlen(callno)); + return 0; +} + +static errcode_t callend_event_notify(char* callno) +{ + CustomEventPublish(TOPIC_EVENT_CAT1_CALLENDED,(uint8_t*)callno,strlen(callno)); + return 0; +} + +errcode_t callend_event_sendmsg_toUI(char* callno) +{ + /**通过UI事件发送Notify*/ + GraphicService::GetInstance()->PostGraphicEvent(std::bind(callend_event_notify, callno)); + return ERRCODE_SUCC; +} + + +errcode_t incomedcall_event_sendmsg_toUI(char* callno) +{ + /**通过UI事件发送Notify*/ + GraphicService::GetInstance()->PostGraphicEvent(std::bind(incomed_call_event_notify, callno)); + return ERRCODE_SUCC; +} + + errcode_t incomingcall_event_sendmsg_toUI(char* callno) { /**通过UI事件发送Notify*/ diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h index b4ba3a31d..0e3716bad 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h @@ -14,7 +14,8 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ - +errcode_t incomedcall_event_sendmsg_toUI(char* callno); +errcode_t callend_event_sendmsg_toUI(char* callno); errcode_t incomingcall_event_sendmsg_toUI(char* callno); #ifdef __cplusplus