ZigbeeApp/Home.Ios/Home.IOS.csproj
@@ -108,6 +108,7 @@ </ItemGroup> <ItemGroup> <Folder Include="Resources\" /> <Folder Include="Resources\Phone\FreshAir\" /> </ItemGroup> <ItemGroup> <InterfaceDefinition Include="LaunchScreen.storyboard" /> @@ -1009,6 +1010,11 @@ <BundleResource Include="Resources\Phone\Gateway\WiredGateway.png" /> <BundleResource Include="Resources\Phone\Gateway\WirelessGateway.png" /> <BundleResource Include="Resources\Phone\Gateway\AddGatewaySuccess.png" /> <BundleResource Include="Resources\Phone\FreshAir\FreshAirPic.png" /> <BundleResource Include="Resources\Phone\Device\FreshAirEpoint.png" /> <BundleResource Include="Resources\Phone\Device\FreshAirEpointSelected.png" /> <BundleResource Include="Resources\Phone\Device\FreshAirEpointSelected2.png" /> <BundleResource Include="Resources\Phone\FreshAir\FreshAirRealDevicePic.png" /> </ItemGroup> <Import Project="..\Shared\Shared.projitems" Label="Shared" Condition="Exists('..\Shared\Shared.projitems')" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> ZigbeeApp/Home.Ios/Resources/Language.ini
@@ -313,6 +313,7 @@ 308=警告!时效性常开删除失败。 309=时效性常开删除失败,继续“常开模式”请前往门锁用户界面设置; 310=请输入合法的数字 311=手动 5097=取消 5098=确定 @@ -1951,6 +1952,7 @@ 40015=插座 40016=灯光 40017=干接点 40018=新风 ;★★★★下面这些是模块ID的设备默认备注名字,从50000开始.注:它并不需要再R.cs文件中定义★★★★ 50000=紧急按钮 ZigbeeApp/Home.Ios/Resources/Phone/Device/FreshAirEpoint.png
ZigbeeApp/Home.Ios/Resources/Phone/Device/FreshAirEpointSelected.png
ZigbeeApp/Home.Ios/Resources/Phone/Device/FreshAirEpointSelected2.png
ZigbeeApp/Home.Ios/Resources/Phone/FreshAir/FreshAirPic.png
ZigbeeApp/Home.Ios/Resources/Phone/FreshAir/FreshAirRealDevicePic.png
ZigbeeApp/Shared/Common/Device.cs
@@ -1770,7 +1770,7 @@ //14新风设备 else if (dicType.ContainsKey(DeviceType.FreshAir) == true) { info.ConcreteTextId = R.MyInternationalizationString.DeviceModelId2310; info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId2310; info.BeloneType = DeviceBeloneType.A新风; info.ConcreteType = DeviceConcreteType.Relay_FangyueFreshAirModul; info.ObjectTypeNameId = 60011;//新风 @@ -2024,14 +2024,14 @@ list.Add(DeviceBeloneType.A插座); list.Add(DeviceBeloneType.A调光器); list.Add(DeviceBeloneType.A窗帘); list.Add(DeviceBeloneType.A新风); list.Add(DeviceBeloneType.A空调); list.Add(DeviceBeloneType.A继电器); list.Add(DeviceBeloneType.A干接点); list.Add(DeviceBeloneType.A智能门锁); list.Add(DeviceBeloneType.A智能空开); list.Add(DeviceBeloneType.A传感器); //其他的看着办呗,都是排在后面的,都归为这个属性 list.Add(DeviceBeloneType.A传感器); //其他的看着办呗,都是排在后面的,都归为这个属性 list.Add(DeviceBeloneType.A未知设备); return list; @@ -2509,7 +2509,10 @@ else if (deviceType == DeviceType.FreshAir) { device = new FreshAir(); } else if (deviceType == DeviceType.DoorLock) { device = new DoorLock(); } else if (deviceType == DeviceType.TemperatureSensor) { device = new TemperatureSensor(); } else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); } else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); } else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); } else { return null; } @@ -2648,13 +2651,12 @@ this.dicDeviceModelIdChanged["MULTI-FIRE--EA05"] = "MSS01/M-ZB.10";//烟雾传感器 this.dicDeviceModelIdChanged["MULTI-MOTI--EA04"] = "MSPIR01/M-ZB.10";//红外传感器 this.dicDeviceModelIdChanged["MULTI-WATE--EA02"] = "MSW01/M-ZB.10";//水浸传感器 this.dicDeviceModelIdChanged["MULTI-BURO--EA06"] = "MBU01/M-ZB.10";//紧急按键 //✩✩✩✩✩需要共有的图片对象✩✩✩✩✩ //两者都是DeviceConcreteType //Keys:指定的设备 value:沿用的图片是哪款设备的 this.dicDeviceModelIdChanged["MULTI-BURO--EA06"] = "MBU01/M-ZB.10";//紧急按键 //✩✩✩✩✩需要共有的图片对象✩✩✩✩✩ //两者都是DeviceConcreteType //Keys:指定的设备 value:沿用的图片是哪款设备的 this.dicPictrueShard = new Dictionary<string, string>(); this.dicPictrueShard["ButtonPanel_SimpleFour"] = "ButtonPanel_Four";//简约4按键面板 沿用 4按键的图标 this.dicPictrueShard["ButtonPanel_SimpleThree"] = "ButtonPanel_Three";//简约3按键面板 沿用 3按键的图标 @@ -2822,6 +2824,11 @@ /// </summary> Sensor_Humidity = -1310, /// <summary> /// PM2.5传感器 /// </summary> Sensor_PM = -1311, //=========★★继电器类(2300-2499)★★========= /// <summary> /// 继电器 @@ -2946,7 +2953,7 @@ /// <summary> /// 按键面板(200-1199) /// </summary> A按键面板 = 200, A按键面板 = 200, /// <summary> /// 传感器(1200-2299) /// </summary> @@ -2954,7 +2961,11 @@ /// <summary> /// 继电器(2300-2499) /// </summary> A继电器 = 2300, A继电器 = 2300, /// <summary> /// 新风 /// </summary> A新风 = 2310, /// <summary> /// 调光器(2500-2799) /// </summary> @@ -3011,10 +3022,6 @@ /// 干接点 /// </summary> A干接点 = 16, /// <summary> /// 新风 /// </summary> A新风 = 17 } #endregion ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs
@@ -525,8 +525,8 @@ } // 新风 else if (device.Type == DeviceType.FreshAir) { cardContr = new Controls.DeviceAcRowControl(listView.rowSpace / 2); { cardContr = new Controls.DeviceFreshAirRowControl(listView.rowSpace / 2); } //彩灯(调光器) else if (device.Type == DeviceType.DimmableLight) @@ -780,6 +780,11 @@ //空调是特殊的,它的开关是属性上报来着.已经接收到网关的反馈 this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu(); } if (report.DeviceStatusReport.CluterID == 514 && report.DeviceStatusReport.AttriBute[0].AttributeId == 0) { //新风是特殊的,它的开关是属性上报来着.已经接收到网关的反馈 this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu(); } this.dicDeviceRowControl[mainKeys].RefreshControlInfo(locadevice); } }, ShowErrorMode.NO); @@ -886,6 +891,11 @@ LocalDevice.Current.GetDeviceObjectIcon(typeInfo.ConcreteType, ref path1, ref path2); dic[typeInfo.BeloneTextId].IconPath = path1; dic[typeInfo.BeloneTextId].IconPathSelected = path2; if (device.Type == DeviceType.FreshAir) { dic[typeInfo.BeloneTextId].IconPath = "Device/FreshAirEpoint.png"; dic[typeInfo.BeloneTextId].IconPathSelected = "Device/FreshAirEpointSelected.png"; } dic[typeInfo.BeloneTextId].TextId = typeInfo.BeloneTextId; } dic[typeInfo.BeloneTextId].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device)); ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceFreshAirRowControl.cs
New file @@ -0,0 +1,105 @@ using System; using Shared.Phone.UserCenter; using ZigBee.Device; namespace Shared.Phone.Category.Controls { /// <summary> /// 分类界面的新风设备行控件 /// </summary> public class DeviceFreshAirRowControl : DeviceRowCommon { /// <summary> /// 分类界面的新风设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceFreshAirRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { } /// <summary> /// 初始化控件 /// </summary> /// <param name="i_device"></param> public override void InitControl(CommonDevice i_device) { base.InitControl(i_device); //添加跳转深度卡片信息事件 this.AddDetailInfoEvent(i_device); //添加开关控件 var btnSwitch = this.AddSwitchControl(); btnSwitch.ButtonClickEvent += (sender, e) => { bool setStatu = !btnSwitch.IsSelected; //变更卡片状态 this.SetRowOpenStatu(setStatu); //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息 this.StartCheckResponeResult(!setStatu); if (setStatu == true) { //打开 this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); (i_device as FreshAir).Open(); } else { //关闭 this.SetDeviceStatuText(Language.StringByID(R.MyInternationalizationString.Close)); (i_device as FreshAir).Close(); } }; } #region ■ 深度卡片信息_______________________ /// <summary> /// 添加跳转深度卡片信息事件 /// </summary> private void AddDetailInfoEvent(CommonDevice i_device) { //深度卡片信息 this.frameTable.ButtonClickEvent += (sender, e) => { //新风类型的深度卡片界面 var form = new MainPage.ControlForm.DeviceFreshAirDetailCardForm(); form.AddForm(i_device, HdlRoomLogic.Current.CurrentRoom, 965, 1374); form.FormCloseEvent += this.CardDetailInfoBackEvent; }; } #endregion #region ■ 检测设备打开状态___________________ /// <summary> /// 检测设备打开状态 /// </summary> /// <param name="i_device"></param> /// <returns></returns> public override bool CheckIsOpenStatu(CommonDevice i_device) { return ((FreshAir)i_device).currentFanStatus != 0; } #endregion #region ■ 发送获取状态命令___________________ /// <summary> /// 发送获取状态命令 /// </summary> public override void SendStatuComand() { //检测能否发送获取状态命令 if (this.CheckCanSendStatuComand() == true) { Device.DeviceLogic.ReadDeviceAttributeLogic.Instance.SendFreshAirStatuComand(this.device); } } #endregion } } ZigbeeApp/Shared/Phone/Device/DeviceLogic/ReadDeviceAttributeLogic.csold mode 100755 new mode 100644
@@ -17,7 +17,7 @@ { get { if(_instance == null) if (_instance == null) { _instance = new ReadDeviceAttributeLogic(); } @@ -27,6 +27,56 @@ #endregion #region ◆ 新风____________________________ /// <summary> /// SendFreshAirStatuComand /// </summary> /// <param name="device">设备</param> public void SendFreshAirStatuComand(CommonDevice device) { if (device == null) { return; } new System.Threading.Thread(() => { SendFreshAirFanStatuComand(device); System.Threading.Thread.Sleep(300); }) { IsBackground = true }.Start(); } /// <summary> /// SendFanStatuComand /// </summary> /// <param name="device">设备</param> private void SendFreshAirFanStatuComand(CommonDevice device) { if (device == null) { return; } var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr",device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", (int)Cluster_ID.FanControl }, { "Command", 108 } }; var attriBute = new Newtonsoft.Json.Linq.JArray { new Newtonsoft.Json.Linq.JObject { { "AttriButeId", (int)AttriButeId.FanMode} } }; var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } }; jObject.Add("Data", data); device.Gateway?.Send("GetDeviceStatus", jObject.ToString()); } #endregion #region ◆ 空调____________________________ /// <summary> ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceAcDetailCardForm.csold mode 100755 new mode 100644
@@ -13,8 +13,7 @@ /// </summary> public class DeviceAcDetailCardForm : DeviceDetailCardCommonForm { #region ■ 变量声明___________________________ #region ■ 变量声明___________________________ /// <summary> /// 界面上可以操作的控件 /// </summary> @@ -67,7 +66,7 @@ public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) { //左滑不能 this.ScrollEnabled = false; this.ScrollEnabled = true; this.deviceAc = (AC)this.device; //先清空 this.listControl = new List<ButtonBase>(); ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs
New file @@ -0,0 +1,322 @@ using System; using System.Collections.Generic; using Shared.Common; using Shared.Phone.UserCenter; using ZigBee.Device; namespace Shared.Phone.MainPage.ControlForm { /// <summary> /// 新风类型的深度卡片界面 /// </summary> public class DeviceFreshAirDetailCardForm : DeviceDetailCardCommonForm { #region ■ 变量声明___________________________ /// <summary> /// 界面上可以操作的控件 /// </summary> private List<ButtonBase> listControl = new List<ButtonBase>(); /// <summary> /// 控件 /// </summary> private FreshAir FreshAirDev = null; /// <summary> /// 状态控件 /// </summary> private NormalViewControl btnStatu = null; /// <summary> /// 当前的文本 /// </summary> private string CurrentText = string.Empty; /// <summary> /// 设备名称控件 /// </summary> private NormalViewControl btnDeviceName = null; #endregion #region ■ 初始化_____________________________ public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) { //左滑不能 this.ScrollEnabled = true; this.FreshAirDev = (FreshAir)this.device; //先清空 this.listControl = new List<ButtonBase>(); InitFreshAirControl(frameWhiteBack); UpdateStatus(); } /// <summary> /// 初始化新风控件 /// </summary> /// <param name="frameWhiteBack"></param> private void InitFreshAirControl(FrameLayout frameWhiteBack) { //新风控件的容器 var frameAcBack = new FrameLayout(); frameAcBack.Y = Application.GetRealHeight(262); frameAcBack.Width = Application.GetMinRealAverage(444); frameAcBack.Height = Application.GetMinRealAverage(444); frameAcBack.Gravity = Gravity.CenterHorizontal; frameAcBack.BackgroundImagePath = "FreshAir/FreshAirPic.png"; frameWhiteBack.AddChidren(frameAcBack); // 自动(第1个,listControl【0】) var btnAuto = new NormalViewControl(213, 63, true); btnAuto.X = Application.GetRealWidth(275); btnAuto.Y = Application.GetRealHeight(821); btnAuto.TextID = R.MyInternationalizationString.Mode_Auto; btnAuto.TextColor = ZigbeeColor.Current.XMGray3; btnAuto.IsBold = false; btnAuto.TextAlignment = TextAlignment.Center; frameWhiteBack.AddChidren(btnAuto); this.listControl.Add(btnAuto); btnAuto.ButtonClickEvent += (sender, e) => { if (!btnAuto.IsSelected) { this.SetFanComand(5); } }; //自动下划线(第2个,listControl【1】) var btnAutoLine = new NormalViewControl(72, 12, true); btnAutoLine.X = Application.GetRealWidth(346); btnAutoLine.Y = Application.GetRealHeight(896); btnAutoLine.BackgroundColor = ZigbeeColor.Current.XMOrange; btnAutoLine.Visible = false; frameWhiteBack.AddChidren(btnAutoLine); this.listControl.Add(btnAutoLine); //手动(第3个,listControl【2】) var btnManual = new NormalViewControl(213, 63, true); btnManual.X = Application.GetRealWidth(488); btnManual.Y = btnAuto.Y; btnManual.TextID = R.MyInternationalizationString.Manual; btnManual.TextColor = ZigbeeColor.Current.XMGray3; btnManual.IsBold = false; btnManual.TextAlignment = TextAlignment.Center; frameWhiteBack.AddChidren(btnManual); this.listControl.Add(btnManual); btnManual.ButtonClickEvent += (sender, e) => { if (!btnManual.IsSelected) { this.SetFanComand(7); } }; //手动下划线(第4个,listControl【3】) var btnManualLine = new NormalViewControl(72, 12, true); btnManualLine.X = Application.GetRealWidth(560); btnManualLine.BackgroundColor = ZigbeeColor.Current.XMOrange; btnManualLine.Y = btnAutoLine.Y; btnManualLine.Visible = false; frameWhiteBack.AddChidren(btnManualLine); this.listControl.Add(btnManualLine); //高风(第5个,listControl【4】) var btnHighSpeed = new IconViewControl(81); btnHighSpeed.X = Application.GetRealWidth(207); btnHighSpeed.Y = Application.GetRealHeight(999); btnHighSpeed.UnSelectedImagePath = "AC/Fan_Height.png"; btnHighSpeed.SelectedImagePath = "AC/Fan_HeightSelected.png"; frameWhiteBack.AddChidren(btnHighSpeed); this.listControl.Add(btnHighSpeed); btnHighSpeed.ButtonClickEvent += (sender, e) => { if (!btnHighSpeed.IsSelected) { this.SetFanComand(3); } }; //开关(第6个,listControl【5】) var btnSwitch = new IconViewControl(81); btnSwitch.X = Application.GetRealWidth(444); btnSwitch.Y = btnHighSpeed.Y; btnSwitch.UnSelectedImagePath = "AC/OpenOrClose.png"; btnSwitch.SelectedImagePath = "AC/OpenOrCloseSelected.png"; frameWhiteBack.AddChidren(btnSwitch); this.listControl.Add(btnSwitch); btnSwitch.ButtonClickEvent += (sender, e) => { btnSwitch.IsSelected = !btnSwitch.IsSelected; if (btnSwitch.IsSelected) { this.SetFanComand(4); } else { this.SetFanComand(0); } }; //低风(第7个,listControl【6】) var btnLowSpeed = new IconViewControl(81); btnLowSpeed.X = Application.GetRealWidth(677); btnLowSpeed.Y = btnHighSpeed.Y; btnLowSpeed.UnSelectedImagePath = "AC/Fan_Low.png"; btnLowSpeed.SelectedImagePath = "AC/Fan_LowSelected.png"; frameWhiteBack.AddChidren(btnLowSpeed); this.listControl.Add(btnLowSpeed); btnLowSpeed.ButtonClickEvent += (sender, e) => { if (!btnLowSpeed.IsSelected) { this.SetFanComand(1); } }; } #endregion #region ■ 是否获取网关反馈的结果_____________ /// <summary> /// 检测网关的反馈结果(属性上报的对象:device.DeviceStatusReport) /// </summary> /// <param name="comandDiv">命令区分</param> /// <param name="report">上报数据</param> /// <returns></returns> public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report) { if (comandDiv == ReceiveComandDiv.A设备属性上报) { if (report.DeviceStatusReport.CluterID == 514) { var attriButeList = report.DeviceStatusReport.AttriBute; foreach (var attList in attriButeList) { if (attList.AttributeId == 0) { //风速 HdlThreadLogic.Current.RunMain(() => { UpdateStatus(); }); //已经接收到网关的反馈 return true; } } } } return false; } #endregion #region ■ 设置方法 /// <summary> ///命令 ///0:Off ///1:Low ///3:High ///4:On ///5:Auto /// 7:Manual /// </summary> private void SetFanComand(int command) { //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息 this.StartCheckResponeResult(this.listControl, (result) => { //接收到网关回复 if (result == true) { } }); switch (command) { case 0: FreshAirDev.Close(); break; case 1: FreshAirDev.SetLowSpeed(); break; case 3: FreshAirDev.SetHighSpeed(); break; case 4: FreshAirDev.Open(); break; case 5: FreshAirDev.SetAuto(); break; case 7: FreshAirDev.SetManual(); break; } } #endregion #region ■ 刷新状态_____________ /// <summary> /// 刷新状态 /// </summary> private void UpdateStatus() { //设置状态文字 if (FreshAirDev.currentFanStatus == 4) { //打开 this.listControl[5].IsSelected = true; //设置状态文字 this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1)); } if (FreshAirDev.currentFanStatus == 0) { //关闭 this.listControl[0].TextColor = ZigbeeColor.Current.XMGray3; this.listControl[0].IsBold = false; this.listControl[1].Visible = false; this.listControl[2].TextColor = ZigbeeColor.Current.XMGray3; this.listControl[2].IsBold = false; this.listControl[3].Visible = false; this.listControl[4].IsSelected = false; this.listControl[5].IsSelected = false; this.listControl[6].IsSelected = false; //设置状态文字 this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close)); return; } //设置模式 if (FreshAirDev.currentFanMode == 5) { this.listControl[0].TextColor = ZigbeeColor.Current.XMGray1; this.listControl[0].IsBold = true; this.listControl[1].Visible = true; this.listControl[2].TextColor = ZigbeeColor.Current.XMGray3; this.listControl[2].IsBold = false; this.listControl[3].Visible = false; } else if (FreshAirDev.currentFanMode == 7) { this.listControl[0].TextColor = ZigbeeColor.Current.XMGray3; this.listControl[0].IsBold = false; this.listControl[1].Visible = false; this.listControl[2].TextColor = ZigbeeColor.Current.XMGray1; this.listControl[2].IsBold = true; this.listControl[3].Visible = true; } //设置风速 if (FreshAirDev.currentFanSpeed == 1) { this.listControl[4].IsSelected = false; this.listControl[6].IsSelected = true; } else if (FreshAirDev.currentFanSpeed == 3) { this.listControl[4].IsSelected = true; this.listControl[6].IsSelected = false; } } #endregion } } ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.csold mode 100755 new mode 100644
@@ -360,6 +360,20 @@ }; } } //如果是新风 if (device.Type == DeviceType.FreshAir) { //功能类型 string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); string strType = Language.StringByID(R.MyInternationalizationString.FreshAir); var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2); btnFunction.UseClickStatu = false; listview.AddChidren(btnFunction); btnFunction.InitControl(); //底线 btnFunction.AddBottomLine(); } } /// <summary> ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceOtherLogic.csold mode 100755 new mode 100644
@@ -154,6 +154,35 @@ } return $"{(device as Rollershade).WcdCurrentPositionLiftPercentage}%"; } else if (device.Type == DeviceType.FreshAir) { //在网关没有回复之前,默认离线 if (device.HadReadDeviceStatu == false) { return Language.StringByID(R.MyInternationalizationString.uOffLine); } //模式 string wind = string.Empty; var freshAir = device as FreshAir; if (freshAir.currentFanStatus == 0) { return Language.StringByID(R.MyInternationalizationString.Close); } if (freshAir.currentFanSpeed == 1) { wind = Language.StringByID(R.MyInternationalizationString.Fan_Low); } else if (freshAir.currentFanSpeed == 2) { wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle); } else if (freshAir.currentFanSpeed == 3) { wind = Language.StringByID(R.MyInternationalizationString.Fan_Height); } return $"{wind}"; } else if (device.Type == DeviceType.Thermostat) { //在网关没有回复之前,默认离线 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.csold mode 100755 new mode 100644
@@ -274,7 +274,7 @@ } #endregion #region ■ 空调数据 #region ■ 空调和新风数据 //空调数据 else if (report.DeviceStatusReport.CluterID == 513) { @@ -339,40 +339,70 @@ } //空调数据 else if (report.DeviceStatusReport.CluterID == 514) { { locadevice.DeviceStatusReport = report.DeviceStatusReport; foreach (var attData in report.DeviceStatusReport.AttriBute) { if (attData.AttributeId == 0) { //风扇模式 ((AC)locadevice).currentFanMode = attData.AttriButeData; //已经接收到状态 locadevice.HadReadDeviceStatu = true; } else if (attData.AttributeId == 4096) { //风扇扫风 ((AC)locadevice).currentFanSwingMode = attData.AttriButeData; //已经接收到状态 locadevice.HadReadDeviceStatu = true; } else if (attData.AttributeId == 4097) { //转换为二进制 var value = Convert.ToString(attData.AttriButeData, 2).PadLeft(16, '0'); //这个设置是放在后面的 value = value.Substring(value.Length - 1, 1); //启用摆风功能 ((AC)locadevice).UseSwingFunction = value == "1"; locadevice.ReSave(); } { //区分是空调还是新风 var device = Shared.Common.LocalDevice.Current.GetDevice(report.DeviceAddr, report.DeviceEpoint); if (device.Type == DeviceType.FreshAir) { if (attData.AttributeId == 0) { switch (attData.AttriButeData) { case 0: case 4: ((FreshAir)locadevice).currentFanStatus = attData.AttriButeData; break; case 1: case 2: case 3: ((FreshAir)locadevice).currentFanSpeed = attData.AttriButeData; break; case 5: case 7: ((FreshAir)locadevice).currentFanMode = attData.AttriButeData; break; } //已经接收到状态 locadevice.HadReadDeviceStatu = true; } } else { if (attData.AttributeId == 0) { //风扇模式 ((AC)locadevice).currentFanMode = attData.AttriButeData; //已经接收到状态 locadevice.HadReadDeviceStatu = true; } else if (attData.AttributeId == 4096) { //风扇扫风 ((AC)locadevice).currentFanSwingMode = attData.AttriButeData; //已经接收到状态 locadevice.HadReadDeviceStatu = true; } else if (attData.AttributeId == 4097) { //转换为二进制 var value = Convert.ToString(attData.AttriButeData, 2).PadLeft(16, '0'); //这个设置是放在后面的 value = value.Substring(value.Length - 1, 1); //启用摆风功能 ((AC)locadevice).UseSwingFunction = value == "1"; locadevice.ReSave(); } } } } } #endregion #region ■ 亮度数据 //亮度数据 //亮度数据 else if (report.DeviceStatusReport.CluterID == 8) { locadevice.DeviceStatusReport = report.DeviceStatusReport; @@ -512,7 +542,21 @@ //常开模式开启 if (info.AlarmCode == 216) { DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush, null); //温居城的要网关中是否有逻辑存在 Application.RunOnMainThread(async () => { var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(); if (resTemp == 1) { DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush, true, null); } else if (resTemp == 0) { DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush, false, null); } }); } } } @@ -528,7 +572,7 @@ /// 设备在线状态更新反馈 /// </summary> /// <param name="receiveData"></param> private void DeviceOnlineChangePush (JObject receiveData) private void DeviceOnlineChangePush(JObject receiveData) { if (this.dicDeviceEvent.Count == 0) { ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.csold mode 100755 new mode 100644
@@ -87,12 +87,12 @@ //初始化桌布 this.tableContr = new InformationEditorControl(); this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1128); //初始化设备回路图标 this.InitDeviceEpointIcon(listBackControl); //保存 this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1128); //初始化设备回路图标 this.InitDeviceEpointIcon(listBackControl); //保存 var btnFinish = new BottomClickButton(); btnFinish.TextID = R.MyInternationalizationString.uSave; bodyFrameLayout.AddChidren(btnFinish); @@ -316,8 +316,8 @@ { strType = Language.StringByID(R.MyInternationalizationString.uSocket1); nowSelectNo = 2; } } var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2); btnFunction.UseClickStatu = false; listview.AddChidren(btnFunction); @@ -377,6 +377,20 @@ }; } } //如果是新风 if (nowSelectDevice.Type == DeviceType.FreshAir) { //功能类型 string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); string strType = Language.StringByID(R.MyInternationalizationString.FreshAir); var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2); btnFunction.UseClickStatu = false; listview.AddChidren(btnFunction); btnFunction.InitControl(); //底线 btnFunction.AddBottomLine(); } } #endregion @@ -414,7 +428,7 @@ else { //不需要滑动控件 frameBorder.AddChidren(frameBack); frameBorder.AddChidren(frameBack); } int index = 0; @@ -429,7 +443,17 @@ if (listIcon.Count == 1) { frame.Gravity = Gravity.CenterVertical; frame.Gravity = Gravity.CenterVertical; //如果是新风 if (deviceObj.Type == DeviceType.FreshAir) { frame.RemoveFromParent(); frameBack.BackgroundImagePath = "FreshAir/FreshAirRealDevicePic.png"; frameBack.Width = Application.GetMinRealAverage(878); frameBack.Height = Application.GetMinRealAverage(354); frameBack.Gravity = Gravity.Center; } } else { @@ -442,15 +466,15 @@ //计算真实高度 int realHeight = this.GetPictrueRealSize(58 + 58);//上下间距 realHeight += frameBack.ChildrenCount * this.GetPictrueRealSize(124);//圆圈高度 realHeight += (frameBack.ChildrenCount-1) * this.GetPictrueRealSize(60);//圆圈间距 realHeight += (frameBack.ChildrenCount - 1) * this.GetPictrueRealSize(60);//圆圈间距 if (realHeight > frameBack.Height) { //变更高度 frameBack.Height = realHeight; } } } } /// <summary> /// 初始化一行设备图标 /// </summary> @@ -491,6 +515,8 @@ //初始化菜单行 this.DeviceEpointSelectEvent(btnTemp, null); } } /// <summary> ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
@@ -582,8 +582,8 @@ private void AddDryContactSettionRow() { if (this.listDeviceType.Contains(DeviceType.OnOffSwitch) == false) { //必须有一路回路是OnOffSwitch才行,面板的干接点的话,使用的是别的菜单 { //必须有一路回路是OnOffSwitch才行,面板的干接点的话,使用的是别的菜单 return; } if (deviceEnumInfo.IsHdlDevice == true && deviceEnumInfo.BeloneType == DeviceBeloneType.A按键面板) @@ -679,8 +679,12 @@ { //只有回路数大于1才能有这个菜单 if (Common.LocalDevice.Current.GetDevicesCountByMac(listNewDevice[0].DeviceAddr) == 1) { return; { //要求新风小模块的新风有功能设置 if (deviceEnumInfo.ConcreteType != DeviceConcreteType.Relay_FangyueFreshAirModul) { return; } } if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir) ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelBackLighWithSensorForm.cs
@@ -576,7 +576,7 @@ //节能模式修改(他们说随便一个回路就行) //肖志豪给按键控制面板(四开八控)设备,说默认15秒时间,这样接近感应功能才合理 energyModeInfo.time = 15; energyModeInfo.time = 4094; result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level); if (result == false) { ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs
@@ -584,7 +584,7 @@ //节能模式修改(他们说随便一个回路就行) //设备同事说新风面板默认60秒时间,这样接近感应功能才合理 energyModeInfo.time = 60; energyModeInfo.time = 65534; var result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level); if (result == false) { ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs
@@ -233,16 +233,15 @@ curControlDev.bindList.Add(bDev); var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); //获取设备类型的 var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); //新风面板的新风设备,则不显示 if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) { continue; } if (device.Type == DeviceType.FreshAir) { //获取设备类型的 var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); //新风面板的新风设备,则不显示 if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) { continue; } bindFreshAirName = device.DeviceEpointName; } if (device.Type == DeviceType.TemperatureSensor) ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs
@@ -74,8 +74,28 @@ /// 失效效日期“秒” /// </summary> public static int InValidDateSecond = 0; /// <summary> /// 门锁操作类型 /// </summary> public enum DoorLockMessType { /// <summary> /// app操作 /// </summary> AppOperate = 0, /// <summary> /// 通过门锁操作设备上报 /// </summary> DeviceReport = 1, /// <summary> /// 通过服务器推送 /// </summary> ServicePush = 2, } #endregion #region 常开模式 API /// <summary> /// 获取当前门锁的常开模式 /// </summary> @@ -122,6 +142,343 @@ } /// <summary> /// 设置本地门锁的常开模式值 /// </summary> public static void NormallyOpenModeValue(ZigBee.Device.DoorLock doorLock, bool value) { string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) { doorLock.IsDoorLockNormallyMode[key] = value; } else { doorLock.IsDoorLockNormallyMode.Add(key, value); } } /// <summary> /// 常开模式失效处理【弹窗】 /// </summary> /// <param name="doorLock">当前门锁</param> /// <param name="doorLockMessType">导致门锁失效的操作类型</param> /// <param name="haveLogic">网关中是否存在逻辑常开模式</param> /// <param name="action">回调处理更新内容</param> public static async void NomallyOpenModeInvalidDialog(ZigBee.Device.DoorLock doorLock, DoorLockMessType doorLockMessType, bool haveLogic, Action action = null) { //常开模式只能主人操作 if (UserCenterResourse.UserInfo.AuthorityNo != 1) { Application.RunOnMainThread(() => { string msg0 = Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate); ShowTipMsg(msg0); }); return; } //常开模式将被取消弹窗 string msg = Language.StringByID(R.MyInternationalizationString.NomallyModeIsCanceled).Replace("{0}", "\r\n"); var confirm = Language.StringByID(R.MyInternationalizationString.SureCancel); var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.NomallyOpenMode, msg, confirm); if (haveLogic) { //有逻辑设置的弹窗 alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.CancelNomallyOpenModeWithLogic, msg, confirm); } alert.Show(); alert.MsgControlClickEvent += async () => { if (doorLockMessType == DoorLockMessType.DeviceReport || doorLockMessType == DoorLockMessType.ServicePush) { //上报“常开模式”已被取消,app默认了“常开模式”被取消 DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); } else { //保持常开 NormallyOpenModeValue(doorLock, true); } action?.Invoke(); }; alert.CancelClickEvent += async () => { if (doorLockMessType == DoorLockMessType.DeviceReport || doorLockMessType == DoorLockMessType.ServicePush) { //上报“常开模式”已被取消 Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); //先删除已失效的“常开模式”的逻辑 //if (resTemp == 1) //{ // var restulTemp = await Shared.Phone.Device.Logic.SkipView.Exist(3); // //if (restulTemp == 3) // //{ // // string msg0 = Language.StringByID(R.MyInternationalizationString.CancelLogicNormallyModeFailed2); // // this.ShowTipMsg(msg0); // // return; // //} //} //app重新开启“常开模式” var result = await doorLock.SetNormallyOpenModeFuncAsync(true); if (result == null || result.defaultControlResponseData == null) { Application.RunOnMainThread(() => { string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); ShowTipMsg(msg0); NormallyOpenModeValue(doorLock, false); CommonPage.Loading.Hide(); //new Tip() { MaxWidth = 150, Text = msg0, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); action?.Invoke(); return; } if (result.defaultControlResponseData.status != 0) { Application.RunOnMainThread(() => { string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed); ShowTipMsg(msg1); NormallyOpenModeValue(doorLock, false); CommonPage.Loading.Hide(); //new Tip() { MaxWidth = 150, Text = msg1, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); action?.Invoke(); return; } else { //创建常开模式的特殊逻辑 var resu = await Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock); Application.RunOnMainThread(() => { string msg0 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeSuccess); ShowTipMsg(msg0); NormallyOpenModeValue(doorLock, true); CommonPage.Loading.Hide(); //new Tip() { MaxWidth = 150, Text = msg0, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); } } else { //app操作不取消“常开模式” DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); } action?.Invoke(); }; alert.ConfirmClickEvent += async () => { if (doorLockMessType == DoorLockMessType.DeviceReport || doorLockMessType == DoorLockMessType.ServicePush) { NormallyOpenModeValue(doorLock, false); if (haveLogic) { var resTemp2 = await Shared.Phone.Device.Logic.SkipView.Exist(3); //if (resTemp2 == 3) //{ // string msg0 = Language.StringByID(R.MyInternationalizationString.CancelLogicNormallyModeFailed); // this.ShowTipMsg(msg0); //} } } else { //app操作取消“常开模式” Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); var result = await doorLock.SetNormallyOpenModeFuncAsync(false); if (result == null || result.defaultControlResponseData == null) { Application.RunOnMainThread(() => { ShowTipMsg(Language.StringByID(R.MyInternationalizationString.GwResponseOvertime)); CommonPage.Loading.Hide(); //new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); action?.Invoke(); return; } if (result.defaultControlResponseData.status != 0) { Application.RunOnMainThread(() => { string msg1 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeFailed); ShowTipMsg(msg1); CommonPage.Loading.Hide(); //new Tip() { MaxWidth = 150, Text = msg1, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); action?.Invoke(); return; } else { //添加App开启常开模式的历史记录 HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(doorLock, 9002, string.Empty); //app确认取消“常开模式”成功 NormallyOpenModeValue(doorLock, false); //删除设置常开模式创建的逻辑 if (haveLogic) { var resTemp1 = await Shared.Phone.Device.Logic.SkipView.Exist(3); //因为目前机制问题,逻辑经常失败,所以不提示,后期机制要改,重新做一个这个界面 //if (resTemp1 == 3) //{ //Application.RunOnMainThread(() => //{ // string msg0 = Language.StringByID(R.MyInternationalizationString.CancelLogicNormallyModeFailed); // ShowTipMsg(msg0); //}); //} //else if (resTemp1 == 2) //{ //Application.RunOnMainThread(() => //{ // string msg0 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeSuccess); // ShowTipMsg(msg0); //}); } Application.RunOnMainThread(() => { string msg2 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeSuccess); ShowTipMsg(msg2); CommonPage.Loading.Hide(); }); } } action?.Invoke(); }; } /// <summary> /// 删除常开模式 /// </summary> /// <param name="doorLock">当前门锁</param> /// <param name="action">回调处理更新内容</param> /// <returns></returns> public static async System.Threading.Tasks.Task<bool> DelNormallyOpenMode(ZigBee.Device.DoorLock doorLock, Action action = null) { //app操作取消“常开模式” var result = await doorLock.SetNormallyOpenModeFuncAsync(false); if (result == null || result.defaultControlResponseData == null || result.defaultControlResponseData.status != 0) { action?.Invoke(); return false; } if (result.defaultControlResponseData.status == 0) { //app确认取消“常开模式”成功 NormallyOpenModeValue(doorLock, false); action?.Invoke(); return true; } return false; } /// <summary> /// 启动常开模式【弹窗】 /// </summary> /// <param name="doorLock">当前门锁</param> /// <param name="action">回调处理更新内容</param> public static async void NomallyOpenModeStartDialog(ZigBee.Device.DoorLock doorLock, Action action) { //常开模式只能主人操作ZigBee.Device.DoorLock doorLock if (UserCenterResourse.UserInfo.AuthorityNo != 1) { Application.RunOnMainThread(() => { string msg0 = Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate); ShowTipMsg(msg0); }); return; } //设置常开模式后,您的门锁将始终处于打开状态,确认开启? string msg = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"); var confirm = Language.StringByID(R.MyInternationalizationString.Confrim); var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, confirm); alert.Show(); alert.ConfirmClickEvent += async () => { Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); var result = await doorLock.SetNormallyOpenModeFuncAsync(true); if (result == null || result.defaultControlResponseData == null) { Application.RunOnMainThread(() => { string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); ShowTipMsg(msg0); CommonPage.Loading.Hide(); }); return; } if (result.defaultControlResponseData.status != 0) { Application.RunOnMainThread(() => { string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed); ShowTipMsg(msg1); CommonPage.Loading.Hide(); }); return; } else { //添加App开启常开模式的历史记录 HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(doorLock, 9001, string.Empty); DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); action?.Invoke(); Application.RunOnMainThread(() => { NomallyOpenModeInvalidTimeDialog(doorLock); CommonPage.Loading.Hide(); }); } }; } /// <summary> /// 常开模式失效时间处理【弹窗】 /// </summary> public static async void NomallyOpenModeInvalidTimeDialog(ZigBee.Device.DoorLock doorLock) { //失效设置 string msgTimeInValidSetting = Language.StringByID(R.MyInternationalizationString.DoorLockOpenAllTheTime); var timeConfrim = Language.StringByID(R.MyInternationalizationString.Confrim); var alertTimeInValidSetting = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.InValid, msgTimeInValidSetting, timeConfrim); alertTimeInValidSetting.Show(); alertTimeInValidSetting.InvalidTimeAction += async (obj) => { //常开模式失效时间设置成功 var temp = int.Parse(obj); DoorLockCommonInfo.NormallyOpenModeInvalidTime = temp; //默认创建常开模式的特殊逻辑 var res = await Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock); if (!res) { Application.RunOnMainThread(() => { //默认创建常开模式失败 string msg0 = Language.StringByID(R.MyInternationalizationString.AddLogicNormallyModeFailed); var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, msg0, Language.StringByID(R.MyInternationalizationString.confrim)); alert.Show(); //二次加载弹窗 常开模式开启提示 NomallyOpenModeInvalidTimeDialog(doorLock); }); } }; } #endregion #region 音量 /// <summary> /// 门锁是否支持音量[这里暂时只有S-One门锁支持,H06C不支持,后期通过能力值支持] /// </summary> /// <param name="doorLock:当前门锁"></param> @@ -137,6 +494,8 @@ } return false; } #endregion #region 从云端获取的方法 /// <summary> @@ -856,7 +1215,7 @@ /// 显示错误信息窗口 /// </summary> /// <param name="msg"></param> private void ShowErrorMsg(string msg) private static void ShowErrorMsg(string msg) { Application.RunOnMainThread(() => { @@ -869,7 +1228,7 @@ /// 显示Tip信息窗口 /// </summary> /// <param name="msg"></param> private void ShowTipMsg(string msg) private static void ShowTipMsg(string msg) { Application.RunOnMainThread(() => { @@ -880,148 +1239,5 @@ #endregion public enum DoorLockMessType { /// <summary> /// app操作 /// </summary> AppOperate = 0, /// <summary> /// 设备上报 /// </summary> DeviceReport = 1, /// <summary> /// 服务器推送 /// </summary> ServicePush = 2, } /// <summary> /// 常开模式失效处理 /// </summary> public static async void NomallyOpenModeInvalidDialog(ZigBee.Device.DoorLock doorLock, DoorLockMessType doorLockMessType, Action action) { if (UserCenterResourse.UserInfo.AuthorityNo != 1) { return; } string msg = Language.StringByID(R.MyInternationalizationString.NomallyModeIsCanceled).Replace("{0}", "\r\n"); var confirm = Language.StringByID(R.MyInternationalizationString.SureCancel); var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.NomallyOpenMode, msg, confirm); var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(); if (resTemp == 1) { //有逻辑设置的弹窗 alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.CancelNomallyOpenModeWithLogic, msg, confirm); } alert.Show(); alert.MsgControlClickEvent += async () => { if (doorLockMessType == DoorLockMessType.DeviceReport || doorLockMessType == DoorLockMessType.ServicePush) { //取消常开 NormallyOpenModeValue(doorLock, false); } else { //保持常开 NormallyOpenModeValue(doorLock, true); } action?.Invoke(); action = null; }; alert.CancelClickEvent += async () => { if (doorLockMessType == DoorLockMessType.DeviceReport || doorLockMessType == DoorLockMessType.ServicePush) { var result = await doorLock.SetNormallyOpenModeFuncAsync(true); if (result == null || result.defaultControlResponseData == null) { string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); Application.RunOnMainThread(() => { new Tip() { MaxWidth = 150, Text = msg0, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); NormallyOpenModeValue(doorLock, false); return; } if (result.defaultControlResponseData.status != 0) { string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed); Application.RunOnMainThread(() => { new Tip() { MaxWidth = 150, Text = msg1, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); NormallyOpenModeValue(doorLock, false); return; } else { NormallyOpenModeValue(doorLock, true); } } else { NormallyOpenModeValue(doorLock, true); } action?.Invoke(); action = null; }; alert.ConfirmClickEvent += async () => { if (doorLockMessType == DoorLockMessType.DeviceReport || doorLockMessType == DoorLockMessType.ServicePush) { NormallyOpenModeValue(doorLock, false); } else { var result = await doorLock.SetNormallyOpenModeFuncAsync(false); if (result == null || result.defaultControlResponseData == null) { Application.RunOnMainThread(() => { new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); return; } if (result.defaultControlResponseData.status != 0) { string msg1 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeFailed); Application.RunOnMainThread(() => { }); new Tip() { MaxWidth = 150, Text = msg1, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); return; } else { NormallyOpenModeValue(doorLock, false); string msg2 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeSuccess); Application.RunOnMainThread(() => { new Tip() { MaxWidth = 150, Text = msg2, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); } } action?.Invoke(); action = null; }; } /// <summary> /// 门锁常开模式值 /// </summary> public static void NormallyOpenModeValue(ZigBee.Device.DoorLock doorLock, bool value) { string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) { doorLock.IsDoorLockNormallyMode[key] = value; } else { doorLock.IsDoorLockNormallyMode.Add(key, value); } } } } ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs
@@ -386,7 +386,7 @@ } /// <summary> /// 去个人中心,开启远程开锁验证 /// 去个人中心,开启系统密码支持开锁权限 /// </summary> public void SystemSecondAuthentication() { ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.csold mode 100755 new mode 100644
@@ -74,10 +74,11 @@ { RemoveFromParent(); var userDoorLockPage = new UserDoorLockPage(currentRoom, deviceUI); HomePage.Instance.AddChidren(userDoorLockPage); HomePage.Instance.PageIndex += 1; userDoorLockPage.Show(); //暂时不考虑下级界面等推送导致常开模式失效的问题 //var userDoorLockPage = new UserDoorLockPage(currentRoom, deviceUI); //HomePage.Instance.AddChidren(userDoorLockPage); //HomePage.Instance.PageIndex += 1; //userDoorLockPage.Show(); }; this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; @@ -186,7 +187,7 @@ var listCheck = new List<string>(); rowBeloneArea.SelectRoomEvent += (roomKeys) => { //选择未分配时,清空 //选择未分配时,清空 if (roomKeys == string.Empty) { listCheck = new List<string>(); } foreach (var device in this.listNewDevice) { ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -47,7 +47,7 @@ /// </summary> bool canVolume = false; /// <summary> /// 保留上一次音量 /// 是否支持常开 /// </summary> bool canOpenNormallyMode = false; /// <summary> @@ -788,8 +788,9 @@ //设置 EventHandler<MouseEventArgs> btnFuncSetHander = (sender, e) => { //打开其他界面时前移除 RemoveFromParent(); //打开其他界面时前移除【暂时不移除】 //RemoveFromParent(); var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(currentRoom, doorLock); Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; @@ -1040,6 +1041,35 @@ /// </summary> private async void NomallyOpenDialog() { #region 后续版本 //if (UserCenterResourse.UserInfo.AuthorityNo != 1) //{ // this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate)); // return; //} //if (!UserCenterResourse.AccountOption.DoorUnLockByRemote) //{ // SystemSecondAuthentication(); // return; //} //action = () => //{ // //系统密码支持操作门锁后,调用温居城的界面【常开自动化】 // var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(currentRoom, doorLock); // Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); // Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; // functionSetting.Show(); // functionSetting.aaaAction = () => // { // UpdateNomallyOpenStatus(); // }; //}; //HdlCheckLogic.Current.CheckSecondarySecurity(action); #endregion #region 暂时版本 (最终去掉) if (!btnNormallyOpen.IsSelected) { if (UserCenterResourse.UserInfo.AuthorityNo != 1) @@ -1056,6 +1086,12 @@ action = () => { //系统密码支持操作门锁后,调用问温居城的界面【常开自动化】 //Action nomallyOpenModeStartAction = () => //{ // UpdateNomallyOpenStatus(); //}; string msg = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"); var confirm = Language.StringByID(R.MyInternationalizationString.Confrim); var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, confirm); @@ -1095,6 +1131,7 @@ AlreadyOpenNormallyMode(); } }; }; HdlCheckLogic.Current.CheckSecondarySecurity(action); } @@ -1102,6 +1139,8 @@ { NomallyOpenModeInvalidDialog(); } #endregion } /// <summary> @@ -1177,11 +1216,11 @@ var result = await doorLock.SetNormallyOpenModeFuncAsync(true); if (result == null || result.defaultControlResponseData == null) { string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); this.ShowTipMsg(msg0); DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); Application.RunOnMainThread(() => { string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); this.ShowTipMsg(msg0); DoorLockCommonInfo.NormallyOpenModeValue(doorLock, false); UpdateNomallyOpenStatus(); }); return; ZigbeeApp/Shared/Phone/ZigBee/Device/CommonDevice.csold mode 100755 new mode 100644
@@ -238,12 +238,16 @@ //继电器 IconPath = "Device/RelayEpoint.png"; } else if (this.Type == DeviceType.Thermostat || this.Type == DeviceType.FreshAir) else if (this.Type == DeviceType.Thermostat) { //空调 //新风和空调图标相同 //空调 IconPath = "Device/AirConditionerEpoint.png"; } else if (this.Type == DeviceType.FreshAir) { //新风 IconPath = "Device/FreshAirEpoint.png"; } else if (this.Type == DeviceType.FreshAirHumiditySensor) { //湿度传感器 ZigbeeApp/Shared/Phone/ZigBee/Device/DeviceType.csold mode 100755 new mode 100644
@@ -79,7 +79,7 @@ FreshAir = 0xD100, /// <summary> /// <para>新风湿度传感器</para> /// <para>设备ID为0xD200</para> /// <para>设备ID为53760</para> /// <para>定义对象:TemperatureSensor</para> /// </summary> FreshAirHumiditySensor = 0xD200, ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.csold mode 100755 new mode 100644
@@ -36,7 +36,8 @@ //本地所有账户列表 public List<Shared.Phone.UserCenter.MemberInfoRes> localAllAccountList = new List<Shared.Phone.UserCenter.MemberInfoRes> { }; /// <summary> /// 是否常开模式[当数据获取失败,返回空] /// 是否常开模式【key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint】 /// ture:常开; false:关闭 /// </summary> public Dictionary<string, bool> IsDoorLockNormallyMode = new Dictionary<string, bool> { };//是否冻结子账户 public string LocalTempPassword = string.Empty;//本地生成的临时密码 ZigbeeApp/Shared/Phone/ZigBee/Device/FreshAir.csold mode 100755 new mode 100644
@@ -15,24 +15,85 @@ } /// <summary> /// 恒温设备当前模式 /// <para>恒温设备具备功能,SystemMode Attribute Values如下</para> /// <para>0:Off </para> /// <para>1:Auto </para> /// <para>3:Cool </para> /// <para>4:Heat </para> /// <para>5:Emergency heating </para> /// <para>6:Precooling</para> /// <para>7:Fan only </para> /// <para>8:Dry </para> /// <para>9:Sleep</para> /// 风速模式 /// <para>5:自动</para> /// <para>6:Smart</para> /// <para>7:手动</para> /// </summary> public int currentSystemMode = 0; public int currentFanMode = 0; /// <summary> /// 风速档位 /// <para>1:低风</para> /// <para>2:中风</para> /// <para>3:高风 </para> /// </summary> public int currentFanSpeed = 0; /// <summary> /// 风扇状态 /// <para>0:关闭 </para> /// <para>4:打开 </para> /// </summary> public int currentFanStatus = 0; /// <summary> /// 关闭 /// </summary> /// <returns>The close.</returns> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> Close() { return await SetFanModeAsync(FanMode.Off); } /// <summary> /// 开启 /// </summary> /// <returns>The open.</returns> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> Open() { return await SetFanModeAsync(FanMode.On); } /// <summary> /// 高风 /// </summary> /// <returns>The close.</returns> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetHighSpeed() { return await SetFanModeAsync(FanMode.High); } /// <summary> /// 低风 /// </summary> /// <returns>The open.</returns> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetLowSpeed() { return await SetFanModeAsync(FanMode.Low); } /// <summary> /// 手动 /// </summary> /// <returns>The close.</returns> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetManual() { return await SetFanModeAsync(FanMode.Manual); } /// <summary> /// 自动 /// </summary> /// <returns>The open.</returns> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetAuto() { return await SetFanModeAsync(FanMode.Auto); } ///<summary > ///设置恒温器设备当前工作模式. ///设置恒温器设备当前风速. /// </summary> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetSystemModeAsync(AcMode acMode) public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetFanModeAsync(FanMode fanMode) { if (Gateway == null) { @@ -81,8 +142,8 @@ DebugPrintLog("SetWritableValue_Actions 启动" + "_" + System.DateTime.Now.ToString()); try { var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 513 }, { "Command", 120 } }; var data = new JObject { { "Undivided", 0 }, { "AttributeId", 28 }, { "AttributeDataType", 48 }, { "AttributeData", (int)acMode } }; var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 514 }, { "Command", 120 } }; var data = new JObject { { "Undivided", 0 }, { "AttributeId", 0 }, { "AttributeDataType", 48 }, { "AttributeData", (int)fanMode } }; jObject.Add("Data", data); Gateway.Send("SetWritableValue", jObject.ToString()); } @@ -107,63 +168,63 @@ }); } public enum AcMode #region ◆ 当前新风开关状态____________________ /// <summary> /// 当前新风开关状态 /// </summary> /// <param name="freshAir"></param> /// <returns></returns> public bool IsOpen(FreshAir freshAir) { if (freshAir.currentFanStatus == 4) { return true; } return false; } #endregion /// <summary> /// 风速档位 /// </summary> public enum FanMode { /// <summary> /// 关闭模式(测试恒温面板时发现:2,5,6,7,8,9都是可以打开的) /// 关闭 /// </summary> Off = 0, /// <summary> /// 自动模式 /// 低风 /// </summary> Auto = 1, Low = 1, /// <summary> /// 制冷模式 /// 中风 /// </summary> Cool = 3, Medium = 2, /// <summary> /// 制热模式 /// 高风 /// </summary> Heat = 4, High = 3, /// <summary> /// 紧急制热模式 /// 打开 /// </summary> EmergencyHeating = 5, On = 4, /// <summary> /// 预冷模式 /// 自动 /// </summary> Precooling = 6, Auto = 5, /// <summary> /// 只有风速模式 /// Smart /// </summary> FanOnly = 7, Smart = 6, /// <summary> /// 干燥模式 /// 手动 /// </summary> Dry = 8, /// <summary> /// 睡眠模式 /// </summary> Sleep = 9 } /// <summary> /// 关闭 /// </summary> /// <returns>The close.</returns> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> Close() { return await SetSystemModeAsync(AcMode.Off); } /// <summary> /// 开启 /// </summary> /// <returns>The open.</returns> /// <param name="acMode">Ac mode.</param> public async System.Threading.Tasks.Task<SetWritableValueResponAllData> Open(AcMode acMode = AcMode.Cool) { return await SetSystemModeAsync(acMode); Manual = 7, } } } ZigbeeApp/Shared/Phone/ZigBee/Device/HumiditySensor.csold mode 100755 new mode 100644
@@ -8,6 +8,7 @@ { public HumiditySensor() { this.Type = DeviceType.FreshAirHumiditySensor; } } } ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs
@@ -155,6 +155,7 @@ /// <para>304:CurtainDownstop,窗帘下降停</para> /// </summary> public List<int> privateFuncThirdLevelList = new List<int>(); #region 获取面板的私有信息. /// <summary> ///获取面板的私有信息 ZigbeeApp/Shared/R.cs
@@ -554,6 +554,10 @@ /// 请输入合法的数字 /// </summary> public const int IllegalNumber = 310; /// <summary> /// 手动 /// </summary> public const int Manual = 311; public readonly static int cancel = 5097; public readonly static int confrim = 5098; @@ -6042,7 +6046,7 @@ /// <summary> /// 镜像ID为2310的设备的默认名字:方悦新风小模块 /// </summary> public const int DeviceModelId2310 = 30038; public const int uDeviceModelId2310 = 30038; //★★★★下面这些是设备所属种类的翻译名字,从40000开始★★★★ /// <summary> @@ -6116,7 +6120,11 @@ /// <summary> /// 自定义设备所属ID为16的翻译名字:干接点 /// </summary> public const int uDeviceBelongId16 = 40017; public const int uDeviceBelongId16 = 40017; /// <summary> /// 自定义设备所属ID为2310的翻译名字:新风 /// </summary> public const int uDeviceBelongId2310 = 40018; //★★★★模块ID的设备默认备注名字,从50000开始,这里不需要定义,只写在Language.ini文件里面★★★★ //★★★★模块ID的设备类型名字,从60000开始,这里不需要定义,只写在Language.ini文件里面★★★★ ZigbeeApp/Shared/Shared.projitemsold mode 100755 new mode 100644
@@ -479,6 +479,8 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\ZigBee\IO\LocalFileUtils.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlSafeguardLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Logic\HdlAlarmsLogic.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Category\Controls\DeviceRow\DeviceFreshAirRowControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceFreshAirDetailCardForm.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Pad\" />