#ifndef SNAPSHOOT_H__
#define SNAPSHOOT_H__

#include "stdio.h"
#include "../tag.h"
#include "../proto_forward.h"
#define MAX_COMMAND_LEN 2048

typedef enum
{
    SNAPSHOOT_FREE = 0,
    SNAPSHOOT_BUSY
}SNAPSHOOT_STATE;

typedef struct 
{
    device_t *dev;
    FILE *file;
}snapshoot_dev_list_s;

typedef struct 
{
    int sync_data;//同步并阻塞
    SNAPSHOOT_STATE state;//空闲状态
    int dev_num;
    bool check_file_ok_state;
    char history_dir[128];
    int dev_file_num;
    snapshoot_dev_list_s snapshoot_dev_list[0];
}snapshoot_var_s;

typedef struct 
{
    int snapshoot_interval; //间隔0不存 其他存储间隔 0直接不创建存储的线程
}snapshoot_param_s;
void snapshoot_init(snapshoot_param_s *snapshoot_param);
int sync_snapshoot_data_and_block();
void complete_and_start_snapshoot();
const char *get_history_dir(void);
int deleteDirectory(const char *path);
#endif


