From 7a202e94bf4454dbccf29b51ec1dd26e50d6cf36 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 12 May 2026 17:08:42 +0800 Subject: [PATCH] =?utf8?q?=E9=83=A8=E5=88=86=E5=A4=B4=E6=96=87=E4=BB=B6?= =?utf8?q?=E5=8A=A0=E7=9B=B8=E5=BA=94=E5=AE=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/aivoice/src/AiVoiceModel.cpp | 11 +++- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 8 ++- .../codedlock/include/CodedLockModel.h | 2 + .../nativeui/makephone/src/CallingView.cpp | 10 ++- .../makephone/src/MainCallingPresenter.cpp | 14 ++-- .../nativeui/message/src/MessageModel.cpp | 4 ++ .../phone/src/DialingMethodPresenter.cpp | 8 +-- .../nativeui/phone/src/PhoneCallPresenter.cpp | 2 + .../src/RebootAndShutdownPresenter.cpp | 7 -- .../schedule/src/SchedulePresenter.cpp | 7 -- .../nativeui/traing/src/TraingModel.cpp | 6 +- .../msg_center/src/msg_center_customer.cpp | 11 ++-- .../msg_center/src/notify/phone_crt.cpp | 66 ++++++++++--------- 13 files changed, 92 insertions(+), 64 deletions(-) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp index 7f6d83481..ce8d782dd 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp @@ -34,7 +34,9 @@ #include "custom_runtime.h" #include "voice_call_volte_sample_wrapper.h" #include +#ifdef SUPPORT_CAT1_SERVICE #include "websocket_server_manager.h" +#endif #include "font/ui_font.h" namespace OHOS @@ -962,7 +964,9 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "type = %d", type); if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_BT) { + #ifdef SUPPORT_AI_SERVICE streamingRecordAndSend_AI(type); // 实时发送录音数据 + #endif } else if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) { @@ -1005,10 +1009,12 @@ namespace OHOS else if (GetSelect4gorbt() == AI_SELECT_BT) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "停止录音BT"); + #ifdef SUPPORT_AI_SERVICE int32_t argc = 1; uint8_t *argv = (uint8_t *)"stop"; AudioCaptureSample(argc, (const char **)&argv); StopStreamingRecordAndSend_AI(); + #endif } uapi_save_runtime_log(RUNTIME_LOG_RECORD_STOP_AI); // TOOD* return; @@ -1382,8 +1388,9 @@ namespace OHOS if (AiVoiceModel::GetInstance().GetInit_4gai_task()) { uint8_t state = 0; - // state = get_asr_is_ready_start(); +#ifdef SUPPORT_CAT1_SERVICE state = get_asr_is_ready_start_old(); +#endif if (state) { bool state = true; @@ -1846,7 +1853,9 @@ namespace OHOS } bool AiVoiceModel::GetInit_4gai_task(void) { +#ifdef SUPPORT_CAT1_SERVICE init_4gai_task = are_all_services_ready(); +#endif return init_4gai_task; } diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp index 9cff9ab3a..1119e4ff3 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -18,7 +18,7 @@ #include // For std::unordered_map #ifdef SUPPORT_BLE_SERVICE -#include +#include "bleEvent.h" #include "bleService.h" #endif @@ -28,7 +28,9 @@ #include "NativeRegisterManager.h" #include "aivoice/include/AiVoiceSelectView.h" #include "graphic_service.h" +#ifdef SUPPORT_CAT1_SERVICE #include "websocket_server_manager.h" +#endif #include "custom_utils.h" namespace OHOS { @@ -103,7 +105,9 @@ namespace OHOS add_4GAI_vote(); // 4g投票 net4g_AI_init(); + #ifdef SUPPORT_BLE_SERVICE uapi_ble_connect_param_update(BLE_CONNECT_INTERVAL_HIGH_AI); + #endif Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_VOICE_ASSISTANT, 100); } @@ -128,7 +132,9 @@ namespace OHOS uapi_destroy_all_websocket_servers(); #endif + #ifdef SUPPORT_BLE_SERVICE uapi_ble_connect_param_update(BLE_CONNECT_INTERVAL_SLOW); + #endif WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStop end"); return; } diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/include/CodedLockModel.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/include/CodedLockModel.h index 17a25efff..f06030dca 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/include/CodedLockModel.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/include/CodedLockModel.h @@ -14,7 +14,9 @@ #include #include #include +#ifdef BLE_INSTRUCT #include "bleInstruct.h" +#endif namespace OHOS { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/CallingView.cpp index a55e4e38d..5ec837896 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/CallingView.cpp @@ -376,17 +376,21 @@ void CallingView::showdial(bool flag) void CallingView::text_updata_buf(const char *buf) { if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1){ - SendDtfmStrNumberToCat1(buf[0]); + #ifdef SUPPORT_CAT1_SERVICE + SendDtfmStrNumberToCat1(buf[0]); + #endif } else{ - uapi_hfp_send_DTMF_CODE(buf[0]); + #ifdef SUPPORT_HFP_SERVICE + uapi_hfp_send_DTMF_CODE(buf[0]); + #endif } char new_buf[16]={0}; const char*text_buf=label_number->GetText(); sprintf_s(new_buf,16,"%s%s",text_buf,buf); label_number->SetText(new_buf); - RootView::GetInstance()->Invalidate(); + RootView::GetInstance()->Invalidate(); return; } diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp index 2189e8e1d..03999aa19 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp @@ -248,7 +248,9 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + #ifdef SUPPORT_CAT1_SERVICE cat1_call_hungup_timer(); + #endif } @@ -266,7 +268,9 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) { //cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + #ifdef SUPPORT_CAT1_SERVICE cat1_call_hungup_timer(); + #endif return true; //#endif @@ -294,11 +298,11 @@ 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_timer(); + #ifdef SUPPORT_CAT1_SERVICE + cat1_call_hungup_timer(); + #endif - return true; - //#endif + return true; }else { @@ -315,8 +319,10 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::phone calling"); if (CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1) { + #ifdef SUPPORT_CAT1_SERVICE WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MakephoneNotify 11111111 "); cat1_call_answer(); + #endif return true; //#endif diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageModel.cpp index 42d346230..a37192502 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageModel.cpp @@ -319,7 +319,9 @@ uint8_t MessageModel::GetMessageCount() const { return numberOfItems; } // 加载Message文件 bool MessageModel::LoadMessagesFromStorage() { // 加载消息过滤文件 + #ifdef SUPPORT_BLE_SERVICE filtration_file_read(); + #endif std::ifstream file(MESSAGE_JSON_FILE); if (!file.is_open()) { @@ -408,7 +410,9 @@ bool MessageModel::LoadMessagesFromStorage() { // 保存Message文件 bool MessageModel::SaveMessagesToStorage() { // 消息过滤文件保存 + #ifdef SUPPORT_BLE_SERVICE filtration_file_save(); + #endif if (MessageVector.empty()) { // 清空文件 std::ofstream file(MESSAGE_JSON_FILE, diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp index f19d4efbb..d115bef15 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp @@ -65,7 +65,7 @@ namespace OHOS if(get_address_number()) { - // if(uapi_cat1_get_power_stat()==0 || + #ifdef SUPPORT_CAT1_SERVICE if(uapi_dev_runtime_get_cat1_simstat()==0) { DialingMethodView::GetInstance()->fail_Dial_show(0); @@ -74,11 +74,11 @@ namespace OHOS { cat1_UI_call_dial(get_address_number()); } - + #endif } else { - // if(uapi_cat1_get_power_stat()==0 || + #ifdef SUPPORT_CAT1_SERVICE if(uapi_dev_runtime_get_cat1_simstat()==0) { DialingMethodView::GetInstance()->fail_Dial_show(0); @@ -87,7 +87,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_cat1_get_power_stat"); NativeAbility::GetInstance().EnterSlice(VIEW_PHONECALL); } - + #endif } } diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallPresenter.cpp index 8a2b71f83..c8c1ae367 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallPresenter.cpp @@ -126,7 +126,9 @@ namespace OHOS if(TelephonyInitInterface::DIALINGMETHOD == DIALINGMETHOD_USINGWATCHSIM) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DIALINGMETHOD_USINGWATCHSIM"); + #ifdef SUPPORT_CAT1_SERVICE cat1_UI_call_dial((char *)phoneNumber.c_str()); + #endif } else if(TelephonyInitInterface::DIALINGMETHOD == DIALINGMETHOD_USINGPHONE) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp index f92836af4..535545139 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp @@ -1,10 +1,3 @@ -/* - * @Author: luozheng 1732036298@qq.com - * @Date: 2024-06-20 15:11:17 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-24 20:17:39 - * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/RebootAndShutdownPresenter.cpp - */ #include "AppViewIDs.h" #include "NativeAbility.h" #include "common/key_code.h" diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp index 1cbb07261..3b483613d 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/schedule/src/SchedulePresenter.cpp @@ -1,10 +1,3 @@ -/* - * @Author: luozheng 1732036298@qq.com - * @Date: 2024-06-20 15:11:17 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-12-13 16:28:48 - * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/SchedulePresenter.cpp - */ #include "AppViewIDs.h" #include "NativeAbility.h" #include "common/key_code.h" diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingModel.cpp index 637468ffa..27b482e04 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingModel.cpp @@ -845,11 +845,15 @@ #endif /*运动结束并且是手表发起的运动*/ if (Openingway == false) { + #ifdef SUPPORT_BLE_SERVICE sendtraningstateend(); + #endif } /*运动结束并且是app发起的运动*/ else { - sendtraningstatedata(0, sportdata->duration); + #ifdef SUPPORT_BLE_SERVICE + sendtraningstatedata(0, sportdata->duration); + #endif } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "结束运动"); diff --git a/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp index a54eac759..b3fdbe2c4 100644 --- a/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp @@ -194,11 +194,11 @@ void MsgCenterSubscribe() MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_PHONE_TO_WATCH); MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_WATCH_TO_PHONE); MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_HINT); - // MsgCenterSubscribeTopic(TOPIC_EVENT_ACTIVITY_UPDATE); - // MsgCenterSubscribeTopic(TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE); + + #ifdef SUPPORT_CYWEE_SERVICE MsgCenterSubscribeTopic(TOPIC_EVENT_AR_ALERT_TYPE_UPDATE); MsgCenterSubscribeTopic(TOPIC_EVENT_INACTIVITY_UPDATE); - // MsgCenterSubscribeTopic(TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE); + #endif MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRAINING); MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRANSMIT); MsgCenterSubscribeTopic(TOPIC_EVENT_GOAL_SHOW_VIEW); @@ -1486,6 +1486,7 @@ void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req //APP运动相关 void MsgCenterNotifybleAPPtraining(const Topic topic, Request* req) { + #ifdef SUPPORT_BLE_SERVICE unused(topic); uint8_t* data=(uint8_t*)req->data; if(data!=NULL && req->len>=2) @@ -1506,9 +1507,7 @@ void MsgCenterNotifybleAPPtraining(const Topic topic, Request* req) break; } } - - // unused(req); - + #endif } diff --git a/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp b/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp index ddc3e8fea..f31d4b7b7 100644 --- a/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp +++ b/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp @@ -22,10 +22,10 @@ #include "cat1_server.h" #include "cat1_ctl.h" #include "cat1_porting.h" +#include "cat1_UI_hal.h" #endif #include "custom_runtime.h" -#include "cat1_UI_hal.h" #include "custom_utils.h" #include "phone/include/phoneaddressmodel.h" #include "components/ui_label_button.h" @@ -70,9 +70,9 @@ uint8_t get_falg_SOS(void) //结束通话运行 void sos_falg_add(void) { - if(sos_dail_falg) + if (sos_dail_falg) { - if(OHOS::get_sos_number_count()<=0) + if (OHOS::get_sos_number_count() <= 0) { #ifdef SUPPORT_CAT1_SERVICE cat1_UI_call_dial("SOS"); @@ -80,33 +80,37 @@ void sos_falg_add(void) return; } - printf("sos dial %d\r\n",sos_dail_falg); - #if SOS_TEST_FLAG - if(1) - #else - if( uapi_dev_runtime_get_cat1_simstat()) - #endif + printf("sos dial %d\r\n", sos_dail_falg); +#if SOS_TEST_FLAG + if (1) +#else + int simstat = 0; +#ifdef SUPPORT_CAT1_SERVICE + simstat = uapi_dev_runtime_get_cat1_simstat(); +#endif + if (simstat) +#endif { #ifdef SUPPORT_CAT1_SERVICE - cat1_UI_call_dial(OHOS:: get_sos_number(sos_dail_falg)); + cat1_UI_call_dial(OHOS::get_sos_number(sos_dail_falg)); #endif } - #if SOS_HFP_FALG - else if(uapi_hfp_connect_state()) +#if SOS_HFP_FALG + else if (uapi_hfp_connect_state()) { - DialCall((unsigned char *)OHOS::get_sos_number(sos_dail_falg),osal_strlen((const char*)OHOS::get_sos_number(sos_dail_falg))); + DialCall((unsigned char *)OHOS::get_sos_number(sos_dail_falg), osal_strlen((const char *)OHOS::get_sos_number(sos_dail_falg))); } - #endif +#endif else { #ifdef SUPPORT_CAT1_SERVICE - cat1_UI_call_dial("SOS"); + cat1_UI_call_dial("SOS"); #endif } sos_dail_falg++; - if(sos_dail_falg>=OHOS::get_sos_number_count()*3) + if (sos_dail_falg >= OHOS::get_sos_number_count() * 3) { - sos_dail_falg=0; + sos_dail_falg = 0; } } } @@ -118,39 +122,41 @@ void sos_falg_clean(void) void start_SOS_phone_dail(void) { - if(OHOS::get_sos_number_count()<=0) + if (OHOS::get_sos_number_count() <= 0) { #ifdef SUPPORT_CAT1_SERVICE cat1_UI_call_dial("SOS"); #endif return; } - #if SOS_TEST_FLAG - if(1) - #else - if(uapi_dev_runtime_get_cat1_simstat()) +#if SOS_TEST_FLAG + if (1) +#else + int simstat = 0; + #ifdef SUPPORT_CAT1_SERVICE + simstat = uapi_dev_runtime_get_cat1_simstat(); #endif + if (simstat) +#endif { #ifdef SUPPORT_CAT1_SERVICE cat1_UI_call_dial(OHOS::get_sos_number(0)); #endif - sos_dail_falg=1; + sos_dail_falg = 1; } - #if SOS_HFP_FALG - else if(uapi_hfp_connect_state()) +#if SOS_HFP_FALG + else if (uapi_hfp_connect_state()) { - DialCall((unsigned char *)OHOS::get_sos_number(0),osal_strlen((const char*)OHOS::get_sos_number(0))); - sos_dail_falg=1; + DialCall((unsigned char *)OHOS::get_sos_number(0), osal_strlen((const char *)OHOS::get_sos_number(0))); + sos_dail_falg = 1; } - #endif +#endif else { #ifdef SUPPORT_CAT1_SERVICE cat1_UI_call_dial("SOS"); #endif } - - } -- 2.17.1