| | |
| | | { |
| | | 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) |
| | | { |
| | | 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 = attriButeList[0].AttriButeData; |
| | | ac.currentSystemMode = attList.AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | |
| | | case 4099: |
| | | var value = Convert.ToString(attriButeList[0].AttriButeData, 2).PadLeft(16, '0'); |
| | | 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 = attriButeList[0].AttriButeData == 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) |
| | | { |
| | | switch (attList.AttributeId) |
| | | { |
| | | case 0: |
| | | ac.currentFanMode = attriButeList[0].AttriButeData; |
| | | ac.currentFanMode = attList.AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 4096: |
| | | ac.currentFanSwingMode = attriButeList[0].AttriButeData; |
| | | 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); |
| | | row.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | dimmableLight.LastDateTime = DateTime.Now; |
| | | } |
| | | if (common.DeviceStatusReport.CluterID == 8) |
| | | { |
| | | var dimmableLight = deviceUI.CommonDevice as DimmableLight; |
| | | dimmableLight.DeviceStatusReport = common.DeviceStatusReport; |
| | | dimmableLight.Level = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | var row = rowLayout.GetChildren(0) as CategoryFunctionRow; |
| | | row.SetStatu(dimmableLight.OnOffStatus == 1); |
| | | row.SetStatuText(deviceUI.GetDeviceStatu()); |
| | |
| | | functionBtn.Init(); |
| | | functionBtn.SetTitle(R.MyInternationalizationString.Function); |
| | | //自动化 |
| | | automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20, 34, 150, 68); |
| | | automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20+50, 34, 150, 68); |
| | | automationBtn.Init(); |
| | | automationBtn.SetTitle(R.MyInternationalizationString.Automation); |
| | | //隐藏自动化 |
| | |
| | | } |
| | | } |
| | | } |
| | | foreach (var deviceUI in sameTypeList) |
| | | for (int i=0;i<sameTypeList.Count;i++) |
| | | { |
| | | var deviceUI = sameTypeList[i]; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | //删除设备 |
| | | EventHandler<MouseEventArgs> delEvent = (delSender, delE) => |
| | | { |
| | | var alert = new CustomAlert(); |
| | | AddChidren(alert); |
| | | alert.Show(Language.StringByID(R.MyInternationalizationString.ConfirmDelete)); |
| | | alert.Show(Language.StringByID(R.MyInternationalizationString.DeleteFunction)); |
| | | alert.ResultEventHandler += (e2) => |
| | | { |
| | | if (e2) |
| | |
| | | { |
| | | //灯 |
| | | var light = deviceUI.CommonDevice as ToggleLight; |
| | | //补上非远程 |
| | | if (light.Gateway == null) |
| | | if (light.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (light.Gateway.IsVirtual) |
| | | { |
| | | UserHomeView.ReadStatus(light, () => |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | |
| | | 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; |
| | | //补上非远程 |
| | | if (airSwitch.Gateway == null) |
| | | var airSwitch = deviceUI.CommonDevice as AirSwitch; |
| | | if (airSwitch.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (airSwitch.Gateway.IsVirtual) |
| | | { |
| | | UserHomeView.ReadStatus(airSwitch, () => |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.DimmableLight) |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight) |
| | | { |
| | | //调光灯 |
| | | var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; |
| | | //补上非远程 |
| | | if (dimmableLight.Gateway == null) |
| | | if (dimmableLight.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (dimmableLight.Gateway.IsVirtual) |
| | | { |
| | | UserHomeView.ReadStatus(dimmableLight, () => |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | 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; |
| | | //补上非远程 |
| | | if (ac.Gateway == null) |
| | | if (ac.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (ac.Gateway.IsVirtual) |
| | | { |
| | | //发送读取状态命令 |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendACStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | |
| | | 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; |
| | | //不上非远程 |
| | | if (rollerShade.Gateway == null) |
| | | if (rollerShade.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (rollerShade.Gateway.IsVirtual) |
| | | { |
| | | UserHomeView.ReadStatus(rollerShade, () => |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | rollerShadeControl.Show(deviceUI, room); |
| | | }; |
| | | } |
| | | else if(deviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.DoorLock) |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock) |
| | | { |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | deviceRow.HideSwitchBtn(true); |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | |
| | | |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | }); |
| | | }) |
| | | { IsBackground=true}.Start(); |
| | | } |
| | | }; |
| | | |
| | | foreach (var deviceType in Common.Room.GetdeviceTypes(room)) |
| | |
| | | typeRowLayout.AddChidren(functionTypeIMG); |
| | | |
| | | functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction; |
| | | |
| | | |
| | | if (deviceType == room.DeviceUIList[0].CommonDevice.Type) |
| | | { |
| | |
| | | /// GetDelayScene |
| | | /// </summary> |
| | | /// <param name="scrolViewLayout"></param> |
| | | private void GetDelayScene(VerticalScrolViewLayout scrolViewLayout) |
| | | { |
| | | new System.Threading.Thread(async () => |
| | | private async void GetDelayScene(VerticalScrolViewLayout scrolViewLayout) |
| | | { |
| | | var catDelaySceneResponseAllData = await Scene.CatDelaySceneAsync(); |
| | | if (catDelaySceneResponseAllData == null) |
| | |
| | | } |
| | | var delayList = catDelaySceneResponseData.DelayScenesList; |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | for (int i = 0; scrolViewLayout != null && i < scrolViewLayout.ChildrenCount; i++) |
| | | { |
| | | var sceneView = scrolViewLayout.GetChildren(i) as SceneCategoryView; |
| | |
| | | if (delayScenesListResponseInfo.ScenesId == sceneView.scene.Id) |
| | | { |
| | | sceneView.scene.RemainTime = delayScenesListResponseInfo.RemainTime; |
| | | var remainTime= delayScenesListResponseInfo.RemainTime; |
| | | if (remainTime > 0) |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (sceneView.scene.RemainTime > 0) |
| | | while (remainTime-- > 0) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | sceneView.SetTimeText(CommonFormResouce.GetTimeString(sceneView.scene.RemainTime)); |
| | | sceneView.SetTimeText(CommonFormResouce.GetTimeString(remainTime)); |
| | | }); |
| | | sceneView.scene.RemainTime -= 1; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | sceneView.scene.RemainTime = 0; |
| | | sceneView.SetTimeImage(); |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |