HDL Home App 第二版本 旧平台金堂用 正在使用
陈嘉乐
2020-12-29 71c7ad13169695913282962a460858e13b6c0969
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs
old mode 100755 new mode 100644
@@ -280,6 +280,87 @@
        #endregion
        #region ■ 晾衣架_______________________________
        /// <summary>
        /// SendAirerComand
        ///回路2:读取照明开关状态
        ///回路3:读取风干开关状态和时间值
        ///回路4:读取烘干开关状态和时间值
        ///回路5:读取消毒开关状态和时间值
        /// </summary>
        /// <param name="device">设备</param>
        /// <param name="ctrlEpoint">控制端点</param>
        public void SendAirerComand(CommonDevice device, int ctrlEpoint)
        {
            if (device == null)
            {
                return;
            }
            new System.Threading.Thread(() =>
            {
                SendAirerStatuComand(device, ctrlEpoint);
                System.Threading.Thread.Sleep(300);
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// SendAirerStatuComand
        /// </summary>
        /// <param name="device">设备</param>
        private void SendAirerStatuComand(CommonDevice device, int ctrlEpoint = 1)
        {
            if (device == null)
            {
                return;
            }
            var jObject = new Newtonsoft.Json.Linq.JObject
            {
                { "DeviceAddr",device.DeviceAddr },
                { "Epoint", ctrlEpoint },
                { "Cluster_ID", (int)Cluster_ID.Switch},
                { "Command", 108 }
            };
            Newtonsoft.Json.Linq.JArray attriBute = new Newtonsoft.Json.Linq.JArray();
            //晾衣架的晾衣架的(烘干,风干,消毒,照明状态读取)
            attriBute = new Newtonsoft.Json.Linq.JArray
             {
                new Newtonsoft.Json.Linq.JObject
               {
                    //晾衣架的照明开关状态
                 { "AttriButeId", (int)AttriButeId.Switch}
               }
             };
            //if (device.DeviceEpoint != 2)
            //{
            //由于设备不支持时间功能,后期才支持,注意处理时间要根据烘干,风干,消毒是否开才发送相应大时间读取数据
            //attriBute = new Newtonsoft.Json.Linq.JArray {
            //        new Newtonsoft.Json.Linq.JObject
            //       {
            //            //晾衣架的开关状态(烘干,风干,消毒)
            //         { "AttriButeId", (int)AttriButeId.Switch}
            //       },
            //           new Newtonsoft.Json.Linq.JObject
            //       {
            //            //晾衣架的晾衣架的(烘干,风干,消毒)剩余时间
            //         { "AttriButeId", (int)AttriButeId.AirerRemainTime}
            //       },
            //       new Newtonsoft.Json.Linq.JObject
            //       {
            //           //晾衣架的(烘干,风干,消毒)时间
            //         { "AttriButeId", (int)AttriButeId.AirerTime}
            //       }
            //    };
            //}
            var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
            jObject.Add("Data", data);
            device.Gateway?.Send("GetDeviceStatus", jObject.ToString());
        }
        #endregion
        #region ■ 窗帘_______________________________
        /// <summary>
        /// 发送获取窗帘状态命令