WJC
2020-03-17 f6e34a69f1d1e0b0b3a6252fe20acddca7fe56e5
ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
@@ -19,13 +18,15 @@
        /// <param name="flage">If set to <c>true</c> flage.</param>
        public static void DebugPrintLog(string msg, bool flage = true)
        {
#if DEBUG
            if (flage == true)
            {
                //if (msg.Contains("DeviceStatusReport") == false)
                //{
                System.Console.WriteLine(msg);
                //}
                if (msg.Contains("DeviceStatusReport") == false)
                {
                    System.Console.WriteLine(msg + "  " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond);
                }
            }
#endif
        }
        /// <summary>
@@ -163,6 +164,10 @@
            else if (strDeviceType == ZigBee.Device.DeviceType.DoorLock.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLock>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.TemperatureSensor.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor>(strDeviceByte);
            }
            return null;
        }
@@ -208,12 +213,12 @@
                else if (this.Type == DeviceType.ColorDimmableLight)
                {
                    //彩灯
                    IconPath = "Device/ColorDimmableLight.png";
                    IconPath = "Device/ColorLight.png";
                }
                else if (this.Type == DeviceType.DimmableLight)
                {
                    //调光器
                    IconPath = "Device/ColorDimmableLight.png";
                    IconPath = "Device/Light.png";
                }
                else if (this.Type == DeviceType.OnOffOutput)
                {
@@ -225,12 +230,25 @@
                    //空调
                    IconPath = "Device/AirConditionerEpoint.png";
                }
                else if (this.Type == DeviceType.TemperatureSensor)
                {
                    if (((TemperatureSensor)this).SensorDiv == 1)
                    {
                        //温度传感器
                        IconPath = "Device/SensorTemperature.png";
                    }
                    else if (((TemperatureSensor)this).SensorDiv == 2)
                    {
                        //湿度传感器
                        IconPath = "Device/SensorHumidity.png";
                    }
                }
                else if (this.Type != DeviceType.UnKown)
                {
                    //其他的图标有点特殊
                    string unSelectPic = string.Empty;
                    string selectPic = string.Empty;
                    Shared.Common.LocalDevice.Current.GetDeviceBeloneIcon(new List<CommonDevice> { this }, ref unSelectPic, ref selectPic);
                    Shared.Common.LocalDevice.Current.GetDeviceObjectIcon(new List<CommonDevice> { this }, ref unSelectPic, ref selectPic);
                    IconPath = unSelectPic;
                }
                Shared.Common.Global.WriteFileByBytesByHomeId(FilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
@@ -276,9 +294,9 @@
        /// </summary>
        public DeviceType Type = DeviceType.UnKown;
        /// <summary>
        /// 设备的功能类型(此类型目前只针对继电器回路有效,默认为灯光)
        /// 设备的功能类型(此类型目前只针对继电器回路有效,默认未指定)
        /// </summary>
        public DeviceFunctionType DfunctionType = DeviceFunctionType.A灯光;
        public DeviceFunctionType DfunctionType = DeviceFunctionType.A未定义;
        /// <summary>
        /// MAC地址
        /// </summary>
@@ -984,7 +1002,7 @@
            /// <summary>
            /// 设备所在网关的网关id
            /// </summary>
            public int GwId;
            public string GwId;
            /// <summary>
            /// 设备名
            /// </summary>