#ifndef _BLV_NOR_DEV_SERVICEFUN_
#define _BLV_NOR_DEV_SERVICEFUN_


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

#define  ServiceNumMAX  64         //服务信息个数限制


typedef enum  //服务下标
{
	Service_Ele = 0,			//0  LOOPCH01        	取电
	Service_Dnd,              	//1  LOOPCH02        	勿扰
	Service_Clean,            	//2  LOOPCH03        	清理
	Service_Call,             	//3  LOOPCH04        	呼叫
	Service_Wash,             	//4  LOOPCH05        	洗衣
	Service_CheckOut,         	//5  LOOPCH06        	退房
	Service_Wait,             	//6  LOOPCH07        	稍后
	Service_Sos,              	//7  LOOPCH08        	SOS
	Service_Meals,            	//8  LOOPCH09        	预约待租
	Service_Food_Plate,       	//9  LOOPCH10       	开锁
	Service_Luggage,          	//10 LOOPCH11       	行李
	Service_Strong,           	//11 LOOPCH12       	保险箱 用于无卡取电门口红外使能
	Service_Door,             	//12 LOOPCH13     		门磁  
	Service_Warning,          	//13 LOOPCH14    		提示音 用于静音开启和关闭
	Service_15,               	//14 LOOPCH15    		服务15 用于背光开启和关闭
	Service_16,
	Service_17,
	Service_18,
	Service_19,
	Service_20,
	Service_21,
	Service_22,
	Service_23,
	Service_24,
	Service_PMS_Rented,					//房态 - 出租	
	Service_PMS_CheckOut,				//房态 - 退房	
	Service_PMS_Waiting,				//房态 - 待租	
	Service_PMS_Vacant,					//房态 - 空房	
	Service_29,							//固定 - 巡检服务	2025-12-25
	Service_30,
	Service_31,
	Service_32,
	Service_33,
	Service_34,
	Service_35,
	Service_36,
	Service_37,
	Service_38,
	Service_39,
	Service_40,
	Service_41,
	Service_42,
	Service_43,
	Service_44,
	Service_45,
	Service_46,
	Service_47,
	Service_48,
	Service_49,
	Service_50,
	Service_51,
	Service_52,
	Service_53,
	Service_54,
	Service_55,
	Service_56,
	Service_57,
	Service_58,
	Service_59,
	Service_60,
	Service_61,
	Service_62,
	Service_63,
	Service_64,
	
	Service_Num_MAX,               //本地自定义服务信息个数上限
}Enum_Dev_Service;              //设备服务信息集合


typedef struct 
{
	uint8_t DevChangeFlag[ServiceNumMAX];   //设备变化标志  1打开 2关闭 读完标志后，需要清空
	
	uint8_t DevServiceState[ServiceNumMAX];  //当前服务信息的状态   结合设备状态变化标志，可以判断当前服务信息是打开还是关闭
	uint8_t DevServiceStateLast[ServiceNumMAX];  //当前服务信息的上一个状态	
	
	uint8_t ServiceLoopValidNum;    //服务信息有效回路数

	//2025-09-01 这个变量没有使用，故而取消
	//Dev_Name_Struct DevNameStruct[DEVNAMENUMMAX]; //如果该类设备同时具备输入与输出，那么输入输出别名共用    
	//服务信息别名 每个回路16个字节别名     //仅支持30个回路别名

	//2025-09-01 新增首次取电 标志位
	uint8_t is_first_power_on;				//首次取电标志位
	
}__attribute__ ((__packed__))NOR_SERVICE_INFO;						//服务信息的结构体参数


void BLV_Nor_Dev_Service_Init(uint8_t devaddr);
void BLV_Nor_Dev_Service_For_Logic_Init(LOGICFILE_DEVICE_INFO *dev_info,uint8_t *data,uint16_t data_len);
uint8_t ServiceInfo_Set_first_power_on(uint8_t state);
uint8_t ServiceInfo_Get_ALL_Loop_State(uint8_t *read_buff);
uint8_t ServiceInfo_Set_RoomState(uint8_t state);
uint8_t ServiceInfo_Set_VirtualCard_LoopState(uint8_t loop,uint8_t state);
#endif



