| | |
| | | { |
| | | try |
| | | { |
| | | if (common.DeviceStatusReport.AttriBute == null || common.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | for (int i = 0; deviceListScrolView != null && i < deviceListScrolView.ChildrenCount; i++) |
| | | { |
| | | var rowLayout = deviceListScrolView.GetChildren(i) as RowLayout; |
| | |
| | | { |
| | | var light = deviceUI.CommonDevice as ToggleLight; |
| | | light.DeviceStatusReport = common.DeviceStatusReport; |
| | | if (light.DeviceStatusReport.AttriBute == null || light.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | continue; |
| | | } |
| | | light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | var row = rowLayout.GetChildren(0) as CategoryFunctionRow; |
| | | row.SetStatu(light.OnOffStatus == 1); |
| | |
| | | { |
| | | var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch; |
| | | airSwitch.DeviceStatusReport = common.DeviceStatusReport; |
| | | if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | var row = rowLayout.GetChildren(0) as CategoryFunctionRow; |
| | | row.SetStatu(airSwitch.OnOffStatus == 1); |
| | |
| | | if (common.DeviceStatusReport.CluterID == 513) |
| | | { |
| | | var attriButeList = common.DeviceStatusReport.AttriBute; |
| | | if (attriButeList == null || attriButeList.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | var ac = deviceUI.CommonDevice as ZigBee.Device.AC; |
| | | ac.DeviceStatusReport = common.DeviceStatusReport; |
| | | |
| | | var curTemp = (attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | switch (attriButeList[0].AttributeId) |
| | | foreach(var attList in attriButeList) |
| | | { |
| | | case 0: |
| | | ac.currentLocalTemperature = curTemp; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 17: |
| | | ac.currentCoolingSetpoint = curTemp; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 18: |
| | | ac.currentHeatingSetpoint = curTemp; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 4096: |
| | | ac.currentAutoSetpoint = curTemp; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 28: |
| | | //此属性描述恒温设备正处于哪种模式 |
| | | ac.currentSystemMode = attriButeList[0].AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 4099: |
| | | var value = Convert.ToString(attriButeList[0].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; |
| | | |
| | | case 4097: |
| | | //过虑网清洗标志:42 |
| | | ac.CleanStatu = attriButeList[0].AttriButeData == 42; |
| | | break; |
| | | 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.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 17: |
| | | ac.currentCoolingSetpoint = curTemp; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 18: |
| | | ac.currentHeatingSetpoint = curTemp; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 4096: |
| | | ac.currentAutoSetpoint = curTemp; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 28: |
| | | ac.currentSystemMode = attList.AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | 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; |
| | | case 4097: |
| | | //过虑网清洗标志:42 |
| | | ac.CleanStatu = attList.AttriButeData == 42; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | var row = rowLayout.GetChildren(0) as CategoryFunctionRow; |
| | | row.SetStatu(ac.currentSystemMode != 0); |
| | | row.SetStatuText(deviceUI.GetDeviceStatu()); |
| | |
| | | { |
| | | var ac = deviceUI.CommonDevice as ZigBee.Device.AC; |
| | | var attriButeList = common.DeviceStatusReport.AttriBute; |
| | | if (attriButeList == null || attriButeList.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | ac.DeviceStatusReport = common.DeviceStatusReport; |
| | | switch (attriButeList[0].AttributeId) |
| | | foreach(var attList in attriButeList) |
| | | { |
| | | case 0: |
| | | ac.currentFanMode = attriButeList[0].AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 4096: |
| | | ac.currentFanSwingMode = attriButeList[0].AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | switch (attList.AttributeId) |
| | | { |
| | | case 0: |
| | | ac.currentFanMode = attList.AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 4096: |
| | | ac.currentFanSwingMode = attList.AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | } |
| | | } |
| | | var row = rowLayout.GetChildren(0) as CategoryFunctionRow; |
| | | row.SetStatu(ac.currentSystemMode != 0); |
| | |
| | | { |
| | | var dimmableLight = deviceUI.CommonDevice as DimmableLight; |
| | | dimmableLight.DeviceStatusReport = common.DeviceStatusReport; |
| | | if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | continue; |
| | | } |
| | | dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | var row = rowLayout.GetChildren(0) as CategoryFunctionRow; |
| | | row.SetStatu(dimmableLight.OnOffStatus == 1); |
| | |
| | | { |
| | | var dimmableLight = deviceUI.CommonDevice as DimmableLight; |
| | | dimmableLight.DeviceStatusReport = common.DeviceStatusReport; |
| | | if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | continue; |
| | | } |
| | | dimmableLight.Level = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | var row = rowLayout.GetChildren(0) as CategoryFunctionRow; |
| | | row.SetStatu(dimmableLight.OnOffStatus == 1); |
| | |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.AirSwitch) |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.AirSwitch) |
| | | { |
| | | //空气开关 |
| | | var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch; |
| | |
| | | } |
| | | |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.DimmableLight) |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight) |
| | | { |
| | | //调光灯 |
| | | var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; |
| | |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.Thermostat) |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.Thermostat) |
| | | { |
| | | //空调 |
| | | var ac = deviceUI.CommonDevice as ZigBee.Device.AC; |
| | |
| | | acControl.Show(deviceUI, room); |
| | | }; |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.WindowCoveringDevice) |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.WindowCoveringDevice) |
| | | { |
| | | //卷帘 |
| | | var rollerShade = deviceUI.CommonDevice as ZigBee.Device.Rollershade; |
| | |
| | | rollerShadeControl.Show(deviceUI, room); |
| | | }; |
| | | } |
| | | else if(deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.DoorLock) |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock) |
| | | { |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | typeRowLayout.AddChidren(functionTypeIMG); |
| | | |
| | | functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction; |
| | | |
| | | |
| | | if (deviceType == room.DeviceUIList[0].CommonDevice.Type) |
| | | { |