WJC
2019-12-30 f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f
ZigbeeApp/Shared/Common/Device.cs
@@ -37,18 +37,21 @@
            }
        }
        /// <summary>
        /// 本地所有设备的缓存
        /// 本地所有设备的缓存(排序)
        /// </summary>
        public List<CommonDevice> listAllDevice
        {
            get
            {
                var list = new List<CommonDevice>();
                foreach (var device in dicAllDevice.Values)
                lock (dicAllDevice)
                {
                    list.Add(device);
                    var list = new List<CommonDevice>();
                    foreach (var device in dicAllDevice.Values)
                    {
                        list.Add(device);
                    }
                    return list;
                }
                return list;
            }
        }
@@ -81,13 +84,9 @@
        /// </summary>
        private Dictionary<string, HashSet<int>> dicDeviceEpoint = new Dictionary<string, HashSet<int>>();
        /// <summary>
        /// 设备文件的前缀名字
        /// 物理设备属于哪个房间的记录
        /// </summary>
        public const string deviceFirstName = "Device_";
        /// <summary>
        /// 锁
        /// </summary>
        private object objLock = new object();
        private Dictionary<string, string> dicDeviceRoomId = null;
        #endregion
@@ -99,7 +98,7 @@
        public void ReFreshByLocal()
        {
            this.dicAllDevice.Clear();
            this.dicDeviceEpoint.Clear();
            this.dicDeviceEpoint.Clear();
            //初始化R文件里面设备默认名字的ID
            this.InitDeviceDefultNameIDList();
@@ -172,6 +171,8 @@
            }
            //成员身份的时候,删除掉非法的网关文件
            this.DeleteGatewayFileByMemberModel();
            //初始化物理设备所属房间的记录
            this.InitRealDeviceRoomId();
        }
        /// <summary>
@@ -184,11 +185,15 @@
                return;
            }
            var listId = new HashSet<string>();
            foreach (var device in this.dicAllDevice.Values)
            lock (dicAllDevice)
            {
                if (listId.Contains(device.CurrentGateWayId) == false)
                foreach (var device in this.dicAllDevice.Values)
                {
                    listId.Add(device.CurrentGateWayId);
                    if (listId.Contains(device.CurrentGateWayId) == false)
                    {
                        listId.Add(device.CurrentGateWayId);
                    }
                }
            }
            var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway();
@@ -213,11 +218,11 @@
        /// <param name="zbGateway">网关对象</param>
        /// <param name="deviceComingAction">接收到设备时的事件,设备对象为null时,代表接收完成</param>
        /// <returns>一直返回true</returns>
        public async Task<bool> SetDeviceToMemmoryByGateway(ZbGateway zbGateway, Action<CommonDevice> deviceComingAction = null)
        public bool SetDeviceToMemmoryByGateway(ZbGateway zbGateway, Action<CommonDevice> deviceComingAction = null)
        {
            //从网关获取全部的设备
            List<CommonDevice> listDevice = new List<CommonDevice>();
            List<CommonDevice> list = await this.GetDeviceListFromGateway(zbGateway, deviceComingAction);
            List<CommonDevice> list = this.GetDeviceListFromGateway(zbGateway, true, deviceComingAction);
            if (list == null)
            {
@@ -329,17 +334,20 @@
                return;
            }
            if (this.dicAllDevice.ContainsKey(mainKeys) == true)
            lock (dicAllDevice)
            {
                //交换属性
                var tempDevice = this.dicAllDevice[mainKeys];
                //将DeviceInfo的属性设置到主属性中
                this.SetDeviceInfoToMain(tempDevice, device);
                device = tempDevice;
            }
            else
            {
                this.dicAllDevice[mainKeys] = device;
                if (this.dicAllDevice.ContainsKey(mainKeys) == true)
                {
                    //交换属性
                    var tempDevice = this.dicAllDevice[mainKeys];
                    //将DeviceInfo的属性设置到主属性中
                    this.SetDeviceInfoToMain(tempDevice, device);
                    device = tempDevice;
                }
                else
                {
                    this.dicAllDevice[mainKeys] = device;
                }
            }
            //设备回路收集
@@ -446,6 +454,11 @@
                }
                //备份数据
                await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.AMac名称, newMacName);
                //如果它只有一个回路,则更改端点名字
                if (this.dicDeviceEpoint.ContainsKey(device.DeviceAddr) == true && this.dicDeviceEpoint[device.DeviceAddr].Count == 1)
                {
                    return await this.ReName(device, newMacName);
                }
            }
            return true;
        }
@@ -456,16 +469,19 @@
        /// <param name="device"></param>
        private void BackupDeviceAfterReName(CommonDevice device)
        {
            string mainKeys = this.GetDeviceMainKeys(device);
            if (this.dicAllDevice.ContainsKey(mainKeys) == false)
            lock (dicAllDevice)
            {
                return;
            }
            this.dicAllDevice[mainKeys] = device;
            device.ReSave();
                string mainKeys = this.GetDeviceMainKeys(device);
                if (this.dicAllDevice.ContainsKey(mainKeys) == false)
                {
                    return;
                }
                this.dicAllDevice[mainKeys] = device;
                device.ReSave();
            //添加自动备份
            HdlAutoBackupLogic.AddOrEditorFile(device.FilePath);
                //添加自动备份
                HdlAutoBackupLogic.AddOrEditorFile(device.FilePath);
            }
        }
        #endregion
@@ -501,6 +517,12 @@
            {
                this.DeleteMemmoryDevice(device);
            }
            if (this.dicDeviceRoomId.ContainsKey(listdevice[0].DeviceAddr) == true)
            {
                //移除真实设备的房间索引
                this.dicDeviceRoomId.Remove(listdevice[0].DeviceAddr);
                this.SaveRealDeviceRoomId(null, null);
            }
            return true;
        }
@@ -513,9 +535,12 @@
        {
            //删除缓存
            string mainKeys = this.GetDeviceMainKeys(device);
            if (this.dicAllDevice.ContainsKey(mainKeys) == true)
            lock (dicAllDevice)
            {
                this.dicAllDevice.Remove(mainKeys);
                if (this.dicAllDevice.ContainsKey(mainKeys) == true)
                {
                    this.dicAllDevice.Remove(mainKeys);
                }
            }
            //删除设备文件
@@ -645,12 +670,15 @@
        public List<CommonDevice> GetDeviceByGatewayID(string gwId)
        {
            List<CommonDevice> list = new List<CommonDevice>();
            //各网关的所有设备
            foreach (CommonDevice device in this.dicAllDevice.Values)
            lock (dicAllDevice)
            {
                if (gwId == device.CurrentGateWayId)
                //各网关的所有设备
                foreach (CommonDevice device in this.dicAllDevice.Values)
                {
                    list.Add(device);
                    if (gwId == device.CurrentGateWayId)
                    {
                        list.Add(device);
                    }
                }
            }
@@ -664,9 +692,12 @@
        /// <returns></returns>
        public CommonDevice GetDevice(string mainKeys)
        {
            if (this.dicAllDevice.ContainsKey(mainKeys) == true)
            lock (dicAllDevice)
            {
                return this.dicAllDevice[mainKeys];
                if (this.dicAllDevice.ContainsKey(mainKeys) == true)
                {
                    return this.dicAllDevice[mainKeys];
                }
            }
            return null;
        }
@@ -716,6 +747,20 @@
        }
        /// <summary>
        /// 根据MAC地址,获取全部回路的数量
        /// </summary>
        /// <param name="DeviceAddr">Mac地址</param>
        /// <returns></returns>
        public int GetDevicesCountByMac(string DeviceAddr)
        {
            if (dicDeviceEpoint.ContainsKey(DeviceAddr) == false)
            {
                return 0;
            }
            return dicDeviceEpoint[DeviceAddr].Count;
        }
        /// <summary>
        /// 获取本地全部的设备文件
        /// </summary>
        /// <returns></returns>
@@ -723,9 +768,10 @@
        {
            List<string> listDeviceFile = new List<string>();
            List<string> listAllFile = Global.FileListByHomeId();
            foreach (string file in listAllFile)
            {
                if (file.StartsWith(deviceFirstName) == false)
                if (file.StartsWith("Device_") == false)
                {
                    //如果不是设备文件
                    continue;
@@ -940,6 +986,11 @@
        /// <returns></returns>
        public void SetDeviceIconToControl(Button btnIcon, CommonDevice device)
        {
            if (device == null)
            {
                btnIcon.UnSelectedImagePath = "Device/ThirdPartyDevice.png";
                return;
            }
            string unSelectFilePath = string.Empty;
            string selectFilePath = string.Empty;
@@ -947,6 +998,7 @@
            this.GetDeviceIcon(device, ref unSelectFilePath, ref selectFilePath);
            btnIcon.UnSelectedImagePath = unSelectFilePath;
            btnIcon.SelectedImagePath = selectFilePath;
        }
        /// <summary>
@@ -1102,14 +1154,14 @@
        public DeviceUI GetDeviceUI(string filePath)
        {
            string[] arry = filePath.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
            if (arry.Length != 5)
            if (arry.Length != 4)
            {
                return null;
            }
            //创建一个新的东西给过去
            var deviceUi = new DeviceUI();
            deviceUi.DeviceAddr = arry[3];
            deviceUi.DeviceEpoint = Convert.ToInt32(arry[4]);
            deviceUi.DeviceAddr = arry[2];
            deviceUi.DeviceEpoint = Convert.ToInt32(arry[3]);
            return deviceUi;
        }
@@ -1293,7 +1345,7 @@
            {
                info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId9;
                info.BeloneType = DeviceBeloneType.A彩灯;
                info.ConcreteType = DeviceConcreteType.ColorDimmableLight;
                info.ConcreteType = DeviceConcreteType.ColorLight;
            }
            //8空调
            else if (dicType.ContainsKey(DeviceType.Thermostat) == true)
@@ -1451,97 +1503,82 @@
        #endregion
        #region ■ 设备排序___________________________
        #region ■ 物理设备所属房间___________________
        /// <summary>
        /// 设备排序
        /// 初始化物理设备所属房间的记录
        /// </summary>
        /// <param name="listDevice">设备对象</param>
        /// <returns></returns>
        public List<CommonDevice> SortDeviceList(List<CommonDevice> listDevice)
        private void InitRealDeviceRoomId()
        {
            List<CommonDevice> listSort = new List<CommonDevice>();
            var list = this.SortDeviceListByRule(listDevice);
            listSort.AddRange(list);
            return listSort;
            this.dicDeviceRoomId = new Dictionary<string, string>();
            string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
            var strData = UserCenterLogic.LoadFileContent(fullName);
            if (strData != null)
            {
                this.dicDeviceRoomId = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(strData);
            }
        }
        /// <summary>
        ///
        /// 保存物理设备所属房间的记录
        /// </summary>
        /// <param name="listDevice">设备对象</param>
        /// <returns></returns>
        private List<CommonDevice> SortDeviceListByRule(List<CommonDevice> listDevice)
        /// <param name="listDevice">需要保存的设备对象</param>
        /// <param name="roomId">需要保存的哪个设备的房间ID</param>
        /// <param name="saveRoadDevice">如果只有一个回路,是否把回路的房间一起修改</param>
        public void SaveRealDeviceRoomId(List<CommonDevice> listDevice, string roomId, bool saveRoadDevice = true)
        {
            //设备排序的规则(Keys:设备类型(DeviceType)  value:存放设备的容器)
            var dic = this.GetDeviceSortRule();
            foreach (CommonDevice device in listDevice)
            if (listDevice != null)
            {
                if (device is IASZone)
                {
                    //传感器有很多种
                    var strType = ((IASZone)device).DeviceInfo.DeviceType.ToString();
                    if (dic.ContainsKey(strType) == false || dic[strType] == null)
                    {
                        dic[strType] = new List<CommonDevice>();
                    }
                    dic[strType].Add(device);
                    continue;
                }
                string checkKeys = device.Type.ToString();
                if (dic.ContainsKey(checkKeys) == false || dic[checkKeys] == null)
                {
                    dic[checkKeys] = new List<CommonDevice>();
                }
                dic[checkKeys].Add(device);
                this.dicDeviceRoomId[listDevice[0].DeviceAddr] = roomId;
            }
            List<CommonDevice> lstSort = new List<CommonDevice>();
            foreach (var list in dic.Values)
            //保存记录
            string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile);
            UserCenterLogic.SaveFileContent(fullName, this.dicDeviceRoomId);
            //添加自动备份
            HdlAutoBackupLogic.AddOrEditorFile(DirNameResourse.DeviceRoomIdFile);
            //如果设备只有一个回路,如果改变了真实设备区域,则它的回路的区域也一起改了
            if (saveRoadDevice == true && listDevice != null && listDevice.Count == 1)
            {
                if (list != null && list.Count > 0)
                {
                    lstSort.AddRange(list);
                }
                Common.Room.CurrentRoom.ChangedRoom(listDevice[0], roomId, false);
            }
            return lstSort;
        }
        /// <summary>
        /// 获取设备排序的规则(Keys:设备类型(DeviceType)  value:存放设备的容器)
        /// 获取真实物理设备的房间名字
        /// </summary>
        /// <returns></returns>
        private Dictionary<string, List<CommonDevice>> GetDeviceSortRule()
        /// <param name="device">设备的某一个回路</param>
        /// <returns></returns>
        public string GeteRealDeviceRoomName(CommonDevice device)
        {
            var dic = new Dictionary<string, List<CommonDevice>>();
            //控制面板
            dic[DeviceType.OnOffSwitch.ToString()] = null;
            //卷帘
            dic[DeviceType.WindowCoveringDevice.ToString()] = null;
            //调光灯
            dic[DeviceType.ColorDimmableLight.ToString()] = null;
            //继电器
            dic[DeviceType.OnOffOutput.ToString()] = null;
            //空气开关
            dic[DeviceType.AirSwitch.ToString()] = null;
            //门窗磁传感器
            dic["21"] = null;
            dic["22"] = null;
            //水浸传感器
            dic["42"] = null;
            //烟雾传感器
            dic["40"] = null;
            //紧急按钮
            dic["44"] = null;
            //燃气传感器
            dic["43"] = null;
            //运动传感器
            dic["13"] = null;
            //钥匙扣
            dic["277"] = null;
            if (this.dicDeviceRoomId.ContainsKey(device.DeviceAddr) == false)
            {
                //未分配区域
                return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
            }
            var room = Room.CurrentRoom.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
            if (room != null)
            {
                return room.Name;
            }
            //未分配区域
            return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
        }
            return dic;
        /// <summary>
        /// 获取真实物理设备属于哪个房间
        /// </summary>
        /// <param name="device">设备的某一个回路</param>
        /// <returns></returns>
        public Room GeteRealDeviceRoom(CommonDevice device)
        {
            if (this.dicDeviceRoomId.ContainsKey(device.DeviceAddr) == false)
            {
                return null;
            }
            return Room.CurrentRoom.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
        }
        #endregion
@@ -1647,14 +1684,40 @@
        #region ■ 获取设备列表的接口_________________
        /// <summary>
        /// 从网关重新获取设备列表(★★★★★★★接收到设备时的事件,设备对象为null时,代表接收完成★★★★★★★)
        /// 从网关重新获取设备列表(★★★★★★★接收到设备时的事件★★★★★★★)
        /// </summary>
        /// <param name="zbGateway">网关对象</param>
        /// <param name="deviceComingAction">接收到设备时的事件,设备对象为null时,代表接收完成</param>
        /// <param name="ignoreTime">是否无视时间,true:每次调用都去网关获取,false:3分钟内返回的是本地的设备</param>
        /// <param name="deviceComingAction">接收到设备时的事件</param>
        /// <param name="mode">是否显示错误</param>
        /// <returns></returns>
        public async Task<List<CommonDevice>> GetDeviceListFromGateway(ZbGateway zbGateway, Action<CommonDevice> deviceComingAction = null, ShowErrorMode mode = ShowErrorMode.YES)
        public List<CommonDevice> GetDeviceListFromGateway(ZbGateway zbGateway, bool ignoreTime, Action<CommonDevice> deviceComingAction = null, ShowErrorMode mode = ShowErrorMode.YES)
        {
            if (ignoreTime == false)
            {
                if ((DateTime.Now - zbGateway.LastDateTime).TotalMilliseconds < 3 * 60 * 1000)
                {
                    //不无视时间,返回本地设备列表
                    var listTemp = this.GetDeviceByGatewayID(HdlGatewayLogic.Current.GetGatewayId(zbGateway));
                    if (deviceComingAction != null)
                    {
                        for (int i = 0; i < listTemp.Count; i++)
                        {
                            try
                            {
                                //回调函数
                                deviceComingAction.Invoke(listTemp[i]);
                            }
                            //Log出力
                            catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex); }
                        }
                    }
                    deviceComingAction = null;
                    return listTemp;
                }
            }
            zbGateway.LastDateTime = DateTime.Now;
            //如果切换到了别的界面,则不显示错误信息
            string nowFormId = UserCenterResourse.NowActionFormID;
@@ -1711,8 +1774,13 @@
                        var device = this.NewDeviceObjectByDeviceId(deviceID, jobject, zbGateway);
                        if (device != null)
                        {
                            //回调函数
                            deviceComingAction?.Invoke(device);
                            try
                            {
                                //回调函数
                                deviceComingAction?.Invoke(device);
                            }
                            //Log出力
                            catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex); }
                            listDevice.Add(device);
                        }
@@ -1730,13 +1798,13 @@
            try
            {
                var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 93 } };
                await realWay.Send("GetDeviceInfo", jObject.ToString());
                realWay.Send("GetDeviceInfo", jObject.ToString());
            }
            catch { canBreak = true; }
            while (canBreak == false && TimeOut < 60)
            {
                await Task.Delay(100);
                System.Threading.Thread.Sleep(100);
                TimeOut++;
            }
@@ -1754,7 +1822,7 @@
                        string msg = Language.StringByID(R.MyInternationalizationString.uGetDeviceListFail);
                        msg += "\r\n[" + HdlGatewayLogic.Current.GetGatewayName(zbGateway).ToString() + "]";
                        msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "回复超时", false);
                        this.ShowErrorMsg(msg);
                        this.ShowTipMsg(msg);
                    }
                    return null;
                }
@@ -1769,8 +1837,7 @@
                }
            }
            //回调函数(接收完成)
            deviceComingAction?.Invoke(null);
            //回调函数(接收完成)
            deviceComingAction = null;
            return listDevice;
@@ -1837,6 +1904,7 @@
            mainDevice.DriveCode = device.DeviceInfo.DriveCode;
            mainDevice.IasDeviceType = device.DeviceInfo.DeviceType;
            mainDevice.Profile = device.DeviceInfo.Profile;
            mainDevice.Type = device.Type;
            //固件版本
            mainDevice.ImgVersion = device.DeviceInfo.ImgVersion;
@@ -1857,9 +1925,9 @@
            mainDevice.OutClusterList.AddRange(device.DeviceInfo.OutClusterList);
            mainDevice.AttributeStatus.Clear();
            mainDevice.AttributeStatus.AddRange(device.DeviceInfo.AttributeStatus);
            //如果是温度传感器
            if (mainDevice is TemperatureSensor)
            if (mainDevice.Type == DeviceType.TemperatureSensor)
            {
                //输出族 1026:温度传感器 1029:湿度传感器
                foreach (var data in mainDevice.OutClusterList)
@@ -1872,6 +1940,24 @@
                    {
                        ((TemperatureSensor)mainDevice).SensorDiv = 1;
                    }
                }
            }
            //如果是调光器
            else if (mainDevice.Type == DeviceType.DimmableLight )
            {
                mainDevice.DfunctionType = DeviceFunctionType.A灯光;
                if (mainDevice.IsCustomizeImage == false)
                {
                    mainDevice.IconPath = "Device/Light.png";
                }
            }
            //如果是彩灯的话
            else if ( mainDevice.Type == DeviceType.ColorDimmableLight)
            {
                mainDevice.DfunctionType = DeviceFunctionType.A灯光;
                if (mainDevice.IsCustomizeImage == false)
                {
                    mainDevice.IconPath = "Device/ColorLight.png";
                }
            }
        }
@@ -1973,7 +2059,7 @@
            this.dicDeviceModelIdEnum["H06C"] = "2800-2800";//智能门锁(H06C)
            //=========★★空调类(3600-3899)★★=========
            this.dicDeviceModelIdEnum["MAC/GW-ZB.431"] = "3600-3600";//zigbee空调网关模块
            this.dicDeviceModelIdEnum["MAC/GW-ZB.10"] = "3600-3600";//zigbee空调网关模块
            //=========★★中继器类(3900-3999)★★=========
            this.dicDeviceModelIdEnum["MSR-ZB.10"] = "3900-3900"; //zigbee中继器
@@ -1998,4 +2084,266 @@
        #endregion
    }
    #region ■ 自定义设备类型_________________________
    /// <summary>
    /// <para>仅限底层使用:设备的具体【设备类型】,自定义与模块id关联的枚举(值为LocalDevice里面dicDeviceModelIdEnum所指定的值)</para>
    /// <para>变量名可以作为【设备类型】图片,这个值是瞎写的,没什么特殊意义</para>
    /// </summary>
    public enum DeviceConcreteType
    {
        //定义规则:【设备类型】图片名字=LocalDevice里面dicDeviceModelIdEnum所指定的值
        /// <summary>
        /// 未知设备
        /// </summary>
        UnKownDevice = -1,
        //=========★★窗帘类(100-199)★★=========
        /// <summary>
        /// 窗帘
        /// </summary>
        Curtain = -100,
        /// <summary>
        /// 智能开合帘电机 镜像id:100
        /// </summary>
        Curtain_AutoOpen = 100,
        /// <summary>
        /// 智能管状电机 镜像id:101
        /// </summary>
        Curtain_Siphonate = 101,
        //=========★★按键面板类(200-1199)★★=========
        /// <summary>
        /// 按键面板
        /// </summary>
        ButtonPanel = -200,
        /// <summary>
        /// 4按键多功能触摸面板(带4路继电器底座) 镜像id:200
        /// </summary>
        ButtonPanel_Four = 200,
        /// <summary>
        /// 3按键多功能触摸面板(带3路继电器底座) 镜像id:201
        /// </summary>
        ButtonPanel_Three = 201,
        /// <summary>
        /// 2按键多功能触摸面板(带2路继电器底座) 镜像id:202
        /// </summary>
        ButtonPanel_Two = 202,
        /// <summary>
        /// 12按键多功能触摸面板(带1路继电器底座) 镜像id:203
        /// </summary>
        ButtonPanel_Twelve = 203,
        /// <summary>
        /// 4按键多功能触摸面板(只带电源底座) 镜像id:210
        /// </summary>
        ButtonPanel_FourNotPower = 210,
        //=========★★PIR传感器类(1200-1299)★★=========
        /// <summary>
        /// 传感器
        /// </summary>
        Sensor = -1200,
        /// <summary>
        /// pir传感器220 镜像id:1200
        /// </summary>
        Sensor_Pir = 1200,
        //=========★★安防类传感器类(1300-2299)★★=========
        /// <summary>
        /// 燃气传感器
        /// </summary>
        Sensor_CarbonMonoxide = 1300,
        /// <summary>
        /// 门窗传感器
        /// </summary>
        Sensor_DoorWindow = 1301,
        /// <summary>
        /// 烟雾传感器
        /// </summary>
        Sensor_Fire = 1302,
        /// <summary>
        /// 红外传感器
        /// </summary>
        Sensor_Infrared = 1303,
        /// <summary>
        /// 水侵传感器
        /// </summary>
        Sensor_Water = 1304,
        /// <summary>
        /// 紧急按钮
        /// </summary>
        Sensor_EmergencyButton = 1305,
        /// <summary>
        /// 运动传感器
        /// </summary>
        Sensor_Motion = -1306,
        /// <summary>
        /// 钥匙扣
        /// </summary>
        Sensor_Keyfob = -1307,
        /// <summary>
        /// 温湿度传感器
        /// </summary>
        Sensor_TemperatrueHumidity = -1308,
        /// <summary>
        /// 温度传感器
        /// </summary>
        Sensor_Temperatrue = -1309,
        /// <summary>
        /// 湿度传感器
        /// </summary>
        Sensor_Humidity = -1310,
        //=========★★继电器类(2300-2499)★★=========
        /// <summary>
        /// 继电器
        /// </summary>
        Relay = -2300,
        /// <summary>
        /// 三路继电器 镜像id:2300
        /// </summary>
        Relay_ThreeLoad = 2300,
        //=========★★调光器类(2500-2799)★★=========
        /// <summary>
        /// 调光器
        /// </summary>
        DimmableLight = -2500,
        /// <summary>
        /// 1路调光器小模块
        /// </summary>
        DimmableLight_OneLoad = 2500,
        //=========★★智能门锁类(2800-????)★★=========
        /// <summary>
        /// 智能门锁
        /// </summary>
        IntelligentLocks = -2800,
        /// <summary>
        /// H06C
        /// </summary>
        IntelligentLocks_H06C = 2800,
        //=========★★彩灯类(????-????)★★=========
        /// <summary>
        /// 彩灯
        /// </summary>
        ColorLight = -10,
        //=========★★空调(3600-3899)★★=========
        /// <summary>
        /// 空调
        /// </summary>
        AirConditioner = -3600,
        /// <summary>
        /// zigbee空调网关模块
        /// </summary>
        AirConditioner_ZbGateway = 3600,
        //=========★★中继器(3900-3999)★★=========
        /// <summary>
        /// 中继器
        /// </summary>
        Repeater = -3900,
        /// <summary>
        /// zigbee中继器 镜像id:3900
        /// </summary>
        Repeater_Zigbee = 3900,
        //=========★★空气开关类(4100-????)★★=========
        /// <summary>
        /// 智能空气开关
        /// </summary>
        AirSwitch = -4100,
        /// <summary>
        /// 微断云控制器 镜像id:4100
        /// </summary>
        AirSwitch_CloudContr = 4100,
        //=========★★转换器类(4200-4699)★★=========
        /// <summary>
        /// 转换器
        /// </summary>
        Converter = -4200,
        /// <summary>
        /// zigbee转485协议转换器
        /// </summary>
        Converter_Zb485 = 4200,
        /// <summary>
        /// zigbee转buspro协议转换器
        /// </summary>
        Converter_ZbBuspro = 4201,
    }
    /// <summary>
    /// <para>仅限底层使用:设备所属的【设备种类】,自定义与模块id关联的枚举(值为LocalDevice里面dicDeviceModelIdEnum所指定的值)</para>
    /// <para>这个值是瞎写的,没什么特殊意义</para>
    /// </summary>
    public enum DeviceBeloneType
    {
        /// <summary>
        /// 未知设备
        /// </summary>
        A未知设备 = 0,
        /// <summary>
        /// 窗帘(100-199)
        /// </summary>
        A窗帘 = 100,
        /// <summary>
        /// 按键面板(200-1199)
        /// </summary>
        A按键面板 = 200,
        /// <summary>
        /// 传感器(1200-2299)
        /// </summary>
        A传感器 = 1200,
        /// <summary>
        /// 继电器(2300-2499)
        /// </summary>
        A继电器 = 2300,
        /// <summary>
        /// 调光器(2500-2799)
        /// </summary>
        A调光器 = 2500,
        /// <summary>
        /// 智能门锁(2800-????)
        /// </summary>
        A智能门锁 = 2800,
        /// <summary>
        /// 空调(3600-3899)
        /// </summary>
        A空调 = 3600,
        /// <summary>
        /// 中继器(3900-3999)
        /// </summary>
        A中继器 = 3900,
        /// <summary>
        /// 空气开关(4100-4199)
        /// </summary>
        A空气开关 = 4100,
        /// <summary>
        /// 转换器(4200-4699)
        /// </summary>
        A转换器 = 4200,
        /// <summary>
        /// 彩灯
        /// </summary>
        A彩灯 = 9,
        /// <summary>
        /// 温湿度传感器
        /// </summary>
        A温湿度传感器 = 10,
        /// <summary>
        /// 温度传感器
        /// </summary>
        A温度传感器 = 11,
        /// <summary>
        /// 湿度传感器
        /// </summary>
        A湿度传感器 = 12
    }
    #endregion
}