| | |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <param name="deviceBindType">1:新风;2:温度传感器;3:湿度传感器;4:PM2.5传感器;5:空调目标,6:地暖目标【暂时没做,因为没有该设备,后期增加】</param> |
| | | /// <param name="deviceBindType">1:新风;2:温度传感器;3:湿度传感器;4:PM2.5传感器;5:空调目标,6:地暖目标,7:Co2目标</param> |
| | | /// <param name="bindDev">绑定目标 </param> |
| | | public PaneTargetsBaseForm(CommonDevice device, CommonDevice bindDev, DeviceBind.BindInfo.BindType deviceBindType) |
| | | { |
| | |
| | | /// 3:湿度传感器 |
| | | /// 4:PM2.5传感器 |
| | | /// 5:空调目标 |
| | | /// 6:地暖目标【暂时没做,因为没有该设备,后期增加】 |
| | | /// 6:地暖目标 |
| | | /// 7:Co2目标 |
| | | /// </summary> |
| | | DeviceBind.BindInfo.BindType curDeviceBindType = 0; |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public Action<string> actionPMTarget = null; |
| | | /// <summary> |
| | | /// Co2绑定目标回调 |
| | | /// </summary> |
| | | public Action<string> actionCo2Target = null; |
| | | /// <summary> |
| | | /// Ac绑定目标回调 |
| | | /// </summary> |
| | | public Action<string> actionAcTarget = null; |
| | |
| | | case DeviceBind.BindInfo.BindType.Fh: |
| | | titleText = Language.StringByID(R.MyInternationalizationString.uFloorHeatingTarget); |
| | | break; |
| | | //case DeviceBind.BindInfo.BindType.CO2: |
| | | //titleText = Language.StringByID(R.MyInternationalizationString.CO2Source); |
| | | //break; |
| | | } |
| | | this.TopFrameLayout(this, titleText); |
| | | EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => |
| | |
| | | X = devicePic.Right + Application.GetRealWidth(20), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 15, |
| | | Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device), |
| | | Text = Common.LocalDevice.Current.GetDeviceEpointName(device), |
| | | }; |
| | | rowLayout.AddChidren(btnBindName); |
| | | |
| | |
| | | { |
| | | line2.Visible = false; |
| | | } |
| | | if (HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(device) == true) |
| | | if (Common.LocalDevice.Current.CheckDeviceIsOnline(device) == true) |
| | | { |
| | | btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.TextBlack; |
| | | } |
| | |
| | | { |
| | | btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; |
| | | } |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { device }); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case DeviceBind.BindInfo.BindType.FreshAir: |
| | |
| | | devicePic.UnSelectedImagePath = "Device/SensorTemperature.png"; |
| | | if (device.Type == DeviceType.PMSensor) |
| | | { |
| | | btnBindName.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.Humidity: |
| | | devicePic.UnSelectedImagePath = "Device/SensorHumidity.png"; |
| | | if (device.Type == DeviceType.PMSensor) |
| | | { |
| | | btnBindName.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.PM: |
| | | devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png"; |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.CO2: |
| | | devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png"; |
| | | break; |
| | | case DeviceBind.BindInfo.BindType.AC: |
| | |
| | | var mainKey = bindDev.BindMacAddr + bindDev.BindEpoint; |
| | | |
| | | //分配的目标列表 |
| | | if (HdlDeviceCommonLogic.Current.listAllDevice.Count != 0) |
| | | if (Shared.Common.LocalDevice.Current.listAllDevice.Count != 0) |
| | | { |
| | | var dev = currentPanelSupportBindDeviceList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey)); |
| | | if (dev != null) |
| | | { |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); |
| | | var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); |
| | | if (device != null) |
| | | { |
| | | BindTypeTargetsList(device, bindDev); |
| | |
| | | var dev = undistruibuteDevList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey)); |
| | | if (dev != null) |
| | | { |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); |
| | | var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); |
| | | if (device != null) |
| | | { |
| | | BindTypeTargetsList(device, bindDev); |
| | |
| | | foreach (var dev in targetList) |
| | | { |
| | | //获取本地设备列表 |
| | | var localDeviceList = HdlDeviceCommonLogic.Current.listAllDevice; |
| | | var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; |
| | | var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == dev.DeviceAddr && obj.DeviceEpoint == dev.DeviceEpoint); |
| | | if (tempDev != null) |
| | | { |
| | |
| | | else |
| | | { |
| | | curControlDev.currentSelectRoomId = "UndistributedId"; |
| | | //目标在未分配时,默认第一个楼层 |
| | | curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); |
| | | } |
| | | } |
| | | |
| | | if (canUpdateBindName) |
| | | { |
| | | //更新外面目标名字:具体名字【刷新本地界面会导致外部目标变化】 |
| | | string bindName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(dev); |
| | | string bindName = Common.LocalDevice.Current.GetDeviceEpointName(dev); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case BindInfo.BindType.Temperature: |
| | |
| | | { |
| | | bindName += "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | if (dev.Type == ZigBee.Device.DeviceType.TemperatureSensor) |
| | | { |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { dev }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | bindName += "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | } |
| | | break; |
| | | case BindInfo.BindType.Humidity: |
| | | if (dev.Type == DeviceType.PMSensor) |
| | | { |
| | | bindName += "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | if (dev.Type == ZigBee.Device.DeviceType.TemperatureSensor) |
| | | { |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { dev }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | bindName += "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | |
| | | case BindInfo.BindType.AC: |
| | | addBindInfo.BindCluster = 513; |
| | | break; |
| | | case BindInfo.BindType.CO2: |
| | | addBindInfo.BindCluster = 1037; |
| | | break; |
| | | } |
| | | addBindInfo.BindType = 0; |
| | | addBindInfo.BindMacAddr = de.DeviceAddr; |
| | | addBindInfo.BindEpoint = de.DeviceEpoint; |
| | | addBindeDev.BindName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(de); |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de); |
| | | |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { de }); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case BindInfo.BindType.Temperature: |
| | | if (de.Type == DeviceType.PMSensor) |
| | | { |
| | | addBindeDev.BindName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); |
| | | } |
| | | break; |
| | | case BindInfo.BindType.Humidity: |
| | | if (de.Type == DeviceType.PMSensor) |
| | | { |
| | | addBindeDev.BindName = HdlDeviceCommonLogic.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); |
| | | } |
| | | break; |
| | | } |
| | |
| | | /// <param name="bindDev"></param> |
| | | void BindTypeTargetsList(CommonDevice device, BindListResponseObj bindDev) |
| | | { |
| | | //获取设备类型的 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | switch (curDeviceBindType) |
| | | { |
| | | case BindInfo.BindType.FreshAir: |
| | | //获取设备类型的 |
| | | var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | |
| | | //新风面板的新风设备,则不显示 |
| | | if (deviceEnumInfo.ConcreteType != DeviceConcreteType.ButtonPanel_FangyueFreshAir) |
| | | if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) |
| | | { |
| | | if (device.Type == DeviceType.FreshAir) |
| | | { |
| | |
| | | var bDev = device as TemperatureSensor; |
| | | if (bDev.SensorDiv == 1) |
| | | { |
| | | oldTargetList.Add(device); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | if (bindDev.BindCluster == 1026) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | } |
| | | if (device.Type == DeviceType.PMSensor) |
| | |
| | | if (bDev.SensorDiv == 2) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | if (bindDev.BindCluster == 1029) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | } |
| | | if (device.Type == DeviceType.FreshAirHumiditySensor) |
| | |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | else if (device.Type == ZigBee.Device.DeviceType.TemperatureSensor) |
| | | { |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | if (bindDev.BindCluster == 1066) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case BindInfo.BindType.AC: |
| | | if (device.Type == DeviceType.Thermostat) |
| | |
| | | if (bindDev.BindCluster == 513) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | break; |
| | | case BindInfo.BindType.CO2: |
| | | if (device.Type == ZigBee.Device.DeviceType.TemperatureSensor) |
| | | { |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | if (bindDev.BindCluster == 1037) |
| | | { |
| | | oldTargetList.Add(device); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | |
| | | return; |
| | | } |
| | | //获取本地设备列表 |
| | | var localDeviceList = HdlDeviceCommonLogic.Current.listAllDevice; |
| | | var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; |
| | | var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == bindDev.DeviceAddr && obj.DeviceEpoint == bindDev.DeviceEpoint); |
| | | if (tempDev != null) |
| | | { |