Files
Leakage-Control/leakage_system/usr/app/app_alarm.h
2026-02-25 15:12:13 +08:00

38 lines
1.2 KiB
C

#ifndef _APP_ALARM_H_
#define _APP_ALARM_H_
#include "main.h"
#include "app_leakage.h"
/* 历史报警记录结构 */
typedef struct
{
u8 region_name[APP_LEAKAGE_STRING_NANE_LEN]; /* 区域名 */
u8 device_id; /* 设备ID */
u8 device_name[APP_LEAKAGE_STRING_NANE_LEN]; /* 设备名称 */
u16 alarm_type; /* 报警类型 */
u8 start_time[6]; /* 开始时间: 年(2字节)月日时分 */
u16 leak_distance; /* 漏液距离 (0表示非漏液报警) */
u8 channel; /* 通道号 (0-3) */
} app_leakage_history_alarm_t;
/* 历史报警管理结构 */
typedef struct
{
u32 total_records; /* 总记录数 */
u32 write_index; /* 写指针 */
u32 read_index; /* 读指针 */
u32 max_records; /* 最大记录数 */
} app_leakage_history_metadata_t;
typedef struct
{
u8 (*read_history)(u32, app_leakage_history_alarm_t *);
void (*clean_history)(void);
void (*init_history)(void);
}app_hitory_t;
extern app_hitory_t history;
#endif