#endif
#endif
+
+#ifdef FD230
+static SLEEP_T sleep_data = {0};
+static NAP_T nap_data = {0};
+static int state_num = 0;
+static uint32_t day_timestamp = 0;
+#endif
+
void MsgCenterNotifyNextDayProc(const Topic topic, Request* req)
{
unused(topic);
unused(req);
+#ifdef FD230
+ day_timestamp = 0;
+#endif
AlarmClockModel::GetInstance()->NextDayNotify();
if(!ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP))
{
{
unused(topic);
}
-#ifdef FD230
-static SLEEP_T sleep_data = {0};
-static NAP_T nap_data = {0};
-#endif
-static int state_num = 0;
void MsgCenterNotifyInactivityProc(const Topic topic, Request *req)
{
WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyInactivityProc !");
unused(topic);
- uint32_t timestamp = 0;
+#ifdef FD230
+ if(day_timestamp == 0)
+ {
+ uint32_t timestamp = 0;
+ time_t rawtime;
+ struct tm* timeinfo;
+ time(&rawtime);
+ timeinfo = localtime(&rawtime);
+ uapi_get_timestampe_ss(×tamp);
+ day_timestamp = timestamp - (timeinfo->tm_hour * 60 * 60 + timeinfo->tm_min * 60 + timeinfo->tm_sec);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, ", = %d", day_timestamp);
+ }
+#endif
OHOS::SLEEP_STATE_T state_data = {0};
cywee_inactivity_result_t *cywee_Inactivity_Info = (cywee_inactivity_result_t *)malloc(req->len);
if (!cywee_Inactivity_Info)
//睡眠
case INACTIVITY_MODE_SLEEPING_OUTPUT:
-
- uapi_get_timestampe_ss(×tamp);
-
#ifdef FD230
-
if(state_num < 20)
{
- sleep_data.sleep_status[state_num].timestamp = timestamp;
+ sleep_data.sleep_status[state_num].timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60;
sleep_data.sleep_status[state_num].stat = cywee_Inactivity_Info->status;
- state_num ++ ;
+ state_num ++;
}
-
- if(cywee_Inactivity_Info->status == 6) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡
+ if(cywee_Inactivity_Info->status == 0) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡
{
- sleep_data.fall_asleep_timestamp = timestamp;
+ sleep_data.fall_asleep_timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60;
}
else if(cywee_Inactivity_Info->status == 4)
{
- sleep_data.wake_up_timestamp = timestamp;
+ sleep_data.wake_up_timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60;
}
#endif
break;
//小睡
case INACTIVITY_MODE_NAP_OUTPUT:
- if(cywee_Inactivity_Info->status == 6) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡
+ if(cywee_Inactivity_Info->status == 0) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡
{
- uapi_get_timestampe_ss(×tamp);
#ifdef FD230
- nap_data.fall_asleep_timestamp = timestamp;
+ nap_data.fall_asleep_timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60;
#endif
}
else if(cywee_Inactivity_Info->status == 14)
{
- uapi_get_timestampe_ss(×tamp);
#ifdef FD230
- nap_data.wake_up_timestamp = timestamp;
+ nap_data.wake_up_timestamp = day_timestamp + cywee_Inactivity_Info->hour * 60 * 60 + cywee_Inactivity_Info->minute * 60;
#endif
}
break;