47 lines
1014 B
C
47 lines
1014 B
C
#ifndef SERVICE_SLEEP_H
|
|
#define SERVICE_SLEEP_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef enum {
|
|
SLEEP_START,
|
|
SLEEP_LIGHT,
|
|
SLEEP_DEEP,
|
|
SLEEP_BLINK,
|
|
SLEEP_WAKE,
|
|
SLEEP_EXIT,
|
|
SLEEP_STATUS_MAX
|
|
} sleep_status_t;
|
|
|
|
typedef struct {
|
|
uint8_t sec;//0~59
|
|
uint8_t min;//0~59
|
|
uint8_t hour;//0~23
|
|
uint8_t day;//1~31
|
|
uint8_t mon;//1~12
|
|
uint16_t year; //year,eg:2024
|
|
} service_sleep_time_t;
|
|
|
|
typedef struct {
|
|
service_sleep_time_t time;
|
|
sleep_status_t status;
|
|
struct sleep_status_dada_t *next;
|
|
} sleep_status_dada_t;
|
|
|
|
void service_sleep_set_cur_week_day(uint8_t week_day);
|
|
int32_t service_sleep_save_sleep_data_to_json(service_sleep_time_t time, sleep_status_t status);
|
|
int32_t service_sleep_save_sleep_json_to_file(void);
|
|
int32_t load_sleep_data_from_json(sleep_status_dada_t *null_head, uint8_t week_day);
|
|
void service_sleep_delete_json_file(void);
|
|
void service_sleep_init(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif |