From 967050bf6c665227823da37e04d40205c7af5a77 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 24 五月 2022 17:07:03 +0800 Subject: [PATCH] 备份 --- HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs | 6 + HDL-ON_Android/Properties/AndroidManifest.xml | 4 HDL-ON_iOS/Info.plist | 4 HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs | 1 HDL_ON/Common/ApiUtlis.cs | 4 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs | 7 + HDL_ON/DAL/DriverLayer/Control.cs | 77 ++++++++++++++++++ HDL_ON/UI/UI2/FuntionControlView/Video/WanderingAlarmPage.cs | 2 HDL_ON/DAL/Mqtt/MqttClient.cs | 11 ++ HDL_ON/UI/UI1-Login/LoginPage.cs | 3 HDL_ON/Entity/FunctionList.cs | 19 ++++ HDL_ON/Entity/Function/Sensor.cs | 100 ++++++++++++++++++++++++ 12 files changed, 220 insertions(+), 18 deletions(-) diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index df0dac1..eabdc56 100644 --- a/HDL-ON_Android/Properties/AndroidManifest.xml +++ b/HDL-ON_Android/Properties/AndroidManifest.xml @@ -1,6 +1,6 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.5.6" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202205181"> - <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28" /> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.5.6" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202205241"> + <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> <!--鍙嬬洘--> <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>--> <!--<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>--> diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index fb0e6ed..bdc5402 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -100,9 +100,9 @@ <key>UIStatusBarStyle</key> <string>UIStatusBarStyleLightContent</string> <key>CFBundleShortVersionString</key> - <string>1.5.502204211</string> + <string>1.5.502205201</string> <key>CFBundleVersion</key> - <string>1.5.504211</string> + <string>1.5.505201</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Use geographic location to provide services such as weather</string> <key>NSAppleMusicUsageDescription</key> diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 75c9bf3..f7b62c8 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -159,7 +159,7 @@ endTime = DateTime.Now.AddSeconds(5); MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛"); - var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); + var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); if (deviceList == null) { deviceList = new DevcieApiPack(); @@ -171,7 +171,7 @@ var deviceResult2 = Ins.HttpRequest.GetDeviceList("30", Convert.ToInt32(deviceList.pageNo) + 1 + ""); if (deviceResult2.Code == StateCode.SUCCESS) { - var deviceList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); + var deviceList2 = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); deviceList.pageNo = deviceList2.pageNo; deviceList.list.AddRange(deviceList2.list); } diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index bd24f80..5672c7a 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -94,7 +94,7 @@ } set { - if (_GatewayOnline_Local != value) + //if (_GatewayOnline_Local != value) { _GatewayOnline_Local = value; if (value) @@ -129,7 +129,7 @@ } set { - if (_GatewayOnline_Cloud != value) + //if (_GatewayOnline_Cloud != value) { _GatewayOnline_Cloud = value; if(GatewayOnline_Local) @@ -656,6 +656,79 @@ } /// <summary> + /// 鍙戦�佽鍙栧懡浠� + /// 鑷姩鍒ゆ柇鏄惁涓篈鍗忚璁惧 + /// </summary> + public void SendReadCommand(List<Function> functions, bool forceRemote = false) + { + List<string> sids = new List<string>(); + foreach (Function function in functions) + { + sids.Add(function.sid); + function.refreshTime = DateTime.Now; + } + if (forceRemote) + { + + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.RefreshDeviceStatus(sids); + } + else + { + if (Ins.GatewayOnline_Local) + { + + if (DB_ResidenceData.Instance.GatewayType == 0) + { + try + { + var busClient = new Control_Udp(); + foreach (Function function in functions) + { + busClient.ReadBusData(function); + } + + } + catch (Exception ex) + { + MainPage.Log($"鍙戦�佹暟鎹紓甯�: {ex.Message}"); + } + } + else + { + var objects = new List<Dictionary<string, string>>(); + + + foreach (Function function in functions) + { + var readKey = new Dictionary<string, string>(); + readKey.Add("sid", function.sid); + objects.Add(readKey); + } + + + var readDataObj = new AlinkReadFunctionStatusObj() + { + id = Ins.msg_id.ToString(), + objects = objects, + time_stamp = Utlis.GetTimestamp() + }; + var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj); + var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ReadStatus, functionControlDataJson); + MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); + new Control_Udp().SendLocalHdlLinkData(sendBytes, readDataObj.id); + } + } + else + { + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.RefreshDeviceStatus(sids); + } + } + } + + + /// <summary> /// 瀹夐槻鎺у埗 /// </summary> public void ControlSecurity(SecurityAlarm securityAlarm,string state) diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index 1f26a36..882cf3b 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -1097,8 +1097,17 @@ //鍒涘缓AES瑙e瘑鍣ㄥ璞� var cTransform = rm.CreateDecryptor(); + byte[] reData = null; //浣跨敤AES灏嗗瘑鏂囨祦杞垚鏄庢枃鐨勫瓧鑺傛暟缁� - return cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); + try + { + reData = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + return reData; } #endregion diff --git a/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs b/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs index 56ec48f..abbdbd3 100644 --- a/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs +++ b/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs @@ -117,6 +117,7 @@ if (mHDLSipInfo == null) return; #if __IOS__ + //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login("1003", "123456", "192.168.31.194:5060"); //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login("6666", "85521566", "116.62.26.215:5060"); Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm); #else diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs index 581343d..f07f304 100644 --- a/HDL_ON/Entity/Function/Sensor.cs +++ b/HDL_ON/Entity/Function/Sensor.cs @@ -65,7 +65,7 @@ } } double value = 0.0; - double.TryParse( attr.state,out value); + double.TryParse(attr.state, out value); return Convert.ToDouble(value); } @@ -150,7 +150,7 @@ return _intervalValue; } - public string Unit(Function function) + public string Unit(Function function) { string unit = ""; @@ -173,7 +173,7 @@ unit = "ug/m虏"; break; case SPK.SensorTemperature: - unit = "掳C"; + unit = "掳C"; break; case SPK.SensorTVOC: unit = "PPB"; @@ -338,6 +338,69 @@ } return _levelTextList; } + + /// <summary> + /// 鑾峰彇 + /// </summary> + /// <param name="function"></param> + /// <returns></returns> + public uint GetCurColor(Function function) + { + var spk = function.spk; + var values = GetValues(function); + uint level = 0x00000000; + if (function.attrKeyConfigs.Count > 0) + { + + foreach (var attrKey in function.attrKeyConfigs) + { + if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", ""))) + { + foreach (var info in attrKey.configs) + { + if ((Convert.ToInt32(info.start) >= values) && (Convert.ToInt32(info.end) < values)) + { + return Convert.ToUInt32(info.color, 16); + } + } + } + } + } + + return level; + } + + /// <summary> + /// 鑾峰彇鏂囨湰 + /// </summary> + /// <param name="function"></param> + /// <returns></returns> + public string GetCurText(Function function) + { + var spk = function.spk; + var values = GetValues(function); + var level = ""; + if (function.attrKeyConfigs.Count > 0) + { + + foreach (var attrKey in function.attrKeyConfigs) + { + if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", ""))) + { + foreach (var info in attrKey.configs) + { + if ((Convert.ToInt32(info.start) >= values) && (Convert.ToInt32(info.end) < values)) + { + return info.desc; + } + } + } + } + } + + return level; + } + /// <summary> /// 褰撳墠绛夌骇 /// </summary> @@ -346,6 +409,37 @@ var spk = function.spk; var values = GetValues(function); int level = 1; + + + + if (function.attrKeyConfigs.Count > 0) + { + + foreach (var attrKey in function.attrKeyConfigs) + { + if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", ""))) + { + level = 1; + if(attrKey.configs.Count == 0) + { + break; + } + foreach (var info in attrKey.configs) + { + if ((Convert.ToDouble(info.start) < values) && (Convert.ToDouble(info.end) >= values)) + { + return level; + } + level++; + + } + } + } + return 1; + } + + + switch (spk) { case SPK.SensorPm25: diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 208eb41..9b724ca 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -468,12 +468,25 @@ if(DriverLayer.Control.Ins.GatewayOnline_Local) { + + //List<Function> functions = GetDeviceFunctionList(SPK.BrandType.Hdl); + //var sss = functions.OrderBy((obj) => obj.collect); + + List<Function> readList = new List<Function>(); foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl)) { + readList.Add(function); MainPage.Log($"璇诲彇鍔熻兘鐘舵�侊細{function.name} : {function.sid} "); - Control.Ins.SendReadCommand(function); + if (readList.Count > 9) + { + Control.Ins.SendReadCommand(readList); + } } - if(DB_ResidenceData.Instance.GatewayType == 1) + if (readList.Count > 0) + { + Control.Ins.SendReadCommand(readList); + } + if (DB_ResidenceData.Instance.GatewayType == 1) { Dictionary<string, string> pairs = new Dictionary<string, string>(); string sendId = Control.Ins.msg_id.ToString(); @@ -490,6 +503,8 @@ var page = new List<string>(); int count = 0; + //List<Function> functions = GetDeviceFunctionList(SPK.BrandType.Hdl); + //var sss = functions.OrderBy((obj) => obj.collect); foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl)) { page.Add(function.deviceId); diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 988eb0c..4b8c43a 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -217,7 +217,7 @@ //etAccount.Text = "18316120654";//tujie //etAccount.Text = "13450425807";//榛勭婧� knx椤圭洰 etAccount.Text = "18244942707"; - etAccount.Text = "13826414433";//闄堜紵娼� 鑷爺鍙瀵硅 + etAccount.Text = "3083375423@qq.com";//闄堜紵娼� 鑷爺鍙瀵硅 } else { @@ -245,6 +245,7 @@ //etAccount.Text = "info@smartlife-ks.com"; //etAccount.Text = "551775569@qq.com";//wcf //etAccount.Text = "15626203746"; + etAccount.Text = "18244942707"; //etAccount.Text = "zhangquansongjava@163.com"; //etAccount.Text = "s.savinov@hdlautomation.ru"; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs index 09d981d..fc62ae0 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs @@ -155,7 +155,11 @@ function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString()); - d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); + d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime)); + if (dimmerBar.Progress > 0) + { + d.Add(FunctionAttributeKey.OnOff, "on"); + } Control.Ins.SendWriteCommand(function, d); //function.fadeTime = barFadeTime.Progress; btnBrightnessText.Text = dimmerBar.Progress + "%"; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs index 400c887..3205232 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs @@ -93,6 +93,7 @@ dimmerBar.OnStartTrackingTouchEvent = (sender, e) => { onDimmerBar = true; + dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); }; dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { @@ -100,13 +101,17 @@ function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress); System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString()); + if(dimmerBar.Progress > 0) + { + d.Add(FunctionAttributeKey.OnOff, "on"); + } Control.Ins.SendWriteCommand(function, d); btnBrightnessText.Text = dimmerBar.Progress + "%"; }; //20201223 鍒犻櫎婊戝姩鍙戦�佸懡浠わ紝闃叉鎺т欢璺冲姩 dimmerBar.OnProgressChangedEvent = (sender, e) => { - dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); + //function.fadeTime = 0; //if (!btnSwitch.IsSelected) //{ diff --git a/HDL_ON/UI/UI2/FuntionControlView/Video/WanderingAlarmPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Video/WanderingAlarmPage.cs index e45fa82..d6b5a5e 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Video/WanderingAlarmPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Video/WanderingAlarmPage.cs @@ -171,7 +171,7 @@ }; }); - System.Threading.Thread.Sleep(50); + System.Threading.Thread.Sleep(20); } Application.RunOnMainThread(() => -- Gitblit v1.8.0