From 37cec4a51f7a5379d852f86245edcb569573da56 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Fri, 28 Jun 2024 19:19:33 +0800 Subject: [PATCH] =?utf8?q?=E9=97=B9=E9=92=9F=E6=B7=BB=E5=8A=A0=E5=88=87?= =?utf8?q?=E6=8D=A2=E7=9D=A1=E7=9C=A0=E4=B8=8E=E5=B0=8F=E7=9D=A1=E6=A8=A1?= =?utf8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/AlarmClockTimerConfig.cpp | 10 ++++++++++ .../drivers/peripheral/config/include/ConfigModelC.h | 5 ++++- .../drivers/peripheral/config/src/ConfigModel.cpp | 12 ++++++++++++ .../sdk/drivers/peripheral/cywee/Inc/cywee_service.h | 5 +++-- .../drivers/peripheral/cywee/service/cywee_service.c | 5 ++++- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp index 0b2fd5c7d..2e67d8c95 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -17,6 +17,8 @@ #include "graphic_service.h" #include "AlarmClockTimerConfig.h" +#include "cywee_service.h" +#include "ConfigModelC.h" #ifdef __cplusplus extern "C" { @@ -128,6 +130,14 @@ void AlarmScan(void *arg) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "time: %d : %d",curTime.tm_hour,curTime.tm_min); on_time_CallBackProc(); + if(curTime.tm_hour == get_sleep_time_from_config_model()) + { + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_SLEEPING_MODE,NULL); + } + else if(curTime.tm_hour == get_wake_up_time_from_config_model()) + { + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NAP_SEDENTARY_MODE,NULL); + } } } diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModelC.h b/code/sdk/drivers/peripheral/config/include/ConfigModelC.h index 8a5a2ef68..ad22bc2cd 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModelC.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModelC.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-17 09:32:03 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-06-21 20:17:12 + * @LastEditTime: 2024-06-28 18:27:45 * @FilePath: /FD230/code/sdk/drivers/peripheral/config/include/ConfigModelC.h */ #ifndef _CONFIG_MODEL_C_H_ @@ -95,6 +95,9 @@ uint8_t cm_get_vibmod(void); //cywee 获取用户信息 void get_user_info_from_config_model(int user_info[5]); +int get_sleep_time_from_config_model(void); +int get_wake_up_time_from_config_model(void); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp index ba11493f7..7caecfba0 100644 --- a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp +++ b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp @@ -1445,6 +1445,18 @@ void get_user_info_from_config_model(int user_info[5]) user_info[3] = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_CUSTOM_DATA_HEIGHT); user_info[4] = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_CUSTOM_DATA_WEARING_MODE); } +int get_sleep_time_from_config_model(void) +{ + int sleep_time = 0; + sleep_time = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP_BEDTIME); + return sleep_time; +} +int get_wake_up_time_from_config_model(void) +{ + int wake_up_time = 0; + wake_up_time = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP_GET_UP); + return wake_up_time; +} #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h index b6c303e24..121a9736a 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-26 20:29:58 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-06-22 15:03:56 + * @LastEditTime: 2024-06-28 18:00:01 * @FilePath: /FD230/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h * @Description: * @@ -61,7 +61,8 @@ extern "C" { #define CYWEE_SERVICE_CMD_HRS_WEARSTATUS_CHANGE 0x21 #define CYWEE_SERVICE_CMD_SEDENTARY_MODE 0x22 -#define CYWEE_SERVICE_CMD_NAP_MODE 0x23 +#define CYWEE_SERVICE_CMD_NAP_MODE 0x32 +#define CYWEE_SERVICE_CMD_NAP_SEDENTARY_MODE 0x23 #define CYWEE_SERVICE_CMD_SLEEPING_MODE 0x24 #define CYWEE_SERVICE_CMD_OPEN_HAND_UPDOWN 0x25 diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index 0c117f868..0d8b92707 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -341,8 +341,11 @@ static void cywee_service_check_task(void const *arg) case CYWEE_SERVICE_CMD_NAP_MODE: cywee_inactivity_mode_change(INACTIVITY_MODE_NAP); + + case CYWEE_SERVICE_CMD_NAP_SEDENTARY_MODE: + cywee_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY_AND_NAP); break; - + case CYWEE_SERVICE_CMD_SLEEPING_MODE: cywee_inactivity_mode_change(INACTIVITY_MODE_SLEEPING); break; -- 2.17.1