| | |
| | | using System.Collections.Generic;
|
| | | using System.Threading.Tasks;
|
| | | using Shared.Common;
|
| | | using Shared.Phone.UserCenter.Device.Bind;
|
| | | using Shared.Phone.UserCenter.DeviceBind;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.Device
|
| | |
| | | /// 中央空调的版本控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnAirConditionerVersion = null;
|
| | |
|
| | | /// <summary>
|
| | | /// 简约面板绑定的温度目标名字
|
| | | /// </summary>
|
| | | private string bindTemperatureName = string.Empty;
|
| | | /// <summary>
|
| | | /// 简约面板绑定的湿度目标名字
|
| | | /// </summary>
|
| | | private string bindHumidityName = string.Empty;
|
| | | /// <summary>
|
| | | /// 简约面板绑定被绑目标是温度
|
| | | /// </summary>
|
| | | private CommonDevice bindTemperatureDev;
|
| | | /// <summary>
|
| | | /// 简约面板绑定被绑目标是湿度
|
| | | /// </summary>
|
| | | private CommonDevice bindHumidityDev;
|
| | | /// <summary>
|
| | | /// 简约面板当前Mac
|
| | | /// </summary>
|
| | | private string deviceMacTemp = string.Empty;
|
| | | // <summary>
|
| | | /// 简约面板中被绑定的温湿度目标列表
|
| | | /// </summary>
|
| | | private List<BindObj.BindListResponseObj> bindList = new List<BindObj.BindListResponseObj>();
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
| | | //针对单纯只有一个200端点的设备
|
| | | listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
|
| | | }
|
| | |
|
| | | this.listDeviceType.Clear();
|
| | | deviceMacTemp = deviceMac;
|
| | | foreach (var device in listNewDevice)
|
| | | {
|
| | | //收集设备类型
|
| | |
| | |
|
| | | //重新获取硬件信息
|
| | | this.RefreshHardFirmwareInfo();
|
| | |
|
| | | //简约多功能面板获取绑定目标的显示
|
| | | if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | //简约面板随便一个回路来获取设备信息
|
| | | var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 62);
|
| | | var key = new ZigBee.Device.Panel();
|
| | | key.DeviceAddr = deviceMac;
|
| | | key.CurrentGateWayId = dev.CurrentGateWayId;
|
| | | InitBindInfo(key);
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | //简约多功能面板
|
| | | this.AddIBindRow();
|
| | | this.AddIBindRow(deviceMacTemp);
|
| | | this.AddFunctionSettionRow();
|
| | | this.AddHumiditySourceRow();
|
| | | this.AddTemperatureSensorRow();
|
| | |
|
| | | this.AddHumiditySourceRow(deviceMacTemp);
|
| | | this.AddTemperatureSensorRow(deviceMacTemp);
|
| | | }
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
|
| | | {
|
| | |
| | | btnFunction.AddBottomLine();
|
| | | btnFunction.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new DeviceBind.PanelSimpleEnvironmentTargetsForm();
|
| | |
|
| | | //简约环境面板的按键配置
|
| | | var form = new DevicePanel.PanelSimpleEnvironmentButtonSettionForm();
|
| | | form.AddForm(listNewDevice[0]);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 按键设置(方悦)_____________________
|
| | |
| | | var form = new DevicePanel.PanelFangyueEnvironmentButtonSettionForm();
|
| | | form.AddForm(listNewDevice[0]);
|
| | | }
|
| | | else
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
|
| | | {
|
| | | //方悦新风面板的按键配置
|
| | | var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm();
|
| | | form.AddForm(listNewDevice[0]);
|
| | | }
|
| | | else
|
| | | {
|
| | | var form = new DevicePanel.PanelFangyueButtonSettionForm();
|
| | | form.AddForm(listNewDevice[0]);
|
| | | }
|
| | | };
|
| | |
| | | {
|
| | | var form = new DevicePanel.PanelFangyueFunctionSettionForm();
|
| | | form.AddForm(listNewDevice[0], deviceEnumInfo);
|
| | | }
|
| | | //简约环境面板的按键配置
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
|
| | | {
|
| | | var form = new DeviceFunctionSettionForm();
|
| | | if (listNewDevice.Count > 62)
|
| | | {
|
| | | form.AddForm(listNewDevice[62], true);
|
| | | }
|
| | | }
|
| | | //河东的面板设备
|
| | | else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A按键面板 && deviceEnumInfo.IsHdlDevice == true)
|
| | |
| | |
|
| | | #region ■ 简约多功能面板用___________________
|
| | | /// <summary>
|
| | | /// 添加【绑定目标】行 |
| | | /// 添加【绑定目标】行
|
| | | /// </summary>
|
| | | private void AddIBindRow()
|
| | | private void AddIBindRow(string deviceMac)
|
| | | {
|
| | | string bindTargets = Language.StringByID(R.MyInternationalizationString.uBindTargets);
|
| | | var btnBindTargets = new FrameRowControl(listview.rowSpace / 2);
|
| | |
| | | btnBindTargets.AddBottomLine();
|
| | | btnBindTargets.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new DeviceBind.PanelSimpleMutilfunctionTargetsForm();
|
| | | var simpleMutilfunctionTargetsPage = new Shared.Phone.UserCenter.DeviceBind.PanelSimpleMutilfunctionTargetsForm(deviceMac);
|
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(simpleMutilfunctionTargetsPage);
|
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
| | | simpleMutilfunctionTargetsPage.Show();
|
| | | };
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 湿度来源行
|
| | | /// </summary>
|
| | | private void AddHumiditySourceRow()
|
| | | private void AddHumiditySourceRow(string deviceMac)
|
| | | {
|
| | | //湿度
|
| | | var rowHumidity = new FrameRowControl(listview.rowSpace / 2);
|
| | |
| | | //右箭头
|
| | | rowHumidity.AddRightArrow();
|
| | | var msg = Language.StringByID(R.MyInternationalizationString.nothing);
|
| | | //if (!string.IsNullOrEmpty(bindHumidityName))
|
| | | //{
|
| | | // msg = bindHumidityName;
|
| | | //}
|
| | | if (!string.IsNullOrEmpty(bindHumidityName))
|
| | | {
|
| | | msg = bindHumidityName;
|
| | | }
|
| | | var btnHumidityStatu = rowHumidity.AddMostRightView(msg, 700);
|
| | | rowHumidity.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //var key = new Panel();
|
| | | //var bindHumiditySensorPage = new Shared.Phone.UserCenter.DeviceBind.PanelSimpleMutilfunctionBindSensorForm(key, bindHumidityDev, 3);
|
| | | //Shared.Phone.UserView.HomePage.Instance.AddChidren(bindHumiditySensorPage);
|
| | | //Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
| | | //bindHumiditySensorPage.Show();
|
| | |
|
| | | //bindHumiditySensorPage.actionHumidityTarget += (bindName) =>
|
| | | //{
|
| | | // Application.RunOnMainThread(() =>
|
| | | // {
|
| | | // if (string.IsNullOrEmpty(bindName))
|
| | | // {
|
| | | // btnHumidityStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // btnHumidityStatu.Text = bindName;
|
| | | // }
|
| | | // });
|
| | | //};
|
| | | var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 62);//简约面板随便一个回路来获取设备
|
| | | var device = new CommonDevice();
|
| | | if (dev != null)
|
| | | {
|
| | | device.CurrentGateWayId = dev.CurrentGateWayId;
|
| | | }
|
| | | device.Type = DeviceType.OnOffSwitch;
|
| | | device.DeviceAddr = deviceMac;
|
| | | device.DeviceEpoint = 65;//能绑定湿度的回路
|
| | | var paneTargetsBaseFormp = new PaneTargetsBaseForm(device, bindHumidityDev, BindInfo.BindType.Humidity);
|
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp);
|
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
| | | paneTargetsBaseFormp.Show();
|
| | | paneTargetsBaseFormp.actionHumidityTarget += (bindName) =>
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (string.IsNullOrEmpty(bindName))
|
| | | {
|
| | | btnHumidityStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
|
| | | }
|
| | | else
|
| | | {
|
| | | btnHumidityStatu.Text = bindName;
|
| | | }
|
| | | });
|
| | | };
|
| | | };
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 温度来源行
|
| | | /// </summary>
|
| | | private void AddTemperatureSensorRow()
|
| | | private void AddTemperatureSensorRow(string deviceMac)
|
| | | {
|
| | | //温度来源
|
| | | var rowTemPerature = new FrameRowControl(listview.rowSpace / 2);
|
| | |
| | | //右箭头
|
| | | rowTemPerature.AddRightArrow();
|
| | | var msg = Language.StringByID(R.MyInternationalizationString.nothing);
|
| | | //if (!string.IsNullOrEmpty(bindTemperatureName))
|
| | | //{
|
| | | // msg = bindTemperatureName;
|
| | | //}
|
| | | if (!string.IsNullOrEmpty(bindTemperatureName))
|
| | | {
|
| | | msg = bindTemperatureName;
|
| | | }
|
| | | var btnTemperatureStatu = rowTemPerature.AddMostRightView(msg, 700);
|
| | | rowTemPerature.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //var key = new Panel();
|
| | | //var bindTemperatureSensorPage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(key, bindTemperatureDev, 2);
|
| | | //Shared.Phone.UserView.HomePage.Instance.AddChidren(bindTemperatureSensorPage);
|
| | | //Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
| | | //bindTemperatureSensorPage.Show();
|
| | |
|
| | | //bindTemperatureSensorPage.actionTemperatureTarget += (bindName) =>
|
| | | //{
|
| | | // Application.RunOnMainThread(() =>
|
| | | // {
|
| | | // if (string.IsNullOrEmpty(bindName))
|
| | | // {
|
| | | // btnTemperatureStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // btnTemperatureStatu.Text = bindName;
|
| | | // }
|
| | | // });
|
| | | //};
|
| | | var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 62);//简约面板随便一个回路来获取设备
|
| | | var device = new CommonDevice();
|
| | | if (dev != null)
|
| | | {
|
| | | device.CurrentGateWayId = dev.CurrentGateWayId;
|
| | | }
|
| | | device.Type = DeviceType.OnOffSwitch;
|
| | | device.DeviceAddr = deviceMac;
|
| | | device.DeviceEpoint = 64;//能绑定温度的回路
|
| | | var paneTargetsBaseFormp = new PaneTargetsBaseForm(device, bindTemperatureDev, BindInfo.BindType.Temperature);
|
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp);
|
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
| | | paneTargetsBaseFormp.Show();
|
| | | paneTargetsBaseFormp.actionTemperatureTarget += (bindName) =>
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (string.IsNullOrEmpty(bindName))
|
| | | {
|
| | | btnTemperatureStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
|
| | | }
|
| | | else
|
| | | {
|
| | | btnTemperatureStatu.Text = bindName;
|
| | | }
|
| | | });
|
| | | };
|
| | | };
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | ///读温湿度数据
|
| | | /// </summary>
|
| | | void InitBindInfo(CommonDevice curControlDev)
|
| | | {
|
| | | System.Threading.Tasks.Task.Run(async () =>
|
| | | {
|
| | | try
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | CommonPage.Loading.Start("");
|
| | | });
|
| | | //1、获去绑定的温度传感器
|
| | | curControlDev.DeviceEpoint = 64;
|
| | | var result = await GetBindName(curControlDev);
|
| | | if (!result)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
| | | });
|
| | | return;
|
| | | }
|
| | |
|
| | | //2、获去绑定的湿度度传感器
|
| | | curControlDev.DeviceEpoint = 65;
|
| | | var result2 = await GetBindName(curControlDev);
|
| | | if (!result2)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
| | | });
|
| | | return;
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | var mess = ex.Message;
|
| | | }
|
| | | finally
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | CommonPage.Loading.Hide();
|
| | | });
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 获取绑定的温湿度目标
|
| | | /// </summary>
|
| | | /// <param name="curControlDev"></param>
|
| | | /// <returns></returns>
|
| | | private async System.Threading.Tasks.Task<bool> GetBindName(CommonDevice curControlDev)
|
| | | {
|
| | | bool result = false;
|
| | | var panelBindListRes = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev);
|
| | | if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null)
|
| | | {
|
| | | bindList = panelBindListRes.getAllBindResponseData.BindList;
|
| | | foreach (var bDev in bindList)
|
| | | {
|
| | | var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint);
|
| | | if (device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | var bD = device as TemperatureSensor;
|
| | | if (bD.SensorDiv == 1 && bDev.BindCluster == 1026)
|
| | | {
|
| | | if (string.IsNullOrEmpty(bDev.ESName))
|
| | | {
|
| | | bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | }
|
| | | else
|
| | | {
|
| | | bindTemperatureName = bDev.ESName;
|
| | | }
|
| | | bindTemperatureDev = device;
|
| | | }
|
| | | if (bD.SensorDiv == 2 && bDev.BindCluster == 1029)
|
| | | {
|
| | | if (string.IsNullOrEmpty(bDev.ESName))
|
| | | {
|
| | | bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | }
|
| | | else
|
| | | {
|
| | | bindHumidityName = bDev.ESName;
|
| | | }
|
| | |
|
| | | bindHumidityDev = device;
|
| | | }
|
| | | }
|
| | | if (device.Type == DeviceType.FreshAirHumiditySensor)
|
| | | {
|
| | | if (string.IsNullOrEmpty(bDev.ESName))
|
| | | {
|
| | | bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | }
|
| | | else
|
| | | {
|
| | | bindHumidityName = bDev.ESName;
|
| | | }
|
| | |
|
| | | bindHumidityDev = device;
|
| | | }
|
| | | }
|
| | | result = true;
|
| | | }
|
| | | return result;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 功能类型(空气开关专用)_____________
|