| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string CodeIDString = "1.1.0121011401"; |
| | | public static string CodeIDString = "1.1.0121070801"; |
| | | /// <summary> |
| | | /// 注册来源(0:HDL On 1:Zigbee) |
| | | /// </summary> |
| | |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 处理网关返回的湿度值 |
| | | /// </summary> |
| | | /// <param name="value">网关返回的属性值</param> |
| | | public decimal AdjustHumidityValue(int value) |
| | | { |
| | | if (value == 0) |
| | | { |
| | | //0% |
| | | return 0; |
| | | } |
| | | //不会出现负数 |
| | | else |
| | | { |
| | | //小数点需要一位 |
| | | string strValue = value.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | //记录温度 |
| | | return strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 处理网关返回的温度值 |
| | | /// </summary> |
| | | /// <param name="value">网关返回的属性值</param> |
| | | public decimal AdjustTemperatrueValue(int value) |
| | | { |
| | | if (value == 0) |
| | | { |
| | | //0℃ |
| | | return 0; |
| | | } |
| | | else if (value > 32767) |
| | | { |
| | | //负数(特殊处理) |
| | | string strValue = (value - 65536).ToString(); |
| | | //小数点需要一位 |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | //记录温度 |
| | | return strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | else |
| | | { |
| | | //小数点需要一位 |
| | | string strValue = value.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | //记录温度 |
| | | return strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | //----------------------------------分割线(自定义接口)--------------------------------------------- |
| | |
| | | ((TemperatureSensor)mainDevice).SensorDiv = 1; |
| | | } |
| | | } |
| | | if (((TemperatureSensor)mainDevice).SensorDiv == 1) |
| | | { |
| | | //变更一下温度的值 |
| | | foreach (var data in mainDevice.AttributeStatus) |
| | | { |
| | | if (data.ClusterId == 1026 |
| | | && data.AttributeId == (int)AttriButeId.MeasuredValue) |
| | | { |
| | | //处理网关返回的温度值 |
| | | decimal temperatrue = this.AdjustTemperatrueValue(data.AttributeData); |
| | | ((TemperatureSensor)mainDevice).currentTemperature = temperatrue; |
| | | } |
| | | } |
| | | } |
| | | else if (((TemperatureSensor)mainDevice).SensorDiv == 2) |
| | | { |
| | | //变更一下湿度的值 |
| | | foreach (var data in mainDevice.AttributeStatus) |
| | | { |
| | | if (data.ClusterId == 1029 |
| | | && data.AttributeId == (int)AttriButeId.MeasuredValue) |
| | | { |
| | | //处理网关返回的温度值 |
| | | decimal humidity = this.AdjustHumidityValue(data.AttributeData); |
| | | ((TemperatureSensor)mainDevice).currentHumidity = humidity; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | <member name="P:Shared.VerticalScrolViewLayout.VerticalScrollBarEnabled"> |
| | | <summary>
/// 是否显示滚动条
/// </summary> |
| | | </member> |
| | | <member name="M:Shared.VerticalScrolViewLayout.ScrollToViewIndex(System.Int32)"> |
| | | <summary> |
| | | 滑动到指定View |
| | | </summary> |
| | | <param name="viewIndex"> 指定view的索引值</param> |
| | | </member> |
| | | <member name="M:Shared.VerticalScrolViewLayout.ScrollToY(System.Int32)"> |
| | | <summary> |
| | | 滑动到指定位置 Y |
| | | </summary> |
| | | <param name="viewY"></param> |
| | | </member> |
| | | <member name="T:Shared.AndroidScrolView"> |
| | | <summary>
/// 竖直方向滑动控件
/// </summary>
|
| | | </member> |
| | |
| | | 设备控件背景图 |
| | | </summary> |
| | | <param name="filePath"></param> |
| | | </member> |
| | | <member name="M:Shared.View.getDrawable(System.String)"> |
| | | <summary> |
| | | 2020-12-23 彪哥新修改方法 |
| | | </summary> |
| | | <param name="filePath"></param> |
| | | <returns></returns> |
| | | </member> |
| | | <member name="P:Shared.View.Padding"> |
| | | <summary> |
| | |
| | | </summary> |
| | | <value>是否可以滑动</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSeekBar.CurtainPaddingLeftRight"> |
| | | <summary> |
| | | 进度条与左右边框边距 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSeekBar.CurtainPaddingTop"> |
| | | <summary> |
| | | 顶部padding |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSeekBar.IsOffline"> |
| | | <summary> |
| | | 是否离线 离线的话禁止滑动并绘制背景遮挡层 |
| | |
| | | Option的配置JsonString |
| | | </summary> |
| | | </member> |
| | | <member name="M:Shared.MyEchartsViewOn.#ctor"> |
| | | <summary> |
| | | MyEchartsViewOn |
| | | </summary> |
| | | </member> |
| | | <member name="F:Shared.MyEchartsViewOn.IsLoadEchartsNew"> |
| | | <summary> |
| | | 是否采用LoadEchartsNew的方式 |
| | | </summary> |
| | | </member> |
| | | <member name="M:Shared.MyEchartsViewOn.ShowWithOption(System.String)"> |
| | | <summary> |
| | | 加载Option配置参数 |
| | | 刷新图表 |
| | | </summary> |
| | | <param name="option"></param> |
| | | </member> |
| | | <member name="M:Shared.MyEchartsViewOn.ShowWithOptionJsonString(System.String)"> |
| | | <summary> |
| | | 加载Option配置JsonString |
| | |
| | | <member name="M:Shared.MyEchartsViewOn.refreshEcharts"> |
| | | <summary> |
| | | 刷新界面 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.MyEchartsViewOn.webView"> |
| | | <summary> |
| | | MyWebView |
| | | </summary> |
| | | </member> |
| | | <member name="T:Shared.WebView"> |
| | |
| | | MyWebView |
| | | </summary> |
| | | </member> |
| | | <member name="T:Shared.CurtainSingleSeekBar"> |
| | | <summary> |
| | | CurtainSingleSeekBar |
| | | 向左或者向右,单向打开的开合帘 |
| | | IsRightOpenStyle |
| | | false:右滑关闭,进度Progress 100-->0 |
| | | true:右滑打开,进度Progress 0-->100 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.mHDLOACSingleCurtainSeekBar"> |
| | | <summary> |
| | | 当前视图 |
| | | </summary> |
| | | <value>The HDLOACSingleCurtainSeekBar.</value> |
| | | </member> |
| | | <member name="M:Shared.CurtainSingleSeekBar.#ctor"> |
| | | <summary> |
| | | 构造函数 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.ProgressBarUnitSring"> |
| | | <summary> |
| | | 进度值显示单位 |
| | | </summary> |
| | | <value>单位字符</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.MaxValue"> |
| | | <summary> |
| | | 进度值最大值 |
| | | </summary> |
| | | <value>最大值</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.MinValue"> |
| | | <summary> |
| | | 进度值最小值 |
| | | </summary> |
| | | <value>最小值</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.Progress"> |
| | | <summary> |
| | | 当前进度值 |
| | | </summary> |
| | | <value>进度值</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.ProgressTextColor"> |
| | | <summary> |
| | | 当前进度值显示的文字颜色 |
| | | </summary> |
| | | <value>文字颜色</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.ProgressTextSize"> |
| | | <summary> |
| | | 当前进度值显示的文字大小 |
| | | </summary> |
| | | <value>文字大小</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.IsClickable"> |
| | | <summary> |
| | | 是否可以滑动 |
| | | </summary> |
| | | <value>是否可以滑动</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.IsProgressTextShow"> |
| | | <summary> |
| | | 是否可以滑动 |
| | | </summary> |
| | | <value>是否可以滑动</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.IsOffline"> |
| | | <summary> |
| | | 是否离线 离线的话禁止滑动并绘制背景遮挡层 |
| | | </summary> |
| | | <value>是否离线</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.NowProgressX"> |
| | | <summary> |
| | | 当前进度值 X坐标 |
| | | </summary> |
| | | <value>X坐标</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.IsRightOpenStyle"> |
| | | <summary> |
| | | 是否从左到右打开到100%,默认false |
| | | </summary> |
| | | <value>默认false</value> |
| | | </member> |
| | | <member name="F:Shared.CurtainSingleSeekBar.OnProgressChangedEvent"> |
| | | <summary> |
| | | EventHandler |
| | | </summary> |
| | | </member> |
| | | <member name="F:Shared.CurtainSingleSeekBar.mOnProgressChangeListener"> |
| | | <summary> |
| | | OnProgressChangeListener 继承响应事件 |
| | | </summary> |
| | | </member> |
| | | <member name="T:ViewFlow.ViewSwitchListener"> |
| | | Receives call backs when a new {@link View} has been scrolled to. |
| | | </member> |
| | |
| | | <member name="P:Shared.VerticalScrolViewLayout.VerticalScrollBarEnabled"> |
| | | <summary>
/// 是否显示垂直滚动条
/// </summary> |
| | | </member> |
| | | <member name="M:Shared.VerticalScrolViewLayout.ScrollToY(System.Int32)"> |
| | | <summary> |
| | | 滑动到指定位置 |
| | | </summary> |
| | | <param name="viewY"></param> |
| | | </member> |
| | | <member name="M:Shared.VerticalScrolViewLayout.ScrollToViewIndex(System.Int32)"> |
| | | <summary> |
| | | 滑动到指定VIEW |
| | | </summary> |
| | | <param name="viewIndex"></param> |
| | | </member> |
| | | <member name="T:Shared.VerticalSeekBar"> |
| | | <summary> |
| | | 位置布局 |
| | |
| | | </summary> |
| | | <value>进度值</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSeekBar.CurtainPaddingLeftRight"> |
| | | <summary> |
| | | 进度条与左右边框边距 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSeekBar.CurtainPaddingTop"> |
| | | <summary> |
| | | 顶部padding |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSeekBar.IsOffline"> |
| | | <summary> |
| | | 是否离线 离线的话禁止滑动并绘制背景遮挡层 |
| | |
| | | <member name="T:Shared.MyEchartsViewOn"> |
| | | <summary> |
| | | MyEchartsViewOn HDLON+ |
| | | |
| | | </summary> |
| | | </member> |
| | | <member name="F:Shared.MyEchartsViewOn.optionJsonString"> |
| | |
| | | WKWebView控件 |
| | | </summary> |
| | | </member> |
| | | <member name="M:Shared.MyEchartsViewOn.#ctor"> |
| | | <summary> |
| | | |
| | | </summary> |
| | | </member> |
| | | <member name="M:Shared.MyEchartsViewOn.LoadFileUrl"> |
| | | <summary> |
| | | 加载本地HTML |
| | | </summary> |
| | | </member> |
| | | <member name="F:Shared.MyEchartsViewOn.htmlPathName"> |
| | | <summary> |
| | | |
| | | </summary> |
| | | </member> |
| | | <member name="F:Shared.MyEchartsViewOn.IsLoadEchartsNew"> |
| | | <summary> |
| | | 是否采用LoadEchartsNew的方式 |
| | | </summary> |
| | | </member> |
| | | <member name="M:Shared.MyEchartsViewOn.ShowWithOption(System.String)"> |
| | | <summary> |
| | | 加载Option配置参数 |
| | | 刷新图表 |
| | | </summary> |
| | | <param name="option"></param> |
| | | </member> |
| | | <member name="M:Shared.MyEchartsViewOn.ShowWithOptionJsonString(System.String)"> |
| | | <summary> |
| | | 加载Option配置jsonString |
| | | </summary> |
| | | <param name="jsonString"></param> |
| | | </member> |
| | | <member name="M:Shared.MyEchartsViewOn.LoadFileUrl"> |
| | | <member name="M:Shared.MyEchartsViewOn.EvaluateJavascript"> |
| | | <summary> |
| | | 加载本地HTML |
| | | EvaluateJavascript |
| | | </summary> |
| | | </member> |
| | | <member name="T:Shared.MyEchartsViewOn.OnWKNavigationDelegate"> |
| | | <summary> |
| | | OnWKNavigationDelegate |
| | | </summary> |
| | | </member> |
| | | <member name="T:Shared.WaveSeekBarOn"> |
| | |
| | | EventHandler |
| | | </summary> |
| | | </member> |
| | | <member name="T:Shared.CurtainSingleSeekBar"> |
| | | <summary> |
| | | CurtainSingleSeekBar |
| | | 向左或者向右,单向打开的开合帘 |
| | | IsRightOpenStyle |
| | | false:右滑关闭,进度Progress 100-->0 |
| | | true:右滑打开,进度Progress 0-->100 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.mHDLOACSingleCurtainSeekBar"> |
| | | <summary> |
| | | 当前视图 |
| | | </summary> |
| | | <value>The HDLOACSingleCurtainSeekBar.</value> |
| | | </member> |
| | | <member name="M:Shared.CurtainSingleSeekBar.#ctor"> |
| | | <summary> |
| | | 构造函数 |
| | | </summary> |
| | | </member> |
| | | <member name="M:Shared.CurtainSingleSeekBar.RefreshFrame"> |
| | | <summary> |
| | | 刷新布局 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.Width"> |
| | | <summary> |
| | | 控件宽度 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.Height"> |
| | | <summary> |
| | | 控件的高度 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.X"> |
| | | <summary> |
| | | 控件的X坐标 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.Y"> |
| | | <summary> |
| | | 控件的X坐标 |
| | | </summary> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.ProgressBarUnitSring"> |
| | | <summary> |
| | | 进度值显示单位 |
| | | </summary> |
| | | <value>单位字符</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.MaxValue"> |
| | | <summary> |
| | | 进度值最大值 |
| | | </summary> |
| | | <value>最大值</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.MinValue"> |
| | | <summary> |
| | | 进度值最小值 |
| | | </summary> |
| | | <value>最小值</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.Progress"> |
| | | <summary> |
| | | 当前进度值 |
| | | </summary> |
| | | <value>进度值</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.IsOffline"> |
| | | <summary> |
| | | 是否离线 离线的话禁止滑动并绘制背景遮挡层 |
| | | </summary> |
| | | <value>是否离线</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.ProgressTextColor"> |
| | | <summary> |
| | | 当前进度值显示的文字颜色 |
| | | </summary> |
| | | <value>文字颜色</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.ProgressTextSize"> |
| | | <summary> |
| | | 当前进度值显示的文字大小 |
| | | </summary> |
| | | <value>文字大小</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.IsClickable"> |
| | | <summary> |
| | | 是否可以滑动 |
| | | </summary> |
| | | <value>是否可以滑动</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.IsProgressTextShow"> |
| | | <summary> |
| | | 是否显示进度文字 |
| | | </summary> |
| | | <value>是否显示进度文字</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.NowProgressX"> |
| | | <summary> |
| | | 当前进度值 X坐标 |
| | | </summary> |
| | | <value>X坐标</value> |
| | | </member> |
| | | <member name="P:Shared.CurtainSingleSeekBar.IsRightOpenStyle"> |
| | | <summary> |
| | | 是否从左到右打开到100%,默认false |
| | | </summary> |
| | | <value>默认false</value> |
| | | </member> |
| | | <member name="F:Shared.CurtainSingleSeekBar.OnProgressChangedEvent"> |
| | | <summary> |
| | | EventHandler |
| | | </summary> |
| | | </member> |
| | | <member name="F:com.hdl.on.Volume.VolumeChange"> |
| | | <summary> |
| | | 声音变化事件 |
| | |
| | | {
|
| | | cardContr = new Controls.DeviceAirQualitySensorRowControl();
|
| | | }
|
| | | else
|
| | | {
|
| | | //温湿度
|
| | | cardContr = new Controls.DeviceTemperatureRowControl();
|
| | | }
|
| | | }
|
| | | //彩灯(调光器)
|
| | | else if (device.Type == DeviceType.DimmableLight)
|
| | |
| | | else if (device.Type == DeviceType.IASZone)
|
| | | {
|
| | | cardContr = new Controls.DeviceSensorRowControl();
|
| | | }
|
| | | //温湿度
|
| | | else if (device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | cardContr = new Controls.DeviceTemperatureRowControl();
|
| | | }
|
| | | //门锁
|
| | | else if (device.Type == DeviceType.DoorLock)
|
| | |
| | | cardContr = new Controls.DeviceColorTemperatureRowControl();
|
| | | }
|
| | | //无法识别
|
| | | else
|
| | | if (cardContr == null)
|
| | | {
|
| | | cardContr = new Controls.DeviceRowCommon();
|
| | | //没有状态功能
|
| | |
| | | string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | //晾衣架上报需要特殊处理,其他上报的回路统一转为端点1
|
| | | var tempList = LocalDevice.Current.GetDevicesByMac(report.DeviceAddr);
|
| | | var tempDeviceEnum = LocalDevice.Current.GetMyDeviceEnumInfo(tempList);
|
| | | if (tempDeviceEnum.ConcreteType == Common.DeviceConcreteType.Airer)
|
| | | if (tempList.Count > 0)
|
| | | {
|
| | | mainKeys = report.DeviceAddr + "_" + 1;
|
| | | var tempDeviceEnum = LocalDevice.Current.GetMyDeviceEnumInfo(tempList);
|
| | | if (tempDeviceEnum.ConcreteType == Common.DeviceConcreteType.Airer)
|
| | | {
|
| | | mainKeys = report.DeviceAddr + "_" + 1;
|
| | | }
|
| | | }
|
| | | if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
|
| | | {
|
| | |
| | | {
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | /// <param name="i_device"></param>
|
| | | public override void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom)
|
| | | {
|
| | | base.InitControl(i_device, i_nowSelectRoom);
|
| | |
|
| | | //添加跳转深度卡片信息事件
|
| | | this.AddDetailInfoEvent(i_device);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 深度卡片信息_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加跳转深度卡片信息事件
|
| | | /// </summary>
|
| | | private void AddDetailInfoEvent(CommonDevice i_device)
|
| | | {
|
| | | //深度卡片信息
|
| | | this.frameTable.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //温湿度类型的深度卡片界面
|
| | | var form = new MainPage.ControlForm.DeviceTemperatureHumidityDetailCardForm();
|
| | | form.RowOrCardControl = this;
|
| | | form.AddForm(i_device, this.nowSelectRoom, 965, 1316);
|
| | | form.FormCloseEvent += this.CardDetailInfoBackEvent;
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 发送获取状态命令___________________
|
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace Shared.Phone.MainPage |
| | | { |
| | | /// <summary> |
| | | /// App公告界面 |
| | | /// </summary> |
| | | public class AppNoticeForm : FrameLayout |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 结束事件 |
| | | /// </summary> |
| | | public Action FinishEvent = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// App公告界面 |
| | | /// </summary> |
| | | public void Show() |
| | | { |
| | | this.BackgroundColor = 0x7f000000; |
| | | |
| | | //白色背景 |
| | | var frameWhite = new FrameLayout(); |
| | | frameWhite.Y = Application.GetRealHeight(252); |
| | | frameWhite.Height = Application.GetRealHeight(1255); |
| | | frameWhite.Width = Application.GetRealWidth(860); |
| | | frameWhite.BackgroundColor = UserCenter.UserCenterColor.Current.White; |
| | | frameWhite.Radius = (uint)Application.GetRealWidth(17); |
| | | frameWhite.Gravity = Gravity.CenterHorizontal; |
| | | this.AddChidren(frameWhite); |
| | | |
| | | //公告 |
| | | var btnNotice = new UserCenter.NormalViewControl(frameWhite.Width, Application.GetRealHeight(65), false); |
| | | btnNotice.TextSize = 20; |
| | | btnNotice.TextAlignment = TextAlignment.Center; |
| | | btnNotice.TextID = R.MyInternationalizationString.uNotice; |
| | | btnNotice.Y = Application.GetRealHeight(48); |
| | | frameWhite.AddChidren(btnNotice); |
| | | |
| | | //加载的内容 |
| | | var webView = new WebView(); |
| | | webView.Y = btnNotice.Bottom + Application.GetRealHeight(70); |
| | | webView.Height = Application.GetRealHeight(868); |
| | | webView.Width = frameWhite.Width - Application.GetRealWidth(23) * 2; |
| | | webView.Gravity = Gravity.CenterHorizontal; |
| | | frameWhite.AddChidren(webView); |
| | | #if Android |
| | | webView.LoadRequest("https://developer.hdlcontrol.com/AnnouncementAndriod.html"); |
| | | #endif |
| | | #if iOS |
| | | webView.LoadRequest("https://developer.hdlcontrol.com/AnnouncementIos.html"); |
| | | #endif |
| | | |
| | | //好的 |
| | | var btnOk = new UserCenter.BottomClickButton(); |
| | | btnOk.Width = frameWhite.Width - Application.GetRealWidth(173); |
| | | btnOk.Y = webView.Bottom + Application.GetRealHeight(23); |
| | | btnOk.TextID = R.MyInternationalizationString.uWell; |
| | | frameWhite.AddChidren(btnOk); |
| | | btnOk.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.RemoveFromParent(); |
| | | |
| | | this.FinishEvent?.Invoke(); |
| | | this.FinishEvent = null; |
| | | }; |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | frameWhiteBack.AddChidren(btnLight); |
| | | |
| | | //设置LED灯 |
| | | btnSetLight = new NormalViewControl(175, 49, true); |
| | | btnSetLight = new NormalViewControl(175+94, 49, true); |
| | | btnSetLight.Y = Application.GetRealHeight(1270 - 35); |
| | | btnSetLight.TextID = R.MyInternationalizationString.SetAirQualitySensorLight; |
| | | btnSetLight.TextSize = 12; |
| | |
| | | frameTemperaturePic.X = Application.GetRealWidth(518); |
| | | frameTemperaturePic.Y = frameHumidityPic.Y; |
| | | frameTemperaturePic.Width = Application.GetMinRealAverage(321); |
| | | frameTemperaturePic.BackgroundColor = 0xffff0000; |
| | | frameTemperaturePic.Height = Application.GetMinRealAverage(351); |
| | | frameTemperaturePic.BackgroundImagePath = "PM2.5Sensor/TemperaturePic.png"; |
| | | frameWhiteBack.AddChidren(frameTemperaturePic); |
New file |
| | |
| | | using ZigBee.Device; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using Shared.Phone.UserCenter; |
| | | |
| | | namespace Shared.Phone.MainPage.ControlForm |
| | | { |
| | | /// <summary> |
| | | /// 温湿度传感器的深度卡片界面 |
| | | /// </summary> |
| | | public class DeviceTemperatureHumidityDetailCardForm : DeviceDetailCardCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 值显示控件 |
| | | /// </summary> |
| | | private NormalViewControl btnValue = null; |
| | | /// <summary> |
| | | /// 单位控件 |
| | | /// </summary> |
| | | private NormalViewControl btnUnit = null; |
| | | /// <summary> |
| | | /// 图片控件的宽度 |
| | | /// </summary> |
| | | private int picContrWidth = 0; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 底层初始化中部控件完成之后 |
| | | /// </summary> |
| | | /// <param name="frameWhiteBack"></param> |
| | | public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack) |
| | | { |
| | | //图片控件的宽度 |
| | | this.picContrWidth = this.GetPictrueRealSize(380); |
| | | //左滑不能 |
| | | this.ScrollEnabled = false; |
| | | |
| | | //湿度 |
| | | if (((TemperatureSensor)this.device).SensorDiv == 2) |
| | | { |
| | | this.InitHumidityControl(frameWhiteBack); |
| | | } |
| | | //温度 |
| | | else if (((TemperatureSensor)this.device).SensorDiv == 1) |
| | | { |
| | | this.InitTemperatureControl(frameWhiteBack); |
| | | } |
| | | |
| | | //查看历史记录 |
| | | var btnHistory = new NormalViewControl(207, 50, true); |
| | | btnHistory.Y = Application.GetRealHeight(1094); |
| | | btnHistory.TextSize = 12; |
| | | btnHistory.TextAlignment = TextAlignment.Center; |
| | | btnHistory.TextColor = UserCenterColor.Current.TextOrangeColor; |
| | | btnHistory.Text = Language.StringByID(R.MyInternationalizationString.CheckAirQualitySensorHistory); |
| | | btnHistory.Width = btnHistory.GetRealWidthByText(); |
| | | btnHistory.Gravity = Gravity.CenterHorizontal; |
| | | frameWhiteBack.AddChidren(btnHistory); |
| | | //底线 |
| | | var btnLine = new NormalViewControl(btnHistory.Width, ControlCommonResourse.BottomLineHeight, false); |
| | | btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; |
| | | btnLine.Gravity = Gravity.CenterHorizontal; |
| | | btnLine.Y = btnHistory.Bottom - Application.GetRealHeight(8); |
| | | frameWhiteBack.AddChidren(btnLine); |
| | | btnHistory.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //查看历史记录事件 |
| | | var form = new DeviceTemperatureHistoryForm(); |
| | | form.AddForm(this.device); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化湿度界面_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化湿度界面 |
| | | /// </summary> |
| | | /// <param name="frameWhiteBack"></param> |
| | | private void InitHumidityControl(FrameLayout frameWhiteBack) |
| | | { |
| | | //湿度容器 |
| | | var frameHumidityPic = new FrameLayout(); |
| | | frameHumidityPic.Y = Application.GetRealHeight(351); |
| | | frameHumidityPic.Width = picContrWidth; |
| | | frameHumidityPic.Height = this.GetPictrueRealSize(426); |
| | | frameHumidityPic.BackgroundImagePath = "PM2.5Sensor/HumidityPic.png"; |
| | | frameHumidityPic.Gravity = Gravity.CenterHorizontal; |
| | | frameWhiteBack.AddChidren(frameHumidityPic); |
| | | |
| | | //湿度文本 |
| | | var btnHumidityText = new NormalViewControl(frameHumidityPic.Width, Application.GetRealHeight(60), false); |
| | | btnHumidityText.Y = Application.GetRealHeight(58); |
| | | btnHumidityText.TextID = R.MyInternationalizationString.Humidity; |
| | | btnHumidityText.TextColor = UserCenterColor.Current.White; |
| | | btnHumidityText.TextAlignment = TextAlignment.Center; |
| | | frameHumidityPic.AddChidren(btnHumidityText); |
| | | |
| | | //湿度数据 |
| | | this.btnValue = new NormalViewControl(193, 120, true); |
| | | btnValue.Y = Application.GetRealHeight(214); |
| | | btnValue.Text = ((TemperatureSensor)this.device).currentHumidity.ToString(); |
| | | btnValue.TextSize = 38; |
| | | btnValue.TextColor = UserCenterColor.Current.White; |
| | | btnValue.IsBold = true; |
| | | btnValue.TextAlignment = TextAlignment.BottomCenter; |
| | | btnValue.Width = btnValue.GetRealWidthByText(); |
| | | frameHumidityPic.AddChidren(btnValue); |
| | | |
| | | //湿度单位 |
| | | this.btnUnit = new NormalViewControl(60, 100, true); |
| | | btnUnit.X = btnValue.Right; |
| | | btnUnit.Y = btnValue.Y; |
| | | btnUnit.Text = "%"; |
| | | btnUnit.TextSize = 17; |
| | | btnUnit.TextColor = UserCenterColor.Current.White; |
| | | btnUnit.TextAlignment = TextAlignment.BottomLeft; |
| | | btnUnit.IsBold = true; |
| | | frameHumidityPic.AddChidren(btnUnit); |
| | | |
| | | //刷新值和单位控件的坐标位置 |
| | | this.RefreshValueAndUintLocation(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化温度界面_____________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化温度界面 |
| | | /// </summary> |
| | | /// <param name="frameWhiteBack"></param> |
| | | private void InitTemperatureControl(FrameLayout frameWhiteBack) |
| | | { |
| | | //温度容器 |
| | | var frameHumidityPic = new FrameLayout(); |
| | | frameHumidityPic.Y = Application.GetRealHeight(351); |
| | | frameHumidityPic.Width = picContrWidth; |
| | | frameHumidityPic.Height = this.GetPictrueRealSize(426); |
| | | frameHumidityPic.BackgroundImagePath = "PM2.5Sensor/TemperaturePic.png"; |
| | | frameHumidityPic.Gravity = Gravity.CenterHorizontal; |
| | | frameWhiteBack.AddChidren(frameHumidityPic); |
| | | |
| | | //温度文本 |
| | | var btnTemperatureText = new NormalViewControl(frameHumidityPic.Width, Application.GetRealHeight(60), false); |
| | | btnTemperatureText.Y = Application.GetRealHeight(58); |
| | | btnTemperatureText.TextID = R.MyInternationalizationString.Temperature; |
| | | btnTemperatureText.TextColor = UserCenterColor.Current.White; |
| | | btnTemperatureText.TextAlignment = TextAlignment.Center; |
| | | frameHumidityPic.AddChidren(btnTemperatureText); |
| | | |
| | | //温度数据 |
| | | this.btnValue = new NormalViewControl(193, 120, true); |
| | | btnValue.Y = Application.GetRealHeight(214); |
| | | btnValue.Text = ((TemperatureSensor)this.device).currentTemperature.ToString(); |
| | | btnValue.TextSize = 38; |
| | | btnValue.TextColor = UserCenterColor.Current.White; |
| | | btnValue.IsBold = true; |
| | | btnValue.TextAlignment = TextAlignment.BottomCenter; |
| | | btnValue.Width = btnValue.GetRealWidthByText(); |
| | | frameHumidityPic.AddChidren(btnValue); |
| | | |
| | | //温度单位 |
| | | this.btnUnit = new NormalViewControl(60, 100, true); |
| | | btnUnit.X = btnValue.Right; |
| | | btnUnit.Y = btnValue.Y; |
| | | btnUnit.Text = "℃"; |
| | | btnUnit.TextSize = 17; |
| | | btnUnit.TextColor = UserCenterColor.Current.White; |
| | | btnUnit.TextAlignment = TextAlignment.BottomLeft; |
| | | btnUnit.IsBold = true; |
| | | frameHumidityPic.AddChidren(btnUnit); |
| | | |
| | | //刷新值和单位控件的坐标位置 |
| | | this.RefreshValueAndUintLocation(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region ■ 是否获取网关反馈的结果_____________ |
| | | |
| | | /// <summary> |
| | | /// 检测网关的反馈结果(属性上报的对象:device.DeviceStatusReport) |
| | | /// </summary> |
| | | /// <param name="comandDiv">命令区分</param> |
| | | /// <param name="report">上报数据</param> |
| | | /// <returns></returns> |
| | | public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report) |
| | | { |
| | | if (comandDiv == ReceiveComandDiv.A设备属性上报) |
| | | { |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //湿度 |
| | | if (((TemperatureSensor)this.device).SensorDiv == 2) |
| | | { |
| | | this.btnValue.Text = ((TemperatureSensor)this.device).currentHumidity.ToString(); |
| | | } |
| | | //温度 |
| | | else if (((TemperatureSensor)this.device).SensorDiv == 1) |
| | | { |
| | | this.btnValue.Text = ((TemperatureSensor)this.device).currentTemperature.ToString(); |
| | | } |
| | | //刷新值和单位控件的坐标位置 |
| | | this.RefreshValueAndUintLocation(); |
| | | }); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 刷新值和单位控件的坐标位置 |
| | | /// </summary> |
| | | private void RefreshValueAndUintLocation() |
| | | { |
| | | this.btnValue.Width = this.btnValue.GetRealWidthByText(); |
| | | int xx = (this.picContrWidth - (this.btnUnit.Width + this.btnValue.Width)) / 2; |
| | | this.btnValue.X = xx; |
| | | this.btnUnit.X = this.btnValue.Right; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | /// </summary>
|
| | | public class DeviceTemperatureCardControl : DeviceCardCommon
|
| | | {
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | /// <param name="i_device"></param>
|
| | | public override void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom)
|
| | | {
|
| | | base.InitControl(i_device, i_nowSelectRoom);
|
| | |
|
| | | //添加跳转深度卡片信息事件
|
| | | this.AddDetailInfoEvent(i_device);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 深度卡片信息_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加跳转深度卡片信息事件
|
| | | /// </summary>
|
| | | private void AddDetailInfoEvent(CommonDevice i_device)
|
| | | {
|
| | | //深度卡片信息
|
| | | this.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | Common.CommonPage.Instance.IsDrawerLockMode = true;
|
| | |
|
| | | //温湿度类型的深度卡片界面
|
| | | var form = new ControlForm.DeviceTemperatureHumidityDetailCardForm();
|
| | | form.RowOrCardControl = this;
|
| | | form.AddForm(i_device, this.nowSelectRoom, 965, 1316);
|
| | | form.FormCloseEvent += this.CardDetailInfoBackEvent;
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 发送获取状态命令___________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | |
| | | //因为曲线图很宽,所以使用左右滑动的控件 |
| | | this.horizontalScrolView = new HorizontalScrolViewLayout(); |
| | | horizontalScrolView.Y = Application.GetRealHeight(230); |
| | | horizontalScrolView.Height = bodyFrameLayout.Height - Application.GetRealHeight(230); |
| | | #if Android |
| | | horizontalScrolView.Y = Application.GetRealHeight(243); |
| | | horizontalScrolView.Height = bodyFrameLayout.Height - Application.GetRealHeight(243); |
| | | #endif |
| | | #if iOS |
| | | horizontalScrolView.Y = Application.GetRealHeight(300); |
| | | horizontalScrolView.Height = bodyFrameLayout.Height - Application.GetRealHeight(300); |
| | | #endif |
| | | bodyFrameLayout.AddChidren(horizontalScrolView); |
| | | |
| | | //初始化类别控件 |
| | |
| | | }; |
| | | } |
| | | |
| | | //CO² |
| | | //frameCo2 = this.CreatTypeSelectControl("CO²"); |
| | | //frameCo2.X = framePm.Right + defultSpace; |
| | | //frameCo2.ButtonClickEvent += (sender, e) => |
| | | //检测该设备是否拥有CO²的功能 |
| | | //if (this.CheckDeviceHadCO2(myType) == true) |
| | | //{ |
| | | // //同一个东西,不处理 |
| | | // if (nowSelectObjType == 4) { return; } |
| | | // nowSelectObjType = 4; |
| | | // //CO² |
| | | // frameCo2 = this.CreatTypeSelectControl("CO²"); |
| | | // frameCo2.X = framePm.Right + defultSpace; |
| | | // frameCo2.ButtonClickEvent += (sender, e) => |
| | | // { |
| | | // //同一个东西,不处理 |
| | | // if (nowSelectObjType == 4) { return; } |
| | | // nowSelectObjType = 4; |
| | | |
| | | // //设置选择控件的状态(原来的变更为取消) |
| | | // this.SetSelectControlStatu(nowBtnSelect, false, 0); |
| | | // nowBtnSelect = frameCo2.GetChildren(0) as NormalViewControl; |
| | | // //设置选择控件的状态(当前变更为选择) |
| | | // this.SetSelectControlStatu(nowBtnSelect, true, 4); |
| | | // 刷新Echart控件 |
| | | // this.RefreshEchartControl(); |
| | | //}; |
| | | // //设置选择控件的状态(原来的变更为取消) |
| | | // this.SetSelectControlStatu(nowBtnSelect, false, 0); |
| | | // nowBtnSelect = frameCo2.GetChildren(0) as NormalViewControl; |
| | | // //设置选择控件的状态(当前变更为选择) |
| | | // this.SetSelectControlStatu(nowBtnSelect, true, 4); |
| | | // //刷新Echart控件 |
| | | // this.RefreshEchartControl(); |
| | | // }; |
| | | //} |
| | | |
| | | //默认初始选择 |
| | | if (frameTemperatrue != null) |
| | |
| | | nowBtnSelect = framePm.GetChildren(0) as NormalViewControl; |
| | | this.SetSelectControlStatu(nowBtnSelect, true, 3); |
| | | } |
| | | //else if (frameCo2 != null) |
| | | //{ |
| | | // this.nowSelectObjType = 4; |
| | | // nowBtnSelect = frameCo2.GetChildren(0) as NormalViewControl; |
| | | // this.SetSelectControlStatu(nowBtnSelect, true, 4); |
| | | //} |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | dicText["3"] = "1" + Language.StringByID(R.MyInternationalizationString.uOneMonth1); |
| | | |
| | | var menuContr = new TextGroupMenuControl(dicText); |
| | | menuContr.Y = Application.GetRealHeight(100); |
| | | menuContr.Y = Application.GetRealHeight(98); |
| | | bodyFrameLayout.AddChidren(menuContr); |
| | | menuContr.SelectEvent += (selectKey, selectText) => |
| | | { |
| | |
| | | string mark = string.Empty; |
| | | if (info.Hour == "0:00") |
| | | { |
| | | mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", "0:00~11:59").Replace("{2}", info.Value.ToString()); |
| | | mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", "0:00~11:59").Replace("{2}", info.deValue.ToString()); |
| | | } |
| | | else |
| | | { |
| | | mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", "12:00~23:59").Replace("{2}", info.Value.ToString()); |
| | | mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", "12:00~23:59").Replace("{2}", info.deValue.ToString()); |
| | | } |
| | | //特殊处理PM2.5的显示 |
| | | this.AdjustPM25TipText(ref mark, info.deValue); |
| | | |
| | | valueText += "{value:" + info.Value + ",mark:" + mark + "},\r\n"; |
| | | valueText += "{value:" + info.deValue + ",mark:" + mark + "},\r\n"; |
| | | } |
| | | //没有数据则设置为null |
| | | else |
| | |
| | | //按以下格式显示 |
| | | //2019-12-16 |
| | | //湿度:68% |
| | | var mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", string.Empty).Replace("{2}", info.Value.ToString()); |
| | | var mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", string.Empty).Replace("{2}", info.deValue.ToString()); |
| | | //特殊处理PM2.5的显示 |
| | | this.AdjustPM25TipText(ref mark, info.deValue); |
| | | |
| | | valueText += "{value:" + info.Value + ",mark:" + mark + "},\r\n"; |
| | | valueText += "{value:" + info.deValue + ",mark:" + mark + "},\r\n"; |
| | | } |
| | | //没有数据则设置为null |
| | | else |
| | |
| | | //{2}:Y轴的单位格式 |
| | | //{3}:X轴组员对应的值 |
| | | //{4}:曲线的颜色 |
| | | #if Android |
| | | return @"{ |
| | | color: ['#73A0FA', '#73DEB3', '#FFB761'], |
| | | tooltip: { |
| | |
| | | type: 'line', |
| | | smooth: true, |
| | | symbol:'emptyCircle', |
| | | symbolSize:8, |
| | | symbolSize:6, |
| | | connectNulls:true, |
| | | color:{4}, |
| | | data: {3} |
| | | } |
| | | ] |
| | | }"; |
| | | #endif |
| | | #if iOS |
| | | return @"{ |
| | | color: ['#73A0FA', '#73DEB3', '#FFB761'], |
| | | backgroundColor:'#f5f6fa', |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | backgroundColor:'#777779', |
| | | axisPointer: { |
| | | type: 'line', |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color:{0} |
| | | } |
| | | }, |
| | | textStyle: { |
| | | fontSize: 36 |
| | | }, |
| | | formatter:function(pra){ |
| | | return pra[0].data.mark; |
| | | } |
| | | |
| | | }, |
| | | dataZoom: |
| | | { |
| | | type: 'inside', |
| | | show: true, |
| | | start: 0, |
| | | end: 50 |
| | | }, |
| | | grid: { |
| | | left: '10', |
| | | right: '0', |
| | | bottom: '25', |
| | | top: '45', |
| | | containLabel: true |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | boundaryGap:true, |
| | | axisLabel:{ |
| | | color: '#666666', |
| | | textStyle: { |
| | | fontSize: 30 |
| | | }, |
| | | }, |
| | | data: {1}, |
| | | splitLine: { |
| | | show: false |
| | | }, |
| | | axisTick: { |
| | | show: false |
| | | }, |
| | | axisLine: { |
| | | show: false |
| | | }, |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | axisLabel: { |
| | | color: '#666666', |
| | | formatter:'{value}{2}', |
| | | textStyle: { |
| | | fontSize: 30 |
| | | }, |
| | | }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: '#CCCCCC', |
| | | width:1, |
| | | type:'dashed' |
| | | } |
| | | }, |
| | | axisTick: { |
| | | show: false |
| | | }, |
| | | axisLine: { |
| | | show: false |
| | | }, |
| | | }, |
| | | series: [{ |
| | | type: 'line', |
| | | smooth: true, |
| | | symbol:'emptyCircle', |
| | | symbolSize:15, |
| | | connectNulls:true, |
| | | color:{4}, |
| | | data: {3} |
| | | } |
| | | ] |
| | | }"; |
| | | #endif |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 获取云端数据_______________________ |
| | |
| | | } |
| | | gwMacmark = ZbGateway.GateWayBaseInfomations[this.device.CurrentGateWayId].MacMark; |
| | | |
| | | //1026:温度; 1037:Co2; 1066:PM2.5; 1029:温度 |
| | | //1026:温度; 1037:Co2; 1066:PM2.5; 1029:湿度 |
| | | int dataType = 0; |
| | | if (this.nowSelectObjType == 1) { dataType = 1029; } |
| | | else if (this.nowSelectObjType == 2) { dataType = 1026; } |
| | | if (this.nowSelectObjType == 1) { dataType = 1026; } |
| | | else if (this.nowSelectObjType == 2) { dataType = 1029; } |
| | | else if (this.nowSelectObjType == 3) { dataType = 1066; } |
| | | else if (this.nowSelectObjType == 4) { dataType = 1037; } |
| | | |
| | |
| | | var text = Language.StringByID(R.MyInternationalizationString.uHumidity); |
| | | return "'{0} {1}<br/>" + text + ":{2}" + this.GetEchartUint() + "<br/>{3}'"; |
| | | } |
| | | //CO² |
| | | else if (this.nowSelectObjType == 4) |
| | | { |
| | | var text = "CO²"; |
| | | return "'{0} {1}<br/>" + text + ":{2}" + this.GetEchartUint() + "'"; |
| | | } |
| | | return "''"; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检测该设备是否拥有CO²的功能 |
| | | /// </summary> |
| | | /// <param name="enumInfo"></param> |
| | | /// <returns></returns> |
| | | private bool CheckDeviceHadCO2(DeviceEnumInfo enumInfo) |
| | | { |
| | | //PM2.5和空气质量传感器都有CO²的功能 |
| | | if (enumInfo.ConcreteType == DeviceConcreteType.Sensor_PMTwoPointFive |
| | | || enumInfo.ConcreteType == DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 转换结果值 |
| | | /// </summary> |
| | | /// <param name="data"></param> |
| | | private void ConvertHistoryDataValue(HistoryData data) |
| | | { |
| | | //云端返回的数据可能带小数点,所以需要把小数点给去掉(强转为int会报错) |
| | | int intValue = (int)Convert.ToDecimal(data.Value); |
| | | //温度,需要除以100(会出现负数) |
| | | if (this.nowSelectObjType == 1) |
| | | { |
| | | int shortData = Convert.ToInt32(data.Value); |
| | | if (shortData > 32767) |
| | | if (intValue > 32767) |
| | | { |
| | | //负数(特殊处理) |
| | | string strValue = (shortData - 65536).ToString(); |
| | | string strValue = (intValue - 65536).ToString(); |
| | | //小数点需要一位(先把最后一位去掉) |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | //然后再插入一个小数点 |
| | | data.deValue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | data.deValue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | else |
| | | { |
| | | //小数点需要一位(先把最后一位去掉) |
| | | string strValue = data.Value.Substring(0, data.Value.Length - 1); |
| | | string strValue = intValue.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | //然后再插入一个小数点 |
| | | data.deValue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | data.deValue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | } |
| | | //湿度,需要除以100(不会出现负数) |
| | | else if (this.nowSelectObjType == 2) |
| | | { |
| | | //小数点需要一位(先把最后一位去掉) |
| | | string strValue = data.Value.Substring(0, data.Value.Length - 1); |
| | | string strValue = intValue.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | //然后再插入一个小数点 |
| | | data.deValue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | data.deValue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | else |
| | | { |
| | | //其他都不用变 |
| | | data.deValue = Convert.ToDecimal(data.Value); |
| | | data.deValue = Convert.ToDecimal(intValue); |
| | | } |
| | | } |
| | | |
| | |
| | | this.AddSensorDeviceReportEvent();
|
| | | //开启传感器状态还原的线程
|
| | | this.StartRecoverSenorStatuThread();
|
| | | //显示App公告
|
| | | this.ShowAppNotice();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | else
|
| | | {
|
| | | cardContr = new Controls.DeviceTemperatureCardControl();
|
| | |
|
| | | }
|
| | | }
|
| | | //门锁
|
| | |
| | | cardContr = new Controls.DeviceColorTemperatureCardControl();
|
| | | }
|
| | | //无法识别
|
| | | else
|
| | | if (cardContr == null)
|
| | | {
|
| | | cardContr = new Controls.DeviceCardCommon();
|
| | | }
|
| | |
| | |
|
| | | //晾衣架上报需要特殊处理,其他上报的回路统一转为端点1
|
| | | var tempList = LocalDevice.Current.GetDevicesByMac(report.DeviceAddr);
|
| | | var tempDeviceEnum = LocalDevice.Current.GetMyDeviceEnumInfo(tempList);
|
| | | if (tempDeviceEnum.ConcreteType == Common.DeviceConcreteType.Airer)
|
| | | if (tempList.Count > 0)
|
| | | {
|
| | | mainKeys = report.DeviceAddr + "_" + 1;
|
| | | var tempDeviceEnum = LocalDevice.Current.GetMyDeviceEnumInfo(tempList);
|
| | | if (tempDeviceEnum.ConcreteType == Common.DeviceConcreteType.Airer)
|
| | | {
|
| | | mainKeys = report.DeviceAddr + "_" + 1;
|
| | | }
|
| | | }
|
| | |
|
| | | if (this.dicDeviceCardControl.ContainsKey(mainKeys) == true)
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示App公告
|
| | | /// </summary>
|
| | | private void ShowAppNotice()
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | if (HdlFirmwareUpdateLogic.CheckCanShowNotice() == true)
|
| | | {
|
| | | while (this.IsFormOpen("HdlAutoBackupForm") == true)
|
| | | {
|
| | | //自动备份的界面正在打开中
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //加载系统公告
|
| | | var form2 = new AppNoticeForm();
|
| | | UserView.UserPage.Instance.AddChidren(form2);
|
| | | form2.Show();
|
| | | form2.FinishEvent += () =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | //显示App升级的弹窗
|
| | | this.ShowUpdateAppDialog();
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | };
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | else
|
| | | {
|
| | | //显示App升级的弹窗
|
| | | this.ShowUpdateAppDialog();
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示App升级的弹窗
|
| | | /// </summary>
|
| | | private void ShowUpdateAppDialog()
|
| | | {
|
| | | //App升级提示
|
| | | if (string.IsNullOrEmpty(FirmwareUpdateResourse.AppNeedUpdateUrl) == false)
|
| | | {
|
| | | //整了一次之后就不整了
|
| | | string updateUrl = FirmwareUpdateResourse.AppNeedUpdateUrl;
|
| | | FirmwareUpdateResourse.AppNeedUpdateUrl = string.Empty;
|
| | |
|
| | | while (this.IsFormOpen("HdlAutoBackupForm") == true)
|
| | | {
|
| | | //自动备份的界面正在打开中
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | }
|
| | | //发现APP新版本,马上升级{0}开启新体验哦~
|
| | | this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uAppUpdateMsg1).Replace("{0}", "\r\n"), () =>
|
| | | {
|
| | | #if iOS
|
| | | Uri url = new Uri(updateUrl);
|
| | | UIKit.UIApplication.SharedApplication.OpenUrl(url);
|
| | | #endif
|
| | | #if Android
|
| | | HDLUtils.OpenUrl(updateUrl);
|
| | | #endif
|
| | | }, Language.StringByID(R.MyInternationalizationString.uLevelUp));
|
| | | //App升级提示优先
|
| | | return;
|
| | | }
|
| | | //网关升级提示
|
| | | if (FirmwareUpdateResourse.ListGatewayNeedUpdate.Count > 0)
|
| | | {
|
| | | //整完之后就清空
|
| | | var listGateway = new List<string>();
|
| | | listGateway.AddRange(FirmwareUpdateResourse.ListGatewayNeedUpdate);
|
| | | FirmwareUpdateResourse.ListGatewayNeedUpdate = new List<string>();
|
| | |
|
| | | while (this.IsFormOpen("HdlAutoBackupForm") == true)
|
| | | {
|
| | | //自动备份的界面正在打开中
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | }
|
| | | foreach (var gwId in listGateway)
|
| | | {
|
| | | //目前只整一个
|
| | | if (HdlGatewayLogic.Current.IsGatewayExist(gwId) == true)
|
| | | {
|
| | | //发现网关新版本,马上升级{0}开启新体验哦~
|
| | | this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uGatewayUpdateMsg1).Replace("{0}", "\r\n"), () =>
|
| | | {
|
| | | var form = new UserCenter.GatewayUpdate.GatewayFirmwareUpdateForm();
|
| | | form.AddForm(HdlGatewayLogic.Current.GetLocalGateway(gwId));
|
| | | });
|
| | | break;
|
| | | }
|
| | | }
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面重新激活事件___________________
|
| | |
| | | return 1;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | if (device == null) |
| | | continue; |
| | | |
| | | //判断该设备是否可以显示在主页 |
| | | if (LocalDevice.Current.CanShowInHomeHomeMainPage(device) == false) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | SmartSound.Device smartDevice = new SmartSound.Device(); |
| | | smartDevice.DeviceAddress = device.DeviceAddr;//设备 MAC |
| | | smartDevice.Epoint = device.DeviceEpoint;//设备端口 |
| | |
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | /// <param name="autoUpdate">打开界面之后,如果有新版本,是否直接升级</param>
|
| | | public void ShowForm(bool autoUpdate)
|
| | | {
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAboutMe));
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | this.InitMiddleFrame(autoUpdate);
|
| | | }
|
| | | /// <summary>
|
| | | /// Closes the form.
|
| | |
| | | /// <summary>
|
| | | /// 初始化中部控件
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | /// <param name="autoUpdate">打开界面之后,如果有新版本,是否直接升级</param>
|
| | | private void InitMiddleFrame(bool autoUpdate)
|
| | | {
|
| | | //头部白色背景
|
| | | var frameLogo = new FrameLayoutBase();
|
| | |
| | | //更新最新版
|
| | | btnRightView.TextID = R.MyInternationalizationString.Update;
|
| | | rowUpdate.CanClick = true;
|
| | | if (autoUpdate == true)
|
| | | {
|
| | | //直接升级
|
| | | rowUpdate.ButtonClickEvent?.Invoke(null, null);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | return false; |
| | | } |
| | | |
| | | //先获取本地全部网关的版本信息 |
| | | var listOldGateway = HdlGatewayLogic.Current.GetAllLocalGateway(); |
| | | |
| | | //清空全部房间 |
| | | HdlRoomLogic.Current.DeleteAllRoom(); |
| | | //清空本地全部的场景数据 |
| | |
| | | //刷新本地缓存 |
| | | UserCenterLogic.RefreshAllMemory(); |
| | | |
| | | //重新加载缓存之后,再还原网关的版本信息 |
| | | foreach (var gw in listOldGateway) |
| | | { |
| | | var newGw = HdlGatewayLogic.Current.GetLocalGateway(gw.GwId); |
| | | if (newGw != null) |
| | | { |
| | | //还原版本信息 |
| | | newGw.GwName = gw.GwName; |
| | | newGw.GwIP = gw.GwIP; |
| | | newGw.LinuxHardVersion = gw.LinuxHardVersion; |
| | | newGw.LinuxImageType = gw.LinuxImageType; |
| | | newGw.LinuxFirmwareVersion = gw.LinuxFirmwareVersion; |
| | | newGw.CoordinatorFirmwareVersion = gw.CoordinatorFirmwareVersion; |
| | | newGw.CoordinatorHardVersion = gw.CoordinatorHardVersion; |
| | | newGw.CoordinatorImageId = gw.CoordinatorImageId; |
| | | newGw.DriveCodeList.Clear(); |
| | | newGw.DriveCodeList.AddRange(gw.DriveCodeList); |
| | | newGw.ReSave(); |
| | | } |
| | | } |
| | | |
| | | //关闭进度条 |
| | | ProgressFormBar.Current.Close(); |
| | | |
| | |
| | | else if (errorCode == 2) |
| | | { |
| | | //协调器正在升级或备份或恢复数据中 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCoordinatorIsUpOrBackupOrRecovering); |
| | | return Language.StringByID(R.MyInternationalizationString.uCoordinatorIsUpOrBackupOrRecovering); |
| | | } |
| | | else if (errorCode == 3) |
| | | { |
| | | //目标设备不存在 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit); |
| | | return Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit); |
| | | } |
| | | else if (errorCode == 4) |
| | | { |
| | | //出现未知错误,请稍后再试 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain); |
| | | return Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain); |
| | | } |
| | | else if (errorCode == 5) |
| | | { |
| | | //数据传输错误,请稍后再试 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDataTransmissionFailAndResetAgain); |
| | | return Language.StringByID(R.MyInternationalizationString.uDataTransmissionFailAndResetAgain); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | 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国标3路10A继电器小模块, RoomId = floorKey + "_ChuFang", DeviceCount = 1 }); |
| | | |
| | | //走廊 |
| | | list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A4按键面板, RoomId = floorKey + "_ZouLang", DeviceCount = 1 }); |
| | | list.Add(new AddDevicePra { DeviceType = VirtualDeviceEnum.A温湿度传感器, RoomId = floorKey + "_ZouLang", DeviceCount = 1 }); |
| | | } |
| | | return list; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public void Zigbee温湿度传感器(int i_DeviceCount, string i_RoomId) |
| | | { |
| | | for (int i = 0; i < i_DeviceCount; i++) |
| | | { |
| | | //湿度 |
| | | var device1 = new TemperatureSensor() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 1, SensorDiv = 2 }; |
| | | //设置设备的基本信息 |
| | | this.SetBaseDataToDevice(device1, 1308, 1308, "MTH01/M-ZB.10", i_RoomId); |
| | | //温度 |
| | | var device2 = new TemperatureSensor() { DeviceAddr = "DeviceAddr" + this.DeviceNumber, DeviceEpoint = 2, SensorDiv = 1 }; |
| | | //设置设备的基本信息 |
| | | this.SetBaseDataToDevice(device2, 1308, 1308, "MTH01/M-ZB.10", i_RoomId); |
| | | |
| | | this.DeviceNumber++; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置设备的基本信息 |
| | | /// </summary> |
| | |
| | | A方悦新风小模块 = 26, |
| | | A吸顶燃气传感器 = 27, |
| | | A国标3路10A继电器小模块 = 28, |
| | | A温湿度传感器 = 29, |
| | | } |
| | | |
| | | #endregion |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using ZigBee.Device; |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 读取App最低版本____________________ |
| | | |
| | | /// <summary> |
| | | /// 读取App最低版本 |
| | | /// </summary> |
| | | public static void ReadAppLestVersion() |
| | | { |
| | | if (FirmwareUpdateResourse.AppNeedUpdateUrl != null) |
| | | { |
| | | //已经读取过了,则不再读取 |
| | | return; |
| | | } |
| | | var pra = new Dictionary<string, string>(); |
| | | pra["version"] = Common.CommonPage.CodeIDString; |
| | | pra["appName"] = "EvoyoHome"; |
| | | var bodyData = GetSignRequestJson(Newtonsoft.Json.JsonConvert.SerializeObject(pra)); |
| | | //var url = "https://china-gateway.hdlcontrol.com/smart-footstone/app/appVersion/check"; |
| | | var url = "https://test-gz.hdlcontrol.com/smart-footstone/app/appVersion/check"; |
| | | var byteData = Common.CommonPage.Instance.DoRequestZigbeeHttpsInterface(url, Encoding.UTF8.GetBytes(bodyData), null); |
| | | if (byteData == null) |
| | | { |
| | | return; |
| | | } |
| | | try |
| | | { |
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(byteData)); |
| | | if (jobject["code"].ToString() != "0") |
| | | { |
| | | return; |
| | | } |
| | | var strData = jobject["data"].ToString(); |
| | | FirmwareUpdateResourse.AppNeedUpdateUrl = string.Empty; |
| | | if (string.IsNullOrEmpty(strData) == true) { return; } |
| | | |
| | | var jobData = Newtonsoft.Json.Linq.JObject.Parse(strData); |
| | | //如果是强制升级的话 |
| | | if (jobData["isEnforce"].ToString().ToLower() == "true") |
| | | { |
| | | #if iOS |
| | | FirmwareUpdateResourse.AppNeedUpdateUrl = jobData["iosUrl"].ToString(); |
| | | #endif |
| | | #if Android |
| | | FirmwareUpdateResourse.AppNeedUpdateUrl = jobData["androidUrl"].ToString(); |
| | | #endif |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 读取网关最低版本___________________ |
| | | |
| | | /// <summary> |
| | | /// 读取网关最低版本 |
| | | /// </summary> |
| | | public static void ReadGatewayLestVersion() |
| | | { |
| | | //每次切换住宅,都会去读取一次 |
| | | FirmwareUpdateResourse.ListGatewayNeedUpdate = new List<string>(); |
| | | |
| | | var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway(); |
| | | foreach (var gw in listGateway) |
| | | { |
| | | var pra = new Dictionary<string, string>(); |
| | | pra["hardwareId"] = gw.LinuxHardVersion.ToString(); |
| | | pra["imagesId"] = gw.LinuxImageType.ToString(); |
| | | pra["version"] = gw.LinuxFirmwareVersion.ToString(); |
| | | var bodyData = GetSignRequestJson(Newtonsoft.Json.JsonConvert.SerializeObject(pra)); |
| | | //var url = "https://china-gateway.hdlcontrol.com/smart-footstone/app/appVersion/check"; |
| | | var url = "https://test-gz.hdlcontrol.com/smart-footstone/app/gateway-hardware/check"; |
| | | var byteData = Common.CommonPage.Instance.DoRequestZigbeeHttpsInterface(url, Encoding.UTF8.GetBytes(bodyData), null); |
| | | if (byteData == null) |
| | | { |
| | | return; |
| | | } |
| | | try |
| | | { |
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(byteData)); |
| | | if (jobject["code"].ToString() != "0") |
| | | { |
| | | continue; |
| | | } |
| | | var strData = jobject["data"].ToString(); |
| | | if (string.IsNullOrEmpty(strData) == true) { return; } |
| | | |
| | | var jobData = Newtonsoft.Json.Linq.JObject.Parse(strData); |
| | | //如果是强制升级的话 |
| | | if (jobData["isEnforce"].ToString().ToLower() == "true") |
| | | { |
| | | FirmwareUpdateResourse.ListGatewayNeedUpdate.Add(gw.GwId); |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 检测能够显示公告___________________ |
| | | |
| | | /// <summary> |
| | | /// 检测能够显示公告 |
| | | /// </summary> |
| | | public static bool CheckCanShowNotice() |
| | | { |
| | | //不管成不成功,读过一次之后就不再读取 |
| | | if (FirmwareUpdateResourse.ReadedNotice == true) |
| | | { |
| | | return false; |
| | | } |
| | | FirmwareUpdateResourse.ReadedNotice = true; |
| | | #if Android |
| | | var url = "https://developer.hdlcontrol.com/AnnouncementAndriod.html"; |
| | | #endif |
| | | #if iOS |
| | | var url = "https://developer.hdlcontrol.com/AnnouncementIos.html"; |
| | | #endif |
| | | |
| | | var byteData = Common.CommonPage.Instance.DoRequestZigbeeHttpsInterface(url, null, null, "GET"); |
| | | if (byteData == null) |
| | | { |
| | | //如果是404,则返回false |
| | | return false; |
| | | } |
| | | //加载系统公告 |
| | | var fileData = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.AppNoticeFile); |
| | | if (fileData == null) { fileData = string.Empty; } |
| | | |
| | | //加上当天日期 |
| | | var strNotice = DateTime.Now.ToString("yyyyMMdd") + "\r\n" + Encoding.UTF8.GetString(byteData); |
| | | if (fileData == strNotice) |
| | | { |
| | | //公告内容一致,则不提示 |
| | | return false; |
| | | } |
| | | //如果公告不一致,或者已经过了一天,则显示 |
| | | HdlFileLogic.Current.SaveTextToFile(DirNameResourse.AppNoticeFile, strNotice); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 新云端访问密匙_____________________ |
| | | |
| | | /// <summary> |
| | | /// appKey(访问云端固定的东西) |
| | | /// </summary> |
| | | private const string APP_KEY = "HDL-HOME-APP-TEST"; |
| | | /// <summary> |
| | | /// 我也不知道这是什么鬼东西 |
| | | /// </summary> |
| | | private const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; |
| | | /// <summary> |
| | | /// 获取当前时间戳值(访问云端使用) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private static string GetTimestamp() |
| | | { |
| | | System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 |
| | | return ((long)(DateTime.Now - startTime).TotalSeconds).ToString(); // 相差秒数 |
| | | } |
| | | |
| | | /// <summary> |
| | | /// MD5加密 |
| | | /// </summary> |
| | | /// <param name="signstr"></param> |
| | | /// <returns></returns> |
| | | private static string SignMD5Encrypt(string s) |
| | | { |
| | | byte[] sign = System.Security.Cryptography.MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(s)); |
| | | string signstr = string.Empty; |
| | | foreach (byte item in sign) |
| | | { |
| | | signstr += item.ToString("X2"); |
| | | } |
| | | return signstr.ToLower(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 基础服务的接口都要校验sign,计算sign签名 |
| | | /// </summary> |
| | | /// <param name="i_BodyData">body的数据</param> |
| | | /// <returns></returns> |
| | | private static string GetSignRequestJson(string i_BodyData) |
| | | { |
| | | try |
| | | { |
| | | //1. 将model实体转为Dictionary<string, object> |
| | | var paramDictionary = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(i_BodyData); |
| | | //2. 计算sign |
| | | if (paramDictionary != null) |
| | | { |
| | | paramDictionary.Add("appKey", APP_KEY); |
| | | paramDictionary.Add("timestamp", GetTimestamp()); |
| | | //2.1 字典升序 |
| | | paramDictionary = paramDictionary.OrderBy(o => o.Key).ToDictionary(o => o.Key, p => p.Value); |
| | | //2.2 拼接按URL键值对 |
| | | string str = string.Empty; |
| | | foreach (KeyValuePair<string, object> item in paramDictionary) |
| | | { |
| | | if (item.Value == null) |
| | | { |
| | | //不校验 |
| | | continue; |
| | | } |
| | | string myValue = item.Value.ToString(); |
| | | if (myValue == string.Empty) |
| | | { |
| | | //空字符也不校验 |
| | | continue; |
| | | } |
| | | if (item.Value is bool) |
| | | { |
| | | //云端那帮沙雕说bool类型必须用小写 |
| | | myValue = myValue.ToLower(); |
| | | } |
| | | str += item.Key + "=" + myValue + "&"; |
| | | } |
| | | //2.3 拼接SECRET_KEY |
| | | str = str.Substring(0, str.Length - 1) + SECRET_KEY; |
| | | //2.4 MD5转换+转小写 |
| | | var signstr = SignMD5Encrypt(str); |
| | | paramDictionary.Add("sign", signstr); |
| | | return Newtonsoft.Json.JsonConvert.SerializeObject(paramDictionary); |
| | | } |
| | | else |
| | | { |
| | | return ""; |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | |
| | | Info.UpdateContent.AddRange(Arry); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | /// <param name="saveFile">是否保存文件</param> |
| | | private void SetGatewayDataToLocalMemmory(ZbGateway localWay, ZbGatewayData.GetGwData data, bool saveFile = true) |
| | | { |
| | | if (data == null) { return; } |
| | | if (localWay == null || data == null) { return; } |
| | | |
| | | localWay.GwId = data.GwId; |
| | | localWay.GwName = data.GwName; |
| | |
| | | } |
| | | |
| | | var tempList = Common.LocalDevice.Current.GetDevicesByMac(report.DeviceAddr, false); |
| | | var res = Common.LocalDevice.Current.GetMyDeviceEnumInfo(tempList); |
| | | if (res.ConcreteType == Common.DeviceConcreteType.Airer) |
| | | if (tempList.Count > 0) |
| | | { |
| | | //晾衣架特殊处理,本地只存了端点1,其余2~5端点都不存 |
| | | deviceEpoint = 1; |
| | | var res = Common.LocalDevice.Current.GetMyDeviceEnumInfo(tempList); |
| | | if (res.ConcreteType == Common.DeviceConcreteType.Airer) |
| | | { |
| | | //晾衣架特殊处理,本地只存了端点1,其余2~5端点都不存 |
| | | deviceEpoint = 1; |
| | | } |
| | | } |
| | | //处理网关上报的数据,然后变更本地缓存 |
| | | var locadevice = Common.LocalDevice.Current.GetDevice(deviceAddr, deviceEpoint); |
| | |
| | | //小数点需要一位 |
| | | string strValue = Convert.ToInt16(receiptData, 16).ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | temperatrue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | //无符号(不会出现负数) |
| | | else if (attData.AttriButeDataType == 32 || attData.AttriButeDataType == 33) |
| | |
| | | string strValue = (shortData - 65536).ToString(); |
| | | //小数点需要一位 |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | temperatrue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | else |
| | | { |
| | | //小数点需要一位 |
| | | string strValue = shortData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | temperatrue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | } |
| | | |
| | |
| | | //小数点需要一位 |
| | | string strValue = Convert.ToInt16(receiptData, 16).ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | humidity = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | //无符号(不会出现负数) |
| | | else if (attData.AttriButeDataType == 32 || attData.AttriButeDataType == 33) |
| | |
| | | //小数点需要一位 湿度不会出现负数 |
| | | string strValue = Convert.ToUInt16(receiptData, 16).ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | humidity = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); |
| | | } |
| | | //湿度传感器 |
| | | if (locadevice is TemperatureSensor) |
| | |
| | | { |
| | | get |
| | | { |
| | | string myId = this.SSID; |
| | | //string myId = this.SSID; |
| | | |
| | | if (myId != null && myId.StartsWith("hdlZigbeeGW") == true) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | //if (myId != null && myId.StartsWith("hdlZigbeeGW") == true) |
| | | //{ |
| | | // return true; |
| | | //} |
| | | //2021.03.22 个人决定,不再检测这个东西 |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | get |
| | | { |
| | | string myId = this.SSID; |
| | | //string myId = this.SSID; |
| | | |
| | | if (myId != null && myId.StartsWith("hdlZigbeeGW-") == true) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | //if (myId != null && myId.StartsWith("hdlZigbeeGW-") == true) |
| | | //{ |
| | | // return true; |
| | | //} |
| | | //2021.03.22 个人决定,不再检测这个东西 |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | if (hadNet == 1) |
| | | { |
| | | //读取隐匿配置 |
| | | HdlBackupLogic.Current.LoadHideOption(); |
| | | //HdlBackupLogic.Current.LoadHideOption(); |
| | | //调试:强制开启后台调试App功能 |
| | | if (UserCenterResourse.HideOption.StartDebugApp == 1) |
| | | { |
| | |
| | | |
| | | //同步云端的网关id,如果本地拥有云端不存在的id,则表示应该被换绑了,直接删除 |
| | | HdlGatewayLogic.Current.SynchronizeDbGateway(); |
| | | |
| | | //读取App最低版本 |
| | | HdlFirmwareUpdateLogic.ReadAppLestVersion(); |
| | | //读取网关最低版本 |
| | | HdlFirmwareUpdateLogic.ReadGatewayLestVersion(); |
| | | } |
| | | |
| | | //断开远程Mqtt连接,重新连接 |
| | |
| | | { |
| | | //住宅切换时,检测网关连接情况 |
| | | CheckGatewayConnection(); |
| | | |
| | | } |
| | | UserCenterResourse.DicReceiveGatewayTest = null; |
| | | } |
| | |
| | | { |
| | | get { return System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, "cd8f75492cb65ef0951442460336db62"); } |
| | | } |
| | | /// <summary> |
| | | /// App公告的标识【文件】 |
| | | /// </summary> |
| | | public static string AppNoticeFile |
| | | { |
| | | get { return System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, "1e1a366c154c6c1ea10d7c5655af8b9c"); } |
| | | } |
| | | |
| | | //------------------------以下为辅助文件------------------------ |
| | | /// <summary> |
| | |
| | | public class FirmwareUpdateResourse |
| | | { |
| | | /// <summary> |
| | | /// App需要升级的URL连接 null:还没有读取过版本 string.Empty:不需要升级 有url:需要升级 |
| | | /// </summary> |
| | | public static string AppNeedUpdateUrl = null; |
| | | /// <summary> |
| | | /// 网关需要升级的对象列表 |
| | | /// </summary> |
| | | public static List<string> ListGatewayNeedUpdate = new List<string>(); |
| | | /// <summary> |
| | | /// 是否已经读取公告 |
| | | /// </summary> |
| | | public static bool ReadedNotice = false; |
| | | /// <summary> |
| | | /// 固件的升级信息 |
| | | /// </summary> |
| | | public static Dictionary<FirmwareLevelType, Dictionary<string, FirmwareHardInfo>> dicFirmwareInfo = new Dictionary<FirmwareLevelType, Dictionary<string, FirmwareHardInfo>>(); |
| | |
| | | this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1368);
|
| | | }
|
| | | }
|
| | | else
|
| | | if (this.listview == null)
|
| | | {
|
| | | this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1128);
|
| | | }
|
| | |
| | | /// </summary>
|
| | | private List<CommonDevice> listDevice = null;
|
| | | /// <summary>
|
| | | /// 设备类型
|
| | | /// </summary>
|
| | | private DeviceEnumInfo deviceEnumInfo = null;
|
| | | /// <summary>
|
| | | /// 数据是否变更
|
| | | /// </summary>
|
| | | private bool valueChanged = false;
|
| | |
| | | this.ScrollEnabled = false;
|
| | |
|
| | | this.listDevice = Common.LocalDevice.Current.GetDevicesByMac(i_deviceMac);
|
| | | this.deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(this.listDevice);
|
| | |
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBackLight));
|
| | |
| | |
|
| | | //各种背光灯的容器
|
| | | var frameLinght = new FrameLayout();
|
| | | frameLinght.Height = Application.GetRealHeight(748);
|
| | | frameLinght.Height = Application.GetRealHeight(311 + 23);
|
| | | frameLinght.Y = Application.GetRealHeight(279);
|
| | | frameLinght.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(frameLinght);
|
| | |
|
| | | //添加1-6干接点的背光灯进度条
|
| | | this.AddSixDryContactProgress(frameLinght);
|
| | | //第七干接点的背光灯进度条
|
| | | this.AddSevenDryContactProgress(frameLinght);
|
| | | //如果是国标3路10A继电器小模块,它没有第七干接点
|
| | | if (this.deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.Relay_NationalThreeLoadTenA)
|
| | | {
|
| | | //第七干接点的背光灯进度条
|
| | | frameLinght.Height = Application.GetRealHeight(748);
|
| | | this.AddSevenDryContactProgress(frameLinght);
|
| | | }
|
| | | //添加节能模式
|
| | | this.AddEnergyConservationRow(btnClickStatu, frameLinght);
|
| | |
|
| | |
| | | btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnProgress1.Text = linghtLevelInfo.panelDirectionsLevel + "%";
|
| | | frameLinght.AddChidren(btnProgress1);
|
| | | //如果是国标3路10A继电器小模块,则为1-4
|
| | | if (this.deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.Relay_NationalThreeLoadTenA)
|
| | | {
|
| | | btnProgressView1.Text = "Dry1-4";
|
| | | }
|
| | |
|
| | | //进度条
|
| | | var seekBar1 = new SeekBarControl();
|
| | |
| | | btnTemp2.Text = "100%";
|
| | | frameLinght.AddChidren(btnTemp2);
|
| | |
|
| | | //线
|
| | | var btnLine = new NormalViewControl(Application.GetRealWidth(965), ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLine.Y = Application.GetRealHeight(311);
|
| | | btnLine.Gravity = Gravity.CenterHorizontal;
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | frameLinght.AddChidren(btnLine);
|
| | | //如果不是国标3路10A继电器小模块
|
| | | if (this.deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.Relay_NationalThreeLoadTenA)
|
| | | {
|
| | | //线
|
| | | var btnLine = new NormalViewControl(Application.GetRealWidth(965), ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLine.Y = Application.GetRealHeight(311);
|
| | | btnLine.Gravity = Gravity.CenterHorizontal;
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | frameLinght.AddChidren(btnLine);
|
| | | }
|
| | |
|
| | | //如果当前是展示模板
|
| | | if (Common.Config.Instance.Home.IsShowTemplate == true)
|
| | |
| | | btnNext.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //如果不是热点模式
|
| | | if (HdlWifiLogic.Current.IsMiniGatewayHotspot == false)
|
| | | {
|
| | | //请选择hdlZigbeeGW-xxxx网络
|
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uPleaseSelectGatewayXXNet));
|
| | | return;
|
| | | }
|
| | | //if (HdlWifiLogic.Current.IsMiniGatewayHotspot == false)
|
| | | //{
|
| | | // //请选择hdlZigbeeGW-xxxx网络
|
| | | // this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uPleaseSelectGatewayXXNet));
|
| | | // return;
|
| | | //}
|
| | | var errorMsg = HdlWifiLogic.Current.StartApTcpConnection();
|
| | | if (errorMsg != null)
|
| | | {
|
| | |
| | | form.AddForm();
|
| | | };
|
| | | //如果不是Mini网关热点
|
| | | if (HdlWifiLogic.Current.IsMiniGatewayHotspot == false)
|
| | | {
|
| | | btnNext.Visible = false;
|
| | | }
|
| | | //if (HdlWifiLogic.Current.IsMiniGatewayHotspot == false)
|
| | | //{
|
| | | // btnNext.Visible = false;
|
| | | //}
|
| | |
|
| | | //图片
|
| | | var framePic = new FrameLayout();
|
| | |
| | | btnNext.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //如果还是热点模式
|
| | | if (HdlWifiLogic.Current.IsMiniGatewayHotspot == true)
|
| | | {
|
| | | //请链接家庭Wifi
|
| | | this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseLinkHomeWifi));
|
| | | return;
|
| | | }
|
| | | //if (HdlWifiLogic.Current.IsMiniGatewayHotspot == true)
|
| | | //{
|
| | | // //请链接家庭Wifi
|
| | | // this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseLinkHomeWifi));
|
| | | // return;
|
| | | //}
|
| | | this.CloseForm();
|
| | | var form = new MiniGatewaySearchForm();
|
| | | form.AddForm();
|
| | |
| | | btnNext.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //如果不是热点模式
|
| | | if (HdlWifiLogic.Current.IsGatewayHotspot == false)
|
| | | {
|
| | | //选择hdlZigbeeGW-xxxx网络
|
| | | this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseSelectGatewayXXNet));
|
| | | return;
|
| | | }
|
| | | //if (HdlWifiLogic.Current.IsGatewayHotspot == false)
|
| | | //{
|
| | | // //选择hdlZigbeeGW-xxxx网络
|
| | | // this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseSelectGatewayXXNet));
|
| | | // return;
|
| | | //}
|
| | | var errorMsg = HdlWifiLogic.Current.StartApTcpConnection();
|
| | | if (errorMsg != null)
|
| | | {
|
| | |
| | | this.AddFromAndRemoveNowForm(form);
|
| | | };
|
| | | //如果不是网关热点
|
| | | if (HdlWifiLogic.Current.IsGatewayHotspot == false)
|
| | | {
|
| | | btnNext.Visible = false;
|
| | | }
|
| | | //if (HdlWifiLogic.Current.IsGatewayHotspot == false)
|
| | | //{
|
| | | // btnNext.Visible = false;
|
| | | //}
|
| | |
|
| | | //图片
|
| | | var framePic = new FrameLayout();
|
| | |
| | | btnNext.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //如果还是热点模式
|
| | | if (HdlWifiLogic.Current.IsGatewayHotspot == true)
|
| | | {
|
| | | //请链接家庭Wifi
|
| | | this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseLinkHomeWifi));
|
| | | return;
|
| | | }
|
| | | //if (HdlWifiLogic.Current.IsGatewayHotspot == true)
|
| | | //{
|
| | | // //请链接家庭Wifi
|
| | | // this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uPleaseLinkHomeWifi));
|
| | | // return;
|
| | | //}
|
| | | var form = new WirelessApSearchForm();
|
| | | this.AddFromAndRemoveNowForm(form);
|
| | | };
|
| | |
| | | });
|
| | | };
|
| | |
|
| | | row1 = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(row1);
|
| | | row1.AddLeftCaption("蓝牙测试", 500);
|
| | | row1.AddRightArrow();
|
| | | row1.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new AndroidBluetoothTestForm1();
|
| | | form.AddForm();
|
| | | };
|
| | |
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | }
|
| | |
|
| | |
| | | && data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
|
| | | {
|
| | | //处理网关返回的温度值
|
| | | decimal temperatrue = 0;
|
| | | this.AdjustTemperatrueValue(data.AttributeData, ref temperatrue);
|
| | | decimal temperatrue = Common.LocalDevice.Current.AdjustTemperatrueValue(data.AttributeData);
|
| | |
|
| | | device.GetType().InvokeMember("currentTemperature", System.Reflection.BindingFlags.SetField, null, device, new object[] { temperatrue });
|
| | | device.ReSave();
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理网关返回的温度值
|
| | | /// </summary>
|
| | | /// <param name="value">网关返回的属性值</param>
|
| | | /// <param name="temperatrue">转换成的温度值</param>
|
| | | private void AdjustTemperatrueValue(int value, ref decimal temperatrue)
|
| | | {
|
| | | if (value == 0)
|
| | | {
|
| | | //0℃
|
| | | temperatrue = 0;
|
| | | }
|
| | | else if (value > 32767)
|
| | | {
|
| | | //负数(特殊处理)
|
| | | string strValue = (value - 65536).ToString();
|
| | | //小数点需要一位
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录温度
|
| | | temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位
|
| | | string strValue = value.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录温度
|
| | | temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | && data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
|
| | | {
|
| | | //处理网关返回的湿度值
|
| | | decimal humidity = 0;
|
| | | this.AdjustHumidityValue(data.AttributeData, ref humidity);
|
| | | decimal humidity = Common.LocalDevice.Current.AdjustHumidityValue(data.AttributeData);
|
| | |
|
| | | device.GetType().InvokeMember("currentHumidity", System.Reflection.BindingFlags.SetField, null, device, new object[] { humidity });
|
| | | device.ReSave();
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理网关返回的湿度值
|
| | | /// </summary>
|
| | | /// <param name="value">网关返回的属性值</param>
|
| | | /// <param name="temperatrue">转换成的湿度值</param>
|
| | | /// <param name="valueText">转换成的湿度值的翻译文本</param>
|
| | | private void AdjustHumidityValue(int value, ref decimal humidity)
|
| | | {
|
| | | if (value == 0)
|
| | | {
|
| | | //0%
|
| | | humidity = 0;
|
| | | }
|
| | | //不会出现负数
|
| | | else
|
| | | {
|
| | | //小数点需要一位
|
| | | string strValue = value.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录温度
|
| | | humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | && data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
|
| | | {
|
| | | //处理网关返回的温度值
|
| | | decimal temperatrue = 0;
|
| | | this.AdjustTemperatrueValue(data.AttributeData, ref temperatrue);
|
| | | decimal temperatrue = Common.LocalDevice.Current.AdjustTemperatrueValue(data.AttributeData);
|
| | |
|
| | | device.GetType().InvokeMember("currentTemperature", System.Reflection.BindingFlags.SetField, null, device, new object[] { temperatrue });
|
| | | device.ReSave();
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理网关返回的温度值
|
| | | /// </summary>
|
| | | /// <param name="value">网关返回的属性值</param>
|
| | | /// <param name="temperatrue">转换成的温度值</param>
|
| | | private void AdjustTemperatrueValue(int value, ref decimal temperatrue)
|
| | | {
|
| | | if (value == 0)
|
| | | {
|
| | | //0℃
|
| | | temperatrue = 0;
|
| | | }
|
| | | else if (value > 32767)
|
| | | {
|
| | | //负数(特殊处理)
|
| | | string strValue = (value - 65536).ToString();
|
| | | //小数点需要一位
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录温度
|
| | | temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位
|
| | | string strValue = value.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录温度
|
| | | temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | && data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
|
| | | {
|
| | | //处理网关返回的湿度值
|
| | | decimal humidity = 0;
|
| | | this.AdjustHumidityValue(data.AttributeData, ref humidity);
|
| | | decimal humidity = Common.LocalDevice.Current.AdjustHumidityValue(data.AttributeData);
|
| | |
|
| | | device.GetType().InvokeMember("currentHumidity", System.Reflection.BindingFlags.SetField, null, device, new object[] { humidity });
|
| | | device.ReSave();
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 处理网关返回的湿度值
|
| | | /// </summary>
|
| | | /// <param name="value">网关返回的属性值</param>
|
| | | /// <param name="temperatrue">转换成的湿度值</param>
|
| | | /// <param name="valueText">转换成的湿度值的翻译文本</param>
|
| | | private void AdjustHumidityValue(int value, ref decimal humidity)
|
| | | {
|
| | | if (value == 0)
|
| | | {
|
| | | //0%
|
| | | humidity = 0;
|
| | | }
|
| | | //不会出现负数
|
| | | else
|
| | | {
|
| | | //小数点需要一位
|
| | | string strValue = value.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录温度
|
| | | humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | rowAbount.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new Abount.AbountForm();
|
| | | form.AddForm();
|
| | | form.AddForm(false);
|
| | | };
|
| | |
|
| | | if (UserCenterResourse.HideOption.CenterHideMenu == 1)
|
| | |
| | | } |
| | | else |
| | | { |
| | | if (co2Quality == 1) |
| | | if (pmQuality == 1) |
| | | { |
| | | curQuality = 1; |
| | | } |
| | | else |
| | | { |
| | | if (co2Quality > 2) |
| | | if (pmQuality > 2) |
| | | { |
| | | curQuality = 3; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 主网关 |
| | | /// </summary> |
| | | /// <value>The main gate way.</value> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public static ZbGateway MainGateWay |
| | | { |
| | | get |
| | |
| | | /// 个月
|
| | | /// </summary>
|
| | | public const int uOneMonth1 = 16230;
|
| | | /// <summary>
|
| | | /// 发现APP新版本,马上升级{0}开启新体验哦~
|
| | | /// </summary>
|
| | | public const int uAppUpdateMsg1 = 16231;
|
| | | /// <summary>
|
| | | /// 发现网关新版本,马上升级{0}开启新体验哦~
|
| | | /// </summary>
|
| | | public const int uGatewayUpdateMsg1 = 16232;
|
| | | /// <summary>
|
| | | /// 公告
|
| | | /// </summary>
|
| | | public const int uNotice = 16233;
|
| | |
|
| | |
|
| | | //★★★★下面这些是接口的返回信息翻译,从18000开始★★★★
|
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\AccountResetPWDSuccess.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\Controls\PhoneEmailSelectControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Login\PhoneEmailForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\AppNoticeForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceAcDetailCardMethord.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Category\SelectFloorForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\Category\SelectHouseForm.cs" />
|
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceMiniLightDetailCardForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DevicePmSensorDetailCardForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceRelayDetailCardForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\ControlForm\DeviceTemperatureHumidityDetailCardForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceAirQualitySensorCardControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceColorTemperatureCardControl.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\MainPage\Controls\DeviceCard\DeviceFreshAirCardControl.cs" />
|
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\Guide\GuideRoomForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HdlBackup\HdlAutoBackupForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HdlBackup\HdlBackupListForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\AndroidBluetoothTestForm1.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\AndroidBluetoothTestForm2.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionDirectoryListForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionFileContentForm.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\HideOption\HideOptionGatewayInfoMenuForm.cs" />
|