黄学彪
2020-05-11 2e7e5f9af5b32cfe1fc3c6ba40bf7eb984bbd0a4
ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.cs
@@ -8,36 +8,165 @@
    [System.Serializable]
    public class CommonDevice
    {
        #region 需要保存的变量
        /// <summary>
        /// 是否是自定义图片
        /// </summary>
        public bool IsCustomizeImage = false;
        /// <summary>
        /// 设备图片
        /// </summary>
        public string IconPath = string.Empty;
        /// <summary>
        /// 设备图片--在线或者选中状态
        /// </summary>
        /// <value>The online icon path.</value>
        [Newtonsoft.Json.JsonIgnore]
        public string OnlineIconPath
        {
            get
            {
                if (string.IsNullOrEmpty(IconPath))
                {
                    return string.Empty;
                }
                var pathArr = IconPath.Split('.');
                if (pathArr == null || string.IsNullOrEmpty(pathArr[0]))
                {
                    return string.Empty;
                }
                return $"{pathArr[0]}Selected.png";
            }
        }
        /// <summary>
        /// 当前网关的ID
        /// </summary>
        public string CurrentGateWayId;
        /// <summary>
        /// 当前设备类型
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public DeviceType Type = DeviceType.UnKown;
        /// <summary>
        /// 设备的功能类型(此类型目前只针对继电器回路有效,默认未指定)
        /// </summary>
        public DeviceFunctionType DfunctionType = DeviceFunctionType.A未定义;
        /// <summary>
        /// MAC地址
        /// </summary>
        public string DeviceAddr;
        /// <summary>
        /// 设备端口号
        /// </summary>
        public int DeviceEpoint;
        /// <summary>
        /// 设备id
        /// <para>258:color dimmable light,调关灯 </para>
        /// <para>10:Door lock,门锁</para>
        /// <para>514:Window covering device,窗帘</para>
        /// <para>515:Window covering controller,窗帘控制器</para>
        /// <para>769:Thermostat,恒温面板/空调</para>
        /// <para>770:Temperature Sensor,温度传感器</para>
        /// <para>775:Temperature Sensor,湿度传感器</para>
        /// <para>262:Light sensor,光照传感器</para>
        /// <para>1026:sensor,传感器,具体类型的传感器DeviceType来区分</para>
        /// </summary>
        public int DeviceID;
        /// <summary>
        /// 该字段主要针对IAS安防设备设立。所有IAS安防设备共用一个DeviceID为1026。所以要区分子设备类型,需要该字段。
        /// 瞬间数据上报的传感器 (MomentStatus=1    TriggerZoneStatus>=1<报警>)
        /// <para>13:Motion sensor (运动传感器)</para>
        /// <para>40 Fire sensor 烟雾传感器</para>
        /// <para>42 Water sensor 水侵传感器</para>
        /// <para>43 Carbon Monoxide (CO) 燃气传感器</para>
        /// <para>44 Personal emergency device 紧急按钮</para>
        /// <para>277 Key fob 钥匙扣</para>
        /// <para>持续数据上报(MomentStatus=0   TriggerZoneStatus>=1<报警>  TriggerZoneStatus=0<取消报警>)</para>
        /// <para>21: Door/Window 门窗传感器(有21和22,这里没有写错)</para>
        /// <para>22:Door/Window 门窗传感器(有21和22,这里没有写错</para>
        /// </summary>
        public int IasDeviceType;
        /// <summary>
        /// 设备名称,以设备的MAC命名
        /// </summary>
        public string DeviceName = "UnKown";
        /// <summary>
        /// 设备端点名称,以设备端点名称命名
        /// </summary>
        public string DeviceEpointName = "UnKown";
        /// <summary>
        /// 用于判断设备的zigbee协议版本。
        ///<para>49246:ZLL1.0标准设备。</para>
        ///<para>260: ZHA1.2标准设备、 Z3.0标准设备。</para>
        ///<para>41440:ZGP3.0标准设备。</para>
        ///<para>265:ZSE1.4标准设备。</para>
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public int Profile;
        /// <summary>
        /// 0:设备不在线
        /// <para>1:设备在线</para>
        /// </summary>
        public int IsOnline;
        /// <summary>
        /// 当前运行程序版本信息。 最大64字节
        /// </summary>
        public int ImgVersion;
        /// <summary>
        /// 硬件版本
        /// </summary>
        public int HwVersion;
        /// <summary>
        /// 当前镜像类型id
        /// </summary>
        public int ImgTypeId;
        /// <summary>
        /// 驱动代码。为0时,表示zigbee协调器设备。其他值表示为虚拟驱动设备
        /// </summary>
        public int DriveCode;
        /// <summary>
        /// 生产商名字
        /// </summary>
        public string ManufacturerName = string.Empty;
        /// <summary>
        /// 模块ID(这个东西也叫【型号码】)
        /// </summary>
        public string ModelIdentifier = string.Empty;
        /// <summary>
        /// 生产日期
        /// </summary>
        public string ProductionDate = string.Empty;
        /// <summary>
        /// 电源
        /// </summary>
        public int PowerSource = -1;
        /// <summary>
        /// 序列号
        /// </summary>
        public string SerialNumber = string.Empty;
        /// <summary>
        /// 输入簇列表
        /// </summary>
        public List<InClusterObj> InClusterList = new List<InClusterObj>();
        /// <summary>
        /// 输出簇列表
        /// </summary>
        public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
        [Newtonsoft.Json.JsonIgnore]
        public DateTime LastDateTime = DateTime.MinValue;
        /// <summary>
        /// 是否已经读取了设备状态(此属性是给主页使用的)
        /// <summary>
        /// 是否已经读取了设备状态(此属性是给主页使用的)
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public bool HadReadDeviceStatu = false;
        /// <summary>
        /// 调试时打开打印信息,true:打印,false:不打印
        /// </summary>
        /// <param name="msg">Message.</param>
        /// <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 + "  " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond);
                }
            }
#endif
        }
        /// <summary>
        /// 等待从网关接收数据的时间
        /// </summary>
        /// <value>The wait receive data time.</value>
        [Newtonsoft.Json.JsonIgnore]
        public virtual int WaitReceiveDataTime
        {
            get
@@ -50,16 +179,6 @@
                {
                    return 3000;
                }
            }
        }
        [Newtonsoft.Json.JsonIgnore]
        public bool IsValid
        {
            get
            {
                return (DateTime.Now - LastDateTime).TotalSeconds < 10;
            }
        }
@@ -103,6 +222,82 @@
            }
        }
        #endregion
        #region 设备保存及生成
        /// <summary>
        /// 由设备字符串比特恢复设备对象
        /// </summary>
        /// <param name="strDeviceType">设备DeviceType的字符串类型</param>
        /// <param name="strDeviceByte">设备Json文件转为比特后再转为的字符串</param>
        /// <returns></returns>
        public static CommonDevice CommonDeviceByByteString(string strDeviceType, string strDeviceByte)
        {
            CommonDevice device = null;
            if (strDeviceType == ZigBee.Device.DeviceType.DimmableLight.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.OnOffOutput.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.WindowCoveringDevice.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.OnOffSwitch.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.IASZone.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.OtaDevice.ToString() || strDeviceType == ZigBee.Device.DeviceType.OtaPanelDevice.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<OTADevice>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.AirSwitch.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.Repeater.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<Repeater>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.Thermostat.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.Transverter.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<Transverter>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.DoorLock.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLock>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.TemperatureSensor.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.FreshAirHumiditySensor.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<HumiditySensor>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.FreshAir.ToString())
            {
                device = Newtonsoft.Json.JsonConvert.DeserializeObject<FreshAir>(strDeviceByte);
            }
            else { return null; }
            //能少存一个变量就少存一个
            device.Type = (DeviceType)device.DeviceID;
            return device;
        }
        /// <summary>
        /// 由设备路径恢复设备对象
        /// </summary>
@@ -116,77 +311,6 @@
                return null;
            }
            return CommonDeviceByByteString(v[1], System.Text.Encoding.UTF8.GetString(Shared.Common.Global.ReadFileByHomeId(deviceFilePath)));
        }
        /// <summary>
        /// 由设备字符串比特恢复设备对象
        /// </summary>
        /// <param name="strDeviceType">设备DeviceType的字符串类型</param>
        /// <param name="strDeviceByte">设备Json文件转为比特后再转为的字符串</param>
        /// <returns></returns>
        public static CommonDevice CommonDeviceByByteString(string strDeviceType, string strDeviceByte)
        {
            if (strDeviceType == ZigBee.Device.DeviceType.DimmableLight.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.OnOffOutput.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.WindowCoveringDevice.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.OnOffSwitch.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<Panel>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.IASZone.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.OtaDevice.ToString() || strDeviceType == ZigBee.Device.DeviceType.OtaPanelDevice.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<OTADevice>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.AirSwitch.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.Repeater.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<Repeater>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.Thermostat.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.Transverter.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<Transverter>(strDeviceByte);
            }
            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);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.FreshAirHumiditySensor.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<HumiditySensor>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.FreshAir.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<FreshAir>(strDeviceByte);
            }
            else if (strDeviceType == ZigBee.Device.DeviceType.PMSensor.ToString())
            {
                return Newtonsoft.Json.JsonConvert.DeserializeObject<PMSensor>(strDeviceByte);
            }
            return null;
        }
        /// <summary>
@@ -252,11 +376,6 @@
                    //新风 
                    IconPath = "Device/FreshAirEpoint.png";
                }
                else if (this.Type == DeviceType.FreshAir)
                {
                    //PM2.5空气质量传感器
                    IconPath = "Device/FreshAirEpoint.png";
                }
                else if (this.Type == DeviceType.FreshAirHumiditySensor)
                {
                    //湿度传感器
@@ -287,192 +406,9 @@
            }
        }
        /// <summary>
        /// 是否是自定义图片
        /// </summary>
        public bool IsCustomizeImage = false;
        /// <summary>
        /// 设备图片
        /// </summary>
        public string IconPath = string.Empty;
        /// <summary>
        /// 设备图片--在线或者选中状态
        /// </summary>
        /// <value>The online icon path.</value>
        [Newtonsoft.Json.JsonIgnore]
        public string OnlineIconPath
        {
            get
            {
                if (string.IsNullOrEmpty(IconPath))
                {
                    return string.Empty;
                }
                var pathArr = IconPath.Split('.');
                if (pathArr == null || string.IsNullOrEmpty(pathArr[0]))
                {
                    return string.Empty;
                }
                return $"{pathArr[0]}Selected.png";
            }
        }
        #endregion
        /// <summary>
        /// 当前网关的ID
        /// </summary>
        public string CurrentGateWayId;
        /// <summary>
        /// 当前设备类型
        /// </summary>
        public DeviceType Type = DeviceType.UnKown;
        /// <summary>
        /// 设备的功能类型(此类型目前只针对继电器回路有效,默认未指定)
        /// </summary>
        public DeviceFunctionType DfunctionType = DeviceFunctionType.A未定义;
        /// <summary>
        /// MAC地址
        /// </summary>
        public string DeviceAddr;
        /// <summary>
        /// 设备端口号
        /// </summary>
        public int DeviceEpoint;
        /// <summary>
        /// 设备命令格式:Mac+端口
        /// </summary>
        /// <value>The common device address epoint.</value>
        public string CommonDeviceAddrEpoint
        {
            get
            {
                return DeviceAddr + "_" + DeviceEpoint.ToString();
            }
        }
        /// <summary>
        /// 网关反馈的时间戳
        /// </summary>
        public int Time;
        /// <summary>
        /// 网关回复的数据ID
        /// </summary>
        public int DataID;
        /// <summary>
        /// 设备id
        /// <para>258:color dimmable light,调关灯 </para>
        /// <para>10:Door lock,门锁</para>
        /// <para>514:Window covering device,窗帘</para>
        /// <para>515:Window covering controller,窗帘控制器</para>
        /// <para>769:Thermostat,恒温面板/空调</para>
        /// <para>770:Temperature Sensor,温度传感器</para>
        /// <para>775:Temperature Sensor,湿度传感器</para>
        /// <para>262:Light sensor,光照传感器</para>
        /// <para>1026:sensor,传感器,具体类型的传感器DeviceType来区分</para>
        /// </summary>
        public int DeviceID;
        /// <summary>
        /// 该字段主要针对IAS安防设备设立。所有IAS安防设备共用一个DeviceID为1026。所以要区分子设备类型,需要该字段。
        /// 瞬间数据上报的传感器 (MomentStatus=1    TriggerZoneStatus>=1<报警>)
        /// <para>13:Motion sensor (运动传感器)</para>
        /// <para>40 Fire sensor 烟雾传感器</para>
        /// <para>42 Water sensor 水侵传感器</para>
        /// <para>43 Carbon Monoxide (CO) 燃气传感器</para>
        /// <para>44 Personal emergency device 紧急按钮</para>
        /// <para>277 Key fob 钥匙扣</para>
        /// <para>持续数据上报(MomentStatus=0   TriggerZoneStatus>=1<报警>  TriggerZoneStatus=0<取消报警>)</para>
        /// <para>21: Door/Window 门窗传感器(有21和22,这里没有写错)</para>
        /// <para>22:Door/Window 门窗传感器(有21和22,这里没有写错</para>
        /// </summary>
        public int IasDeviceType;
        /// <summary>
        /// 设备名称,以设备的MAC命名
        /// </summary>
        public string DeviceName = "UnKown";
        /// <summary>
        /// 设备端点名称,以设备端点名称命名
        /// </summary>
        public string DeviceEpointName = "UnKown";
        /// <summary>
        /// 用于判断设备的zigbee协议版本。
        ///<para>49246:ZLL1.0标准设备。</para>
        ///<para>260: ZHA1.2标准设备、 Z3.0标准设备。</para>
        ///<para>41440:ZGP3.0标准设备。</para>
        ///<para>265:ZSE1.4标准设备。</para>
        /// </summary>
        public int Profile;
        /// <summary>
        /// 0:设备不在线
        /// <para>1:设备在线</para>
        /// </summary>
        public int IsOnline;
        /// <summary>
        /// 当前运行程序版本信息。 最大64字节
        /// </summary>
        public int ImgVersion;
        /// <summary>
        /// 硬件版本
        /// </summary>
        public int HwVersion;
        /// <summary>
        /// 当前镜像类型id
        /// </summary>
        public int ImgTypeId;
        /// <summary>
        /// 驱动代码。为0时,表示zigbee协调器设备。其他值表示为虚拟驱动设备
        /// </summary>
        public int DriveCode;
        /// <summary>
        /// 生产商名字
        /// </summary>
        public string ManufacturerName = string.Empty;
        /// <summary>
        /// 模块ID(这个东西也叫【型号码】)
        /// </summary>
        public string ModelIdentifier = string.Empty;
        /// <summary>
        /// 生产日期
        /// </summary>
        public string ProductionDate = string.Empty;
        /// <summary>
        /// 电源
        /// </summary>
        public int PowerSource = -1;
        /// <summary>
        /// 序列号
        /// </summary>
        public string SerialNumber = string.Empty;
        /// <summary>
        /// 所有指定cluster是否都已经成功绑定协调器
        ///<para>0:未完全绑定</para>
        ///<para>1:已经绑定</para>
        /// </summary>
        public int ClusterBindZbSuccess = -1;
        /// <summary>
        /// 是否获取所有默认绑定信息
        ///<para>0:否</para>
        ///<para>1:是</para>
        /// </summary>
        public int IsGetAllDefaultBind = -1;
        /// <summary>
        /// 输入簇列表
        /// </summary>
        public List<InClusterObj> InClusterList = new List<InClusterObj>();
        /// <summary>
        /// 输出簇列表
        /// </summary>
        public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
        /// <summary>
        /// 用于记录设备最新上报的属性状态信息。最大支持记录16个属性状态,且只记录属性值长度不大于4字节的数据。
        /// </summary>
        public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
        #region 输入输出镞定义
        /// <summary>
        /// 设备最新上报的属性状态信息
@@ -618,12 +554,15 @@
            public int commandId;
        }
        #region 二、获取已入网设备信息
        #endregion
        #region 获取已入网设备信息
        /// <summary>
        /// 网关中的设备信息
        /// </summary>
        public DeviceInfoData DeviceInfo = new DeviceInfoData();
        [Newtonsoft.Json.JsonIgnore]
        public DeviceInfoData DeviceInfo = null;
        /// <summary>
        /// 网关中的设备信息
        /// </summary>
@@ -722,110 +661,15 @@
        }
        #endregion
        #region 错误结果定义
        /// <summary>
        /// 获取所有网关的节点设备信息(用于主网关)
        /// </summary>
        public AllGatewayDeviceInfo getAllGatewayDeviceInfo;
        /// <summary>
        /// 获取所有网关的节点设备信息(用于主网关)
        /// 网关信息错误反馈共通
        /// </summary>
        [System.Serializable]
        public class AllGatewayDeviceInfo
        {
            /// <summary>
            /// 入网设备总数。等于0时,表示没有设备信息,下面字段将不存在。
            /// </summary>
            public int TotalNum;
            /// <summary>
            /// 标识当前设备是发送的是第几个设备。DeviceNum从1开始每发送一个设备信息,下一个设备信息的DeviceNum将加1。直到DeviceNum等于TotalNum说明所有设备信息发送完毕。
            /// </summary>
            public int DeviceNum;
            /// <summary>
            /// 设备所在网关的网关id
            /// </summary>
            public string GwId;
            /// <summary>
            /// 入网的utc时间戳
            /// </summary>
            public int JoinTime;
            /// <summary>
            /// 1:路由器设备
            /// <para>2:终端设备</para>
            /// </summary>
            public int ZigbeeType;
            /// <summary>
            /// 设备网络地址
            /// </summary>
            public int NwkAddr;
            /// <summary>
            /// 该字段主要针对IAS安防设备设立。所有IAS安防设备共用一个DeviceID为1026。所以要区分子设备类型,需要该字段。
            /// <para>13:Motion sensor (运动传感器)</para>
            /// <para>43:Carbon Monoxide sensor (一氧化碳传感器)</para>
            /// <para>44:Personal emergency device (紧急按钮)</para>
            /// </summary>
            public int DeviceType;
            /// <summary>
            /// 用于判断设备的zigbee协议版本。
            /// <para>49246:ZLL1.0标准设备。</para>
            /// <para>260: ZHA1.2标准设备、 Z3.0标准设备。</para>
            /// <para>41440:ZGP3.0标准设备。</para>
            /// <para>265:ZSE1.4标准设备。</para>
            /// </summary>
            public int Profile;
            /// <summary>
            /// 设备端点名
            /// </summary>
            public string DeviceName;
            /// <summary>
            /// 设备名
            /// </summary>
            public string MacName;
            /// <summary>
            /// 0:设备不在线
            /// <para>1:设备在线</para>
            /// </summary>
            public int IsOnline;
            /// <summary>
            /// 当前运行程序版本信息。 最大64字节
            /// </summary>
            public int ImgVersion;
            /// <summary>
            /// 硬件版本
            /// </summary>
            public int HwVersion;
            /// <summary>
            /// 当前镜像类型id
            /// </summary>
            public int ImgTypeId;
            /// <summary>
            /// 驱动代码。为0时,表示zigbee协调器设备。其他值表示为虚拟驱动设备
            /// </summary>
            public int DriveCode;
            /// <summary>
            /// 输入簇列表
            /// </summary>
            public List<InClusterObj> InClusterList = new List<InClusterObj>();
            /// <summary>
            /// 输出簇列表
            /// </summary>
            public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
            /// <summary>
            /// 用于记录设备最新上报的属性状态信息。最大支持记录16个属性状态,且只记录属性值长度不大于4字节的数据。
            /// </summary>
            public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
        }
        /// <summary>
        /// 获取网关记录的设备属性状态
        /// </summary>
        public GetStatusRecordAllInfo getStatusRecordAllInfo;
        /// <summary>
        /// 获取网关记录的设备属性状态
        /// </summary>
        [System.Serializable]
        public class GetStatusRecordAllInfo
        public class ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
@@ -836,269 +680,8 @@
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 设备名称修改
            /// </summary>
            public GetStatusRecordInfo getStatusRecordInfo;
        }
        /// <summary>
        /// 获取所有网关的节点设备信息(用于主网关)
        /// </summary>
        public GetStatusRecordInfo getStatusRecordInfo;
        /// <summary>
        /// 获取所有网关的节点设备信息(用于主网关)
        /// </summary>
        [System.Serializable]
        public class GetStatusRecordInfo
        {
            /// <summary>
            /// 设备所在网关的网关id
            /// </summary>
            public string GwId;
            /// <summary>
            /// 入网的utc时间戳
            /// </summary>
            public int JoinTime;
            /// <summary>
            /// 1:路由器设备
            /// <para>2:终端设备</para>
            /// </summary>
            public int ZigbeeType;
            /// <summary>
            /// 设备网络地址
            /// </summary>
            public int NwkAddr;
            /// <summary>
            /// 该字段主要针对IAS安防设备设立。所有IAS安防设备共用一个DeviceID为1026。所以要区分子设备类型,需要该字段。
            /// <para>13:Motion sensor (运动传感器)</para>
            /// <para>43:Carbon Monoxide sensor (一氧化碳传感器)</para>
            /// <para>44:Personal emergency device (紧急按钮)</para>
            /// </summary>
            public int DeviceType;
            /// <summary>
            /// 用于判断设备的zigbee协议版本。
            /// <para>49246:ZLL1.0标准设备。</para>
            /// <para>260: ZHA1.2标准设备、 Z3.0标准设备。</para>
            /// <para>41440:ZGP3.0标准设备。</para>
            /// <para>265:ZSE1.4标准设备。</para>
            /// </summary>
            public int Profile;
            /// <summary>
            /// 设备端点名
            /// </summary>
            public string DeviceName;
            /// <summary>
            /// 设备名
            /// </summary>
            public string MacName;
            /// <summary>
            /// 0:设备不在线
            /// <para>1:设备在线</para>
            /// </summary>
            public int IsOnline;
            /// <summary>
            /// 当前运行程序版本信息。 最大64字节
            /// </summary>
            public int ImgVersion;
            /// <summary>
            /// 硬件版本
            /// </summary>
            public int HwVersion;
            /// <summary>
            /// 当前镜像类型id
            /// </summary>
            public int ImgTypeId;
            /// <summary>
            /// 驱动代码。为0时,表示zigbee协调器设备。其他值表示为虚拟驱动设备
            /// </summary>
            public int DriveCode;
            /// <summary>
            /// 输入簇列表
            /// </summary>
            public List<InClusterObj> InClusterList = new List<InClusterObj>();
            /// <summary>
            /// 输出簇列表
            /// </summary>
            public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
            /// <summary>
            /// 用于记录设备最新上报的属性状态信息。最大支持记录16个属性状态,且只记录属性值长度不大于4字节的数据。
            /// </summary>
            public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
        }
        #endregion
        /// <summary>
        /// 有新设备加入zigbee网络的信息
        /// </summary>
        public DeviceDeviceJoinZbNetResponData deviceDeviceJoinZbNetResponData;
        /// <summary>
        /// 有新设备加入zigbee网络的信息
        /// </summary>
        [System.Serializable]
        public class DeviceDeviceJoinZbNetResponData
        {
            /// <summary>
            /// 设备网络地址
            /// </summary>
            public int NwkAddr;
            /// <summary>
            /// 1:路由器设备
            /// <para>2:终端设备</para>
            /// </summary>
            public int ZigbeeType;
        }
        /// <summary>
        /// 获取新设备所有端点信息是否成功信息
        /// </summary>
        public DeviceIsGetEpointInfoResponData deviceIsGetEpointInfoResponData;
        /// <summary>
        /// 获取新设备所有端点信息是否成功信息
        /// </summary>
        [System.Serializable]
        public class DeviceIsGetEpointInfoResponData
        {
            /// <summary>
            /// 0:成功获取所有端点信息
            ///<para>1:获取失败</para>
            /// </summary>
            public int Result;
        }
        /// <summary>
        /// 网关中新搜索出的设备信息
        /// </summary>
        public NewDeviceInfoData getNewDeviceInfo;
        /// <summary>
        /// 网关中新搜索出的设备信息
        /// </summary>
        [System.Serializable]
        public class NewDeviceInfoData
        {
            /// <summary>
            /// 入网的utc时间戳
            /// </summary>
            public int JoinTime;
            /// <summary>
            /// 1:路由器设备
            /// <para>2:终端设备</para>
            /// </summary>
            public int ZigbeeType;
            /// <summary>
            /// 设备网络地址
            /// </summary>
            public int NwkAddr;
            /// <summary>
            /// 该字段主要针对IAS安防设备设立。所有IAS安防设备共用一个DeviceID为1026。所以要区分子设备类型,需要该字段。
            /// <para>13:Motion sensor (运动传感器)</para>
            /// <para>43:Carbon Monoxide sensor (一氧化碳传感器)</para>
            /// <para>44:Personal emergency device (紧急按钮)</para>
            /// </summary>
            public int DeviceType;
            /// <summary>
            /// 用于判断设备的zigbee协议版本。区分3.0设备和ZHA设备
            /// <para>49246:ZLL1.0标准设备。</para>
            /// <para>260: ZHA1.2标准设备、 Z3.0标准设备。</para>
            /// <para>41440:ZGP3.0标准设备。</para>
            /// <para>265:ZSE1.4标准设备。</para>
            /// </summary>
            public int Profile;
            /// <summary>
            /// 是否是新入网设备。
            /// <para>如果网关储存的设备列表中原来是没有该设备则为新入网设备。</para>
            /// <para>如果网关储存的设备列表中有该设备则为旧设备。</para>
            /// <para>如果重入网后设备信息已经改变(如设备的网络地址,设备ID,cluster列表)则也视为新设备入网。</para>
            /// <para>该字段用来判别用户可能通过节点的实体按键将设备恢复出厂设备后节点设备重新入网的情况或节点设备重启主动发送入网信息的情况。</para>
            /// <para>0:旧设备入网</para>
            /// <para>1:新设备入网</para>
            /// <para>2:设备为新设备,并在上报该信息前已经退网,即设备入网后网关还来不及上报该设备信息设备便已经退网。(设备入网,到网关上报设备信息有一段延时,如果在此期间如果设备已经退网,将反馈该值。该值为异常情况,当收到该值时候说明设备并没入网,可丢弃这个入网信息)</para>
            /// </summary>
            public int IsNewDev;
            /// <summary>
            /// 当前运行程序版本信息。 最大64字节
            /// </summary>
            public int ImgVersion;
            /// <summary>
            /// 硬件版本
            /// </summary>
            public int HwVersion;
            /// <summary>
            /// 当前镜像类型id
            /// </summary>
            public int ImgTypeId;
            /// <summary>
            /// 驱动代码。为0时,表示zigbee协调器设备。其他值表示为虚拟驱动设备
            /// </summary>
            public int DriveCode;
            /// <summary>
            /// 设备所在网关的网关id
            /// </summary>
            public string GwId;
            /// <summary>
            /// 设备名
            /// </summary>
            public string MacName;
            /// <summary>
            /// 设备端点名
            /// </summary>
            public string DeviceName;
            /// <summary>
            /// 0:设备不在线
            /// <para>1:设备在线</para>
            /// </summary>
            public int IsOnline;
            /// <summary>
            /// 所有指定cluster是否都已经成功绑定协调器
            ///<para>0:未完全绑定</para>
            ///<para>1:已经绑定</para>
            /// </summary>
            public int ClusterBindZbSuccess = -1;
            /// <summary>
            /// 是否获取所有默认绑定信息
            ///<para>0:否</para>
            ///<para>1:是</para>
            /// </summary>
            public int IsGetAllDefaultBind = -1;
            /// <summary>
            /// 生产商名字
            /// </summary>
            public string ManufacturerName = string.Empty;
            /// <summary>
            /// 模块ID(这个东西也叫【型号码】)
            /// </summary>
            public string ModelIdentifier = string.Empty;
            /// <summary>
            /// 生产日期
            /// </summary>
            public string ProductionDate = string.Empty;
            /// <summary>
            /// 电源
            /// </summary>
            public int PowerSource = -1;
            /// <summary>
            /// 序列号
            /// </summary>
            public string SerialNumber = string.Empty;
            /// <summary>
            /// 输入簇列表
            /// </summary>
            public List<InClusterObj> InClusterList = new List<InClusterObj>();
            /// <summary>
            /// 输出簇列表
            /// </summary>
            public List<OutClusterObj> OutClusterList = new List<OutClusterObj>();
            /// <summary>
            /// 用于记录设备最新上报的属性状态信息。最大支持记录16个属性状态,且只记录属性值长度不大于4字节的数据。
            /// </summary>
            public List<AttributeStatusObj> AttributeStatus = new List<AttributeStatusObj>();
        }
        /// <summary>
        /// 网关信息错误反馈
        /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
        /// </summary>
        public ErrorResponData errorResponData;
        /// <summary>
        /// 网关信息错误反馈
        /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
@@ -1146,6 +729,8 @@
            return message;
        }
        #endregion
        #region 修改设备端口名称
        ///<summary >
        /// 修改设备端口(按键)名称
@@ -1168,8 +753,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -1226,10 +810,6 @@
        /// <summary>
        /// 重命名设备,网关反馈具体信息
        /// </summary>
        public DeviceRenameAllData renameDeviceAllData;
        /// <summary>
        /// 重命名设备,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class DeviceRenameAllData
        {
@@ -1248,10 +828,6 @@
            public DeviceRenameResponseData deviceRenameData;
        }
        /// <summary>
        /// 设备名称修改
        /// </summary>
        public DeviceRenameResponseData renameDeviceData;
        /// <summary>
        /// 设备名称修改
        /// </summary>
@@ -1291,8 +867,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -1350,32 +925,15 @@
        /// <summary>
        /// 修改设备mac名称数据,网关反馈具体信息
        /// </summary>
        public RenameDeviceMacNameAllData renameDeviceMacNameAllData;
        /// <summary>
        /// 修改设备mac名称数据,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class RenameDeviceMacNameAllData
        public class RenameDeviceMacNameAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 修改设备mac名称数据
            /// </summary>
            public RenameDeviceMacNameData renameDeviceMacNameData;
        }
        /// <summary>
        /// 修改设备mac名称数据
        /// </summary>
        public RenameDeviceMacNameData renameDeviceMacNameData;
        /// <summary>
        /// 修改设备mac名称数据
        /// </summary>
@@ -1391,32 +949,6 @@
            /// 修改后的设备名称
            /// </summary>
            public string MacName;
        }
        #endregion
        #region 设备恢复出厂设置与出网
        ///<summary >
        /// 使设备恢复出厂设置
        /// <para>仅恢复出厂设置,不离网。但有些不标准的3.0设备,恢复出厂设置就会离网。 客户端或云端到网关</para>
        /// </summary>
        public async void ResetDeviceFactoryAsync(string deviceAddr, int deviceEpoint)
        {
            if (Gateway == null)
            {
                return;
            }
            //Action<string, string> action = (topic, message) => { };
            //Gateway.Actions += action;
            System.Console.WriteLine("FactoryResete_Actions 启动" + "_" + System.DateTime.Now.ToString());
            try
            {
                var jObject = new JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 0 }, { "Command", 97 } };
                Gateway.Send("FactoryReset", jObject.ToString());
            }
            catch { }
            //Gateway.Actions -= action;
            System.Console.WriteLine("FactoryReset_Action退出" + System.DateTime.Now.ToString());
        }
        #endregion
@@ -1442,8 +974,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -1457,16 +988,15 @@
                    if (topic == gatewayID + "/" + "RemoveDeviceRespon")
                    {
                        var gatewayTemp = new ZbGateway() { DeviceAddr = jobject.Value<string>("DeviceAddr"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
                        gatewayTemp.removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.RemoveDeviceResponseData>(jobject["Data"].ToString());
                        var removeDeviceResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.RemoveDeviceResponseData>(jobject["Data"].ToString());
                        if (gatewayTemp.removeDeviceResponseData == null)
                        if (removeDeviceResponseData == null)
                        {
                            d = new RemoveDeviceResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new RemoveDeviceResponseAllData { removeDeviceResponseData = gatewayTemp.removeDeviceResponseData };
                            d = new RemoveDeviceResponseAllData { removeDeviceResponseData = removeDeviceResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
                    }
@@ -1519,10 +1049,6 @@
        /// <summary>
        /// 需要删除设备的数据
        /// </summary>
        public RemoveDeviceData removeDeviceData;
        /// <summary>
        /// 需要删除设备的数据
        /// </summary>
        [System.Serializable]
        public class RemoveDeviceData
        {
@@ -1552,10 +1078,6 @@
        /// <summary>
        /// 移除设备,网关反馈具体信息
        /// </summary>
        public RemoveDeviceResponseAllData removeDeviceResponseAllData;
        /// <summary>
        /// 移除设备,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class RemoveDeviceResponseAllData
        {
@@ -1574,10 +1096,6 @@
            public RemoveDeviceResponseData removeDeviceResponseData;
        }
        /// <summary>
        /// 删除设备回复数据
        /// </summary>
        public RemoveDeviceResponseData removeDeviceResponseData;
        /// <summary>
        /// 删除设备回复数据
        /// <para>返回结果Resul=,删除成功</para>
@@ -1618,135 +1136,6 @@
            public int Epoint;
        }
        #endregion
        #region 从总设备列表中移除一个网关的所有节点设备(用于主网关)
        ///<summary >
        /// 从总设备列表中移除一个网关的所有节点设备(用于主网关)
        /// <para>GwId:要移除节点设备的网关id</para>
        /// </summary>
        public async System.Threading.Tasks.Task<RemoveGatewayDeviceListAllData> RemoveGatewayDeviceListAsync(string gwId)
        {
            if (Gateway == null || gwId == null)
            {
                return null;
            }
            return await System.Threading.Tasks.Task.Run(async () =>
            {
                RemoveGatewayDeviceListAllData d = null;
                Action<string, string> action = (topic, message) =>
                {
                    var gatewayID = topic.Split('/')[0];
                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
                            d = new RemoveGatewayDeviceListAllData { errorMessageBase = "网关错误回复,且数据是空" };
                        }
                        else
                        {
                            d = new RemoveGatewayDeviceListAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) };
                        }
                    }
                    if (topic == gatewayID + "/" + "RemoveEqOfGw_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID };
                        gatewayTemp.removeGatewayDeviceListData = Newtonsoft.Json.JsonConvert.DeserializeObject<RemoveGatewayDeviceListData>(jobject["Data"].ToString());
                        if (gatewayTemp.removeGatewayDeviceListData == null)
                        {
                            d = new RemoveGatewayDeviceListAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new RemoveGatewayDeviceListAllData { removeGatewayDeviceListData = gatewayTemp.removeGatewayDeviceListData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
                    }
                };
                Gateway.Actions += action;
                System.Console.WriteLine("RemoveEqOfGw_Actions 启动" + "_" + System.DateTime.Now.ToString());
                try
                {
                    var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 81 } };
                    var data = new JObject { { "GwId", gwId } };
                    jObject.Add("Data", data);
                    Gateway.Send(("RemoveEqOfGw"), jObject.ToString());
                }
                catch { }
                var dateTime = DateTime.Now;
                while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime)
                {
                    await System.Threading.Tasks.Task.Delay(10);
                    if (d != null)
                    {
                        break;
                    }
                }
                if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime)
                {
                    d = new RemoveGatewayDeviceListAllData { errorMessageBase = " 回复超时,请重新操作" };
                }
                Gateway.Actions -= action;
                System.Console.WriteLine("RemoveEqOfGw_Actions 退出" + System.DateTime.Now.ToString());
                return d;
            });
        }
        /// <summary>
        /// 移除设备,网关反馈具体信息
        /// </summary>
        public RemoveGatewayDeviceListAllData removeGatewayDeviceListAllData;
        /// <summary>
        /// 移除设备,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class RemoveGatewayDeviceListAllData
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 设备名称修改
            /// </summary>
            public RemoveGatewayDeviceListData removeGatewayDeviceListData;
        }
        /// <summary>
        /// 从总设备列表中移除一个网关的所有节点设备(用于主网关)
        /// </summary>
        public RemoveGatewayDeviceListData removeGatewayDeviceListData;
        /// <summary>
        /// 从总设备列表中移除一个网关的所有节点设备(用于主网关)
        /// </summary>
        [System.Serializable]
        public class RemoveGatewayDeviceListData
        {
            /// <summary>
            /// 要移除节点设备的网关id
            /// </summary>
            public string GwId;
            /// <summary>
            /// 被删除设备的数量
            /// </summary>
            public int RemoveNum;
        }
        #endregion
        #region 识别设备
@@ -1826,7 +1215,8 @@
        /// <summary>
        /// 设备属性状态上报
        /// </summary>
        public DeviceStatusReportData DeviceStatusReport = new DeviceStatusReportData { };
        [Newtonsoft.Json.JsonIgnore]
        public DeviceStatusReportData DeviceStatusReport = new DeviceStatusReportData();
        /// <summary>
        /// 设备属性状态上报
        /// </summary>
@@ -1891,8 +1281,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -1906,7 +1295,6 @@
                    if (topic == gatewayID + "/" + "SetWritableValue_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetWritableValueResponData>(jobject["Data"].ToString());
                        if (tempData == null)
@@ -1955,22 +1343,9 @@
        /// <summary>
        /// 网关版本信息,网关反馈信息
        /// </summary>
        public SetWritableValueResponAllData setWritableValueResponAllData;
        /// <summary>
        /// 网关版本信息,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class SetWritableValueResponAllData
        public class SetWritableValueResponAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 网关版本信息
            /// </summary>
@@ -2001,10 +1376,6 @@
        }
        /// <summary>
        /// 设置可写属性的值的数据
        /// </summary>
        public SetWritableValueData setWritableValueData;
        /// <summary>
        /// 设置可写属性的值的数据
        /// </summary>
@@ -2081,8 +1452,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2096,22 +1466,21 @@
                    if (topic == gatewayID + "/" + "Cluster/OwnAttributes_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        gatewayTemp.clusterOwnAttributesResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ClusterOwnAttributesResponData>(jobject["Data"].ToString());
                        var clusterOwnAttributesResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClusterOwnAttributesResponData>(jobject["Data"].ToString());
                        var tempAttributes = Newtonsoft.Json.Linq.JArray.Parse(jobject["Data"]["Attribute"].ToString());
                        for (int m = 0; tempAttributes != null && m < tempAttributes.Count; m++)
                        {
                            var tempAttribute = tempAttributes[m];
                            gatewayTemp.clusterOwnAttributesResponData.AttributeList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AttributeObj>(tempAttribute.ToString()));
                            clusterOwnAttributesResponData.AttributeList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AttributeObj>(tempAttribute.ToString()));
                        }
                        if (gatewayTemp.clusterOwnAttributesResponData == null)
                        if (clusterOwnAttributesResponData == null)
                        {
                            d = new ClusterOwnAttributesResponAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new ClusterOwnAttributesResponAllData { clusterOwnAttributesResponData = gatewayTemp.clusterOwnAttributesResponData };
                            d = new ClusterOwnAttributesResponAllData { clusterOwnAttributesResponData = clusterOwnAttributesResponData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
@@ -2150,32 +1519,15 @@
        /// <summary>
        /// 发现属性,网关反馈信息
        /// </summary>
        public ClusterOwnAttributesResponAllData clusterOwnAttributesResponAllData;
        /// <summary>
        /// 发现属性,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class ClusterOwnAttributesResponAllData
        public class ClusterOwnAttributesResponAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 网关版本信息
            /// </summary>
            public ClusterOwnAttributesResponData clusterOwnAttributesResponData;
        }
        /// <summary>
        /// 发现属性数据
        /// </summary>
        public ClusterOwnAttributesResponData clusterOwnAttributesResponData;
        [System.Serializable]
        public class ClusterOwnAttributesResponData
        {
@@ -2214,8 +1566,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2230,17 +1581,16 @@
                    if (topic == gatewayID + "/" + "Cluster/OwnCommand_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        gatewayTemp.clusterOwnCommandResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClusterOwnCommandResponData>(jobject["Data"].ToString());
                        var clusterOwnCommandResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClusterOwnCommandResponData>(jobject["Data"].ToString());
                        if (gatewayTemp.clusterOwnCommandResponData == null)
                        if (clusterOwnCommandResponData == null)
                        {
                            d = new ClusterOwnCommandResponAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new ClusterOwnCommandResponAllData { clusterOwnCommandResponData = gatewayTemp.clusterOwnCommandResponData };
                            d = new ClusterOwnCommandResponAllData { clusterOwnCommandResponData = clusterOwnCommandResponData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
                    }
@@ -2279,32 +1629,15 @@
        /// <summary>
        /// 设备某cluster所支持的Command数据,网关反馈信息
        /// </summary>
        public ClusterOwnCommandResponAllData clusterOwnCommandResponAllData;
        /// <summary>
        /// 设备某cluster所支持的Command数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class ClusterOwnCommandResponAllData
        public class ClusterOwnCommandResponAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 网设备某cluster所支持的Command数据
            /// </summary>
            public ClusterOwnCommandResponData clusterOwnCommandResponData;
        }
        /// <summary>
        /// 设备某cluster所支持的Command数据
        /// </summary>
        public ClusterOwnCommandResponData clusterOwnCommandResponData;
        /// <summary>
        /// 设备某cluster所支持的Command数据
        /// </summary>
@@ -2342,8 +1675,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2358,16 +1690,15 @@
                    if (topic == gatewayID + "/" + "OTA/SetImage_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
                        gatewayTemp.oTASetImageData = Newtonsoft.Json.JsonConvert.DeserializeObject<OTASetImageData>(jobject["Data"].ToString());
                        var oTASetImageData = Newtonsoft.Json.JsonConvert.DeserializeObject<OTASetImageData>(jobject["Data"].ToString());
                        if (gatewayTemp.oTASetImageData == null)
                        if (oTASetImageData == null)
                        {
                            d = new OTASetImageResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new OTASetImageResponseAllData { otaSetImageData = gatewayTemp.oTASetImageData };
                            d = new OTASetImageResponseAllData { otaSetImageData = oTASetImageData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
                    }
@@ -2407,31 +1738,15 @@
        /// <summary>
        /// 设备进行OTA升级,网关反馈具体信息
        /// </summary>
        public OTASetImageResponseAllData otaSetImageResponseAllData;
        /// <summary>
        /// 设备进行OTA升级,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class OTASetImageResponseAllData
        public class OTASetImageResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 保存zigbee协调器组网信息
            /// </summary>
            public OTASetImageData otaSetImageData;
        }
        /// <summary>
        /// 设备进行OTA升级
        /// </summary>
        public OTASetImageData oTASetImageData;
        [System.Serializable]
        public class OTASetImageData
        {
@@ -2505,8 +1820,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2521,16 +1835,15 @@
                    if (topic == gatewayID + "/" + "OTA/StartUpdate_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
                        gatewayTemp.startUpdateDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<StartDeviceUpdateData>(jobject["Data"].ToString());
                        var startUpdateDeviceData = Newtonsoft.Json.JsonConvert.DeserializeObject<StartDeviceUpdateData>(jobject["Data"].ToString());
                        if (gatewayTemp.startUpdateDeviceData == null)
                        if (startUpdateDeviceData == null)
                        {
                            d = new StartDeviceUpdateResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new StartDeviceUpdateResponseAllData { startUpdateDeviceData = gatewayTemp.startUpdateDeviceData };
                            d = new StartDeviceUpdateResponseAllData { startUpdateDeviceData = startUpdateDeviceData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
                    }
@@ -2583,10 +1896,6 @@
        /// <summary>
        /// 启动升级,网关反馈具体信息
        /// </summary>
        public StartDeviceUpdateResponseAllData startUpdateDeviceResponseAllData;
        /// <summary>
        /// 启动升级,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class StartDeviceUpdateResponseAllData
        {
@@ -2604,10 +1913,7 @@
            /// </summary>
            public StartDeviceUpdateData startUpdateDeviceData;
        }
        /// <summary>
        /// 启动升级
        /// </summary>
        public StartDeviceUpdateData startUpdateDeviceData;
        [System.Serializable]
        public class StartDeviceUpdateData
        {
@@ -2648,7 +1954,9 @@
        /// <summary>
        /// 启动升级
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public OTAScheduleResponData oTAScheduleResponData;
        [System.Serializable]
        public class OTAScheduleResponData
        {
@@ -2669,10 +1977,6 @@
            public int Percent = 999;
        }
        /// <summary>
        ///  启动升级的数据
        /// </summary>
        public StartUpdateData startUpdateData;
        [System.Serializable]
        public class StartUpdateData
        {
@@ -2702,8 +2006,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2718,16 +2021,15 @@
                    if (topic == gatewayID + "/" + "ZbDataPassthrough")
                    {
                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
                        gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
                        var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString());
                        if (gatewayTemp.clientDataPassthroughResponseData == null)
                        if (clientDataPassthroughResponseData == null)
                        {
                            d = new ClientDataPassthroughResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new ClientDataPassthroughResponseAllData { clientDataPassthroughResponseData = gatewayTemp.clientDataPassthroughResponseData };
                            d = new ClientDataPassthroughResponseAllData { clientDataPassthroughResponseData = clientDataPassthroughResponseData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
                    }
@@ -2767,22 +2069,9 @@
        /// <summary>
        /// 客户端向节点设备透传数据,网关反馈具体信息
        /// </summary>
        public ClientDataPassthroughResponseAllData clientDataPassthroughResponseAllData;
        /// <summary>
        /// 客户端向节点设备透传数据,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class ClientDataPassthroughResponseAllData
        public class ClientDataPassthroughResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 客户端向节点设备透传数据
            /// </summary>
@@ -2791,7 +2080,9 @@
        /// <summary>
        /// 客户端向节点设备透传数据
        /// </summary>
        public ClientDataPassthroughResponseData clientDataPassthroughResponseData = new ClientDataPassthroughResponseData { };
        [Newtonsoft.Json.JsonIgnore]
        public ClientDataPassthroughResponseData clientDataPassthroughResponseData = new ClientDataPassthroughResponseData();
        [System.Serializable]
        public class ClientDataPassthroughResponseData
        {
@@ -2804,31 +2095,15 @@
        /// <summary>
        /// 启用或关闭节点设备透传数据上传接口,网关反馈具体信息
        /// </summary>
        public OnZbDataPassthroughResponseAllData onZbDataPassthroughResponseAllData;
        /// <summary>
        /// 启用或关闭节点设备透传数据上传接口,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class OnZbDataPassthroughResponseAllData
        public class OnZbDataPassthroughResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 启用或关闭节点设备透传数据上传接口
            /// </summary>
            public OnZbDataPassthroughData onZbDataPassthroughData;
        }
        /// <summary>
        /// 启用或关闭节点设备透传数据上传接口
        /// </summary>
        public OnZbDataPassthroughData onZbDataPassthroughData;
        [System.Serializable]
        public class OnZbDataPassthroughData
        {
@@ -2863,8 +2138,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -2878,16 +2152,15 @@
                    if (topic == gatewayID + "/" + "DownloadFile_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
                        gatewayTemp.downloadFileResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<DownloadFileResponData>(jobject["Data"].ToString());
                        var downloadFileResponData = Newtonsoft.Json.JsonConvert.DeserializeObject<DownloadFileResponData>(jobject["Data"].ToString());
                        if (gatewayTemp.downloadFileResponData == null)
                        if (downloadFileResponData == null)
                        {
                            d = new DownloadFileResponAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new DownloadFileResponAllData { downloadFileResponData = gatewayTemp.downloadFileResponData };
                            d = new DownloadFileResponAllData { downloadFileResponData = downloadFileResponData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
                    }
@@ -2928,35 +2201,19 @@
            });
        }
        /// <summary>
        /// 网关系统升级,网关反馈具体信息
        /// </summary>
        public DownloadFileResponAllData downloadFileResponAllData;
        /// <summary>
        /// 网关系统升级,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class DownloadFileResponAllData
        public class DownloadFileResponAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 下载云端固件
            /// </summary>
            public DownloadFileResponData downloadFileResponData;
        }
        /// <summary>
        /// 下载云端固件
        /// </summary>
        public DownloadFileResponData downloadFileResponData;
        /// <summary>
        /// 下载云端固件
        /// </summary>
@@ -2980,6 +2237,7 @@
        /// <summary>
        /// 下载进度
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public DownloadFileProgressResponData downloadFileProgressResponData;
        /// <summary>
        /// 下载进度
@@ -3032,8 +2290,7 @@
                    if (topic == gatewayID + "/" + "Error_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID };
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString());
                        var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
                        if (temp == null)
                        {
@@ -3048,16 +2305,15 @@
                    if (topic == gatewayID + "/" + "OTA/KillUpdate_Respon")
                    {
                        var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
                        gatewayTemp.killUpdateData = Newtonsoft.Json.JsonConvert.DeserializeObject<KillUpdateData>(jobject["Data"].ToString());
                        var killUpdateData = Newtonsoft.Json.JsonConvert.DeserializeObject<KillUpdateData>(jobject["Data"].ToString());
                        if (gatewayTemp.killUpdateData == null)
                        if (killUpdateData == null)
                        {
                            d = new KillUpdateResponseAllData { errorMessageBase = "网关返回的数据为空" };
                        }
                        else
                        {
                            d = new KillUpdateResponseAllData { killUpdateData = gatewayTemp.killUpdateData };
                            d = new KillUpdateResponseAllData { killUpdateData = killUpdateData };
                            System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
                        }
                    }
@@ -3095,31 +2351,15 @@
        /// <summary>
        /// 终止设备升级,网关反馈具体信息
        /// </summary>
        public KillUpdateResponseAllData killUpdateResponseAllData;
        /// <summary>
        /// 终止设备升级,网关反馈具体信息
        /// </summary>
        [System.Serializable]
        public class KillUpdateResponseAllData
        public class KillUpdateResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 终止设备升级
            /// </summary>
            public KillUpdateData killUpdateData;
        }
        /// <summary>
        /// 终止设备升级
        /// </summary>
        public KillUpdateData killUpdateData;
        [System.Serializable]
        public class KillUpdateData
        {
@@ -3132,22 +2372,10 @@
        #endregion
        #region 私有协议网关和设备的默认回复
        /// <summary>
        /// 私有协议网关和设备的默认回复
        /// </summary>
        public ResponseAllData keyColorDataResponseAllData;
        [System.Serializable]
        public class ResponseAllData
        public class ResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 错误信息
            /// </summary>
            public string errorMessageBase;
            /// <summary>
            /// 网关信息错误反馈
            /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
            /// </summary>
            public ErrorResponData errorResponData;
            /// <summary>
            /// 按键指示灯颜色信息
            /// </summary>
@@ -3171,5 +2399,27 @@
            public int status = -1;
        }
        #endregion
        #region ■ 调试打印
        /// <summary>
        /// 调试时打开打印信息,true:打印,false:不打印
        /// </summary>
        /// <param name="msg">Message.</param>
        /// <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 + "  " + System.DateTime.Now.ToLongTimeString() + " " + System.DateTime.Now.Millisecond);
                }
            }
#endif
        }
        #endregion
    }
}