| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 接近感应___________________________
|
| | | /// <summary>
|
| | | /// 获取接近感应配置(ui叫接近感应,使用返回值的panelProximitySensorInfo)
|
| | | /// </summary>
|
| | | /// <param name="device">设备对象</param>
|
| | | /// <returns></returns>
|
| | | public async Task<Panel.PanelProximitySensorInfo> GetDeviceProximitySensorsSettion(CommonDevice device)
|
| | | {
|
| | | //借用它的函数
|
| | | var panel = new Panel();
|
| | | panel.DeviceAddr = device.DeviceAddr;
|
| | | panel.DeviceEpoint = device.DeviceEpoint;
|
| | | panel.CurrentGateWayId = device.CurrentGateWayId;
|
| | |
|
| | | var result = await panel.GetProximitySensorAsync();
|
| | | panel = null;
|
| | | //共通错误检测
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | | {
|
| | | this.ShowErrorMsg(error);
|
| | | return null;
|
| | | }
|
| | | if (result == null || result.panelProximitySensorInfo == null || string.IsNullOrEmpty(result.errorMessageBase) == false)
|
| | | {
|
| | | //获取接近感应信息失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.GetPanelProximityFail);
|
| | | this.ShowErrorMsg(msg);
|
| | | return null;
|
| | | }
|
| | | return result.panelProximitySensorInfo;
|
| | | }
|
| | |
|
| | |
|
| | | /// <summary>
|
| | | /// 配置接近传感
|
| | | /// </summary>
|
| | | /// <param name="device">设备对象</param>
|
| | | /// <para>sensorEnable:传感器使能</para> |
| | | /// <returns></returns>
|
| | | public async Task<bool> SetProximitySensorStatus(CommonDevice device, bool sensorEnable)
|
| | | {
|
| | | //借用它的函数
|
| | | var panel = new Panel();
|
| | | panel.DeviceAddr = device.DeviceAddr;
|
| | | panel.DeviceEpoint = device.DeviceEpoint;
|
| | | panel.CurrentGateWayId = device.CurrentGateWayId;
|
| | |
|
| | | var result = await panel.SetProximitySensor(sensorEnable);
|
| | | panel = null;
|
| | |
|
| | | //共通错误检测
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | | {
|
| | | this.ShowErrorMsg(error);
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (result == null || result.responseData == null)
|
| | | {
|
| | | //接近传感配置失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.SetPannelProximityFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | |
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | |
|
| | | // 备份设备
|
| | | var backData = new Newtonsoft.Json.Linq.JObject
|
| | | {
|
| | | { "sensorEnable",sensorEnable }
|
| | | };
|
| | | //备份设备
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A面板接近感应功能, backData);
|
| | | return true;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 节能模式___________________________
|
| | | /// <summary>
|
| | | /// 获取设备节能模式的配置状态(ui叫节能模式)
|