黄学彪
2020-09-18 c7df85937f73fb347ee0b19e9c052d2d00a6df6c
ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
@@ -85,7 +85,6 @@
        /// <para>持续数据上报(MomentStatus=0   TriggerZoneStatus>=1<报警>  TriggerZoneStatus=0<取消报警>)</para>
        /// <para>21: Door/Window 门窗传感器(有21和22,这里没有写错)</para>
        /// <para>22:Door/Window 门窗传感器(有21和22,这里没有写错</para>
        /// <para>541 球型移动传感器</para>
        /// </summary>
        public int IasDeviceType;
        /// <summary>
@@ -116,7 +115,7 @@
        /// </summary>
        public int ZigbeeType;
        /// <summary>
        /// 当前运行程序版本信息。 最大64字节
        /// 固件版本
        /// </summary>
        public int ImgVersion;
        /// <summary>
@@ -158,7 +157,11 @@
        /// <summary>
        /// 输出簇列表
        /// </summary>
        public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
        public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
        /// <summary>
        /// 用于记录设备最新上报的属性状态信息
        /// </summary>
        public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
        [Newtonsoft.Json.JsonIgnore]
        public DateTime LastDateTime = DateTime.MinValue;
@@ -166,7 +169,13 @@
        /// 是否已经读取了设备状态(此属性是给主页使用的)
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public bool HadReadDeviceStatu = false;
        public bool HadReadDeviceStatu = false;
        /// <summary>
        /// 是否是低电量(这个变量目前是给传感器用的)
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public bool IsBatteryDown = false;
        /// <summary>
        /// 等待从网关接收数据的时间
@@ -311,17 +320,28 @@
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.PMSensor.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<PMSensor>(strDeviceByte);
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<PMSensor>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.ColorTemperatureLight.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<ColorTemperatureLight>(strDeviceByte);
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorTemperatureLight>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.Buzzer.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<Buzzer>(strDeviceByte);
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<Buzzer>(strDeviceByte);
            }
            else { return null; }
            else if (strDeviceType == ZigBee.Device.DeviceType.ColorDimmableLight.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorDimmableLight>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.DimmerSwitch.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmerSwitch>(strDeviceByte);
            }
            else
            {
                return null;
            }
            //能少存一个变量就少存一个
            device.Type = (DeviceType)device.DeviceID;
@@ -360,6 +380,11 @@
        /// </summary>
        public void ReSave()
        {
            if (Shared.Common.Config.Instance.Home.IsShowTemplate == true)
            {
                //展示模板时,不允许保存文件(防止属性上报用的)
                return;
            }
            if (IconPath == string.Empty)
            {
                //保存设备图标(这里会保存一次,下面就不用保存了)
@@ -465,7 +490,7 @@
            /// </summary>
            public int AttributeId;
            /// <summary>
            /// 属性值,最大占用4个字节
            /// 属性值,这个东西不需要什么高位在后低位在前,它已经是转为了10进制
            /// </summary>
            public int AttributeData;
            /// <summary>