using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace RCUHost.Protocols
{
	/// <summary>
	/// 空调设置 Packet 服务器 -> RCU
	/// </summary>
	[StructLayout(LayoutKind.Sequential, Pack = 1)]
	public struct AirConditionSettingPacket
	{
		/// <summary>
		/// 空调编号
		/// </summary>
		public byte AirNo;

		/// <summary>
		/// 开关机：0/关，1/开
		/// </summary>
		public byte OnOff;

		/// <summary>
		/// 设定温度
		/// </summary>
		public byte SettingTemp;

		/// <summary>
		/// 补偿温度：范围 -6.0~6.0，存放格式 值*10
		/// </summary>
		public byte CompensatoryTemp;

		/// <summary>
		/// 风速：0/停止, 1/低速, 2/中速, 3/高速, 4/自动
		/// </summary>
		public byte Speed;

		/// <summary>
		/// 模式: 0/制冷，1/制热，2/送风，3/除湿
		/// </summary>
		public byte Mode;

		/// <summary>
		/// 是否锁定温度：0/否，1/是
		/// </summary>
		public byte IsLockTemp;

		/// <summary>
		/// 锁定温度
		/// </summary>
		public byte LockTemp;

		/*************温控器设置*************************************************************/

		/// <summary>
		/// 保温温度
		/// </summary>
		public byte KeepTemp;

		/// <summary>
		/// 初始温度
		/// </summary>
		public byte InitTemp;

		/// <summary>
		/// 最高温度
		/// </summary>
		public byte HighTemp;

		/// <summary>
		/// 最低温度
		/// </summary>
		public byte LowerTemp;

		/// <summary>
		/// 冷热转换延时，单位：秒
		/// </summary>
		public byte ColdHotSwitchDelayTime;

		/// <summary>
		/// 手自模式：0/手动，1/自动
		/// </summary>
		public byte ColdHotMode;

		/// <summary>
		/// 死区温度
		/// </summary>
		public byte DeadTemp;

		/// <summary>
		/// 热偏差
		/// </summary>
		public byte HotDevition;

		/// <summary>
		/// 冷偏差
		/// </summary>
		public byte ColdDevition;

		/// <summary>
		/// 欢迎模式时间(分钟)
		/// </summary>
		public byte WelcomeTime;

		/// <summary>
		/// 是否关联房态：0/否，1/是
		/// </summary>
		public byte RelateRoomStatus;

		/// <summary>
		/// 是否关联门磁：0/否，1/是
		/// </summary>
		public byte RelateDoorContact;

		/// <summary>
		/// 温度到达停止风机运行：0/否，1/是
		/// </summary>
		public byte FanStop;

		/// <summary>
		/// 禁止风机高速运行：0/否，1/是
		/// </summary>
		public byte DisableFanHighSpeed;

		/*************睡眠温度设置*************************************************************/

		/// <summary>
		/// 睡眠启用标志
		/// </summary>
		public byte SleepFlag;
		
		/// <summary>
		/// 睡眠开始时间 byte0:小时, byte1:分钟
		/// </summary>
		[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
		public byte[] SleepStartTime;

		/// <summary>
		/// 睡眠结束时间 byte0:小时, byte1:分钟
		/// </summary>
		[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
		public byte[] SleepEndTime;

		/// <summary>
		/// 睡眠模式偏差
		/// </summary>
		public byte SleepDevition;

		/*************空调定时设置*************************************************************/

		/// <summary>
		/// 定时启用标志
		/// </summary>
		public byte TimeFlag;

		/// <summary>
		/// 定时开始时间1 byte0:小时, byte1:分钟
		/// </summary>
		[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
		public byte[] TimeStartTime1;

		/// <summary>
		/// 定时结束时间1 byte0:小时, byte1:分钟
		/// </summary>
		[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
		public byte[] TimeEndTime1;

		/// <summary>
		/// 定时开始时间2 byte0:小时, byte1:分钟
		/// </summary>
		[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
		public byte[] TimeStartTime2;

		/// <summary>
		/// 定时结束时间2 byte0:小时, byte1:分钟
		/// </summary>
		[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
		public byte[] TimeEndTime2;

		/// <summary>
		/// 定时开始时间3 byte0:小时, byte1:分钟
		/// </summary>
		[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
		public byte[] TimeStartTime3;

		/// <summary>
		/// 定时结束时间3 byte0:小时, byte1:分钟
		/// </summary>
		[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)]
		public byte[] TimeEndTime3;

		/*************其它*************************************************************/

		/// <summary>
		/// CRC16
		/// </summary>
		public ushort CRC;
	}
}
