ZigbeeApp/GateWay.Droid/Assets/Language.ini
@@ -314,6 +314,7 @@ 309=时效性常开删除失败,继续“常开模式”请前往门锁用户界面设置; 310=请输入合法的数字 311=手动 312= 背光灯颜色 5097=取消 5098=确定 @@ -578,7 +579,15 @@ 5387=号 5388=常开自动化 5389=时效性常开设置 5390=失效设置 5391=小时 5392=门锁始终打开 5393=设置常开模式后,您的门锁将始终{0}处于打开状态,确认开启? 5394=不能小于1小时 5395=大于12小时 5396=或 5397=时间为空 5398=只支持数字输入 10000=HDL Home 10001=常用 @@ -1911,7 +1920,9 @@ ;方悦环境面板入网操作指示 21021=按住面板功能(function)按键,所有按键{0}指示灯亮起,则配网成功 ;窗帘面板的入网操作指示 21022=长按面板左上角按键,所有按键{0}指示灯亮起,则配网成功 21022=长按面板左上角按键,所有按键{0}指示灯亮起,则配网成功 ;吸顶燃气传感器的入网操作指示 21023=长按图示按键5秒以上,绿色快闪{0}进入配网状态,绿灯常亮则入网成功 ;★★★★下面这些是模块ID的官方名字,从30000开始★★★★ 30000=紧急按钮 @@ -1931,14 +1942,14 @@ 30014=1代Zigbee网关(高级网关桌面模式) 30015=调试设备 30016=Zigbee智能管状电机 30017=zigbee中继器 30017=Zigbee中继器 30018=12按键触摸面板(1路继电器底座) 30019=4按键触摸面板(只带电源底座) 30020=Zigbee人体移动传感器(球形) 30021=1路调光器小模块 30022=zigbee转Buspro协议转换器 30023=zigbee转485协议转换器 30024=zigbee空调网关模块 30022=Zigbee转Buspro协议转换器 30023=Zigbee转485协议转换器 30024=Zigbee空调网关模块 30025=H06C 30026=简约4按键面板 30027=简约3按键面板 @@ -1953,6 +1964,7 @@ 30036=方悦/2路窗帘面板-Z 30037=S-one 30038=方悦新风小模块 30039=Zigbee吸顶燃气传感器 ;★★★★下面这些是设备所属种类的翻译名字,从40000开始★★★★ 40000=遮阳 @@ -2015,6 +2027,7 @@ 50036=Zigbee方悦2路窗帘面板 50037=Zigbee智能门锁 50038=新风控制小模块 50039=Zigbee吸顶燃气传感器 ;★★★★下面这些是模块ID的设备类型名字,从60000开始.注:它并不需要再R.cs文件中定义★★★★ 60000=传感器 @@ -2055,4 +2068,5 @@ 70021=门窗传感器 70022=温湿度传感器 70023=中继器 70024=智能空开 70024=智能空开 70025=吸顶燃气传感器 ZigbeeApp/Home.Ios/Resources/Language.ini
@@ -314,6 +314,7 @@ 309=时效性常开删除失败,继续“常开模式”请前往门锁用户界面设置; 310=请输入合法的数字 311=手动 312= 背光灯颜色 5097=取消 5098=确定 @@ -578,7 +579,15 @@ 5387=号 5388=常开自动化 5389=时效性常开设置 5390=失效设置 5391=小时 5392=门锁始终打开 5393=设置常开模式后,您的门锁将始终{0}处于打开状态,确认开启? 5394=不能小于1小时 5395=大于12小时 5396=或 5397=时间为空 5398=只支持数字输入 10000=HDL Home 10001=常用 @@ -1911,7 +1920,9 @@ ;方悦环境面板入网操作指示 21021=按住面板功能(function)按键,所有按键{0}指示灯亮起,则配网成功 ;窗帘面板的入网操作指示 21022=长按面板左上角按键,所有按键{0}指示灯亮起,则配网成功 21022=长按面板左上角按键,所有按键{0}指示灯亮起,则配网成功 ;吸顶燃气传感器的入网操作指示 21023=长按图示按键5秒以上,绿色快闪{0}进入配网状态,绿灯常亮则入网成功 ;★★★★下面这些是模块ID的官方名字,从30000开始★★★★ 30000=紧急按钮 @@ -1931,14 +1942,14 @@ 30014=1代Zigbee网关(高级网关桌面模式) 30015=调试设备 30016=Zigbee智能管状电机 30017=zigbee中继器 30017=Zigbee中继器 30018=12按键触摸面板(1路继电器底座) 30019=4按键触摸面板(只带电源底座) 30020=Zigbee人体移动传感器(球形) 30021=1路调光器小模块 30022=zigbee转Buspro协议转换器 30023=zigbee转485协议转换器 30024=zigbee空调网关模块 30022=Zigbee转Buspro协议转换器 30023=Zigbee转485协议转换器 30024=Zigbee空调网关模块 30025=H06C 30026=简约4按键面板 30027=简约3按键面板 @@ -1953,6 +1964,7 @@ 30036=方悦/2路窗帘面板-Z 30037=S-one 30038=方悦新风小模块 30039=Zigbee吸顶燃气传感器 ;★★★★下面这些是设备所属种类的翻译名字,从40000开始★★★★ 40000=遮阳 @@ -2015,6 +2027,7 @@ 50036=Zigbee方悦2路窗帘面板 50037=Zigbee智能门锁 50038=新风控制小模块 50039=Zigbee吸顶燃气传感器 ;★★★★下面这些是模块ID的设备类型名字,从60000开始.注:它并不需要再R.cs文件中定义★★★★ 60000=传感器 @@ -2055,4 +2068,5 @@ 70021=门窗传感器 70022=温湿度传感器 70023=中继器 70024=智能空开 70024=智能空开 70025=吸顶燃气传感器 ZigbeeApp/Shared/Common/Device.cs
@@ -1987,9 +1987,19 @@ /// <param name="listMac">设备Mac地址</param> public void DeleteRealDeviceFromRoom(List<string> listMac) { bool save = false; foreach (var deviceMacAddr in listMac) { this.dicDeviceRoomId.Remove(deviceMacAddr); if (this.dicDeviceRoomId.ContainsKey(deviceMacAddr) == true) { this.dicDeviceRoomId.Remove(deviceMacAddr); save = true; } } if (save == false) { //没有改变,不需要保存 return; } //保存记录 string fullName = UserCenterLogic.CombinePath(DirNameResourse.DeviceRoomIdFile); @@ -2077,6 +2087,17 @@ #endregion #region ■ 一般方法___________________________ /// <summary> /// 从缓存变量检测设备是否在线 /// </summary> /// <param name="i_device"></param> /// <returns></returns> public bool CheckDeviceIsOnline(CommonDevice i_device) { //0:离线 1:在线 2:正在刷新状态 return i_device.IsOnline == 1 || i_device.IsOnline == 2; } /// <summary> /// 判断该设备是否可以显示在主页 @@ -2637,19 +2658,20 @@ //=========★★安防类传感器类(1300-2299)★★========= //这里是麦乐克的 this.dicDeviceModelIdEnum["MULTI-GASE--EA07"] = "1300-1300-60000";//燃气传感器 this.dicDeviceModelIdEnum["MULTI-MECI--EA01"] = "1301-1300-60000";//门窗磁传感器 this.dicDeviceModelIdEnum["MULTI-FIRE--EA05"] = "1302-1300-60000";//烟雾传感器 this.dicDeviceModelIdEnum["MULTI-MOTI--EA04"] = "1303-1300-60000";//红外传感器 this.dicDeviceModelIdEnum["MULTI-WATE--EA02"] = "1304-1300-60000";//水浸传感器 this.dicDeviceModelIdEnum["MULTI-BURO--EA06"] = "1305-1300-60000";//紧急按键 this.dicDeviceModelIdEnum["MULTI-GASE--EA07"] = "1300-1200-60000";//燃气传感器 this.dicDeviceModelIdEnum["MULTI-MECI--EA01"] = "1301-1200-60000";//门窗磁传感器 this.dicDeviceModelIdEnum["MULTI-FIRE--EA05"] = "1302-1200-60000";//烟雾传感器 this.dicDeviceModelIdEnum["MULTI-MOTI--EA04"] = "1303-1200-60000";//红外传感器 this.dicDeviceModelIdEnum["MULTI-WATE--EA02"] = "1304-1200-60000";//水浸传感器 this.dicDeviceModelIdEnum["MULTI-BURO--EA06"] = "1305-1200-60000";//紧急按键 //这里是河东的 this.dicDeviceModelIdEnum["MSG01/M-ZB.10"] = "1300-1300-60000";//燃气传感器 this.dicDeviceModelIdEnum["MSDC01/M-ZB.10"] = "1301-1300-60000";//门窗磁传感器 this.dicDeviceModelIdEnum["MSS01/M-ZB.10"] = "1302-1300-60000";//烟雾传感器 this.dicDeviceModelIdEnum["MSPIR01/M-ZB.10"] = "1303-1300-60000";//红外传感器 this.dicDeviceModelIdEnum["MSW01/M-ZB.10"] = "1304-1300-60000";//水浸传感器 this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1300-60000";//紧急按键 this.dicDeviceModelIdEnum["MSG01/M-ZB.10"] = "1300-1200-60000";//燃气传感器 this.dicDeviceModelIdEnum["MSDC01/M-ZB.10"] = "1301-1200-60000";//门窗磁传感器 this.dicDeviceModelIdEnum["MSS01/M-ZB.10"] = "1302-1200-60000";//烟雾传感器 this.dicDeviceModelIdEnum["MSPIR01/M-ZB.10"] = "1303-1200-60000";//红外传感器 this.dicDeviceModelIdEnum["MSW01/M-ZB.10"] = "1304-1200-60000";//水浸传感器 this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1200-60000";//紧急按键 this.dicDeviceModelIdEnum["MGCD01/ZB.10"] = "1306-1200-60000";//吸顶燃气传感器 //=========★★继电器类(2300-2499)★★========= this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3路继电器小模块 @@ -2696,9 +2718,8 @@ this.dicPictrueShard["ButtonPanel_SimpleFour"] = "ButtonPanel_Four";//简约4按键面板 沿用 4按键的图标 this.dicPictrueShard["ButtonPanel_SimpleThree"] = "ButtonPanel_Three";//简约3按键面板 沿用 3按键的图标 this.dicPictrueShard["ButtonPanel_SimpleTwo"] = "ButtonPanel_Two";//简约2按键面板 沿用 2按键的图标 this.dicPictrueShard["IntelligentLocks_Sone"] = "IntelligentLocks_H06C";//S-one的门锁图片沿用H06C的图标 this.dicPictrueShard["Relay_FangyueFreshAirModul"] = "Relay_ThreeLoad";//方悦新风小模块图片沿用3路继电器的图标 this.dicPictrueShard["IntelligentLocks_Sone"] = "IntelligentLocks_H06C";//S-one的门锁图片 沿用 H06C的图标 this.dicPictrueShard["Relay_FangyueFreshAirModul"] = "Relay_ThreeLoad";//方悦新风小模块图片 沿用 3路继电器的图标 } #endregion @@ -2839,6 +2860,10 @@ /// </summary> Sensor_EmergencyButton = 1305, /// <summary> /// 吸顶燃气传感器 /// </summary> Sensor_CeilingGas = 1306, /// <summary> /// 运动传感器 /// </summary> Sensor_Motion = -1306, ZigbeeApp/Shared/Common/ZigbeeColor.cs
@@ -365,7 +365,9 @@ public uint LogicSecurity1Color = 0xFF35B87F; public uint LogicDelay1Color = 0xFFBF64FB; public uint LogicListWeekTextColor = 0xFF666666; public uint LogicTipColor = 0xFF333443; public uint LogicTipTextColor= 0xFFcccccc; public uint LogicEditTextBackgroundColor=0xFFD1D1D3; #endregion } } ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs
@@ -248,7 +248,8 @@ //自动化 else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2) { this.ShowAutotion(); //自动化功能代码入口 Device.Logic.SkipView.ShowAutotionView(functionSceneAutoBodyView); //隐藏楼层 floorVisible = false; //显示右上角的加号 @@ -506,56 +507,56 @@ //窗帘 if (device.Type == DeviceType.WindowCoveringDevice) { cardContr = new Controls.DeviceCurtainRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceCurtainRowControl(); } //继电器 else if (device.Type == DeviceType.OnOffOutput) { cardContr = new Controls.DeviceRelayRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceRelayRowControl(); } //空气开关 else if (device.Type == DeviceType.AirSwitch) { cardContr = new Controls.DeviceAirSwitchRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceAirSwitchRowControl(); } //空调 else if (device.Type == DeviceType.Thermostat) { cardContr = new Controls.DeviceAcRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceAcRowControl(); } // 新风 else if (device.Type == DeviceType.FreshAir) { cardContr = new Controls.DeviceFreshAirRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceFreshAirRowControl(); } //彩灯(调光器) else if (device.Type == DeviceType.DimmableLight) { cardContr = new Controls.DeviceColorLightRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceColorLightRowControl(); } //传感器 else if (device.Type == DeviceType.IASZone) { cardContr = new Controls.DeviceSensorRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceSensorRowControl(); } //温湿度 else if (device.Type == DeviceType.TemperatureSensor) { cardContr = new Controls.DeviceTemperatureRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceTemperatureRowControl(); } //门锁 else if (device.Type == DeviceType.DoorLock) { cardContr = new Controls.DeviceDoorLockRowControl(listView.rowSpace / 2); cardContr = new Controls.DeviceDoorLockRowControl(); } //无法识别 else { cardContr = new Controls.DeviceRowCommon(listView.rowSpace / 2); cardContr = new Controls.DeviceRowCommon(); //没有状态功能 cardContr.hadStatuFunction = false; } cardContr.chidrenYaxis = listView.rowSpace / 2; //初始化卡片 listView.AddChidren(cardContr); cardContr.InitControl(device); @@ -832,7 +833,8 @@ if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true) { //刷新卡片状态 this.dicDeviceRowControl[mainKeys].SetRowOnlineStatu(report.IsOnline == 1); bool bolOnline = LocalDevice.Current.CheckDeviceIsOnline(report); this.dicDeviceRowControl[mainKeys].SetRowOnlineStatu(bolOnline); return; } @@ -1009,18 +1011,6 @@ /// 设备回路主键 /// </summary> public List<string> listDeviceKeys = new List<string>(); } #endregion #region ◆ 自动化__________________________ /// <summary> /// 自动化功能代码入口 /// </summary> private void ShowAutotion() { Shared.Phone.Device.Logic.SkipView.ShowAutotionView(functionSceneAutoBodyView); } #endregion ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
@@ -61,8 +61,7 @@ /// <summary> /// 未分配界面的设备选择控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceRowCommon(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) public DeviceRowCommon() { this.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); this.Width = Application.GetRealWidth(1022); @@ -100,7 +99,8 @@ //设备名字 this.btnDeviceName = new NormalViewControl(600, 60, true); btnDeviceName.X = Application.GetRealWidth(181); btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis; //当指定实际坐标时,这里需要的偏移量为2倍 btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis * 2; btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device); btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor; this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly); @@ -117,7 +117,8 @@ //状态 this.btnStatu = new NormalViewControl(600, 50, true); btnStatu.X = Application.GetRealWidth(181); btnStatu.Y = Application.GetRealHeight(70) + this.chidrenYaxis; //当指定实际坐标时,这里需要的偏移量为2倍 btnStatu.Y = Application.GetRealHeight(70) + this.chidrenYaxis * 2; btnStatu.TextSize = 10; btnStatu.TextColor = UserCenterColor.Current.TextGrayColor1; this.frameTable.AddChidren(btnStatu, ChidrenBindMode.BindEventOnly); @@ -329,7 +330,7 @@ //如果这个函数被重写的话,则代表这个设备有开关功能 this.isHadOpenSwitch = false; //默认用在线状态来判断 return i_device.IsOnline == 1; return Common.LocalDevice.Current.CheckDeviceIsOnline(i_device); } ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceAcRowControl.cs
@@ -14,14 +14,6 @@ #region ■ 初始化_____________________________ /// <summary> /// 分类界面的空调设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceAcRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { } /// <summary> /// 初始化控件 /// </summary> /// <param name="i_device"></param> ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceAirSwitchRowControl.cs
@@ -14,14 +14,6 @@ #region ■ 初始化_____________________________ /// <summary> /// 分类界面的空气开关设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceAirSwitchRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { } /// <summary> /// 初始化控件 /// </summary> /// <param name="i_device"></param> ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceColorLightRowControl.cs
@@ -14,14 +14,6 @@ #region ■ 初始化_____________________________ /// <summary> /// 分类界面的彩灯(调光器)设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceColorLightRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { } /// <summary> /// 初始化控件 /// </summary> /// <param name="i_device"></param> ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceCurtainRowControl.cs
@@ -35,14 +35,6 @@ #region ■ 初始化_____________________________ /// <summary> /// 分类界面的窗帘设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceCurtainRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { } /// <summary> /// 初始化控件 /// </summary> /// <param name="i_device"></param> ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceDoorLockRowControl.cs
@@ -15,8 +15,7 @@ /// <summary> /// 分类界面的门锁设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceDoorLockRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) public DeviceDoorLockRowControl() { //门锁暂时没有状态功能 this.hadStatuFunction = false; ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceFreshAirRowControl.cs
@@ -10,14 +10,6 @@ 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> ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceRelayRowControl.cs
@@ -14,14 +14,6 @@ #region ■ 初始化_____________________________ /// <summary> /// 分类界面的继电器设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceRelayRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { } /// <summary> /// 初始化控件 /// </summary> /// <param name="i_device"></param> ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceSensorRowControl.cs
@@ -12,14 +12,6 @@ { #region ■ 初始化_____________________________ /// <summary> /// 分类界面的传感器设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceSensorRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { } #endregion } } ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/DeviceTemperatureRowControl.cs
@@ -12,14 +12,6 @@ { #region ■ 初始化_____________________________ /// <summary> /// 分类界面的温湿度传感器设备行控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> public DeviceTemperatureRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { } #endregion #region ■ 发送获取状态命令___________________ ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs
@@ -490,6 +490,7 @@ /// </summary> void TimeView() { UserView.HomePage.Instance.ScrollEnabled = false; Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>(); #region ------界面布局部分 ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs
New file @@ -0,0 +1,415 @@ using System; using Shared.Common; namespace Shared.Phone.Device.Logic.LogicView { public class TipView { /// <summary> /// 确定框 /// </summary> /// <param name="action"></param> public static void ShowConfrimTip(Action action) { ///主控件 Dialog dialog = new Dialog(); dialog.Show(); ///背景的父控件 FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; dialog.AddChidren(fLayout); fLayout.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; ///弹框父控件 FrameLayout tipFLayout = new FrameLayout { X = Application.GetRealWidth(144), Y = Application.GetRealHeight(706), Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(351 + 127), BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, Radius = (uint)Application.GetRealHeight(17) }; fLayout.AddChidren(tipFLayout); ///上面快的父控件 FrameLayout topFrame = new FrameLayout { Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(351), }; tipFLayout.AddChidren(topFrame); ///提示控件 Button tipBtn = new Button { TextID = R.MyInternationalizationString.Tip, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTipColor, TextSize = 16, Y = Application.GetRealHeight(69), X = Application.GetRealWidth(150), Height = Application.GetRealHeight(63), Width = Application.GetRealWidth(492), }; topFrame.AddChidren(tipBtn); ///自定义文本控件 Button tipTextBtn = new Button { Text = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"), TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTipTextColor, TextSize = 14, Y = tipBtn.Bottom + Application.GetRealHeight(35), X = Application.GetRealWidth(60), Height = Application.GetRealHeight(115), Width = Application.GetRealWidth(674), IsMoreLines = true, }; topFrame.AddChidren(tipTextBtn); ///下面快的父控件 FrameLayout bottomFrame = new FrameLayout { Y = topFrame.Bottom, Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(127), }; tipFLayout.AddChidren(bottomFrame); ///取消控件 Button cancelBtn = new Button { TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextSize = 14, Height = Application.GetRealHeight(127), Width = Application.GetRealWidth(397), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, TextID = R.MyInternationalizationString.cancel, }; bottomFrame.AddChidren(cancelBtn); cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft); ///确认控件 Button okBtn = new Button { TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, TextSize = 14, X = cancelBtn.Right, Height = Application.GetRealHeight(127), Width = bottomFrame.Width - cancelBtn.Width, BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor, TextID = R.MyInternationalizationString.confrim, }; bottomFrame.AddChidren(okBtn); okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight); ///取消点击事件 cancelBtn.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; ///确认点击事件 okBtn.MouseUpEventHandler += (sender, e) => { dialog.Close(); action(); }; } /// <summary> /// 输入框 /// </summary> /// <param name="_if">是否需要取消按钮</param> /// <param name="action"></param> public static void ShowInputTip(bool _if, Action<string> action) { ///主控件 Dialog dialog = new Dialog(); dialog.Show(); ///背景的父控件 FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; dialog.AddChidren(fLayout); fLayout.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; ///弹框父控件 FrameLayout tipFLayout = new FrameLayout { X = Application.GetRealWidth(144), Y = Application.GetRealHeight(706), Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(351 + 127), BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, Radius = (uint)Application.GetRealHeight(17) }; fLayout.AddChidren(tipFLayout); ///上面快的父控件 FrameLayout topFrame = new FrameLayout { Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(351), }; tipFLayout.AddChidren(topFrame); ///提示控件 Button tipBtn = new Button { Y = Application.GetRealHeight(69), X = Application.GetRealWidth(150), Height = Application.GetRealHeight(63), Width = Application.GetRealWidth(492), TextID = R.MyInternationalizationString.invalidSetting, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTipColor, TextSize = 16, }; topFrame.AddChidren(tipBtn); ///文本1控件 Button Text1Btn = new Button { Y = Application.GetRealHeight(187), X = Application.GetRealWidth(50), Height = Application.GetRealHeight(58), Width = Application.GetRealWidth(242 + 94), TextID = R.MyInternationalizationString.lockOpen, TextAlignment = TextAlignment.CenterRight, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextSize = 14, }; topFrame.AddChidren(Text1Btn); ///输入文本框 EditText editTime = new EditText() { X = Application.GetRealWidth(409), Y = Application.GetRealHeight(173), Height = Application.GetRealHeight(81), Width = Application.GetRealWidth(132), Radius = (uint)Application.GetMinRealAverage(17), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, TextColor = ZigbeeColor.Current.LogicTextBlackColor, TextAlignment = TextAlignment.Center, TextSize = 14, Text = "12", IsNumberKeyboardType=true,//只输入数字的属性 }; topFrame.AddChidren(editTime); ///文本2控件 Button Text2Btn = new Button { Y = Application.GetRealHeight(187), X = Application.GetRealWidth(564), Height = Application.GetRealHeight(58), Width = Application.GetRealWidth(51 + 100), TextID = R.MyInternationalizationString.hour, TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextSize = 14, }; topFrame.AddChidren(Text2Btn); ///下面快的父控件 FrameLayout bottomFrame = new FrameLayout { Y = topFrame.Bottom, Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(127), }; tipFLayout.AddChidren(bottomFrame); ///取消控件 Button cancelBtn = new Button { TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextSize = 14, Height = Application.GetRealHeight(127), Width = Application.GetRealWidth(397), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, TextID = R.MyInternationalizationString.cancel, }; bottomFrame.AddChidren(cancelBtn); ///确认控件 Button okBtn = new Button { TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, TextSize = 14, X = cancelBtn.Right, Height = Application.GetRealHeight(127), Width = bottomFrame.Width - cancelBtn.Width, BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor, TextID = R.MyInternationalizationString.confrim, }; bottomFrame.AddChidren(okBtn); if (_if) { cancelBtn.X = Application.GetRealWidth(0); cancelBtn.Width = Application.GetRealWidth(0); okBtn.X = Application.GetRealWidth(0); okBtn.Width = Application.GetRealWidth(792); okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); } else { cancelBtn.X = Application.GetRealWidth(0); cancelBtn.Width = Application.GetRealWidth(397); okBtn.X = Application.GetRealWidth(397); okBtn.Width = bottomFrame.Width - cancelBtn.Width; cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft); okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight); } ///取消点击事件 cancelBtn.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; ///确认点击事件 okBtn.MouseUpEventHandler += (sender, e) => { if (string.IsNullOrEmpty(editTime.Text)) { ShowTip(Language.StringByID(R.MyInternationalizationString.timeNull),true); return; } if (int.Parse(editTime.Text) < 1 || int.Parse(editTime.Text) > 12) { ///限制输入数字范围; string str = Language.StringByID(R.MyInternationalizationString.less) + Language.StringByID(R.MyInternationalizationString.or) + Language.StringByID(R.MyInternationalizationString.more); ShowTip(str, true); return; } dialog.Close(); action(editTime.Text); }; } /// <summary> /// 提示框 /// </summary> public static void ShowTip(string tipText,bool _if ) { ///主控件 Dialog dialog = new Dialog(); dialog.Show(); ///背景的父控件 FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; dialog.AddChidren(fLayout); fLayout.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; ///弹框父控件 FrameLayout tipFLayout = new FrameLayout { X = Application.GetRealWidth(144), Y = Application.GetRealHeight(706), Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(351 + 127), BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, Radius = (uint)Application.GetRealHeight(17) }; fLayout.AddChidren(tipFLayout); ///上面快的父控件 FrameLayout topFrame = new FrameLayout { Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(351), }; tipFLayout.AddChidren(topFrame); ///提示控件 Button tipBtn = new Button { Y = Application.GetRealHeight(69), X = Application.GetRealWidth(150), Height = Application.GetRealHeight(63), Width = Application.GetRealWidth(492), TextID = R.MyInternationalizationString.tip, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicTipColor, TextSize = 16, }; topFrame.AddChidren(tipBtn); ///文本控件 Button Text1Btn = new Button { Y = Application.GetRealHeight(187), X = Application.GetRealWidth(50), Height = Application.GetRealHeight(58), Width = Application.GetRealWidth(792-100), Text= tipText, TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextSize = 14, }; topFrame.AddChidren(Text1Btn); ///下面快的父控件 FrameLayout bottomFrame = new FrameLayout { Y = topFrame.Bottom, Width = Application.GetRealWidth(792), Height = Application.GetRealHeight(127), }; tipFLayout.AddChidren(bottomFrame); ///取消控件 Button cancelBtn = new Button { TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextSize = 14, Height = Application.GetRealHeight(127), Width = Application.GetRealWidth(397), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, TextID = R.MyInternationalizationString.cancel, }; bottomFrame.AddChidren(cancelBtn); ///确认控件 Button okBtn = new Button { TextAlignment = TextAlignment.Center, TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, TextSize = 14, X = cancelBtn.Right, Height = Application.GetRealHeight(127), Width = bottomFrame.Width - cancelBtn.Width, BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor, TextID = R.MyInternationalizationString.confrim, }; bottomFrame.AddChidren(okBtn); if (_if) { cancelBtn.X = Application.GetRealWidth(0); cancelBtn.Width = Application.GetRealWidth(0); okBtn.X = Application.GetRealWidth(0); okBtn.Width = Application.GetRealWidth(792); okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); } else { cancelBtn.X = Application.GetRealWidth(0); cancelBtn.Width = Application.GetRealWidth(397); okBtn.X = Application.GetRealWidth(397); okBtn.Width = bottomFrame.Width - cancelBtn.Width; cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft); okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight); } ///取消点击事件 cancelBtn.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; ///确认点击事件 okBtn.MouseUpEventHandler += (sender, e) => { dialog.Close(); }; } } } ZigbeeApp/Shared/Phone/Device/Logic/SkipView.cs
@@ -8,7 +8,7 @@ namespace Shared.Phone.Device.Logic { public class SkipView public class SkipView:FrameLayout { /// <summary> /// 其它界面跳进来的入口 @@ -20,8 +20,10 @@ { case 0: { //new一个新逻辑对象; //新增正常自动化入口 ////new一个新逻辑对象; ////新增正常自动化入口 Common.Logic.CurrentLogic = new Common.Logic(); Common.Logic.CurrentLogic.IsEnable = 1;//默认为开 Common.Logic.CurrentLogic.LogicType = 0;//标记逻辑类型 @@ -60,32 +62,11 @@ doorLockLogicList.Show(); } break; case 2: { ///Sone门锁主入口 if (doorLock == null) { ///防止抛异常 doorLock = new DoorLock(); } Send.CurrentDoorLock = doorLock; ///进来刷新一次设备列表; Common.Logic.LogicDviceList.Clear(); if (Common.Logic.LogicDviceList.Count == 0) { Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); } var addLogicPage = new SoneLogicList(); UserView.HomePage.Instance.AddChidren(addLogicPage); UserView.HomePage.Instance.PageIndex += 1; addLogicPage.Show(); } break; } } #region ◆ 自动化__________________________ /// <summary> @@ -698,7 +679,7 @@ #endregion /// <summary> /// 门锁取消设置用的方法(相当一个关闭常开模式按钮,分类-自动化-不需要显示该自动化) /// 门锁失效设置用的方法(相当一个关闭常开模式按钮,分类-自动化-不需要显示该自动化) /// </summary> /// <param name="timeVlaue">时间值</param> /// <param name="common">设备</param> @@ -776,6 +757,30 @@ } return logic; } ///<summary> ///删除所有时效性自动化 /// 返回值:true成功;false失败; /// </summary> public static async System.Threading.Tasks.Task<bool> GetLogicAll() { bool _if = false; var Idlist = await Send.GetLogicId(3); if (Idlist.Count != 0) { _if = true; for (int i = 0; i < Idlist.Count; i++) { int id = Idlist[i]; //本来只有一条时效性自动化, //防止特殊情况,找到就删除掉; Send.DelLogic(id); } } return _if; } } } ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -8,12 +8,23 @@ { public class SoneLogicList : FrameLayout { /// <summary> /// 给Sone门锁徐梅更新界面用的 /// </summary> /// public SoneLogicList() { Tag = "SoneLogic"; } /// <summary> /// /// </summary> /// <param name="action">给徐梅刷新界面用的</param> /// <param name="bool_If"></param> public Action<bool> action; public async void Show() { #region 界面的布局代码 UserView.HomePage.Instance.ScrollEnabled = false;//锁住左滑 TopView view = new TopView(); @@ -22,7 +33,13 @@ view.clickBtn.MouseDownEventHandler += (sender, e) => { UserView.HomePage.Instance.ScrollEnabled = true; if (action != null) { action(Send.CurrentDoorLock.IsDoorLockNormallyMode); } RemoveFromParent(); }; var middle = new FrameLayout @@ -54,10 +71,11 @@ SelectedImagePath = "ZigeeLogic/openMode.png", }; fLayout.AddChidren(modeIconBtn); var logic = await SkipView.GetLogicIfon(); if (logic != null) { if (Send.CurrentDoorLock.IsDoorLockNormallyMode) { /// 查找是否存在时效性自动化;有的话就返回自动化对象; var logic = await SkipView.GetLogicIfon(); fLayout.Height = Application.GetRealHeight(780);//改变高度 modeIconBtn.IsSelected = true;//改变图标状态 @@ -82,26 +100,33 @@ TextSize = 16, }; openModeFl.AddChidren(closeBtn); closeBtn.MouseUpEventHandler += (sender,e) => { var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm, Language.StringByID(MyInternationalizationString.doyouwanttodelete), Language.StringByID(MyInternationalizationString.confrim)); alert.Show(); alert.ConfirmClickEvent += () => closeBtn.MouseUpEventHandler += async (sender, e) => { var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock); if (result) { Send.DelLogic(logic.LogicId); if (logic != null) { ///有可能只有常开模式,没有时效性自动化 ///没有判断的话,逻辑会为空,抛出异常; Send.DelLogic(logic.LogicId); } Send.CurrentDoorLock.IsDoorLockNormallyMode = false; this.RemoveFromParent(); var soneLogicList = new SoneLogicList(); UserView.HomePage.Instance.AddChidren(soneLogicList); UserView.HomePage.Instance.PageIndex += 1; soneLogicList.Show(); }; } else { ///提示失败 } }; ///显示失效设置时间文本控件 var timeTextBtn= new Button var timeTextBtn = new Button { Y = Application.GetRealHeight(127 + 69), X = Application.GetRealWidth(225), @@ -111,19 +136,23 @@ TextColor = ZigbeeColor.Current.LogicTextBlackColor, Text = "时效性常开设置12:20", }; openModeFl.AddChidren(timeTextBtn); if (logic != null) { ///有时效性常开才显示时间条件文本 openModeFl.AddChidren(timeTextBtn); } ///时效性常开只有一个条件; try { var y = DateTime.Now.ToString("yy");//那一年 var m = DateTime.Now.ToString("mm");//那一月 var d = DateTime.Now.ToString("dd");//那一天 var h =int.Parse(DateTime.Now.ToString("HH"));//当前系统时间 var h = int.Parse(DateTime.Now.ToString("HH"));//当前系统时间 var me = DateTime.Now.ToLongDateString(); var timeInt = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]); int dayInt = (h + timeInt)/ 24;//算出几天后执行 int dayInt = (h + timeInt) / 24;//算出几天后执行 int hour = (h + timeInt) % 24;//算出几天后那个时间执行 timeTextBtn.Text = "时效性常开设置" + y + "年" + m + "月" + d + dayInt + "号" + timeInt + "时"+ "执行"; timeTextBtn.Text = "时效性常开设置" + y + "年" + m + "月" + d + dayInt + "号" + timeInt + "时" + "执行"; } catch { } @@ -155,8 +184,8 @@ TextSize = 15, TextColor = ZigbeeColor.Current.LogicTextBlackColor, TextAlignment = TextAlignment.CenterLeft, // Text = "时效性常开设置", TextID=MyInternationalizationString.timeSetSone, // Text = "时效性常开设置", TextID = MyInternationalizationString.timeSetSone, }; modeFl.AddChidren(modeTextBtn); ///下一级菜单图标控件 @@ -170,20 +199,54 @@ }; modeFl.AddChidren(nextIconBtn); var clickBtn = new Button { Y = Application.GetRealHeight(478), X = Application.GetRealWidth(58), Height = Application.GetRealHeight(138), Width = Application.GetRealWidth(1022), }; modeFl.AddChidren(clickBtn); clickBtn.MouseUpEventHandler += async (sender, e) => { var d = await SkipView.LockAddModifyLogic(12, Send.CurrentDoorLock); }; nextIconBtn.MouseUpEventHandler += (sender, e) => { LogicView.TipView.ShowConfrimTip(() => {///再次确认 LogicView.TipView.ShowInputTip(true, async (str) => {///确认发送命令 try { ///xm var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock); if (!result) { Application.RunOnMainThread(() => { ///提示失败 }); return; } else { ///因为有常开模式下才可以创建失效逻辑; SkipView.GetLogicAll();//删除之前所有失效逻辑 var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//添加一条失效逻辑 if (!addResult) { ///提示失败 return; } Send.CurrentDoorLock.IsDoorLockNormallyMode = true; this.RemoveFromParent(); var soneLogicList = new SoneLogicList(); UserView.HomePage.Instance.AddChidren(soneLogicList); UserView.HomePage.Instance.PageIndex += 1; soneLogicList.Show(); } } catch { } }); }); }; } #endregion @@ -234,7 +297,7 @@ addLogicfL.AddChidren(addIconBtn); addIconBtn.MouseUpEventHandler += (sender, e) => { //读取系统当前时间:时-分 //读取系统当前时间:时-分 var h = DateTime.Now.ToString("HH"); ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceFreshAirDetailCardForm.cs
@@ -106,7 +106,7 @@ { if (!btnManual.IsSelected) { this.SetFanComand(7); this.SetFanComand(15); } }; @@ -217,7 +217,7 @@ ///3:High ///4:On ///5:Auto /// 7:Manual /// 15:Manual /// </summary> private void SetFanComand(int command) { @@ -247,7 +247,7 @@ case 5: FreshAirDev.SetAuto(); break; case 7: case 15: FreshAirDev.SetManual(); break; } @@ -295,7 +295,7 @@ this.listControl[2].IsBold = false; this.listControl[3].Visible = false; } else if (FreshAirDev.currentFanMode == 7) else if (FreshAirDev.currentFanMode == 15) { this.listControl[0].TextColor = ZigbeeColor.Current.XMGray3; this.listControl[0].IsBold = false; ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs
@@ -296,7 +296,7 @@ //如果这个函数被重写的话,则代表这个设备有开关功能 this.isHadOpenSwitch = false; //默认用在线状态来判断 return i_device.IsOnline == 1; return Common.LocalDevice.Current.CheckDeviceIsOnline(i_device); } ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/DeviceFreshAirCardControl.cs
New file @@ -0,0 +1,116 @@ using System; using Shared.Phone.UserCenter; using ZigBee.Device; namespace Shared.Phone.MainPage.Controls { /// <summary> /// 新风卡片的控件 /// </summary> public class DeviceFreshAirCardControl : DeviceCardCommon { #region ■ 初始化_____________________________ /// <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) => { //如果住宅为虚拟住宅 if (Common.Config.Instance.Home.IsVirtually == true) { //直接变更缓存 ((FreshAir)i_device).currentFanStatus = btnSwitch.IsSelected == true ? 4 : 0; this.RefreshControlInfo(this.device); return; } bool setStatu = !btnSwitch.IsSelected; //变更卡片状态 this.SetCardOpenStatu(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(); } }; } #endregion #region ■ 深度卡片信息_______________________ /// <summary> /// 添加跳转深度卡片信息事件 /// </summary> private void AddDetailInfoEvent(CommonDevice i_device) { //深度卡片信息 this.ButtonClickEvent += (sender, e) => { Common.CommonPage.Instance.IsDrawerLockMode = true; //新风类型的深度卡片界面 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 (Common.Config.Instance.Home.IsVirtually == true) { //如果住宅为虚拟住宅,则此功能无效 return; } //检测能否发送获取状态命令 if (this.CheckCanSendStatuComand() == true) { HdlDeviceAttributeLogic.Current.SendACStatuComand(this.device); } } #endregion } } ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs
@@ -64,7 +64,7 @@ /// <summary> /// 未分配界面的设备选择控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public DeviceSelectUnallocatedControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs
@@ -607,6 +607,11 @@ { cardContr = new Controls.DeviceAcCardControl(); } //新风 else if (device.Type == DeviceType.FreshAir) { cardContr = new Controls.DeviceFreshAirCardControl(); } //彩灯(调光器) else if (device.Type == DeviceType.DimmableLight) { @@ -1139,6 +1144,11 @@ //空调是特殊的,它的开关是属性上报来着.已经接收到网关的反馈 this.dicDeviceCardControl[mainKeys].SetHadGetResponeResultStatu(); } if (report.DeviceStatusReport.CluterID == 514 && report.DeviceStatusReport.AttriBute[0].AttributeId == 0) { //新风是特殊的,它的开关是属性上报来着.已经接收到网关的反馈 this.dicDeviceCardControl[mainKeys].SetHadGetResponeResultStatu(); } this.dicDeviceCardControl[mainKeys].RefreshControlInfo(locadevice); } }, ShowErrorMode.NO); @@ -1153,7 +1163,8 @@ if (this.dicDeviceCardControl.ContainsKey(mainKeys) == true) { //刷新卡片状态 this.dicDeviceCardControl[mainKeys].SetCardOnlineStatu(report.IsOnline == 1); bool bolOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(report); this.dicDeviceCardControl[mainKeys].SetCardOnlineStatu(bolOnline); return; } ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/BelongAreaControl.cs
@@ -47,7 +47,7 @@ /// <summary> /// 所属区域的控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public BelongAreaControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { //初始化数据 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/NormalSelectControl.cs
@@ -58,7 +58,7 @@ /// 做成一个简单的选择控件 /// </summary> /// <param name="i_text">显示文本</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public NormalSelectControl(string i_text, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.textValue = i_text; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SafetySensorStatuControl.cs
@@ -81,7 +81,7 @@ btnOnline.X = this.Width - Application.GetRealWidth(200 + 46); btnOnline.Y = btnDeviceName.Y; btnOnline.TextAlignment = TextAlignment.CenterRight; this.SetOnlineStatu(device.IsOnline == 1); this.SetOnlineStatu(Common.LocalDevice.Current.CheckDeviceIsOnline(device)); this.AddChidren(btnOnline); } ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
@@ -62,7 +62,7 @@ /// 做成一个显示设备类型+设备MAC备注的RowLayout /// </summary> /// <param name="i_deviceMac">设备的Mac地址</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public DeviceObjectControl(string i_deviceMac, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.deviceMac = i_deviceMac; @@ -96,7 +96,7 @@ frameTable.AddBottomLine(); //设置在线状态的特效 this.isOnline = listDevice[0].IsOnline == 1; this.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]); } #endregion @@ -144,7 +144,7 @@ //设备房间 btnDeviceRoom.Text = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]); //设置在线状态的特效 this.isOnline = listDevice[0].IsOnline == 1; this.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]); } ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs
@@ -61,7 +61,7 @@ /// 做成一个显示设备回路+房间的RowLayout /// </summary> /// <param name="i_device">设备对象</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public DeviceRoomControl(CommonDevice i_device, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.mainKey = Common.LocalDevice.Current.GetDeviceMainKeys(i_device); ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceSelectControl.cs
@@ -63,7 +63,7 @@ /// </summary> /// <param name="i_device">设备对象</param> /// <param name="autoSelect">当点击此控件时,是否自动设置选择状态</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public DeviceSelectControl(CommonDevice i_device, bool autoSelect, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.MainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(i_device); ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceSimpleSelectControl.cs
@@ -63,7 +63,7 @@ /// </summary> /// <param name="i_device">设备对象</param> /// <param name="autoSelect">当点击此控件时,是否自动设置选择状态</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public DeviceSimpleSelectControl(CommonDevice i_device, bool autoSelect, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.MainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(i_device); ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/GatewayRowControl.cs
@@ -71,7 +71,7 @@ /// 做成一个显示网关信息的RowLayout,添加此控件到容器后,调用【InitControl()】完成初始化 /// </summary> /// <param name="i_zbGateway">网关对象</param> /// <param name="ChidrenYaxis">子控件Y轴偏移量(有些界面需要这种特殊操作)</param> /// <param name="ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public GatewayRowControl(ZbGateway i_zbGateway, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(i_zbGateway); ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionInputControl.cs
@@ -37,7 +37,7 @@ /// </summary> /// <param name="i_caption">标题文本</param> /// <param name="i_text">输入框的值</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public FrameCaptionInputControl(string i_caption, string i_text, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.UseClickStatu = false; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameCaptionViewControl.cs
@@ -37,7 +37,7 @@ /// </summary> /// <param name="i_caption">标题文本</param> /// <param name="i_text">显示文本的值</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public FrameCaptionViewControl(string i_caption, string i_text, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { btnCaption = new NormalViewControl(270, 58, true); ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs
@@ -54,7 +54,7 @@ /// <summary> /// 做成一个点击后能够显示点击状态的控件 /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public FrameLayoutStatuControl(int i_ChidrenYaxis = 0) { this.chidrenYaxis = i_ChidrenYaxis; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameRowControl.cs
@@ -42,7 +42,7 @@ /// <summary> /// 做成一个RowLayout型的FrameLayout /// </summary> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public FrameRowControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.Height = ControlCommonResourse.ListViewRowHeight; @@ -331,7 +331,8 @@ } var contr = this.AddLeftCaption(i_caption, i_width, Application.GetRealHeight(60), false); contr.TextSize = 15; contr.Y = Application.GetRealHeight(12) + this.chidrenYaxis; //当指定实际坐标时,这里需要的偏移量为2倍 contr.Y = Application.GetRealHeight(12) + this.chidrenYaxis * 2; this.AddChidren(contr, ChidrenBindMode.BindEventOnly); return contr; @@ -355,7 +356,8 @@ i_width = Application.GetRealWidth(i_width); } var contr = this.AddLeftCaption(i_caption, i_width, Application.GetRealHeight(50), false); contr.Y = Application.GetRealHeight(72) + this.chidrenYaxis; //当指定实际坐标时,这里需要的偏移量为2倍 contr.Y = Application.GetRealHeight(72) + this.chidrenYaxis * 2; contr.TextSize = 12; contr.TextColor = UserCenterColor.Current.TextGrayColor1; this.AddChidren(contr, ChidrenBindMode.BindEventOnly); ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
@@ -52,7 +52,7 @@ /// 设备功能类型的自定义行控件(选择功能之后,无条件直接变更类型) /// </summary> /// <param name="i_device">设备的对象</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public DeviceFunctionTypeRowControl(CommonDevice i_device, int i_ChidrenYaxis = 0) : base("", "", i_ChidrenYaxis) { this.device = i_device; @@ -178,7 +178,7 @@ strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800); nowSelectNo = -1; } else if (this.device.Type == DeviceType.DoorLock) else if (this.device.Type == DeviceType.FreshAir) { //新风固定为 新风 strType = Language.StringByID(R.MyInternationalizationString.FreshAir); ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/RowLayoutControl.cs
@@ -41,7 +41,7 @@ /// <summary> /// 做成一个点击能够显示选中状态背景色的RowLayout(拥有桌布) /// </summary> /// <param name="ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public RowLayoutControl(int i_ChidrenYaxis = 0) { this.LineColor = UserCenterColor.Current.Transparent; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/SceneRoomControl.cs
@@ -39,7 +39,7 @@ /// </summary> /// <param name="i_SceneId">场景ID</param> /// <param name="i_SceneName">场景名</param> /// <param name="i_chidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_chidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public SceneRoomControl(int i_SceneId, string i_SceneName, int i_chidrenYaxis) : base(i_chidrenYaxis) { this.SceneId = i_SceneId; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/SceneControls/SceneSimpleSelectControl.cs
@@ -65,7 +65,7 @@ /// 做成一个简单场景选择的行控件(它会自动设置选择状态) /// </summary> /// <param name="i_Scene">场景对象</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(真实值,有些界面需要这种特殊操作)</param> /// <param name="i_ChidrenYaxis">子控件Y轴偏移量(【列表控件的rowSpace/2】即可,不懂默认为0即可)</param> public SceneSimpleSelectControl(Common.SceneUI i_Scene, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) { this.SceneId = i_Scene.Id; ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
@@ -113,6 +113,37 @@ return true; } /// <summary> /// 设置面板颜色 /// </summary> /// <param name="panel">按键面板的</param> /// <param name="colorData">只设置开的颜色</param> /// <returns></returns> public async Task<bool> SetPanelColorInfo(Panel panel, Panel.KeyColorData colorData) { var keyNum = new Panel.KeyNumStatus(); //默认第一个用面板第一个按键颜色作为整个面板的颜色 keyNum.Key1 = true; var result = await panel.SetPanelColorInfoAsync(colorData, keyNum); if (result == null || result.responseData == null) { //设置按键面板指示灯颜色失败 string msg = Language.StringByID(R.MyInternationalizationString.uSetPanelPilolightSettionFail); this.ShowErrorMsg(msg); return false; } if (result.responseData.status != 0) { //设置按键面板指示灯颜色失败 string msg = Language.StringByID(R.MyInternationalizationString.uSetPanelPilolightSettionFail); this.ShowErrorMsg(msg); return false; } //备份设备 await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(panel, GatewayBackupEnum.A干接点颜色调节, colorData); return true; } #endregion #region ■ 亮度调节___________________________ ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlExperienceAccountLogic.cs
@@ -241,6 +241,7 @@ list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A水浸传感器, RoomId = floorKey + "_ChuFang", DeviceCount = 1 }); list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A烟雾传感器, RoomId = floorKey + "_ChuFang", DeviceCount = 1 }); list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A燃气传感器, RoomId = floorKey + "_ChuFang", DeviceCount = 1 }); list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A吸顶燃气传感器, RoomId = floorKey + "_ChuFang", DeviceCount = 1 }); //走廊 list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A4按键面板, RoomId = floorKey + "_ZouLang", DeviceCount = 1 }); @@ -255,6 +256,9 @@ { //先刷新容器 LocalDevice.Current.ReFreshByLocal(); //顺便也整一下网关(有可能它是从实体账号转为虚拟时,没有清空) HdlGatewayLogic.Current.ReFreshByLocal(); HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId(); Type thisType = m_Current.GetType(); //获取需要创建的虚拟设备列表 @@ -580,6 +584,19 @@ device.IasDeviceType = 43; //设置设备的基本信息 this.SetBaseDataToDevice(device, 1300, 1300, "MSG01/M-ZB.10", i_RoomId); this.DeviceNumber++; } } public void Zigbee吸顶燃气传感器(int i_DeviceCount, string i_RoomId) { for (int i = 0; i < i_DeviceCount; i++) { var device = new IASZone() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1 }; device.IasDeviceType = 43; //设置设备的基本信息 this.SetBaseDataToDevice(device, 1300, 1300, "MGCD01/ZB.10", i_RoomId); this.DeviceNumber++; } @@ -933,7 +950,8 @@ A方悦双开四控面板 = 23, A方悦四开八控面板 = 24, A方悦新风面板 = 25, A方悦新风小模块 = 26 A方悦新风小模块 = 26, A吸顶燃气传感器 = 27, } #endregion ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
@@ -362,7 +362,7 @@ ((FreshAir)locadevice).currentFanSpeed = attData.AttriButeData; break; case 5: case 7: case 15: ((FreshAir)locadevice).currentFanMode = attData.AttriButeData; break; } @@ -507,6 +507,8 @@ if (locadevice != null) { ((IASZone)locadevice).iASInfo = ias.iASInfo; //如果接收到上报,即说明这个传感器是在线的 locadevice.IsOnline = 1; //记录回复时间 locadevice.LastDateTime = DateTime.Now; } ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs
@@ -170,6 +170,26 @@ } /// <summary> /// 获取当前楼层名称 /// fllodID:楼层ID /// </summary> /// <returns></returns> public static string GetBindTargetsFloorIdName(string curFllodID) { var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); foreach (var floorId in dicFloor.Keys) { //当前楼层 if (curFllodID == floorId) { return dicFloor[floorId]; break; } } return null; } /// <summary> /// 检测控制面板(按键类)所拥有的功能,现支持的有以下几种(必定存在键值,出错会返回null) /// </summary> /// <returns>The panel key function level2.</returns> ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceAddSuccessForm.cs
@@ -55,6 +55,8 @@ this.SetAllEpointName(); // 设置网关所在的时区的时间给门锁时间 this.SetDoorTime(); //新入网的设备,清空掉它的房间 this.ClearDeviceFromRoom(); } /// <summary> @@ -306,6 +308,23 @@ #endregion #region ■ 一般方法___________________________ /// <summary> /// 新入网的设备,清空掉它的房间 /// </summary> private void ClearDeviceFromRoom() { foreach (var device in this.listNewDevice) { HdlRoomLogic.Current.DeleteDevice(device); HdlRoomLogic.Current.DeleteLoveDevice(device); } Common.LocalDevice.Current.DeleteRealDeviceFromRoom(this.listNewDevice[0]); } #endregion #region ■ 画面关闭___________________________ /// <summary> ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -348,7 +348,7 @@ //右箭头 rowDevice.frameTable.AddRightArrow(); //在线状态 rowDevice.isOnline = device.IsOnline == 1; rowDevice.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device); //保存控件 string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device); @@ -792,7 +792,7 @@ { if (rowInfo != null) { rowInfo.MenuRow.isOnline = device.IsOnline == 1; rowInfo.MenuRow.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device); if (rowInfo.dicDetailRow != null) { foreach (var detailRow in rowInfo.dicDetailRow.Values) ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
@@ -96,11 +96,13 @@ this.ClearBodyFrame(); //图片 var btnPic = new PicViewControl(878, 478); btnPic.Y = Application.GetRealHeight(251); btnPic.Gravity = Gravity.CenterHorizontal; btnPic.UnSelectedImagePath = "Instruct/DeviceSearch.png"; bodyFrameLayout.AddChidren(btnPic); var framePic = new FrameLayout(); framePic.Width = this.GetPictrueRealSize(878); framePic.Height = this.GetPictrueRealSize(478); framePic.Y = Application.GetRealHeight(251); framePic.Gravity = Gravity.CenterHorizontal; framePic.BackgroundImagePath = "Instruct/DeviceSearch.png"; bodyFrameLayout.AddChidren(framePic); //正在搜索设备,请稍候… var btnSearch = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false); @@ -150,7 +152,7 @@ this.realGateway.GwResDataAction += this.AdjustGatewayResultData; } //开启连接的假想动画效果线程 this.StartConcetionAnimeteThread(); this.StartConcetionAnimeteThread(framePic); } #endregion @@ -312,7 +314,7 @@ /// <summary> /// 开启连接的假想动画效果线程 /// </summary> private void StartConcetionAnimeteThread() private void StartConcetionAnimeteThread(FrameLayout framePic) { int iconSize = this.GetPictrueRealSize(23); @@ -320,15 +322,15 @@ for (int i = 0; i < 9; i++) { //X轴+Index*(图标大小+间距) listPoint.Add(this.GetPictrueRealSize(394) + i * (iconSize + this.GetPictrueRealSize(10))); listPoint.Add(this.GetPictrueRealSize(300) + i * (iconSize + this.GetPictrueRealSize(10))); } var btnRound = new PicViewControl(iconSize, iconSize, false); btnRound.Radius = (uint)iconSize / 2; btnRound.BackgroundColor = UserCenterColor.Current.ConcetionRoundColor; btnRound.X = listPoint[0]; btnRound.Y = this.GetPictrueRealSize(475); bodyFrameLayout.AddChidren(btnRound); btnRound.Y = this.GetPictrueRealSize(225); framePic.AddChidren(btnRound); HdlThreadLogic.Current.RunThread(() => { ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs
@@ -152,6 +152,11 @@ unSelectPic = "Device/SensorCarbonMonoxide.png"; this.AddMenuRow(objectText, unSelectPic, "SensorCarbonMonoxideDirectionForm"); //吸顶燃气传感器 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName26); unSelectPic = "Device/SensorCarbonMonoxide.png"; this.AddMenuRow(objectText, unSelectPic, "SensorCeilingGasDirectionForm"); //烟雾传感器 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName20); unSelectPic = "Device/SensorFire.png"; ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/PanelFangyueFreshAirModulDirectionForm.cs
@@ -70,7 +70,7 @@ //长按图示按键5秒以上,指示灯变绿、闪烁 //进入配网状态。绿灯快闪3秒则配网成功 string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddTwoButtonPanelMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); string[] msgArry = Language.StringByID(R.MyInternationalizationString.AddFreshAirModulPanelMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg1.Y = Application.GetRealHeight(1037); ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/SensorCeilingGasDirectionForm.cs
New file @@ -0,0 +1,90 @@ using System; using System.Collections.Generic; using System.Text; namespace Shared.Phone.UserCenter.DeviceDirection { /// <summary> /// 吸顶燃气传感器的添加步骤界面 /// </summary> public class SensorCeilingGasDirectionForm : DirectionCommonForm { #region ■ 初始化_____________________________ /// <summary> /// 画面显示(底层会固定调用此方法,借以完成画面创建) /// </summary> public void ShowForm() { //设置头部信息 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); //初始化中部信息 this.InitMiddleFrame(); } /// <summary> /// 初始化中部信息 /// </summary> private void InitMiddleFrame() { //图片 var framePic = new FrameLayout(); framePic.Width = this.GetPictrueRealSize(948); framePic.Height = this.GetPictrueRealSize(702); framePic.Gravity = Gravity.CenterHorizontal; framePic.Y = Application.GetRealHeight(138); bodyFrameLayout.AddChidren(framePic); var btnPic = new PicViewControl(framePic.Width, framePic.Height, false); btnPic.UnSelectedImagePath = "Instruct/SensorCeilingGas.png"; framePic.AddChidren(btnPic); //绿色指示灯快速闪烁 var btnGreanLinght = new NormalViewControl(this.GetPictrueRealSize(501), this.GetPictrueRealSize(45), false); btnGreanLinght.X = this.GetPictrueRealSize(447); btnGreanLinght.Y = this.GetPictrueRealSize(326); btnGreanLinght.TextAlignment = TextAlignment.Center; btnGreanLinght.TextColor = UserCenterColor.Current.TextGrayColor3; btnGreanLinght.TextSize = 10; btnGreanLinght.TextID = R.MyInternationalizationString.uGreanPilotLampLinghtQuickly; framePic.AddChidren(btnGreanLinght); //长按5秒 //(按键) string textMsg = Language.StringByID(R.MyInternationalizationString.uLongClickPanelSomeSecond); if (textMsg.Contains("{0}") == true) { textMsg = string.Format(textMsg, "5"); } var btnSecond2 = new NormalViewControl(this.GetPictrueRealSize(463), this.GetPictrueRealSize(45), false); btnSecond2.Y = this.GetPictrueRealSize(222); btnSecond2.TextColor = UserCenterColor.Current.TextGrayColor3; btnSecond2.TextSize = 10; btnSecond2.TextAlignment = TextAlignment.Center; btnSecond2.Text = textMsg; framePic.AddChidren(btnSecond2); //长按图示按键5秒以上,绿色快闪 //进入配网状态,绿灯常亮则入网成功 string[] msgArry = Language.StringByID(R.MyInternationalizationString.uAddSensorCeilingGasMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); var msg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg1.Y = Application.GetRealHeight(1037); msg1.Text = msgArry[0]; msg1.TextColor = UserCenterColor.Current.TextGrayColor3; msg1.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg1); var msg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false); msg2.Y = msg1.Bottom; if (msgArry.Length > 1) { msg2.Text = msgArry[1]; } msg2.TextColor = UserCenterColor.Current.TextGrayColor3; msg2.TextAlignment = TextAlignment.Center; bodyFrameLayout.AddChidren(msg2); } #endregion } } ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirBackLightSettionForm.cs
@@ -78,8 +78,9 @@ //添加屏幕亮度级别控件 this.AddScreenBrightnesLevelControl(); //添加背光灯亮度控件【暂时不需要,可能后期新风面板的这个颜色要补回来】 //this.AddBackLightControl(); this.AddBackLightControl(); //【暂时不需要,可能后期新风面板的这个颜色要补回来】 //this.FinishInitControl(listview, energyModeInfo.enable); @@ -256,10 +257,10 @@ } #endregion #region ■ 背光灯亮度_________________________ #region ■ 背光颜色_________________________ /// <summary> /// 添加背光灯亮度控件 /// 添加背光颜色控件 /// </summary> private void AddBackLightControl() { @@ -270,69 +271,28 @@ //背景 var frameBack = new FrameLayout(); frameBack.Y = Application.GetRealHeight(490); frameBack.Height = Application.GetRealHeight(429); frameBack.Height = Application.GetRealHeight(170); frameBack.BackgroundColor = UserCenterColor.Current.White; listview.AddChidren(frameBack); //背光灯亮度 //背光灯颜色 var btnLevelView = new NormalViewControl(400, 60, true); btnLevelView.X = ControlCommonResourse.XXLeft; btnLevelView.Y = Application.GetRealHeight(54); btnLevelView.TextID = R.MyInternationalizationString.uBacklightBrightness; btnLevelView.Gravity = Gravity.CenterVertical; btnLevelView.TextID = R.MyInternationalizationString.BackgroundLightColor; frameBack.AddChidren(btnLevelView); //当前亮度 var btnProgressView1 = new NormalViewControl(200, 50, true); btnProgressView1.X = ControlCommonResourse.XXLeft; btnProgressView1.Y = Application.GetRealHeight(157); btnProgressView1.TextSize = 12; btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1; btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance; frameBack.AddChidren(btnProgressView1); var btnProgress1 = new NormalViewControl(200, 50, true); btnProgress1.X = Application.GetRealWidth(222); btnProgress1.Y = Application.GetRealHeight(157); btnProgress1.TextSize = 12; btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1; btnProgress1.Text = "70%"; frameBack.AddChidren(btnProgress1); //进度条 var seekBar1 = new SeekBarControl(); seekBar1.Y = Application.GetRealHeight(253); frameBack.AddChidren(seekBar1); seekBar1.ProgressChangedEvent += (div, value) => { btnProgress1.Text = value + "%"; }; //seekBar1.Progress = linghtLevelInfo.panelBacklightLevel; var btnTemp1 = new NormalViewControl(200, 50, true); btnTemp1.X = ControlCommonResourse.XXLeft; btnTemp1.Y = Application.GetRealHeight(322); btnTemp1.TextSize = 12; btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3; btnTemp1.Text = "0%"; frameBack.AddChidren(btnTemp1); var btnTemp2 = new NormalViewControl(200, 50, true); btnTemp2.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(200); btnTemp2.Y = Application.GetRealHeight(322); btnTemp2.TextAlignment = TextAlignment.CenterRight; btnTemp2.TextSize = 12; btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3; btnTemp2.Text = "100%"; frameBack.AddChidren(btnTemp2); var frameColor = new FrameLayoutStatuControl(); frameColor.UseClickStatu = false; frameColor.Width = Application.GetRealHeight(262); frameColor.Height = this.GetPictrueRealSize(79); frameColor.Y = Application.GetRealHeight(26); frameColor.Gravity = Gravity.CenterVertical; frameColor.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262); frameBack.AddChidren(frameColor); //颜色 var btnColorView = new NormalViewControl(Application.GetRealHeight(110), this.GetPictrueRealSize(50), false); var btnColorView = new NormalViewControl(Application.GetRealHeight(110), this.GetPictrueRealSize(49), false); btnColorView.Gravity = Gravity.CenterVertical; btnColorView.TextAlignment = TextAlignment.CenterRight; btnColorView.TextSize = 12; @@ -341,28 +301,26 @@ btnColorView.TextID = R.MyInternationalizationString.uColor; frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly); int R1 = Convert.ToInt32("d8", 16); int G1 = Convert.ToInt32("95", 16); int B1 = Convert.ToInt32("e3", 16); int R1 = Convert.ToInt32(this.keyColorData.OpenColorR, 16); int G1 = Convert.ToInt32(this.keyColorData.OpenColorG, 16); int B1 = Convert.ToInt32(this.keyColorData.OpenColorB, 16); uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1); //颜色外框 var btnColorLine = new NormalViewControl(this.GetPictrueRealSize(79), this.GetPictrueRealSize(79), false); //颜色外框 var btnColorLine = new FrameLayoutStatuControl(); btnColorLine.Width = Application.GetRealHeight(79); btnColorLine.Height = this.GetPictrueRealSize(79); btnColorLine.X = btnColorView.Right + Application.GetRealHeight(18); btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2; btnColorLine.BorderWidth = 1; btnColorLine.BorderColor = 0xff666666; btnColorLine.BorderColor = 0xffcccccc; frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly); var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false); btnColor.Y = Application.GetRealHeight(5); btnColor.X = btnColorView.Right + Application.GetRealHeight(23); btnColor.Gravity = Gravity.Center; btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2; btnColor.BackgroundColor = UserCenterColor.Current.ErrorColor; frameColor.AddChidren(btnColor, ChidrenBindMode.BindEventOnly); //变更滑动条的颜色 seekBar1.ProgressBarColor = backColor; btnColor.BackgroundColor = backColor; btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEventOnly); var btnRight = new NormalViewControl(this.GetPictrueRealSize(58), this.GetPictrueRealSize(58), false); btnRight.UnSelectedImagePath = "Item/RightNext.png"; @@ -381,13 +339,11 @@ G1 = Gcolor; B1 = Bcolor; //this.keyColorData.CloseColorR = Convert.ToString(Rcolor, 16); //this.keyColorData.CloseColorG = Convert.ToString(Gcolor, 16); //this.keyColorData.CloseColorB = Convert.ToString(Bcolor, 16); this.keyColorData.OpenColorR = Convert.ToString(Rcolor, 16); this.keyColorData.OpenColorG = Convert.ToString(Gcolor, 16); this.keyColorData.OpenColorB = Convert.ToString(Bcolor, 16); btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor); //变更滑动条的颜色 seekBar1.ProgressBarColor = btnColor.BackgroundColor; }; }; } @@ -607,17 +563,16 @@ return; } //设置按键面板指定端点的【指示灯开关颜色】的信息 //result = await HdlDevicePanelLogic.Current.SetPanelEpointColorInfo(panelDevice, this.keyColorData); //this.CloseProgressBar(); //if (result == false) //{ // return; //} //设置按键面板颜色的信息 result = await HdlDevicePanelLogic.Current.SetPanelColorInfo(panelDevice, this.keyColorData); this.CloseProgressBar(); if (result == false) { return; } //关闭自身 this.CloseForm(); } #endregion #region ■ 补充容器___________________________ ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonInfo.cs
@@ -11,6 +11,10 @@ { #region 本地变量 /// <summary> /// 更新“逻辑常开”界面的回调 /// </summary> public static Action<bool> LogicAction = null; /// <summary> /// 网关(门锁)所在的时间 /// </summary> public static DateTime DoorlockZoneTime = DateTime.Now; @@ -146,14 +150,11 @@ /// </summary> public static void NormallyOpenModeValue(ZigBee.Device.DoorLock doorLock, bool value) { string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) doorLock.IsDoorLockNormallyMode = value; if (LogicAction != null) { doorLock.IsDoorLockNormallyMode[key] = value; } else { doorLock.IsDoorLockNormallyMode.Add(key, value); LogicAction(value); } } @@ -210,17 +211,9 @@ { //上报“常开模式”已被取消 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); @@ -232,7 +225,6 @@ 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; @@ -245,7 +237,6 @@ 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; @@ -260,7 +251,6 @@ ShowTipMsg(msg0); NormallyOpenModeValue(doorLock, true); CommonPage.Loading.Hide(); //new Tip() { MaxWidth = 150, Text = msg0, Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); }); } } @@ -279,12 +269,8 @@ 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 @@ -298,7 +284,6 @@ { 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; @@ -310,7 +295,6 @@ 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; @@ -325,22 +309,8 @@ 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(() => { @@ -354,32 +324,57 @@ }; } /// <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> /// <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> /// <returns></returns> public static async System.Threading.Tasks.Task<bool> SetNormallyOpenModeFuncAsync(ZigBee.Device.DoorLock doorLock) { //app设置“常开模式”失败 var result = await doorLock.SetNormallyOpenModeFuncAsync(false); if (result == null || result.defaultControlResponseData == null || result.defaultControlResponseData.status != 0) { return false; } if (result.defaultControlResponseData.status == 0) { //app设置“常开模式”成功 NormallyOpenModeValue(doorLock, false); return true; } return false; } /// <summary> /// 启动常开模式【弹窗】 /// </summary> @@ -406,6 +401,27 @@ alert.ConfirmClickEvent += async () => { NomallyOpenModeInvalidTimeDialog(doorLock, action); }; } /// <summary> /// 常开模式失效时间处理【弹窗】 /// </summary> public static async void NomallyOpenModeInvalidTimeDialog(ZigBee.Device.DoorLock doorLock, Action action) { //失效设置 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; Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); var result = await doorLock.SetNormallyOpenModeFuncAsync(true); if (result == null || result.defaultControlResponseData == null) @@ -436,43 +452,12 @@ 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 @@ -1237,7 +1222,6 @@ }); } #endregion #endregion } } ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs
@@ -133,8 +133,8 @@ } else { ///备注:WJC的 ///记录当前用户信息 ///记录当前用户信息H06C ///wjc Shared.Phone.Device.Logic.SkipView.SkipAddLogic(1, doorLock, accountObj); } ZigbeeApp/Shared/Phone/UserCenter/DoorLock/ShowDoorLockMsgControl.cs
@@ -112,6 +112,11 @@ ((ViewGroup)nowForm).AddChidren(MsgControlFrameLayout); MsgControlFrameLayout.MouseDownEventHandler += (sender, e) => { if (msgType == DoorLockMsgType.InValid) { return; } //移除界面 MsgControlFrameLayout.RemoveFromParent(); //回调函数 @@ -179,10 +184,15 @@ btnMsg.Text = msgText; } if (msgType == DoorLockMsgType.Confirm || msgType == DoorLockMsgType.InValid || msgType == DoorLockMsgType.NomallyOpenMode || msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) if (msgType == DoorLockMsgType.Confirm || msgType == DoorLockMsgType.NomallyOpenMode || msgType == DoorLockMsgType.CancelNomallyOpenModeWithLogic) { //初始化确认类型的底部按钮 this.InitBottomConfirmButton(MsgControlFrameLayout, frameBack); } else if (msgType == DoorLockMsgType.InValid) { //失效设置的底部按钮 this.InitBottomInvalidTimeButton(MsgControlFrameLayout, frameBack); } else if (msgType == DoorLockMsgType.DoorLockLogic) { @@ -336,6 +346,46 @@ } /// <summary> /// 失效时间的底部按钮 /// </summary> /// <param name="frameMain"></param> /// <param name="frameBack"></param> private void InitBottomInvalidTimeButton(FrameLayout frameMain, FrameLayout frameBack) { //确定按钮 var btnConfirm = new BottomRightClickButton(frameBack.Width, Application.GetRealHeight(127)); frameBack.AddChidren(btnConfirm); btnConfirm.InitControl(buttonOkText); btnConfirm.ButtonClickEvent += (sender, e) => { string textValue = string.Empty; if (editInvalidTime != null) { textValue = editInvalidTime.Text.Trim(); if (this.CheckInvalidTime(textValue.TrimStart('0')) == false) { return; } } //移除界面 frameMain.RemoveFromParent(); if (msgType == DoorLockMsgType.InValid) { if (InvalidTimeAction != null) { InvalidTimeAction(textValue); } } else { //回调函数 this.ConfirmClickEvent?.Invoke(); this.ConfirmClickEvent = null; } }; } /// <summary> /// 初始化确认类型的底部按钮 /// </summary> /// <param name="frameMain"></param> ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs
@@ -218,7 +218,7 @@ ClickHandle(); if (doorLock.IsOnline == 1) if (Common.LocalDevice.Current.CheckDeviceIsOnline(doorLock) == true) { ReadDoorLockUserInfo(); } @@ -605,15 +605,11 @@ { return; } string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) if (doorLock.IsDoorLockNormallyMode) { if (doorLock.IsDoorLockNormallyMode[key] == true) { if (canOpenNormallyMode) { Application.RunOnMainThread(() => { NomallyOpenModeInvalidDialog(true); }); } if (canOpenNormallyMode) { Application.RunOnMainThread(() => { NomallyOpenModeInvalidDialog(true); }); } } } @@ -849,20 +845,11 @@ //开锁事件 EventHandler<MouseEventArgs> hander1 = async (sender, e) => { string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) if (doorLock.IsDoorLockNormallyMode) { if (doorLock.IsDoorLockNormallyMode[key] == true) { if (canOpenNormallyMode) { NomallyOpenModeInvalidDialog(false); } else { OpenDoorLockHandle(progressButton, btnDoorLockPic, btnStatus); } if (canOpenNormallyMode) { NomallyOpenModeInvalidDialog(false); } else { @@ -886,13 +873,9 @@ { if (canOpenNormallyMode) { var key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; if (doorLock.IsDoorLockNormallyMode.ContainsKey(key)) if (doorLock.IsDoorLockNormallyMode) { if (doorLock.IsDoorLockNormallyMode[key] == true) { NomallyOpenModeInvalidDialog(); } NomallyOpenModeInvalidDialog(); } } else @@ -1054,93 +1037,37 @@ // 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) action = () => { if (UserCenterResourse.UserInfo.AuthorityNo != 1) { this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate)); return; } if (!UserCenterResourse.AccountOption.DoorUnLockByRemote) { SystemSecondAuthentication(); return; } 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); alert.Show(); alert.ConfirmClickEvent += async () => { Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); var result = await doorLock.SetNormallyOpenModeFuncAsync(true); if (result == null || result.defaultControlResponseData == null) { string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); this.ShowTipMsg(msg0); return; } if (result.defaultControlResponseData.status != 0) { string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed); this.ShowTipMsg(msg1); return; } else { //添加App开启常开模式的历史记录 HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(this.doorLock, 9001, string.Empty); //每次重新设置常开,默认时间都是12小时 DoorLockCommonInfo.NormallyOpenModeInvalidTime = 12; DoorLockCommonInfo.NormallyOpenModeValue(doorLock, true); Application.RunOnMainThread(() => { UpdateNomallyOpenStatus(); CommonPage.Loading.Hide(); }); //常开模式开启提示 AlreadyOpenNormallyMode(); } }; }; HdlCheckLogic.Current.CheckSecondarySecurity(action); } else { NomallyOpenModeInvalidDialog(); } //系统密码支持操作门锁后,调用温居城的界面【常开自动化】 if (doorLock == null) { ///防止抛异常 return; } ///备注:WJC的 Shared.Phone.Device.Logic.Send.CurrentDoorLock = doorLock; ///进来刷新一次设备列表; Common.Logic.LogicDviceList.Clear(); if (Common.Logic.LogicDviceList.Count == 0) { Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); } var addLogicPage = new Shared.Phone.Device.Logic.SoneLogicList(); UserView.HomePage.Instance.AddChidren(addLogicPage); UserView.HomePage.Instance.PageIndex += 1; addLogicPage.Show(); addLogicPage.action += (w) => { doorLock.IsDoorLockNormallyMode = w; ///留给徐梅用的 UpdateNomallyOpenStatus(); }; }; //HdlCheckLogic.Current.CheckSecondarySecurity(action); #endregion } /// <summary> @@ -1415,12 +1342,7 @@ btnNormallyOpenFrameLayout.Width = Application.GetRealWidth(0); return; } string key = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; if (!doorLock.IsDoorLockNormallyMode.ContainsKey(key)) { return; } if (doorLock.IsDoorLockNormallyMode[key] == true) if (doorLock.IsDoorLockNormallyMode) { btnNormallyOpen.IsSelected = true; btnDoorLockPic.IsSelected = true; @@ -1428,7 +1350,7 @@ btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Current) + Language.StringByID(R.MyInternationalizationString.DoorLockOpen); } else if (doorLock.IsDoorLockNormallyMode[key] == false) else if (!doorLock.IsDoorLockNormallyMode) { btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Current) + Language.StringByID(R.MyInternationalizationString.CLose); btnDoorLockPic.IsSelected = false; @@ -1517,6 +1439,7 @@ CommonPage.Instance.IsDrawerLockMode = false; } ZbGateway.StatusList.Remove(this); DoorLockCommonInfo.LogicAction = null; base.RemoveFromParent(); } #endregion ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomDeviceListForm.cs
@@ -95,7 +95,7 @@ //设备名字 var btnName = frameRow.AddLeftCaption(Common.LocalDevice.Current.GetDeviceEpointName(device), 700); btnName.TextSize = 15; if (device.IsOnline == 0) if (Common.LocalDevice.Current.CheckDeviceIsOnline(device) == false) { btnName.TextColor = UserCenterColor.Current.TextGrayColor1; } ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs
@@ -287,7 +287,7 @@ { for (int j = 0; j < list.Count; j++) { string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(list[i]); string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(list[j]); if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true) { return; @@ -295,13 +295,13 @@ listCheck.Add(mainkeys); var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys); if (localDevice != null && localDevice.IsOnline != list[i].IsOnline) if (localDevice != null && localDevice.IsOnline != list[j].IsOnline) { //在线状态一样的话,不需要刷新 localDevice.IsOnline = list[i].IsOnline; localDevice.IsOnline = list[j].IsOnline; localDevice.ReSave(); } if (list[i].IsOnline == 1) if (Common.LocalDevice.Current.CheckDeviceIsOnline(list[j]) == true) { dicData[mainkeys].OnlineCount += 1; dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count; ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs
@@ -599,7 +599,8 @@ Application.RunOnMainThread(() => { //设置控件的在线状态文本效果 control?.SetOnlineStatu(device.IsOnline == 1); bool bolOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device); control?.SetOnlineStatu(bolOnline); }); } } ZigbeeApp/Shared/Phone/UserCenter/UserMain/SecondAuthenticationForm.cs
@@ -415,10 +415,8 @@ UserCenterResourse.HideOption.CenterHideMenu = 1; } } if (textValue == "0001a") if (textValue == "1") { var form = new Guide.GuideHouseForm(); form.ShowFrom(); } if (textValue == "12349") { ZigbeeApp/Shared/Phone/ZigBee/Device/DoorLock.cs
@@ -35,11 +35,12 @@ public string currentUserDisplayMethod = string.Empty;//当前用户显示方式 //本地所有账户列表 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 bool IsDoorLockNormallyMode = false; public string LocalTempPassword = string.Empty;//本地生成的临时密码 public Dictionary<string, bool> IsFreezeAccount = new Dictionary<string, bool> { };//是否冻结子账户 public Dictionary<string, bool> HasRemoteUnlockAccess = new Dictionary<string, bool> { };//是否给子账户拥有远程开锁的条件 ZigbeeApp/Shared/Phone/ZigBee/Device/FreshAir.cs
@@ -18,7 +18,7 @@ /// 风速模式 /// <para>5:自动</para> /// <para>6:Smart</para> /// <para>7:手动</para> /// <para>15:手动</para> /// </summary> public int currentFanMode = 0; /// <summary> @@ -224,7 +224,7 @@ /// <summary> /// 手动 /// </summary> Manual = 7, Manual = 15, } } } ZigbeeApp/Shared/Phone/ZigBee/Device/Panel.cs
@@ -37,6 +37,10 @@ /// </summary> public string currentSelectFloorId = string.Empty; /// <summary> /// 当前选择的房间ID【新风面板】 /// </summary> public string currentSelectRoomId = string.Empty; /// <summary> /// 当前开关模式 /// </summary> public string CurrentSwitchMode = ""; ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
@@ -603,422 +603,6 @@ } #endregion #region 获取已入网设备信息 /// <summary> /// 获取网关设备信息(注意,这个接口会被去掉) /// </summary> public async System.Threading.Tasks.Task<List<CommonDevice>> GetGwDeviceList() { DeviceList.Clear(); return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<List<CommonDevice>>>)(async () => { var dateTime = DateTime.Now; bool canBreak = false; Action<string, string> action = (topic, message) => { var gatewayID = topic.Split('/')[0]; var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); if (topic == gatewayID + "/" + "DeviceInfoRespon") { dateTime = DateTime.Now; var totalNum = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["TotalNum"].ToString()); if (totalNum == 0) { canBreak = true; return; } var deviceID = jobject.Value<int>("Device_ID"); switch ((DeviceType)(deviceID)) { //case DeviceType.DimmableLight: // var dimmableLight = new DimmableLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; // dimmableLight.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight.DeviceInfoData>(jobject["Data"].ToString()); // if (dimmableLight.DeviceInfo == null) // { // return; // } // var light = DeviceList.Find(obj => obj.DeviceID == dimmableLight.DeviceID && obj.DeviceAddr == dimmableLight.DeviceAddr && obj.DeviceEpoint == dimmableLight.DeviceEpoint); // if (light == null) // { // DeviceList.Add(dimmableLight); // dimmableLight.DeviceName = dimmableLight.DeviceInfo.MacName; // dimmableLight.DeviceEpointName = dimmableLight.DeviceInfo.DeviceName; // dimmableLight.ImgVersion = dimmableLight.DeviceInfo.ImgVersion; // dimmableLight.HwVersion = dimmableLight.DeviceInfo.HwVersion; // dimmableLight.IsOnline = dimmableLight.DeviceInfo.IsOnline; // dimmableLight.DriveCode = dimmableLight.DeviceInfo.DriveCode; // dimmableLight.ImgTypeId = dimmableLight.DeviceInfo.ImgTypeId; // dimmableLight.IasDeviceType = dimmableLight.DeviceInfo.DeviceType; // dimmableLight.Profile = dimmableLight.DeviceInfo.Profile; // dimmableLight.InClusterList = dimmableLight.DeviceInfo.InClusterList; // dimmableLight.OutClusterList = dimmableLight.DeviceInfo.OutClusterList; // dimmableLight.AttributeStatus = dimmableLight.DeviceInfo.AttributeStatus; // //dimmableLight.Save(); // } // else // { // light.DeviceInfo = dimmableLight.DeviceInfo; // light.DeviceName = dimmableLight.DeviceInfo.MacName; // light.DeviceEpointName = dimmableLight.DeviceInfo.DeviceName; // light.ImgVersion = dimmableLight.DeviceInfo.ImgVersion; // light.HwVersion = dimmableLight.DeviceInfo.HwVersion; // light.IsOnline = dimmableLight.DeviceInfo.IsOnline; // light.DriveCode = dimmableLight.DeviceInfo.DriveCode; // light.ImgTypeId = dimmableLight.DeviceInfo.ImgTypeId; // light.IasDeviceType = dimmableLight.DeviceInfo.DeviceType; // light.Profile = dimmableLight.DeviceInfo.Profile; // light.InClusterList = dimmableLight.DeviceInfo.InClusterList; // light.OutClusterList = dimmableLight.DeviceInfo.OutClusterList; // light.AttributeStatus = dimmableLight.DeviceInfo.AttributeStatus; // //dimmableLight.ReSave(); // } // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // break; //case DeviceType.OnOffSwitch: // var panel = new Panel() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; // panel.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.DeviceInfoData>(jobject["Data"].ToString()); // if (panel.DeviceInfo == null) // { // return; // } // var panelInfo = DeviceList.Find(obj => obj.DeviceID == panel.DeviceID && obj.DeviceAddr == panel.DeviceAddr && obj.DeviceEpoint == panel.DeviceEpoint); // if (panelInfo == null) // { // DeviceList.Add(panel); // panel.DeviceName = panel.DeviceInfo.MacName; // panel.DeviceEpointName = panel.DeviceInfo.DeviceName; // panel.ImgTypeId = panel.DeviceInfo.ImgTypeId; // panel.ImgVersion = panel.DeviceInfo.ImgVersion; // panel.HwVersion = panel.DeviceInfo.HwVersion; // panel.IasDeviceType = panel.DeviceInfo.DeviceType; // panel.IsOnline = panel.DeviceInfo.IsOnline; // panel.DriveCode = panel.DeviceInfo.DriveCode; // panel.Profile = panel.DeviceInfo.Profile; // panel.InClusterList = panel.DeviceInfo.InClusterList; // panel.OutClusterList = panel.DeviceInfo.OutClusterList; // panel.AttributeStatus = panel.DeviceInfo.AttributeStatus; // //panel.Save(); // } // else // { // panelInfo.DeviceInfo = panel.DeviceInfo; // panelInfo.DeviceName = panel.DeviceInfo.MacName; // panelInfo.DeviceEpointName = panel.DeviceInfo.DeviceName; // panelInfo.ImgVersion = panel.DeviceInfo.ImgVersion; // panelInfo.HwVersion = panel.DeviceInfo.HwVersion; // panelInfo.IsOnline = panel.DeviceInfo.IsOnline; // panelInfo.DriveCode = panel.DeviceInfo.DriveCode; // panelInfo.IasDeviceType = panel.DeviceInfo.DeviceType; // panelInfo.Profile = panel.DeviceInfo.Profile; // panelInfo.ImgTypeId = panel.DeviceInfo.ImgTypeId; // panelInfo.InClusterList = panel.DeviceInfo.InClusterList; // panelInfo.OutClusterList = panel.DeviceInfo.OutClusterList; // panelInfo.AttributeStatus = panel.DeviceInfo.AttributeStatus; // //panel.ReSave(); // } // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // break; //case DeviceType.OnOffOutput: // var toggleLight = new ToggleLight() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; // toggleLight.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight.DeviceInfoData>(jobject["Data"].ToString()); // if (toggleLight.DeviceInfo == null) // { // return; // } // var toggleLightInfo = DeviceList.Find(obj => obj.DeviceID == toggleLight.DeviceID && obj.DeviceAddr == toggleLight.DeviceAddr && obj.DeviceEpoint == toggleLight.DeviceEpoint); // if (toggleLightInfo == null) // { // DeviceList.Add(toggleLight); // toggleLight.DeviceName = toggleLight.DeviceInfo.MacName; // toggleLight.DeviceEpointName = toggleLight.DeviceInfo.DeviceName; // toggleLight.ImgVersion = toggleLight.DeviceInfo.ImgVersion; // toggleLight.HwVersion = toggleLight.DeviceInfo.HwVersion; // toggleLight.IsOnline = toggleLight.DeviceInfo.IsOnline; // toggleLight.DriveCode = toggleLight.DeviceInfo.DriveCode; // toggleLight.IasDeviceType = toggleLight.DeviceInfo.DeviceType; // toggleLight.Profile = toggleLight.DeviceInfo.Profile; // toggleLight.ImgTypeId = toggleLight.DeviceInfo.ImgTypeId; // toggleLight.InClusterList = toggleLight.DeviceInfo.InClusterList; // toggleLight.OutClusterList = toggleLight.DeviceInfo.OutClusterList; // toggleLight.AttributeStatus = toggleLight.DeviceInfo.AttributeStatus; // //toggleLight.Save(); // } // else // { // toggleLightInfo.DeviceName = toggleLight.DeviceInfo.MacName; // toggleLightInfo.DeviceEpointName = toggleLight.DeviceInfo.DeviceName; // toggleLightInfo.ImgVersion = toggleLight.DeviceInfo.ImgVersion; // toggleLightInfo.HwVersion = toggleLight.DeviceInfo.HwVersion; // toggleLightInfo.IsOnline = toggleLight.DeviceInfo.IsOnline; // toggleLightInfo.DriveCode = toggleLight.DeviceInfo.DriveCode; // toggleLightInfo.IasDeviceType = toggleLight.DeviceInfo.DeviceType; // toggleLightInfo.Profile = toggleLight.DeviceInfo.Profile; // toggleLightInfo.ImgTypeId = toggleLight.DeviceInfo.ImgTypeId; // toggleLightInfo.InClusterList = toggleLight.DeviceInfo.InClusterList; // toggleLightInfo.OutClusterList = toggleLight.DeviceInfo.OutClusterList; // toggleLightInfo.AttributeStatus = toggleLight.DeviceInfo.AttributeStatus; // toggleLightInfo.DeviceInfo = toggleLight.DeviceInfo; // //toggleLightInfo.ReSave(); // } // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // break; //case DeviceType.AirSwitch: // var airSwitch = new AirSwitch() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; // airSwitch.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch.DeviceInfoData>(jobject["Data"].ToString()); // if (airSwitch.DeviceInfo == null) // { // return; // } // var airSwitchInfo = DeviceList.Find(obj => obj.DeviceID == airSwitch.DeviceID && obj.DeviceAddr == airSwitch.DeviceAddr && obj.DeviceEpoint == airSwitch.DeviceEpoint); // if (airSwitchInfo == null) // { // DeviceList.Add(airSwitch); // airSwitch.DeviceName = airSwitch.DeviceInfo.MacName; // airSwitch.DeviceEpointName = airSwitch.DeviceInfo.DeviceName; // airSwitch.ImgVersion = airSwitch.DeviceInfo.ImgVersion; // airSwitch.HwVersion = airSwitch.DeviceInfo.HwVersion; // airSwitch.IsOnline = airSwitch.DeviceInfo.IsOnline; // airSwitch.DriveCode = airSwitch.DeviceInfo.DriveCode; // airSwitch.IasDeviceType = airSwitch.DeviceInfo.DeviceType; // airSwitch.Profile = airSwitch.DeviceInfo.Profile; // airSwitch.ImgTypeId = airSwitch.DeviceInfo.ImgTypeId; // airSwitch.InClusterList = airSwitch.DeviceInfo.InClusterList; // airSwitch.OutClusterList = airSwitch.DeviceInfo.OutClusterList; // airSwitch.AttributeStatus = airSwitch.DeviceInfo.AttributeStatus; // //airSwitch.Save(); // } // else // { // airSwitchInfo.DeviceName = airSwitch.DeviceInfo.MacName; // airSwitchInfo.DeviceEpointName = airSwitch.DeviceInfo.DeviceName; // airSwitchInfo.ImgVersion = airSwitch.DeviceInfo.ImgVersion; // airSwitchInfo.HwVersion = airSwitch.DeviceInfo.HwVersion; // airSwitchInfo.IsOnline = airSwitch.DeviceInfo.IsOnline; // airSwitchInfo.DriveCode = airSwitch.DeviceInfo.DriveCode; // airSwitchInfo.IasDeviceType = airSwitch.DeviceInfo.DeviceType; // airSwitchInfo.Profile = airSwitch.DeviceInfo.Profile; // airSwitchInfo.ImgTypeId = airSwitch.DeviceInfo.ImgTypeId; // airSwitchInfo.InClusterList = airSwitch.DeviceInfo.InClusterList; // airSwitchInfo.OutClusterList = airSwitch.DeviceInfo.OutClusterList; // airSwitchInfo.AttributeStatus = airSwitch.DeviceInfo.AttributeStatus; // airSwitchInfo.DeviceInfo = airSwitch.DeviceInfo; // // airSwitchInfo.ReSave(); // } // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // break; //case DeviceType.WindowCoveringDevice: // var windowCovering = new Rollershade() { DeviceID = jobject.Value<int>((object)"Device_ID"), DeviceAddr = jobject.Value<string>((object)"DeviceAddr"), DeviceEpoint = jobject.Value<int>((object)"Epoint"), DataID = jobject.Value<int>((object)"Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; // windowCovering.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade.DeviceInfoData>(jobject["Data"].ToString()); // if (windowCovering.DeviceInfo == null) // { // return; // } // var wc = DeviceList.Find(obj => obj.DeviceID == windowCovering.DeviceID && obj.DeviceAddr == windowCovering.DeviceAddr && obj.DeviceEpoint == windowCovering.DeviceEpoint); // if (wc == null) // { // DeviceList.Add(windowCovering); // windowCovering.DeviceName = windowCovering.DeviceInfo.MacName; // windowCovering.DeviceEpointName = windowCovering.DeviceInfo.DeviceName; // windowCovering.ImgVersion = windowCovering.DeviceInfo.ImgVersion; // windowCovering.HwVersion = windowCovering.DeviceInfo.HwVersion; // windowCovering.IsOnline = windowCovering.DeviceInfo.IsOnline; // windowCovering.DriveCode = windowCovering.DeviceInfo.DriveCode; // windowCovering.IasDeviceType = windowCovering.DeviceInfo.DeviceType; // windowCovering.Profile = windowCovering.DeviceInfo.Profile; // windowCovering.ImgTypeId = windowCovering.DeviceInfo.ImgTypeId; // windowCovering.InClusterList = windowCovering.DeviceInfo.InClusterList; // windowCovering.OutClusterList = windowCovering.DeviceInfo.OutClusterList; // windowCovering.AttributeStatus = windowCovering.DeviceInfo.AttributeStatus; // //windowCovering.Save(); // } // else // { // wc.DeviceName = windowCovering.DeviceInfo.MacName; // wc.DeviceEpointName = windowCovering.DeviceInfo.DeviceName; // wc.DeviceInfo = windowCovering.DeviceInfo; // wc.ImgVersion = windowCovering.DeviceInfo.ImgVersion; // wc.HwVersion = windowCovering.DeviceInfo.HwVersion; // wc.IsOnline = windowCovering.DeviceInfo.IsOnline; // wc.DriveCode = windowCovering.DeviceInfo.DriveCode; // wc.IasDeviceType = windowCovering.DeviceInfo.DeviceType; // wc.Profile = windowCovering.DeviceInfo.Profile; // wc.ImgTypeId = windowCovering.DeviceInfo.ImgTypeId; // wc.InClusterList = windowCovering.DeviceInfo.InClusterList; // wc.OutClusterList = windowCovering.DeviceInfo.OutClusterList; // wc.AttributeStatus = windowCovering.DeviceInfo.AttributeStatus; // // wc.ReSave(); // } // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // break; //case DeviceType.IASZone: // var ias = new IASZone() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; // ias.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.DeviceInfoData>(jobject["Data"].ToString()); // if (ias.DeviceInfo == null) // { // return; // } // var infoIAS = DeviceList.Find(obj => obj.DeviceID == ias.DeviceID && obj.DeviceAddr == ias.DeviceAddr && obj.DeviceEpoint == ias.DeviceEpoint); // if (infoIAS == null) // { // DeviceList.Add(ias); // ias.DeviceName = ias.DeviceInfo.MacName; // ias.DeviceEpointName = ias.DeviceInfo.DeviceName; // ias.ImgVersion = ias.DeviceInfo.ImgVersion; // ias.HwVersion = ias.DeviceInfo.HwVersion; // ias.IsOnline = ias.DeviceInfo.IsOnline; // ias.DriveCode = ias.DeviceInfo.DriveCode; // ias.IasDeviceType = ias.DeviceInfo.DeviceType; // ias.Profile = ias.DeviceInfo.Profile; // ias.ImgTypeId = ias.DeviceInfo.ImgTypeId; // ias.InClusterList = ias.DeviceInfo.InClusterList; // ias.OutClusterList = ias.DeviceInfo.OutClusterList; // ias.AttributeStatus = ias.DeviceInfo.AttributeStatus; // //ias.Save(); // } // else // { // infoIAS.DeviceName = ias.DeviceInfo.MacName; // infoIAS.DeviceEpointName = ias.DeviceInfo.DeviceName; // infoIAS.DeviceEpointName = ias.DeviceInfo.DeviceName; // infoIAS.ImgVersion = ias.DeviceInfo.ImgVersion; // infoIAS.HwVersion = ias.DeviceInfo.HwVersion; // infoIAS.IsOnline = ias.DeviceInfo.IsOnline; // infoIAS.DriveCode = ias.DeviceInfo.DriveCode; // infoIAS.IasDeviceType = ias.DeviceInfo.DeviceType; // infoIAS.Profile = ias.DeviceInfo.Profile; // infoIAS.ImgTypeId = ias.DeviceInfo.ImgTypeId; // infoIAS.InClusterList = ias.DeviceInfo.InClusterList; // infoIAS.OutClusterList = ias.DeviceInfo.OutClusterList; // infoIAS.AttributeStatus = ias.DeviceInfo.AttributeStatus; // infoIAS.DeviceInfo = ias.DeviceInfo; // //ias.ReSave(); // } // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // break; //case DeviceType.OtaDevice: //case DeviceType.OtaPanelDevice: //var ota = new OTADevice() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; //ota.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceInfoData>(jobject["Data"].ToString()); //if (ota.DeviceInfo == null) //{ // return; //} //var infoOta = DeviceList.Find(obj => obj.DeviceID == ota.DeviceID && obj.DeviceAddr == ota.DeviceAddr && obj.DeviceEpoint == ota.DeviceEpoint); //if (infoOta == null) //{ // DeviceList.Add(ota); // ota.DeviceName = ota.DeviceInfo.MacName; // ota.DeviceEpointName = ota.DeviceInfo.DeviceName; // ota.ImgVersion = ota.DeviceInfo.ImgVersion; // ota.HwVersion = ota.DeviceInfo.HwVersion; // ota.IsOnline = ota.DeviceInfo.IsOnline; // ota.DriveCode = ota.DeviceInfo.DriveCode; // ota.IasDeviceType = ota.DeviceInfo.DeviceType; // ota.Profile = ota.DeviceInfo.Profile; // ota.ImgTypeId = ota.DeviceInfo.ImgTypeId; // ota.InClusterList = ota.DeviceInfo.InClusterList; // ota.OutClusterList = ota.DeviceInfo.OutClusterList; // ota.AttributeStatus = ota.DeviceInfo.AttributeStatus; // //ota.Save(); //} //else //{ // infoOta.DeviceName = ota.DeviceInfo.MacName; // infoOta.DeviceEpointName = ota.DeviceInfo.DeviceName; // infoOta.DeviceEpointName = ota.DeviceInfo.DeviceName; // infoOta.ImgVersion = ota.DeviceInfo.ImgVersion; // infoOta.HwVersion = ota.DeviceInfo.HwVersion; // infoOta.IsOnline = ota.DeviceInfo.IsOnline; // infoOta.DriveCode = ota.DeviceInfo.DriveCode; // infoOta.IasDeviceType = ota.DeviceInfo.DeviceType; // infoOta.Profile = ota.DeviceInfo.Profile; // infoOta.ImgTypeId = ota.DeviceInfo.ImgTypeId; // infoOta.InClusterList = ota.DeviceInfo.InClusterList; // infoOta.OutClusterList = ota.DeviceInfo.OutClusterList; // infoOta.AttributeStatus = ota.DeviceInfo.AttributeStatus; // infoOta.DeviceInfo = ota.DeviceInfo; // //ota.ReSave(); //} //DebugPrintLog($"UI收到通知后的主题_{ topic}"); //break; //case DeviceType.Thermostat: //var thermostat = new ThermostatObj() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; //thermostat.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ThermostatObj.DeviceInfoData>(jobject["Data"].ToString()); //if (thermostat.DeviceInfo == null) //{ // return; //} //var ther = gateway.DeviceList.Find(obj => obj.DeviceID == thermostat.DeviceID && obj.DeviceAddr == thermostat.DeviceAddr && obj.DeviceEpoint == thermostat.DeviceEpoint); //if (ther == null) //{ // gateway.DeviceList.Add(thermostat); // thermostat.DeviceName = thermostat.DeviceInfo.DeviceName; // IO.LocalFileUtils.SaveDeviceInfo(thermostat, thermostat.DeviceEpoint.ToString()); //} //else //{ // ther.DeviceName = thermostat.DeviceInfo.DeviceName; // ther.DeviceInfo = thermostat.DeviceInfo; // ZigBee.IO.LocalFileUtils.SaveDeviceInfo(ther, ther.DeviceEpoint.ToString()); //} //break; //case DeviceType.TemperatureSensor: //var temperatureSensor = new TemperatureSensor() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; //temperatureSensor.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor.DeviceInfoData>(jobject["Data"].ToString()); //if (temperatureSensor.DeviceInfo == null) //{ // return; //} //var ts = gateway.DeviceList.Find(obj => obj.DeviceID == temperatureSensor.DeviceID && obj.DeviceAddr == temperatureSensor.DeviceAddr && obj.DeviceEpoint == temperatureSensor.DeviceEpoint); //if (ts == null) //{ // gateway.DeviceList.Add(temperatureSensor); // temperatureSensor.DeviceName = temperatureSensor.DeviceInfo.DeviceName; // IO.LocalFileUtils.SaveDeviceInfo(temperatureSensor, temperatureSensor.DeviceEpoint.ToString()); //} //else //{ // ts.DeviceName = temperatureSensor.DeviceInfo.DeviceName; // ts.DeviceInfo = temperatureSensor.DeviceInfo; // IO.LocalFileUtils.SaveDeviceInfo(ts, ts.DeviceEpoint.ToString()); //} //break; } } else if (topic == gatewayID + "/" + "DeviceInfoResponEnd") { canBreak = true; } }; Actions += action; DebugPrintLog("DeviceInfo Actions 启动" + "_" + System.DateTime.Now.ToString()); try { var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 93 } }; Send("GetDeviceInfo", jObject.ToString()); } catch { } while (canBreak == false && (DateTime.Now - dateTime).TotalMilliseconds < 6000) { await System.Threading.Tasks.Task.Delay(10); } Actions -= action; DebugPrintLog("DeviceInfo_Actions 退出" + System.DateTime.Now.ToString()); return DeviceList; })); } #endregion #region 获取网关记录的设备属性状态 /// <summary> ///获取网关记录的设备属性状态 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGatewayData.cs
@@ -443,355 +443,6 @@ } #endregion #region 获取所有网关的节点设备信息(用于主网关) ///// <summary> ///// 获取所有网关的节点设备信息(用于主网关) ///// </summary> //public static async System.Threading.Tasks.Task<List<CommonDevice>> GetAllGatewayDeviceInfoList() //{ // if (ZbGateway.MainGateWay == null) // { // return null; // } // ZbGateway.MainGateWay.AllGatewayDeviceList.Clear(); // return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<List<CommonDevice>>>)(async () => // { // var dateTime = DateTime.Now; // Action<string, string> action = (topic, message) => // { // var gatewayID = topic.Split('/')[0]; // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); // if (topic == gatewayID + "/" + "DeviceInfoRespon") // { // dateTime = DateTime.Now; // var deviceID = jobject.Value<int>("Device_ID"); // switch ((DeviceType)(deviceID)) // { // case DeviceType.ColorDimmableLight: // var dimmableLight = new ColorDimmableLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") }; // dimmableLight.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorDimmableLight.AllGatewayDeviceInfo>(jobject["Data"].ToString()); // if (dimmableLight.getAllGatewayDeviceInfo == null) // { // return; // } // dimmableLight.CurrentGateWayId = dimmableLight.getAllGatewayDeviceInfo.GwId; // var light = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == dimmableLight.DeviceID && obj.DeviceAddr == dimmableLight.DeviceAddr && obj.DeviceEpoint == dimmableLight.DeviceEpoint); // if (light == null) // { // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(dimmableLight); // dimmableLight.DeviceName = dimmableLight.getAllGatewayDeviceInfo.MacName; // dimmableLight.DeviceEpointName = dimmableLight.getAllGatewayDeviceInfo.DeviceName; // dimmableLight.ImgVersion = dimmableLight.getAllGatewayDeviceInfo.ImgVersion; // dimmableLight.IsOnline = dimmableLight.getAllGatewayDeviceInfo.IsOnline; // dimmableLight.IasDeviceType = dimmableLight.getAllGatewayDeviceInfo.DeviceType; // dimmableLight.Profile = dimmableLight.getAllGatewayDeviceInfo.Profile; // dimmableLight.ImgTypeId = dimmableLight.getAllGatewayDeviceInfo.ImgTypeId; // dimmableLight.InClusterList = dimmableLight.getAllGatewayDeviceInfo.InClusterList; // dimmableLight.OutClusterList = dimmableLight.getAllGatewayDeviceInfo.OutClusterList; // dimmableLight.AttributeStatus = dimmableLight.getAllGatewayDeviceInfo.AttributeStatus; // dimmableLight.Save(); // } // else // { // light.getAllGatewayDeviceInfo = dimmableLight.getAllGatewayDeviceInfo; // light.DeviceName = dimmableLight.getAllGatewayDeviceInfo.MacName; // light.DeviceEpointName = dimmableLight.getAllGatewayDeviceInfo.DeviceName; // light.ImgVersion = dimmableLight.getAllGatewayDeviceInfo.ImgVersion; // light.IsOnline = dimmableLight.getAllGatewayDeviceInfo.IsOnline; // light.IasDeviceType = dimmableLight.getAllGatewayDeviceInfo.DeviceType; // light.Profile = dimmableLight.getAllGatewayDeviceInfo.Profile; // light.ImgTypeId = dimmableLight.getAllGatewayDeviceInfo.ImgTypeId; // light.InClusterList = dimmableLight.getAllGatewayDeviceInfo.InClusterList; // light.OutClusterList = dimmableLight.getAllGatewayDeviceInfo.OutClusterList; // light.AttributeStatus = dimmableLight.getAllGatewayDeviceInfo.AttributeStatus; // light.ReSave(); // } // System.Console.WriteLine($"收到通知后的主题_{ topic}"); // break; // case DeviceType.OnOffOutput: // var toggleLight = new ToggleLight() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") }; // toggleLight.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight.AllGatewayDeviceInfo>(jobject["Data"].ToString()); // if (toggleLight.getAllGatewayDeviceInfo == null) // { // return; // } // toggleLight.CurrentGateWayId = toggleLight.getAllGatewayDeviceInfo.GwId; // var localToggleLight = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == toggleLight.DeviceID && obj.DeviceAddr == toggleLight.DeviceAddr && obj.DeviceEpoint == toggleLight.DeviceEpoint); // if (localToggleLight == null) // { // toggleLight.DeviceName = toggleLight.getAllGatewayDeviceInfo.MacName; // toggleLight.DeviceEpointName = toggleLight.getAllGatewayDeviceInfo.DeviceName; // toggleLight.ImgVersion = toggleLight.getAllGatewayDeviceInfo.ImgVersion; // toggleLight.IsOnline = toggleLight.getAllGatewayDeviceInfo.IsOnline; // toggleLight.IasDeviceType = toggleLight.getAllGatewayDeviceInfo.DeviceType; // toggleLight.Profile = toggleLight.getAllGatewayDeviceInfo.Profile; // toggleLight.ImgTypeId = toggleLight.getAllGatewayDeviceInfo.ImgTypeId; // toggleLight.InClusterList = toggleLight.getAllGatewayDeviceInfo.InClusterList; // toggleLight.OutClusterList = toggleLight.getAllGatewayDeviceInfo.OutClusterList; // toggleLight.AttributeStatus = toggleLight.getAllGatewayDeviceInfo.AttributeStatus; // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(toggleLight); // toggleLight.Save(); // } // else // { // localToggleLight.getAllGatewayDeviceInfo = toggleLight.getAllGatewayDeviceInfo; // localToggleLight.DeviceName = toggleLight.getAllGatewayDeviceInfo.MacName; // localToggleLight.DeviceEpointName = toggleLight.getAllGatewayDeviceInfo.DeviceName; // localToggleLight.ImgVersion = toggleLight.getAllGatewayDeviceInfo.ImgVersion; // localToggleLight.IsOnline = toggleLight.getAllGatewayDeviceInfo.IsOnline; // localToggleLight.IasDeviceType = toggleLight.getAllGatewayDeviceInfo.DeviceType; // localToggleLight.Profile = toggleLight.getAllGatewayDeviceInfo.Profile; // localToggleLight.ImgTypeId = toggleLight.getAllGatewayDeviceInfo.ImgTypeId; // localToggleLight.InClusterList = toggleLight.getAllGatewayDeviceInfo.InClusterList; // localToggleLight.OutClusterList = toggleLight.getAllGatewayDeviceInfo.OutClusterList; // localToggleLight.AttributeStatus = toggleLight.getAllGatewayDeviceInfo.AttributeStatus; // localToggleLight.ReSave(); // } // System.Console.WriteLine($"收到通知后的主题_{ topic}"); // break; // case DeviceType.OnOffSwitch: // var panel = new Panel() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") }; // panel.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.AllGatewayDeviceInfo>(jobject["Data"].ToString()); // if (panel.getAllGatewayDeviceInfo == null) // { // return; // } // panel.CurrentGateWayId = panel.getAllGatewayDeviceInfo.GwId; // var localPanel = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == panel.DeviceID && obj.DeviceAddr == panel.DeviceAddr && obj.DeviceEpoint == panel.DeviceEpoint); // if (localPanel == null) // { // panel.DeviceName = panel.getAllGatewayDeviceInfo.MacName; // panel.DeviceEpointName = panel.getAllGatewayDeviceInfo.DeviceName; // panel.ImgVersion = panel.getAllGatewayDeviceInfo.ImgVersion; // panel.IsOnline = panel.getAllGatewayDeviceInfo.IsOnline; // panel.IasDeviceType = panel.getAllGatewayDeviceInfo.DeviceType; // panel.Profile = panel.getAllGatewayDeviceInfo.Profile; // panel.ImgTypeId = panel.getAllGatewayDeviceInfo.ImgTypeId; // panel.InClusterList = panel.getAllGatewayDeviceInfo.InClusterList; // panel.OutClusterList = panel.getAllGatewayDeviceInfo.OutClusterList; // panel.AttributeStatus = panel.getAllGatewayDeviceInfo.AttributeStatus; // if (panel.DeviceAddr != null) // { // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(panel); // } // panel.Save(); // } // else // { // localPanel.getAllGatewayDeviceInfo = panel.getAllGatewayDeviceInfo; // localPanel.DeviceName = panel.getAllGatewayDeviceInfo.MacName; // localPanel.DeviceEpointName = panel.getAllGatewayDeviceInfo.DeviceName; // localPanel.ImgVersion = panel.getAllGatewayDeviceInfo.ImgVersion; // localPanel.IsOnline = panel.getAllGatewayDeviceInfo.IsOnline; // localPanel.IasDeviceType = panel.getAllGatewayDeviceInfo.DeviceType; // localPanel.Profile = panel.getAllGatewayDeviceInfo.Profile; // localPanel.ImgTypeId = panel.getAllGatewayDeviceInfo.ImgTypeId; // localPanel.InClusterList = panel.getAllGatewayDeviceInfo.InClusterList; // localPanel.OutClusterList = panel.getAllGatewayDeviceInfo.OutClusterList; // localPanel.AttributeStatus = panel.getAllGatewayDeviceInfo.AttributeStatus; // localPanel.ReSave(); // } // System.Console.WriteLine($"收到通知后的主题_{ topic}"); // break; // case DeviceType.WindowCoveringDevice: // var windowCovering = new Rollershade() { DeviceID = jobject.Value<int>((object)"Device_ID"), DeviceAddr = jobject.Value<string>((object)"DeviceAddr"), DeviceEpoint = jobject.Value<int>((object)"Epoint"), DataID = jobject.Value<int>((object)"Data_ID") }; // windowCovering.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade.AllGatewayDeviceInfo>(jobject["Data"].ToString()); // if (windowCovering.getAllGatewayDeviceInfo == null) // { // return; // } // windowCovering.CurrentGateWayId = windowCovering.getAllGatewayDeviceInfo.GwId; // var wc = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == windowCovering.DeviceID && obj.DeviceAddr == windowCovering.DeviceAddr && obj.DeviceEpoint == windowCovering.DeviceEpoint); // if (wc == null) // { // windowCovering.DeviceName = windowCovering.getAllGatewayDeviceInfo.MacName; // windowCovering.DeviceEpointName = windowCovering.getAllGatewayDeviceInfo.DeviceName; // windowCovering.ImgVersion = windowCovering.getAllGatewayDeviceInfo.ImgVersion; // windowCovering.IsOnline = windowCovering.getAllGatewayDeviceInfo.IsOnline; // windowCovering.IasDeviceType = windowCovering.getAllGatewayDeviceInfo.DeviceType; // windowCovering.Profile = windowCovering.getAllGatewayDeviceInfo.Profile; // windowCovering.ImgTypeId = windowCovering.getAllGatewayDeviceInfo.ImgTypeId; // windowCovering.InClusterList = windowCovering.getAllGatewayDeviceInfo.InClusterList; // windowCovering.OutClusterList = windowCovering.getAllGatewayDeviceInfo.OutClusterList; // windowCovering.AttributeStatus = windowCovering.getAllGatewayDeviceInfo.AttributeStatus; // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(windowCovering); // windowCovering.Save(); // } // else // { // wc.getAllGatewayDeviceInfo = windowCovering.getAllGatewayDeviceInfo; // wc.DeviceName = windowCovering.getAllGatewayDeviceInfo.MacName; // wc.DeviceEpointName = windowCovering.getAllGatewayDeviceInfo.DeviceName; // wc.ImgVersion = windowCovering.getAllGatewayDeviceInfo.ImgVersion; // wc.IsOnline = windowCovering.getAllGatewayDeviceInfo.IsOnline; // wc.IasDeviceType = windowCovering.getAllGatewayDeviceInfo.DeviceType; // wc.Profile = windowCovering.getAllGatewayDeviceInfo.Profile; // wc.ImgTypeId = windowCovering.getAllGatewayDeviceInfo.ImgTypeId; // wc.InClusterList = windowCovering.getAllGatewayDeviceInfo.InClusterList; // wc.OutClusterList = windowCovering.getAllGatewayDeviceInfo.OutClusterList; // wc.AttributeStatus = windowCovering.getAllGatewayDeviceInfo.AttributeStatus; // wc.ReSave(); // } // System.Console.WriteLine($"收到通知后的主题_{ topic}"); // break; // case DeviceType.IASZone: // var ias = new IASZone() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") }; // ias.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.AllGatewayDeviceInfo>(jobject["Data"].ToString()); // if (ias.getAllGatewayDeviceInfo == null) // { // return; // } // ias.CurrentGateWayId = ias.getAllGatewayDeviceInfo.GwId; // var infoIAS = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == ias.DeviceID && obj.DeviceAddr == ias.DeviceAddr && obj.DeviceEpoint == ias.DeviceEpoint); // if (infoIAS == null) // { // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(ias); // ias.DeviceName = ias.getAllGatewayDeviceInfo.MacName; // ias.DeviceEpointName = ias.getAllGatewayDeviceInfo.DeviceName; // ias.ImgVersion = ias.getAllGatewayDeviceInfo.ImgVersion; // ias.IsOnline = ias.getAllGatewayDeviceInfo.IsOnline; // ias.IasDeviceType = ias.getAllGatewayDeviceInfo.DeviceType; // ias.Profile = ias.getAllGatewayDeviceInfo.Profile; // ias.ImgTypeId = ias.getAllGatewayDeviceInfo.ImgTypeId; // ias.InClusterList = ias.getAllGatewayDeviceInfo.InClusterList; // ias.OutClusterList = ias.getAllGatewayDeviceInfo.OutClusterList; // ias.AttributeStatus = ias.getAllGatewayDeviceInfo.AttributeStatus; // ias.Save(); // } // else // { // infoIAS.DeviceName = ias.getAllGatewayDeviceInfo.MacName; // infoIAS.DeviceEpointName = ias.getAllGatewayDeviceInfo.DeviceName; // infoIAS.getAllGatewayDeviceInfo = ias.getAllGatewayDeviceInfo; // infoIAS.ImgVersion = ias.getAllGatewayDeviceInfo.ImgVersion; // infoIAS.IsOnline = ias.getAllGatewayDeviceInfo.IsOnline; // infoIAS.IasDeviceType = ias.getAllGatewayDeviceInfo.DeviceType; // infoIAS.Profile = ias.getAllGatewayDeviceInfo.Profile; // infoIAS.ImgTypeId = ias.getAllGatewayDeviceInfo.ImgTypeId; // infoIAS.InClusterList = ias.getAllGatewayDeviceInfo.InClusterList; // infoIAS.OutClusterList = ias.getAllGatewayDeviceInfo.OutClusterList; // infoIAS.AttributeStatus = ias.getAllGatewayDeviceInfo.AttributeStatus; // ias.ReSave(); // } // System.Console.WriteLine($"收到通知后的主题_{ topic}"); // break; // case DeviceType.OtaDevice: // case DeviceType.OtaPanelDevice: // var ota = new OTADevice() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") }; // ota.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<AllGatewayDeviceInfo>(jobject["Data"].ToString()); // if (ota.getAllGatewayDeviceInfo == null) // { // return; // } // ota.CurrentGateWayId = ota.getAllGatewayDeviceInfo.GwId; // var infoOta = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == ota.DeviceID && obj.DeviceAddr == ota.DeviceAddr && obj.DeviceEpoint == ota.DeviceEpoint); // if (infoOta == null) // { // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(ota); // ota.DeviceName = ota.getAllGatewayDeviceInfo.MacName; // ota.DeviceEpointName = ota.getAllGatewayDeviceInfo.DeviceName; // ota.ImgVersion = ota.getAllGatewayDeviceInfo.ImgVersion; // ota.IsOnline = ota.getAllGatewayDeviceInfo.IsOnline; // ota.IasDeviceType = ota.getAllGatewayDeviceInfo.DeviceType; // ota.Profile = ota.getAllGatewayDeviceInfo.Profile; // ota.ImgTypeId = ota.getAllGatewayDeviceInfo.ImgTypeId; // ota.InClusterList = ota.getAllGatewayDeviceInfo.InClusterList; // ota.OutClusterList = ota.getAllGatewayDeviceInfo.OutClusterList; // ota.AttributeStatus = ota.getAllGatewayDeviceInfo.AttributeStatus; // ota.Save(); // } // else // { // infoOta.DeviceName = ota.getAllGatewayDeviceInfo.MacName; // infoOta.DeviceEpointName = ota.getAllGatewayDeviceInfo.DeviceName; // infoOta.getAllGatewayDeviceInfo = ota.getAllGatewayDeviceInfo; // infoOta.ImgVersion = ota.getAllGatewayDeviceInfo.ImgVersion; // infoOta.IsOnline = ota.getAllGatewayDeviceInfo.IsOnline; // infoOta.IasDeviceType = ota.getAllGatewayDeviceInfo.DeviceType; // infoOta.Profile = ota.getAllGatewayDeviceInfo.Profile; // infoOta.ImgTypeId = ota.getAllGatewayDeviceInfo.ImgTypeId; // infoOta.InClusterList = ota.getAllGatewayDeviceInfo.InClusterList; // infoOta.OutClusterList = ota.getAllGatewayDeviceInfo.OutClusterList; // infoOta.AttributeStatus = ota.getAllGatewayDeviceInfo.AttributeStatus; // ota.ReSave(); // } // System.Console.WriteLine($"收到通知后的主题_{ topic}"); // break; // //case DeviceType.Thermostat: // //var thermostat = new ThermostatObj() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; // //thermostat.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ThermostatObj.DeviceInfoData>(jobject["Data"].ToString()); // //if (thermostat.DeviceInfo == null) // //{ // // return; // //} // // var ther = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == thermostat.DeviceID && obj.DeviceAddr == thermostat.DeviceAddr && obj.DeviceEpoint == thermostat.DeviceEpoint); // //if (ther == null) // //{ // // thermostat.DeviceName = thermostat.DeviceInfo.DeviceName; // // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(thermostat); // //} // //else // //{ // // thermostat.DeviceName = thermostat.DeviceInfo.DeviceName; // // ZigBee.IO.LocalFileUtils.SaveDeviceInfo(thermostat, thermostat.DeviceEpoint.ToString()); // //} // //break; // //case DeviceType.TemperatureSensor: // // var temperatureSensor = new TemperatureSensor() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID }; // // temperatureSensor.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor.DeviceInfoData>(jobject["Data"].ToString()); // // if (temperatureSensor.DeviceInfo == null) // // { // // return; // // } // // var ts = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == temperatureSensor.DeviceID && obj.DeviceAddr == temperatureSensor.DeviceAddr && obj.DeviceEpoint == temperatureSensor.DeviceEpoint); // // if (ts == null) // // { // // temperatureSensor.DeviceName = temperatureSensor.DeviceInfo.DeviceName; // // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(temperatureSensor); // // } // // else // // { // // temperatureSensor.DeviceName = temperatureSensor.DeviceInfo.DeviceName; // // IO.LocalFileUtils.SaveDeviceInfo(temperatureSensor, temperatureSensor.DeviceEpoint.ToString()); // // } // // break; // } // } // }; // ZbGateway.MainGateWay.Actions += action; // System.Console.WriteLine("MainGatewayDeviceInfo_Actions 启动" + System.DateTime.Now.ToString()); // var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 90 } }; // ZbGateway.MainGateWay.CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo?.gwID; // ZbGateway.MainGateWay.Send("GetAllDeviceInfo", Common.SecuritySet.Encryption(jObject.ToString())); // while ((DateTime.Now - dateTime).TotalMilliseconds < 4000) // { // await System.Threading.Tasks.Task.Delay(100); // } // ZbGateway.MainGateWay.Actions -= action; // System.Console.WriteLine("MainGatewayDeviceInfo_Actions 退出" + System.DateTime.Now.ToString()); // return ZbGateway.MainGateWay.AllGatewayDeviceList; // })); //} #endregion #region 网关恢复出厂设置 /// <summary> /// 网关恢复出厂设置返回的数据. @@ -1240,414 +891,6 @@ } #endregion //#region 获取协调器获取协调器当前发射功率. /////<summary > ///// 获取协调器获取协调器当前发射功率 ///// </summary> //public static async System.Threading.Tasks.Task<GwGetPowerResponData> GetPowerAsync(ZigBee.Device.ZbGateway gateway) //{ // if (gateway == null) // { // return null; // } // return await System.Threading.Tasks.Task.Run(async () => // { // GwGetPowerResponData d = null; // Action<string, string> action = (topic, message) => // { // var gatewayID = topic.Split('/')[0]; // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); // if (topic == gatewayID + "/" + "Error_Respon") // { // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) // { // d = new GwGetPowerResponData { errorMessageBase = "网关错误回复,且数据是空" }; // } // else // { // d = new GwGetPowerResponData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; // } // } // if (topic == gatewayID + "/" + "ZbGw/GetPower_Respon") // { // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; // var power = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Power"].ToString()); // if (power == 0) // { // d = new GwGetPowerResponData { errorMessageBase = "网关返回的数据为空" }; // } // else // { // d = new GwGetPowerResponData { power = power }; // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // } // } // }; // gateway.Actions += action; // System.Console.WriteLine("GetPower_Actions 启动" + "_" + System.DateTime.Now.ToString()); // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 10 } }; // gateway.Send(("ZbGw/GetPower"), Common.SecuritySet.Encryption((jObject.ToString()))); // var dateTime = DateTime.Now; // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) // { // await System.Threading.Tasks.Task.Delay(10); // if (d != null) // { // break; // } // } // if ((DateTime.Now - dateTime).TotalMilliseconds > 1000) // { // d = new GwGetPowerResponData { errorMessageBase = " 回复超时,请重新操作" }; // } // gateway.Actions -= action; // System.Console.WriteLine("GetPower_Actions 退出" + "_" + System.DateTime.Now.ToString()); // return d; // }); //} ///// <summary> ///// 获取协调器获取协调器当前发射功率,网关反馈具体信息 ///// </summary> //public GwGetPowerResponData gwGetPowerResponData; ///// <summary> ///// 获取协调器获取协调器当前发射功率,网关反馈具体信息 ///// </summary> //[System.Serializable] //public class GwGetPowerResponData //{ // /// <summary> // /// 错误信息 // /// </summary> // public string errorMessageBase; // /// <summary> // /// 网关信息错误反馈 // /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> // /// </summary> // public ErrorResponData errorResponData; // /// <summary> // /// 协调器发射功率 // /// </summary> // public int power = 999; //} //#endregion //#region 设置发射功. /////<summary > /////设置发射功率 ///// <para>power:要更改的设备发射功率,可设置8,10,11,13,15,16,18,19,20,21,22(dBm)</para> ///// </summary> //public static async System.Threading.Tasks.Task<SetPowerResponAllData> GwSetPowerAsync(ZigBee.Device.ZbGateway gateway, int power) //{ // if (gateway == null) // { // return null; // } // return await System.Threading.Tasks.Task.Run(async () => // { // SetPowerResponAllData d = null; // Action<string, string> action = (topic, message) => // { // var gatewayID = topic.Split('/')[0]; // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); // if (topic == gatewayID + "/" + "Error_Respon") // { // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) // { // d = new SetPowerResponAllData { errorMessageBase = "网关错误回复,且数据是空" }; // } // else // { // d = new SetPowerResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; // } // } // if (topic == gatewayID + "/" + "ZbGw/SetPower_Respon") // { // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; // var tempInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<SetPoweResponData>(jobject["Data"].ToString()); // if (tempInfo == null) // { // d = new SetPowerResponAllData { errorMessageBase = "网关返回的数据为空" }; // } // else // { // d = new SetPowerResponAllData { setPoweResponData = tempInfo }; // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // } // } // }; // gateway.Actions += action; // System.Console.WriteLine("ZbGw/SetPower_Actions 启动" + "_" + System.DateTime.Now.ToString()); // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 11 } }; // var data = new JObject { { "Power", power } }; // jObject.Add("Data", data); // gateway.Send(("ZbGw/SetPower"), Common.SecuritySet.Encryption(jObject.ToString(),Password)); // var dateTime = DateTime.Now; // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) // { // await System.Threading.Tasks.Task.Delay(10); // if (d != null) // { // break; // } // } // if ((DateTime.Now - dateTime).TotalMilliseconds > 1000) // { // d = new SetPowerResponAllData { errorMessageBase = " 回复超时,请重新操作" }; // } // gateway.Actions -= action; // System.Console.WriteLine("ZbGw/SetPower_Actions退出" + "_" + System.DateTime.Now.ToString()); // return d; // }); //} ///// <summary> ///// 设置发射功率,网关反馈具体信息 ///// </summary> //public SetPowerResponAllData setPoweResponAllData; ///// <summary> ///// 设置发射功率,网关反馈具体信息 ///// </summary> //[System.Serializable] //public class SetPowerResponAllData //{ // /// <summary> // /// 错误信息 // /// </summary> // public string errorMessageBase; // /// <summary> // /// 网关信息错误反馈 // /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> // /// </summary> // public ErrorResponData errorResponData; // /// <summary> // /// 设置发射功率数据 // /// </summary> // public SetPoweResponData setPoweResponData; //} ///// <summary> ///// 设置发射功率数据 ///// </summary> //public SetPoweResponData setPoweResponData; ///// <summary> ///// 设置发射功率数据 ///// </summary> //[System.Serializable] //public class SetPoweResponData //{ // /// <summary> // /// 是否配置成功 // ///<para>0:成功</para> // ///<para>2:配置的信道为无效值</para> // /// </summary> // public int Status = 999; // /// <summary> // /// 功率 // /// </summary> // public int Power = 999; //} //#endregion //#region 读取当前局域网的PANID. /////<summary > ///// 读取当前局域网的PANID ///// </summary> //public static async System.Threading.Tasks.Task<GetPanIdResponData> ReadPanIdAsync(ZigBee.Device.ZbGateway gateway) //{ // if (gateway == null) // { // return null; // } // return await System.Threading.Tasks.Task.Run(async () => // { // GetPanIdResponData d = null; // Action<string, string> action = (topic, message) => // { // var gatewayID = topic.Split('/')[0]; // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); // if (topic == gatewayID + "/" + "Error_Respon") // { // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) // { // d = new GetPanIdResponData { errorMessageBase = "网关错误回复,且数据是空" }; // } // else // { // d = new GetPanIdResponData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; // } // } // if (topic == gatewayID + "/" + "ZbGw/GetPanId_Respon") // { // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; // var panID = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["PANID"].ToString()); // if (panID == null) // { // d = new GetPanIdResponData { errorMessageBase = "网关返回的数据为空" }; // } // else // { // d = new GetPanIdResponData { panID = panID }; // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // } // } // }; // gateway.Actions += action; // System.Console.WriteLine("ZbGw/GetPanId_Actions 启动" + "_" + System.DateTime.Now.ToString()); // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 12 } }; // gateway.Send(("ZbGw/GetPanId"), Common.SecuritySet.Encryption((jObject.ToString()))); // var dateTime = DateTime.Now; // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) // { // await System.Threading.Tasks.Task.Delay(10); // if (d != null) // { // break; // } // } // if ((DateTime.Now - dateTime).TotalMilliseconds > 1000) // { // d = new GetPanIdResponData { errorMessageBase = " 回复超时,请重新操作" }; // } // gateway.Actions -= action; // System.Console.WriteLine("ZbGw/GetPanId_Actions 退出" + "_" + System.DateTime.Now.ToString()); // return d; // }); //} ///// <summary> ///// 读取当前局域网的PANID,网关反馈具体信息 ///// </summary> //public GetPanIdResponData getPanIdResponData; ///// <summary> ///// 读取当前局域网的PANID,网关反馈具体信息 ///// </summary> //[System.Serializable] //public class GetPanIdResponData //{ // /// <summary> // /// 错误信息 // /// </summary> // public string errorMessageBase; // /// <summary> // /// 网关信息错误反馈 // /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> // /// </summary> // public ErrorResponData errorResponData; // /// <summary> // /// 当前网络的PANID // /// </summary> // public int panID = 999; //} //#endregion //#region 读取协调器MAC地址. /////<summary > ///// 读取协调器MAC地址 ///// </summary> //public static async System.Threading.Tasks.Task<GetMacResponData> ReadMacAsync(ZigBee.Device.ZbGateway gateway) //{ // if (gateway == null) // { // return null; // } // return await System.Threading.Tasks.Task.Run(async () => // { // GetMacResponData d = null; // Action<string, string> action = (topic, message) => // { // var gatewayID = topic.Split('/')[0]; // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); // if (topic == gatewayID + "/" + "Error_Respon") // { // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) // { // d = new GetMacResponData { errorMessageBase = "网关错误回复,且数据是空" }; // } // else // { // d = new GetMacResponData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; // } // } // if (topic == gatewayID + "/" + "ZbGw/GetMac_Respon") // { // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; // var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<MacAddrData>(jobject["Data"].ToString()); // if (tempData == null) // { // d = new GetMacResponData { errorMessageBase = "网关返回的数据为空" }; // } // else // { // d = new GetMacResponData { macAddrData = tempData }; // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // } // } // }; // gateway.Actions += action; // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 13 } }; // gateway.Send(("ZbGw/GetMac"), Common.SecuritySet.Encryption((jObject.ToString()))); // var dateTime = DateTime.Now; // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) // { // await System.Threading.Tasks.Task.Delay(10); // if (d != null) // { // break; // } // } // if ((DateTime.Now - dateTime).TotalMilliseconds > 10000) // { // d = new GetMacResponData { errorMessageBase = " 回复超时,请重新操作" }; // } // gateway.Actions -= action; // return d; // }); //} /// <summary> /// 读取协调器MAC地址,网关反馈具体信息 /// </summary> @@ -1686,108 +929,6 @@ //#endregion #region 添加Install Codes码 /////<summary > /////添加Install Codes码 ///// <para>installCode:InstallCode码 36个字符</para> ///// <para>installCodeAddr:InstallCodes码设备的mac地址16个字符</para> ///// </summary> //public static async System.Threading.Tasks.Task<InstallCodeResponData> InstallCodeAsync(ZigBee.Device.ZbGateway gateway, string installCode, string installCodeAddr) //{ // if (gateway == null) // { // return null; // } // return await System.Threading.Tasks.Task.Run(async () => // { // var d = new InstallCodeResponData { }; // Action<string, string> action = (topic, message) => // { // var gatewayID = topic.Split('/')[0]; // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); // if (topic == gatewayID + "/" + "Error_Respon") // { // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) // { // d.errorMessageBase = "网关错误回复,且数据是空"; // } // else // { // d.errorResponData = temp; // d.errorMessageBase = ErrorMess(temp.Error); // } // } // if (topic == gatewayID + "/" + "ZbGw/InstallCode_Respon") // { // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; // var code = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"].ToString()); // if (code == null) // { // d.errorMessageBase = "网关返回的数据为空"; // } // else // { // d.Status = code; // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // } // } // }; // gateway.Actions += action; // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 13 } }; // gateway.Send(("ZbGw/GetMac"), Common.SecuritySet.Encryption((jObject.ToString()))); // var dateTime = DateTime.Now; // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) // { // await System.Threading.Tasks.Task.Delay(10); // //if (d.Status != 999) // //{ // // break; // //} // } // if ((DateTime.Now - dateTime).TotalMilliseconds > 1000) // { // d.errorMessageBase = " 回复超时,请重新操作"; // } // gateway.Actions -= action; // return d; // }); //} /// <summary> /// 添加Install Codes码,网关反馈具体信息 /// </summary> public InstallCodeResponData installCodeResponData; /// <summary> /// 添加Install Codes码,网关反馈具体信息 /// </summary> [System.Serializable] public class InstallCodeResponData { /// <summary> /// 错误信息 /// </summary> public string errorMessageBase; /// <summary> /// 网关信息错误反馈 /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> /// </summary> public ErrorResponData errorResponData; /// <summary> /// 0:成功,1:失败 /// </summary> public int Status = 999; } #endregion #region 启用或关闭透传数据上传接口 /// <summary> /// 透传数据上传接口,网关反馈信息 @@ -1814,134 +955,6 @@ public string passData; } #endregion //#region 协调器通用功能操作接口 ///// <summary> ///// 协调器通用功能操作接口 ///// </summary> ///// <returns>The or get all data async.</returns> ///// <param name="gateway">Gateway.</param> ///// <param name="commandID">Command identifier.</param> ///// <param name="payload">Payload.</param> //public static async System.Threading.Tasks.Task<SetOrGetAllData> SetOrGetAllDataAsync(ZigBee.Device.ZbGateway gateway, int commandID, string payload) //{ // if (gateway == null) // { // return null; // } // return await System.Threading.Tasks.Task.Run(async () => // { // var d = new SetOrGetAllData { }; // Action<string, string> action = (topic, message) => // { // var gatewayID = topic.Split('/')[0]; // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); // if (topic == gatewayID + "/" + "Error_Respon") // { // var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); // if (temp == null) // { // d.errorMessageBase = "网关错误回复,且数据是空"; // } // else // { // d.errorResponData = temp; // d.errorMessageBase = ErrorMess(temp.Error); // } // } // if (topic == gatewayID + "/" + "ZbGw/SetOrGetData_Respon") // { // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SetOrGetData>(jobject["Data"].ToString()); // if (gatewayTemp.getGwVersion == null) // { // d.errorMessageBase = "网关返回的数据为空"; // } // else // { // d.setOrGetData = temp; // DebugPrintLog($"UI收到通知后的主题_{ topic}"); // } // } // }; // gateway.Actions += action; // System.Console.WriteLine("ZbDataPassthrough_Actions 启动" + "_" + System.DateTime.Now.ToString()); // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 2 } }; // var data = new JObject { { "Command_ID", commandID }, { "Payload", payload } }; // jObject.Add("Data", data); // gateway.Send("ZbGw/SetOrGetData", Common.SecuritySet.Encryption(jObject.ToString())); // var dateTime = DateTime.Now; // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) // { // await System.Threading.Tasks.Task.Delay(10); // if (d.setOrGetData != null) // { // break; // } // } // if ((DateTime.Now - dateTime).TotalMilliseconds > 10000) // { // d.errorMessageBase = " 回复超时,请重新操作"; // } // gateway.Actions -= action; // System.Console.WriteLine("GetGwVersionData_Actions 退出" + System.DateTime.Now.ToString()); // return d; // }); //} ///// <summary> ///// BDB接口,网关反馈信息 ///// </summary> //public SetOrGetAllData setOrGetAllData; ///// <summary> ///// BDB接口,网关反馈信息 ///// </summary> //[System.Serializable] //public class SetOrGetAllData //{ // /// <summary> // /// 错误信息 // /// </summary> // public string errorMessageBase; // /// <summary> // /// 网关信息错误反馈 // /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> // /// </summary> // public ErrorResponData errorResponData; // /// <summary> // /// BDB数据 // /// </summary> // public SetOrGetData setOrGetData; //} ///// <summary> ///// BDB数据 ///// </summary> //public SetOrGetData setOrGetData; ///// <summary> ///// BDB数据 ///// </summary> //[System.Serializable] //public class SetOrGetData //{ // /// <summary> // /// 协调器指令的command_ID。对应《协调器串口通信协议规范》第2章节指令的command_ID // /// </summary> // public int commandID; // /// <summary> // /// 已经转换成字符格式的16进制的data数据。对应《协调器串口通信协议规范》第2章节指令的“数据”内容 // /// </summary> // public string payload; //} //#endregion #region 客户端发送文件流到网关 /// <summary> ZigbeeApp/Shared/R.cs
@@ -558,6 +558,10 @@ /// 手动 /// </summary> public const int Manual = 311; /// <summary> /// 背光灯颜色 /// </summary> public const int BackgroundLightColor = 312; public readonly static int cancel = 5097; public readonly static int confrim = 5098; @@ -822,7 +826,15 @@ public readonly static int numberSone = 5387; public readonly static int openAutomationSone = 5388; public readonly static int timeSetSone= 5389; public readonly static int invalidSetting = 5390; public readonly static int hour = 5391; public readonly static int lockOpen = 5392; public readonly static int setDoorLockOpen = 5393; public readonly static int less = 5394; public readonly static int more = 5395; public readonly static int or = 5396; public readonly static int timeNull = 5397; public readonly static int numberInput = 5398; #region 登录注册 /// <summary> @@ -5961,6 +5973,10 @@ /// 窗帘面板 -> 长按面板左上角按键,所有按键{0}指示灯亮起,则配网成功 /// </summary> public const int uAddCurtaunPanelMsg = 21022; /// <summary> /// 吸顶燃气传感器 -> 长按图示按键5秒以上,绿色快闪{0}进入配网状态,绿灯常亮则入网成功 /// </summary> public const int uAddSensorCeilingGasMsg = 21023; //★★★★下面这些是模块ID的官方名字,从30000开始★★★★ @@ -6120,6 +6136,10 @@ /// 镜像ID为2310的设备的默认名字:方悦新风小模块 /// </summary> public const int uDeviceModelId2310 = 30038; /// <summary> /// 镜像ID为1306的设备的默认名字:Zigbee吸顶燃气传感器 /// </summary> public const int uDeviceModelId1306 = 30039; //★★★★下面这些是设备所属种类的翻译名字,从40000开始★★★★ /// <summary> @@ -6303,5 +6323,9 @@ /// 智能空开 /// </summary> public const int uDeviceDirectionName25 = 70024; /// <summary> /// 吸顶燃气传感器 /// </summary> public const int uDeviceDirectionName26 = 70025; } } ZigbeeApp/Shared/Shared.projitems
@@ -42,6 +42,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\mFunView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\SaveView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\SelectedDeviceView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\TipView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\TopView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\LogicView\TypeView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\Method.cs" /> @@ -96,6 +97,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceCurtainDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceFreshAirDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceRelayDetailCardForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceFreshAirCardControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceFunctionUnallocatedControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceSelectUnallocatedControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\SelectLocalDeviceImageForm.cs" /> @@ -185,6 +187,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\PanelFangyueTwoButtonDirectionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\RepeaterZigbeeDirectionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorCarbonMonoxideDirectionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorCeilingGasDirectionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorDoorWindowDirectionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorFireDirectionForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Device\Direction\SensorInfraredDirectionForm.cs" />