From 8a6d2c1e479e224c1493c819914d74cf4e96a3ce Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sat, 2 Nov 2024 18:57:46 +0800 Subject: [PATCH] =?utf8?q?=E5=96=9D=E6=B0=B4=E6=8F=90=E9=86=92=EF=BC=8C?= =?utf8?q?=E4=B9=85=E5=9D=90=E6=8F=90=E9=86=92=EF=BC=8C=E8=BF=90=E5=8A=A8?= =?utf8?q?=E8=AF=86=E5=88=AB=E5=BC=B9=E7=AA=97=E6=97=B6=E9=97=B4=E4=BF=9D?= =?utf8?q?=E5=AD=98=E9=87=87=E7=94=A8=E9=98=9F=E5=88=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/system/include/SystemLogModel.h | 1 + .../nativeui/system/include/SystemLogModelC.h | 1 + .../nativeui/system/src/SystemLogModel.cpp | 24 +++++++++++++++++++ .../src/notify/drinkReminder_notification.cpp | 10 ++++---- .../motion_recognition_notification.cpp | 13 ++++++---- .../notify/sedentaryReminder_notification.cpp | 11 +++++---- .../utils/custom_fileoperate_service.c | 5 ++++ .../drivers/peripheral/utils/custom_utils.h | 1 + 8 files changed, 53 insertions(+), 13 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModel.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModel.h index 1f8637861..aa32dcbbb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModel.h @@ -103,6 +103,7 @@ public: size_t get_nextday_log_size() const;//获取日志大小 /* ------------------------------ popup_windows 日志记录----------------------------- */ bool save_popup_windows_log(popup_windows_log_data data); // 保存popup_windows日志 + void save_popup_windows_log_type(int type); // 保存popup_windows日志 bool load_popup_windows_log(); // 加载popup_windows日志 const std::deque &get_popup_windows_log() const; // 获取popup_windows日志记录(常量引用) size_t get_popup_windows_log_size() const; // 获取日志大小 diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModelC.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModelC.h index e4fd948af..2eb82ebd5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModelC.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLogModelC.h @@ -15,6 +15,7 @@ void update_version_report_log(void); void start_report_nextday_log_start(void); void start_report_nextday_log_end(void); void nextday_clear_popup_windows_log(void); +void save_popup_windows_log_c(int type); #ifdef __cplusplus diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp index 11321a4fc..68a3a2c22 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLogModel.cpp @@ -76,6 +76,10 @@ void start_report_nextday_log_end(void) { void nextday_clear_popup_windows_log(void) { OHOS::SystemLogModel::GetInstance()->clear_popup_windows_log(); } +void save_popup_windows_log_c(int type) +{ + OHOS::SystemLogModel::GetInstance()->save_popup_windows_log_type(type); +} } namespace OHOS { @@ -344,6 +348,26 @@ bool SystemLogModel::save_popup_windows_log(popup_windows_log_data data) { return true; } +void SystemLogModel::save_popup_windows_log_type(int type) +{ + popup_windows_log_data data; + data.timestamp = GetCurrentTime(); + switch(type) + { + case 0: + data.type = popup_windows_type::MOTION_RECOGNITION; + break; + case 1: + data.type = popup_windows_type::DRINK_WATER_REMINDER; + break; + case 2: + data.type = popup_windows_type::SEDENTARY_REMINDER; + break; + default: + break; + } + save_popup_windows_log(data); +} bool SystemLogModel::load_popup_windows_log() { std::ifstream inFile(SYSTEM_LOG_FILE_PATH_POPUP_WINDOWS); if (!inFile) { 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 b9b4a1fad..9ad8731ec 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 @@ -106,10 +106,12 @@ namespace OHOS //记录喝水提醒日志 void DrinkReminderViewEventListener::record_drink_reminder_log(void) { - popup_windows_log_data systemlog; - systemlog.type = popup_windows_type::DRINK_WATER_REMINDER; - systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime(); - SystemLogModel::GetInstance()->save_popup_windows_log(systemlog); + // popup_windows_log_data systemlog; + // systemlog.type = popup_windows_type::DRINK_WATER_REMINDER; + // systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime(); + // SystemLogModel::GetInstance()->save_popup_windows_log(systemlog); + uint8_t type = 1; + do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST, &type, sizeof(type)); } /*创建喝水提醒视图*/ diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp index c9f2fcd02..4e8328f6f 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-17 16:44:20 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-18 20:25:43 + * @LastEditTime: 2024-11-02 14:26:15 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp */ #include "notification_manager.h" @@ -23,6 +23,7 @@ #include "vibrator_service.h" #include "custom_runtime.h" #include "system/include/SystemLogModel.h" +#include namespace OHOS { @@ -162,10 +163,12 @@ namespace OHOS // 记录运动识别日志 void MotionRecognitionViewEventListener::record_motion_recognition_log(void) { - popup_windows_log_data systemlog; - systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime(); - systemlog.type = popup_windows_type::MOTION_RECOGNITION; - SystemLogModel::GetInstance()->save_popup_windows_log(systemlog); + // popup_windows_log_data systemlog; + // systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime(); + // systemlog.type = popup_windows_type::MOTION_RECOGNITION; + // SystemLogModel::GetInstance()->save_popup_windows_log(systemlog); + uint8_t type = 0; + do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST, &type, sizeof(type)); } static std::string UpdateNoteLabelText(UILabelExt *&label, const std::string &newText, int id) diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp index e24b7efa5..d38c12cc3 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp @@ -17,6 +17,7 @@ #include "vibrator_service.h" #include "custom_runtime.h" #include "system/include/SystemLogModel.h" +#include namespace OHOS { @@ -93,10 +94,12 @@ namespace OHOS // 记录久坐提醒日志 void SedentaryReminderViewEventListener::record_sedentary_reminder_log(void) { - popup_windows_log_data systemlog; - systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime(); - systemlog.type = popup_windows_type::SEDENTARY_REMINDER; - SystemLogModel::GetInstance()->save_popup_windows_log(systemlog); + // popup_windows_log_data systemlog; + // systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime(); + // systemlog.type = popup_windows_type::SEDENTARY_REMINDER; + // SystemLogModel::GetInstance()->save_popup_windows_log(systemlog); + uint8_t type = 2; + do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST, &type, sizeof(type)); } static std::string UpdateNoteLabelText(UILabelExt *&label, const std::string &newText, int id) diff --git a/code/sdk/drivers/peripheral/utils/custom_fileoperate_service.c b/code/sdk/drivers/peripheral/utils/custom_fileoperate_service.c index def59e40d..17ef38d2b 100644 --- a/code/sdk/drivers/peripheral/utils/custom_fileoperate_service.c +++ b/code/sdk/drivers/peripheral/utils/custom_fileoperate_service.c @@ -45,6 +45,7 @@ #include "player/include/PlayersModelC.h" #include "record/include/RecordingModelC.h" +#include "system/include/SystemLogModelC.h" #include "mmc5603_hal.h" @@ -157,6 +158,10 @@ static void custom_fileoperate_service_check_task(void const *arg) case CUSTOM_FILEOPERATE_MSG_TYPE_HEART_DATA_LIST: save_heart_rate_data(); break; + case CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST: + // printf("[%d] %d\r\n",__LINE__,mail.data[0]); + save_popup_windows_log_c(mail.data[0]); + break; default: PRINT("Unknown CUSTOM_FILE_OPERATE_MSG cmd 0x%02X \r\n", mail.cmd); break; diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index 4d9bb552b..8d7d4dde2 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -264,6 +264,7 @@ errcode_t do_custom_cmd_service_check_msg_head(int cmd, void *params, int paraml #define CUSTOM_FILEOPERATE_MSG_TYPE_RECORDING_SPACE_READ 0x0D //读取录音空间 #define CUSTOM_FILEOPERATE_MSG_TYPE_HEART_DATA_LIST 0x0E //存储心率数据列表 +#define CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST 0x0F //存储弹窗数据 errcode_t uapi_custom_fileoperate_service_init(void); errcode_t do_custom_fileoperate_service_check_msg(int cmd, void *params, int paramlen); -- 2.17.1