From b63cd07065d6b3790701dc832d89771ea9bcaf25 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Tue, 15 Oct 2024 12:47:35 +0000 Subject: [PATCH] Merge #1194 into sdk602patch0911 from refs/changes/1194/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 胡传军 * refs/changes/1194/head: (2 commits squashed) - 电话综合修改,有所改善,但如果太快连续拨打电话易出错 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0911 Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1194 --- .../nativeui/callerlog/src/CallerLogModel.cpp | 21 ++++++++- .../makephone/src/MainCallingPresenter.cpp | 12 ++--- .../msg_center/src/msg_center_customer.cpp | 7 ++- .../src/notify/makephone_notification.cpp | 2 +- .../peripheral/config/include/ConfigModel.h | 3 +- .../slip/cat1Service/cat1_at_cmd.cpp | 25 +++++++++++ .../peripheral/slip/cat1Service/cat1_ctl.cpp | 45 ++++++++++++++++--- .../peripheral/slip/cat1Service/cat1_ctl.h | 12 +++-- .../slip/cat1Service/cat1_server.cpp | 32 +++++++++++++ .../peripheral/slip/cat1Service/cat1_server.h | 5 +++ .../slip/cat1Service/cat1_server_hal.cpp | 13 ++++-- .../voice_call_volte_sample_wrapper.cpp | 2 +- 12 files changed, 153 insertions(+), 26 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp index a393d01b7..cb7ef4d4e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp @@ -23,6 +23,9 @@ #include "custom_runtime.h" #include "MainCallingView.h" #include "dial_sos_c.h" +#include "cat1_ctl.h" +#include "cat1_server.h" + #ifdef __cplusplus extern "C" { #endif @@ -136,7 +139,7 @@ void StatusReset(void) NotificationManager::GetInstance()->SetWatchCallStatus(false); CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); DisshakeTimer(); - + set_call_hungup_flag(0); // If the call is handling in the notification, the slice is not switched @@ -175,6 +178,22 @@ static void CallTimerCallbackProc(int data) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::xxx"); } } + if( CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1 + && NotificationManager::GetInstance()->GetWatchCallStatus()==true) + { + if(!volte_voice_state()) + uapi_cat1_start_volte_voice(); + + if(get_call_hungup_flag()>=2) + { + cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + } + else if(get_call_hungup_flag()) + { + set_call_hungup_flag(get_call_hungup_flag()+1); + + } + } // if(MainCallingView::GetInstance()->GetScreenView()) // { diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp index f2d4347d6..95fa5fd62 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/MainCallingPresenter.cpp @@ -230,9 +230,9 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) sos_falg_clean(); } - cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - cat1_call_hungup(); + cat1_call_hungup_timer(); } @@ -249,8 +249,8 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) { if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) { - cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - cat1_call_hungup(); + //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + cat1_call_hungup_timer(); return true; //#endif @@ -278,8 +278,8 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) { - cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - cat1_call_hungup(); + //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + cat1_call_hungup_timer(); return true; //#endif 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 a06ade330..d7b623d8e 100644 --- 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 @@ -361,8 +361,8 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时步数"); step_history_save(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据"); - stand_history_save(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据"); + stand_history_save(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据"); calories_history_save(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据"); distances_history_save(); @@ -1002,6 +1002,9 @@ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req) if(strcmp("callfail",call_data)==0) { + + cat1_call_hungup(); + cat1_phone_state_change_cb(OPERATE_WATCH_FINISH); free(call_data); return; 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 8149122fd..c4e6446a2 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 @@ -695,7 +695,7 @@ void CalldialTimerCallBackProc(int data) dail_falg++; if(dail_falg>=DIAL_TIME) { - cat1_call_hungup(); + cat1_call_hungup_timer(); cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); } diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModel.h b/code/sdk/drivers/peripheral/config/include/ConfigModel.h index fa41ad714..c0bf2fb1b 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModel.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModel.h @@ -64,6 +64,7 @@ namespace OHOS CONFIGMODEL_ITEM_CUSTOM_DATA_SEX, //用户数据性别 CONFIGMODEL_ITEM_CUSTOM_DATA_AGE, //用户数据年龄 CONFIGMODEL_ITEM_CUSTOM_DATA_WEARING_MODE, //用户数据佩戴方式 + CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT, //运动目标步数 CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES, //运动目标卡路里 CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES, //运动目标站立次数 @@ -333,7 +334,7 @@ namespace OHOS {ConfigDataType::DATATYPE_INT, "goal_calories", "300" },// CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES, //运动目标卡路里 300(kcal) {ConfigDataType::DATATYPE_INT, "goal_standup_times", "10" },// CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES, //运动目标站立次数 10 {ConfigDataType::DATATYPE_INT, "goal_duration", "30" },// CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION, //运动目标时长 30(分钟) - {ConfigDataType::DATATYPE_INT, "goal_distance", "8" },// CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE, //运动目标距离 8.0(km) + {ConfigDataType::DATATYPE_INT, "goal_distance", "3" },// CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE, //运动目标距离 8.0(km) {ConfigDataType::DATATYPE_INT, "goal_step_notification", "1" },//CONFIGMODEL_ITEM_SPORTS_GOAL_STEP, //步数目标 {ConfigDataType::DATATYPE_INT, "goal_other_notification", "1" },//CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER, //其他目标 {ConfigDataType::DATATYPE_BOOL, "dnotdisturb", "false" },// CONFIGMODEL_ITEM_DNOTDISTURB //勿扰模式默认关闭 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 03cf2be25..9b362e5e4 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp @@ -334,6 +334,30 @@ static uint32_t VoiceCallSetVolume(uint8_t *para, uint32_t paraLen, char *strCom return 0; } +static uint32_t VoiceCallcontrol(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; + } + + int32_t linearVolume = atoi((char *)argv[0]); + if(linearVolume) + { + uapi_cat1_start_volte_voice(); + } + else + { + uapi_cat1_stop_volte_voice(); + } + return 0; +} + static const at_cmd_table_t g_cat1_cmd[] = { @@ -354,6 +378,7 @@ static const at_cmd_table_t g_cat1_cmd[] = { { (char *)"AT^CALL_ADD_ADRESSBOOK", ADD_ADDRESS, (char *)"1" }, { (char *)"AT^CALL_READ_ADRESSBOOK", read_ADDRESS, (char *)"1" }, { (char *)"AT^CALLVOLUME", VoiceCallSetVolume, (char *)"1" }, + { (char *)"AT^CALLVOICE", VoiceCallcontrol, (char *)"1" }, }; diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp index 70b417e71..01a383080 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp @@ -67,15 +67,48 @@ bool uapi_cat1_get_power_stat(void) return ( GPIO_LEVEL_HIGH == uapi_gpio_get_output_val(S_AGPIO_L23)); } -void uapi_cat1_start_volte_voice(void) + +static uint8_t cat1_voice=0; + +uint8_t volte_voice_state(void) { - char *argv[]={"start"}; - VoiceCallVolteSample(1,(const char**)argv); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"volte_voice_state %d \n",cat1_voice); + return cat1_voice; } -void uapi_cat1_stop_volte_voice(void) + +int32_t uapi_cat1_start_volte_voice(void) { - char *argv[]={"stop"}; - VoiceCallVolteSample(1,(const char**)argv); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"uapi_cat1_start_volte_voice\n"); + + int32_t ret = ERRCODE_FAIL; + int32_t argc = 1; + uint8_t *argv = (uint8_t *)"start"; + + ret = VoiceCallVolteSample(argc, (const char **)&argv); + if(ret==0) + cat1_voice=1; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"ret %d %d ",ret, cat1_voice); + + return ret; +} + + +int32_t uapi_cat1_stop_volte_voice(void) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"uapi_cat1_stop_volte_voice\n"); + + int32_t ret = ERRCODE_FAIL; + int32_t argc = 1; + uint8_t *argv = (uint8_t *)"stop"; + + ret = VoiceCallVolteSample(argc, (const char **)&argv); + if(ret==0) + cat1_voice=0; + + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"ret %d %d ",ret, cat1_voice); + + return ret; + } void uapi_cat1_remove_cat1_vote(void) diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.h index 07d99b297..083799ac6 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.h @@ -17,14 +17,18 @@ uint32_t uapi_cat1_power_on(uint32_t pwron); /**set resetpin 0/1*/ uint32_t uapi_cat1_reset(uint32_t pwron); -/**¸´ºÏº¯Êý£¬set powerpin 1 £¬set resetpin 0*/ +/**���Ϻ�����set powerpin 1 ��set resetpin 0*/ void power_on_cat1(void); -/**¸´ºÏº¯Êý£¬set powerpin 0 £¬set resetpin 1*/ +/**���Ϻ�����set powerpin 0 ��set resetpin 1*/ void power_off_cat1(void); void cat1_ring_isr_callback(pin_t pin, uintptr_t param); -void uapi_cat1_start_volte_voice(void); -void uapi_cat1_stop_volte_voice(void); +int32_t uapi_cat1_start_volte_voice(void); + +int32_t uapi_cat1_stop_volte_voice(void); + +uint8_t volte_voice_state(void); + void uapi_cat1_remove_cat1_vote(void); void uapi_cat1_add_cat1_vote(void); void uapi_cat1_wakeup_cat1(uint8_t wakeup); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 9b5fbbd46..df9c7fed5 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -379,6 +379,7 @@ 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 || cmd== UDP_CMD_ANSWER ) uapi_cat1_start_volte_voice(); } @@ -755,6 +756,37 @@ static int decodeNetStat(char* msg) else return -3; } + + +static uint8_t call_hungup_flag=0; + + +uint8_t get_call_hungup_flag(void) +{ + return call_hungup_flag; +} + +uint8_t set_call_hungup_flag(uint8_t data) +{ + call_hungup_flag=data; + + return 0; + +} + +//先挂断电话,并同时做记号,避免出现实际挂断了,但没有传出挂断消息的情况 + +void cat1_call_hungup_timer(void) +{ + call_hungup_flag++; + udp_send_msg_toCat1(UDP_CMD_HUNGUP,"0"); +} + + + + + + void cat1_call_hungup(void) { udp_send_msg_toCat1(UDP_CMD_HUNGUP,"0"); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h index 196c1db14..adef5d6ae 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h @@ -44,6 +44,11 @@ void send_dtfm_number_toCat1(char ch);//发送dtfm void send_volte_switch_toCat1(void); //发送VOLTE开关标识到CAT1 int cat1_handle_call_disconnected(char* phonenum); +uint8_t get_call_hungup_flag(void); +uint8_t set_call_hungup_flag(uint8_t data); + +void cat1_call_hungup_timer(void); + #ifdef __cplusplus #if __cplusplus } 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 051073155..3148c3844 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp @@ -64,8 +64,9 @@ static errcode_t cat1msg_event_notify(char* callno) CustomEventPublish(TOPIC_EVENT_CAT1_SIGNAL_UPDATE,(uint8_t*)callno,strlen(callno)+1); return 0; } -std::string call_number_end; +//传地址应设置固定内存,否则异进程内存安全没法保证 +std::string call_number_end; int callend_event_sendmsg_toUI(char* callno) { /**通过UI事件发送Notify*/ @@ -76,19 +77,23 @@ int callend_event_sendmsg_toUI(char* callno) return ERRCODE_SUCC; } - +std::string incomedcall_number_end; int incomedcall_event_sendmsg_toUI(char* callno) { /**通过UI事件发送Notify*/ - GraphicService::GetInstance()->PostGraphicEvent(std::bind(incomed_call_event_notify, callno)); + incomedcall_number_end=std::string(callno); + GraphicService::GetInstance()->PostGraphicEvent(std::bind(incomed_call_event_notify, (char *)incomedcall_number_end.c_str())); return ERRCODE_SUCC; } +std::string incomingcall_number; int incomingcall_event_sendmsg_toUI(char* callno) { /**通过UI事件发送Notify*/ - GraphicService::GetInstance()->PostGraphicEvent(std::bind(incomingcall_event_notify, callno)); + incomingcall_number=std::string(callno); + + GraphicService::GetInstance()->PostGraphicEvent(std::bind(incomingcall_event_notify, (char *)incomingcall_number.c_str())); return ERRCODE_SUCC; } diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp index 2584aa994..33ace63b6 100755 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp @@ -643,7 +643,7 @@ int32_t VoiceCallVolteSample(int32_t argc, const char *argv[]) // will free g_voiceCallVolteContext when voice call volte exit MEDIA_INFO_LOG("exit"); - return 0; + return ret; } #ifdef __cplusplus -- 2.17.1