黄学彪
2020-04-13 3793a9a38ac6c4c4111c2bba3a35a71c30601e82
ZigbeeApp/Shared/Common/Device.cs
@@ -980,34 +980,66 @@
                return this.GetDeviceMacName(device);
            }
            //同一设备里面,不同类型的回路,它的命名都从1开始
            int epointNo = 0;
            var listSort = this.GetDevicesByMac(device.DeviceAddr);
            foreach (var myDevice in listSort)
            {
                if (myDevice.Type == device.Type)
                {
                    //同一类型编号+1
                    epointNo++;
                    if (myDevice.DeviceEpoint == device.DeviceEpoint)
                    {
                        //已经到达它自己
                        break;
                    }
                }
            }
            if (device.Type == DeviceType.OnOffOutput
                || device.Type == DeviceType.DimmableLight || device.Type == DeviceType.ColorDimmableLight)
            {
                //继电器,掉光器都叫回路
                return Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + device.DeviceEpoint;
            }
            else if (device.Type == DeviceType.Thermostat)
            {
                //空调都叫室内机
                return Language.StringByID(R.MyInternationalizationString.uIndoorUnit) + device.DeviceEpoint;
                return Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + epointNo;
            }
            //获取设备类型
            var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
            if (device.Type == DeviceType.OnOffSwitch)
            if (device.Type == DeviceType.Thermostat)
            {
                //新风面板中的Thermostat叫温度传感器
                if (deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
                {
                    return Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                }
                //空调都叫室内机
                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);
            }
            else if (device.Type == DeviceType.OnOffSwitch)
            {
                //面板的干接点叫按键
                if (deviceInfoType.BeloneType == DeviceBeloneType.A按键面板)
                {
                    return Language.StringByID(R.MyInternationalizationString.uPanelButton) + device.DeviceEpoint;
                    return Language.StringByID(R.MyInternationalizationString.uPanelButton) + epointNo;
                }
                //其他的干接点叫干接点
                else
                {
                    return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + device.DeviceEpoint;
                    return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + epointNo;
                }
            }
            //其他情况,使用它的默认名称
            return Language.StringByID(deviceInfoType.DefultNameId) + device.DeviceEpoint;
            return Language.StringByID(deviceInfoType.DefultNameId) + epointNo;
        }
        /// <summary>
@@ -1571,7 +1603,7 @@
            {
                //默认值
                info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId4100;
                info.BeloneType = DeviceBeloneType.A智能空开;
                info.BeloneType = DeviceBeloneType.A开关;
                info.ConcreteType = DeviceConcreteType.AirSwitch;
                info.ObjectTypeNameId = 60001;//开关模块
@@ -1869,12 +1901,7 @@
                return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
            }
            var room = HdlRoomLogic.Current.GetRoomById(this.dicDeviceRoomId[device.DeviceAddr]);
            if (room != null)
            {
                return room.Name;
            }
            //未分配区域
            return Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
            return HdlRoomLogic.Current.GetFloorRoomName(room);
        }
        /// <summary>
@@ -2009,10 +2036,13 @@
                //这个设备不见了
                return false;
            }
            if (i_device.Type == DeviceType.OnOffOutput && i_device.DfunctionType == DeviceFunctionType.A未定义)
            if (i_device.Type == DeviceType.OnOffOutput || i_device.Type == DeviceType.AirSwitch)
            {
                //2020.03.23追加式样:未指定类型的继电器,不显示
                return false;
                if (i_device.DfunctionType == DeviceFunctionType.A未定义)
                {
                    return false;
                }
            }
            //2020.03.30追加式样:如果是面板的温度探头,不显示
            else if (i_device.Type == DeviceType.TemperatureSensor && ((TemperatureSensor)i_device).SensorDiv == 1)
@@ -2178,7 +2208,7 @@
            var listCheck = new HashSet<string>();
            Action<string, string> getDeviceAction = (topic, message) =>
            {
                if (topic == gatewayID + "/" + "DeviceInfoRespon")
                if (topic == gatewayID + "/DeviceInfoRespon")
                {
                    try
                    {
@@ -2226,6 +2256,9 @@
                        //设备全部接收完成
                        canBreak = true;
                    }
                }
                else if (topic == gatewayID + "/DeviceInfoResponEnd")
                {
                }
            };
@@ -2447,8 +2480,10 @@
            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.FreshAirHumiditySensor) { device = new HumiditySensor(); }
            else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); }
            else { return null; }
@@ -2501,7 +2536,7 @@
            //前言:因为zigbeehome的设备拥有四种名字:
            //1、设备官方名称            ----它由DeviceConcreteType的数值所决定(个人中心专用)
            //2、设备入网后的默认名称    ----它不需要再代码里面定义,它直接在Language文件里面定义
            //2、设备入网后的默认名称    ----它不需要在代码里面定义,它直接在Language文件里面定义
            //                               范围:50000开始,它的规则是DeviceConcreteType对应的R文件里面的ID的数值+20000,
            //3、设备所属名称            ----它有DeviceBeloneType的数值所决定
            //4、设备类型名称            ----它由【设备类型的翻译ID】所决定,这个值是个人中心专用,
@@ -2538,12 +2573,20 @@
            this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir传感器220
            //=========★★安防类传感器类(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["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";//紧急按键
            //=========★★继电器类(2300-2499)★★=========
            this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3路继电器小模块