* @Author: penglei 1624952103@qq.com
* @Date: SLEPPNOTIFY24-06-26 19:36:48
* @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2024-11-06 18:28:20
+ * @LastEditTime: 2024-11-08 12:26:04
* @FilePath:
* /FD230/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp
* @Description:
FILE *fp = fopen(file_path, "rb");
if (fp == NULL)
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "read_sleep_data fopen fail");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "read_sleep_data fopen fail %s \n",file_path);
// osal_mutex_unlock(&sleep_mutex);
return false;
}
// 开机读取
void SleepModel::read_sleep_file_data() {
- custom_read_sleep_data();
- custom_read_nap_data();
+ // custom_read_sleep_data();
+ do_custom_fileoperate_service_check_msg(
+ CUSTOM_FILEOPERATE_MSG_TYPE_SLEEPDATA_READ, nullptr, 0);
+ do_custom_fileoperate_service_check_msg(
+ CUSTOM_FILEOPERATE_MSG_TYPE_NAPDATA_READ, nullptr, 0);
+ // custom_read_nap_data();
+
}
// 保存睡眠数据
void SleepModel::msg_save_sleep_data() {
sleep_data.total_time = totaltime;
}
// 更新小睡数据
- void updata_nap_data(uint32_t sleep_timestamp, uint32_t wake_timestamp,
+ void update_nap_data(uint32_t sleep_timestamp, uint32_t wake_timestamp,
uint32_t totaltime) {
nap_data.fall_asleep_timestamp = sleep_timestamp;
nap_data.wake_up_timestamp = wake_timestamp;
#include "time.h"
#include "ConfigModelC.h"
#include "battery_hal.h"
+#include "sleep/include/SleepModelC.h"
#define AP_ENABLE_DML_SDO_LISTEN
// CWM_OS_dbgPrintf("save_nap_sleep_data succ \n");
fclose(fp);
+
+ update_nap_data(fall_asleep_timestamp,wake_up_timestamp,total_time);
}
void cywee_set_sleep_time_data(cywee_inactivity_accumulate_time_t *sleep_data)
// CWM_OS_dbgPrintf("total_time[%d], total_deep_sleep_time[%d], total_mild_sleep_time[%d], total_rem_sleep_time[%d], total_wake_time[%d] \n",
// total_time,total_deep_sleep_time,total_mild_sleep_time,total_rem_sleep_time,total_wake_time);
+ update_sleep_data(fall_asleep_timestamp,wake_up_timestamp,total_time);
}