#ifndef _BLV_DEVICE_CONTROL_H_
#define _BLV_DEVICE_CONTROL_H_

#include "stdint.h"

#define Project_NO_Schema			0x00		//无模式
#define Project_Bright_Mode 		0x01		//明亮模式1
#define Project_Reception_Mode		0x02		//会客模式1
#define Project_Warm_Mode			0x03		//温馨模式
#define Project_Neight_Mode		    0x04		//睡眠模式
#define Project_Bright2_Mode 		0x05		//明亮模式2
#define Project_Reception2_Mode		0x06		//会客模式2

#define Project_Reading_Mode		0x07		//阅读模式
#define Project_Viewing_Mode		0x09		//观影模式

#define Project_Relaxation_Mode	    0x0A		//休闲模式
#define Project_Hypnotic_Mode		0x0B		//助眠模式
#define Project_Romance_Mode		0x0C		//浪漫模式

#define BLV_Curtains_Control_Time		0x07D0

#define Project_Service_Do_Not_Disturb	0x02
#define Project_Service_Clear			0x03


#define BLV_Project_Light_Off_State		0x00000000

#define Project_NightMode_Enable		1

/*项目灯光模式 - 控制状态*/
#define Project_LightMode_CH0_Control				0x00000000
#define Project_LightMode_CH0_State					0x00000000
#define Project_LightMode_CH1_Control				0x0000FFFE      //明亮模式1
#define Project_LightMode_CH1_State					0x0000F000
#define Project_LightMode_CH2_Control				0x0000FFFE      //温馨模式
#define Project_LightMode_CH2_State					0x00005000
#define Project_LightMode_CH3_Control				0x0000FFFE      //会客模式1
#define Project_LightMode_CH3_State					0x0000F004			
#define Project_LightMode_CH4_Control				0x0000FFFE		  //睡眠模式
#define Project_LightMode_CH4_State					0x00000000			
#define Project_LightMode_CH5_Control				0x00000100      //起夜模式
#define Project_LightMode_CH5_State					0x00000100	    		
#define Project_LightMode_CH6_Control				0x0000FFFE	    //阅读模式
#define Project_LightMode_CH6_State					0x00002000			
#define Project_LightMode_CH7_Control				0x0000FFFE      //会客模式2
#define Project_LightMode_CH7_State					0x0000F0C4		  	
#define Project_LightMode_CH8_Control				0x0000FFFE      //明亮模式2
#define Project_LightMode_CH8_State					0x0000F0E4			
#define Project_LightMode_CH9_Control				0x0000FFFE      //观影模式
#define Project_LightMode_CH9_State					0x00004020		  	
#define Project_LightMode_CH10_Control			0x00000000    //
#define Project_LightMode_CH10_State				0x00000000

/*项目灯光模式 - 别名*/
#define Project_NO_Schema_Control					Project_LightMode_CH0_Control
#define Project_NO_Schema_State						Project_LightMode_CH0_State
#define Project_Bright1_Mode_Control					Project_LightMode_CH1_Control    //明亮模式1
#define Project_Bright1_Mode_State					Project_LightMode_CH1_State
#define Project_Warm_Mode_Control					Project_LightMode_CH2_Control      //温馨模式
#define Project_Warm_Mode_State						Project_LightMode_CH2_State
#define Project_Neight_Mode_Control					Project_LightMode_CH4_Control     //睡眠模式
#define Project_Neight_Mode_State					Project_LightMode_CH4_State
#define Project_Reading_Mode_Control				Project_LightMode_CH6_Control     //阅读模式
#define Project_Reading_Mode_State					Project_LightMode_CH6_State
#define Project_Viewing_Mode_Control				Project_LightMode_CH9_Control    //观影模式
#define Project_Viewing_Mode_State					Project_LightMode_CH9_State
#define Project_Scene_NightLight_Control   Project_LightMode_CH5_Control     //起夜模式
#define Project_Scene_NightLight_State     Project_LightMode_CH5_State
#define Project_Bright2_Mode_Control					Project_LightMode_CH8_Control    //明亮模式2
#define Project_Bright2_Mode_State					Project_LightMode_CH8_State
#define Project_Receive1_Mode_Control					Project_LightMode_CH3_Control    //会客模式1
#define Project_Receive1_Mode_State					Project_LightMode_CH3_State
#define Project_Receive2_Mode_Control					Project_LightMode_CH7_Control    //会客模式2
#define Project_Receive2_Mode_State					Project_LightMode_CH7_State

/*项目灯关场景 - 控制状态*/
#define Project_LightScence_CH0_Control             0x0000FFFF          //取电
#define Project_LightScence_CH0_State               0x0000FDFF          //取电开的灯
#define Project_LightScence_CH1_Control				0x00000004          //廊灯
#define Project_LightScence_CH1_State				0x00000004
#define Project_LightScence_CH2_Control				0x00000008          //镜前灯1
#define Project_LightScence_CH2_State				0x00000008
#define Project_LightScence_CH3_Control				0x00000010          //卫生间灯
#define Project_LightScence_CH3_State				0x00000010			
#define Project_LightScence_CH4_Control				0x00000002		    //排气扇1
#define Project_LightScence_CH4_State				0x00000002			
#define Project_LightScence_CH5_Control				0x00000800          //卫浴灯
#define Project_LightScence_CH5_State				0x00000800			
#define Project_LightScence_CH6_Control				0x00000400	        //镜前灯2
#define Project_LightScence_CH6_State				0x00000400			
#define Project_LightScence_CH7_Control				0x00000200          //排气扇2
#define Project_LightScence_CH7_State				0x00000200			
#define Project_LightScence_CH8_Control				0x00002000          //床头灯
#define Project_LightScence_CH8_State				0x00002000			
#define Project_LightScence_CH9_Control				0x00000080          //顶灯
#define Project_LightScence_CH9_State				0x00000080			
#define Project_LightScence_CH10_Control			0x00000800          //备用
#define Project_LightScence_CH10_State				0x00000800
#define Project_LightScence_CH11_Control			0x0000FC00          //总控1
#define Project_LightScence_CH11_State				0x0000FC00
#define Project_LightScence_CH12_Control			0x000001FC          //总控2       
#define Project_LightScence_CH12_State				0x000001FC
#define Project_LightScence_CH13_Control			0x00002000          
#define Project_LightScence_CH13_State				0x00002000
#define Project_LightScence_CH14_Control			0x00000000
#define Project_LightScence_CH14_State				0x00000000
#define Project_LightScence_CH15_Control			0x00000000
#define Project_LightScence_CH15_State				0x00000000
#define Project_LightScence_CH16_Control			0x00000000
#define Project_LightScence_CH16_State				0x00000000

/*项目灯光场景 - 别名 根据项目自行定义*/
// #define	Project_Scene_ProchLight_Control			Project_LightScence_CH1_Control		//廊灯 控制
// #define	Project_Scene_ProchLight_State				Project_LightScence_CH1_State		//廊灯 状态
// #define Project_Scene_Bathroom_Control				Project_LightScence_CH2_Control		//卫浴灯 控制
// #define Project_Scene_Bathroom_State				Project_LightScence_CH2_State		//卫浴灯 状态
// #define Project_Scene_MirrorLight_Control			Project_LightScence_CH3_Control		//镜前灯 控制
// #define Project_Scene_MirrorLight_State				Project_LightScence_CH3_State		//镜前灯 状态
// #define Project_Scene_ExhaustFan_Control			Project_LightScence_CH4_Control		//排气扇 控制
// #define Project_Scene_ExhaustFan_State				Project_LightScence_CH4_State		//排气扇 状态
// #define Project_Scene_ReadingLight_Control			Project_LightScence_CH5_Control		//阅读灯 控制
// #define Project_Scene_ReadingLight_State			Project_LightScence_CH5_State		//阅读灯 状态
// #define Project_Scene_NightLight_Control			Project_LightScence_CH6_Control		//夜灯 控制
// #define Project_Scene_NightLight_State				Project_LightScence_CH6_State		//夜灯 状态
// #define Project_Scene_RoomLight_Control				Project_LightScence_CH7_Control		//房灯 控制
// #define Project_Scene_RoomLight_State				Project_LightScence_CH7_State		//房灯 状态




void BLV_BUS_Device_Init(void);
void BLV_PollPort_Init(void);
void BLV_Active_Device_Init(void);
void BLV_BUS_DEV_C5IO_Data_Init_Local(void);

void BLV_DEVICE_Action_Scan(void);
void BLV_DEVICE_Action_Processing(uint32_t dev_addr);
void Device_Switch_Scan_Signal(uint32_t devaddr);
void Device_Card_Scan_Signal(uint32_t devaddr);
void Device_XiaoBao_Scan_Signal(uint32_t devaddr);
void BUS_C5IO_Scan_DI_Signal(uint32_t dev_addr);
void BUS_C5MUSIC_Scan_Signal(uint32_t devaddr);
void BUS_TEMP_Scan_Signal(uint32_t devaddr);
void BUS_TEMP1_Scan_Signal(uint32_t devaddr);

void Project_Service_Processing(void);
void Project_Temp_Control(uint8_t Temp_num,uint16_t state);
void Project_Curtain_Control(uint8_t Curtain_num,uint8_t state);
void Project_LightMode_Control(uint8_t mode_num,uint8_t sound);
void Project_LightMode_Feedback(uint8_t mode_num);
void Project_Service_Feedback(uint8_t service,uint8_t on_off);
void Project_Feedback_All_OFF(void);
void Project_QuietMode_Feedback(uint8_t state);

#endif
