#ifndef _BLV_NOR_DEV_NOCARD_
#define _BLV_NOR_DEV_NOCARD_

#include "stdint.h"
#include "BLV_All_Dev_Init.h"

#define PORT_NUM_MAX     7

#define NOCARD_OPEN           1
#define NOCARD_CLOSE          2
#define NOCARD_ONCOUNT        5             //设置总触发次数阈值
#define NOCARD_PERCENT        4             //设置总触发时间占统计时间的百分比阈值


typedef struct
{
	uint8_t    Port;      //弱电输入端口
	uint8_t    State;     //状态
//	uint8_t    Count;     //触发次数
	uint32_t   Tick;      //触发时间戳
	uint32_t   OnTime;    //触发总时间
	
}__attribute__ ((__packed__))Port_Struct;	



typedef struct 
{
	Port_Struct Port_State[PORT_NUM_MAX];       //端口状态列表
	uint8_t  CtrlFlag;                          //触发统计标记
	uint32_t CtrlTick;                          //统计时间戳
	uint8_t  Action;                            //产生动作
	uint8_t  OffTime;                           //统计总时间 min
	uint16_t AllPercent;                        //所有端口总百分比阈值
	uint8_t  OnPercent;                         //时间百分比阈值
	uint32_t DevC5IOAddr;                       //C5IO设备地址

}__attribute__ ((__packed__))NOR_NoCard_INFO;	


void BLV_Nor_Dev_NoCard_Init(uint8_t devaddr);
void BLV_Nor_Dev_NoCard_For_Logic_Init(LOGICFILE_DEVICE_INFO *dev_info,uint8_t *data,uint16_t data_len);


#endif

