From de21275b28d98e76dcaf293471cc321d28e779b0 Mon Sep 17 00:00:00 2001 From: cheng Date: Wed, 7 Aug 2024 14:48:13 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=9A?= =?utf8?q?=E7=BB=9F=E4=B8=80UI=E9=9C=87=E5=8A=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/heart_blood/CheckAbnormalView.cpp | 7 +++++-- .../nativeui/heart_blood/CheckInvalidView.cpp | 4 ++-- .../include/SoundAndVibrationVolumeSettingC.h | 2 +- .../src/SoundAndVibrationPresenter.cpp | 4 +++- .../SoundAndVibrationVolumeSettingPresenter.cpp | 14 +++++++------- .../nativeui/takephotos/src/TakephotosModel.cpp | 2 -- .../nativeui/traing/src/TraingModel.cpp | 5 ++--- .../training_card/src/TraingCardPresenter.cpp | 2 +- .../service/ble_service/blemoder/bletest.cpp | 4 +++- .../factorytest_service/factorytest_protocol.c | 6 ++++-- .../src/notify/drinkReminder_notification.cpp | 5 ++++- .../src/notify/findwatch_notification.cpp | 5 ++--- .../src/notify/message_notification.cpp | 3 +-- .../src/notify/sleep_notification.cpp | 5 ++--- .../peripheral/config/src/ConfigModel.cpp | 5 ++++- .../sdk/drivers/peripheral/utils/custom_utils.c | 17 +++++++++-------- .../sdk/drivers/peripheral/utils/custom_utils.h | 2 +- .../vibrator/service/vibrator_service.cpp | 7 +++++++ .../vibrator/service/vibrator_service.h | 3 +++ 19 files changed, 61 insertions(+), 41 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp index 2de5203ee..1779e4dce 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp @@ -23,7 +23,7 @@ #include "heart_blood/CheckAbnormalView.h" #include "vibrator_service.h" -extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); + namespace OHOS { static CheckAbnormalView *g_pCheckAbnormalView{nullptr}; @@ -164,7 +164,10 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::InitBloodView fail"); } - custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒 + if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb()) + { + ui_api_vibrate_once_func(); + } RootView::GetInstance()->Add(container_); SetContainerView(container_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp index fc845ebff..7c89fc583 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp @@ -31,7 +31,6 @@ #include "heart_blood/health_service/health_service.h" #include "vibrator_service.h" -extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); namespace OHOS { @@ -218,7 +217,8 @@ namespace OHOS if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb()) { - custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒 + // 震动提醒 + ui_api_vibrate_once_func(); } RootView::GetInstance()->Add(container_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h index e0c3a9743..ec6f1b8a9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h @@ -19,7 +19,7 @@ extern "C" void SystemVolumeSet(int16_t sounding); void CallVolumeSet(int16_t sounding); - void VibationModeSet(int value); + // void VibationModeSet(int value); void SilentModelSet(bool isopen); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp index 4024b910a..2258d9c4e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp @@ -19,6 +19,7 @@ #include #include "soundandvibration/include/SoundAndVibrationVolumeSettingC.h" #include "UiConfig.h" +#include "vibrator_service.h" namespace OHOS { @@ -137,7 +138,8 @@ namespace OHOS int VibrationMode = view_->GetVibrationModeView()->GetVibrationModePicker()->GetSelected(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VibrationMode = %d", VibrationMode); SoundAndVibrationModel::GetInstance()->SetVibrationReminderToggleButtonStaus(VibrationMode); - uapi_vibrationModeSet(VibrationMode); + // uapi_vibrationModeSet(VibrationMode); + ui_api_vibrate_once_func(); view_->ChangeView(VIBRATIONMODEVIEW, SOUNDANDVIBRATIONVIEW); } return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp index 350c4e9fd..690803820 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp @@ -242,13 +242,13 @@ extern "C" Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO, sounding); // 系统音量设置 } - /* - * @brief 震动模式设置 - */ - void VibationModeSet(int value) - { - custom_VibratorFunc_int(value); - } + // /* + // * @brief 震动模式设置 + // */ + // void VibationModeSet(int value) + // { + // custom_VibratorFunc_int(value); + // } /* * @brief 静音模式设置 diff --git a/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosModel.cpp index eaa3c549c..195e97e66 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosModel.cpp @@ -26,8 +26,6 @@ #include "AppViewIDs.h" #include "bleEvent.h" -extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); - #ifdef __cplusplus extern "C" { diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp index f4e80afc2..dabde6acc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -65,7 +65,6 @@ #define HIGH_INTENSITY_UPPER_THRESHOLD 79 extern "C" errcode_t uapi_get_timestampe_ms(uint32_t *tm); -extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); #ifdef __cplusplus extern "C" @@ -459,7 +458,7 @@ namespace OHOS uapi_set_screen_on_api(); // 亮屏检测 if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb()) { - custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒 + ui_api_vibrate_once_func(); } TraingCardView::GetInstance()->SetPopupViewStatus(HeartPopup, true); } @@ -476,7 +475,7 @@ namespace OHOS uapi_set_screen_on_api(); // 亮屏检测 if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb()) { - custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); + ui_api_vibrate_once_func(); } TraingCardView::GetInstance()->SetPopupViewStatus(GetTagPopup, true); TraingCardView::GetInstance()->GetAnimator()->Start(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp index bb78a55c2..d61473158 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -31,7 +31,7 @@ #include extern "C" void do_cywee_service_check_msg(int cmd, int data[]); -extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); + #define MAXSPORTID 176 #define DEFAULT_DASH "--" diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index ab035b3fc..cc7b7226a 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -24,6 +24,7 @@ #include "ConfigModel.h" #include "cat1_server.h" // #include "TraingCardPresenter.h" +#include "../../../../../../drivers/peripheral/vibrator/service/vibrator_service.h" #ifdef FD230 #include "uiservice/include/ui_service.h" @@ -1453,7 +1454,8 @@ void set_vibrationremiander(uint8_t falg)//设置震动模式 { OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); p_ConfigModel->SetVibrationReminder(falg); - uapi_vibrationModeSet(falg); + // uapi_vibrationModeSet(falg); + ui_api_vibrate_once_func(); #ifdef FD230 SendMsgToUIService(UI_UPDATE_VIBRATION_MODE,0,nullptr,0); #endif diff --git a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c index 7b1c96197..f7c9e886a 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -146,7 +146,8 @@ static void func_button_callback_long_press_2s(void) void ble_vibrator_check_timer_callback(void) { - uapi_vibrationModeSet(3); + // uapi_vibrationModeSet(3); + ui_api_vibrate_once_func(); } void ble_acc_check_timer_callback(void) @@ -240,7 +241,8 @@ void aging_task(void) } PRINT("aging_t.mag_error : %d \r\n",aging_t.mag_error); - uapi_vibrationModeSet(3); + // uapi_vibrationModeSet(3); + ui_api_vibrate_once_func(); aging_t.motor_error = 0; PRINT("aging_t.motor_error : %d \r\n",aging_t.motor_error); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp index 5ce3ae99c..5e2708a32 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp @@ -14,6 +14,8 @@ #include #include #include +#include "vibrator_service.h" + namespace OHOS { @@ -91,7 +93,8 @@ namespace OHOS uapi_set_screen_on_api(); if(true != ConfigModel::GetInstance()->GetDnotdisturb()) { - uapi_vibrationModeSet(ConfigModel::GetInstance()->GetVibrationReminder()); + // uapi_vibrationModeSet(ConfigModel::GetInstance()->GetVibrationReminder()); + ui_api_vibrate_once_func(); } } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index e8732b468..d028c62e9 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -37,8 +37,7 @@ #include "ConfigModel.h" #include #include -#include "../../../../../../../middleware/services/gui/uikit/ui/interfaces/innerkits/dock/vibrator_manager.h" -extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); +#include "vibrator_service.h" namespace OHOS { @@ -133,7 +132,7 @@ namespace OHOS if(nullptr != FindWatchGroupView) { - custom_VibratorFunc(OHOS::VibratorType::VIBRATOR_TYPE_ONE); + ui_api_vibrate_once_func(); } } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp index dafc878f4..e5b0723de 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp @@ -13,7 +13,6 @@ #include "message_notification.h" #include "string" #include "vibrator_service.h" -extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); #include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h" namespace OHOS @@ -202,7 +201,7 @@ namespace OHOS if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb()) { // 震动提醒 - custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); + ui_api_vibrate_once_func(); } int32_t timeout = 2000; // 亮屏操作 2000ms 2秒关闭 diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp index adf52470e..a324d04e3 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp @@ -14,7 +14,6 @@ #include "UiConfig.h" #include "ConfigModel.h" #include "alarm/include/AlarmClockModel.h" -extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType); namespace OHOS { @@ -149,7 +148,7 @@ namespace OHOS if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb()) { - custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒 + ui_api_vibrate_once_func(); } int32_t timeout = 5000; // 亮屏操作 5000ms 5秒关闭 @@ -194,7 +193,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create SleepGroupView succeed!!"); if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb()) { - custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒 + ui_api_vibrate_once_func(); } } /*释放消息弹窗视图*/ diff --git a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp index e66f8472f..393bd53f8 100644 --- a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp +++ b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp @@ -10,6 +10,8 @@ #else #define CONFIG_DEBUG #endif +#include "../../../../../drivers/peripheral/vibrator/service/vibrator_service.h" + // #define DEBUG_LINE() printf("%s %d\n",__func__,__LINE__) namespace OHOS { @@ -1393,7 +1395,8 @@ void cm_initializeVibrationModel(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cm_initializeVibrationModel"); int value = OHOS::ConfigModel::GetInstance()->GetVibrationReminder(); - uapi_vibrationModeSet(value); + // uapi_vibrationModeSet(value); + ui_api_vibrate_once_func(); } void cm_initializeSilentModel(void) diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index d38c9fedc..b1247b5be 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -1099,13 +1099,13 @@ void uapi_callVolumeSet(int16_t sounding) #endif } -//震动强度设置 -void uapi_vibrationModeSet(int value) -{ - #ifdef FD230 - VibationModeSet(value); - #endif -} +// //震动强度设置 +// void uapi_vibrationModeSet(int value) +// { +// #ifdef FD230 +// VibationModeSet(value); +// #endif +// } //设置是否静音 void uapi_setSilentMode(bool isopen) @@ -2520,7 +2520,8 @@ void uapi_aging_test(uint32_t test_time) for(cmd = 0; cmd < 6 ; cmd++) { - uapi_vibrationModeSet(3); + // uapi_vibrationModeSet(3); + ui_api_vibrate_once_func(); LOS_Msleep(1000); } diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index 44aca45cb..1cab1bb62 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -110,7 +110,7 @@ int32_t uapi_get_screen_state(void); void uapi_systemVolumeSet(int16_t sounding); void uapi_callVolumeSet(int16_t sounding); -void uapi_vibrationModeSet(int value); +// void uapi_vibrationModeSet(int value); void uapi_setSilentMode(bool isopen); void uapi_set4GCapability(bool isopen); diff --git a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp index 09974b433..8e425abe8 100644 --- a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp +++ b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp @@ -98,6 +98,13 @@ void custom_VibratorFunc(OHOS::VibratorType vibratorType) } } +// UI 界面震动一次接口 +void ui_api_vibrate_once_func(void) +{ + custom_VibratorFunc_int(0); +} + + #define MAG_CHECK_MS 20 static unsigned long g_app_queue; diff --git a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.h b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.h index 225898a4a..f23339cec 100644 --- a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.h +++ b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.h @@ -31,6 +31,9 @@ typedef struct { */ extern void do_vibrator_cmd(vibrator_cmd_t cmd); +// UI 界面震动一次接口 +void ui_api_vibrate_once_func(void); + #ifdef __cplusplus #if __cplusplus } -- 2.17.1