黄学彪
2019-10-10 2ed75b8b337048e5d75e6d9ec8307633134f02fd
ZigbeeApp/Shared/Common/Device.cs
@@ -279,11 +279,10 @@
                        dName += "(" + device.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + ")";
                    }
                    new System.Threading.Thread(async () =>
                    {
                    HdlThreadLogic.Current.RunThread(async () =>
                    {
                        await this.ReName(device, dName, ShowErrorMode.NO);
                    })
                    { IsBackground = true }.Start();
                    });
                }
            }
@@ -996,6 +995,11 @@
                    return;
                }
                imageFilePath = "RealDevice/" + arry[0] + ".png";
                //如果它自己的共通图片还是不存在的话,则直接使用所有设备的共通图片
                if (string.IsNullOrEmpty(IO.FileUtils.GetImageFilePath(imageFilePath)) == true)
                {
                    imageFilePath = "RealDevice/CommonDevice.png";
                }
            }
            btnIcon.UnSelectedImagePath = imageFilePath;
        }
@@ -1319,13 +1323,57 @@
                info.BeloneType = DeviceBeloneType.A智能门锁;
                info.ConcreteType = DeviceConcreteType.IntelligentLocks;
            }
            //2包含传感器的话,当传感器处理
            //12包含传感器的话,当传感器处理
            else if (dicType.ContainsKey(DeviceType.IASZone) == true)
            {
                //设置传感器具体的类型
                info.BeloneType = DeviceBeloneType.A传感器;
                this.SetSensorDeviceSpecificType(ref info, listdevice);
            }
            //13包含温度传感器的话
            else if (dicType.ContainsKey(DeviceType.TemperatureSensor) == true)
            {
                bool temperatrue = false;
                bool humidity = false;
                foreach (var device in listdevice)
                {
                    if (device is TemperatureSensor)
                    {
                        //温度传感器
                        if (((TemperatureSensor)device).SensorDiv == 1)
                        {
                            temperatrue = true;
                        }
                        //湿度传感器
                        else if(((TemperatureSensor)device).SensorDiv == 2)
                        {
                            humidity = true;
                        }
                    }
                }
                if (temperatrue == true && humidity == true)
                {
                    //设置传感器具体的类型
                    info.BeloneType = DeviceBeloneType.A温湿度传感器;
                    info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId10;
                    info.ConcreteType = DeviceConcreteType.Sensor_TemperatrueHumidity;
                }
                else if (temperatrue == true && humidity == false)
                {
                    //设置传感器具体的类型
                    info.BeloneType = DeviceBeloneType.A温度传感器;
                    info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId11;
                    info.ConcreteType = DeviceConcreteType.Sensor_Temperatrue;
                }
                else if (temperatrue == false && humidity == true)
                {
                    //设置传感器具体的类型
                    info.BeloneType = DeviceBeloneType.A湿度传感器;
                    info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId12;
                    info.ConcreteType = DeviceConcreteType.Sensor_Humidity;
                }
            }
            int value = (int)info.BeloneType;
            if (dicDeviceDefultNameID.ContainsKey("uDeviceBelongId" + value) == true)
            {
@@ -1809,6 +1857,23 @@
            mainDevice.OutClusterList.AddRange(device.DeviceInfo.OutClusterList);
            mainDevice.AttributeStatus.Clear();
            mainDevice.AttributeStatus.AddRange(device.DeviceInfo.AttributeStatus);
            //如果是温度传感器
            if (mainDevice is TemperatureSensor)
            {
                //输出族 1026:温度传感器 1029:湿度传感器
                foreach (var data in mainDevice.OutClusterList)
                {
                    if (data.OutCluster == 1029)
                    {
                        ((TemperatureSensor)mainDevice).SensorDiv = 2;
                    }
                    else if (data.OutCluster == 1026)
                    {
                        ((TemperatureSensor)mainDevice).SensorDiv = 1;
                    }
                }
            }
        }
        /// <summary>
@@ -1831,6 +1896,7 @@
            else if (deviceType == DeviceType.Repeater) { device = new Repeater(); }
            else if (deviceType == DeviceType.Thermostat) { device = new AC(); }
            else if (deviceType == DeviceType.DoorLock) { device = new DoorLock(); }
            else if (deviceType == DeviceType.TemperatureSensor) { device = new TemperatureSensor(); }
            else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); }
            else { return null; }