HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
old mode 100755 new mode 100644
@@ -227,7 +227,7 @@
                    }
                }
                //保存设备房间索引
                Common.LocalDevice.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys);
                HdlRoomLogic.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys);
            };
            //添加全部菜单
@@ -462,7 +462,13 @@
                //底线
                btnRow.AddBottomLine();
                var doorLock = (ZigBee.Device.DoorLock)listNewDevice[0];
                var doorLock = (ZigBee.Device.DoorLock)listNewDevice[0];
                ///值为空再去读取本地
                if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword))
                {
                    ///读取本地远程开锁密码,看看之前是否配置过
                    doorLock.RemoteUnlockPassword = ReadLocalPassword();
                }
                if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword) == false)
                {
                    btnswitch.IsSelected = true;
@@ -518,7 +524,24 @@
                 };
            }
        }
        /// <summary>
        /// 保存远程门锁密码
        /// </summary>
        /// <param name="password">密码</param>
        public void SaveLocalPassword(string password) {
            var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(password));
            IO.FileUtils.WriteFileByBytes(Config.Instance.HomeId + "_" + Config.Instance.Guid, bytes);
        }
        /// <summary>
        /// 读取远程门锁密码
        /// </summary>
        /// <returns></returns>
        public string ReadLocalPassword()
        {
            var str = System.Text.Encoding.UTF8.GetString(IO.FileUtils.ReadFile(Config.Instance.HomeId + "_" + Config.Instance.Guid));
            //Newtonsoft.Json.JsonConvert.DeserializeObject<对像>(str);
            return str;
        }
        #endregion
        #region ■ 门锁时间(门锁)_____________________
@@ -784,8 +807,30 @@
            //只有回路数大于1才能有这个菜单
            if (Common.LocalDevice.Current.GetDevicesCountByMac(listNewDevice[0].DeviceAddr) == 1)
            {
                //新风小模块只有一个回路,但要求新风小模块的新风有功能设置
                if (deviceEnumInfo.ConcreteType != DeviceConcreteType.Relay_FangyueFreshAirModul)
                //空气质量传感器和新风小模块只有一个回路,但要求新风小模块的新风有功能设置
                //晾衣架默认只存储第一回路,其他回路被过滤了
                bool isSpecial = false;
                if (deviceEnumInfo.ConcreteType == DeviceConcreteType.Relay_FangyueFreshAirModul ||
                    deviceEnumInfo.ConcreteType == DeviceConcreteType.AirQualitySensor)
                {
                    isSpecial = true;
                }
                if (deviceEnumInfo.ConcreteType == DeviceConcreteType.Airer)
                {
                    isSpecial = true;
                    var dev = listNewDevice[0];
                    //晾衣架默认只存储第一回路,其他回路在功能界面需要读取时间,所以提前一个界面获取
                    //第一版时间功能由于设备不支持,暂时去掉,后期才加上
                    //for (int i = 3; i < 6; i++)
                    //{
                    //  //注意,衣架中的状态由不同端点获取
                    //  //回路3:读取风干开关状态和时间值
                    //  //回路4:读取烘干开关状态和时间值
                    //  //回路5:读取消毒开关状态和时间值
                    //  HdlDeviceAttributeLogic.Current.SendAirerComand(dev, i);
                    //}
                }
                if (!isSpecial)
                {
                    return;
                }
@@ -831,14 +876,19 @@
                    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)
                    foreach (var dev in listNewDevice)
                    {
                        form.AddForm(listNewDevice[62], true);
                        if (dev.Type == DeviceType.OnOffOutput && dev.DeviceEpoint == 62)
                        {
                            var form = new DeviceFunctionSettionForm();
                            form.AddForm(dev, true);
                            break;
                        }
                    }
                }
                //河东的面板设备
                else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A按键面板 && deviceEnumInfo.IsHdlDevice == true)
@@ -1174,6 +1224,7 @@
                        if (string.IsNullOrEmpty(bindName))
                        {
                            btnHumidityStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
                            bindHumidityDev = null;
                        }
                        else
                        {
@@ -1225,6 +1276,7 @@
                        if (string.IsNullOrEmpty(bindName))
                        {
                            btnTemperatureStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
                            bindTemperatureDev = null;
                        }
                        else
                        {
@@ -1308,47 +1360,54 @@
                    {
                        continue;
                    }
                    //获取设备类型的
                    var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
                    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;
                            }
                            bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device);
                            bindTemperatureDev = device;
                        }
                        if (bD.SensorDiv == 2 && bDev.BindCluster == 1029)
                        {
                            if (string.IsNullOrEmpty(bDev.ESName))
                            {
                                bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device);
                            }
                            else
                            {
                                bindHumidityName = bDev.ESName;
                            }
                            bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device);
                            bindHumidityDev = device;
                        }
                        //空气质量传感器
                        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
                        {
                            if (bDev.BindCluster == 1026)
                            {
                                bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                                bindTemperatureDev = device;
                            }
                            if (bDev.BindCluster == 1029)
                            {
                                bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
                                bindHumidityDev = device;
                            }
                        }
                    }
                    if (device.Type == DeviceType.FreshAirHumiditySensor)
                    {
                        if (string.IsNullOrEmpty(bDev.ESName))
                        {
                            bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device);
                        }
                        else
                        {
                            bindHumidityName = bDev.ESName;
                        }
                        bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device);
                        bindHumidityDev = device;
                    }
                    else if (device.Type == DeviceType.PMSensor)
                    {
                        if (bDev.BindCluster == 1026)
                        {
                            bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
                            bindTemperatureDev = device;
                        }
                        if (bDev.BindCluster == 1029)
                        {
                            bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
                            bindHumidityDev = device;
                        }
                    }
                }
                result = true;
@@ -1377,7 +1436,8 @@
                    { 
                        return;
                    }
                } catch (Exception ex)
                }
                catch (Exception ex)
                {
                    var mess = ex.Message;
                }
@@ -1598,7 +1658,7 @@
                        }
                    }, ShowErrorMode.NO);
                }
            });
            }, ShowErrorMode.NO);
        }
        #endregion
@@ -1683,7 +1743,7 @@
                frame.AddRowMenu(deviceMenu, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () =>
                {
                    //发送定位功能
                    Common.LocalDevice.Current.SetFixedPositionCommand(listNewDevice[0]);
                    Common.LocalDevice.Current.SetFixedPositionCommand(listNewDevice[0], true);
                });
            }