xm
2020-07-21 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d
ZigbeeApp/Shared/Common/Device.cs
old mode 100644 new mode 100755
@@ -115,7 +115,7 @@
            {
                CommonDevice device = null;
                //反序列化为指定的类,不然数据会丢失而导致无法强转
                try
                try
                {
                    device = CommonDevice.CommonDeviceByFilePath(file);
                }
@@ -123,12 +123,6 @@
                if (device == null || device.CurrentGateWayId == null)
                {
#if DEBUG
                    //调查,为什么它会把全部设备删掉?
                    string file1 = UserCenterLogic.CombinePath(file);
                    string file2 = UserCenterLogic.CombinePath("Back_" + file);
                    System.IO.File.Copy(file1, file2, true);
#endif
                    //失效的文件,没有网关id的都删除掉
                    Global.DeleteFilebyHomeId(file);
                    continue;
@@ -143,12 +137,6 @@
                    }
                    else
                    {
#if DEBUG
                        //调查,为什么它会把全部设备删掉?
                        string file1 = UserCenterLogic.CombinePath(file);
                        string file2 = UserCenterLogic.CombinePath("Back_" + file);
                        System.IO.File.Copy(file1, file2, true);
#endif
                        //如果是主人,或者管理员,那么这个文件是非法的,直接删除
                        Global.DeleteFilebyHomeId(file);
                        continue;
@@ -211,7 +199,7 @@
            var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway();
            foreach (var gateway in listGateway)
            {
                string gwId = HdlGatewayLogic.Current.GetGatewayId(gateway);
                string gwId = gateway.GwId;
                if (listId.Contains(gwId) == false)
                {
                    //这个网关对于当前这个成员来说是非法的
@@ -242,7 +230,7 @@
            listDevice.AddRange(list);
            //获取这个网关的本地所有设备
            string gwID = HdlGatewayLogic.Current.GetGatewayId(zbGateway);
            string gwID = zbGateway.GwId;
            List<CommonDevice> listLocalDevices = this.GetDeviceByGatewayID(gwID);
            //获取ota设备
            foreach (var ota in this.dicOTADevice.Values)
@@ -261,6 +249,7 @@
            }
            //添加设备的缓存
            var listDriveDevice = new List<CommonDevice>();
            for (int i = 0; i < listDevice.Count; i++)
            {
                var device = listDevice[i];
@@ -279,24 +268,27 @@
                }
                //获取设备的固定属性
                HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device);
            }
            for (int i = 0; i < listDevice.Count; i++)
            {
                var device = listDevice[i];
                //对未命名的虚拟设备重新命名
                if (device.DriveCode > 0 && this.GetSimpleEpointName(device) == string.Empty)
                {
                    //根据设备类型获取名称
                    var dName = this.GetDeviceObjectText(new List<CommonDevice>() { device }, false);
                    //在端点名字的后面附加【回路】字样
                    dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
                    HdlThreadLogic.Current.RunThread(async () =>
                    {
                        await this.ReName(device, dName, ShowErrorMode.NO);
                    });
                    listDriveDevice.Add(device);
                }
            }
            if (listDriveDevice.Count > 0)
            {
                //如果虚拟设备还没有名字的话
                HdlThreadLogic.Current.RunThread(() =>
                {
                    //如果不这样放在一个线程里,有可能对Dictionary产生影响
                    foreach (var myDevice in listDriveDevice)
                    {
                        //根据设备类型获取名称
                        var dName = this.GetDeviceObjectText(new List<CommonDevice>() { myDevice }, false);
                        //在端点名字的后面附加【回路】字样
                        dName += "(" + myDevice.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
                        this.ReName(myDevice, dName, ShowErrorMode.NO);
                    }
                });
            }
            //只有完全获取的时候,才会去处理删除的问题
@@ -431,7 +423,7 @@
        /// <param name="device">设备对象</param>
        /// <param name="newName">新名字</param>
        /// <param name="mode">是否显示错误</param>
        public async Task<bool> ReName(CommonDevice device, string newName, ShowErrorMode mode = ShowErrorMode.YES)
        public bool ReName(CommonDevice device, string newName, ShowErrorMode mode = ShowErrorMode.YES)
        {
            //先别管那么多,更改名字后,刷新设备缓存
            this.SetEpointName(device, newName);
@@ -441,6 +433,8 @@
            //如果住宅为虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                //修改设备名字的话,主页需要重新刷新
                Phone.UserView.UserPage.Instance.RefreshAllForm = true;
                return true;
            }
@@ -448,7 +442,7 @@
            //成员只能修改自己本地的名字
            if (UserCenterResourse.UserInfo.AuthorityNo != 3)
            {
                var result = await device.RenameDeviceNameAsync(device.DeviceAddr, device.DeviceEpoint, newName);
                var result = this.RenameDeviceNameAsync(device, newName);
                if (result == null || result.deviceRenameData == null || result.deviceRenameData.Result == 1)
                {
                    //设备名称修改失败
@@ -462,9 +456,9 @@
                    }
                    return false;
                }
                //备份数据
                await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A端点名称, newName);
            }
            //修改设备名字的话,主页需要重新刷新
            Phone.UserView.UserPage.Instance.RefreshAllForm = true;
            return true;
        }
@@ -474,7 +468,7 @@
        /// <param name="listDevice">设备对象</param>
        /// <param name="newMacName">新名字</param>
        /// <param name="mode">是否显示错误</param>
        public async Task<bool> ReMacName(List<CommonDevice> listDevice, string newMacName, ShowErrorMode mode = ShowErrorMode.YES)
        public bool ReMacName(List<CommonDevice> listDevice, string newMacName, ShowErrorMode mode = ShowErrorMode.YES)
        {
            if (listDevice.Count == 0)
            {
@@ -502,7 +496,7 @@
            if (UserCenterResourse.UserInfo.AuthorityNo != 3)
            {
                //修改物理名字
                var result = await device.RenameDeviceMacNameAsync(device.DeviceAddr, device.DeviceEpoint, newMacName);
                var result = this.RenameDeviceMacNameAsync(device, newMacName);
                if (result == null || result.renameDeviceMacNameData == null || result.renameDeviceMacNameData.Result != 0)
                {
                    //设备名称修改失败
@@ -515,15 +509,13 @@
                    }
                    return false;
                }
                //备份数据
                await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.AMac名称, newMacName);
                //如果它只有一个回路,则更改端点名字
                if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true)
                {
                    //只有一个端点
                    if (this.dicDeviceEpoint[device.DeviceAddr].Count == 1)
                    {
                        return await this.ReName(device, newMacName);
                        return this.ReName(device, newMacName);
                    }
                    //如果它有两个端点时,pir传感器特殊处理
                    else if (this.dicDeviceEpoint[device.DeviceAddr].Count == 2)
@@ -535,7 +527,7 @@
                            {
                                if (myDevice.Type == DeviceType.IASZone)
                                {
                                    return await this.ReName(myDevice, newMacName);
                                    return this.ReName(myDevice, newMacName);
                                }
                            }
                        }
@@ -543,6 +535,100 @@
                }
            }
            return true;
        }
        ///<summary >
        /// 修改设备mac名称
        /// <para>macName:设备名称</para>
        /// </summary>
        private CommonDevice.RenameDeviceMacNameAllData RenameDeviceMacNameAsync(CommonDevice device, string macName)
        {
            //如果当前是虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                return Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceMacName(device, macName, "MacRename");
            }
            //获取编辑设备Mac名字的命令字符
            var sendData = this.GetReDeviceMacNameCommandText(device.DeviceAddr, device.DeviceEpoint, macName);
            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "MacRename", sendData, "MacRename_Respon", 8);
            if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
            {
                return null;
            }
            //加缓存
            Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceMacName(device, macName, "MacRename");
            var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.RenameDeviceMacNameData>(result.ReceiptData);
            return new CommonDevice.RenameDeviceMacNameAllData { renameDeviceMacNameData = tempData };
        }
        /// <summary>
        /// 修改设备端口(按键)名称
        /// </summary>
        /// <param name="device">设备对象</param>
        /// <param name="deviceName">设备端点名字</param>
        /// <returns></returns>
        private CommonDevice.DeviceRenameAllData RenameDeviceNameAsync(CommonDevice device, string deviceName)
        {
            //如果当前是虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                return Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceEpointName(device, deviceName, "DeviceRename");
            }
            //获取编辑设备端点名字的命令字符
            var sendData = this.GetReDeviceEpointNameCommandText(device.DeviceAddr, device.DeviceEpoint, deviceName);
            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "DeviceRename", sendData, "DeviceRenameRespon", 8);
            if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
            {
                return null;
            }
            //加缓存
            Phone.ModelData.DeviceModelDataLogic.Current.ReDeviceEpointName(device, deviceName, "DeviceRename");
            var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceRenameResponseData>(result.ReceiptData);
            return new CommonDevice.DeviceRenameAllData { deviceRenameData = tempData };
        }
        /// <summary>
        /// 获取编辑设备Mac名字的命令字符
        /// </summary>
        /// <param name="deviceAddr"></param>
        /// <param name="deviceEpoint"></param>
        /// <param name="deviceName"></param>
        /// <returns></returns>
        public string GetReDeviceMacNameCommandText(string deviceAddr, int deviceEpoint, string deviceName)
        {
            var bytes = new byte[64];
            var reamarkGwBytes = Encoding.UTF8.GetBytes(deviceName);
            System.Array.Copy(reamarkGwBytes, 0, bytes, 0, 64 < reamarkGwBytes.Length ? 64 : reamarkGwBytes.Length);
            deviceName = Encoding.UTF8.GetString(bytes);
            var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 0 }, { "Command", 100 } };
            var data = new Newtonsoft.Json.Linq.JObject { { "MacName", deviceName } };
            jObject.Add("Data", data);
            return jObject.ToString();
        }
        /// <summary>
        /// 获取编辑设备端点名字的命令字符
        /// </summary>
        /// <param name="deviceAddr"></param>
        /// <param name="deviceEpoint"></param>
        /// <param name="deviceName"></param>
        /// <returns></returns>
        public string GetReDeviceEpointNameCommandText(string deviceAddr, int deviceEpoint, string deviceName)
        {
            var bytes = new byte[64];
            var reamarkGwBytes = Encoding.UTF8.GetBytes(deviceName);
            System.Array.Copy(reamarkGwBytes, 0, bytes, 0, 64 < reamarkGwBytes.Length ? 64 : reamarkGwBytes.Length);
            deviceName = Encoding.UTF8.GetString(bytes);
            var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", deviceAddr }, { "Epoint", deviceEpoint }, { "Cluster_ID", 0 }, { "Command", 96 } };
            var data = new Newtonsoft.Json.Linq.JObject { { "DeviceName", deviceName } };
            jObject.Add("Data", data);
            return jObject.ToString();
        }
        /// <summary>
@@ -586,22 +672,26 @@
        /// <param name="listdevice">设备对象(MAC地址必须要相同)</param>
        public async Task<bool> DeleteDevice(List<CommonDevice> listdevice)
        {
            var data = new CommonDevice.RemoveDeviceData();
            var info = new CommonDevice.RemoveDeviceListInfo();
            info.DeviceAddr = listdevice[0].DeviceAddr;
            data.DeviceAddrList.Add(info);
            //删一次的时候,它会把MAC地址下面全部的设备都删除
            var result = await listdevice[0].DeleteDeviceAsync(data);
            if (result == null || result.removeDeviceResponseData == null || result.removeDeviceResponseData.Result != 0)
            //虚拟住宅的话,不需要删除网关的设备
            if (Config.Instance.Home.IsVirtually == false)
            {
                //设备删除失败
                string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail);
                //拼接上【网关回复超时】的Msg
                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
                var data = new CommonDevice.RemoveDeviceData();
                var info = new CommonDevice.RemoveDeviceListInfo();
                info.DeviceAddr = listdevice[0].DeviceAddr;
                data.DeviceAddrList.Add(info);
                this.ShowErrorMsg(msg);
                return false;
                //删一次的时候,它会把MAC地址下面全部的设备都删除
                var result = await listdevice[0].DeleteDeviceAsync(data);
                if (result == null || result.removeDeviceResponseData == null || result.removeDeviceResponseData.Result != 0)
                {
                    //设备删除失败
                    string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail);
                    //拼接上【网关回复超时】的Msg
                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
                    this.ShowErrorMsg(msg);
                    return false;
                }
            }
            //删除缓存的Ota设备
@@ -628,6 +718,9 @@
        /// <param name="deleteRoom">是否从房间删除</param>
        public void DeleteMemmoryDevice(CommonDevice device, bool deleteRoom = true)
        {
            //删除缓存设备的话,主页需要重新刷新
            Phone.UserView.UserPage.Instance.RefreshAllForm = true;
            if (deleteRoom == true)
            {
                //从房间中删除
@@ -703,6 +796,35 @@
        #endregion
        #region ■ 同步设备___________________________
        /// <summary>
        ///  同步设备并且刷新缓存(同步失败时,会显示信息)
        /// </summary>
        /// <param name="litdevice">设备对象(MAC地址必须要相同)</param>
        public async Task<bool> SynchronizationDevice(List<CommonDevice> listdevice)
        {
            //虚拟住宅的话,不需要删除网关的设备
            if (Config.Instance.Home.IsVirtually == false)
            {
                //同步
                var result = await listdevice[0].SyncMsgToBindSource(listdevice[0].DeviceAddr, listdevice[0].DeviceEpoint);
                if (result == null || result.result != 0)
                {
                    //同步删除失败
                    string msg = Language.StringByID(R.MyInternationalizationString.SynchronizationFailed);
                    //拼接上【网关回复超时】的Msg
                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
                    this.ShowErrorMsg(msg);
                    return false;
                }
            }
            return true;
        }
        #endregion
        #region ■ 测试设备___________________________
        /// <summary>
@@ -725,7 +847,7 @@
        /// <returns></returns>
        public bool DeviceIsCanFixedPosition(CommonDevice device)
        {
            if (device.Type == DeviceType.DoorLock)
            if (device.Type == DeviceType.DoorLock || device.Type == DeviceType.PMSensor)
            {
                //门锁没有定位功能
                return false;
@@ -738,6 +860,11 @@
                    //传感器除了Pir都没有定位功能
                    return true;
                }
                else if (myTypeInfo.ConcreteType == DeviceConcreteType.Sensor_SphericalMotion)
                {
                    //球型移动传感器虽然是电池设备,但是它有定位功能
                    return true;
                }
                return false;
            }
@@ -748,6 +875,22 @@
                {
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        /// 检测设备是否拥有一键同步功能
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        public bool DeviceIsCanSynchronization(CommonDevice device)
        {
            //获取设备类型的
            var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
            if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
            {
                return true;
            }
            return false;
        }
@@ -882,6 +1025,89 @@
        }
        /// <summary>
        /// 根据MAC地址,获取简约面板全部回路的设备对象
        /// </summary>
        /// <param name="listDevice"></param>
        /// <returns></returns>
        public List<CommonDevice> GetMutilfunctionPanelByMac(List<CommonDevice> listDevice, bool sort = true)
        {
            //和彪哥、设备和产品部同事确认:
            //简约多功能面板[不显示多余的回路,只显示携带的2个继电器,1个温度传感器,1个湿度传感器
            var list = new List<CommonDevice>();
            foreach (var dev in listDevice)
            {
                if (dev.Type == DeviceType.TemperatureSensor)
                {
                    if (dev.DeviceEpoint == 64)
                    {
                        list.Add(dev);
                    }
                }
                else if (dev.Type == DeviceType.FreshAirHumiditySensor)
                {
                    if (dev.DeviceEpoint == 65)
                    {
                        list.Add(dev);
                    }
                }
                else if (dev.Type == DeviceType.OnOffOutput)
                {
                    list.Add(dev);
                }
            }
            if (sort == false)
            {
                return list;
            }
            list.Sort((obj1, obj2) =>
            {
                if (obj1.DeviceEpoint > obj2.DeviceEpoint)
                {
                    return 1;
                }
                return -1;
            });
            return list;
        }
        /// <summary>
        /// 根据MAC地址,获取新风、简约环境面板全部回路的设备对象
        /// </summary>
        /// <param name="listDevice"></param>
        /// <returns></returns>
        public List<CommonDevice> GetPanelMatchEpointByMac(List<CommonDevice> listDevice, bool sort = true)
        {
            var list = new List<CommonDevice>();
            foreach (var dev in listDevice)
            {
                if (dev.Type == DeviceType.TemperatureSensor)
                {
                    list.Add(dev);
                }
                else if (dev.Type == DeviceType.FreshAirHumiditySensor)
                {
                    list.Add(dev);
                }
            }
            if (sort == false)
            {
                return list;
            }
            list.Sort((obj1, obj2) =>
            {
                if (obj1.DeviceEpoint > obj2.DeviceEpoint)
                {
                    return 1;
                }
                return -1;
            });
            return list;
        }
        /// <summary>
        /// 根据MAC地址,获取全部回路的设备对象(强制排序)
        /// </summary>
        /// <param name="DeviceAddr">Mac地址</param>
@@ -935,7 +1161,7 @@
        public List<string> GetAllDeviceFile()
        {
            List<string> listDeviceFile = new List<string>();
            List<string> listAllFile = Global.FileListByHomeId();
            List<string> listAllFile = HdlFileLogic.Current.GetRootPathListFile();
            foreach (string file in listAllFile)
            {
@@ -996,6 +1222,56 @@
        #endregion
        #region ■ 获取设备信息_______________________
        /// <summary>
        /// 读取单个端点回路设备信息
        /// </summary>
        /// <param name="device">设备对象</param>
        /// <returns></returns>
        public CommonDevice.DeviceInfoData ReadDeviceEpointDeviceInfo(CommonDevice device)
        {
            var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 80 } };
            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "GetStatusRecord", jObject.ToString(), "GetStatusRecord_Respon");
            if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
            {
                return null;
            }
            var info = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceInfoData>(result.ReceiptData);
            return info;
        }
        #endregion
        #region ■ 设置设备功能类型___________________
        /// <summary>
        /// 设置设备功能类型到网关
        /// </summary>
        /// <param name="device">设备回路</param>
        /// <param name="functionType">功能类型</param>
        /// <returns></returns>
        public bool SendDeviceFunctionTypeToGateway(CommonDevice device, DeviceFunctionType functionType)
        {
            var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", 0 }, { "Command", 110 } };
            var data = new Newtonsoft.Json.Linq.JObject { { "FunctionType", (int)functionType } };
            jObject.Add("Data", data);
            var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "Device/SetEPDeviceFunctionType", jObject.ToString(), "Device/SetEPDeviceFunctionTypeRespon");
            if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
            {
                return false;
            }
            var resultData = Newtonsoft.Json.Linq.JObject.Parse(result.ReceiptData);
            if (resultData.Property("Result") != null)
            {
                //0:修改成功 1:修改失败
                return resultData["Result"].ToString() == "0";
            }
            return false;
        }
        #endregion
        #region ■ 获取设备名称_______________________
        /// <summary>
@@ -1010,6 +1286,12 @@
            {
                return dName;
            }
            if (this.IsMiniLight(device) == true)
            {
                //Mini夜灯
                return Language.StringByID(R.MyInternationalizationString.uMiniNightLight);
            }
            //如果这个设备只有一个回路的话,返回Mac名字给它
            if (this.GetDevicesCountByMac(device.DeviceAddr) <= 1)
            {
@@ -1034,7 +1316,9 @@
            }
            if (device.Type == DeviceType.OnOffOutput
                || device.Type == DeviceType.DimmableLight || device.Type == DeviceType.ColorDimmableLight)
                || device.Type == DeviceType.DimmableLight
                || device.Type == DeviceType.ColorDimmableLight
                || device.Type == DeviceType.ColorTemperatureLight)
            {
                //继电器,掉光器都叫回路
                return Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + epointNo;
@@ -1043,17 +1327,7 @@
            {
                //空调都叫室内机
                return Language.StringByID(R.MyInternationalizationString.uIndoorUnit) + epointNo;
            }
            else if (device.Type == DeviceType.FreshAir)
            {
                //新风面板中的按键叫新风
                return Language.StringByID(R.MyInternationalizationString.FreshAir);
            }
            else if (device.Type == DeviceType.FreshAirHumiditySensor)
            {
                //新风面板湿度传感器
                return Language.StringByID(R.MyInternationalizationString.HumiditySensor);
            }
            }
            //获取设备类型
            var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
@@ -1070,12 +1344,19 @@
                    return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + epointNo;
                }
            }
            else if (device.Type == DeviceType.FreshAirHumiditySensor)
            {
                //新风面板/简约多功能/简约环境面板湿度传感器
                return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
            }
            else if (device.Type == DeviceType.TemperatureSensor)
            {
                if (deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
                if (deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
                    || deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment
                    || deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
                {
                    //新风面板中的Thermostat为温度传感器
                    return Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                    //新风面板/简约多功能/简约环境面板 温度传感器
                    return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                }
                else if (deviceInfoType.BeloneType == DeviceBeloneType.A按键面板)
                {
@@ -1098,6 +1379,11 @@
            if (string.IsNullOrEmpty(dName) == false)
            {
                return dName;
            }
            if (this.IsMiniLight(device) == true)
            {
                //Mini夜灯
                return Language.StringByID(R.MyInternationalizationString.uMiniNightLight);
            }
            //获取设备类型
@@ -1324,7 +1610,7 @@
        }
        /// <summary>
        /// 设置【设备类型】的图标到指定的控件
        /// 设置【设备类型】的图标到指定的控件(此方法不能用在设备功能类型菜单的图标)
        /// </summary>
        /// <param name="btnIcon">控件对象</param>
        /// <param name="listdevice">设备对象</param>
@@ -1346,7 +1632,7 @@
        }
        /// <summary>
        /// 获取【设备类型】的图标
        /// 获取【设备类型】的图标(此方法不能用在设备功能类型菜单的图标)
        /// </summary>
        /// <param name="listdevice">设备对象</param>
        /// <param name="unSelectPath">图片地址</param>
@@ -1362,13 +1648,42 @@
        }
        /// <summary>
        /// 获取【设备类型】的图标
        /// 获取【设备功能类型】的菜单图标
        /// </summary>
        /// <param name="specificType">自定义设备类型</param>
        /// <param name="unSelectPath">图片地址</param>
        /// <param name="selectPath">图片地址</param>
        /// <returns></returns>
        public void GetDeviceObjectIcon(DeviceConcreteType specificType, ref string unSelectPath, ref string selectPath)
        public void GetDeviceFunctionTypeMenuIcon(DeviceConcreteType specificType, ref string unSelectPath, ref string selectPath)
        {
            //新风小模块
            if (specificType == DeviceConcreteType.Relay_FangyueFreshAirModul)
            {
                unSelectPath = "Device/FreshAirEpoint.png";
                selectPath = "Device/FreshAirEpointSelected.png";
                return;
            }
            //PM2.5空气质量传感器
            else if (specificType == DeviceConcreteType.Sensor_PMTwoPointFive)
            {
                unSelectPath = "Device/AirQualitySensorEpoint.png";
                selectPath = "Device/AirQualitySensorEpointSelected.png";
                return;
            }
            //上面需要特殊处理
            //获取【设备类型】的图标
            this.GetDeviceObjectIcon(specificType, ref unSelectPath, ref selectPath);
        }
        /// <summary>
        /// 获取【设备类型】的图标 2020.05.13:次函数不再公开
        /// </summary>
        /// <param name="specificType">自定义设备类型</param>
        /// <param name="unSelectPath">图片地址</param>
        /// <param name="selectPath">图片地址</param>
        /// <returns></returns>
        private void GetDeviceObjectIcon(DeviceConcreteType specificType, ref string unSelectPath, ref string selectPath)
        {
            //将具体类型转字符串
            string strSpecific = Enum.GetName(typeof(DeviceConcreteType), specificType);
@@ -1811,6 +2126,22 @@
                info.ConcreteType = DeviceConcreteType.Relay_FangyueFreshAirModul;
                info.ObjectTypeNameId = 60011;//新风
            }
            //15 PM2.5传感器设备
            else if (dicType.ContainsKey(DeviceType.PMSensor) == true)
            {
                info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1307;
                info.BeloneType = DeviceBeloneType.APM2点5空气质量传感器;
                info.ConcreteType = DeviceConcreteType.Sensor_PMTwoPointFive;
                info.ObjectTypeNameId = 60000;//传感器
            }
            //16色温灯
            else if (dicType.ContainsKey(DeviceType.ColorTemperatureLight) == true)
            {
                info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId20000;
                info.BeloneType = DeviceBeloneType.A彩灯;
                info.ConcreteType = DeviceConcreteType.ColorLight_Temperature;
                info.ObjectTypeNameId = 60007;//调光模块
            }
            int value = (int)info.BeloneType;
            if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
@@ -1881,6 +2212,12 @@
                info.ConcreteType = DeviceConcreteType.Sensor_DoorWindow;
                info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1301;
            }
            else if (iasZone.IasDeviceType == 541)
            {
                //球型移动传感器
                info.ConcreteType = DeviceConcreteType.Sensor_SphericalMotion;
                info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1205;
            }
        }
        #endregion
@@ -1893,12 +2230,21 @@
        private void InitRealDeviceRoomId()
        {
            this.dicDeviceRoomId = new Dictionary<string, string>();
            string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
            var strData = UserCenterLogic.LoadFileContent(fullName);
            string fullName = DirNameResourse.DeviceRoomIdFile;
            var strData = HdlFileLogic.Current.ReadFileTextContent(fullName);
            if (strData != null)
            {
                this.dicDeviceRoomId = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(strData);
            }
        }
        /// <summary>
        /// 获取全部物理设备所属房间的记录
        /// </summary>
        /// <returns></returns>
        public Dictionary<string, string> GetAllRealDeviceRoomData()
        {
            return this.dicDeviceRoomId;
        }
        /// <summary>
@@ -1909,26 +2255,10 @@
        /// <param name="saveRoadDevice">如果只有一个回路,是否把回路的房间一起修改</param>
        public void SaveRealDeviceRoomId(List<CommonDevice> listDevice, string roomId, bool saveRoadDevice = true)
        {
            if (listDevice != null)
            if (listDevice == null)
            {
                if (roomId == string.Empty)
                {
                    //选择的是未分配
                    this.dicDeviceRoomId.Remove(listDevice[0].DeviceAddr);
                }
                else
                {
                    this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
                }
                return;
            }
            //保存记录
            string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
            UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId);
            //添加自动备份
            HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile);
            //如果设备只有一个回路,如果改变了真实设备区域,则它的回路的区域也一起改了
            if (saveRoadDevice == true && listDevice != null && listDevice.Count == 1)
            {
@@ -1938,6 +2268,40 @@
                    return;
                }
                HdlRoomLogic.Current.ChangedRoom(listDevice[0], roomId, false);
            }
            bool save = false;
            if (roomId == string.Empty)
            {
                //选择的是未分配
                this.dicDeviceRoomId.Remove(listDevice[0].DeviceAddr);
                save = true;
            }
            else
            {
                if (this.dicDeviceRoomId.ContainsKey(listDevice[0].DeviceAddr) == false)
                {
                    this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
                    save = true;
                }
                else
                {
                    //2020.05.18追加:如果记录的房间ID是不存在的话,则重新覆盖
                    var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[listDevice[0].DeviceAddr]);
                    if (room == null || this.dicDeviceRoomId[listDevice[0].DeviceAddr] != roomId)
                    {
                        this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
                        save = true;
                    }
                }
            }
            if (save == true)
            {
                //保存记录
                HdlFileLogic.Current.SaveFileContent(DirNameResourse.DeviceRoomIdFile, this.dicDeviceRoomId);
                //添加自动备份
                HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile);
            }
        }
@@ -1954,7 +2318,7 @@
                return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
            }
            var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
            return HdlRoomLogic.Current.GetFloorRoomName(room);
            return HdlRoomLogic.Current.GetRoomName(room);
        }
        /// <summary>
@@ -1987,16 +2351,44 @@
        /// <param name="listMac">设备Mac地址</param>
        public void DeleteRealDeviceFromRoom(List<string> listMac)
        {
            bool save = false;
            foreach (var deviceMacAddr in listMac)
            {
                this.dicDeviceRoomId.Remove(deviceMacAddr);
                if (this.dicDeviceRoomId.ContainsKey(deviceMacAddr) == true)
                {
                    this.dicDeviceRoomId.Remove(deviceMacAddr);
                    save = true;
                }
            }
            if (save == false)
            {
                //没有改变,不需要保存
                return;
            }
            //保存记录
            string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
            UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId);
            HdlFileLogic.Current.SaveFileContent(DirNameResourse.DeviceRoomIdFile, this.dicDeviceRoomId);
            //添加自动备份
            HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile);
        }
        /// <summary>
        /// 根据房间ID,移除指定的真实物理设备的所属房间记录
        /// </summary>
        /// <param name="i_RoomId"></param>
        public void DeleteRealDeviceByRoomId(string i_RoomId)
        {
            var listDeleteKey = new List<string>();
            foreach (var deviceAddr in this.dicDeviceRoomId.Keys)
            {
                if (this.dicDeviceRoomId[deviceAddr] == i_RoomId
                    && listDeleteKey.Contains(deviceAddr) == false)
                {
                    listDeleteKey.Add(deviceAddr);
                }
            }
            //将真实物理设备从房间中移除
            this.DeleteRealDeviceFromRoom(listDeleteKey);
        }
        #endregion
@@ -2069,14 +2461,35 @@
            list.Add(DeviceBeloneType.A传感器);
            //其他的看着办呗,都是排在后面的,都归为这个属性
            list.Add(DeviceBeloneType.A未知设备);
            list.Add(DeviceBeloneType.A未知设备);
            return list;
        }
        #endregion
        #region ■ 一般方法___________________________
        /// <summary>
        /// 从缓存变量检测设备是否在线
        /// </summary>
        /// <param name="i_device"></param>
        /// <returns></returns>
        public bool CheckDeviceIsOnline(CommonDevice i_device)
        {
            var listDevice = this.GetDevicesByMac(i_device.DeviceAddr, false);
            foreach (var device in listDevice)
            {
                //0:离线 1:在线 2:正在刷新状态
                bool statu = i_device.IsOnline == 1 || i_device.IsOnline == 2;
                if (statu == true)
                {
                    //有一个回路在线,即在线
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        /// 判断该设备是否可以显示在主页
@@ -2093,16 +2506,8 @@
            if (i_device.Type == DeviceType.OnOffOutput || i_device.Type == DeviceType.AirSwitch)
            {
                //2020.03.23追加式样:未指定类型的继电器,不显示
                if (i_device.DfunctionType == DeviceFunctionType.A未定义)
                {
                    return false;
                }
            }
            //如果是新风面板的新风设备,则不显示
            else if (i_device.Type == DeviceType.FreshAir)
            {
                var myInfoType = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
                if (myInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
                if (i_device.DfunctionType == DeviceFunctionType.A未定义
                    || i_device.DfunctionType == DeviceFunctionType.A不指定)
                {
                    return false;
                }
@@ -2112,6 +2517,25 @@
            {
                var myInfoType = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
                if (myInfoType.BeloneType == DeviceBeloneType.A按键面板)
                {
                    return false;
                }
            }
            else if (i_device.Type == DeviceType.FreshAirHumiditySensor)
            {
                //新风的湿度传感器不显示
                return false;
            }
            //如果是新风面板或环境面板,则都不显示任何回路
            var myInfoTypeTemp = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { i_device });
            if (myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir || myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
            {
                return false;
            }
            else if (myInfoTypeTemp.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
            {
                if (i_device.Type != DeviceType.OnOffOutput)
                {
                    return false;
                }
@@ -2127,6 +2551,16 @@
        public bool IsHdlDevice(CommonDevice device)
        {
            return device.ManufacturerName == "HDL";
        }
        /// <summary>
        /// 是否是Mini夜灯
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        public bool IsMiniLight(CommonDevice device)
        {
            return device.DriveCode != 0 && device.Type == DeviceType.ColorTemperatureLight;
        }
        /// <summary>
@@ -2173,16 +2607,22 @@
        /// <returns></returns>
        public string AppendVersion(int versionValue)
        {
            //10101 3个byte  显示为:ver.1.01.01
            //中间那个byte为奇数时,代表是测试版本,在显示最新版本时,不需要显示,但是在历史版本那里可以显示
            //中间那个byte为偶数时, 代表是正式版本
            //直接是10进制
            string txt10 = Convert.ToString(versionValue).PadLeft(4, '0');
            //这个是小数点前面的值
            int value1 = Convert.ToInt32(txt10.Substring(0, txt10.Length - 2));
            //这个是小数点后面的值
            int value2 = Convert.ToInt32(txt10.Substring(txt10.Length - 2, 2));
            string txt10 = Convert.ToString(versionValue).PadLeft(6, '0');
            //这个是第一位
            int value1 = Convert.ToInt32(txt10.Substring(0, 2));
            //这个是第二位
            string value2 = txt10.Substring(2, 2);
            //这个是第三位
            string value3 = txt10.Substring(4, 2);
            //Ver.
            string ver = Language.StringByID(R.MyInternationalizationString.uVersionAbbreviation);
            return ver + value1 + "." + value2.ToString().PadLeft(2, '0');
            return ver + value1 + "." + value2 + "." + value3;
        }
        /// <summary>
@@ -2234,7 +2674,7 @@
                {
                    //不无视时间,返回本地设备列表
                    statu = 1;
                    return this.GetDeviceByGatewayID(HdlGatewayLogic.Current.GetGatewayId(zbGateway));
                    return this.GetDeviceByGatewayID(zbGateway.GwId);
                }
            }
            zbGateway.LastDateTime = DateTime.Now;
@@ -2258,7 +2698,7 @@
            //是否达成中断的时机
            bool canBreak = false;
            //网关ID
            string gatewayID = HdlGatewayLogic.Current.GetGatewayId(zbGateway);
            string gatewayID = zbGateway.GwId;
            //超时时间
            int TimeOut = 0;
            //设备总数
@@ -2305,8 +2745,14 @@
                                if (listCheck.Contains(mainkeys) == false)
                                {
                                    listDevice.Add(device);
                                    listCheck.Add(mainkeys);
                                    //刷新一下本地缓存
                                    var localDevice = this.GetDevice(mainkeys);
                                    if (localDevice != null)
                                    {
                                        //刷新属性
                                        this.SetDeviceInfoToMain(localDevice, device);
                                    }
                                }
                            }
                        }
@@ -2389,7 +2835,7 @@
        /// <returns></returns>
        private CommonDevice NewDeviceObjectByDeviceId(DeviceType deviceType, Newtonsoft.Json.Linq.JObject jobject, ZbGateway zbGateway)
        {
            string gwId = HdlGatewayLogic.Current.GetGatewayId(zbGateway);
            string gwId = zbGateway.GwId;
            //根据设备类型创建设备对象的实例
            CommonDevice device = this.NewDeviceObjectByDeviceId(deviceType);
@@ -2433,6 +2879,7 @@
                mainDevice.DeviceEpointName = device.DeviceInfo.DeviceName;
            }
            mainDevice.CurrentGateWayId = device.CurrentGateWayId;
            mainDevice.ZigbeeType = device.DeviceInfo.ZigbeeType;
            mainDevice.IsOnline = device.DeviceInfo.IsOnline;
            mainDevice.DriveCode = device.DeviceInfo.DriveCode;
            mainDevice.IasDeviceType = device.DeviceInfo.DeviceType;
@@ -2451,13 +2898,13 @@
            mainDevice.ModelIdentifier = device.DeviceInfo.ModelIdentifier;
            //序列号
            mainDevice.SerialNumber = device.DeviceInfo.ProductCode;
            //设备功能类型
            mainDevice.DfunctionType = (DeviceFunctionType)device.DeviceInfo.FunctionType;
            mainDevice.InClusterList.Clear();
            mainDevice.InClusterList.AddRange(device.DeviceInfo.InClusterList);
            mainDevice.OutClusterList.Clear();
            mainDevice.OutClusterList.AddRange(device.DeviceInfo.OutClusterList);
            mainDevice.AttributeStatus.Clear();
            mainDevice.AttributeStatus.AddRange(device.DeviceInfo.AttributeStatus);
            //如果是温度传感器
            if (mainDevice.Type == DeviceType.TemperatureSensor)
@@ -2479,26 +2926,45 @@
            else if (mainDevice.Type == DeviceType.DimmableLight)
            {
                mainDevice.DfunctionType = DeviceFunctionType.A灯光;
                if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
                {
                    //调光器固定灯光
                    this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A灯光);
                }
                if (mainDevice.IsCustomizeImage == false)
                {
                    mainDevice.IconPath = "Device/Light.png";
                }
            }
            //如果是色温灯
            else if (mainDevice.Type == DeviceType.ColorTemperatureLight)
            {
                mainDevice.DfunctionType = DeviceFunctionType.A灯光;
                if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
                {
                    //色温灯固定灯光
                    this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A灯光);
                }
                if (mainDevice.IsCustomizeImage == false)
                {
                    mainDevice.IconPath = "Device/ColorLightTemperature.png";
                }
            }
            //如果是三路继电器的回路的话,默认为灯光
            else if (mainDevice.Type == DeviceType.OnOffOutput)
            {
                var myType = this.GetHdlMyDeviceEnumInfo(mainDevice);
                if (myType != null && myType.ConcreteType == DeviceConcreteType.Relay_ThreeLoad)
                //2020.05.13变更:继电器都默认为灯光
                if (mainDevice.DfunctionType == DeviceFunctionType.A未定义)
                {
                    if (mainDevice.DfunctionType == DeviceFunctionType.A未定义)
                    mainDevice.DfunctionType = DeviceFunctionType.A灯光;
                    if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
                    {
                        mainDevice.DfunctionType = DeviceFunctionType.A灯光;
                    }
                    if (mainDevice.IsCustomizeImage == false)
                    {
                        mainDevice.IconPath = "Device/Light.png";
                        //继电器默认为灯光
                        this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A灯光);
                    }
                }
                //根据功能类型,重新设置设备回路图标
                this.ResetIconPathByDeviceFunctionType(mainDevice);
            }
            //如果是空气开关的话
            else if (mainDevice.Type == DeviceType.AirSwitch)
@@ -2507,20 +2973,52 @@
                if (mainDevice.DfunctionType == DeviceFunctionType.A未定义)
                {
                    mainDevice.DfunctionType = DeviceFunctionType.A开关;
                    if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A开关)
                    {
                        //空气开关默认为开关
                        this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A开关);
                    }
                }
                if (mainDevice.IsCustomizeImage == false)
                {
                    mainDevice.IconPath = "Device/Switch.png";
                }
                //根据功能类型,重新设置设备回路图标
                this.ResetIconPathByDeviceFunctionType(mainDevice);
            }
            //如果是彩灯的话
            else if (mainDevice.Type == DeviceType.ColorDimmableLight)
            {
                mainDevice.DfunctionType = DeviceFunctionType.A灯光;
                if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A灯光)
                {
                    //彩灯默认为开关
                    this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A灯光);
                }
                if (mainDevice.IsCustomizeImage == false)
                {
                    mainDevice.IconPath = "Device/ColorLight.png";
                }
            }
        }
        /// <summary>
        /// 根据功能类型,重新设置设备回路图标
        /// </summary>
        /// <param name="device"></param>
        private void ResetIconPathByDeviceFunctionType(CommonDevice device)
        {
            if (device.IsCustomizeImage == true)
            {
                return;
            }
            if (device.DfunctionType == DeviceFunctionType.A开关)
            {
                device.IconPath = "Device/Switch.png";
            }
            else if (device.DfunctionType == DeviceFunctionType.A插座)
            {
                device.IconPath = "Device/Socket1.png";
            }
            else
            {
                device.IconPath = "Device/Light.png";
            }
        }
@@ -2536,17 +3034,23 @@
            //根据设备类型创建设备对象的实例
            if (deviceType == DeviceType.ColorDimmableLight) { device = new ColorDimmableLight(); }
            else if (deviceType == DeviceType.DimmableLight) { device = new DimmableLight(); }
            else if (deviceType == DeviceType.ColorDimmerSwitch) { device = new ColorDimmerSwitch(); }
            else if (deviceType == DeviceType.LevelControlSwitch) { device = new LevelControlSwitch(); }
            else if (deviceType == DeviceType.OnOffSwitch) { device = new Panel(); }
            else if (deviceType == DeviceType.OnOffOutput) { device = new ToggleLight(); }
            else if (deviceType == DeviceType.AirSwitch) { device = new AirSwitch(); }
            else if (deviceType == DeviceType.WindowCoveringDevice) { device = new Rollershade(); }
            else if (deviceType == DeviceType.WindowCoveringController) { device = new WindowCoveringController(); }
            else if (deviceType == DeviceType.IASZone) { device = new IASZone(); }
            else if (deviceType == DeviceType.Repeater) { device = new Repeater(); }
            else if (deviceType == DeviceType.Thermostat) { device = new AC(); }
            else if (deviceType == DeviceType.FreshAir) { device = new FreshAir(); }
            else if (deviceType == DeviceType.DoorLock) { device = new DoorLock(); }
            else if (deviceType == DeviceType.TemperatureSensor) { device = new TemperatureSensor(); }
            else if (deviceType == DeviceType.PMSensor) { device = new PMSensor(); }
            else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); }
            else if (deviceType == DeviceType.ColorTemperatureLight) { device = new ColorTemperatureLight(); }
            else if (deviceType == DeviceType.Buzzer) { device = new Buzzer(); }
            else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); }
            else { return null; }
@@ -2564,11 +3068,9 @@
        public void SetNewDeviceMainKeys(CommonDevice device, Newtonsoft.Json.Linq.JObject jobject)
        {
            //设置设备主键类
            device.Time = jobject.Value<int>("Time");
            device.DeviceID = jobject.Value<int>("Device_ID");
            device.DeviceAddr = jobject.Value<string>("DeviceAddr");
            device.DeviceEpoint = jobject.Value<int>("Epoint");
            device.DataID = jobject.Value<int>("Data_ID");
        }
        #endregion
@@ -2631,27 +3133,33 @@
            this.dicDeviceModelIdEnum["MPFA/TILE-ZB.18"] = "250-200-60003";//方悦新风面板
            this.dicDeviceModelIdEnum["MPTE3/TILE-ZB.18"] = "253-200-60003";//方悦环境面板
            this.dicDeviceModelIdEnum["MP2W/TILE-ZB.18"] = "256-200-60003";//窗帘面板
            this.dicDeviceModelIdEnum["MPTL4C/S-ZB.18"] = "212-200-60003";//简约多功能面板
            this.dicDeviceModelIdEnum["MPTE3/S-ZB.18"] = "230-200-60003";//简约环境面板
            //=========★★PIR传感器类(1200-1299)★★=========
            this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir传感器220
            this.dicDeviceModelIdEnum["MSPIRB-ZB.10"] = "1205-1200-60000";//球型移动传感器
            //=========★★安防类传感器类(1300-2299)★★=========
            //这里是麦乐克的
            this.dicDeviceModelIdEnum["MULTI-GASE--EA07"] = "1300-1300-60000";//燃气传感器
            this.dicDeviceModelIdEnum["MULTI-MECI--EA01"] = "1301-1300-60000";//门窗磁传感器
            this.dicDeviceModelIdEnum["MULTI-FIRE--EA05"] = "1302-1300-60000";//烟雾传感器
            this.dicDeviceModelIdEnum["MULTI-MOTI--EA04"] = "1303-1300-60000";//红外传感器
            this.dicDeviceModelIdEnum["MULTI-WATE--EA02"] = "1304-1300-60000";//水浸传感器
            this.dicDeviceModelIdEnum["MULTI-BURO--EA06"] = "1305-1300-60000";//紧急按键
            this.dicDeviceModelIdEnum["MULTI-GASE--EA07"] = "1300-1200-60000";//燃气传感器
            this.dicDeviceModelIdEnum["MULTI-MECI--EA01"] = "1301-1200-60000";//门窗磁传感器
            this.dicDeviceModelIdEnum["MULTI-FIRE--EA05"] = "1302-1200-60000";//烟雾传感器
            this.dicDeviceModelIdEnum["MULTI-MOTI--EA04"] = "1303-1200-60000";//红外传感器
            this.dicDeviceModelIdEnum["MULTI-WATE--EA02"] = "1304-1200-60000";//水浸传感器
            this.dicDeviceModelIdEnum["MULTI-BURO--EA06"] = "1305-1200-60000";//紧急按键
            //这里是河东的
            this.dicDeviceModelIdEnum["MSG01/M-ZB.10"] = "1300-1300-60000";//燃气传感器
            this.dicDeviceModelIdEnum["MSDC01/M-ZB.10"] = "1301-1300-60000";//门窗磁传感器
            this.dicDeviceModelIdEnum["MSS01/M-ZB.10"] = "1302-1300-60000";//烟雾传感器
            this.dicDeviceModelIdEnum["MSPIR01/M-ZB.10"] = "1303-1300-60000";//红外传感器
            this.dicDeviceModelIdEnum["MSW01/M-ZB.10"] = "1304-1300-60000";//水浸传感器
            this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1300-60000";//紧急按键DZ_PM100-V1.6
            this.dicDeviceModelIdEnum["MSG01/M-ZB.10"] = "1300-1200-60000";//燃气传感器
            this.dicDeviceModelIdEnum["MSDC01/M-ZB.10"] = "1301-1200-60000";//门窗磁传感器
            this.dicDeviceModelIdEnum["MSS01/M-ZB.10"] = "1302-1200-60000";//烟雾传感器
            this.dicDeviceModelIdEnum["MSPIR01/M-ZB.10"] = "1303-1200-60000";//红外传感器
            this.dicDeviceModelIdEnum["MSW01/M-ZB.10"] = "1304-1200-60000";//水浸传感器
            this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1200-60000";//紧急按键
            this.dicDeviceModelIdEnum["MGCD01/M-ZB.10"] = "1306-1200-60000";//吸顶燃气传感器
            this.dicDeviceModelIdEnum["MSW01/M-ZB.10"] = "1306-1300-60000";//水浸传感器
            //PM2.5空气质量传感器 【该设备属于第三方设备,没有镜像ID】
            this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5空气质量传感器
            //=========★★继电器类(2300-2499)★★=========
            this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3路继电器小模块
@@ -2698,9 +3206,8 @@
            this.dicPictrueShard["ButtonPanel_SimpleFour"] = "ButtonPanel_Four";//简约4按键面板 沿用 4按键的图标
            this.dicPictrueShard["ButtonPanel_SimpleThree"] = "ButtonPanel_Three";//简约3按键面板 沿用 3按键的图标
            this.dicPictrueShard["ButtonPanel_SimpleTwo"] = "ButtonPanel_Two";//简约2按键面板 沿用 2按键的图标
            this.dicPictrueShard["IntelligentLocks_Sone"] = "IntelligentLocks_H06C";//S-one的门锁图片沿用H06C的图标
            this.dicPictrueShard["Relay_FangyueFreshAirModul"] = "Relay_ThreeLoad";//方悦新风小模块图片沿用3路继电器的图标
            this.dicPictrueShard["IntelligentLocks_Sone"] = "IntelligentLocks_H06C";//S-one的门锁图片 沿用 H06C的图标
            this.dicPictrueShard["Relay_FangyueFreshAirModul"] = "Relay_ThreeLoad";//方悦新风小模块图片 沿用 3路继电器的图标
        }
        #endregion
@@ -2804,6 +3311,14 @@
        /// 窗帘面板 镜像id:256
        /// </summary>
        ButtonPanel_Curtain = 256,
        /// <summary>
        /// 简约多功能面板 镜像ID:212
        /// </summary>
        ButtonPanel_SimpleMultifunction = 212,
        /// <summary>
        /// 简约环境面板
        /// </summary>
        ButtonPanel_SimpleEnvironment = 230,
        //=========★★PIR传感器类(1200-1299)★★=========
        /// <summary>
@@ -2814,6 +3329,10 @@
        /// pir传感器220 镜像id:1200
        /// </summary>
        Sensor_Pir = 1200,
        /// <summary>
        /// 球形移动传感器 镜像id:1205
        /// </summary>
        Sensor_SphericalMotion = 1205,
        //=========★★安防类传感器类(1300-2299)★★=========
        /// <summary>
@@ -2840,6 +3359,15 @@
        /// 紧急按钮
        /// </summary>
        Sensor_EmergencyButton = 1305,
        /// <summary>
        /// 吸顶燃气传感器
        /// </summary>
        Sensor_CeilingGas = 1306,
        /// <summary>
        /// PM2.5空气质量传感器
        /// </summary>
        Sensor_PMTwoPointFive = 1307,
        /// <summary>
        /// 运动传感器
        /// </summary>
@@ -2873,9 +3401,9 @@
        /// <summary>
        /// 方悦新风小模块 镜像id:2310
        /// </summary>
        Relay_FangyueFreshAirModul = 2310,
        //=========★★调光器类(2500-2799)★★=========
        Relay_FangyueFreshAirModul = 2310,
        //=========★★调光器类(2500-2799)★★=========
        /// <summary>
        /// 调光器
        /// </summary>
@@ -2904,6 +3432,10 @@
        /// 彩灯
        /// </summary>
        ColorLight = -10,
        /// <summary>
        /// 色温灯(它的镜像ID未定,暂定20000)
        /// </summary>
        ColorLight_Temperature = 20000,
        //=========★★空调(3600-3899)★★=========
        /// <summary>
@@ -2991,6 +3523,10 @@
        /// </summary>
        A传感器 = 1200,
        /// <summary>
        /// PM2.5空气质量传感器
        /// </summary>
        APM2点5空气质量传感器 = 1307,
        /// <summary>
        /// 继电器(2300-2499)
        /// </summary>
        A继电器 = 2300,