| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action<DeviceUI, Common.Room> action; |
| | | public Action<CommonDevice, Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// 收藏按钮 |
| | |
| | | /// <summary> |
| | | /// 传过来的设备 |
| | | /// </summary> |
| | | private DeviceUI device; |
| | | private CommonDevice device; |
| | | /// <summary> |
| | | /// 传过来的房间 |
| | | /// </summary> |
| | |
| | | #endregion |
| | | |
| | | #region ◆ 接口___________________________ |
| | | /// <summary> |
| | | /// 处理变化事件 --将弃用 改用DeviceInfoChange() |
| | | /// </summary> |
| | | /// <returns>The changed.</returns> |
| | | /// <param name="common">Common.</param> |
| | | public void Changed(CommonDevice common) |
| | | { |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 设备状态更新接口 |
| | | /// <para>type:如果为 DeviceInComingRespon:设备新上报</para> |
| | |
| | | try |
| | | { |
| | | var deviceUI = device; |
| | | if (deviceUI.CommonDevice == null) |
| | | if (deviceUI == null) |
| | | { |
| | | return; |
| | | } |
| | | if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) |
| | | if (deviceUI.DeviceEpoint != common.DeviceEpoint || deviceUI.DeviceAddr != common.DeviceAddr) |
| | | { |
| | | return; |
| | | } |
| | |
| | | { |
| | | return; |
| | | } |
| | | deviceUI.CommonDevice.DeviceStatusReport = common.DeviceStatusReport; |
| | | deviceUI.DeviceStatusReport = common.DeviceStatusReport; |
| | | foreach(var attList in attriButeList) |
| | | { |
| | | var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High && attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | switch (attList.AttributeId) |
| | | { |
| | | case 0: |
| | | ac.currentLocalTemperature = curTemp; |
| | | ac.currentLocalTemperature = attList.AttriButeData / 100; |
| | | ac.LastDateTime = DateTime.Now; |
| | | indoorTemperatureBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {ac.currentLocalTemperature} ℃"; |
| | | //currentTemperatureBtn.Text = $"{ac.currentLocalTemperature} ℃"; |
| | | break; |
| | | case 17: |
| | | ac.currentCoolingSetpoint = curTemp; |
| | | ac.currentCoolingSetpoint = attList.AttriButeData / 100; |
| | | if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) |
| | | { |
| | | mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint; |
| | |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 18: |
| | | ac.currentHeatingSetpoint = curTemp; |
| | | ac.currentHeatingSetpoint = attList.AttriButeData / 100; |
| | | if (ac.currentSystemMode == 4) |
| | | { |
| | | mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint; |
| | |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 4096: |
| | | ac.currentAutoSetpoint = curTemp; |
| | | ac.currentAutoSetpoint = attList.AttriButeData / 100; |
| | | if (ac.currentSystemMode == 1) |
| | | { |
| | | mArcScaleSeekBar.Progress = ac.currentAutoSetpoint; |
| | |
| | | fanModeBtn.IsSelected = false; |
| | | FanSwingModeBtn.IsSelected = false; |
| | | mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); |
| | | //如果是关闭空调的话,直接变暗即可 |
| | | return; |
| | | } |
| | | else if (ac.currentSystemMode == 1 || ac.currentSystemMode == 3 || ac.currentSystemMode == 4 || ac.currentSystemMode == 7 || ac.currentSystemMode == 8) |
| | | { |
| | |
| | | //过虑网清洗标志:42 |
| | | ac.CleanStatu = attList.AttriButeData == 42; |
| | | cleanStatu.Visible = ac.CleanStatu; |
| | | break; |
| | | case 4099: |
| | | var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0'); |
| | | var modeStr = value.Substring(value.Length - 5, 5); |
| | | for (int j = 0; j < modeStr.Length; j++) |
| | | { |
| | | ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | |
| | | { |
| | | var deviceUI = device; |
| | | //设备为空 |
| | | if (deviceUI.CommonDevice == null) |
| | | if (deviceUI == null) |
| | | { |
| | | return; |
| | | } |
| | | //是否为当前设备 |
| | | if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) |
| | | if (deviceUI.DeviceEpoint != common.DeviceEpoint || deviceUI.DeviceAddr != common.DeviceAddr) |
| | | { |
| | | return; |
| | | } |
| | | if (deviceUI.CommonDevice.Type == DeviceType.Thermostat) |
| | | if (deviceUI.Type == DeviceType.Thermostat) |
| | | { |
| | | ac.IsOnline = common.IsOnline; |
| | | ac.LastDateTime = DateTime.Now; |
| | |
| | | }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// Changeds the IL ogic status. |
| | | /// </summary> |
| | | /// <param name="logic">Logic.</param> |
| | | public void ChangedILogicStatus(ZigBee.Device.Logic logic) |
| | | { |
| | | //throw new NotImplementedException(); |
| | | } |
| | | /// <summary> |
| | | /// Changeds the IS cene status. |
| | | /// </summary> |
| | | /// <param name="scene">Scene.</param> |
| | | public void ChangedISceneStatus(Scene scene) |
| | | { |
| | | //throw new NotImplementedException(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 构造方法________________________ |
| | |
| | | /// </summary> |
| | | /// <param name="dev">Device.</param> |
| | | /// <param name="room">Room.</param> |
| | | public void Show(DeviceUI dev, Shared.Common.Room room) |
| | | public void Show(CommonDevice dev, Shared.Common.Room room) |
| | | { |
| | | device = dev; |
| | | zbGateway = this.device.CommonDevice.Gateway; |
| | | zbGateway = this.device.Gateway; |
| | | this.room = room; |
| | | this.ac = device.CommonDevice as ZigBee.Device.AC; |
| | | this.ac = device as ZigBee.Device.AC; |
| | | AddTop(); |
| | | |
| | | AddBodyView(device); |
| | |
| | | //发送读取状态命令 |
| | | UserView.UserHomeView.ReadStatus(ac, () => |
| | | { |
| | | ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendACStatuComand(device); |
| | | }); |
| | | } |
| | | else |
| | |
| | | //防止短时间内多次读取设备状态 |
| | | if ((DateTime.Now - ac.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) |
| | | { |
| | | ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendACStatuComand(device); |
| | | } |
| | | } |
| | | |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName)==false) |
| | | if (UserCenter.HdlRoomLogic.Current.IsCollectInRoom(device)==false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | /// <summary> |
| | | /// AddBodyView |
| | | /// </summary> |
| | | public void AddBodyView(DeviceUI device) |
| | | public void AddBodyView(CommonDevice device) |
| | | { |
| | | bodyFrameLayout = new FrameLayout() |
| | | { |
| | |
| | | Width = Application.GetRealWidth(600), |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = device.CommonDevice.DeviceEpointName, |
| | | Text = Common.LocalDevice.Current.GetDeviceEpointName(device), |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 15, |
| | | IsBold=true |
| | |
| | | SelectedImagePath = ACControlBase.GetFanSwingModeSelectedImagePathByFanSwingModeId(ac.currentFanSwingMode), |
| | | IsSelected = ACControlBase.IsOpen(ac) |
| | | }; |
| | | itemView.AddChidren(FanSwingModeBtn); |
| | | |
| | | modeBtn = new Button() |
| | | { |
| | |
| | | IsSelected = ACControlBase.IsOpen(ac) |
| | | }; |
| | | itemView.AddChidren(fanModeBtn); |
| | | |
| | | if (ac.UseSwingFunction) |
| | | { |
| | | itemView.AddChidren(FanSwingModeBtn); |
| | | } |
| | | else |
| | | { |
| | | modeBtn.X = Application.GetRealWidth(207); |
| | | switchBtn.X = Application.GetRealWidth(444); |
| | | fanModeBtn.X = Application.GetRealWidth(677); |
| | | } |
| | | |
| | | |
| | | var roomBG = new Button |
| | | { |
| | |
| | | ACControlBase.ShowACIsCloseTip(); |
| | | return; |
| | | } |
| | | modeBtn.IsSelected = true; |
| | | |
| | | modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByMode(acMode); |
| | | modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByMode(acMode); |
| | | modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByMode(acMode);
|
| | | modeBtn.IsSelected = true; |
| | | currentModeBtn.Text = ACControlBase.GetModeNameByMode(acMode); |
| | | ac.currentSystemMode = (int)acMode; |
| | | mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac); |
| | |
| | | return; |
| | | } |
| | | var tempDevice = (CommonDevice)objValue; |
| | | if (tempDevice.DeviceEpoint != this.device.CommonDevice.DeviceEpoint || tempDevice.DeviceAddr != this.device.CommonDevice.DeviceAddr) |
| | | if (tempDevice.DeviceEpoint != this.device.DeviceEpoint || tempDevice.DeviceAddr != this.device.DeviceAddr) |
| | | { |
| | | //不是当前设备的推送,则不处理 |
| | | return; |
| | |
| | | { |
| | | if (collectionBtn.IsSelected) |
| | | { |
| | | Shared.Common.Room.Lists[0].DeleteDevice(device.FileName); |
| | | UserCenter.HdlRoomLogic.Current.DeleteLoveDevice(device); |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | Shared.Common.Room.Lists[0].AddDevice(device.FileName); |
| | | UserCenter.HdlRoomLogic.Current.AddLoveDevice(device); |
| | | collectionBtn.IsSelected = true; |
| | | } |
| | | } |